resolvewithplus
Advanced tools
Comparing version 0.4.1 to 0.4.2
{ | ||
"name": "resolvewithplus", | ||
"version": "0.4.1", | ||
"version": "0.4.2", | ||
"license": "MIT", | ||
@@ -5,0 +5,0 @@ "main": "resolvewithplus.mjs", |
@@ -5,15 +5,15 @@ resolvewithplus | ||
_resolvewithplus_ is an iteration of the _resolvewith_ package, which resolves CJS modules following [the original node.js spec.][2] _resolvewithplus_ is changed to an ESM module and adds support for ESM-style `import 'name'` resolutions. When packages export both ESM and CJS, `resolvewithplus` will return the ESM path. Resolving ESM paths is complex and ESM support will be lacking for edge-cases. | ||
_resolvewithplus_ iterates on the _resolvewith_ package for resolving CJS modules following [the original node.js spec.][2] _resolvewithplus_ is changed to an ESM module and adds support for ESM `import 'name'` resolutions. | ||
When a package exports both ESM and CJS, `resolvewithplus` returns the ESM path (tries to). Resolving ESM paths is complex and ESM support will be lacking for edge-cases. | ||
```javascript | ||
// CJS | ||
// ESM paths are returned by default rather than CJS paths | ||
resolvewithplus('koa', '/Users/bumble/resolvewith/test/'); | ||
// '/Users/bumble/resolvewith/node_modules/koa/dist/koa.mjs' | ||
// A CJS path is returned when the ESM path is not found | ||
resolvewithplus('./testfiles/testscript.js', '/Users/bumble/resolvewith/test/') | ||
// '/Users/bumble/resolvewith/test/testfiles/testscript.js' | ||
resolvewithplus('testmodule', '/Users/bumble/resolvewith/test/') | ||
// '/Users/bumble/resolvewith/node_modules/testmodule/index.js' | ||
// ESM paths are returned by default and not CJS paths | ||
resolvewithplus('koa', '/Users/bumble/resolvewith/test/'); | ||
// '/Users/bumble/resolvewith/node_modules/koa/dist/koa.mjs' | ||
// use the older 'resolvewith' package to resolve CJS paths | ||
@@ -24,2 +24,5 @@ resolvewith('koa', '/Users/bumble/resolvewith/test/'); | ||
_resolvewithplus_ caches and reuse results it generates. The first call follows rules to locate the file. Subsequent calls using the values return reults from a key store. | ||
[0]: http://www.bumblehead.com "bumblehead" | ||
@@ -26,0 +29,0 @@ [1]: https://github.com/iambumblehead/resolvewith/blob/master/src/resolvewith.js |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
12127
222
43