resolve.exports
Advanced tools
Comparing version 1.0.0 to 1.0.1
@@ -94,8 +94,12 @@ /** | ||
if (tmp === '/' && target.startsWith(key)) { | ||
return exports[key] + target.substring(key.length); | ||
return (tmp = loop(exports[key], allows)) | ||
? (tmp + target.substring(key.length)) | ||
: bail(name, target, 1); | ||
} | ||
if (tmp === '*' && target.startsWith(key.slice(0, -1))) { | ||
// do not trigger if no *content* to inject | ||
if (tmp = target.substring(key.length - 1)) { | ||
return exports[key].replace('*', tmp); | ||
if (target.length - key.length > 1) { | ||
return (tmp = loop(exports[key], allows)) | ||
? tmp.replace('*', target.substring(key.length - 1)) | ||
: bail(name, target, 1); | ||
} | ||
@@ -102,0 +106,0 @@ } |
{ | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"name": "resolve.exports", | ||
"repository": "lukeed/resolve.exports", | ||
"description": "A tiny (710b), correct, general-purpose, and configurable \"exports\" resolver without file-system reliance", | ||
"description": "A tiny (727b), correct, general-purpose, and configurable \"exports\" resolver without file-system reliance", | ||
"module": "dist/index.mjs", | ||
@@ -7,0 +7,0 @@ "main": "dist/index.js", |
# resolve.exports [![CI](https://github.com/lukeed/resolve.exports/workflows/CI/badge.svg)](https://github.com/lukeed/resolve.exports/actions) [![codecov](https://badgen.net/codecov/c/github/lukeed/resolve.exports)](https://codecov.io/gh/lukeed/resolve.exports) | ||
> A tiny (710b), correct, general-purpose, and configurable `"exports"` resolver without file-system reliance | ||
> A tiny (727b), correct, general-purpose, and configurable `"exports"` resolver without file-system reliance | ||
@@ -22,2 +22,4 @@ ***Why?*** | ||
- [x] directory mapping (`./foobar/*` => `./other/*.js`) | ||
- [x] directory mapping w/ conditions | ||
- [x] directory mapping w/ nested conditions | ||
- [x] legacy fields (`main` vs `module` vs ...) | ||
@@ -24,0 +26,0 @@ - [x] legacy "browser" files object |
Sorry, the diff of this file is not supported yet
18872
269
285