@utoo/pack 1.4.12-alpha.7 → 1.4.12

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.
@@ -234,8 +234,19 @@ async function runDev(options, projectPath, rootPath, serverOptions) {
234
234
  : serveOptsBase.hostname;
235
235
  (0, printServerInfo_1.printServerInfo)(scheme, displayHost, serveOptsBase.port);
236
236
  }
237
- const cleanup = () => {
238
- hotReloader.close();
237
+ let cleanupStarted = false;
238
+ const cleanup = async () => {
239
+ if (cleanupStarted) {
240
+ return;
241
+ }
242
+ cleanupStarted = true;
243
+ try {
244
+ await hotReloader.close();
245
+ }
246
+ catch (err) {
247
+ console.error(err);
248
+ process.exit(1);
249
+ }
239
250
  // We always create HTTP/1.1 server (http or https), so closeAllConnections exists; Hono's
240
251
  // ServerType union includes HTTP/2, so TS does not narrow. Use runtime check to satisfy types.
241
252
  if ("closeAllConnections" in server &&
package/cjs/core/hmr.d.ts CHANGED
@@ -38,7 +38,7 @@ export interface HotReloaderInterface {
38
38
  /** Handle a message from a client (JSON string). */
39
39
  handleClientMessage(ws: WSLike, data: string): void;
40
40
  buildFallbackError(): Promise<void>;
41
- close(): void;
41
+ close(): Promise<void>;
42
42
  }
43
43
  export type ChangeSubscriptions = Map<string, Promise<AsyncIterableIterator<TurbopackResult>>>;
44
44
  export type ReadyIds = Set<string>;
package/cjs/core/hmr.js CHANGED
@@ -548,11 +548,12 @@ async function createHotReloader(bundleOptions, projectPath, rootPath) {
548
548
  async buildFallbackError() {
549
549
  // Not implemented yet.
550
550
  },
551
- close() {
551
+ async close() {
552
552
  closed = true;
553
- void disposeBackgroundWatchSubscriptions();
554
- closePromise !== null && closePromise !== void 0 ? closePromise : (closePromise = project
555
- .onExit()
553
+ const disposePromise = disposeBackgroundWatchSubscriptions();
554
+ closePromise !== null && closePromise !== void 0 ? closePromise : (closePromise = (bundleOptions.config.persistentCaching
555
+ ? project.shutdown()
556
+ : project.onExit())
556
557
  .catch((err) => {
557
558
  console.error(err);
558
559
  })
@@ -563,6 +564,7 @@ async function createHotReloader(bundleOptions, projectPath, rootPath) {
563
564
  wsClient.close();
564
565
  }
565
566
  clients.clear();
567
+ await Promise.all([disposePromise, closePromise]);
566
568
  },
567
569
  };
568
570
  handleEntrypointsSubscription().catch((err) => {
@@ -102,7 +102,6 @@ const DEFAULT_OPTIMIZE_PACKAGE_IMPORTS = [
102
102
  "date-fns",
103
103
  "lodash-es",
104
104
  "ramda",
105
- "antd",
106
105
  "react-bootstrap",
107
106
  "ahooks",
108
107
  "@ant-design/icons",
@@ -228,8 +228,19 @@ async function runDev(options, projectPath, rootPath, serverOptions) {
228
228
  : serveOptsBase.hostname;
229
229
  printServerInfo(scheme, displayHost, serveOptsBase.port);
230
230
  }
231
- const cleanup = () => {
232
- hotReloader.close();
231
+ let cleanupStarted = false;
232
+ const cleanup = async () => {
233
+ if (cleanupStarted) {
234
+ return;
235
+ }
236
+ cleanupStarted = true;
237
+ try {
238
+ await hotReloader.close();
239
+ }
240
+ catch (err) {
241
+ console.error(err);
242
+ process.exit(1);
243
+ }
233
244
  // We always create HTTP/1.1 server (http or https), so closeAllConnections exists; Hono's
234
245
  // ServerType union includes HTTP/2, so TS does not narrow. Use runtime check to satisfy types.
235
246
  if ("closeAllConnections" in server &&
package/esm/core/hmr.d.ts CHANGED
@@ -38,7 +38,7 @@ export interface HotReloaderInterface {
38
38
  /** Handle a message from a client (JSON string). */
39
39
  handleClientMessage(ws: WSLike, data: string): void;
40
40
  buildFallbackError(): Promise<void>;
41
- close(): void;
41
+ close(): Promise<void>;
42
42
  }
43
43
  export type ChangeSubscriptions = Map<string, Promise<AsyncIterableIterator<TurbopackResult>>>;
44
44
  export type ReadyIds = Set<string>;
package/esm/core/hmr.js CHANGED
@@ -543,11 +543,12 @@ export async function createHotReloader(bundleOptions, projectPath, rootPath) {
543
543
  async buildFallbackError() {
544
544
  // Not implemented yet.
545
545
  },
546
- close() {
546
+ async close() {
547
547
  closed = true;
548
- void disposeBackgroundWatchSubscriptions();
549
- closePromise !== null && closePromise !== void 0 ? closePromise : (closePromise = project
550
- .onExit()
548
+ const disposePromise = disposeBackgroundWatchSubscriptions();
549
+ closePromise !== null && closePromise !== void 0 ? closePromise : (closePromise = (bundleOptions.config.persistentCaching
550
+ ? project.shutdown()
551
+ : project.onExit())
551
552
  .catch((err) => {
552
553
  console.error(err);
553
554
  })
@@ -558,6 +559,7 @@ export async function createHotReloader(bundleOptions, projectPath, rootPath) {
558
559
  wsClient.close();
559
560
  }
560
561
  clients.clear();
562
+ await Promise.all([disposePromise, closePromise]);
561
563
  },
562
564
  };
563
565
  handleEntrypointsSubscription().catch((err) => {
@@ -63,7 +63,6 @@ const DEFAULT_OPTIMIZE_PACKAGE_IMPORTS = [
63
63
  "date-fns",
64
64
  "lodash-es",
65
65
  "ramda",
66
- "antd",
67
66
  "react-bootstrap",
68
67
  "ahooks",
69
68
  "@ant-design/icons",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@utoo/pack",
3
- "version": "1.4.12-alpha.7",
3
+ "version": "1.4.12",
4
4
  "main": "cjs/index.js",
5
5
  "module": "esm/index.js",
6
6
  "types": "esm/index.d.ts",
@@ -41,7 +41,7 @@
41
41
  "@hono/node-server": "^1.19.11",
42
42
  "@hono/node-ws": "^1.3.0",
43
43
  "@swc/helpers": "0.5.15",
44
- "@utoo/pack-shared": "1.4.12-alpha.7",
44
+ "@utoo/pack-shared": "1.4.12",
45
45
  "domparser-rs": "^0.0.7",
46
46
  "find-up": "4.1.0",
47
47
  "get-port": "5.1.1",
@@ -96,12 +96,12 @@
96
96
  "directory": "packages/pack"
97
97
  },
98
98
  "optionalDependencies": {
99
- "@utoo/pack-darwin-arm64": "1.4.12-alpha.7",
100
- "@utoo/pack-darwin-x64": "1.4.12-alpha.7",
101
- "@utoo/pack-linux-arm64-gnu": "1.4.12-alpha.7",
102
- "@utoo/pack-linux-arm64-musl": "1.4.12-alpha.7",
103
- "@utoo/pack-linux-x64-gnu": "1.4.12-alpha.7",
104
- "@utoo/pack-linux-x64-musl": "1.4.12-alpha.7",
105
- "@utoo/pack-win32-x64-msvc": "1.4.12-alpha.7"
99
+ "@utoo/pack-darwin-arm64": "1.4.12",
100
+ "@utoo/pack-darwin-x64": "1.4.12",
101
+ "@utoo/pack-linux-arm64-gnu": "1.4.12",
102
+ "@utoo/pack-linux-arm64-musl": "1.4.12",
103
+ "@utoo/pack-linux-x64-gnu": "1.4.12",
104
+ "@utoo/pack-linux-x64-musl": "1.4.12",
105
+ "@utoo/pack-win32-x64-msvc": "1.4.12"
106
106
  }
107
107
  }