@umijs/bundler-utoopack 4.6.74 → 4.6.76

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/config.js CHANGED
@@ -834,7 +834,7 @@ async function getDevUtooPackConfig(rawOpts) {
834
834
  emotion
835
835
  },
836
836
  define,
837
- stats: true,
837
+ stats: false,
838
838
  // Windows persistent cache restore is currently unstable in utoopack dev.
839
839
  persistentCaching: getDefaultPersistentCaching("development"),
840
840
  nodePolyfill: true,
package/dist/index.d.ts CHANGED
@@ -4,6 +4,7 @@ export { findRootDir } from '@utoo/pack';
4
4
  export * from './config';
5
5
  export type { IUtoopackUserConfig } from './types';
6
6
  export declare function isUtoopackProxyStartupError(error: any, utooServePort: number): boolean;
7
+ export declare function createDevStatsFromClientPaths(clientPaths: string[] | undefined, entryNames: string[]): any;
7
8
  export declare function build(opts: IOpts): Promise<any>;
8
9
  export declare function buildSSR(opts: IOpts & {
9
10
  serverBuildPath: string;
package/dist/index.js CHANGED
@@ -32,6 +32,7 @@ var src_exports = {};
32
32
  __export(src_exports, {
33
33
  build: () => build,
34
34
  buildSSR: () => buildSSR,
35
+ createDevStatsFromClientPaths: () => createDevStatsFromClientPaths,
35
36
  dev: () => dev,
36
37
  findRootDir: () => import_pack.findRootDir,
37
38
  isUtoopackProxyStartupError: () => isUtoopackProxyStartupError
@@ -51,6 +52,33 @@ __reExport(src_exports, require("./config"), module.exports);
51
52
  function isUtoopackProxyStartupError(error, utooServePort) {
52
53
  return (error == null ? void 0 : error.code) === "ECONNREFUSED" && Number(error == null ? void 0 : error.port) === utooServePort && (!(error == null ? void 0 : error.address) || error.address === "127.0.0.1");
53
54
  }
55
+ function addStatsCompatibility(stats) {
56
+ stats.hasErrors = () => false;
57
+ stats.toJson = () => stats;
58
+ stats.toString = () => {
59
+ };
60
+ stats.compilation = {
61
+ ...stats,
62
+ assets: (stats.assets || []).reduce(
63
+ (acc, cur) => Object.assign(acc, { [cur.name]: cur }),
64
+ {}
65
+ )
66
+ };
67
+ return stats;
68
+ }
69
+ function createDevStatsFromClientPaths(clientPaths, entryNames) {
70
+ const assets = Array.from(new Set(clientPaths ?? [])).map((name) => ({
71
+ name
72
+ }));
73
+ return addStatsCompatibility({
74
+ assets,
75
+ chunks: [],
76
+ modules: [],
77
+ entrypoints: Object.fromEntries(
78
+ entryNames.map((entryName) => [entryName, { assets, chunks: [] }])
79
+ )
80
+ });
81
+ }
54
82
  function getUtoopackRootDir(cwd, utoopackConfig, findRootDir2) {
55
83
  const normalizedCwd = (0, import_config.normalizeUtoopackPath)(cwd);
56
84
  if (typeof (utoopackConfig == null ? void 0 : utoopackConfig.root) === "string") {
@@ -306,30 +334,24 @@ async function dev(opts) {
306
334
  `File stats.json not found by utoopack dev at ${statsPath}: ${e.message}`
307
335
  );
308
336
  }
309
- stats.hasErrors = () => false;
310
- stats.toJson = () => stats;
311
- stats.toString = () => {
312
- };
313
- stats.compilation = {
314
- ...stats,
315
- assets: stats.assets.reduce(
316
- (acc, cur) => Object.assign(acc, { [cur.name]: cur }),
317
- {}
318
- )
319
- };
320
- return stats;
337
+ return addStatsCompatibility(stats);
321
338
  };
339
+ let clientPaths = [];
340
+ const shouldReadFullStats = Boolean(process.env.ANALYZE) || Boolean(utooPackConfig.config.stats);
322
341
  try {
323
342
  await Promise.all([
324
343
  serverReady,
325
344
  utooPackServe(utooPackConfig, normalizedCwd, rootDir, {
326
345
  port: utooServePort,
327
346
  hostname: "127.0.0.1",
328
- logServerInfo: false
347
+ logServerInfo: false,
348
+ onReady(context) {
349
+ clientPaths = context.clientPaths ?? [];
350
+ }
329
351
  })
330
352
  ]);
331
353
  const time = Date.now() - devStartTime;
332
- const stats = createStatsObject();
354
+ const stats = shouldReadFullStats ? createStatsObject() : createDevStatsFromClientPaths(clientPaths, Object.keys(opts.entry));
333
355
  await (onDevCompileDone == null ? void 0 : onDevCompileDone({
334
356
  stats,
335
357
  time,
@@ -354,6 +376,7 @@ async function dev(opts) {
354
376
  0 && (module.exports = {
355
377
  build,
356
378
  buildSSR,
379
+ createDevStatsFromClientPaths,
357
380
  dev,
358
381
  findRootDir,
359
382
  isUtoopackProxyStartupError,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@umijs/bundler-utoopack",
3
- "version": "4.6.74",
3
+ "version": "4.6.76",
4
4
  "description": "@umijs/bundler-utoopack",
5
5
  "repository": {
6
6
  "type": "git",
@@ -14,7 +14,7 @@
14
14
  "dist"
15
15
  ],
16
16
  "dependencies": {
17
- "@utoo/pack": "1.4.22",
17
+ "@utoo/pack": "1.4.25",
18
18
  "compression": "^1.7.4",
19
19
  "connect-history-api-fallback": "^2.0.0",
20
20
  "cors": "^2.8.5",
@@ -26,8 +26,8 @@
26
26
  "resolve-url-loader": "5.0.0",
27
27
  "sass": "1.54.0",
28
28
  "sass-loader": "13.2.0",
29
- "@umijs/bundler-utils": "4.6.74",
30
- "@umijs/bundler-webpack": "4.6.74"
29
+ "@umijs/bundler-utils": "4.6.76",
30
+ "@umijs/bundler-webpack": "4.6.76"
31
31
  },
32
32
  "publishConfig": {
33
33
  "access": "public"