@tscircuit/internal-dynamic-import 0.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +22 -0
- package/dist/index.d.ts +3007 -0
- package/dist/index.js +41 -0
- package/dist/index.js.map +1 -0
- package/package.json +49 -0
package/README.md
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# @tscircuit/internal-dynamic-import
|
|
2
|
+
|
|
3
|
+
This module simplifies dynamically importing tscircuit modules, especially when you always want to use the latest version.
|
|
4
|
+
|
|
5
|
+
It is also approximately type-safe, meaning we package bundled declaration types for a recent version of the supported modules here while leaving the runtime implementation remote.
|
|
6
|
+
|
|
7
|
+
```tsx
|
|
8
|
+
import importer from "@tscircuit/internal-dynamic-import"
|
|
9
|
+
|
|
10
|
+
async function main() {
|
|
11
|
+
const { convertSoupToGerberCommands } = await importer("circuit-json-to-gerber")
|
|
12
|
+
|
|
13
|
+
// Import a specific version
|
|
14
|
+
const { CircuitJsonToKicadProConverter } = await importer(
|
|
15
|
+
"circuit-json-to-kicad@0.0.91",
|
|
16
|
+
)
|
|
17
|
+
|
|
18
|
+
// ...
|
|
19
|
+
}
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
Runtime imports are resolved through jsDelivr's bundled ESM endpoint at `https://esm.run/...`, so omitting a version uses the latest published package and adding `@...` preserves the requested version/tag.
|