bunup 0.16.23 → 0.16.25
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.25";
|
|
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,51 +227,6 @@ export default classes;
|
|
|
163
227
|
};
|
|
164
228
|
}
|
|
165
229
|
|
|
166
|
-
// packages/bunup/src/utils/package.ts
|
|
167
|
-
function getPackageExternalDeps(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
|
-
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
|
-
}
|
|
184
|
-
|
|
185
|
-
// packages/bunup/src/helpers/external.ts
|
|
186
|
-
function getDepsPatterns(deps) {
|
|
187
|
-
return deps.map((dep) => new RegExp(`^${dep}($|\\/|\\\\)`));
|
|
188
|
-
}
|
|
189
|
-
function matchesPattern(path2, pattern) {
|
|
190
|
-
return typeof pattern === "string" ? pattern === path2 : pattern.test(path2);
|
|
191
|
-
}
|
|
192
|
-
function isExternalFromPackageJson(path2, options, packageJson) {
|
|
193
|
-
const packageExternalDepsPatterns = getDepsPatterns(getPackageExternalDeps(packageJson));
|
|
194
|
-
const packageAllDepsPatterns = getDepsPatterns(getPackageAllDeps(packageJson));
|
|
195
|
-
if (options.packages === "bundle") {
|
|
196
|
-
const explicitlyExternal = options.external?.some((pattern) => matchesPattern(path2, pattern));
|
|
197
|
-
return explicitlyExternal;
|
|
198
|
-
}
|
|
199
|
-
if (options.packages === "external") {
|
|
200
|
-
const explicitlyBundled = options.noExternal?.some((pattern) => matchesPattern(path2, pattern));
|
|
201
|
-
if (explicitlyBundled) {
|
|
202
|
-
return false;
|
|
203
|
-
}
|
|
204
|
-
return packageAllDepsPatterns.some((pattern) => pattern.test(path2));
|
|
205
|
-
}
|
|
206
|
-
const matchesExternalPattern = packageExternalDepsPatterns.some((pattern) => pattern.test(path2)) || options.external?.some((pattern) => matchesPattern(path2, pattern));
|
|
207
|
-
const isExcludedFromExternal = options.noExternal?.some((pattern) => matchesPattern(path2, pattern));
|
|
208
|
-
return matchesExternalPattern && !isExcludedFromExternal;
|
|
209
|
-
}
|
|
210
|
-
|
|
211
230
|
// packages/bunup/src/plugins/internal/external-option.ts
|
|
212
231
|
function externalOptionPlugin(options, packageJson) {
|
|
213
232
|
return {
|
|
@@ -570,7 +589,9 @@ async function build(userOptions, rootDir = process.cwd()) {
|
|
|
570
589
|
}
|
|
571
590
|
if ((options.dts || options.dtsOnly) && !options.compile) {
|
|
572
591
|
try {
|
|
573
|
-
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 : []];
|
|
574
595
|
const dtsResult = await generateDts(ensureArray(entry ?? entrypoints), {
|
|
575
596
|
cwd: rootDir,
|
|
576
597
|
preferredTsconfig: options.preferredTsconfig,
|
|
@@ -579,7 +600,8 @@ async function build(userOptions, rootDir = process.cwd()) {
|
|
|
579
600
|
chunk: getDefaultChunkNaming(options.name)
|
|
580
601
|
},
|
|
581
602
|
root: options.sourceBase ? path4.resolve(rootDir, options.sourceBase) : undefined,
|
|
582
|
-
...dtsOptions
|
|
603
|
+
...dtsOptions,
|
|
604
|
+
resolve: dtsResolve
|
|
583
605
|
});
|
|
584
606
|
if (dtsResult.errors.length && !logger.isSilent()) {
|
|
585
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.25",
|
|
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",
|