Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

resolvewithplus

Package Overview
Dependencies
Maintainers
1
Versions
47
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

resolvewithplus - npm Package Compare versions

Comparing version 0.2.0 to 0.4.0

LICENSE

15

package.json
{
"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"
}
}

18

README.md
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 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc