Minor Changes
-
Add experimental support for Node.js package maps through a new
packageMapoption, which takes the path of the configuration file (or afile:URL) or an already-parsedpackagesobject. When it is set, a bare specifier is resolved through the importing package'sdependenciestable and the target package's location is handed to the regular pipeline, instead of walkingnode_modules; relative and absolute requests andnode:builtins are unaffected. Because several package entries may share oneurl, the package a request resolved into is exposed aspackageIdon the result and can be passed back in ascontext.packageIdto resolve from that package unambiguously. Package maps are stability 1 (experimental) in Node.js, and this option tracks that specification and may change with it. (by @alexander-akait in #667) -
Explain an
exports/importsfield whose conditions wrap subpaths, instead of failing with a message that points at the request. A field shaped like{ "import": { ".": "./esm/index.js", "./*": "./esm/*.js" }, "require": "./build/bundle.js" }is not supported by Node.js: the subpaths inside a condition are read as condition names, so they match nothing, and every request into the package failed as"./foo" is not exported under the conditions [...]— which reads as though the package forgot to export./foo. Such a failure now names the offending keys and shows the arrangement that works, with the subpaths at the top level and the conditions nested inside them. Resolution itself is unchanged: the diagnosis runs only on a request that has already failed, so nothing that resolves today starts failing, and a successful resolve does no extra work. Errors raised while processing either field also name thepackage.jsonthey came from, which previously only appeared in the resolver log. (by @alexander-akait in #676) -
Generate the published type declarations with TypeScript instead of
webpack/tooling, which is no longer a dependency. Every name the package exported before is still exported, andtypes.d.tsis still the entry point, but the declarations themselves now live intypes/and are emitted bytscfrom the JSDoc inlib/. Two shapes follow the sources more closely than the previous generator did: the object form ofPluginno longer declaresthis: Resolveronapply(it is called asplugin.apply(resolver), sothisis the plugin), and the entries ofResolveContext.stackdeclarename: string | undefinedrather than an optionalname. Class fields that the old generator dropped, such as the cache backends onCachedInputFileSystem, are now part of the declarations. (by @alexander-akait in #675)
Patch Changes
- Size the ancestor path and segment arrays that
getPathsCachedkeeps to what they actually hold: apush-built store keeps room for 17 entries while a path has a handful, and the cache holds these for the filesystem's lifetime. (by @alexander-akait in #681)