nf(fix): Add support for external package.json wildcards - #963
Conversation
|
I have been digging and the However, apparently, there is an order of precedence in the exports of a package.json. When you import a package, it will try the exports one by one until it resolves. We can't do that when we build export bundles... So we'll need to keep track of an "already resolved" Set for multiple wildcard patterns like "exports": {
"./locales/global/*": {
"default": "./locales/global/*.js"
},
"./locales/*": {
"types": "./locales/*.d.ts",
"default": "./locales/*.js"
},
"./package.json": {
"default": "./package.json"
},
".": {
"types": "./index.d.ts",
"default": "./fesm2022/common.mjs"
},
// more exports
}We don't want to resolve global twice. Working on it, this is just for administration. |
|
Final considerations, it's now also accepting the asterisk when skipping entry points. E.g. shared: {
...share({
'@primeuix/themes': {
singleton: true,
strictVersion: true,
requiredVersion: 'auto',
includeSecondaries: {skip: "@primeuix/themes/aura/*"} // this creates only 1 entry point: @primeuix/themes/aura
},
}),
},By default, the Also, small fix, but now all entrypoints of the library are excluded from the "externals" in the ESBuild. This is important because if the entryPoint "@primeuix/themes/aura" is in the externals list, all imports that start with this will be considered "resolvable" (like |
251a31e to
dc9a02f
Compare
Proposal: Enhanced GLOB searching for secondary entry points.
Apparently, double asterisk (
**) is not a thing for typescript/node exports:src: https://hirok.io/posts/package-json-exports#exposing-all-package-files
This PR fixes the discovery of secondary entrypoints while respecting the package.json exports.
closes #916.