resolvewithplus
Advanced tools
Comparing version 0.2.0 to 0.4.0
{ | ||
"name": "resolvewithplus", | ||
"version": "0.2.0", | ||
"version": "0.4.0", | ||
"license": "MIT", | ||
"main": "src/resolvewithplus", | ||
"main": "resolvewithplus.mjs", | ||
"readmeFilename": "README.md", | ||
"description": "resolvewith with extra power", | ||
"type": "module", | ||
"files": [ | ||
"resolvewithplus.mjs", | ||
"README.md" | ||
], | ||
"repository": { | ||
@@ -18,2 +23,4 @@ "type": "git", | ||
"resolve", | ||
"esm", | ||
"resolution", | ||
"file" | ||
@@ -23,2 +30,3 @@ ], | ||
"ava": "4.0.0-alpha.2", | ||
"eslint": "^8.0.1", | ||
"koa": "^2.13.1", | ||
@@ -28,4 +36,5 @@ "optfn": "~0.0.x" | ||
"scripts": { | ||
"test": "ava" | ||
"test": "ava resolvewithplus.spec.mjs", | ||
"lint": "eslint ./*mjs" | ||
} | ||
} |
resolvewithplus | ||
=============== | ||
**(c)[Bumblehead][0]** [MIT-license](#license) | ||
[![npm version](https://badge.fury.io/js/resolvewithplus.svg)](https://badge.fury.io/js/resolvewithplus) [![Build Status](https://github.com/iambumblehead/resolvewithplus/workflows/nodejs-ci/badge.svg)][2] | ||
[_resolvewith_ resolves][1] a name used in CommonJS's `require(name)` or ES6's `import 'name'` relative to the path of a file, following the [node.js specification][2] exactly. For example, | ||
_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. | ||
```javascript | ||
// CJS | ||
resolvewithplus('./testfiles/testscript.js', '/Users/bumble/resolvewith/test/') | ||
@@ -12,13 +13,10 @@ // '/Users/bumble/resolvewith/test/testfiles/testscript.js' | ||
// '/Users/bumble/resolvewith/node_modules/testmodule/index.js' | ||
``` | ||
Recent support is added for esm module resolution. Note, the ESM resolution spec is not fully implemented, | ||
```javascript | ||
resolvewithplus('koa', '/Users/bumble/resolvewith/test/', { esm : true }); | ||
// 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' | ||
resolvewithplus('koa', '/Users/bumble/resolvewith/test/'); | ||
// use the older 'resolvewith' package to resolve CJS paths | ||
resolvewith('koa', '/Users/bumble/resolvewith/test/'); | ||
// '/Users/bumble/resolvewith/node_modules/koa/lib/application.js' | ||
resolvewithplus('bowermodule', '/Users/bumble/resolvewith/test/', { browser : true }); | ||
// '/Users/bumble/resolvewith/bower_components/bowermodule/build/bowermoduleweb.js' | ||
``` | ||
@@ -25,0 +23,0 @@ |
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Debug access
Supply chain riskUses debug, reflection and dynamic code execution features.
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
Yes
11753
4
4
215
40
5
1