Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug/issue 1406 / 1407 handle entry point only conditions from export maps when generating import map #1413

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@
"@spectrum-web-components/styles": "^1.0.1",
"@uswds/web-components": "^0.0.1-alpha",
"call-bind": "^1.0.8",
"d3": "^7.9.0",
"font-awesome": "^4.6.3",
"geist": "^1.2.0",
"lit": "^3.1.0",
Expand Down
11 changes: 10 additions & 1 deletion packages/cli/src/lib/walker-package-ranger.js
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,11 @@ async function walkPackageForExports(dependency, packageJson, resolvedRoot) {
const { exports, module, main } = packageJson;

// favor exports over main / module
if (exports) {
// favor exports over main / module
if (typeof exports === "string") {
// https://unpkg.com/browse/[email protected]/package.json
updateImportMap(dependency, exports, resolvedRoot);
} else if (typeof exports === "object") {
for (const sub in exports) {
/*
* test for conditional subpath exports
Expand Down Expand Up @@ -224,7 +228,12 @@ async function walkPackageForExports(dependency, packageJson, resolvedRoot) {
updateImportMap(dependency, `${exports[sub]}`, resolvedRoot);
} else if (sub.indexOf("*") >= 0) {
await walkExportPatterns(dependency, sub, exports[sub], resolvedRoot);
} else if (SUPPORTED_EXPORT_CONDITIONS.includes(sub)) {
// filter out for just supported top level conditions
// https://unpkg.com/browse/[email protected]/package.json
updateImportMap(dependency, `${exports[sub]}`, resolvedRoot);
} else {
// let all other conditions "pass through" as is
updateImportMap(`${dependency}/${sub}`, `${exports[sub]}`, resolvedRoot);
}
}
Expand Down
Loading
Loading