{"name":"@cspell/dynamic-import","version":"6.31.3","keywords":["module","esm","cjs","import","require"],"author":{"name":"Jason Dent","email":"jason@streetsidesoftware.nl"},"license":"MIT","_id":"@cspell/dynamic-import@6.31.3","homepage":"https://github.com/streetsidesoftware/cspell/tree/main/packages/dynamic-import#readme","bugs":{"url":"https://github.com/streetsidesoftware/cspell/labels/cspell-pipe"},"dist":{"shasum":"f98ee7a8210e457b6f885be9a918b9608571b677","tarball":"http://registry-npm.ywwl.com/@cspell/dynamic-import/download/@cspell/dynamic-import-6.31.3.tgz","fileCount":11,"integrity":"sha512-A6sT00+6UNGFksQ5SxW2ohNl6vUutai8F4jwJMHTjZL/9vivQpU7y5V4PpsfoPZtx3WZcbrzuTvJ+tLfdbWc4A==","signatures":[{"sig":"MEUCID7ZArmgO5nnC3DPX0ZmEamQfDn9aWwwQbwdOsj3bWoKAiEAtE+RMXgGJsYo7K3oZcYeJmqQSiPyqtTIEyDr9X1UCmk=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":8224,"size":3327,"noattachment":false,"key":"/@cspell/dynamic-import/-/@cspell/dynamic-import-6.31.3.tgz"},"main":"./dist/cjs/index.js","type":"commonjs","types":"./dist/cjs/index.d.ts","module":"./dist/esm/index.mjs","engines":{"node":">=14"},"exports":{".":{"import":"./dist/esm/index.mjs","require":"./dist/cjs/index.js"}},"gitHead":"0e8ca7b32f21aea40ade645172ef93017e6a143d","scripts":{"test":"vitest run","build":"tsc -b .","watch":"tsc -b . --watch","coverage":"pnpm coverage:vitest && pnpm coverage:fix","test-watch":"vitest","build:clean":"shx rm -rf dist coverage && pnpm build","clean-build":"pnpm build:clean","coverage:fix":"nyc report --temp-dir \"$(pwd)/coverage\" --reporter lcov --report-dir \"$(pwd)/coverage\" --cwd ../..","coverage:vitest":"vitest run --coverage"},"_npmUser":{"name":"jason-dent","email":"jason@streetsidesoftware.nl"},"repository":{"url":"git+https://github.com/streetsidesoftware/cspell.git","type":"git"},"_npmVersion":"lerna/1.17.0/node@v18.17.0+x64 (linux)","description":"Dynamic Module Loader","directories":{},"_nodeVersion":"18.17.0","dependencies":{"import-meta-resolve":"^2.2.2"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/dynamic-import_6.31.3_1691485242207_0.022211406240187914","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 Common JS**\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 Common JS**\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":1691485242334,"maintainers":[{"name":"jason-dent","email":"jason@streetsidesoftware.nl"}],"_cnpm_publish_time":1691485242334,"dist-tags":{"latest":"10.4.0","next":"10.4.0-alpha.1"}}