{"name":"@cspell/dynamic-import","publishConfig":{"access":"public"},"version":"8.14.4","description":"Dynamic Module Loader","keywords":["module","esm","cjs","import","require"],"author":"Jason Dent <jason@streetsidesoftware.nl>","homepage":"https://github.com/streetsidesoftware/cspell/tree/main/packages/dynamic-import#readme","license":"MIT","type":"commonjs","sideEffects":false,"main":"./dist/cjs/index.js","module":"./dist/esm/index.mjs","types":"./dist/cjs/index.d.ts","exports":{".":{"require":"./dist/cjs/index.js","import":"./dist/esm/index.mjs"}},"scripts":{"build":"tsc -b . -f","build:clean":"pnpm clean && pnpm build","clean":"shx rm -rf dist coverage","clean-build":"pnpm build:clean","coverage":"vitest run --coverage","test-watch":"vitest","test":"vitest run","watch":"tsc -b . --watch -f"},"repository":{"type":"git","url":"https://github.com/streetsidesoftware/cspell.git","directory":"packages/dynamic-import"},"bugs":{"url":"https://github.com/streetsidesoftware/cspell"},"engines":{"node":">=18.0"},"dependencies":{"import-meta-resolve":"^4.1.0"},"gitHead":"aeedd49f6ef20799eed04076093291fcacbc4b84","_nodeVersion":"18.20.4","_npmVersion":"lerna/3.9.1/node@v18.20.4+x64 (linux)","_id":"@cspell/dynamic-import@8.14.4","dist":{"integrity":"sha512-GjKsBJvPXp4dYRqsMn7n1zpnKbnpfJnlKLOVeoFBh8fi4n06G50xYr+G25CWX1WT3WFaALAavvVICEUPrVsuqg==","shasum":"c3a8a9f5a8c6d6f8ccd2612a367bcc870dd07244","tarball":"http://registry-npm.ywwl.com/@cspell/dynamic-import/download/@cspell/dynamic-import-8.14.4.tgz","fileCount":9,"unpackedSize":8102,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIAoCIFjPOIeUiojvzh0SDyeO0g8CS9tH5Dd2ETqN0raVAiABfphwshN6qAiG7+DmasXlOFOPf09oycDKLLOlf1nuYA=="}],"size":3196,"noattachment":false,"key":"/@cspell/dynamic-import/-/@cspell/dynamic-import-8.14.4.tgz"},"_npmUser":{"name":"jason-dent","email":"jason@streetsidesoftware.nl"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/dynamic-import_8.14.4_1726639006509_0.4574475683725374"},"_hasShrinkwrap":false,"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":1726639006662,"maintainers":[{"name":"jason-dent","email":"jason@streetsidesoftware.nl"}],"_cnpm_publish_time":1726639006662,"dist-tags":{"latest":"10.4.0","next":"10.4.0-alpha.1"}}