@utoo/pack 1.1.3 → 1.1.4-lingguang.0

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.
Files changed (65) hide show
  1. package/cjs/commands/build.d.ts +3 -0
  2. package/cjs/commands/build.js +165 -0
  3. package/cjs/commands/dev.d.ts +44 -0
  4. package/cjs/commands/dev.js +387 -0
  5. package/cjs/config/readWebpackConfig.d.ts +1 -0
  6. package/cjs/config/readWebpackConfig.js +14 -0
  7. package/cjs/config/types.d.ts +1 -0
  8. package/cjs/config/types.js +17 -0
  9. package/cjs/config/webpackCompat.d.ts +2 -0
  10. package/cjs/config/webpackCompat.js +7 -0
  11. package/cjs/core/hmr.d.ts +80 -0
  12. package/cjs/core/hmr.js +341 -0
  13. package/cjs/core/loaderWorkerPool.d.ts +1 -0
  14. package/cjs/core/loaderWorkerPool.js +35 -0
  15. package/cjs/core/project.d.ts +43 -0
  16. package/cjs/core/project.js +291 -0
  17. package/cjs/core/types.d.ts +94 -0
  18. package/cjs/core/types.js +2 -0
  19. package/cjs/plugins/HtmlPlugin.d.ts +9 -0
  20. package/cjs/plugins/HtmlPlugin.js +116 -0
  21. package/cjs/utils/common.d.ts +3 -0
  22. package/cjs/utils/common.js +32 -0
  23. package/cjs/utils/find-root.d.ts +4 -0
  24. package/cjs/utils/find-root.js +75 -0
  25. package/cjs/utils/html-entry.d.ts +2 -0
  26. package/cjs/utils/html-entry.js +47 -0
  27. package/cjs/utils/mkcert.d.ts +7 -0
  28. package/cjs/utils/mkcert.js +183 -0
  29. package/cjs/utils/print-server-info.d.ts +1 -0
  30. package/cjs/utils/print-server-info.js +50 -0
  31. package/cjs/utils/xcodeProfile.d.ts +1 -0
  32. package/cjs/utils/xcodeProfile.js +16 -0
  33. package/esm/commands/build.d.ts +3 -0
  34. package/esm/commands/build.js +129 -0
  35. package/esm/commands/dev.d.ts +44 -0
  36. package/esm/commands/dev.js +371 -0
  37. package/esm/config/readWebpackConfig.d.ts +1 -0
  38. package/esm/config/readWebpackConfig.js +8 -0
  39. package/esm/config/types.d.ts +1 -0
  40. package/esm/config/types.js +1 -0
  41. package/esm/config/webpackCompat.d.ts +2 -0
  42. package/esm/config/webpackCompat.js +2 -0
  43. package/esm/core/hmr.d.ts +80 -0
  44. package/esm/core/hmr.js +334 -0
  45. package/esm/core/loaderWorkerPool.d.ts +1 -0
  46. package/esm/core/loaderWorkerPool.js +32 -0
  47. package/esm/core/project.d.ts +43 -0
  48. package/esm/core/project.js +253 -0
  49. package/esm/core/types.d.ts +94 -0
  50. package/esm/core/types.js +1 -0
  51. package/esm/plugins/HtmlPlugin.d.ts +9 -0
  52. package/esm/plugins/HtmlPlugin.js +109 -0
  53. package/esm/utils/common.d.ts +3 -0
  54. package/esm/utils/common.js +18 -0
  55. package/esm/utils/find-root.d.ts +4 -0
  56. package/esm/utils/find-root.js +66 -0
  57. package/esm/utils/html-entry.d.ts +2 -0
  58. package/esm/utils/html-entry.js +41 -0
  59. package/esm/utils/mkcert.d.ts +7 -0
  60. package/esm/utils/mkcert.js +176 -0
  61. package/esm/utils/print-server-info.d.ts +1 -0
  62. package/esm/utils/print-server-info.js +44 -0
  63. package/esm/utils/xcodeProfile.d.ts +1 -0
  64. package/esm/utils/xcodeProfile.js +13 -0
  65. package/package.json +12 -14
