bunup 0.16.21 → 0.16.23
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-c4hqnzs5.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.23";
|
|
30
30
|
|
|
31
31
|
// packages/bunup/src/printer/print-build-report.ts
|
|
32
32
|
import { promisify } from "util";
|
package/dist/index.js
CHANGED
|
@@ -164,7 +164,7 @@ export default classes;
|
|
|
164
164
|
}
|
|
165
165
|
|
|
166
166
|
// packages/bunup/src/utils/package.ts
|
|
167
|
-
function
|
|
167
|
+
function getPackageExternalDeps(packageJson) {
|
|
168
168
|
if (!packageJson)
|
|
169
169
|
return [];
|
|
170
170
|
return Array.from(new Set([
|
|
@@ -172,16 +172,26 @@ function getPackageDeps(packageJson) {
|
|
|
172
172
|
...Object.keys(packageJson.peerDependencies || {})
|
|
173
173
|
]));
|
|
174
174
|
}
|
|
175
|
+
function getPackageAllDeps(packageJson) {
|
|
176
|
+
if (!packageJson)
|
|
177
|
+
return [];
|
|
178
|
+
return Array.from(new Set([
|
|
179
|
+
...Object.keys(packageJson.dependencies || {}),
|
|
180
|
+
...Object.keys(packageJson.devDependencies || {}),
|
|
181
|
+
...Object.keys(packageJson.peerDependencies || {})
|
|
182
|
+
]));
|
|
183
|
+
}
|
|
175
184
|
|
|
176
185
|
// packages/bunup/src/helpers/external.ts
|
|
177
|
-
function
|
|
178
|
-
return
|
|
186
|
+
function getDepsPatterns(deps) {
|
|
187
|
+
return deps.map((dep) => new RegExp(`^${dep}($|\\/|\\\\)`));
|
|
179
188
|
}
|
|
180
189
|
function matchesPattern(path2, pattern) {
|
|
181
190
|
return typeof pattern === "string" ? pattern === path2 : pattern.test(path2);
|
|
182
191
|
}
|
|
183
192
|
function isExternalFromPackageJson(path2, options, packageJson) {
|
|
184
|
-
const
|
|
193
|
+
const packageExternalDepsPatterns = getDepsPatterns(getPackageExternalDeps(packageJson));
|
|
194
|
+
const packageAllDepsPatterns = getDepsPatterns(getPackageAllDeps(packageJson));
|
|
185
195
|
if (options.packages === "bundle") {
|
|
186
196
|
const explicitlyExternal = options.external?.some((pattern) => matchesPattern(path2, pattern));
|
|
187
197
|
return explicitlyExternal;
|
|
@@ -191,9 +201,9 @@ function isExternalFromPackageJson(path2, options, packageJson) {
|
|
|
191
201
|
if (explicitlyBundled) {
|
|
192
202
|
return false;
|
|
193
203
|
}
|
|
194
|
-
return
|
|
204
|
+
return packageAllDepsPatterns.some((pattern) => pattern.test(path2));
|
|
195
205
|
}
|
|
196
|
-
const matchesExternalPattern =
|
|
206
|
+
const matchesExternalPattern = packageExternalDepsPatterns.some((pattern) => pattern.test(path2)) || options.external?.some((pattern) => matchesPattern(path2, pattern));
|
|
197
207
|
const isExcludedFromExternal = options.noExternal?.some((pattern) => matchesPattern(path2, pattern));
|
|
198
208
|
return matchesExternalPattern && !isExcludedFromExternal;
|
|
199
209
|
}
|
|
@@ -500,7 +510,6 @@ async function build(userOptions, rootDir = process.cwd()) {
|
|
|
500
510
|
env: resolvedEnv,
|
|
501
511
|
ignoreDCEAnnotations: options.ignoreDCEAnnotations,
|
|
502
512
|
emitDCEAnnotations: options.emitDCEAnnotations,
|
|
503
|
-
packages: options.packages,
|
|
504
513
|
jsx: options.jsx,
|
|
505
514
|
compile: options.compile,
|
|
506
515
|
outdir: options.compile ? path4.resolve(rootDir, options.outDir) : undefined,
|