{"name":"@cspell/dynamic-import","version":"9.1.1","keywords":["module","esm","cjs","import","require"],"author":"Jason Dent <jason@streetsidesoftware.nl>","license":"MIT","_id":"@cspell/dynamic-import@9.1.1","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":"1f8431d1cab13d85838c99a27095b4db86e84ada","tarball":"http://registry-npm.ywwl.com/@cspell/dynamic-import/download/@cspell/dynamic-import-9.1.1.tgz","fileCount":9,"integrity":"sha512-jcg5Wti4kcPh4Deds009MEZvuN3tViUft079MTsdSpNPNhRf/gKwSIQnkda9g4ppsVPh5mxkE0nUZLxfZRZYMg==","signatures":[{"sig":"MEYCIQC4sitYZy9gU5uLpYEy6eRQvT1uf6D42ehmkOgb6LO3dQIhAM+5Du9nO6UFKDtsxYEhlKUEuLBA8KzxiTvw3y7kdibg","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@cspell%2fdynamic-import@9.1.1","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":8244,"size":3251,"noattachment":false,"key":"/@cspell/dynamic-import/-/@cspell/dynamic-import-9.1.1.tgz"},"main":"./dist/cjs/index.js","type":"commonjs","types":"./dist/cjs/index.d.ts","module":"./dist/esm/index.mjs","engines":{"node":">=20"},"exports":{".":{"import":"./dist/esm/index.mjs","require":"./dist/cjs/index.js"}},"gitHead":"40c6e1a331f38a0c008aacf2cb527270752c35ad","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":"jason-dent","email":"jason@streetsidesoftware.nl"},"repository":{"url":"https://github.com/streetsidesoftware/cspell.git","type":"git","directory":"packages/dynamic-import"},"_npmVersion":"lerna/4.4.1/node@v20.19.2+x64 (linux)","description":"Dynamic Module Loader","directories":{},"sideEffects":false,"_nodeVersion":"20.19.2","dependencies":{"@cspell/url":"9.1.1","import-meta-resolve":"^4.1.0"},"publishConfig":{"access":"public","provenance":true},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/dynamic-import_9.1.1_1749908658406_0.842566947448647","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":1749908658612,"_cnpm_publish_time":1749908658612,"dist-tags":{"latest":"10.4.0","next":"10.4.0-alpha.1"}}