Skip to content

Commit

Permalink
chore: fix types
Browse files Browse the repository at this point in the history
  • Loading branch information
pi0 committed Aug 22, 2024
1 parent c7435f0 commit 2298d24
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 20 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@
"openapi-typescript": "^7.3.0",
"pathe": "^1.1.2",
"perfect-debounce": "^1.0.0",
"pkg-types": "^1.1.3",
"pkg-types": "^1.2.0",
"pretty-bytes": "^6.1.1",
"radix3": "^1.1.2",
"rollup": "^4.21.0",
Expand Down
32 changes: 16 additions & 16 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 7 additions & 3 deletions src/rollup/plugins/externals.ts
Original file line number Diff line number Diff line change
Expand Up @@ -483,18 +483,22 @@ function compareVersions(v1 = "0.0.0", v2 = "0.0.0") {
}

export function applyProductionCondition(exports: PackageJson["exports"]) {
if (!exports || typeof exports === "string") {
if (
!exports ||
typeof exports === "string" ||
Array.isArray(exports) /* TODO: unhandled */
) {
return;
}
if (exports.production) {
if ("production" in exports) {
if (typeof exports.production === "string") {
exports.default = exports.production;
} else {
Object.assign(exports, exports.production);
}
}
for (const key in exports) {
applyProductionCondition(exports[key]);
applyProductionCondition(exports[key as keyof typeof exports]);
}
}

Expand Down

0 comments on commit 2298d24

Please sign in to comment.