package-build-stats 8.2.5 → 8.2.7
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.
|
@@ -6,6 +6,7 @@ type MakeRspackConfigOptions = {
|
|
|
6
6
|
debug?: boolean;
|
|
7
7
|
minify?: boolean;
|
|
8
8
|
entry: Entry;
|
|
9
|
+
outputPath: string;
|
|
9
10
|
};
|
|
10
|
-
export default function makeRspackConfig({ packageName: _packageName, entry, externals, debug: _debug, minify, }: MakeRspackConfigOptions): Configuration;
|
|
11
|
+
export default function makeRspackConfig({ packageName: _packageName, entry, externals, debug: _debug, minify, outputPath, }: MakeRspackConfigOptions): Configuration;
|
|
11
12
|
export {};
|
|
@@ -3,7 +3,7 @@ import escapeRegex from 'escape-string-regexp';
|
|
|
3
3
|
import rspack from '@rspack/core';
|
|
4
4
|
import { createRequire } from 'module';
|
|
5
5
|
const require = createRequire(import.meta.url);
|
|
6
|
-
export default function makeRspackConfig({ packageName: _packageName, entry, externals, debug: _debug, minify = true, }) {
|
|
6
|
+
export default function makeRspackConfig({ packageName: _packageName, entry, externals, debug: _debug, minify = true, outputPath, }) {
|
|
7
7
|
const externalsRegex = makeExternalsRegex(externals.externalPackages);
|
|
8
8
|
const isExternalRequest = (request) => {
|
|
9
9
|
const isPeerDep = externals.externalPackages.length
|
|
@@ -154,6 +154,7 @@ export default function makeRspackConfig({ packageName: _packageName, entry, ext
|
|
|
154
154
|
},
|
|
155
155
|
output: {
|
|
156
156
|
filename: '[name].bundle.js',
|
|
157
|
+
path: outputPath,
|
|
157
158
|
},
|
|
158
159
|
externals: ({ request }, callback) => isExternalRequest(request || '')
|
|
159
160
|
? callback(undefined, 'commonjs ' + request)
|
|
@@ -7,6 +7,7 @@ type CompilePackageArgs = {
|
|
|
7
7
|
entry: Entry;
|
|
8
8
|
debug?: boolean;
|
|
9
9
|
minify?: boolean;
|
|
10
|
+
outputPath: string;
|
|
10
11
|
};
|
|
11
12
|
type CompilePackageReturn = {
|
|
12
13
|
stats: Stats;
|
|
@@ -36,7 +37,7 @@ type BuildPackageResultWithIgnored = BuildPackageResult & {
|
|
|
36
37
|
declare function getCompilationErrors(stats: Stats): import("@rspack/core").RspackError[];
|
|
37
38
|
declare const BuildUtils: {
|
|
38
39
|
createEntryPoint(packageName: string, installPath: string, options: CreateEntryPointOptions): string;
|
|
39
|
-
compilePackage({ name, entry, externals, debug, minify, }: CompilePackageArgs): Promise<CompilePackageReturn>;
|
|
40
|
+
compilePackage({ name, entry, externals, debug, minify, outputPath, }: CompilePackageArgs): Promise<CompilePackageReturn>;
|
|
40
41
|
_parseMissingModules(errors: ReturnType<typeof getCompilationErrors>): string[];
|
|
41
42
|
buildPackage({ name, installPath, externals, options, }: BuildPackageArgs): Promise<{
|
|
42
43
|
assets: {
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import path from 'path';
|
|
2
|
+
import { randomUUID } from 'crypto';
|
|
3
|
+
import config from '../config/config.js';
|
|
2
4
|
import { rspack } from '@rspack/core';
|
|
3
5
|
import isValidNPMName from 'is-valid-npm-name';
|
|
4
6
|
import { gzipSync } from 'zlib';
|
|
@@ -60,7 +62,7 @@ const BuildUtils = {
|
|
|
60
62
|
throw new EntryPointError(err);
|
|
61
63
|
}
|
|
62
64
|
},
|
|
63
|
-
compilePackage({ name, entry, externals, debug, minify, }) {
|
|
65
|
+
compilePackage({ name, entry, externals, debug, minify, outputPath, }) {
|
|
64
66
|
const startTime = performance.now();
|
|
65
67
|
const options = makeRspackConfig({
|
|
66
68
|
packageName: name,
|
|
@@ -68,6 +70,7 @@ const BuildUtils = {
|
|
|
68
70
|
externals,
|
|
69
71
|
debug,
|
|
70
72
|
minify,
|
|
73
|
+
outputPath,
|
|
71
74
|
});
|
|
72
75
|
const compiler = rspack(options);
|
|
73
76
|
return new Promise((resolve, reject) => {
|
|
@@ -119,9 +122,13 @@ const BuildUtils = {
|
|
|
119
122
|
},
|
|
120
123
|
async buildPackage({ name, installPath, externals, options, }) {
|
|
121
124
|
var _a;
|
|
125
|
+
const id = randomUUID().slice(0, 8);
|
|
126
|
+
const outputPath = path.join(config.tmp, 'dist', `build-${name}-${id}`);
|
|
127
|
+
fs.mkdirSync(outputPath, { recursive: true });
|
|
122
128
|
let entry = {};
|
|
123
129
|
if (options.splitCustomImports) {
|
|
124
130
|
if (!options.customImports || !options.customImports.length) {
|
|
131
|
+
fs.rmSync(outputPath, { recursive: true, force: true });
|
|
125
132
|
return { assets: [] };
|
|
126
133
|
}
|
|
127
134
|
options.customImports.forEach(importt => {
|
|
@@ -144,93 +151,99 @@ const BuildUtils = {
|
|
|
144
151
|
externals,
|
|
145
152
|
debug: options.debug,
|
|
146
153
|
minify: options.minify,
|
|
154
|
+
outputPath,
|
|
147
155
|
});
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
else {
|
|
168
|
-
Telemetry.parseWebpackStats(name, true, jsonStatsStartTime);
|
|
169
|
-
}
|
|
170
|
-
const compilationErrors = getCompilationErrors(stats);
|
|
171
|
-
if (error && !stats) {
|
|
172
|
-
throw new BuildError(error);
|
|
173
|
-
}
|
|
174
|
-
else if (compilationErrors.length) {
|
|
175
|
-
const missingModules = BuildUtils._parseMissingModules(compilationErrors);
|
|
176
|
-
if (missingModules.length) {
|
|
177
|
-
if (missingModules.length === 1 && missingModules[0] === name) {
|
|
178
|
-
throw new EntryPointError(compilationErrors.map(err => err.message));
|
|
179
|
-
}
|
|
180
|
-
else {
|
|
181
|
-
throw new MissingDependencyError(compilationErrors.map(err => err.toString()), { missingModules });
|
|
182
|
-
}
|
|
156
|
+
try {
|
|
157
|
+
const jsonStatsStartTime = performance.now();
|
|
158
|
+
let jsonStats = stats.toJson({
|
|
159
|
+
assets: true,
|
|
160
|
+
source: true,
|
|
161
|
+
chunks: false,
|
|
162
|
+
chunkGroups: false,
|
|
163
|
+
chunkModules: true,
|
|
164
|
+
modules: true,
|
|
165
|
+
nestedModules: true,
|
|
166
|
+
reasons: true,
|
|
167
|
+
depth: true,
|
|
168
|
+
errors: true,
|
|
169
|
+
entrypoints: false,
|
|
170
|
+
warnings: false,
|
|
171
|
+
});
|
|
172
|
+
if (!jsonStats) {
|
|
173
|
+
Telemetry.parseWebpackStats(name, false, jsonStatsStartTime);
|
|
174
|
+
throw new UnexpectedBuildError('Expected webpack json stats to be non-null, but was null');
|
|
183
175
|
}
|
|
184
|
-
else
|
|
185
|
-
|
|
186
|
-
|
|
176
|
+
else {
|
|
177
|
+
Telemetry.parseWebpackStats(name, true, jsonStatsStartTime);
|
|
178
|
+
}
|
|
179
|
+
const compilationErrors = getCompilationErrors(stats);
|
|
180
|
+
if (error && !stats) {
|
|
181
|
+
throw new BuildError(error);
|
|
182
|
+
}
|
|
183
|
+
else if (compilationErrors.length) {
|
|
184
|
+
const missingModules = BuildUtils._parseMissingModules(compilationErrors);
|
|
185
|
+
if (missingModules.length) {
|
|
186
|
+
if (missingModules.length === 1 && missingModules[0] === name) {
|
|
187
|
+
throw new EntryPointError(compilationErrors.map(err => err.message));
|
|
188
|
+
}
|
|
189
|
+
else {
|
|
190
|
+
throw new MissingDependencyError(compilationErrors.map(err => err.toString()), { missingModules });
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
else if (jsonStats.errors && jsonStats.errors.length > 0) {
|
|
194
|
+
if (jsonStats.errors.some(error => error.message.includes("Unexpected character '#'"))) {
|
|
195
|
+
throw new CLIBuildError(jsonStats.errors);
|
|
196
|
+
}
|
|
197
|
+
else {
|
|
198
|
+
throw new BuildError(jsonStats.errors);
|
|
199
|
+
}
|
|
187
200
|
}
|
|
188
201
|
else {
|
|
189
|
-
throw new
|
|
202
|
+
throw new UnexpectedBuildError('The webpack stats object was unexpectedly empty');
|
|
190
203
|
}
|
|
191
204
|
}
|
|
192
205
|
else {
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
+
const getAssetStats = async (asset) => {
|
|
207
|
+
const bundle = path.join(outputPath, asset.name);
|
|
208
|
+
const bundleContents = await fs.promises.readFile(bundle);
|
|
209
|
+
const gzip = gzipSync(bundleContents, {}).length;
|
|
210
|
+
const matches = asset.name.match(/(.+?)\.bundle\.(.+)$/);
|
|
211
|
+
if (!matches) {
|
|
212
|
+
throw new UnexpectedBuildError('Found an asset without the `.bundle` suffix. ' +
|
|
213
|
+
'A loader customization might be needed to recognize this asset type' +
|
|
214
|
+
asset.name);
|
|
215
|
+
}
|
|
216
|
+
const [, entryName, extension] = matches;
|
|
217
|
+
return {
|
|
218
|
+
name: entryName,
|
|
219
|
+
type: extension,
|
|
220
|
+
size: asset.size,
|
|
221
|
+
gzip,
|
|
222
|
+
};
|
|
223
|
+
};
|
|
224
|
+
const assetStatsPromises = ((_a = jsonStats === null || jsonStats === void 0 ? void 0 : jsonStats.assets) === null || _a === void 0 ? void 0 : _a.filter(asset => {
|
|
225
|
+
var _a;
|
|
226
|
+
return !((_a = asset.chunkNames) === null || _a === void 0 ? void 0 : _a.some(name => name === 'runtime' ||
|
|
227
|
+
(typeof name === 'string' && name.startsWith('runtime~'))));
|
|
228
|
+
}).filter(asset => typeof asset.name === 'string' &&
|
|
229
|
+
!asset.name.endsWith('LICENSE.txt')).map(getAssetStats)) || [];
|
|
230
|
+
const assetStats = await Promise.all(assetStatsPromises);
|
|
231
|
+
Telemetry.assetsGZIPParseTime(name, performance.now());
|
|
232
|
+
let dependencySizeResults = {};
|
|
233
|
+
if (options.includeDependencySizes) {
|
|
234
|
+
const dependencySizes = await getDependencySizes(name, jsonStats);
|
|
235
|
+
dependencySizeResults = {
|
|
236
|
+
dependencySizes,
|
|
237
|
+
};
|
|
206
238
|
}
|
|
207
|
-
const [, entryName, extension] = matches;
|
|
208
239
|
return {
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
size: asset.size,
|
|
212
|
-
gzip,
|
|
213
|
-
};
|
|
214
|
-
};
|
|
215
|
-
const assetStatsPromises = ((_a = jsonStats === null || jsonStats === void 0 ? void 0 : jsonStats.assets) === null || _a === void 0 ? void 0 : _a.filter(asset => {
|
|
216
|
-
var _a;
|
|
217
|
-
return !((_a = asset.chunkNames) === null || _a === void 0 ? void 0 : _a.some(name => name === 'runtime' ||
|
|
218
|
-
(typeof name === 'string' && name.startsWith('runtime~'))));
|
|
219
|
-
}).filter(asset => typeof asset.name === 'string' &&
|
|
220
|
-
!asset.name.endsWith('LICENSE.txt')).map(getAssetStats)) || [];
|
|
221
|
-
const assetStats = await Promise.all(assetStatsPromises);
|
|
222
|
-
Telemetry.assetsGZIPParseTime(name, performance.now());
|
|
223
|
-
let dependencySizeResults = {};
|
|
224
|
-
if (options.includeDependencySizes) {
|
|
225
|
-
const dependencySizes = await getDependencySizes(name, jsonStats);
|
|
226
|
-
dependencySizeResults = {
|
|
227
|
-
dependencySizes,
|
|
240
|
+
assets: assetStats || [],
|
|
241
|
+
...dependencySizeResults,
|
|
228
242
|
};
|
|
229
243
|
}
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
};
|
|
244
|
+
}
|
|
245
|
+
finally {
|
|
246
|
+
fs.rmSync(outputPath, { recursive: true, force: true });
|
|
234
247
|
}
|
|
235
248
|
},
|
|
236
249
|
async buildPackageIgnoringMissingDeps({ name, externals, installPath, options, }) {
|
package/package.json
CHANGED
|
@@ -15,6 +15,7 @@ type MakeRspackConfigOptions = {
|
|
|
15
15
|
debug?: boolean
|
|
16
16
|
minify?: boolean
|
|
17
17
|
entry: Entry
|
|
18
|
+
outputPath: string
|
|
18
19
|
}
|
|
19
20
|
|
|
20
21
|
export default function makeRspackConfig({
|
|
@@ -23,6 +24,7 @@ export default function makeRspackConfig({
|
|
|
23
24
|
externals,
|
|
24
25
|
debug: _debug,
|
|
25
26
|
minify = true,
|
|
27
|
+
outputPath,
|
|
26
28
|
}: MakeRspackConfigOptions): Configuration {
|
|
27
29
|
const externalsRegex = makeExternalsRegex(externals.externalPackages)
|
|
28
30
|
const isExternalRequest = (request: string) => {
|
|
@@ -176,6 +178,7 @@ export default function makeRspackConfig({
|
|
|
176
178
|
},
|
|
177
179
|
output: {
|
|
178
180
|
filename: '[name].bundle.js',
|
|
181
|
+
path: outputPath,
|
|
179
182
|
},
|
|
180
183
|
externals: ({ request }, callback) =>
|
|
181
184
|
isExternalRequest(request || '')
|
package/src/utils/build.utils.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import path from 'path'
|
|
2
|
+
import { randomUUID } from 'crypto'
|
|
3
|
+
import config from '../config/config.js'
|
|
2
4
|
import { Entry, rspack } from '@rspack/core'
|
|
3
5
|
import isValidNPMName from 'is-valid-npm-name'
|
|
4
6
|
import { gzipSync } from 'zlib'
|
|
@@ -28,6 +30,7 @@ type CompilePackageArgs = {
|
|
|
28
30
|
entry: Entry
|
|
29
31
|
debug?: boolean
|
|
30
32
|
minify?: boolean
|
|
33
|
+
outputPath: string
|
|
31
34
|
}
|
|
32
35
|
|
|
33
36
|
type CompilePackageReturn = {
|
|
@@ -133,6 +136,7 @@ const BuildUtils = {
|
|
|
133
136
|
externals,
|
|
134
137
|
debug,
|
|
135
138
|
minify,
|
|
139
|
+
outputPath,
|
|
136
140
|
}: CompilePackageArgs) {
|
|
137
141
|
const startTime = performance.now()
|
|
138
142
|
|
|
@@ -142,6 +146,7 @@ const BuildUtils = {
|
|
|
142
146
|
externals,
|
|
143
147
|
debug,
|
|
144
148
|
minify,
|
|
149
|
+
outputPath,
|
|
145
150
|
})
|
|
146
151
|
|
|
147
152
|
const compiler = rspack(options)
|
|
@@ -214,10 +219,14 @@ const BuildUtils = {
|
|
|
214
219
|
externals,
|
|
215
220
|
options,
|
|
216
221
|
}: BuildPackageArgs) {
|
|
222
|
+
const id = randomUUID().slice(0, 8)
|
|
223
|
+
const outputPath = path.join(config.tmp, 'dist', `build-${name}-${id}`)
|
|
224
|
+
fs.mkdirSync(outputPath, { recursive: true })
|
|
217
225
|
let entry: any = {}
|
|
218
226
|
|
|
219
227
|
if (options.splitCustomImports) {
|
|
220
228
|
if (!options.customImports || !options.customImports.length) {
|
|
229
|
+
fs.rmSync(outputPath, { recursive: true, force: true })
|
|
221
230
|
return { assets: [] }
|
|
222
231
|
}
|
|
223
232
|
options.customImports.forEach(importt => {
|
|
@@ -240,121 +249,127 @@ const BuildUtils = {
|
|
|
240
249
|
externals,
|
|
241
250
|
debug: options.debug,
|
|
242
251
|
minify: options.minify,
|
|
252
|
+
outputPath,
|
|
243
253
|
})
|
|
244
254
|
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
if (!jsonStats) {
|
|
262
|
-
Telemetry.parseWebpackStats(name, false, jsonStatsStartTime)
|
|
263
|
-
throw new UnexpectedBuildError(
|
|
264
|
-
'Expected webpack json stats to be non-null, but was null',
|
|
265
|
-
)
|
|
266
|
-
} else {
|
|
267
|
-
Telemetry.parseWebpackStats(name, true, jsonStatsStartTime)
|
|
268
|
-
}
|
|
269
|
-
|
|
270
|
-
const compilationErrors = getCompilationErrors(stats)
|
|
271
|
-
|
|
272
|
-
if (error && !stats) {
|
|
273
|
-
throw new BuildError(error)
|
|
274
|
-
} else if (compilationErrors.length) {
|
|
275
|
-
const missingModules = BuildUtils._parseMissingModules(compilationErrors)
|
|
255
|
+
try {
|
|
256
|
+
const jsonStatsStartTime = performance.now()
|
|
257
|
+
let jsonStats = stats.toJson({
|
|
258
|
+
assets: true,
|
|
259
|
+
source: true,
|
|
260
|
+
chunks: false,
|
|
261
|
+
chunkGroups: false,
|
|
262
|
+
chunkModules: true,
|
|
263
|
+
modules: true,
|
|
264
|
+
nestedModules: true,
|
|
265
|
+
reasons: true,
|
|
266
|
+
depth: true,
|
|
267
|
+
errors: true,
|
|
268
|
+
entrypoints: false,
|
|
269
|
+
warnings: false,
|
|
270
|
+
})
|
|
276
271
|
|
|
277
|
-
if (
|
|
278
|
-
|
|
279
|
-
throw new EntryPointError(compilationErrors.map(err => err.message))
|
|
280
|
-
} else {
|
|
281
|
-
throw new MissingDependencyError(
|
|
282
|
-
compilationErrors.map(err => err.toString()),
|
|
283
|
-
{ missingModules },
|
|
284
|
-
)
|
|
285
|
-
}
|
|
286
|
-
} else if (jsonStats.errors && jsonStats.errors.length > 0) {
|
|
287
|
-
if (
|
|
288
|
-
jsonStats.errors.some(error =>
|
|
289
|
-
error.message.includes("Unexpected character '#'"),
|
|
290
|
-
)
|
|
291
|
-
) {
|
|
292
|
-
throw new CLIBuildError(jsonStats.errors)
|
|
293
|
-
} else {
|
|
294
|
-
throw new BuildError(jsonStats.errors)
|
|
295
|
-
}
|
|
296
|
-
} else {
|
|
272
|
+
if (!jsonStats) {
|
|
273
|
+
Telemetry.parseWebpackStats(name, false, jsonStatsStartTime)
|
|
297
274
|
throw new UnexpectedBuildError(
|
|
298
|
-
'
|
|
275
|
+
'Expected webpack json stats to be non-null, but was null',
|
|
299
276
|
)
|
|
277
|
+
} else {
|
|
278
|
+
Telemetry.parseWebpackStats(name, true, jsonStatsStartTime)
|
|
300
279
|
}
|
|
301
|
-
} else {
|
|
302
|
-
const getAssetStats = async (asset: RspackStatsAsset) => {
|
|
303
|
-
const bundle = path.join(process.cwd(), 'dist', asset.name)
|
|
304
|
-
const bundleContents = await fs.promises.readFile(bundle)
|
|
305
280
|
|
|
306
|
-
|
|
307
|
-
const matches = asset.name.match(/(.+?)\.bundle\.(.+)$/)
|
|
281
|
+
const compilationErrors = getCompilationErrors(stats)
|
|
308
282
|
|
|
309
|
-
|
|
283
|
+
if (error && !stats) {
|
|
284
|
+
throw new BuildError(error)
|
|
285
|
+
} else if (compilationErrors.length) {
|
|
286
|
+
const missingModules =
|
|
287
|
+
BuildUtils._parseMissingModules(compilationErrors)
|
|
288
|
+
|
|
289
|
+
if (missingModules.length) {
|
|
290
|
+
if (missingModules.length === 1 && missingModules[0] === name) {
|
|
291
|
+
throw new EntryPointError(compilationErrors.map(err => err.message))
|
|
292
|
+
} else {
|
|
293
|
+
throw new MissingDependencyError(
|
|
294
|
+
compilationErrors.map(err => err.toString()),
|
|
295
|
+
{ missingModules },
|
|
296
|
+
)
|
|
297
|
+
}
|
|
298
|
+
} else if (jsonStats.errors && jsonStats.errors.length > 0) {
|
|
299
|
+
if (
|
|
300
|
+
jsonStats.errors.some(error =>
|
|
301
|
+
error.message.includes("Unexpected character '#'"),
|
|
302
|
+
)
|
|
303
|
+
) {
|
|
304
|
+
throw new CLIBuildError(jsonStats.errors)
|
|
305
|
+
} else {
|
|
306
|
+
throw new BuildError(jsonStats.errors)
|
|
307
|
+
}
|
|
308
|
+
} else {
|
|
310
309
|
throw new UnexpectedBuildError(
|
|
311
|
-
'
|
|
312
|
-
'A loader customization might be needed to recognize this asset type' +
|
|
313
|
-
asset.name,
|
|
310
|
+
'The webpack stats object was unexpectedly empty',
|
|
314
311
|
)
|
|
315
312
|
}
|
|
313
|
+
} else {
|
|
314
|
+
const getAssetStats = async (asset: RspackStatsAsset) => {
|
|
315
|
+
const bundle = path.join(outputPath, asset.name)
|
|
316
|
+
const bundleContents = await fs.promises.readFile(bundle)
|
|
317
|
+
|
|
318
|
+
const gzip = gzipSync(bundleContents, {}).length
|
|
319
|
+
const matches = asset.name.match(/(.+?)\.bundle\.(.+)$/)
|
|
320
|
+
|
|
321
|
+
if (!matches) {
|
|
322
|
+
throw new UnexpectedBuildError(
|
|
323
|
+
'Found an asset without the `.bundle` suffix. ' +
|
|
324
|
+
'A loader customization might be needed to recognize this asset type' +
|
|
325
|
+
asset.name,
|
|
326
|
+
)
|
|
327
|
+
}
|
|
316
328
|
|
|
317
|
-
|
|
329
|
+
const [, entryName, extension] = matches
|
|
318
330
|
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
331
|
+
return {
|
|
332
|
+
name: entryName,
|
|
333
|
+
type: extension,
|
|
334
|
+
size: asset.size,
|
|
335
|
+
gzip,
|
|
336
|
+
}
|
|
324
337
|
}
|
|
325
|
-
}
|
|
326
338
|
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
339
|
+
const assetStatsPromises =
|
|
340
|
+
jsonStats?.assets
|
|
341
|
+
?.filter(
|
|
342
|
+
asset =>
|
|
343
|
+
!asset.chunkNames?.some(
|
|
344
|
+
name =>
|
|
345
|
+
name === 'runtime' ||
|
|
346
|
+
(typeof name === 'string' && name.startsWith('runtime~')),
|
|
347
|
+
),
|
|
348
|
+
)
|
|
349
|
+
.filter(
|
|
350
|
+
asset =>
|
|
351
|
+
typeof asset.name === 'string' &&
|
|
352
|
+
!asset.name.endsWith('LICENSE.txt'),
|
|
353
|
+
)
|
|
354
|
+
.map(getAssetStats) || []
|
|
355
|
+
const assetStats = await Promise.all(assetStatsPromises)
|
|
356
|
+
Telemetry.assetsGZIPParseTime(name, performance.now())
|
|
357
|
+
|
|
358
|
+
let dependencySizeResults = {}
|
|
359
|
+
if (options.includeDependencySizes) {
|
|
360
|
+
const dependencySizes = await getDependencySizes(name, jsonStats)
|
|
361
|
+
dependencySizeResults = {
|
|
362
|
+
dependencySizes,
|
|
363
|
+
}
|
|
351
364
|
}
|
|
352
|
-
}
|
|
353
365
|
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
366
|
+
return {
|
|
367
|
+
assets: assetStats || [],
|
|
368
|
+
...dependencySizeResults,
|
|
369
|
+
}
|
|
357
370
|
}
|
|
371
|
+
} finally {
|
|
372
|
+
fs.rmSync(outputPath, { recursive: true, force: true })
|
|
358
373
|
}
|
|
359
374
|
},
|
|
360
375
|
async buildPackageIgnoringMissingDeps({
|