@seip/bluebird-js 0.2.2 → 0.2.3
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/core/cli/export.js +24 -2
- package/package.json +1 -1
package/core/cli/export.js
CHANGED
|
@@ -79,6 +79,26 @@ function rebaseLocalUrls(html, base) {
|
|
|
79
79
|
return html.replace(/(\s(?:src|href)=["'])\/(?!\/)/g, `$1${base}`);
|
|
80
80
|
}
|
|
81
81
|
|
|
82
|
+
/**
|
|
83
|
+
* Validates a URL path option (`--base`, `--basename`). Git Bash on Windows rewrites a bare `/` argument into
|
|
84
|
+
* `C:/Program Files/Git/`, which would break every asset URL; that case falls back to `/` with a warning.
|
|
85
|
+
* @param {unknown} value
|
|
86
|
+
* @param {string} flag
|
|
87
|
+
* @returns {string|undefined}
|
|
88
|
+
*/
|
|
89
|
+
function urlPathOption(value, flag) {
|
|
90
|
+
if (typeof value !== "string") return undefined;
|
|
91
|
+
if (/^[A-Za-z]:[\\/]/.test(value)) {
|
|
92
|
+
const converted = /[\\/]Git[\\/]?$/i.test(value);
|
|
93
|
+
if (converted) {
|
|
94
|
+
console.log(colors.yellow(`[WARN] ${flag} '${value}' looks like a Git Bash path conversion of '/'; using '/'. Prefix the command with MSYS_NO_PATHCONV=1 or run it from PowerShell/cmd to avoid it.`));
|
|
95
|
+
return "/";
|
|
96
|
+
}
|
|
97
|
+
throw new Error(`${flag} must be a URL path such as / or /app/, not a filesystem path ('${value}').`);
|
|
98
|
+
}
|
|
99
|
+
return value;
|
|
100
|
+
}
|
|
101
|
+
|
|
82
102
|
/**
|
|
83
103
|
* `npx bluebird-js export`: static client build of the React SPA.
|
|
84
104
|
*/
|
|
@@ -99,7 +119,9 @@ async function exportSpa() {
|
|
|
99
119
|
delete process.env.DEBUG;
|
|
100
120
|
|
|
101
121
|
const router = ["hash", "browser", "memory"].includes(args.router) ? args.router : "hash";
|
|
102
|
-
const
|
|
122
|
+
const baseArg = urlPathOption(args.base, "--base");
|
|
123
|
+
const basenameArg = urlPathOption(args.basename, "--basename");
|
|
124
|
+
const base = typeof baseArg === "string" ? baseArg.replace(/\/?$/, "/") : router === "browser" ? "/" : "./";
|
|
103
125
|
const auth = args.auth === "cookie" ? "cookie" : "token";
|
|
104
126
|
const apiUrl = String(
|
|
105
127
|
(typeof args.api === "string" && args.api) || process.env.EXPORT_API_URL || process.env.APP_URL || ""
|
|
@@ -131,7 +153,7 @@ async function exportSpa() {
|
|
|
131
153
|
throw new Error(`Missing SPA entry files: ${missing.join(", ")}`);
|
|
132
154
|
}
|
|
133
155
|
|
|
134
|
-
const exportConfig = { apiUrl, router, auth, basename: typeof
|
|
156
|
+
const exportConfig = { apiUrl, router, auth, basename: typeof basenameArg === "string" ? basenameArg : "/" };
|
|
135
157
|
const bridge = new ViteBridge({ root, base });
|
|
136
158
|
const viteConfig = await bridge.inlineConfig();
|
|
137
159
|
const { build: viteBuild } = await import("vite");
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@seip/bluebird-js",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.3",
|
|
4
4
|
"description": "Performance-first Node.js framework: Express + HTML {{ }} SSR templates + React Router SPA with Vite, Tailwind CSS, JWT auth, BaseModel, smart migrations, and multi-level caching",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "core/app.js",
|