@utoo/pack 1.1.8 → 1.1.10-rc.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/README.md +1 -1
- package/cjs/commands/dev.js +27 -9
- package/esm/commands/dev.js +27 -9
- package/package.json +9 -9
package/README.md
CHANGED
package/cjs/commands/dev.js
CHANGED
|
@@ -35,23 +35,41 @@ function serve(options, projectPath, rootPath, serverOptions) {
|
|
|
35
35
|
return serveInternal(bundleOptions, projectPath, rootPath, serverOptions);
|
|
36
36
|
}
|
|
37
37
|
async function serveInternal(options, projectPath, rootPath, serverOptions) {
|
|
38
|
+
var _a;
|
|
38
39
|
(0, common_1.blockStdout)();
|
|
39
40
|
if (process.env.XCODE_PROFILE) {
|
|
40
41
|
await (0, xcodeProfile_1.xcodeProfilingReady)();
|
|
41
42
|
}
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
43
|
+
// FIXME: fix any type
|
|
44
|
+
const cfgDevServer = (((_a = options.config) === null || _a === void 0 ? void 0 : _a.devServer) || {});
|
|
45
|
+
const serverOpts = {
|
|
46
|
+
hostname: (serverOptions === null || serverOptions === void 0 ? void 0 : serverOptions.hostname) || cfgDevServer.host || "localhost",
|
|
47
|
+
port: typeof (serverOptions === null || serverOptions === void 0 ? void 0 : serverOptions.port) !== "undefined"
|
|
48
|
+
? serverOptions.port
|
|
49
|
+
: cfgDevServer.port || 3000,
|
|
50
|
+
https: typeof (serverOptions === null || serverOptions === void 0 ? void 0 : serverOptions.https) !== "undefined"
|
|
51
|
+
? serverOptions.https
|
|
52
|
+
: cfgDevServer.https,
|
|
46
53
|
logServerInfo: serverOptions === null || serverOptions === void 0 ? void 0 : serverOptions.logServerInfo,
|
|
47
|
-
selfSignedCertificate:
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
54
|
+
selfSignedCertificate: serverOptions === null || serverOptions === void 0 ? void 0 : serverOptions.selfSignedCertificate,
|
|
55
|
+
};
|
|
56
|
+
// If HTTPS is requested and no certificate provided, attempt to generate one.
|
|
57
|
+
if (serverOpts.https && !serverOpts.selfSignedCertificate) {
|
|
58
|
+
try {
|
|
59
|
+
// createSelfSignedCertificate may return undefined on failure
|
|
60
|
+
const cert = await (0, mkcert_1.createSelfSignedCertificate)(serverOpts.hostname);
|
|
61
|
+
if (cert)
|
|
62
|
+
serverOpts.selfSignedCertificate = cert;
|
|
63
|
+
}
|
|
64
|
+
catch (e) {
|
|
65
|
+
// ignore and fall back to http if certificate generation fails
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
await startServer(serverOpts, {
|
|
51
69
|
...options,
|
|
52
70
|
config: {
|
|
53
71
|
...options.config,
|
|
54
|
-
devServer: { hot: true },
|
|
72
|
+
devServer: { ...(options.config.devServer || {}), hot: true },
|
|
55
73
|
},
|
|
56
74
|
packPath: (0, common_1.getPackPath)(),
|
|
57
75
|
}, projectPath || process.cwd(), rootPath);
|
package/esm/commands/dev.js
CHANGED
|
@@ -21,23 +21,41 @@ export function serve(options, projectPath, rootPath, serverOptions) {
|
|
|
21
21
|
return serveInternal(bundleOptions, projectPath, rootPath, serverOptions);
|
|
22
22
|
}
|
|
23
23
|
async function serveInternal(options, projectPath, rootPath, serverOptions) {
|
|
24
|
+
var _a;
|
|
24
25
|
blockStdout();
|
|
25
26
|
if (process.env.XCODE_PROFILE) {
|
|
26
27
|
await xcodeProfilingReady();
|
|
27
28
|
}
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
29
|
+
// FIXME: fix any type
|
|
30
|
+
const cfgDevServer = (((_a = options.config) === null || _a === void 0 ? void 0 : _a.devServer) || {});
|
|
31
|
+
const serverOpts = {
|
|
32
|
+
hostname: (serverOptions === null || serverOptions === void 0 ? void 0 : serverOptions.hostname) || cfgDevServer.host || "localhost",
|
|
33
|
+
port: typeof (serverOptions === null || serverOptions === void 0 ? void 0 : serverOptions.port) !== "undefined"
|
|
34
|
+
? serverOptions.port
|
|
35
|
+
: cfgDevServer.port || 3000,
|
|
36
|
+
https: typeof (serverOptions === null || serverOptions === void 0 ? void 0 : serverOptions.https) !== "undefined"
|
|
37
|
+
? serverOptions.https
|
|
38
|
+
: cfgDevServer.https,
|
|
32
39
|
logServerInfo: serverOptions === null || serverOptions === void 0 ? void 0 : serverOptions.logServerInfo,
|
|
33
|
-
selfSignedCertificate:
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
40
|
+
selfSignedCertificate: serverOptions === null || serverOptions === void 0 ? void 0 : serverOptions.selfSignedCertificate,
|
|
41
|
+
};
|
|
42
|
+
// If HTTPS is requested and no certificate provided, attempt to generate one.
|
|
43
|
+
if (serverOpts.https && !serverOpts.selfSignedCertificate) {
|
|
44
|
+
try {
|
|
45
|
+
// createSelfSignedCertificate may return undefined on failure
|
|
46
|
+
const cert = await createSelfSignedCertificate(serverOpts.hostname);
|
|
47
|
+
if (cert)
|
|
48
|
+
serverOpts.selfSignedCertificate = cert;
|
|
49
|
+
}
|
|
50
|
+
catch (e) {
|
|
51
|
+
// ignore and fall back to http if certificate generation fails
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
await startServer(serverOpts, {
|
|
37
55
|
...options,
|
|
38
56
|
config: {
|
|
39
57
|
...options.config,
|
|
40
|
-
devServer: { hot: true },
|
|
58
|
+
devServer: { ...(options.config.devServer || {}), hot: true },
|
|
41
59
|
},
|
|
42
60
|
packPath: getPackPath(),
|
|
43
61
|
}, projectPath || process.cwd(), rootPath);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@utoo/pack",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.10-rc.2",
|
|
4
4
|
"main": "cjs/index.js",
|
|
5
5
|
"module": "esm/index.js",
|
|
6
6
|
"types": "esm/index.d.ts",
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"dependencies": {
|
|
40
40
|
"@babel/code-frame": "7.22.5",
|
|
41
41
|
"@swc/helpers": "0.5.15",
|
|
42
|
-
"@utoo/pack-shared": "1.1.
|
|
42
|
+
"@utoo/pack-shared": "1.1.10-rc.2",
|
|
43
43
|
"@utoo/style-loader": "^1.0.0",
|
|
44
44
|
"domparser-rs": "^0.0.5",
|
|
45
45
|
"find-up": "4.1.0",
|
|
@@ -88,12 +88,12 @@
|
|
|
88
88
|
},
|
|
89
89
|
"repository": "git@github.com:utooland/utoo.git",
|
|
90
90
|
"optionalDependencies": {
|
|
91
|
-
"@utoo/pack-darwin-arm64": "1.1.
|
|
92
|
-
"@utoo/pack-darwin-x64": "1.1.
|
|
93
|
-
"@utoo/pack-linux-arm64-gnu": "1.1.
|
|
94
|
-
"@utoo/pack-linux-arm64-musl": "1.1.
|
|
95
|
-
"@utoo/pack-linux-x64-gnu": "1.1.
|
|
96
|
-
"@utoo/pack-linux-x64-musl": "1.1.
|
|
97
|
-
"@utoo/pack-win32-x64-msvc": "1.1.
|
|
91
|
+
"@utoo/pack-darwin-arm64": "1.1.10-rc.2",
|
|
92
|
+
"@utoo/pack-darwin-x64": "1.1.10-rc.2",
|
|
93
|
+
"@utoo/pack-linux-arm64-gnu": "1.1.10-rc.2",
|
|
94
|
+
"@utoo/pack-linux-arm64-musl": "1.1.10-rc.2",
|
|
95
|
+
"@utoo/pack-linux-x64-gnu": "1.1.10-rc.2",
|
|
96
|
+
"@utoo/pack-linux-x64-musl": "1.1.10-rc.2",
|
|
97
|
+
"@utoo/pack-win32-x64-msvc": "1.1.10-rc.2"
|
|
98
98
|
}
|
|
99
99
|
}
|