Releases: iambumblehead/resolvewithplus
improve wildcard nesting expansion
Essentially, this release enables resolvewithplus to resolve the following esm export
{
"exports": {
"./*": {
"require": "./*.js",
"import": "./*.js"
}
}
}
Full list of changes,
- add tests for path pattern resolver
- resolve more nested export wildcard-scenarious
resolve wildcard-using pattern resolution
resolve nested exports defined on named-properties with wildcards, eg exports: { './*': { default: './src/*/index.js' } }
resolves this issue at esmock
resolves criticaal error
resolve full path from package.json "main", "browser" and "module" definitions. resolves this issue at esmock.
remove unused condition
remove unused condition and resolved error where fileurl path was not correctly resolved for package.json "main", "browser" and "module" definitions
support user-defined `priority` list
when user-defined priority list includes "import" return packagejson.module before packagejson.main
support user-defined priority list when resolving nested export expressions
resolve error preventing module resolution
resolve error preventing module resolution. There is a condition that alters lookup paths for the situation when resolvewithplus is being developed and tested from inside another package's node_modules. The condition caused lookup errors. The condition was changed and a unit-test added
remove un-necessary sort
remove un-necessary sorting to provide faster lookups
use package type to determine 'import' or 'require' lookup
use package type to determine lookup: 'import' or 'require'
(wiki is updated with details)
prioritize module resolutions
With this release resolvewithplus
supports optional isbrowser
, istypescript
and isimport
fields and when one of these is specified the resolver prioritizes browser-exported files, typecript and module files. By default, isimport
is true
resolvewithplus('react-dom/server', '/resolvewith/test/', {
isbrowser: true
}) // 'file:///resolvewith/node_modules/react-dom/server.browser.js'
resolvewithplus
now also supports an advanced priority
option. When a package.json is parsed, a default priority
list determines the priority of named-exports in this order: browser
(if isbrowser
), then import
then node
then default
. Define a custom priority
list to specify a custom ordering. If you are using nodejs, this is probably not needed,
resolvewithplus('react-dom/server', '/resolvewith/test/', {
priority: ['deno', 'default']
}) // 'file:///resolvewith/node_modules/react-dom/server.deno.js'
resolvewithplus('react-dom/server', '/resolvewith/test/', {
priority: ['browser', 'default']
}) // 'file:///resolvewith/node_modules/react-dom/server.browser.js'
changelog:
- add support for 'priority' configuration option
- explicitly prioritize "browser" then "import" then "default", when browser and import both true
- update README image link to use "main" repo path
- replace reducer function w/ simple recursion
improve typescript resolution
this PR changes the location of isTypescript detection to occur in one place that is more widely used so that it can be engaged more frequently to improve typescript resolution.
- improve resolution of typescript moduleIds