{"name":"@cspell/dynamic-import","version":"10.3.5","keywords":["module","esm","cjs","import","require"],"author":{"name":"Jason Dent","email":"jason@streetsidesoftware.nl"},"license":"MIT","_id":"@cspell/dynamic-import@10.3.5","maintainers":[{"name":"jason-dent","email":"jason@streetsidesoftware.nl"}],"homepage":"https://github.com/streetsidesoftware/cspell/tree/main/packages/dynamic-import#readme","bugs":{"url":"https://github.com/streetsidesoftware/cspell"},"dist":{"shasum":"8914014b9844d07d79a92a7503ae932c798e0a52","tarball":"http://registry-npm.ywwl.com/@cspell/dynamic-import/download/@cspell/dynamic-import-10.3.5.tgz","fileCount":9,"integrity":"sha512-qg+KtbuVMP1WPZO6hj9jux1+UuaCUUoQ+/Rqh0G7LIK+72T81lv8tmJMymiCr31Wjd9w3cs0nOYdPZJ9o0ypQQ==","signatures":[{"sig":"MEYCIQCdF4NC0pwBTjP4gEyg5CqO1RQ6mIuyVFQxuXcHmgxd8wIhAJL7E67jEdNuuzmNpmC6ziWRotat4zetii29DAdhCyeg","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"},{"sig":"MEQCIGfyOkynSY8LUx5YwuQwW1QxcZEvllMdYTubsiNvMit8AiASs1w8id3UILxcN4VVWhyLHm6tSSjtN/uQrj9YR+sXpQ==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@cspell%2fdynamic-import@10.3.5","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":8250,"size":3254,"noattachment":false,"key":"/@cspell/dynamic-import/-/@cspell/dynamic-import-10.3.5.tgz"},"main":"./dist/cjs/index.js","type":"commonjs","types":"./dist/cjs/index.d.ts","module":"./dist/esm/index.mjs","engines":{"node":">=22.18.0"},"exports":{".":{"import":"./dist/esm/index.mjs","require":"./dist/cjs/index.js"}},"gitHead":"f37a244a54b686fc1ac11272d6019b9a059b062a","scripts":{"test":"vitest run","build":"tsc -b . -f","clean":"shx rm -rf dist coverage","watch":"tsc -b . --watch -f","coverage":"vitest run --coverage","test-watch":"vitest","build:clean":"pnpm clean && pnpm build","clean-build":"pnpm build:clean"},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:1a46451c-a13b-4d24-bd2c-c3da381683f8"}},"repository":{"url":"git+https://github.com/streetsidesoftware/cspell.git","type":"git","directory":"packages/dynamic-import"},"_npmVersion":"lerna/5.6.1/node@v24.21.0+x64 (linux)","description":"Dynamic Module Loader","directories":{},"sideEffects":false,"_nodeVersion":"24.21.0","dependencies":{"@cspell/url":"10.3.5","import-meta-resolve":"^4.2.0"},"publishConfig":{"access":"public","provenance":true},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/dynamic-import_10.3.5_1790540340699_0.9660982007747774","host":"s3://npm-registry-packages-npm-production"},"readme":"# `@cspell/dynamic-import`\n\nA small library to assist with dynamically loading CommonJS and ESM modules from either CommonJS or ESM modules.\n\n## Install\n\n```sh\nnpm install -S @cspell/dynamic-import\n```\n\n## Usage\n\n### Example ESM Package\n\nExample loading [chalk v5](https://www.npmjs.com/package/chalk), which is an ESM-only module.\n\n**TypeScript CommonJS**\n\n```ts\nimport { dynamicImport } from '@cspell/dynamic-import';\n\nconst pChalk = dynamicImport<typeof import('chalk')>('chalk', __dirname);\n```\n\n**TypeScript ESM**\n\n```ts\nimport { dynamicImport } from '@cspell/dynamic-import';\n\nconst pChalk = dynamicImport<typeof import('chalk')>('chalk', import.meta.url);\n```\n\n### Example ESM files\n\n**TypeScript CommonJS**\n\n```ts\nimport { dynamicImport } from '@cspell/dynamic-import';\n\nconst pIndex = dynamicImport<typeof import('../esm/index.mjs')>('../esm/index.mjs', __dirname);\n```\n\n<!--- @@inject: ../../static/footer.md --->\n\n<br/>\n\n---\n\n<p align=\"center\">Brought to you by<a href=\"https://streetsidesoftware.com\" title=\"Street Side Software\"><img width=\"16\" alt=\"Street Side Software Logo\" src=\"https://i.imgur.com/CyduuVY.png\" /> Street Side Software</a></p>\n\n<!--- @@inject-end: ../../static/footer.md --->\n\n<!--- cspell:dictionaries typescript --->\n","publish_time":1790540340768,"_cnpm_publish_time":1790540340768,"dist-tags":{"latest":"10.4.0","next":"10.4.0-alpha.1"}}