@@ -0,0 +1,80 @@
1
+ import { IncomingMessage } from "http";
2
+ import { Duplex } from "stream";
3
+ import type webpack from "webpack";
4
+ import { BundleOptions, Project, Update as TurbopackUpdate } from "./types";
5
+ export declare const enum HMR_ACTIONS_SENT_TO_BROWSER {
6
+ RELOAD = "reload",
7
+ CLIENT_CHANGES = "clientChanges",
8
+ SERVER_ONLY_CHANGES = "serverOnlyChanges",
9
+ SYNC = "sync",
10
+ BUILT = "built",
11
+ BUILDING = "building",
12
+ TURBOPACK_MESSAGE = "turbopack-message",
13
+ TURBOPACK_CONNECTED = "turbopack-connected"
14
+ }
15
+ export interface TurbopackMessageAction {
16
+ action: HMR_ACTIONS_SENT_TO_BROWSER.TURBOPACK_MESSAGE;
17
+ data: TurbopackUpdate | TurbopackUpdate[];
18
+ }
19
+ export interface TurbopackConnectedAction {
20
+ action: HMR_ACTIONS_SENT_TO_BROWSER.TURBOPACK_CONNECTED;
21
+ data: {
22
+ sessionId: number;
23
+ };
24
+ }
25
+ interface BuildingAction {
26
+ action: HMR_ACTIONS_SENT_TO_BROWSER.BUILDING;
27
+ }
28
+ export interface CompilationError {
29
+ moduleName?: string;
30
+ message: string;
31
+ details?: string;
32
+ moduleTrace?: Array<{
33
+ moduleName?: string;
34
+ }>;
35
+ stack?: string;
36
+ }
37
+ export interface SyncAction {
38
+ action: HMR_ACTIONS_SENT_TO_BROWSER.SYNC;
39
+ hash: string;
40
+ errors: ReadonlyArray<CompilationError>;
41
+ warnings: ReadonlyArray<CompilationError>;
42
+ updatedModules?: ReadonlyArray<string>;
43
+ }
44
+ export interface BuiltAction {
45
+ action: HMR_ACTIONS_SENT_TO_BROWSER.BUILT;
46
+ hash: string;
47
+ errors: ReadonlyArray<CompilationError>;
48
+ warnings: ReadonlyArray<CompilationError>;
49
+ updatedModules?: ReadonlyArray<string>;
50
+ }
51
+ export interface ReloadAction {
52
+ action: HMR_ACTIONS_SENT_TO_BROWSER.RELOAD;
53
+ data: string;
54
+ }
55
+ export type HMR_ACTION_TYPES = TurbopackMessageAction | TurbopackConnectedAction | BuildingAction | SyncAction | BuiltAction | ReloadAction;
56
+ export interface HotReloaderInterface {
57
+ turbopackProject?: Project;
58
+ serverStats: webpack.Stats | null;
59
+ setHmrServerError(error: Error | null): void;
60
+ clearHmrServerError(): void;
61
+ start(): Promise<void>;
62
+ send(action: HMR_ACTION_TYPES): void;
63
+ onHMR(req: IncomingMessage, socket: Duplex, head: Buffer, onUpgrade?: (client: {
64
+ send(data: string): void;
65
+ }) => void): void;
66
+ buildFallbackError(): Promise<void>;
67
+ close(): void;
68
+ }
69
+ export type ChangeSubscriptions = Map<string, Promise<AsyncIterableIterator<TurbopackResult>>>;
70
+ export type ReadyIds = Set<string>;
71
+ export type StartBuilding = (id: string, forceRebuild: boolean) => () => void;
72
+ export type ClientState = {
73
+ hmrPayloads: Map<string, HMR_ACTION_TYPES>;
74
+ turbopackUpdates: TurbopackUpdate[];
75
+ subscriptions: Map<string, AsyncIterator<any>>;
76
+ };
77
+ export type SendHmr = (id: string, payload: HMR_ACTION_TYPES) => void;
78
+ export declare const FAST_REFRESH_RUNTIME_RELOAD = "Fast Refresh had to perform a full reload due to a runtime error.";
79
+ export declare function createHotReloader(bundleOptions: BundleOptions, projectPath?: string, rootPath?: string): Promise<HotReloaderInterface>;
80
+ export {};
@@ -0,0 +1,341 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.FAST_REFRESH_RUNTIME_RELOAD = void 0;
7
+ exports.createHotReloader = createHotReloader;
8
+ const fs_1 = __importDefault(require("fs"));
9
+ const nanoid_1 = require("nanoid");
10
+ const path_1 = require("path");
11
+ const ws_1 = __importDefault(require("ws"));
12
+ const HtmlPlugin_1 = require("../plugins/HtmlPlugin");
13
+ const common_1 = require("../utils/common");
14
+ const html_entry_1 = require("../utils/html-entry");
15
+ const project_1 = require("./project");
16
+ const wsServer = new ws_1.default.Server({ noServer: true });
17
+ const sessionId = Math.floor(Number.MAX_SAFE_INTEGER * Math.random());
18
+ exports.FAST_REFRESH_RUNTIME_RELOAD = "Fast Refresh had to perform a full reload due to a runtime error.";
19
+ async function createHotReloader(bundleOptions, projectPath, rootPath) {
20
+ var _a;
21
+ (0, html_entry_1.processHtmlEntry)(bundleOptions.config, projectPath || process.cwd());
22
+ const createProject = (0, project_1.projectFactory)();
23
+ const project = await createProject({
24
+ processEnv: (_a = bundleOptions.processEnv) !== null && _a !== void 0 ? _a : {},
25
+ defineEnv: (0, common_1.createDefineEnv)({
26
+ config: bundleOptions.config,
27
+ dev: true,
28
+ optionDefineEnv: bundleOptions.defineEnv,
29
+ }),
30
+ watch: {
31
+ enable: true,
32
+ },
33
+ dev: true,
34
+ buildId: bundleOptions.buildId || (0, nanoid_1.nanoid)(),
35
+ config: {
36
+ ...bundleOptions.config,
37
+ mode: "development",
38
+ stats: Boolean(process.env.ANALYZE) ||
39
+ bundleOptions.config.stats ||
40
+ bundleOptions.config.entry.some((e) => !!e.html),
41
+ optimization: {
42
+ ...bundleOptions.config.optimization,
43
+ minify: false,
44
+ moduleIds: "named",
45
+ },
46
+ },
47
+ projectPath: projectPath || process.cwd(),
48
+ rootPath: rootPath || projectPath || process.cwd(),
49
+ packPath: (0, common_1.getPackPath)(),
50
+ }, {
51
+ persistentCaching: true,
52
+ });
53
+ const entrypointsSubscription = project.entrypointsSubscribe();
54
+ let currentEntriesHandlingResolve;
55
+ let currentEntriesHandling = new Promise((resolve) => (currentEntriesHandlingResolve = resolve));
56
+ let hmrEventHappened = false;
57
+ let hmrHash = 0;
58
+ const clients = new Set();
59
+ const clientStates = new WeakMap();
60
+ function sendToClient(client, payload) {
61
+ client.send(JSON.stringify(payload));
62
+ }
63
+ function sendEnqueuedMessages() {
64
+ for (const client of clients) {
65
+ const state = clientStates.get(client);
66
+ if (!state) {
67
+ continue;
68
+ }
69
+ for (const payload of state.hmrPayloads.values()) {
70
+ sendToClient(client, payload);
71
+ }
72
+ state.hmrPayloads.clear();
73
+ if (state.turbopackUpdates.length > 0) {
74
+ sendToClient(client, {
75
+ action: "turbopack-message" /* HMR_ACTIONS_SENT_TO_BROWSER.TURBOPACK_MESSAGE */,
76
+ data: state.turbopackUpdates,
77
+ });
78
+ state.turbopackUpdates.length = 0;
79
+ }
80
+ }
81
+ }
82
+ const sendEnqueuedMessagesDebounce = (0, common_1.debounce)(sendEnqueuedMessages, 2);
83
+ function sendTurbopackMessage(payload) {
84
+ var _a;
85
+ payload.diagnostics = [];
86
+ payload.issues = [];
87
+ for (const client of clients) {
88
+ (_a = clientStates.get(client)) === null || _a === void 0 ? void 0 : _a.turbopackUpdates.push(payload);
89
+ }
90
+ hmrEventHappened = true;
91
+ sendEnqueuedMessagesDebounce();
92
+ }
93
+ async function subscribeToHmrEvents(client, id) {
94
+ const state = clientStates.get(client);
95
+ if (!state || state.subscriptions.has(id)) {
96
+ return;
97
+ }
98
+ const subscription = project.hmrEvents(id);
99
+ state.subscriptions.set(id, subscription);
100
+ // The subscription will always emit once, which is the initial
101
+ // computation. This is not a change, so swallow it.
102
+ try {
103
+ await subscription.next();
104
+ for await (const data of subscription) {
105
+ (0, common_1.processIssues)(data, true, true);
106
+ if (data.type !== "issues") {
107
+ sendTurbopackMessage(data);
108
+ }
109
+ }
110
+ }
111
+ catch (e) {
112
+ // The client might be using an HMR session from a previous server, tell them
113
+ // to fully reload the page to resolve the issue. We can't use
114
+ // `hotReloader.send` since that would force every connected client to
115
+ // reload, only this client is out of date.
116
+ const reloadAction = {
117
+ action: "reload" /* HMR_ACTIONS_SENT_TO_BROWSER.RELOAD */,
118
+ data: `error in HMR event subscription for ${id}: ${e}`,
119
+ };
120
+ sendToClient(client, reloadAction);
121
+ client.close();
122
+ return;
123
+ }
124
+ }
125
+ function unsubscribeFromHmrEvents(client, id) {
126
+ const state = clientStates.get(client);
127
+ if (!state) {
128
+ return;
129
+ }
130
+ const subscription = state.subscriptions.get(id);
131
+ subscription === null || subscription === void 0 ? void 0 : subscription.return();
132
+ }
133
+ async function handleEntrypointsSubscription() {
134
+ var _a, _b;
135
+ for await (const entrypoints of entrypointsSubscription) {
136
+ if (!currentEntriesHandlingResolve) {
137
+ currentEntriesHandling = new Promise(
138
+ // eslint-disable-next-line no-loop-func
139
+ (resolve) => (currentEntriesHandlingResolve = resolve));
140
+ }
141
+ const assets = { js: [], css: [] };
142
+ await Promise.all(entrypoints.apps.map((l) => l.writeToDisk().then((res) => {
143
+ (0, common_1.processIssues)(res, true, true);
144
+ res.clientPaths.forEach((p) => {
145
+ if (p.endsWith(".js"))
146
+ assets.js.push(p);
147
+ if (p.endsWith(".css"))
148
+ assets.css.push(p);
149
+ });
150
+ })));
151
+ const htmlConfigs = [
152
+ ...(Array.isArray(bundleOptions.config.html)
153
+ ? bundleOptions.config.html
154
+ : bundleOptions.config.html
155
+ ? [bundleOptions.config.html]
156
+ : []),
157
+ ...bundleOptions.config.entry
158
+ .filter((e) => !!e.html)
159
+ .map((e) => e.html),
160
+ ];
161
+ if (htmlConfigs.length > 0) {
162
+ const outputDir = ((_a = bundleOptions.config.output) === null || _a === void 0 ? void 0 : _a.path) || (0, path_1.join)(process.cwd(), "dist");
163
+ const publicPath = (_b = bundleOptions.config.output) === null || _b === void 0 ? void 0 : _b.publicPath;
164
+ if (assets.js.length === 0 && assets.css.length === 0) {
165
+ const statsPath = (0, path_1.join)(outputDir, "stats.json");
166
+ if (fs_1.default.existsSync(statsPath)) {
167
+ try {
168
+ const stats = JSON.parse(fs_1.default.readFileSync(statsPath, "utf-8"));
169
+ if (stats.assets) {
170
+ stats.assets.forEach((asset) => {
171
+ if (asset.name.endsWith(".js"))
172
+ assets.js.push(asset.name);
173
+ if (asset.name.endsWith(".css"))
174
+ assets.css.push(asset.name);
175
+ });
176
+ }
177
+ }
178
+ catch (e) {
179
+ console.warn("Failed to read stats.json for assets discovery", e);
180
+ }
181
+ }
182
+ }
183
+ for (const config of htmlConfigs) {
184
+ const plugin = new HtmlPlugin_1.HtmlPlugin(config);
185
+ await plugin.generate(outputDir, assets, publicPath);
186
+ }
187
+ }
188
+ currentEntriesHandlingResolve();
189
+ currentEntriesHandlingResolve = undefined;
190
+ }
191
+ }
192
+ const hotReloader = {
193
+ turbopackProject: project,
194
+ serverStats: null,
195
+ onHMR(req, socket, head, onUpgrade) {
196
+ wsServer.handleUpgrade(req, socket, head, (client) => {
197
+ onUpgrade === null || onUpgrade === void 0 ? void 0 : onUpgrade(client);
198
+ const subscriptions = new Map();
199
+ clients.add(client);
200
+ clientStates.set(client, {
201
+ hmrPayloads: new Map(),
202
+ turbopackUpdates: [],
203
+ subscriptions,
204
+ });
205
+ client.on("close", () => {
206
+ var _a;
207
+ // Remove active subscriptions
208
+ for (const subscription of subscriptions.values()) {
209
+ (_a = subscription.return) === null || _a === void 0 ? void 0 : _a.call(subscription);
210
+ }
211
+ clientStates.delete(client);
212
+ clients.delete(client);
213
+ });
214
+ client.addEventListener("message", ({ data }) => {
215
+ const parsedData = JSON.parse(typeof data !== "string" ? data.toString() : data);
216
+ // messages
217
+ switch (parsedData.event) {
218
+ case "client-error": // { errorCount, clientId }
219
+ case "client-warning": // { warningCount, clientId }
220
+ case "client-success": // { clientId }
221
+ case "client-full-reload": // { stackTrace, hadRuntimeError }
222
+ const { hadRuntimeError, dependencyChain } = parsedData;
223
+ if (hadRuntimeError) {
224
+ console.warn(exports.FAST_REFRESH_RUNTIME_RELOAD);
225
+ }
226
+ if (Array.isArray(dependencyChain) &&
227
+ typeof dependencyChain[0] === "string") {
228
+ const cleanedModulePath = dependencyChain[0]
229
+ .replace(/^\[project\]/, ".")
230
+ .replace(/ \[.*\] \(.*\)$/, "");
231
+ console.warn(`Fast Refresh had to perform a full reload when ${cleanedModulePath} changed.`);
232
+ }
233
+ break;
234
+ default:
235
+ // Might be a Turbopack message...
236
+ if (!parsedData.type) {
237
+ throw new Error(`unrecognized HMR message "${data}"`);
238
+ }
239
+ }
240
+ // Turbopack messages
241
+ switch (parsedData.type) {
242
+ case "turbopack-subscribe":
243
+ subscribeToHmrEvents(client, parsedData.path);
244
+ break;
245
+ case "turbopack-unsubscribe":
246
+ unsubscribeFromHmrEvents(client, parsedData.path);
247
+ break;
248
+ default:
249
+ if (!parsedData.event) {
250
+ throw new Error(`unrecognized Turbopack HMR message "${data}"`);
251
+ }
252
+ }
253
+ });
254
+ const turbopackConnected = {
255
+ action: "turbopack-connected" /* HMR_ACTIONS_SENT_TO_BROWSER.TURBOPACK_CONNECTED */,
256
+ data: { sessionId },
257
+ };
258
+ sendToClient(client, turbopackConnected);
259
+ const errors = [];
260
+ (async function () {
261
+ const sync = {
262
+ action: "sync" /* HMR_ACTIONS_SENT_TO_BROWSER.SYNC */,
263
+ errors,
264
+ warnings: [],
265
+ hash: "",
266
+ };
267
+ sendToClient(client, sync);
268
+ })();
269
+ });
270
+ },
271
+ send(action) {
272
+ const payload = JSON.stringify(action);
273
+ for (const client of clients) {
274
+ client.send(payload);
275
+ }
276
+ },
277
+ setHmrServerError(_error) {
278
+ // Not implemented yet.
279
+ },
280
+ clearHmrServerError() {
281
+ // Not implemented yet.
282
+ },
283
+ async start() { },
284
+ async buildFallbackError() {
285
+ // Not implemented yet.
286
+ },
287
+ close() {
288
+ for (const wsClient of clients) {
289
+ // it's okay to not cleanly close these websocket connections, this is dev
290
+ wsClient.terminate();
291
+ }
292
+ clients.clear();
293
+ },
294
+ };
295
+ handleEntrypointsSubscription().catch((err) => {
296
+ console.error(err);
297
+ process.exit(1);
298
+ });
299
+ // Write empty manifests
300
+ await currentEntriesHandling;
301
+ async function handleProjectUpdates() {
302
+ for await (const updateMessage of project.updateInfoSubscribe(30)) {
303
+ switch (updateMessage.updateType) {
304
+ case "start": {
305
+ hotReloader.send({ action: "building" /* HMR_ACTIONS_SENT_TO_BROWSER.BUILDING */ });
306
+ break;
307
+ }
308
+ case "end": {
309
+ sendEnqueuedMessages();
310
+ const errors = new Map();
311
+ for (const client of clients) {
312
+ const state = clientStates.get(client);
313
+ if (!state) {
314
+ continue;
315
+ }
316
+ const clientErrors = new Map(errors);
317
+ sendToClient(client, {
318
+ action: "built" /* HMR_ACTIONS_SENT_TO_BROWSER.BUILT */,
319
+ hash: String(++hmrHash),
320
+ errors: [...clientErrors.values()],
321
+ warnings: [],
322
+ });
323
+ }
324
+ if (hmrEventHappened) {
325
+ const time = updateMessage.value.duration;
326
+ const timeMessage = time > 2000 ? `${Math.round(time / 100) / 10}s` : `${time}ms`;
327
+ console.log(`Compiled in ${timeMessage}`);
328
+ hmrEventHappened = false;
329
+ }
330
+ break;
331
+ }
332
+ default:
333
+ }
334
+ }
335
+ }
336
+ handleProjectUpdates().catch((err) => {
337
+ console.error(err);
338
+ process.exit(1);
339
+ });
340
+ return hotReloader;
341
+ }
@@ -0,0 +1 @@
1
+ export declare function runLoaderWorkerPool(binding: typeof import("../binding"), bindingPath: string): Promise<void>;
@@ -0,0 +1,35 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.runLoaderWorkerPool = runLoaderWorkerPool;
4
+ const worker_threads_1 = require("worker_threads");
5
+ const loaderWorkers = {};
6
+ function getPoolId(cwd, filename) {
7
+ return `${cwd}:${filename}`;
8
+ }
9
+ let workerSchedulerRegistered = false;
10
+ async function runLoaderWorkerPool(binding, bindingPath) {
11
+ if (workerSchedulerRegistered) {
12
+ return;
13
+ }
14
+ binding.registerWorkerScheduler((creation) => {
15
+ const { options: { filename, cwd }, } = creation;
16
+ let poolId = getPoolId(cwd, filename);
17
+ const worker = new worker_threads_1.Worker(filename, {
18
+ workerData: {
19
+ bindingPath,
20
+ cwd,
21
+ },
22
+ });
23
+ worker.unref();
24
+ const workers = loaderWorkers[poolId] || (loaderWorkers[poolId] = new Map());
25
+ workers.set(worker.threadId, worker);
26
+ }, (termination) => {
27
+ var _a;
28
+ const { options: { filename, cwd }, workerId, } = termination;
29
+ let poolId = getPoolId(cwd, filename);
30
+ const workers = loaderWorkers[poolId];
31
+ (_a = workers.get(workerId)) === null || _a === void 0 ? void 0 : _a.terminate();
32
+ workers.delete(workerId);
33
+ });
34
+ workerSchedulerRegistered = true;
35
+ }
@@ -0,0 +1,43 @@
1
+ import type { HmrIdentifiers, NapiUpdateMessage, NapiWrittenEndpoint, StackFrame } from "../binding";
2
+ import * as binding from "../binding";
3
+ import { ProjectOptions, RawEntrypoints, Update } from "./types";
4
+ export declare class TurbopackInternalError extends Error {
5
+ name: string;
6
+ constructor(cause: Error);
7
+ }
8
+ export declare function projectFactory(): (options: Required<ProjectOptions>, turboEngineOptions: binding.NapiTurboEngineOptions) => Promise<{
9
+ readonly _nativeProject: {
10
+ __napiType: "Project";
11
+ };
12
+ update(options: Partial<ProjectOptions>): Promise<void>;
13
+ writeAllEntrypointsToDisk(): Promise<TurbopackResult<RawEntrypoints>>;
14
+ entrypointsSubscribe(): AsyncGenerator<{
15
+ apps: {
16
+ readonly _nativeEndpoint: {
17
+ __napiType: "Endpoint";
18
+ };
19
+ writeToDisk(): Promise<TurbopackResult<NapiWrittenEndpoint>>;
20
+ clientChanged(): Promise<AsyncIterableIterator<TurbopackResult<{}>>>;
21
+ serverChanged(includeIssues: boolean): Promise<AsyncIterableIterator<TurbopackResult<{}>>>;
22
+ }[];
23
+ libraries: {
24
+ readonly _nativeEndpoint: {
25
+ __napiType: "Endpoint";
26
+ };
27
+ writeToDisk(): Promise<TurbopackResult<NapiWrittenEndpoint>>;
28
+ clientChanged(): Promise<AsyncIterableIterator<TurbopackResult<{}>>>;
29
+ serverChanged(includeIssues: boolean): Promise<AsyncIterableIterator<TurbopackResult<{}>>>;
30
+ }[];
31
+ issues: binding.NapiIssue[];
32
+ diagnostics: binding.NapiDiagnostic[];
33
+ }, void, unknown>;
34
+ hmrEvents(identifier: string): AsyncIterableIterator<TurbopackResult<Update>>;
35
+ hmrIdentifiersSubscribe(): AsyncIterableIterator<TurbopackResult<HmrIdentifiers>>;
36
+ traceSource(stackFrame: StackFrame, currentDirectoryFileUrl: string): Promise<StackFrame | null>;
37
+ getSourceForAsset(filePath: string): Promise<string | null>;
38
+ getSourceMap(filePath: string): Promise<string | null>;
39
+ getSourceMapSync(filePath: string): string | null;
40
+ updateInfoSubscribe(aggregationMs: number): AsyncIterableIterator<TurbopackResult<NapiUpdateMessage>>;
41
+ shutdown(): Promise<void>;
42
+ onExit(): Promise<void>;
43
+ }>;