mirror of
https://github.com/morluto/rea.git
synced 2026-11-16 03:33:25 +00:00
fix(javascript): preserve trailing-slash exports uncertainty
Fixes #9998 Supersedes #10107 Co-Authored-By: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com>
This commit is contained in:
1 parent
f81cbd0c43
commit
3a25046b8c
3 files changed
+127
-2
No files matched your search
@@ -2013,6 +2013,30 @@ const packageExportPatternCases = [
|
||||
request: "fixture/window",
|
||||
status: "unavailable",
|
||||
},
|
||||
{
|
||||
name: "matching trailing slash",
|
||||
exports: { "./*": "./*.cjs" },
|
||||
request: "fixture/window/",
|
||||
status: "unavailable",
|
||||
},
|
||||
{
|
||||
name: "trailing slash ignores exact null before pattern",
|
||||
exports: { "./*": "./*.cjs", "./window/": null },
|
||||
request: "fixture/window/",
|
||||
status: "unavailable",
|
||||
},
|
||||
{
|
||||
name: "trailing slash exact key without pattern",
|
||||
exports: { "./window/": "./window.cjs" },
|
||||
request: "fixture/window/",
|
||||
status: "external",
|
||||
},
|
||||
{
|
||||
name: "trailing slash matching null",
|
||||
exports: { "./*": null },
|
||||
request: "fixture/window/",
|
||||
status: "external",
|
||||
},
|
||||
{
|
||||
name: "nonmatching",
|
||||
exports: { "./other/*": "./*.cjs" },
|
||||
|
||||
@@ -1862,8 +1862,12 @@ const selectPackageExport = (
|
||||
};
|
||||
declared = keys;
|
||||
if (hasSubpaths) {
|
||||
if (subpath.endsWith("/")) return { status: "unmatched", declared };
|
||||
if (!subpath.includes("*") && Object.hasOwn(value, subpath))
|
||||
// A trailing slash excludes exact keys, but can still match a wildcard.
|
||||
if (
|
||||
!subpath.endsWith("/") &&
|
||||
!subpath.includes("*") &&
|
||||
Object.hasOwn(value, subpath)
|
||||
)
|
||||
target = Reflect.get(value, subpath);
|
||||
else {
|
||||
pattern = selectPackageSubpathPattern(keys, subpath);
|
||||
|
||||
Reference in new issue
Block a user