@utoo/pack 1.4.8 → 1.4.9
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.js
CHANGED
|
@@ -71,6 +71,9 @@ function normalizedPublicPath(publicPath) {
|
|
|
71
71
|
catch (_a) { }
|
|
72
72
|
return `/${escapedPublicPath}`;
|
|
73
73
|
}
|
|
74
|
+
function isRuntimeResolvedPublicPath(publicPath) {
|
|
75
|
+
return publicPath === "runtime" || publicPath === "auto";
|
|
76
|
+
}
|
|
74
77
|
async function resolveDevConfig(options, projectPath, rootPath, serverOptions) {
|
|
75
78
|
var _a, _b, _d, _e, _f, _g;
|
|
76
79
|
const cfgDevServer = (_b = (_a = options.config) === null || _a === void 0 ? void 0 : _a.devServer) !== null && _b !== void 0 ? _b : {};
|
|
@@ -151,8 +154,8 @@ async function runDev(options, projectPath, rootPath, serverOptions) {
|
|
|
151
154
|
await hotReloader.start();
|
|
152
155
|
const distRoot = (0, cleanOutput_1.getOutputPath)(options.config, projectPathResolved);
|
|
153
156
|
const publicPath = (_b = (_a = options.config) === null || _a === void 0 ? void 0 : _a.output) === null || _b === void 0 ? void 0 : _b.publicPath;
|
|
154
|
-
// Skip prefix stripping for
|
|
155
|
-
const normalizedPrefix = publicPath && publicPath
|
|
157
|
+
// Skip prefix stripping for runtime-resolved publicPath modes and when publicPath is absent.
|
|
158
|
+
const normalizedPrefix = publicPath && !isRuntimeResolvedPublicPath(publicPath)
|
|
156
159
|
? normalizedPublicPath(publicPath)
|
|
157
160
|
: "";
|
|
158
161
|
const app = new hono_1.Hono();
|
|
@@ -7,6 +7,11 @@ exports.HtmlPlugin = void 0;
|
|
|
7
7
|
const domparser_rs_1 = require("domparser-rs");
|
|
8
8
|
const fs_1 = __importDefault(require("fs"));
|
|
9
9
|
const path_1 = __importDefault(require("path"));
|
|
10
|
+
function normalizeHtmlPublicPath(globalPublicPath) {
|
|
11
|
+
return globalPublicPath === "runtime" || globalPublicPath === "auto"
|
|
12
|
+
? ""
|
|
13
|
+
: (globalPublicPath !== null && globalPublicPath !== void 0 ? globalPublicPath : "");
|
|
14
|
+
}
|
|
10
15
|
class HtmlPlugin {
|
|
11
16
|
constructor(config) {
|
|
12
17
|
this.config = config;
|
|
@@ -16,7 +21,7 @@ class HtmlPlugin {
|
|
|
16
21
|
const templatePath = this.config.template
|
|
17
22
|
? path_1.default.resolve(process.cwd(), this.config.template)
|
|
18
23
|
: undefined;
|
|
19
|
-
const publicPath = globalPublicPath
|
|
24
|
+
const publicPath = normalizeHtmlPublicPath(globalPublicPath);
|
|
20
25
|
let htmlContent = "";
|
|
21
26
|
if (this.config.templateContent) {
|
|
22
27
|
htmlContent = this.config.templateContent;
|
package/config_schema.json
CHANGED
|
@@ -1338,7 +1338,7 @@
|
|
|
1338
1338
|
]
|
|
1339
1339
|
},
|
|
1340
1340
|
"publicPath": {
|
|
1341
|
-
"description": "URL prefix prepended to all chunk and asset URLs. Use 'runtime' for
|
|
1341
|
+
"description": "URL prefix prepended to all chunk and asset URLs. Use 'runtime' for globalThis.publicPath or 'auto' for current-script inference.",
|
|
1342
1342
|
"type": [
|
|
1343
1343
|
"string",
|
|
1344
1344
|
"null"
|
package/esm/commands/dev.js
CHANGED
|
@@ -65,6 +65,9 @@ function normalizedPublicPath(publicPath) {
|
|
|
65
65
|
catch (_a) { }
|
|
66
66
|
return `/${escapedPublicPath}`;
|
|
67
67
|
}
|
|
68
|
+
function isRuntimeResolvedPublicPath(publicPath) {
|
|
69
|
+
return publicPath === "runtime" || publicPath === "auto";
|
|
70
|
+
}
|
|
68
71
|
async function resolveDevConfig(options, projectPath, rootPath, serverOptions) {
|
|
69
72
|
var _a, _b, _d, _e, _f, _g;
|
|
70
73
|
const cfgDevServer = (_b = (_a = options.config) === null || _a === void 0 ? void 0 : _a.devServer) !== null && _b !== void 0 ? _b : {};
|
|
@@ -145,8 +148,8 @@ async function runDev(options, projectPath, rootPath, serverOptions) {
|
|
|
145
148
|
await hotReloader.start();
|
|
146
149
|
const distRoot = getOutputPath(options.config, projectPathResolved);
|
|
147
150
|
const publicPath = (_b = (_a = options.config) === null || _a === void 0 ? void 0 : _a.output) === null || _b === void 0 ? void 0 : _b.publicPath;
|
|
148
|
-
// Skip prefix stripping for
|
|
149
|
-
const normalizedPrefix = publicPath && publicPath
|
|
151
|
+
// Skip prefix stripping for runtime-resolved publicPath modes and when publicPath is absent.
|
|
152
|
+
const normalizedPrefix = publicPath && !isRuntimeResolvedPublicPath(publicPath)
|
|
150
153
|
? normalizedPublicPath(publicPath)
|
|
151
154
|
: "";
|
|
152
155
|
const app = new Hono();
|
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import { DOMParser } from "domparser-rs";
|
|
2
2
|
import fs from "fs";
|
|
3
3
|
import path from "path";
|
|
4
|
+
function normalizeHtmlPublicPath(globalPublicPath) {
|
|
5
|
+
return globalPublicPath === "runtime" || globalPublicPath === "auto"
|
|
6
|
+
? ""
|
|
7
|
+
: (globalPublicPath !== null && globalPublicPath !== void 0 ? globalPublicPath : "");
|
|
8
|
+
}
|
|
4
9
|
export class HtmlPlugin {
|
|
5
10
|
constructor(config) {
|
|
6
11
|
this.config = config;
|
|
@@ -10,7 +15,7 @@ export class HtmlPlugin {
|
|
|
10
15
|
const templatePath = this.config.template
|
|
11
16
|
? path.resolve(process.cwd(), this.config.template)
|
|
12
17
|
: undefined;
|
|
13
|
-
const publicPath = globalPublicPath
|
|
18
|
+
const publicPath = normalizeHtmlPublicPath(globalPublicPath);
|
|
14
19
|
let htmlContent = "";
|
|
15
20
|
if (this.config.templateContent) {
|
|
16
21
|
htmlContent = this.config.templateContent;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@utoo/pack",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.9",
|
|
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.
|
|
44
|
+
"@utoo/pack-shared": "1.4.9",
|
|
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.
|
|
100
|
-
"@utoo/pack-darwin-x64": "1.4.
|
|
101
|
-
"@utoo/pack-linux-arm64-gnu": "1.4.
|
|
102
|
-
"@utoo/pack-linux-arm64-musl": "1.4.
|
|
103
|
-
"@utoo/pack-linux-x64-gnu": "1.4.
|
|
104
|
-
"@utoo/pack-linux-x64-musl": "1.4.
|
|
105
|
-
"@utoo/pack-win32-x64-msvc": "1.4.
|
|
99
|
+
"@utoo/pack-darwin-arm64": "1.4.9",
|
|
100
|
+
"@utoo/pack-darwin-x64": "1.4.9",
|
|
101
|
+
"@utoo/pack-linux-arm64-gnu": "1.4.9",
|
|
102
|
+
"@utoo/pack-linux-arm64-musl": "1.4.9",
|
|
103
|
+
"@utoo/pack-linux-x64-gnu": "1.4.9",
|
|
104
|
+
"@utoo/pack-linux-x64-musl": "1.4.9",
|
|
105
|
+
"@utoo/pack-win32-x64-msvc": "1.4.9"
|
|
106
106
|
}
|
|
107
107
|
}
|