@utoo/pack 0.0.1-alpha.2 → 0.0.1-alpha.20

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
@@ -63,7 +63,7 @@ export interface NapiProjectOptions {
63
63
  * A map of environment variables which should get injected at compile
64
64
  * time.
65
65
  */
66
- processDefineEnv: NapiDefineEnv
66
+ defineEnv: NapiDefineEnv
67
67
  /** The mode in which Next.js is running. */
68
68
  dev: boolean
69
69
  /** The build id. */
@@ -88,7 +88,7 @@ export interface NapiPartialProjectOptions {
88
88
  * A map of environment variables which should get injected at compile
89
89
  * time.
90
90
  */
91
- processDefineEnv?: NapiDefineEnv
91
+ defineEnv?: NapiDefineEnv
92
92
  /** The mode in which Next.js is running. */
93
93
  dev?: boolean
94
94
  /** The build id. */
@@ -136,7 +136,7 @@ export interface NapiEntrypoints {
136
136
  }
137
137
  export declare function projectWriteAllEntrypointsToDisk(project: { __napiType: "Project" }): Promise<TurbopackResult>
138
138
  export declare function projectEntrypointsSubscribe(project: { __napiType: "Project" }, func: (...args: any[]) => any): { __napiType: "RootTask" }
139
- export declare function projectHmrEvents(project: { __napiType: "Project" }, identifier: string, func: (...args: any[]) => any): { __napiType: "RootTask" }
139
+ export declare function projectHmrEvents(project: { __napiType: "Project" }, identifier: RcStr, func: (...args: any[]) => any): { __napiType: "RootTask" }
140
140
  export interface HmrIdentifiers {
141
141
  identifiers: Array<string>
142
142
  }
@@ -166,16 +166,18 @@ export declare function projectUpdateInfoSubscribe(project: { __napiType: "Proje
166
166
  export interface StackFrame {
167
167
  isServer: boolean
168
168
  isInternal?: boolean
169
- originalFile?: string
170
- file: string
169
+ originalFile?: RcStr
170
+ file: RcStr
171
+ /** 1-indexed, unlike source map tokens */
171
172
  line?: number
173
+ /** 1-indexed, unlike source map tokens */
172
174
  column?: number
173
- methodName?: string
175
+ methodName?: RcStr
174
176
  }
175
177
  export declare function projectTraceSource(project: { __napiType: "Project" }, frame: StackFrame, currentDirectoryFileUrl: string): Promise<StackFrame | null>
176
178
  export declare function projectGetSourceForAsset(project: { __napiType: "Project" }, filePath: string): Promise<string | null>
177
- export declare function projectGetSourceMap(project: { __napiType: "Project" }, filePath: string): Promise<string | null>
178
- export declare function projectGetSourceMapSync(project: { __napiType: "Project" }, filePath: string): string | null
179
+ export declare function projectGetSourceMap(project: { __napiType: "Project" }, filePath: RcStr): Promise<string | null>
180
+ export declare function projectGetSourceMapSync(project: { __napiType: "Project" }, filePath: RcStr): string | null
179
181
  export declare function rootTaskDispose(rootTask: { __napiType: "RootTask" }): void
180
182
  export interface NapiIssue {
181
183
  severity: string
@@ -186,7 +188,7 @@ export interface NapiIssue {
186
188
  detail?: any
187
189
  source?: NapiIssueSource
188
190
  documentationLink: string
189
- subIssues: Array<NapiIssue>
191
+ importTraces: any
190
192
  }
191
193
  export interface NapiIssueSource {
192
194
  source: NapiSource
package/cjs/build.d.ts CHANGED
@@ -1,2 +1,4 @@
1
- import { BuildOptions } from "./types";
2
- export declare function build(projectOptions: BuildOptions, projectPath?: string, rootPath?: string): Promise<void>;
1
+ import { BundleOptions } from "./types";
2
+ import { WebpackConfig } from "./webpackCompat";
3
+ export declare function build(bundleOptions: BundleOptions, projectPath?: string, rootPath?: string): Promise<void>;
4
+ export declare function build(webpackConfig: WebpackConfig, projectPath?: string, rootPath?: string): Promise<void>;
package/cjs/build.js CHANGED
@@ -4,27 +4,34 @@ exports.build = build;
4
4
  const nanoid_1 = require("nanoid");
5
5
  const project_1 = require("./project");
6
6
  const util_1 = require("./util");
7
+ const webpackCompat_1 = require("./webpackCompat");
7
8
  const xcodeProfile_1 = require("./xcodeProfile");
8
- async function build(projectOptions, projectPath, rootPath) {
9
- var _a, _b, _c, _d;
9
+ function build(options, projectPath, rootPath) {
10
+ const bundleOptions = options.compatMode
11
+ ? (0, webpackCompat_1.compatOptionsFromWebpack)(options)
12
+ : options;
13
+ return buildInternal(bundleOptions, projectPath, rootPath);
14
+ }
15
+ async function buildInternal(bundleOptions, projectPath, rootPath) {
16
+ var _a, _b, _c;
10
17
  (0, util_1.blockStdout)();
11
18
  if (process.env.XCODE_PROFILE) {
12
19
  await (0, xcodeProfile_1.xcodeProfilingReady)();
13
20
  }
14
21
  const createProject = (0, project_1.projectFactory)();
15
22
  const project = await createProject({
16
- processEnv: (_a = projectOptions.processEnv) !== null && _a !== void 0 ? _a : {},
17
- processDefineEnv: (0, util_1.createDefineEnv)({
18
- config: projectOptions.config,
19
- dev: (_b = projectOptions.dev) !== null && _b !== void 0 ? _b : false,
20
- optionDefineEnv: projectOptions.processDefineEnv,
23
+ processEnv: (_a = bundleOptions.processEnv) !== null && _a !== void 0 ? _a : {},
24
+ defineEnv: (0, util_1.createDefineEnv)({
25
+ config: bundleOptions.config,
26
+ dev: (_b = bundleOptions.dev) !== null && _b !== void 0 ? _b : false,
27
+ optionDefineEnv: bundleOptions.defineEnv,
21
28
  }),
22
- watch: (_c = projectOptions.watch) !== null && _c !== void 0 ? _c : {
29
+ watch: {
23
30
  enable: false,
24
31
  },
25
- dev: (_d = projectOptions.dev) !== null && _d !== void 0 ? _d : false,
26
- buildId: (0, nanoid_1.nanoid)(),
27
- config: projectOptions.config,
32
+ dev: (_c = bundleOptions.dev) !== null && _c !== void 0 ? _c : false,
33
+ buildId: bundleOptions.buildId || (0, nanoid_1.nanoid)(),
34
+ config: bundleOptions.config,
28
35
  projectPath: projectPath || process.cwd(),
29
36
  rootPath: rootPath || projectPath || process.cwd(),
30
37
  }, {
package/cjs/dev.d.ts ADDED
@@ -0,0 +1,44 @@
1
+ import { IncomingMessage, ServerResponse } from "http";
2
+ import send from "send";
3
+ import { Duplex, Writable } from "stream";
4
+ import { BundleOptions } from "./types";
5
+ import { WebpackConfig } from "./webpackCompat";
6
+ export declare function serve(bundleOptions: BundleOptions, projectPath?: string, rootPath?: string, serverOptions?: StartServerOptions): Promise<void>;
7
+ export declare function serve(webpackConfig: WebpackConfig, projectPath?: string, rootPath?: string, serverOptions?: StartServerOptions): Promise<void>;
8
+ export interface SelfSignedCertificate {
9
+ key: string;
10
+ cert: string;
11
+ rootCA?: string;
12
+ }
13
+ export interface StartServerOptions {
14
+ port: number;
15
+ https?: boolean;
16
+ hostname?: string;
17
+ selfSignedCertificate?: SelfSignedCertificate;
18
+ }
19
+ export type RequestHandler = (req: IncomingMessage, res: ServerResponse) => Promise<void>;
20
+ export type UpgradeHandler = (req: IncomingMessage, socket: Duplex, head: Buffer) => Promise<void>;
21
+ export type ServerInitResult = {
22
+ requestHandler: RequestHandler;
23
+ upgradeHandler: UpgradeHandler;
24
+ closeUpgraded: () => void;
25
+ };
26
+ export declare function startServer(serverOptions: StartServerOptions, bundleOptions: BundleOptions, projectPath: string, rootPath?: string): Promise<void>;
27
+ export declare function initialize(bundleOptions: BundleOptions, projectPath: string, rootPath?: string): Promise<ServerInitResult>;
28
+ export declare function pipeToNodeResponse(readable: ReadableStream<Uint8Array>, res: ServerResponse, waitUntilForEnd?: Promise<unknown>): Promise<void>;
29
+ export declare function createAbortController(response: Writable): AbortController;
30
+ export declare function isAbortError(e: any): e is Error & {
31
+ name: "AbortError";
32
+ };
33
+ export declare const ResponseAbortedName = "ResponseAborted";
34
+ export declare class ResponseAborted extends Error {
35
+ readonly name = "ResponseAborted";
36
+ }
37
+ export declare class DetachedPromise<T = any> {
38
+ readonly resolve: (value: T | PromiseLike<T>) => void;
39
+ readonly reject: (reason: any) => void;
40
+ readonly promise: Promise<T>;
41
+ constructor();
42
+ }
43
+ export declare function serveStatic(req: IncomingMessage, res: ServerResponse, path: string, opts?: Parameters<typeof send>[2]): Promise<void>;
44
+ export declare function formatHostname(hostname: string): string;
package/cjs/dev.js ADDED
@@ -0,0 +1,362 @@
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.DetachedPromise = exports.ResponseAborted = exports.ResponseAbortedName = void 0;
7
+ exports.serve = serve;
8
+ exports.startServer = startServer;
9
+ exports.initialize = initialize;
10
+ exports.pipeToNodeResponse = pipeToNodeResponse;
11
+ exports.createAbortController = createAbortController;
12
+ exports.isAbortError = isAbortError;
13
+ exports.serveStatic = serveStatic;
14
+ exports.formatHostname = formatHostname;
15
+ const fs_1 = __importDefault(require("fs"));
16
+ const http_1 = __importDefault(require("http"));
17
+ const https_1 = __importDefault(require("https"));
18
+ const net_1 = require("net");
19
+ const path_1 = __importDefault(require("path"));
20
+ const send_1 = __importDefault(require("send"));
21
+ const url_1 = __importDefault(require("url"));
22
+ const hmr_1 = require("./hmr");
23
+ const mkcert_1 = require("./mkcert");
24
+ const util_1 = require("./util");
25
+ const webpackCompat_1 = require("./webpackCompat");
26
+ const xcodeProfile_1 = require("./xcodeProfile");
27
+ function serve(options, projectPath, rootPath, serverOptions) {
28
+ const bundleOptions = options.compatMode
29
+ ? (0, webpackCompat_1.compatOptionsFromWebpack)(options)
30
+ : options;
31
+ return serveInternal(bundleOptions, projectPath, rootPath, serverOptions);
32
+ }
33
+ async function serveInternal(options, projectPath, rootPath, serverOptions) {
34
+ (0, util_1.blockStdout)();
35
+ if (process.env.XCODE_PROFILE) {
36
+ await (0, xcodeProfile_1.xcodeProfilingReady)();
37
+ }
38
+ startServer({
39
+ hostname: (serverOptions === null || serverOptions === void 0 ? void 0 : serverOptions.hostname) || "localhost",
40
+ port: (serverOptions === null || serverOptions === void 0 ? void 0 : serverOptions.port) || 3000,
41
+ https: serverOptions === null || serverOptions === void 0 ? void 0 : serverOptions.https,
42
+ selfSignedCertificate: (serverOptions === null || serverOptions === void 0 ? void 0 : serverOptions.https)
43
+ ? await (0, mkcert_1.createSelfSignedCertificate)((serverOptions === null || serverOptions === void 0 ? void 0 : serverOptions.hostname) || "localhost")
44
+ : undefined,
45
+ }, options, projectPath || process.cwd(), rootPath);
46
+ }
47
+ async function startServer(serverOptions, bundleOptions, projectPath, rootPath) {
48
+ let { port, hostname, selfSignedCertificate } = serverOptions;
49
+ process.title = "utoo-pack-dev-server";
50
+ let handlersReady = () => { };
51
+ let handlersError = () => { };
52
+ let handlersPromise = new Promise((resolve, reject) => {
53
+ handlersReady = resolve;
54
+ handlersError = reject;
55
+ });
56
+ let requestHandler = async (req, res) => {
57
+ if (handlersPromise) {
58
+ await handlersPromise;
59
+ return requestHandler(req, res);
60
+ }
61
+ throw new Error("Invariant request handler was not setup");
62
+ };
63
+ let upgradeHandler = async (req, socket, head) => {
64
+ if (handlersPromise) {
65
+ await handlersPromise;
66
+ return upgradeHandler(req, socket, head);
67
+ }
68
+ throw new Error("Invariant upgrade handler was not setup");
69
+ };
70
+ async function requestListener(req, res) {
71
+ try {
72
+ if (handlersPromise) {
73
+ await handlersPromise;
74
+ handlersPromise = undefined;
75
+ }
76
+ await requestHandler(req, res);
77
+ }
78
+ catch (err) {
79
+ res.statusCode = 500;
80
+ res.end("Internal Server Error");
81
+ console.error(`Failed to handle request for ${req.url}`);
82
+ console.error(err);
83
+ }
84
+ }
85
+ const server = selfSignedCertificate
86
+ ? https_1.default.createServer({
87
+ key: fs_1.default.readFileSync(selfSignedCertificate.key),
88
+ cert: fs_1.default.readFileSync(selfSignedCertificate.cert),
89
+ }, requestListener)
90
+ : http_1.default.createServer(requestListener);
91
+ server.on("upgrade", async (req, socket, head) => {
92
+ try {
93
+ await upgradeHandler(req, socket, head);
94
+ }
95
+ catch (err) {
96
+ socket.destroy();
97
+ console.error(`Failed to handle request for ${req.url}`);
98
+ console.error(err);
99
+ }
100
+ });
101
+ let portRetryCount = 0;
102
+ const originalPort = port;
103
+ server.on("error", (err) => {
104
+ if (port && err.code === "EADDRINUSE" && portRetryCount < 10) {
105
+ port += 1;
106
+ portRetryCount += 1;
107
+ server.listen(port, hostname);
108
+ }
109
+ else {
110
+ console.error(`Failed to start server`);
111
+ console.error(err);
112
+ process.exit(1);
113
+ }
114
+ });
115
+ await new Promise((resolve) => {
116
+ server.on("listening", async () => {
117
+ const addr = server.address();
118
+ const actualHostname = formatHostname(typeof addr === "object"
119
+ ? (addr === null || addr === void 0 ? void 0 : addr.address) || hostname || "localhost"
120
+ : addr);
121
+ const formattedHostname = !hostname || actualHostname === "0.0.0.0"
122
+ ? "localhost"
123
+ : actualHostname === "[::]"
124
+ ? "[::1]"
125
+ : formatHostname(hostname);
126
+ port = typeof addr === "object" ? (addr === null || addr === void 0 ? void 0 : addr.port) || port : port;
127
+ if (portRetryCount) {
128
+ console.warn(`Port ${originalPort} is in use, using available port ${port} instead.`);
129
+ }
130
+ console.log(`Listening on ${serverOptions.https ? "https" : "http"}://${formattedHostname}:${port} ...`);
131
+ try {
132
+ let cleanupStarted = false;
133
+ let closeUpgraded = null;
134
+ const cleanup = () => {
135
+ if (cleanupStarted) {
136
+ return;
137
+ }
138
+ cleanupStarted = true;
139
+ (async () => {
140
+ console.debug("start-server process cleanup");
141
+ await new Promise((res) => {
142
+ server.close((err) => {
143
+ if (err)
144
+ console.error(err);
145
+ res();
146
+ });
147
+ server.closeAllConnections();
148
+ closeUpgraded === null || closeUpgraded === void 0 ? void 0 : closeUpgraded();
149
+ });
150
+ console.debug("start-server process cleanup finished");
151
+ process.exit(0);
152
+ })();
153
+ };
154
+ const exception = (err) => {
155
+ console.error(err);
156
+ };
157
+ process.on("SIGINT", cleanup);
158
+ process.on("SIGTERM", cleanup);
159
+ process.on("rejectionHandled", () => { });
160
+ process.on("uncaughtException", exception);
161
+ process.on("unhandledRejection", exception);
162
+ const initResult = await initialize(bundleOptions, projectPath, rootPath);
163
+ requestHandler = initResult.requestHandler;
164
+ upgradeHandler = initResult.upgradeHandler;
165
+ closeUpgraded = initResult.closeUpgraded;
166
+ handlersReady();
167
+ }
168
+ catch (err) {
169
+ handlersError();
170
+ console.error(err);
171
+ process.exit(1);
172
+ }
173
+ resolve();
174
+ });
175
+ server.listen(port, hostname);
176
+ });
177
+ }
178
+ async function initialize(bundleOptions, projectPath, rootPath) {
179
+ process.env.NODE_ENV = "development";
180
+ const hotReloader = await (0, hmr_1.createHotReloader)(bundleOptions, projectPath, rootPath);
181
+ await hotReloader.start();
182
+ const requestHandlerImpl = async (req, res) => {
183
+ req.on("error", console.error);
184
+ res.on("error", console.error);
185
+ const handleRequest = async () => {
186
+ var _a;
187
+ if (!(req.method === "GET" || req.method === "HEAD")) {
188
+ res.setHeader("Allow", ["GET", "HEAD"]);
189
+ res.statusCode = 405;
190
+ res.end();
191
+ }
192
+ const distRoot = path_1.default.resolve(projectPath, ((_a = bundleOptions.config.output) === null || _a === void 0 ? void 0 : _a.path) || "./dist");
193
+ try {
194
+ const reqUrl = req.url || "";
195
+ const path = url_1.default.parse(reqUrl).pathname || "";
196
+ return await serveStatic(req, res, path, { root: distRoot });
197
+ }
198
+ catch (err) {
199
+ res.setHeader("Cache-Control", "private, no-cache, no-store, max-age=0, must-revalidate");
200
+ res.statusCode = 404;
201
+ res.end();
202
+ }
203
+ };
204
+ try {
205
+ await handleRequest();
206
+ }
207
+ catch (err) {
208
+ res.statusCode = 500;
209
+ res.end("Internal Server Error");
210
+ }
211
+ };
212
+ let requestHandler = requestHandlerImpl;
213
+ const logError = async (type, err) => {
214
+ if (type === "unhandledRejection") {
215
+ console.error("unhandledRejection: ", err);
216
+ }
217
+ else if (type === "uncaughtException") {
218
+ console.error("uncaughtException: ", err);
219
+ }
220
+ };
221
+ process.on("uncaughtException", logError.bind(null, "uncaughtException"));
222
+ process.on("unhandledRejection", logError.bind(null, "unhandledRejection"));
223
+ const upgradeHandler = async (req, socket, head) => {
224
+ var _a;
225
+ try {
226
+ const isHMRRequest = (_a = req.url) === null || _a === void 0 ? void 0 : _a.includes("turbopack-hmr");
227
+ if (isHMRRequest) {
228
+ hotReloader.onHMR(req, socket, head);
229
+ }
230
+ else {
231
+ socket.end();
232
+ }
233
+ }
234
+ catch (err) {
235
+ console.error("Error handling upgrade request", err);
236
+ socket.end();
237
+ }
238
+ };
239
+ return {
240
+ requestHandler,
241
+ upgradeHandler,
242
+ closeUpgraded() {
243
+ hotReloader.close();
244
+ },
245
+ };
246
+ }
247
+ async function pipeToNodeResponse(readable, res, waitUntilForEnd) {
248
+ try {
249
+ const { errored, destroyed } = res;
250
+ if (errored || destroyed)
251
+ return;
252
+ const controller = createAbortController(res);
253
+ const writer = createWriterFromResponse(res, waitUntilForEnd);
254
+ await readable.pipeTo(writer, { signal: controller.signal });
255
+ }
256
+ catch (err) {
257
+ if (isAbortError(err))
258
+ return;
259
+ throw new Error("failed to pipe response", { cause: err });
260
+ }
261
+ }
262
+ function createAbortController(response) {
263
+ const controller = new AbortController();
264
+ response.once("close", () => {
265
+ if (response.writableFinished)
266
+ return;
267
+ controller.abort(new ResponseAborted());
268
+ });
269
+ return controller;
270
+ }
271
+ function isAbortError(e) {
272
+ return (e === null || e === void 0 ? void 0 : e.name) === "AbortError" || (e === null || e === void 0 ? void 0 : e.name) === exports.ResponseAbortedName;
273
+ }
274
+ exports.ResponseAbortedName = "ResponseAborted";
275
+ class ResponseAborted extends Error {
276
+ constructor() {
277
+ super(...arguments);
278
+ this.name = exports.ResponseAbortedName;
279
+ }
280
+ }
281
+ exports.ResponseAborted = ResponseAborted;
282
+ function createWriterFromResponse(res, waitUntilForEnd) {
283
+ let started = false;
284
+ let drained = new DetachedPromise();
285
+ function onDrain() {
286
+ drained.resolve();
287
+ }
288
+ res.on("drain", onDrain);
289
+ res.once("close", () => {
290
+ res.off("drain", onDrain);
291
+ drained.resolve();
292
+ });
293
+ const finished = new DetachedPromise();
294
+ res.once("finish", () => {
295
+ finished.resolve();
296
+ });
297
+ return new WritableStream({
298
+ write: async (chunk) => {
299
+ if (!started) {
300
+ started = true;
301
+ res.flushHeaders();
302
+ }
303
+ try {
304
+ const ok = res.write(chunk);
305
+ if ("flush" in res && typeof res.flush === "function") {
306
+ res.flush();
307
+ }
308
+ if (!ok) {
309
+ await drained.promise;
310
+ drained = new DetachedPromise();
311
+ }
312
+ }
313
+ catch (err) {
314
+ res.end();
315
+ throw new Error("failed to write chunk to response", { cause: err });
316
+ }
317
+ },
318
+ abort: (err) => {
319
+ if (res.writableFinished)
320
+ return;
321
+ res.destroy(err);
322
+ },
323
+ close: async () => {
324
+ if (waitUntilForEnd) {
325
+ await waitUntilForEnd;
326
+ }
327
+ if (res.writableFinished)
328
+ return;
329
+ res.end();
330
+ return finished.promise;
331
+ },
332
+ });
333
+ }
334
+ class DetachedPromise {
335
+ constructor() {
336
+ let resolve;
337
+ let reject;
338
+ this.promise = new Promise((res, rej) => {
339
+ resolve = res;
340
+ reject = rej;
341
+ });
342
+ this.resolve = resolve;
343
+ this.reject = reject;
344
+ }
345
+ }
346
+ exports.DetachedPromise = DetachedPromise;
347
+ function serveStatic(req, res, path, opts) {
348
+ return new Promise((resolve, reject) => {
349
+ (0, send_1.default)(req, path, opts)
350
+ .on("directory", () => {
351
+ const err = new Error("No directory access");
352
+ err.code = "ENOENT";
353
+ reject(err);
354
+ })
355
+ .on("error", reject)
356
+ .pipe(res)
357
+ .on("finish", resolve);
358
+ });
359
+ }
360
+ function formatHostname(hostname) {
361
+ return (0, net_1.isIPv6)(hostname) ? `[${hostname}]` : hostname;
362
+ }
@@ -1,8 +1,7 @@
1
- import { ModernSourceMapPayload } from "./sourceMap";
2
- import { Project, ProjectOptions, Update as TurbopackUpdate } from "./types";
3
- import type webpack from "webpack";
4
1
  import { IncomingMessage } from "http";
5
2
  import { Duplex } from "stream";
3
+ import type webpack from "webpack";
4
+ import { BundleOptions, Project, Update as TurbopackUpdate } from "./types";
6
5
  export declare const enum HMR_ACTIONS_SENT_TO_BROWSER {
7
6
  RELOAD = "reload",
8
7
  CLIENT_CHANGES = "clientChanges",
@@ -17,10 +16,6 @@ export interface TurbopackMessageAction {
17
16
  action: HMR_ACTIONS_SENT_TO_BROWSER.TURBOPACK_MESSAGE;
18
17
  data: TurbopackUpdate | TurbopackUpdate[];
19
18
  }
20
- export interface TurbopackMessageAction {
21
- action: HMR_ACTIONS_SENT_TO_BROWSER.TURBOPACK_MESSAGE;
22
- data: TurbopackUpdate | TurbopackUpdate[];
23
- }
24
19
  export interface TurbopackConnectedAction {
25
20
  action: HMR_ACTIONS_SENT_TO_BROWSER.TURBOPACK_CONNECTED;
26
21
  data: {
@@ -65,14 +60,12 @@ export interface HotReloaderInterface {
65
60
  clearHmrServerError(): void;
66
61
  start(): Promise<void>;
67
62
  send(action: HMR_ACTION_TYPES): void;
68
- onHMR(req: IncomingMessage, _socket: Duplex, head: Buffer, onUpgrade: (client: {
63
+ onHMR(req: IncomingMessage, socket: Duplex, head: Buffer, onUpgrade?: (client: {
69
64
  send(data: string): void;
70
65
  }) => void): void;
71
66
  buildFallbackError(): Promise<void>;
72
67
  close(): void;
73
68
  }
74
- type FindSourceMapPayload = (sourceURL: string) => ModernSourceMapPayload | undefined;
75
- export declare function setBundlerFindSourceMapImplementation(findSourceMapImplementation: FindSourceMapPayload): void;
76
69
  export type ChangeSubscriptions = Map<string, Promise<AsyncIterableIterator<TurbopackResult>>>;
77
70
  export type ReadyIds = Set<string>;
78
71
  export type StartBuilding = (id: string, forceRebuild: boolean) => () => void;
@@ -83,5 +76,5 @@ export type ClientState = {
83
76
  };
84
77
  export type SendHmr = (id: string, payload: HMR_ACTION_TYPES) => void;
85
78
  export declare const FAST_REFRESH_RUNTIME_RELOAD = "Fast Refresh had to perform a full reload due to a runtime error.";
86
- export declare function createHotReloader(projectOptions: ProjectOptions, projectPath?: string, rootPath?: string): Promise<HotReloaderInterface>;
79
+ export declare function createHotReloader(bundleOptions: BundleOptions, projectPath?: string, rootPath?: string): Promise<HotReloaderInterface>;
87
80
  export {};