@utoo/pack 1.4.12-alpha.1 → 1.4.12-alpha.10

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/cjs/binding.d.ts CHANGED
@@ -243,11 +243,6 @@ export interface NapiSourcePos {
243
243
  line: number
244
244
  column: number
245
245
  }
246
- export interface NapiDiagnostic {
247
- category: string
248
- name: string
249
- payload: Record<string, string>
250
- }
251
246
  /**
252
247
  * Initialize tracing subscriber to emit traces. This configures subscribers
253
248
  * for Trace Event Format <https://docs.google.com/document/d/1CvAClvFfyA5R-PhYUmn5OOQtYMH4h6I0nSsKchNAySU/preview>.
@@ -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
@@ -155,7 +155,6 @@ async function createHotReloader(bundleOptions, projectPath, rootPath) {
155
155
  const sendEnqueuedMessagesDebounce = (0, common_1.debounce)(sendEnqueuedMessages, 2);
156
156
  function sendTurbopackMessage(payload) {
157
157
  var _a;
158
- payload.diagnostics = [];
159
158
  payload.issues = [];
160
159
  for (const client of clients) {
161
160
  (_a = clientStates.get(client)) === null || _a === void 0 ? void 0 : _a.turbopackUpdates.push(payload);
@@ -549,11 +548,12 @@ async function createHotReloader(bundleOptions, projectPath, rootPath) {
549
548
  async buildFallbackError() {
550
549
  // Not implemented yet.
551
550
  },
552
- close() {
551
+ async close() {
553
552
  closed = true;
554
- void disposeBackgroundWatchSubscriptions();
555
- closePromise !== null && closePromise !== void 0 ? closePromise : (closePromise = project
556
- .onExit()
553
+ const disposePromise = disposeBackgroundWatchSubscriptions();
554
+ closePromise !== null && closePromise !== void 0 ? closePromise : (closePromise = (bundleOptions.config.persistentCaching
555
+ ? project.shutdown()
556
+ : project.onExit())
557
557
  .catch((err) => {
558
558
  console.error(err);
559
559
  })
@@ -564,6 +564,7 @@ async function createHotReloader(bundleOptions, projectPath, rootPath) {
564
564
  wsClient.close();
565
565
  }
566
566
  clients.clear();
567
+ await Promise.all([disposePromise, closePromise]);
567
568
  },
568
569
  };
569
570
  handleEntrypointsSubscription().catch((err) => {
@@ -40,7 +40,6 @@ export declare function projectFactory(): (options: Required<ProjectOptions>, tu
40
40
  appPaths: NapiWrittenEndpoint[] | undefined;
41
41
  libraryPaths: NapiWrittenEndpoint[] | undefined;
42
42
  issues: binding.NapiIssue[];
43
- diagnostics: binding.NapiDiagnostic[];
44
43
  }, void, unknown>;
45
44
  hmrEvents(identifier: string): AsyncIterableIterator<TurbopackResult<Update>>;
46
45
  hmrIdentifiersSubscribe(): AsyncIterableIterator<TurbopackResult<HmrIdentifiers>>;
@@ -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",
@@ -493,7 +492,6 @@ function projectFactory() {
493
492
  appPaths: entrypoints.appPaths,
494
493
  libraryPaths: entrypoints.libraryPaths,
495
494
  issues: entrypoints.issues,
496
- diagnostics: entrypoints.diagnostics,
497
495
  };
498
496
  }
499
497
  return async function createProject(options, turboEngineOptions) {
@@ -1,9 +1,8 @@
1
- import { HmrIdentifiers, NapiDiagnostic, NapiIssue, NapiUpdateMessage, NapiWrittenEndpoint, StackFrame } from "../binding";
1
+ import { HmrIdentifiers, NapiIssue, NapiUpdateMessage, NapiWrittenEndpoint, StackFrame } from "../binding";
2
2
  import { BundleOptions } from "../config/types";
3
3
  declare global {
4
4
  export type TurbopackResult<T = {}> = T & {
5
5
  issues: NapiIssue[];
6
- diagnostics: NapiDiagnostic[];
7
6
  };
8
7
  export type RefCell = {
9
8
  readonly __tag: unique symbol;
@@ -18,7 +17,6 @@ export interface BaseUpdate {
18
17
  headers: unknown;
19
18
  path: string;
20
19
  };
21
- diagnostics: unknown[];
22
20
  issues: NapiIssue[];
23
21
  }
24
22
  export interface IssuesUpdate extends BaseUpdate {
package/esm/binding.d.ts CHANGED
@@ -243,11 +243,6 @@ export interface NapiSourcePos {
243
243
  line: number
244
244
  column: number
245
245
  }
246
- export interface NapiDiagnostic {
247
- category: string
248
- name: string
249
- payload: Record<string, string>
250
- }
251
246
  /**
252
247
  * Initialize tracing subscriber to emit traces. This configures subscribers
253
248
  * for Trace Event Format <https://docs.google.com/document/d/1CvAClvFfyA5R-PhYUmn5OOQtYMH4h6I0nSsKchNAySU/preview>.
@@ -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
@@ -150,7 +150,6 @@ export async function createHotReloader(bundleOptions, projectPath, rootPath) {
150
150
  const sendEnqueuedMessagesDebounce = debounce(sendEnqueuedMessages, 2);
151
151
  function sendTurbopackMessage(payload) {
152
152
  var _a;
153
- payload.diagnostics = [];
154
153
  payload.issues = [];
155
154
  for (const client of clients) {
156
155
  (_a = clientStates.get(client)) === null || _a === void 0 ? void 0 : _a.turbopackUpdates.push(payload);
@@ -544,11 +543,12 @@ export async function createHotReloader(bundleOptions, projectPath, rootPath) {
544
543
  async buildFallbackError() {
545
544
  // Not implemented yet.
546
545
  },
547
- close() {
546
+ async close() {
548
547
  closed = true;
549
- void disposeBackgroundWatchSubscriptions();
550
- closePromise !== null && closePromise !== void 0 ? closePromise : (closePromise = project
551
- .onExit()
548
+ const disposePromise = disposeBackgroundWatchSubscriptions();
549
+ closePromise !== null && closePromise !== void 0 ? closePromise : (closePromise = (bundleOptions.config.persistentCaching
550
+ ? project.shutdown()
551
+ : project.onExit())
552
552
  .catch((err) => {
553
553
  console.error(err);
554
554
  })
@@ -559,6 +559,7 @@ export async function createHotReloader(bundleOptions, projectPath, rootPath) {
559
559
  wsClient.close();
560
560
  }
561
561
  clients.clear();
562
+ await Promise.all([disposePromise, closePromise]);
562
563
  },
563
564
  };
564
565
  handleEntrypointsSubscription().catch((err) => {
@@ -40,7 +40,6 @@ export declare function projectFactory(): (options: Required<ProjectOptions>, tu
40
40
  appPaths: NapiWrittenEndpoint[] | undefined;
41
41
  libraryPaths: NapiWrittenEndpoint[] | undefined;
42
42
  issues: binding.NapiIssue[];
43
- diagnostics: binding.NapiDiagnostic[];
44
43
  }, void, unknown>;
45
44
  hmrEvents(identifier: string): AsyncIterableIterator<TurbopackResult<Update>>;
46
45
  hmrIdentifiersSubscribe(): AsyncIterableIterator<TurbopackResult<HmrIdentifiers>>;
@@ -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",
@@ -454,7 +453,6 @@ export function projectFactory() {
454
453
  appPaths: entrypoints.appPaths,
455
454
  libraryPaths: entrypoints.libraryPaths,
456
455
  issues: entrypoints.issues,
457
- diagnostics: entrypoints.diagnostics,
458
456
  };
459
457
  }
460
458
  return async function createProject(options, turboEngineOptions) {
@@ -1,9 +1,8 @@
1
- import { HmrIdentifiers, NapiDiagnostic, NapiIssue, NapiUpdateMessage, NapiWrittenEndpoint, StackFrame } from "../binding";
1
+ import { HmrIdentifiers, NapiIssue, NapiUpdateMessage, NapiWrittenEndpoint, StackFrame } from "../binding";
2
2
  import { BundleOptions } from "../config/types";
3
3
  declare global {
4
4
  export type TurbopackResult<T = {}> = T & {
5
5
  issues: NapiIssue[];
6
- diagnostics: NapiDiagnostic[];
7
6
  };
8
7
  export type RefCell = {
9
8
  readonly __tag: unique symbol;
@@ -18,7 +17,6 @@ export interface BaseUpdate {
18
17
  headers: unknown;
19
18
  path: string;
20
19
  };
21
- diagnostics: unknown[];
22
20
  issues: NapiIssue[];
23
21
  }
24
22
  export interface IssuesUpdate extends BaseUpdate {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@utoo/pack",
3
- "version": "1.4.12-alpha.1",
3
+ "version": "1.4.12-alpha.10",
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.1",
44
+ "@utoo/pack-shared": "1.4.12-alpha.10",
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.1",
100
- "@utoo/pack-darwin-x64": "1.4.12-alpha.1",
101
- "@utoo/pack-linux-arm64-gnu": "1.4.12-alpha.1",
102
- "@utoo/pack-linux-arm64-musl": "1.4.12-alpha.1",
103
- "@utoo/pack-linux-x64-gnu": "1.4.12-alpha.1",
104
- "@utoo/pack-linux-x64-musl": "1.4.12-alpha.1",
105
- "@utoo/pack-win32-x64-msvc": "1.4.12-alpha.1"
99
+ "@utoo/pack-darwin-arm64": "1.4.12-alpha.10",
100
+ "@utoo/pack-darwin-x64": "1.4.12-alpha.10",
101
+ "@utoo/pack-linux-arm64-gnu": "1.4.12-alpha.10",
102
+ "@utoo/pack-linux-arm64-musl": "1.4.12-alpha.10",
103
+ "@utoo/pack-linux-x64-gnu": "1.4.12-alpha.10",
104
+ "@utoo/pack-linux-x64-musl": "1.4.12-alpha.10",
105
+ "@utoo/pack-win32-x64-msvc": "1.4.12-alpha.10"
106
106
  }
107
107
  }