-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
feat: add rootDir option and set __svelte_meta.file like in svelte4 #11627
Conversation
🦋 Changeset detectedLatest commit: f767eb5 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 |
packages/svelte/src/compiler/phases/3-transform/client/transform-client.js
Show resolved
Hide resolved
working on this |
I think this is ready to go, though there are some Windows failures that I don't really understand — forward slashes versus backward slashes — and will leave to someone else |
oh and I guess we should summon @Conduitry in case he wants to veto the fallback to |
looks nice now. I did wonder about using state for it as well but cheaped out 👍 the windows path separator issue is really unfortunate. Do we want to go the lengths to normalize \ to / to avoid it? |
I mean I don't understand how and where it's happening. surely |
Fixed it by normalizing slashes. The slashes were a mix of |
lots of tests fail because there are still ... in various expects and i havn't found a way to automatically update them.
tbd: not defaulting to process.cwd would make svelte more independant, but means bundler plugins will have to set it to avoid issues with path leaks
it gets complicated with error handling (stacktraces) and sourcemap merging that might need the absolute path still.
In general we should try to use the stripped filename everywhere in output, not just in dev mode like in this PR.
This is basically the minimum way i think it could be added, feel free to completely refactor/change/close this, but for svelte-inspector to work we need
__svelte_meta.file to be
src/foo/Bar.svelte
and not.../foo/Bar.svelte
Svelte 5 rewrite
Please note that the Svelte codebase is currently being rewritten for Svelte 5. Changes should target Svelte 5, which lives on the default branch (
main
).If your PR concerns Svelte 4 (including updates to svelte.dev.docs), please ensure the base branch is
svelte-4
and notmain
.Before submitting the PR, please make sure you do the following
feat:
,fix:
,chore:
, ordocs:
.Tests and linting
pnpm test
and lint the project withpnpm lint