{"name":"@cspell/dynamic-import","version":"8.14.1","keywords":["module","esm","cjs","import","require"],"author":"Jason Dent <jason@streetsidesoftware.nl>","license":"MIT","_id":"@cspell/dynamic-import@8.14.1","homepage":"https://github.com/streetsidesoftware/cspell/tree/main/packages/dynamic-import#readme","bugs":{"url":"https://github.com/streetsidesoftware/cspell"},"dist":{"shasum":"ed188954ba8fda2ab93180ac2470763e37195346","tarball":"http://registry-npm.ywwl.com/@cspell/dynamic-import/download/@cspell/dynamic-import-8.14.1.tgz","fileCount":9,"integrity":"sha512-zGnymwieuFigqz839cKCF9JB90nUm50SMqopWClMl4LFOpqpuCucn/Slh4CLGu2vri4iqCvRweDxZCsi/5qYiw==","signatures":[{"sig":"MEUCIFH8ZlZCcAzEDRD6sBtQANtYf8jUP+XcpEt9hq/F73ASAiEA1tWUO8zgKTIJHLH4adPePwcIuqGZsk2C2/5L53+/U5M=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":8102,"size":3197,"noattachment":false,"key":"/@cspell/dynamic-import/-/@cspell/dynamic-import-8.14.1.tgz"},"main":"./dist/cjs/index.js","type":"commonjs","types":"./dist/cjs/index.d.ts","module":"./dist/esm/index.mjs","engines":{"node":">=18.0"},"exports":{".":{"import":"./dist/esm/index.mjs","require":"./dist/cjs/index.js"}},"gitHead":"5552bdba15adc8c073dd33791f30329147c5c64b","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/3.8.0/node@v18.20.4+x64 (linux)","description":"Dynamic Module Loader","directories":{},"sideEffects":false,"_nodeVersion":"18.20.4","dependencies":{"import-meta-resolve":"^4.1.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/dynamic-import_8.14.1_1723895859604_0.07563521911257909","host":"s3://npm-registry-packages"},"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":1723895859788,"maintainers":[{"name":"jason-dent","email":"jason@streetsidesoftware.nl"}],"_cnpm_publish_time":1723895859788,"dist-tags":{"latest":"10.4.0","next":"10.4.0-alpha.1"}}