fix: introduce post-packaging fixing of js imports#483
Merged
Conversation
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
✅ Deploy Preview for svelteplot ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
📦 Preview package for this PR is published! Version: Install it with: npm install svelteplot@pr-483
# or install the specific version
npm install svelteplot@0.10.3-pr-483.0 |
|
📦 Preview package for this PR is published! Version: Install it with: npm install svelteplot@pr-483
# or install the specific version
npm install svelteplot@0.10.3-pr-483.1 |
|
📦 Preview package for this PR is published! Version: Install it with: npm install svelteplot@pr-483
# or install the specific version
npm install svelteplot@0.10.3-pr-483.2 |
|
📦 Preview package for this PR is published! Version: Install it with: npm install svelteplot@pr-483
# or install the specific version
npm install svelteplot@0.10.3-pr-483.3 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
the Svelte Playground/REPL import of SveltePlot fails when we're importing TS files without the JS extension.
This pull request introduces a post-packaging script to automatically fix missing
.jsextensions in relative imports within thedist/directory, ensuring compatibility with strict ESM environments. It also adds themagic-stringdependency for efficient code rewriting and updates the packaging workflow. The previous script for checking missing.jsextensions is removed in favor of the new automated fixer.Packaging and Build Process Improvements:
prepackscript inpackage.jsonnow runsscripts/fix-js-imports.jsaftersvelte-package, automating the correction of import extensions in thedist/output.magic-stringdependency topackage.jsonandpnpm-lock.yamlfor advanced string manipulation during import rewriting. [1] [2]Script Changes:
scripts/fix-js-imports.js, a script that scans files indist/, detects extensionless relative imports, and rewrites them to fully specified.jsor/index.jspaths usingmagic-string.scripts/check-js-extensions.js, which previously only checked for missing.jsextensions without fixing them.