feat: dynamically load export converters from jsdelivr CDN#3558
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
ae3e5e3 to
98254c4
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ae3e5e384b
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| projectName: string | ||
| }) => { | ||
| const { circuitJsonToStep } = await importer("circuit-json-to-step") | ||
| const { circuitJsonToStep } = await loadStepConverter() |
There was a problem hiding this comment.
Register the GLTF converter before STEP export
When users export STEP with components (this flow always passes includeComponents: true below), circuit-json-to-step@0.0.33 delegates component mesh generation to circuit-json-to-gltf via a dynamic import and falls back to globalThis.tscircuitDynamicModules. This new loader only imports the STEP module, so the browser/CDN path has no registered GLTF module to fall back to and STEP exports with components can fail before producing a file. Please preload/register the GLTF converter for the STEP path or use a STEP bundle that includes that dependency.
Useful? React with 👍 / 👎.
98254c4 to
bd8b754
Compare
|
This PR has been automatically marked as stale because it has had no recent activity. It will be closed if no further activity occurs. |
bd8b754 to
fa96b81
Compare
|
Rebased this PR on current main to resolve the merge conflict from upstream dependency updates. The diff is still scoped to dynamic jsdelivr converter loading/removing bundled converter deps.\n\nCurrent validation after rebase:\n- |
|
This PR has been automatically marked as stale because it has had no recent activity. It will be closed if no further activity occurs. |
fa96b81 to
50b0601
Compare
|
Rebased this PR again on current main after the latest upstream package/version updates. The conflict was limited to |
50b0601 to
0809a78
Compare
fd94d61 to
9e54c47
Compare
9e54c47 to
effa339
Compare
|
Rebased once more on current Validation after this rebase:
GitHub checks are green again ( |
effa339 to
01208b4
Compare
|
Rebased again on current Local validation on this commit (
Vercel is green. The GitHub Actions workflows ( |
01208b4 to
f8020c2
Compare
f8020c2 to
0d842cd
Compare
0d842cd to
413239b
Compare
413239b to
a08f405
Compare
Summary
Fixes tscircuit/tscircuit#1539
/claim tscircuit/tscircuit#1539
Instead of bundling heavy converter packages into the standalone bundle, each converter is now lazy-loaded on demand from pinned jsdelivr CDN URLs when the user requests an export.
What changed
lib/optional-features/exporting/dynamic-converters.tswith typed dynamic loaders, pinned jsdelivr ESM URLs, singleton-promise cache, and retry-after-failure behavior.@tscircuit/internal-dynamic-importconverter calls in export paths.BomTable's static BOM converter import with the dynamic loader.devDependencies.Notes
This intentionally leaves
export-pinout-svg.tsunchanged because it loadscircuit-to-svg, not one of thecircuit-json-to-*converter packages targeted by the issue.Validation
bun test bun run format:check bun run build:lib bun run build:standalone bun run build:standalone-preview git diff --checkResults:
bun test: 25/25 passedformat:check: cleanbuild:lib: successbuild:standalone: successbuild:standalone-preview: successgit diff --check: cleanRisk
If jsdelivr is unavailable, export actions that need these converters will fail until the CDN recovers. The URLs are pinned to exact versions to keep behavior reproducible.