@umijs/bundler-utoopack 4.6.66 → 4.6.68

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.
@@ -11,6 +11,7 @@ console.log('[utoopack] connecting...');
11
11
  let hasCompileErrors = false;
12
12
  let shouldReloadOnRecovery = false;
13
13
  let overlayIframe = null;
14
+ let isSocketConnected = false;
14
15
 
15
16
  const enableErrorOverlay =
16
17
  typeof process === 'undefined' ||
@@ -145,6 +146,7 @@ function handleSuccess() {
145
146
  function handleMessage(payload) {
146
147
  switch (payload.action) {
147
148
  case ACTIONS.TURBOPACK_CONNECTED:
149
+ isSocketConnected = true;
148
150
  console.log('[utoopack] connected.');
149
151
  break;
150
152
  case ACTIONS.BUILDING:
@@ -198,6 +200,11 @@ socket.addEventListener('message', ({ data }) => {
198
200
  });
199
201
 
200
202
  socket.addEventListener('close', async () => {
203
+ if (!isSocketConnected) {
204
+ console.info('[utoopack] Dev server connection failed.');
205
+ return;
206
+ }
207
+
201
208
  console.info('[utoopack] Dev server disconnected. Polling for restart...');
202
209
  await waitForSuccessfulPing();
203
210
  window.location.reload();
package/dist/config.d.ts CHANGED
@@ -9,7 +9,7 @@ export declare function getSSRUtooPackConfig(rawOpts: IOpts & {
9
9
  useHash?: boolean;
10
10
  isDev?: boolean;
11
11
  }): Promise<BundleOptions>;
12
- export declare type IDevOpts = {
12
+ export type IDevOpts = {
13
13
  afterMiddlewares?: any[];
14
14
  beforeMiddlewares?: any[];
15
15
  onDevCompileDone?: Function;
package/dist/config.js CHANGED
@@ -151,9 +151,18 @@ function isSerializableBabelItem(item) {
151
151
  return false;
152
152
  }
153
153
  }
154
- function getExtraBabelModuleRules(opts) {
154
+ function isReactCompilerEnabled(config) {
155
+ if ("reactCompiler" in config) {
156
+ return config.reactCompiler !== false;
157
+ }
158
+ return "forget" in config;
159
+ }
160
+ function shouldAddBabelLoaderRules(config) {
155
161
  var _a;
156
- if (((_a = opts.config.utoopack) == null ? void 0 : _a.babelLoader) !== true) {
162
+ return ((_a = config.utoopack) == null ? void 0 : _a.babelLoader) === true || isReactCompilerEnabled(config);
163
+ }
164
+ function getExtraBabelModuleRules(opts) {
165
+ if (!shouldAddBabelLoaderRules(opts.config)) {
157
166
  return {};
158
167
  }
159
168
  const plugins = getExtraBabelPlugins(opts).filter((plugin) => {
@@ -197,7 +206,7 @@ function getExtraBabelModuleRules(opts) {
197
206
  module: {
198
207
  rules: Object.fromEntries(
199
208
  ["js", "mjs", "cjs", "jsx", "ts", "tsx"].map((ext) => [
200
- `**/src/**/*.${ext}`,
209
+ `**/*.${ext}`,
201
210
  rule
202
211
  ])
203
212
  )
@@ -347,7 +356,8 @@ function getNormalizedAlias(alias, rootDir) {
347
356
  } catch (e) {
348
357
  }
349
358
  }
350
- if (!isDirectory) continue;
359
+ if (!isDirectory)
360
+ continue;
351
361
  }
352
362
  newAlias[`${key}/*`] = `${value}/*`;
353
363
  }
@@ -395,11 +405,13 @@ function toWildcardExternalConfig(value) {
395
405
  }
396
406
  }
397
407
  function getExternalSubPathGlob(externalKey) {
398
- if (!externalKey.includes("*")) return;
408
+ if (!externalKey.includes("*"))
409
+ return;
399
410
  const parts = externalKey.split("/");
400
411
  const packageName = externalKey.startsWith("@") ? parts.slice(0, 2).join("/") : parts[0];
401
412
  const subPathGlob = externalKey.slice(packageName.length);
402
- if (!packageName || !subPathGlob.startsWith("/")) return;
413
+ if (!packageName || !subPathGlob.startsWith("/"))
414
+ return;
403
415
  return {
404
416
  packageName,
405
417
  subPathGlob
@@ -452,9 +464,11 @@ function getNormalizedExternals(externals) {
452
464
  );
453
465
  Object.entries(externals || {}).forEach(([k, v]) => {
454
466
  const externalSubPathGlob = getExternalSubPathGlob(k);
455
- if (!externalSubPathGlob) return;
467
+ if (!externalSubPathGlob)
468
+ return;
456
469
  const normalized = toWildcardExternalConfig(v);
457
- if (!normalized) return;
470
+ if (!normalized)
471
+ return;
458
472
  ret[externalSubPathGlob.packageName] = addWildcardSubPath(
459
473
  ret[externalSubPathGlob.packageName] && typeof ret[externalSubPathGlob.packageName] === "object" ? ret[externalSubPathGlob.packageName] : normalized,
460
474
  externalSubPathGlob.subPathGlob
@@ -706,6 +720,7 @@ async function getSSRUtooPackConfig(rawOpts) {
706
720
  target: "node",
707
721
  sourceMaps: false,
708
722
  stats: true,
723
+ pluginRuntimeStrategy: "childProcesses",
709
724
  nodePolyfill: false,
710
725
  optimization: {
711
726
  ...utooBundlerOpts.config.optimization,
package/dist/index.js CHANGED
@@ -207,7 +207,8 @@ async function dev(opts) {
207
207
  }
208
208
  const publicPathPrefix = (() => {
209
209
  const p = opts.config.publicPath;
210
- if (!p || p === "/" || p === "auto") return null;
210
+ if (!p || p === "/" || p === "auto")
211
+ return null;
211
212
  return p.startsWith("/") ? p : "/" + p;
212
213
  })();
213
214
  app.use(
package/dist/types.d.ts CHANGED
@@ -1,10 +1,10 @@
1
1
  import type { IOpts as IConfigOpts } from '@umijs/bundler-webpack';
2
2
  import type { ConfigComplete } from '@utoo/pack';
3
- export declare type IUtoopackUserConfig = ConfigComplete & {
3
+ export type IUtoopackUserConfig = ConfigComplete & {
4
4
  babelLoader?: boolean;
5
5
  root?: string;
6
6
  };
7
- export declare type IOpts = {
7
+ export type IOpts = {
8
8
  cwd: string;
9
9
  rootDir: string;
10
10
  entry: Record<string, string>;
package/dist/util.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import type { WebpackConfig } from '@utoo/pack';
2
- declare type IDevBannerOpts = {
2
+ type IDevBannerOpts = {
3
3
  duration?: number;
4
4
  host?: string;
5
5
  ip?: string;
@@ -7,7 +7,7 @@ declare type IDevBannerOpts = {
7
7
  port?: number;
8
8
  protocol: string;
9
9
  };
10
- declare type IBuildBannerOpts = {
10
+ type IBuildBannerOpts = {
11
11
  assetCount?: number;
12
12
  duration?: number;
13
13
  outputPath?: string;
@@ -20,8 +20,8 @@ export declare function getCssOutputFilenames(opts: {
20
20
  webpackConfig: WebpackConfig;
21
21
  useHash: boolean;
22
22
  }): {
23
- cssChunkFilename: string;
24
23
  cssFilename?: string | undefined;
24
+ cssChunkFilename: string;
25
25
  };
26
26
  export declare function getSSRCssSplitChunks(config: Record<string, any>): {
27
27
  splitChunks?: undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@umijs/bundler-utoopack",
3
- "version": "4.6.66",
3
+ "version": "4.6.68",
4
4
  "description": "@umijs/bundler-utoopack",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -9,7 +9,7 @@
9
9
  "dist"
10
10
  ],
11
11
  "dependencies": {
12
- "@utoo/pack": "1.4.13",
12
+ "@utoo/pack": "1.4.17",
13
13
  "compression": "^1.7.4",
14
14
  "connect-history-api-fallback": "^2.0.0",
15
15
  "cors": "^2.8.5",
@@ -21,11 +21,8 @@
21
21
  "resolve-url-loader": "5.0.0",
22
22
  "sass": "1.54.0",
23
23
  "sass-loader": "13.2.0",
24
- "@umijs/bundler-utils": "4.6.66",
25
- "@umijs/bundler-webpack": "4.6.66"
26
- },
27
- "devDependencies": {
28
- "father": "4.1.5"
24
+ "@umijs/bundler-utils": "4.6.68",
25
+ "@umijs/bundler-webpack": "4.6.68"
29
26
  },
30
27
  "publishConfig": {
31
28
  "access": "public"