{"name":"@loaderkit/resolve","version":"1.0.2","author":{"name":"https://github.com/laverdet/"},"license":"ISC","_id":"@loaderkit/resolve@1.0.2","maintainers":[{"name":"laverdet","email":"marcel.npm@laverdet.com"}],"homepage":"https://github.com/braidnetworks/loaderkit/packages/resolve#readme","bugs":{"url":"https://github.com/braidnetworks/loaderkit/issues"},"dist":{"shasum":"d711555e9546e09eeff7f610674d42e86e189c15","tarball":"http://registry-npm.ywwl.com/@loaderkit/resolve/download/@loaderkit/resolve-1.0.2.tgz","fileCount":30,"integrity":"sha512-yTCCjuQapvRz6S30B8DyqHu1WYsbYRCww6uNsmbQU4GQVf5gJzJSB60qUHj+qBSxReLtRL/mhmhYhrIc9jVFTw==","signatures":[{"sig":"MEQCIBp75z5DkeS9o9ku8JMvPqXE8bS/l2jAa61lyZRJF7AbAiAS1sdYpUMmVww1YzedF/YxwHZes1F7OK/q9kYoKc0KRg==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":108815,"size":22302,"noattachment":false,"key":"/@loaderkit/resolve/-/@loaderkit/resolve-1.0.2.tgz"},"type":"module","exports":{"./*":"./dist/*.js"},"gitHead":"c908f8811173e1df438a4d4092605cb66c7f740b","scripts":{"test":"node --enable-source-maps --test-reporter=spec --test 'dist/__tests__/**/*.js'","clean":"rm -rf dist","prepare":"npm run -s clean; npx tsc -b"},"_npmUser":{"name":"laverdet","email":"marcel.npm@laverdet.com"},"repository":{"url":"git+https://github.com/braidnetworks/loaderkit.git","type":"git"},"_npmVersion":"10.9.0","description":"[![npm version](https://badgen.now.sh/npm/v/@loaderkit/resolve)](https://www.npmjs.com/package/@loaderkit/resolve) [![isc license](https://badgen.now.sh/npm/license/@loaderkit/resolve)](https://github.com/braidnetworks/loaderkit/blob/main/LICENSE)","directories":{},"_nodeVersion":"22.11.0","dependencies":{"@braidai/lang":"^1.0.0"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/resolve_1.0.2_1739999420918_0.9812116781434983","host":"s3://npm-registry-packages-npm-production"},"readme":"[![npm version](https://badgen.now.sh/npm/v/@loaderkit/resolve)](https://www.npmjs.com/package/@loaderkit/resolve)\n[![isc license](https://badgen.now.sh/npm/license/@loaderkit/resolve)](https://github.com/braidnetworks/loaderkit/blob/main/LICENSE)\n[![github action](https://github.com/braidnetworks/loaderkit/actions/workflows/build.yaml/badge.svg)](https://github.com/braidnetworks/loaderkit/actions/workflows/build.yaml)\n[![npm downloads](https://badgen.now.sh/npm/dm/@loaderkit/resolve)](https://www.npmjs.com/package/@loaderkit/resolve)\n\n🔎 @loaderkit/resolve - General purpose nodejs module resolver\n==============================================================\n\nAn accurate & abstract implementation of the nodejs module resolution algorithms. It implements both\nthe [CommonJS](https://nodejs.org/api/modules.html#all-together) and\n[modules](https://nodejs.org/api/esm.html#resolution-and-loading-algorithm) algorithms. Originally\nauthored for [arethetypeswrong](https://arethetypeswrong.github.io).\n\nSee also: [resolve](https://www.npmjs.com/package/resolve),\n[enhanced-resolve](https://github.com/webpack/enhanced-resolve), and\n[esm-resolve](https://www.npmjs.com/package/esm-resolve). The main point of this package is accuracy\nwith the default nodejs resolution algorithms.\n\n- **Does nothing that the nodejs default resolver doesn't do**\n- Runs in a web browser w/ abstract filesystems\n- Sensible TypeScript-first types\n- Shakeable ESM exports\n- Promise & synchronous implementations\n\n## Usage\n```ts\nimport { resolve, resolveSync } from '@loaderkit/resolve/esm';\nimport { resolve as resolveRequire, resolveSync as resolveRequireSync } from '@loaderkit/resolve/cjs';\nimport { defaultAsyncFileSystem, defaultSyncFileSystem } from '@loaderkit/resolve/fs';\n\n// Async module resolution\nconst resolution = await resolve(defaultAsyncFileSystem, 'react', new URL(import.meta.url));\nconsole.log(resolution.format, resolution.url);\n// format: \"addon\" | \"builtin\" | \"commonjs\" | \"json\" | \"module\" | \"wasm\"\n// url: typeof URL\n\n// Synchronous module resolution\nresolveSync(defaultSyncFileSystem, 'react', new URL(import.meta.url));\n\n// CommonJS module resolution\nawait resolveRequire(defaultAsyncFileSystem, 'lodash', new URL(import.meta.url));\nresolveRequireSync(defaultSyncFileSystem, 'lodash', new URL(import.meta.url));\n```\n\nThe `FileSystemAsync` and `FileSystemSync` interfaces can be implemented by client code as\nnecessary. For example, you could write a delegate to load the module source files from a zip file,\nfrom the internet, or whatever you want.\n","publish_time":1739999421110,"_cnpm_publish_time":1739999421110,"dist-tags":{"latest":"1.0.6"}}