@utoo/pack 1.4.2-alpha.0 → 1.4.2-alpha.2
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/commands/dev.d.ts +9 -0
- package/cjs/commands/dev.js +19 -1
- package/esm/commands/dev.d.ts +9 -0
- package/esm/commands/dev.js +19 -1
- package/package.json +9 -9
package/cjs/commands/dev.d.ts
CHANGED
|
@@ -15,5 +15,14 @@ export interface StartServerOptions {
|
|
|
15
15
|
hostname?: string;
|
|
16
16
|
logServerInfo?: boolean;
|
|
17
17
|
selfSignedCertificate?: SelfSignedCertificate;
|
|
18
|
+
/**
|
|
19
|
+
* Called after the initial dev build has been written and the HTTP server is
|
|
20
|
+
* listening. Integrations can await this instead of polling the internal
|
|
21
|
+
* server port.
|
|
22
|
+
*/
|
|
23
|
+
onReady?: (context: {
|
|
24
|
+
port: number;
|
|
25
|
+
hostname: string;
|
|
26
|
+
}) => void | Promise<void>;
|
|
18
27
|
}
|
|
19
28
|
export declare function serve(options: BundleOptions | WebpackConfig, projectPath?: string, rootPath?: string, serverOptions?: StartServerOptions): Promise<void>;
|
package/cjs/commands/dev.js
CHANGED
|
@@ -139,7 +139,7 @@ function serve(options, projectPath, rootPath, serverOptions) {
|
|
|
139
139
|
}
|
|
140
140
|
const HMR_PATH = "/turbopack-hmr";
|
|
141
141
|
async function runDev(options, projectPath, rootPath, serverOptions) {
|
|
142
|
-
var _a, _b, _d, _e, _f, _g;
|
|
142
|
+
var _a, _b, _d, _e, _f, _g, _h;
|
|
143
143
|
(0, common_1.blockStdout)();
|
|
144
144
|
process.title = "utoopack-dev-server";
|
|
145
145
|
if (process.env.XCODE_PROFILE) {
|
|
@@ -206,6 +206,24 @@ async function runDev(options, projectPath, rootPath, serverOptions) {
|
|
|
206
206
|
fetch: app.fetch,
|
|
207
207
|
});
|
|
208
208
|
injectWebSocket(server);
|
|
209
|
+
if (!server.listening) {
|
|
210
|
+
await new Promise((resolve, reject) => {
|
|
211
|
+
const onListening = () => {
|
|
212
|
+
server.off("error", onError);
|
|
213
|
+
resolve();
|
|
214
|
+
};
|
|
215
|
+
const onError = (error) => {
|
|
216
|
+
server.off("listening", onListening);
|
|
217
|
+
reject(error);
|
|
218
|
+
};
|
|
219
|
+
server.once("listening", onListening);
|
|
220
|
+
server.once("error", onError);
|
|
221
|
+
});
|
|
222
|
+
}
|
|
223
|
+
await ((_h = serverOptions === null || serverOptions === void 0 ? void 0 : serverOptions.onReady) === null || _h === void 0 ? void 0 : _h.call(serverOptions, {
|
|
224
|
+
port: serveOptsBase.port,
|
|
225
|
+
hostname: serveOptsBase.hostname,
|
|
226
|
+
}));
|
|
209
227
|
if ((serverOptions === null || serverOptions === void 0 ? void 0 : serverOptions.logServerInfo) !== false) {
|
|
210
228
|
const scheme = serveOptsBase.serverOptions ? "https" : "http";
|
|
211
229
|
const displayHost = serveOptsBase.hostname === "0.0.0.0"
|
package/esm/commands/dev.d.ts
CHANGED
|
@@ -15,5 +15,14 @@ export interface StartServerOptions {
|
|
|
15
15
|
hostname?: string;
|
|
16
16
|
logServerInfo?: boolean;
|
|
17
17
|
selfSignedCertificate?: SelfSignedCertificate;
|
|
18
|
+
/**
|
|
19
|
+
* Called after the initial dev build has been written and the HTTP server is
|
|
20
|
+
* listening. Integrations can await this instead of polling the internal
|
|
21
|
+
* server port.
|
|
22
|
+
*/
|
|
23
|
+
onReady?: (context: {
|
|
24
|
+
port: number;
|
|
25
|
+
hostname: string;
|
|
26
|
+
}) => void | Promise<void>;
|
|
18
27
|
}
|
|
19
28
|
export declare function serve(options: BundleOptions | WebpackConfig, projectPath?: string, rootPath?: string, serverOptions?: StartServerOptions): Promise<void>;
|
package/esm/commands/dev.js
CHANGED
|
@@ -133,7 +133,7 @@ export function serve(options, projectPath, rootPath, serverOptions) {
|
|
|
133
133
|
}
|
|
134
134
|
const HMR_PATH = "/turbopack-hmr";
|
|
135
135
|
async function runDev(options, projectPath, rootPath, serverOptions) {
|
|
136
|
-
var _a, _b, _d, _e, _f, _g;
|
|
136
|
+
var _a, _b, _d, _e, _f, _g, _h;
|
|
137
137
|
blockStdout();
|
|
138
138
|
process.title = "utoopack-dev-server";
|
|
139
139
|
if (process.env.XCODE_PROFILE) {
|
|
@@ -200,6 +200,24 @@ async function runDev(options, projectPath, rootPath, serverOptions) {
|
|
|
200
200
|
fetch: app.fetch,
|
|
201
201
|
});
|
|
202
202
|
injectWebSocket(server);
|
|
203
|
+
if (!server.listening) {
|
|
204
|
+
await new Promise((resolve, reject) => {
|
|
205
|
+
const onListening = () => {
|
|
206
|
+
server.off("error", onError);
|
|
207
|
+
resolve();
|
|
208
|
+
};
|
|
209
|
+
const onError = (error) => {
|
|
210
|
+
server.off("listening", onListening);
|
|
211
|
+
reject(error);
|
|
212
|
+
};
|
|
213
|
+
server.once("listening", onListening);
|
|
214
|
+
server.once("error", onError);
|
|
215
|
+
});
|
|
216
|
+
}
|
|
217
|
+
await ((_h = serverOptions === null || serverOptions === void 0 ? void 0 : serverOptions.onReady) === null || _h === void 0 ? void 0 : _h.call(serverOptions, {
|
|
218
|
+
port: serveOptsBase.port,
|
|
219
|
+
hostname: serveOptsBase.hostname,
|
|
220
|
+
}));
|
|
203
221
|
if ((serverOptions === null || serverOptions === void 0 ? void 0 : serverOptions.logServerInfo) !== false) {
|
|
204
222
|
const scheme = serveOptsBase.serverOptions ? "https" : "http";
|
|
205
223
|
const displayHost = serveOptsBase.hostname === "0.0.0.0"
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@utoo/pack",
|
|
3
|
-
"version": "1.4.2-alpha.
|
|
3
|
+
"version": "1.4.2-alpha.2",
|
|
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.2-alpha.
|
|
44
|
+
"@utoo/pack-shared": "1.4.2-alpha.2",
|
|
45
45
|
"domparser-rs": "^0.0.7",
|
|
46
46
|
"find-up": "4.1.0",
|
|
47
47
|
"get-port": "5.1.1",
|
|
@@ -92,12 +92,12 @@
|
|
|
92
92
|
},
|
|
93
93
|
"repository": "git@github.com:utooland/utoo.git",
|
|
94
94
|
"optionalDependencies": {
|
|
95
|
-
"@utoo/pack-darwin-arm64": "1.4.2-alpha.
|
|
96
|
-
"@utoo/pack-darwin-x64": "1.4.2-alpha.
|
|
97
|
-
"@utoo/pack-linux-arm64-gnu": "1.4.2-alpha.
|
|
98
|
-
"@utoo/pack-linux-arm64-musl": "1.4.2-alpha.
|
|
99
|
-
"@utoo/pack-linux-x64-gnu": "1.4.2-alpha.
|
|
100
|
-
"@utoo/pack-linux-x64-musl": "1.4.2-alpha.
|
|
101
|
-
"@utoo/pack-win32-x64-msvc": "1.4.2-alpha.
|
|
95
|
+
"@utoo/pack-darwin-arm64": "1.4.2-alpha.2",
|
|
96
|
+
"@utoo/pack-darwin-x64": "1.4.2-alpha.2",
|
|
97
|
+
"@utoo/pack-linux-arm64-gnu": "1.4.2-alpha.2",
|
|
98
|
+
"@utoo/pack-linux-arm64-musl": "1.4.2-alpha.2",
|
|
99
|
+
"@utoo/pack-linux-x64-gnu": "1.4.2-alpha.2",
|
|
100
|
+
"@utoo/pack-linux-x64-musl": "1.4.2-alpha.2",
|
|
101
|
+
"@utoo/pack-win32-x64-msvc": "1.4.2-alpha.2"
|
|
102
102
|
}
|
|
103
103
|
}
|