Releases: lukeed/resolve.exports
v2.0.2
v2.0.1
v2.0.0
Breaking
- Changed the
resolve
return signature fromstring | undefined
tostring[] | undefined
:
Previouslyresolve.exports
could only return 1 string output. This ignored"imports"
and"exports"
entries that could return multiple resolved locations (aka "alternatives").
Nowresolve.exports
supports arrayable entries and normalizes all outputs into arrays. This makes it easier for consumers to uniformly traverse the output (or simply take the first item).
Features
-
NEW Add
imports
function to resolve"imports"
identifiers: #14 -
NEW Add
exports
function to resolve"exports"
maps exclusively
Note: This is identical to theresolve
function from[email protected]
release. -
Converted the
resolve
function to be a convenience helper.
Note: Its API signature is unchanged. However, it also now accepts import specifiers. If an import identifier (eg,#foo
or<package>/#foo
) is received, then theimports()
function is invoked. Otherwise theexports()
function is called. -
Support array values (#17)
Chores
- Converted source code to strict TypeScript
- Add Node 16.x and 18.x to CI matrix
Full Changelog: v1.1.1...v2.0.0
v1.1.1
Patches
- Handle subpath entry names that start with a dot (#20):
Thank you @ErikMikkelson - Allow subpath patterns to include
"*"
anywhere (#16, #22): 7e41d63 - Support
null
resolved values: (#16): d3bda82 - Allow multiple
"*"
within the resolved value (#9):
All these fixes allow the following package.json
example to be resolved correctly (according to the latest "exports"
resolution specification):
{
"name": "foobar",
"exports": {
// subpath w/ leading "."
"./.ini": "./.ini",
// nullable (private) values
"./features/internal/*": null,
"./features/*": "./src/features/*.js",
"./features/private/*": null,
// allow "*" anywhere in pattern
"./views/*": "./src/views/*.js",
"./views/*.jsx": "./src/views/*.jsx",
"./views/*/template": "./src/views/*.html",
// multiple wildcards in value
"./es*": "./esm/*/GAP/*.js"
// "foobar/es2015" => "./esm/2015/GAP/2015.js"
// "foobar/es2015/a/b" => "./esm/2015/a/b/GAP/2015/a/b.js"
}
}
Types
- Allow
readonly
andconst
arrays in options (#15): 587b0ba
Thank you @SimenB - Add
types
condition toexports
field (#18): dc7bae3
Thank you @merceyz
Chores
- Add additional tests for subpath pattern depth (#23): 0bae61e
Thank you @huntie - Add Node
16.x
and18x
to CI testing matrix: 4908584
Full Changelog: v1.1.0...v1.1.1
v1.1.0
Features
- Add
unsafe
option (#12, #13): 0b69d12
Note: This option should not be used by most consumers, but is made available for edge cases. As the name suggests, this is "unsafe" and breaks away from the default Node resolve conditions.
Chores
- Update module size: a98d57a
Full Changelog: v1.0.2...v1.1.0
v1.0.2
v1.0.1
Patches
-
Add support for conditionals within directory mappings – both subpath and subpattern variants (#1, #2): a881ef8
The following examples are now supported, in congruence with the Node.js algorithm (v12.20+):{ "name": "foobar", "exports": { // subpath folder mapping "./features/": { "browser": { "import": "./browser.import/", "require": "./browser.require/" }, "import": "./import/", "require": "./require/" }, // subpath pattern mapping "./features/*": { "browser": { "import": "./browser.import/*.mjs", "require": "./browser.require/*.js" }, "import": "./import/*.mjs", "require": "./require/*.js" } } }