bunup 0.16.22 → 0.16.24
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli/index.js
CHANGED
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
build,
|
|
5
5
|
processLoadedConfigs,
|
|
6
6
|
resolveBuildOptions
|
|
7
|
-
} from "../shared/bunup-
|
|
7
|
+
} from "../shared/bunup-rt9wtqx8.js";
|
|
8
8
|
import {
|
|
9
9
|
BunupBuildError,
|
|
10
10
|
BunupCLIError,
|
|
@@ -26,7 +26,7 @@ import {
|
|
|
26
26
|
import { loadConfig } from "coffi";
|
|
27
27
|
import pc4 from "picocolors";
|
|
28
28
|
// packages/bunup/package.json
|
|
29
|
-
var version = "0.16.
|
|
29
|
+
var version = "0.16.24";
|
|
30
30
|
|
|
31
31
|
// packages/bunup/src/printer/print-build-report.ts
|
|
32
32
|
import { promisify } from "util";
|
package/dist/index.js
CHANGED
|
@@ -80,6 +80,70 @@ function ensureMinimumBunVersion() {
|
|
|
80
80
|
ensureBunVersion(MINIMUM_BUN_VERSION);
|
|
81
81
|
}
|
|
82
82
|
|
|
83
|
+
// packages/bunup/src/utils/package.ts
|
|
84
|
+
function getPackageExternalDeps(packageJson) {
|
|
85
|
+
if (!packageJson)
|
|
86
|
+
return [];
|
|
87
|
+
return Array.from(new Set([
|
|
88
|
+
...Object.keys(packageJson.dependencies || {}),
|
|
89
|
+
...Object.keys(packageJson.peerDependencies || {})
|
|
90
|
+
]));
|
|
91
|
+
}
|
|
92
|
+
function getPackageAllDeps(packageJson) {
|
|
93
|
+
if (!packageJson)
|
|
94
|
+
return [];
|
|
95
|
+
return Array.from(new Set([
|
|
96
|
+
...Object.keys(packageJson.dependencies || {}),
|
|
97
|
+
...Object.keys(packageJson.devDependencies || {}),
|
|
98
|
+
...Object.keys(packageJson.peerDependencies || {})
|
|
99
|
+
]));
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
// packages/bunup/src/helpers/external.ts
|
|
103
|
+
function getDepsPatterns(deps) {
|
|
104
|
+
return deps.map((dep) => new RegExp(`^${dep}($|\\/|\\\\)`));
|
|
105
|
+
}
|
|
106
|
+
function matchesPattern(path2, pattern) {
|
|
107
|
+
return typeof pattern === "string" ? pattern === path2 : pattern.test(path2);
|
|
108
|
+
}
|
|
109
|
+
function isExternalFromPackageJson(path2, options, packageJson) {
|
|
110
|
+
const packageExternalDepsPatterns = getDepsPatterns(getPackageExternalDeps(packageJson));
|
|
111
|
+
const packageAllDepsPatterns = getDepsPatterns(getPackageAllDeps(packageJson));
|
|
112
|
+
if (options.packages === "bundle") {
|
|
113
|
+
const explicitlyExternal = options.external?.some((pattern) => matchesPattern(path2, pattern));
|
|
114
|
+
return explicitlyExternal;
|
|
115
|
+
}
|
|
116
|
+
if (options.packages === "external") {
|
|
117
|
+
const explicitlyBundled = options.noExternal?.some((pattern) => matchesPattern(path2, pattern));
|
|
118
|
+
if (explicitlyBundled) {
|
|
119
|
+
return false;
|
|
120
|
+
}
|
|
121
|
+
return packageAllDepsPatterns.some((pattern) => pattern.test(path2));
|
|
122
|
+
}
|
|
123
|
+
const matchesExternalPattern = packageExternalDepsPatterns.some((pattern) => pattern.test(path2)) || options.external?.some((pattern) => matchesPattern(path2, pattern));
|
|
124
|
+
const isExcludedFromExternal = options.noExternal?.some((pattern) => matchesPattern(path2, pattern));
|
|
125
|
+
return matchesExternalPattern && !isExcludedFromExternal;
|
|
126
|
+
}
|
|
127
|
+
function getBundledDepsForDtsResolve(options, packageJson) {
|
|
128
|
+
if (options.packages === "bundle") {
|
|
129
|
+
const allDeps2 = getPackageAllDeps(packageJson);
|
|
130
|
+
const bundled = options.external?.length ? allDeps2.filter((dep) => !options.external.some((p) => matchesPattern(dep, p))) : allDeps2;
|
|
131
|
+
return bundled.length ? getDepsPatterns(bundled) : undefined;
|
|
132
|
+
}
|
|
133
|
+
if (options.packages === "external") {
|
|
134
|
+
return options.noExternal?.length ? [...options.noExternal] : undefined;
|
|
135
|
+
}
|
|
136
|
+
const externalDeps = new Set(getPackageExternalDeps(packageJson));
|
|
137
|
+
const allDeps = getPackageAllDeps(packageJson);
|
|
138
|
+
const devDeps = allDeps.filter((dep) => !externalDeps.has(dep));
|
|
139
|
+
const bundledDevDeps = options.external?.length ? devDeps.filter((dep) => !options.external.some((p) => matchesPattern(dep, p))) : devDeps;
|
|
140
|
+
const patterns = [
|
|
141
|
+
...getDepsPatterns(bundledDevDeps),
|
|
142
|
+
...options.noExternal ?? []
|
|
143
|
+
];
|
|
144
|
+
return patterns.length ? patterns : undefined;
|
|
145
|
+
}
|
|
146
|
+
|
|
83
147
|
// packages/bunup/src/helpers/on-success.ts
|
|
84
148
|
import { exec } from "tinyexec";
|
|
85
149
|
import treeKill from "tree-kill";
|
|
@@ -163,41 +227,6 @@ export default classes;
|
|
|
163
227
|
};
|
|
164
228
|
}
|
|
165
229
|
|
|
166
|
-
// packages/bunup/src/utils/package.ts
|
|
167
|
-
function getPackageDeps(packageJson) {
|
|
168
|
-
if (!packageJson)
|
|
169
|
-
return [];
|
|
170
|
-
return Array.from(new Set([
|
|
171
|
-
...Object.keys(packageJson.dependencies || {}),
|
|
172
|
-
...Object.keys(packageJson.peerDependencies || {})
|
|
173
|
-
]));
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
// packages/bunup/src/helpers/external.ts
|
|
177
|
-
function getPackageDepsPatterns(packageJson) {
|
|
178
|
-
return getPackageDeps(packageJson).map((dep) => new RegExp(`^${dep}($|\\/|\\\\)`));
|
|
179
|
-
}
|
|
180
|
-
function matchesPattern(path2, pattern) {
|
|
181
|
-
return typeof pattern === "string" ? pattern === path2 : pattern.test(path2);
|
|
182
|
-
}
|
|
183
|
-
function isExternalFromPackageJson(path2, options, packageJson) {
|
|
184
|
-
const packageDepsPatterns = getPackageDepsPatterns(packageJson);
|
|
185
|
-
if (options.packages === "bundle") {
|
|
186
|
-
const explicitlyExternal = options.external?.some((pattern) => matchesPattern(path2, pattern));
|
|
187
|
-
return explicitlyExternal;
|
|
188
|
-
}
|
|
189
|
-
if (options.packages === "external") {
|
|
190
|
-
const explicitlyBundled = options.noExternal?.some((pattern) => matchesPattern(path2, pattern));
|
|
191
|
-
if (explicitlyBundled) {
|
|
192
|
-
return false;
|
|
193
|
-
}
|
|
194
|
-
return packageDepsPatterns.some((pattern) => pattern.test(path2));
|
|
195
|
-
}
|
|
196
|
-
const matchesExternalPattern = packageDepsPatterns.some((pattern) => pattern.test(path2)) || options.external?.some((pattern) => matchesPattern(path2, pattern));
|
|
197
|
-
const isExcludedFromExternal = options.noExternal?.some((pattern) => matchesPattern(path2, pattern));
|
|
198
|
-
return matchesExternalPattern && !isExcludedFromExternal;
|
|
199
|
-
}
|
|
200
|
-
|
|
201
230
|
// packages/bunup/src/plugins/internal/external-option.ts
|
|
202
231
|
function externalOptionPlugin(options, packageJson) {
|
|
203
232
|
return {
|
|
@@ -500,7 +529,6 @@ async function build(userOptions, rootDir = process.cwd()) {
|
|
|
500
529
|
env: resolvedEnv,
|
|
501
530
|
ignoreDCEAnnotations: options.ignoreDCEAnnotations,
|
|
502
531
|
emitDCEAnnotations: options.emitDCEAnnotations,
|
|
503
|
-
packages: options.packages,
|
|
504
532
|
jsx: options.jsx,
|
|
505
533
|
compile: options.compile,
|
|
506
534
|
outdir: options.compile ? path4.resolve(rootDir, options.outDir) : undefined,
|
|
@@ -561,7 +589,9 @@ async function build(userOptions, rootDir = process.cwd()) {
|
|
|
561
589
|
}
|
|
562
590
|
if ((options.dts || options.dtsOnly) && !options.compile) {
|
|
563
591
|
try {
|
|
564
|
-
const { entry, splitting, ...dtsOptions } = typeof options.dts === "object" ? options.dts : {};
|
|
592
|
+
const { entry, splitting, resolve: userDtsResolve, ...dtsOptions } = typeof options.dts === "object" ? options.dts : {};
|
|
593
|
+
const bundledDeps = getBundledDepsForDtsResolve(options, packageJson.data);
|
|
594
|
+
const dtsResolve = !bundledDeps?.length ? userDtsResolve : userDtsResolve === true ? true : [...bundledDeps, ...Array.isArray(userDtsResolve) ? userDtsResolve : []];
|
|
565
595
|
const dtsResult = await generateDts(ensureArray(entry ?? entrypoints), {
|
|
566
596
|
cwd: rootDir,
|
|
567
597
|
preferredTsconfig: options.preferredTsconfig,
|
|
@@ -570,7 +600,8 @@ async function build(userOptions, rootDir = process.cwd()) {
|
|
|
570
600
|
chunk: getDefaultChunkNaming(options.name)
|
|
571
601
|
},
|
|
572
602
|
root: options.sourceBase ? path4.resolve(rootDir, options.sourceBase) : undefined,
|
|
573
|
-
...dtsOptions
|
|
603
|
+
...dtsOptions,
|
|
604
|
+
resolve: dtsResolve
|
|
574
605
|
});
|
|
575
606
|
if (dtsResult.errors.length && !logger.isSilent()) {
|
|
576
607
|
logIsolatedDeclarationErrors(dtsResult.errors);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "bunup",
|
|
3
|
-
"version": "0.16.
|
|
3
|
+
"version": "0.16.24",
|
|
4
4
|
"description": "⚡ A blazing-fast build tool for your libraries built with Bun.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"bun",
|
|
@@ -50,8 +50,8 @@
|
|
|
50
50
|
"type-check": "tsc --noEmit"
|
|
51
51
|
},
|
|
52
52
|
"dependencies": {
|
|
53
|
-
"@bunup/dts": "^0.14.
|
|
54
|
-
"@bunup/shared": "0.16.
|
|
53
|
+
"@bunup/dts": "^0.14.52",
|
|
54
|
+
"@bunup/shared": "0.16.23",
|
|
55
55
|
"chokidar": "^5.0.0",
|
|
56
56
|
"coffi": "^0.1.37",
|
|
57
57
|
"lightningcss": "^1.30.2",
|