New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[fix] allow any top-level keys in svelte config #2267
Conversation
🦋 Changeset detectedLatest commit: 66fdaa8 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! Just a couple of questions
I'd be happy to use superstruct or something similar. I hadn't seen that library and think we only coded it ourselves out of unfamiliarity with other options. I've heard other also ponder if we should have a package specifically for svelte config, but no one's really made a proposal or wanted to take on that work. I think it's something folks would be open to though since I have heard it before |
I think misplacing kit options outside |
Yeah, it would be nice to use that instead to also remove the need to maintain its tests. But I guess there's already an infrastructure setup for custom validation so until some issue comes up with it then we could consider superstruct. I'd be happy to tackle that.
It would be nice to have something like
@ignatiusmb I'd be afraid that it would cause false positives for that. If one day a package decides to use a top-level key that's the same as |
I'd say the odds are pretty slim and we should not encourage packages, at least community-made, to directly use top-level config and instead put them under a name like kit does. I'm thinking we could at least warn them in the console or do a double-check using its value type or if the keys matches what we expected in the config. But, I guess we can discuss more when this is handled outside of kit, so this should do for now. |
Thanks! |
Sure, feel free to send a PR for superstruct if you're interested I agree that options should be under a namespace like |
Fixes #2253
Allow any top-level keys to be added to the svelte config, essentially skipping validation for the top-level keys only.
Unrelated side note: I'm not sure why we're not using something like superstruct to handle validation. And if the spec of the svelte config should live here?
Before submitting the PR, please make sure you do the following
Tests
pnpm test
and lint the project withpnpm lint
andpnpm check
Changesets
pnpx changeset
and following the prompts. All changesets should bepatch
until SvelteKit 1.0