@base44-preview/vite-plugin 1.0.37-pr.121.9ef7c71 → 1.0.37-pr.121.de0cee3
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/dist/build-status-plugin.d.ts.map +1 -1
- package/dist/build-status-plugin.js +11 -24
- package/dist/build-status-plugin.js.map +1 -1
- package/dist/bundled-dev.js +1 -1
- package/dist/bundled-dev.js.map +1 -1
- package/dist/html-injections-plugin.d.ts +8 -3
- package/dist/html-injections-plugin.d.ts.map +1 -1
- package/dist/html-injections-plugin.js +2 -11
- package/dist/html-injections-plugin.js.map +1 -1
- package/dist/injections/sandbox-build-error-notifier.d.ts +0 -4
- package/dist/injections/sandbox-build-error-notifier.d.ts.map +1 -1
- package/dist/injections/sandbox-build-error-notifier.js +25 -22
- package/dist/injections/sandbox-build-error-notifier.js.map +1 -1
- package/dist/injections/sandbox-hmr-socket-relay.d.ts +0 -5
- package/dist/injections/sandbox-hmr-socket-relay.d.ts.map +1 -1
- package/dist/injections/sandbox-hmr-socket-relay.js +18 -22
- package/dist/injections/sandbox-hmr-socket-relay.js.map +1 -1
- package/package.json +1 -1
- package/src/build-status-plugin.ts +12 -30
- package/src/bundled-dev.ts +1 -1
- package/src/html-injections-plugin.ts +8 -12
- package/src/injections/sandbox-build-error-notifier.ts +25 -28
- package/src/injections/sandbox-hmr-socket-relay.ts +14 -25
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build-status-plugin.d.ts","sourceRoot":"","sources":["../src/build-status-plugin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"build-status-plugin.d.ts","sourceRoot":"","sources":["../src/build-status-plugin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAW,MAAM,EAAiB,MAAM,MAAM,CAAC;AA0E3D;;;GAGG;AACH,wBAAgB,KAAK,CAAC,GAAG,EAAE,OAAO,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CA2ClE;AAED,wBAAgB,iBAAiB,IAAI,MAAM,CA6F1C"}
|
|
@@ -29,13 +29,6 @@ const ENDPOINT = "/__build_status";
|
|
|
29
29
|
const MAX_FIELD = 4000;
|
|
30
30
|
/** Max characters kept for the code frame. */
|
|
31
31
|
const MAX_FRAME = 2000;
|
|
32
|
-
const PATCHED = Symbol.for("base44.buildStatus.loggerPatched");
|
|
33
|
-
// Plugin hooks run once per environment in bundled dev; only the client's
|
|
34
|
-
// build is the preview. Older Vite has no `this.environment`.
|
|
35
|
-
function isClientEnvironment(ctx) {
|
|
36
|
-
const name = ctx?.environment?.name;
|
|
37
|
-
return name === undefined || name === "client";
|
|
38
|
-
}
|
|
39
32
|
const LOOPBACK_ADDRESSES = new Set([
|
|
40
33
|
"127.0.0.1",
|
|
41
34
|
"::1",
|
|
@@ -118,15 +111,14 @@ export function buildStatusPlugin() {
|
|
|
118
111
|
configResolved(config) {
|
|
119
112
|
bundled = isBundledDev(config);
|
|
120
113
|
},
|
|
121
|
-
// Bundled dev runs the rolldown build hooks on every rebuild
|
|
122
|
-
//
|
|
123
|
-
// was recorded before. Other environments' builds say nothing about the preview.
|
|
114
|
+
// Bundled dev runs the rolldown build hooks on every rebuild; a build that
|
|
115
|
+
// reaches generateBundle superseded whatever error was recorded before.
|
|
124
116
|
buildEnd(error) {
|
|
125
|
-
if (bundled && error
|
|
117
|
+
if (bundled && error)
|
|
126
118
|
lastError = error;
|
|
127
119
|
},
|
|
128
120
|
generateBundle() {
|
|
129
|
-
if (bundled
|
|
121
|
+
if (bundled)
|
|
130
122
|
lastError = null;
|
|
131
123
|
},
|
|
132
124
|
configureServer(server) {
|
|
@@ -134,19 +126,14 @@ export function buildStatusPlugin() {
|
|
|
134
126
|
if (bundled) {
|
|
135
127
|
// Bundled dev reports build failures through the environment logger
|
|
136
128
|
// (`{ error }` option) and per-client sends, never the broadcast
|
|
137
|
-
// channel patched below.
|
|
138
|
-
// successful build: the fail-safe direction for a health endpoint.
|
|
129
|
+
// channel patched below.
|
|
139
130
|
const logger = server.environments.client.logger;
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
};
|
|
147
|
-
patched[PATCHED] = true;
|
|
148
|
-
logger.error = patched;
|
|
149
|
-
}
|
|
131
|
+
const origError = logger.error.bind(logger);
|
|
132
|
+
logger.error = (msg, options) => {
|
|
133
|
+
if (options?.error)
|
|
134
|
+
lastError = options.error;
|
|
135
|
+
return origError(msg, options);
|
|
136
|
+
};
|
|
150
137
|
}
|
|
151
138
|
// Observe the HMR channel: an `error` payload records the last
|
|
152
139
|
// error; a successful `update` / `full-reload` clears it.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build-status-plugin.js","sourceRoot":"","sources":["../src/build-status-plugin.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAEhD;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH,MAAM,QAAQ,GAAG,iBAAiB,CAAC;AAEnC,qDAAqD;AACrD,MAAM,SAAS,GAAG,IAAI,CAAC;AACvB,8CAA8C;AAC9C,MAAM,SAAS,GAAG,IAAI,CAAC;AAIvB,MAAM,
|
|
1
|
+
{"version":3,"file":"build-status-plugin.js","sourceRoot":"","sources":["../src/build-status-plugin.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAEhD;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH,MAAM,QAAQ,GAAG,iBAAiB,CAAC;AAEnC,qDAAqD;AACrD,MAAM,SAAS,GAAG,IAAI,CAAC;AACvB,8CAA8C;AAC9C,MAAM,SAAS,GAAG,IAAI,CAAC;AAIvB,MAAM,kBAAkB,GAAG,IAAI,GAAG,CAAC;IACjC,WAAW;IACX,KAAK;IACL,kBAAkB;CACnB,CAAC,CAAC;AAEH,SAAS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CAAC;gBAED,MAAM,CAAC,WAAW,CAAC,GAAG,CACpB,QAAQ,EACR,CACE,GAA4B,EAC5B,GAAmB,EACnB,IAA0B,EAC1B,EAAE;oBACF,IAAI,CAAC;wBACH,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,MAAM,EAAE,aAAa,CAAC,EAAE,CAAC;4BAC3C,IAAI,EAAE,CAAC;4BACP,OAAO;wBACT,CAAC;wBACD,IAAI,GAAG,CAAC,MAAM,KAAK,KAAK,EAAE,CAAC;4BACzB,IAAI,EAAE,CAAC;4BACP,OAAO;wBACT,CAAC;wBAED,MAAM,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC;4BAC1B,EAAE,EAAE,CAAC,SAAS;4BACd,KAAK,EAAE,KAAK,CAAC,SAAS,CAAC;yBACxB,CAAC,CAAC;wBACH,2DAA2D;wBAC3D,wDAAwD;wBACxD,GAAG,CAAC,UAAU,GAAG,GAAG,CAAC;wBACrB,GAAG,CAAC,SAAS,CAAC,cAAc,EAAE,kBAAkB,CAAC,CAAC;wBAClD,GAAG,CAAC,SAAS,CAAC,eAAe,EAAE,UAAU,CAAC,CAAC;wBAC3C,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;oBAChB,CAAC;oBAAC,MAAM,CAAC;wBACP,yDAAyD;wBACzD,IAAI,CAAC;4BACH,IAAI,EAAE,CAAC;wBACT,CAAC;wBAAC,MAAM,CAAC;4BACP,SAAS;wBACX,CAAC;oBACH,CAAC;gBACH,CAAC,CACF,CAAC;YACJ,CAAC;YAAC,MAAM,CAAC;gBACP,2DAA2D;YAC7D,CAAC;QACH,CAAC;KACF,CAAC;AACJ,CAAC"}
|
package/dist/bundled-dev.js
CHANGED
package/dist/bundled-dev.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bundled-dev.js","sourceRoot":"","sources":["../src/bundled-dev.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,MAAM,UAAU,YAAY,CAAC,MAAe;IAC1C,MAAM,YAAY,GAAI,MAAkE;QACtF,EAAE,YAAY,CAAC;IACjB,OAAO,
|
|
1
|
+
{"version":3,"file":"bundled-dev.js","sourceRoot":"","sources":["../src/bundled-dev.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,MAAM,UAAU,YAAY,CAAC,MAAe;IAC1C,MAAM,YAAY,GAAI,MAAkE;QACtF,EAAE,YAAY,CAAC;IACjB,OAAO,YAAY,EAAE,UAAU,KAAK,IAAI,CAAC;AAC3C,CAAC"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type { Connect, Plugin } from "vite";
|
|
1
|
+
import type { Plugin } from "vite";
|
|
3
2
|
/** This file lives in dist/ once built, so its directory is the served root. */
|
|
4
3
|
export declare const PLUGIN_DIST_DIR: string;
|
|
5
4
|
/**
|
|
@@ -7,7 +6,13 @@ export declare const PLUGIN_DIST_DIR: string;
|
|
|
7
6
|
* dynamic `import()` of dist/statics/index.mjs would fall through to the SPA
|
|
8
7
|
* fallback and receive index.html. Serve the plugin's own dist tree instead.
|
|
9
8
|
*/
|
|
10
|
-
export declare function serveDistMiddleware(distDir: string): (req:
|
|
9
|
+
export declare function serveDistMiddleware(distDir: string): (req: {
|
|
10
|
+
url?: string | undefined;
|
|
11
|
+
}, res: {
|
|
12
|
+
statusCode: number;
|
|
13
|
+
setHeader: (k: string, v: string) => void;
|
|
14
|
+
end: (b?: string) => void;
|
|
15
|
+
}, next: (err?: unknown) => void) => void;
|
|
11
16
|
export declare function htmlInjectionsPlugin({ hmrNotifier, navigationNotifier, visualEditAgent, analyticsTracker, }: {
|
|
12
17
|
hmrNotifier: boolean;
|
|
13
18
|
navigationNotifier: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"html-injections-plugin.d.ts","sourceRoot":"","sources":["../src/html-injections-plugin.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"html-injections-plugin.d.ts","sourceRoot":"","sources":["../src/html-injections-plugin.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,MAAM,EAAoC,MAAM,MAAM,CAAC;AAgGrE,gFAAgF;AAChF,eAAO,MAAM,eAAe,QAA+C,CAAC;AAE5E;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,MAAM,IAE/C,KAAK;IAAE,GAAG,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;CAAE,EACjC,KAAK;IAAE,UAAU,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;IAAC,GAAG,EAAE,CAAC,CAAC,CAAC,EAAE,MAAM,KAAK,IAAI,CAAA;CAAE,EACjG,MAAM,CAAC,GAAG,CAAC,EAAE,OAAO,KAAK,IAAI,UAoBhC;AAED,wBAAgB,oBAAoB,CAAC,EACnC,WAAW,EACX,kBAAkB,EAClB,eAAe,EACf,gBAAgB,GACjB,EAAE;IACD,WAAW,EAAE,OAAO,CAAC;IACrB,kBAAkB,EAAE,OAAO,CAAC;IAC5B,eAAe,EAAE,OAAO,CAAC;IACzB,gBAAgB,EAAE,OAAO,CAAC;CAC3B,GAAG,MAAM,EAAE,CAiHX"}
|
|
@@ -92,15 +92,7 @@ export function serveDistMiddleware(distDir) {
|
|
|
92
92
|
const url = (req.url ?? "").split("?")[0] ?? "";
|
|
93
93
|
if (!url.startsWith(`${DIST_URL_PREFIX}/`))
|
|
94
94
|
return next();
|
|
95
|
-
|
|
96
|
-
return next();
|
|
97
|
-
let relative;
|
|
98
|
-
try {
|
|
99
|
-
relative = decodeURIComponent(url.slice(DIST_URL_PREFIX.length + 1));
|
|
100
|
-
}
|
|
101
|
-
catch {
|
|
102
|
-
return next();
|
|
103
|
-
}
|
|
95
|
+
const relative = decodeURIComponent(url.slice(DIST_URL_PREFIX.length + 1));
|
|
104
96
|
const filePath = path.resolve(distDir, relative);
|
|
105
97
|
const type = CONTENT_TYPES[path.extname(filePath)];
|
|
106
98
|
if (!type ||
|
|
@@ -112,8 +104,7 @@ export function serveDistMiddleware(distDir) {
|
|
|
112
104
|
res.statusCode = 200;
|
|
113
105
|
res.setHeader("Content-Type", type);
|
|
114
106
|
res.setHeader("Cache-Control", "no-store");
|
|
115
|
-
|
|
116
|
-
createReadStream(filePath).on("error", () => res.end()).pipe(res);
|
|
107
|
+
createReadStream(filePath).pipe(res);
|
|
117
108
|
};
|
|
118
109
|
}
|
|
119
110
|
export function htmlInjectionsPlugin({ hmrNotifier, navigationNotifier, visualEditAgent, analyticsTracker, }) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"html-injections-plugin.js","sourceRoot":"","sources":["../src/html-injections-plugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACjE,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"html-injections-plugin.js","sourceRoot":"","sources":["../src/html-injections-plugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACjE,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAC/B,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAahD,MAAM,wBAAwB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA+BhC,CAAC;AAEF,MAAM,eAAe,GAAG,wCAAwC,CAAC;AAEjE,MAAM,UAAU,GAA8B;IAC5C,eAAe,EAAE;QACf,GAAG,EAAE,GAAG,eAAe,0CAA0C;QACjE,QAAQ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C,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;YAC7C,CAAC;SACF;KACF,CAAC;IAEF,MAAM,UAAU,GAAW;QACzB,IAAI,EAAE,4BAA4B;QAClC,kBAAkB,EAAE;YAClB,OAAO;gBACL,OAAO,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC;YAC9C,CAAC;SACF;KACF,CAAC;IAEF,OAAO,CAAC,GAAG,EAAE,UAAU,EAAE,UAAU,CAAC,CAAC;AACvC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sandbox-build-error-notifier.d.ts","sourceRoot":"","sources":["../../src/injections/sandbox-build-error-notifier.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"sandbox-build-error-notifier.d.ts","sourceRoot":"","sources":["../../src/injections/sandbox-build-error-notifier.ts"],"names":[],"mappings":"AAgCA,OAAO,EAAE,CAAC"}
|
|
@@ -1,26 +1,29 @@
|
|
|
1
1
|
/// <reference types="vite/client" />
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const stack = typeof err.stack === "string" ? err.stack : undefined;
|
|
6
|
-
const loc = err.loc;
|
|
7
|
-
const file = loc?.file ?? (typeof err.id === "string" ? err.id : undefined);
|
|
8
|
-
const where = file && loc?.line != null ? `${file}:${loc.line}:${loc.column ?? 0}` : file;
|
|
9
|
-
const details = [where, typeof err.frame === "string" ? err.frame : undefined, stack]
|
|
10
|
-
.filter(Boolean)
|
|
11
|
-
.join("\n");
|
|
12
|
-
win.parent?.postMessage({
|
|
13
|
-
type: "app_error",
|
|
14
|
-
error: {
|
|
15
|
-
title: message,
|
|
16
|
-
details: details || undefined,
|
|
17
|
-
componentName: undefined,
|
|
18
|
-
originalError: { message, stack, plugin: err.plugin, id: err.id, loc },
|
|
19
|
-
stack,
|
|
20
|
-
},
|
|
21
|
-
}, "*");
|
|
22
|
-
}
|
|
2
|
+
// Bundled dev mode keeps Vite's own client, so the ErrorOverlay swap in
|
|
3
|
+
// error-overlay-plugin never runs. The overlay is disabled server-side instead
|
|
4
|
+
// and build errors are forwarded here in the same `app_error` shape.
|
|
23
5
|
if (import.meta.hot) {
|
|
24
|
-
import.meta.hot.on("vite:error", (payload) =>
|
|
6
|
+
import.meta.hot.on("vite:error", (payload) => {
|
|
7
|
+
const err = payload?.err ?? {};
|
|
8
|
+
const message = typeof err.message === "string" ? err.message : "Build error";
|
|
9
|
+
const stack = typeof err.stack === "string" ? err.stack : undefined;
|
|
10
|
+
const loc = err.loc;
|
|
11
|
+
const file = loc?.file ?? (typeof err.id === "string" ? err.id : undefined);
|
|
12
|
+
const where = file && loc?.line != null ? `${file}:${loc.line}:${loc.column ?? 0}` : file;
|
|
13
|
+
const details = [where, typeof err.frame === "string" ? err.frame : undefined, stack]
|
|
14
|
+
.filter(Boolean)
|
|
15
|
+
.join("\n");
|
|
16
|
+
window.parent?.postMessage({
|
|
17
|
+
type: "app_error",
|
|
18
|
+
error: {
|
|
19
|
+
title: message,
|
|
20
|
+
details: details || undefined,
|
|
21
|
+
componentName: undefined,
|
|
22
|
+
originalError: { message, stack, plugin: err.plugin, id: err.id, loc },
|
|
23
|
+
stack,
|
|
24
|
+
},
|
|
25
|
+
}, "*");
|
|
26
|
+
});
|
|
25
27
|
}
|
|
28
|
+
export {};
|
|
26
29
|
//# sourceMappingURL=sandbox-build-error-notifier.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sandbox-build-error-notifier.js","sourceRoot":"","sources":["../../src/injections/sandbox-build-error-notifier.ts"],"names":[],"mappings":"AAAA,qCAAqC;
|
|
1
|
+
{"version":3,"file":"sandbox-build-error-notifier.js","sourceRoot":"","sources":["../../src/injections/sandbox-build-error-notifier.ts"],"names":[],"mappings":"AAAA,qCAAqC;AAErC,wEAAwE;AACxE,+EAA+E;AAC/E,qEAAqE;AACrE,IAAI,MAAM,CAAC,IAAI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S;gBACxB,aAAa,EAAE,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,EAAE,EAAE,GAAG,CAAC,EAAE,EAAE,GAAG,EAAE;gBACtE,KAAK;aACN;SACF,EACD,GAAG,CACJ,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC;AAED,OAAO,EAAE,CAAC"}
|
|
@@ -1,7 +1,2 @@
|
|
|
1
|
-
type HotEvents = {
|
|
2
|
-
on: (event: string, cb: (payload?: unknown) => unknown) => void;
|
|
3
|
-
};
|
|
4
|
-
export declare const PREVIEW_FE_VERSION_PARAM = "previewFE_version";
|
|
5
|
-
export declare function attachHmrSocketRelay(hot: HotEvents, win?: Window): void;
|
|
6
1
|
export {};
|
|
7
2
|
//# sourceMappingURL=sandbox-hmr-socket-relay.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sandbox-hmr-socket-relay.d.ts","sourceRoot":"","sources":["../../src/injections/sandbox-hmr-socket-relay.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"sandbox-hmr-socket-relay.d.ts","sourceRoot":"","sources":["../../src/injections/sandbox-hmr-socket-relay.ts"],"names":[],"mappings":"AAyBA,OAAO,EAAE,CAAC"}
|
|
@@ -1,28 +1,24 @@
|
|
|
1
1
|
/// <reference types="vite/client" />
|
|
2
|
-
//
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
hot.on("vite:ws:connect", () => {
|
|
11
|
-
win.parent?.postMessage({ type: "SANDBOX_WS_CONNECT" }, "*");
|
|
2
|
+
// The preview proxy's bridge watches the HMR socket by importing /@vite/client,
|
|
3
|
+
// which bundled dev mode does not serve. This module ships inside the bundle and
|
|
4
|
+
// reports the same events; the bridge skips its own attach when it sees the flag.
|
|
5
|
+
window.__base44_bundled_dev__ = true;
|
|
6
|
+
if (import.meta.hot && window.self !== window.top) {
|
|
7
|
+
const previewFEVersion = Number(new URLSearchParams(window.location.search).get("previewFE_version")) || 0;
|
|
8
|
+
import.meta.hot.on("vite:ws:connect", () => {
|
|
9
|
+
window.parent?.postMessage({ type: "SANDBOX_WS_CONNECT" }, "*");
|
|
12
10
|
});
|
|
13
|
-
hot.on("vite:ws:disconnect", () => {
|
|
14
|
-
|
|
11
|
+
import.meta.hot.on("vite:ws:disconnect", () => {
|
|
12
|
+
window.parent?.postMessage({ type: "SANDBOX_WS_DISCONNECT" }, "*");
|
|
15
13
|
});
|
|
16
|
-
// Vite
|
|
17
|
-
//
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
14
|
+
// Vite awaits these listeners before reloading; a pending promise lets the
|
|
15
|
+
// editor swap in a fresh iframe instead of reloading in place.
|
|
16
|
+
import.meta.hot.on("vite:beforeFullReload", () => {
|
|
17
|
+
window.parent?.postMessage({ type: "sandbox:beforeFullReload" }, "*");
|
|
18
|
+
if (previewFEVersion > 0)
|
|
19
|
+
return new Promise(() => { });
|
|
20
|
+
return undefined;
|
|
22
21
|
});
|
|
23
22
|
}
|
|
24
|
-
|
|
25
|
-
// listeners above are always registered before the first connect event.
|
|
26
|
-
if (import.meta.hot)
|
|
27
|
-
attachHmrSocketRelay(import.meta.hot);
|
|
23
|
+
export {};
|
|
28
24
|
//# sourceMappingURL=sandbox-hmr-socket-relay.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sandbox-hmr-socket-relay.js","sourceRoot":"","sources":["../../src/injections/sandbox-hmr-socket-relay.ts"],"names":[],"mappings":"AAAA,qCAAqC;
|
|
1
|
+
{"version":3,"file":"sandbox-hmr-socket-relay.js","sourceRoot":"","sources":["../../src/injections/sandbox-hmr-socket-relay.ts"],"names":[],"mappings":"AAAA,qCAAqC;AAErC,gFAAgF;AAChF,iFAAiF;AACjF,kFAAkF;AACjF,MAA6C,CAAC,sBAAsB,GAAG,IAAI,CAAC;AAE7E,IAAI,MAAM,CAAC,IAAI,CAAC,GAAG,IAAI,MAAM,CAAC,IAAI,KAAK,MAAM,CAAC,GAAG,EAAE,CAAC;IAClD,MAAM,gBAAgB,GACpB,MAAM,CAAC,IAAI,eAAe,CAAC,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,mBAAmB,CAAC,CAAC,IAAI,CAAC,CAAC;IACpF,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,iBAAiB,EAAE,GAAG,EAAE;QACzC,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,EAAE,IAAI,EAAE,oBAAoB,EAAE,EAAE,GAAG,CAAC,CAAC;IAClE,CAAC,CAAC,CAAC;IACH,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,oBAAoB,EAAE,GAAG,EAAE;QAC5C,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,EAAE,IAAI,EAAE,uBAAuB,EAAE,EAAE,GAAG,CAAC,CAAC;IACrE,CAAC,CAAC,CAAC;IACH,2EAA2E;IAC3E,+DAA+D;IAC/D,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,uBAAuB,EAAE,GAAG,EAAE;QAC/C,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,EAAE,IAAI,EAAE,0BAA0B,EAAE,EAAE,GAAG,CAAC,CAAC;QACtE,IAAI,gBAAgB,GAAG,CAAC;YAAE,OAAO,IAAI,OAAO,CAAO,GAAG,EAAE,GAAE,CAAC,CAAC,CAAC;QAC7D,OAAO,SAAS,CAAC;IACnB,CAAC,CAAC,CAAC;AACL,CAAC;AAED,OAAO,EAAE,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Connect,
|
|
1
|
+
import type { Connect, Plugin, ViteDevServer } from "vite";
|
|
2
2
|
import type { ServerResponse } from "http";
|
|
3
3
|
import { isBundledDev } from "./bundled-dev.js";
|
|
4
4
|
|
|
@@ -37,18 +37,6 @@ const MAX_FRAME = 2000;
|
|
|
37
37
|
|
|
38
38
|
type SendChannel = { send: (...args: unknown[]) => void };
|
|
39
39
|
|
|
40
|
-
const PATCHED = Symbol.for("base44.buildStatus.loggerPatched");
|
|
41
|
-
type PatchableLogger = Omit<Logger, "error"> & {
|
|
42
|
-
error: Logger["error"] & { [PATCHED]?: boolean };
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
// Plugin hooks run once per environment in bundled dev; only the client's
|
|
46
|
-
// build is the preview. Older Vite has no `this.environment`.
|
|
47
|
-
function isClientEnvironment(ctx: unknown): boolean {
|
|
48
|
-
const name = (ctx as { environment?: { name?: string } } | undefined)?.environment?.name;
|
|
49
|
-
return name === undefined || name === "client";
|
|
50
|
-
}
|
|
51
|
-
|
|
52
40
|
const LOOPBACK_ADDRESSES = new Set([
|
|
53
41
|
"127.0.0.1",
|
|
54
42
|
"::1",
|
|
@@ -143,32 +131,26 @@ export function buildStatusPlugin(): Plugin {
|
|
|
143
131
|
configResolved(config) {
|
|
144
132
|
bundled = isBundledDev(config);
|
|
145
133
|
},
|
|
146
|
-
// Bundled dev runs the rolldown build hooks on every rebuild
|
|
147
|
-
//
|
|
148
|
-
// was recorded before. Other environments' builds say nothing about the preview.
|
|
134
|
+
// Bundled dev runs the rolldown build hooks on every rebuild; a build that
|
|
135
|
+
// reaches generateBundle superseded whatever error was recorded before.
|
|
149
136
|
buildEnd(error) {
|
|
150
|
-
if (bundled && error
|
|
137
|
+
if (bundled && error) lastError = error;
|
|
151
138
|
},
|
|
152
139
|
generateBundle() {
|
|
153
|
-
if (bundled
|
|
140
|
+
if (bundled) lastError = null;
|
|
154
141
|
},
|
|
155
142
|
configureServer(server: ViteDevServer) {
|
|
156
143
|
try {
|
|
157
144
|
if (bundled) {
|
|
158
145
|
// Bundled dev reports build failures through the environment logger
|
|
159
146
|
// (`{ error }` option) and per-client sends, never the broadcast
|
|
160
|
-
// channel patched below.
|
|
161
|
-
|
|
162
|
-
const
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
return origError(msg, options);
|
|
168
|
-
};
|
|
169
|
-
patched[PATCHED] = true;
|
|
170
|
-
logger.error = patched;
|
|
171
|
-
}
|
|
147
|
+
// channel patched below.
|
|
148
|
+
const logger = server.environments.client.logger;
|
|
149
|
+
const origError = logger.error.bind(logger);
|
|
150
|
+
logger.error = (msg, options) => {
|
|
151
|
+
if (options?.error) lastError = options.error;
|
|
152
|
+
return origError(msg, options);
|
|
153
|
+
};
|
|
172
154
|
}
|
|
173
155
|
// Observe the HMR channel: an `error` payload records the last
|
|
174
156
|
// error; a successful `update` / `full-reload` clears it.
|
package/src/bundled-dev.ts
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { createReadStream, existsSync, statSync } from "node:fs";
|
|
2
2
|
import path from "node:path";
|
|
3
3
|
import { fileURLToPath } from "node:url";
|
|
4
|
-
import type {
|
|
5
|
-
import type { Connect, Plugin, HtmlTagDescriptor, ViteDevServer } from "vite";
|
|
4
|
+
import type { Plugin, HtmlTagDescriptor, ViteDevServer } from "vite";
|
|
6
5
|
import { loadEnv } from "vite";
|
|
7
6
|
import { isBundledDev } from "./bundled-dev.js";
|
|
8
7
|
|
|
@@ -107,16 +106,14 @@ export const PLUGIN_DIST_DIR = path.dirname(fileURLToPath(import.meta.url));
|
|
|
107
106
|
* fallback and receive index.html. Serve the plugin's own dist tree instead.
|
|
108
107
|
*/
|
|
109
108
|
export function serveDistMiddleware(distDir: string) {
|
|
110
|
-
return (
|
|
109
|
+
return (
|
|
110
|
+
req: { url?: string | undefined },
|
|
111
|
+
res: { statusCode: number; setHeader: (k: string, v: string) => void; end: (b?: string) => void },
|
|
112
|
+
next: (err?: unknown) => void
|
|
113
|
+
) => {
|
|
111
114
|
const url = (req.url ?? "").split("?")[0] ?? "";
|
|
112
115
|
if (!url.startsWith(`${DIST_URL_PREFIX}/`)) return next();
|
|
113
|
-
|
|
114
|
-
let relative: string;
|
|
115
|
-
try {
|
|
116
|
-
relative = decodeURIComponent(url.slice(DIST_URL_PREFIX.length + 1));
|
|
117
|
-
} catch {
|
|
118
|
-
return next();
|
|
119
|
-
}
|
|
116
|
+
const relative = decodeURIComponent(url.slice(DIST_URL_PREFIX.length + 1));
|
|
120
117
|
const filePath = path.resolve(distDir, relative);
|
|
121
118
|
const type = CONTENT_TYPES[path.extname(filePath)];
|
|
122
119
|
if (
|
|
@@ -130,8 +127,7 @@ export function serveDistMiddleware(distDir: string) {
|
|
|
130
127
|
res.statusCode = 200;
|
|
131
128
|
res.setHeader("Content-Type", type);
|
|
132
129
|
res.setHeader("Cache-Control", "no-store");
|
|
133
|
-
|
|
134
|
-
createReadStream(filePath).on("error", () => res.end()).pipe(res);
|
|
130
|
+
createReadStream(filePath).pipe(res as unknown as NodeJS.WritableStream);
|
|
135
131
|
};
|
|
136
132
|
}
|
|
137
133
|
|
|
@@ -3,34 +3,31 @@
|
|
|
3
3
|
// Bundled dev mode keeps Vite's own client, so the ErrorOverlay swap in
|
|
4
4
|
// error-overlay-plugin never runs. The overlay is disabled server-side instead
|
|
5
5
|
// and build errors are forwarded here in the same `app_error` shape.
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
.
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
stack,
|
|
6
|
+
if (import.meta.hot) {
|
|
7
|
+
import.meta.hot.on("vite:error", (payload: { err?: Record<string, unknown> }) => {
|
|
8
|
+
const err = payload?.err ?? {};
|
|
9
|
+
const message = typeof err.message === "string" ? err.message : "Build error";
|
|
10
|
+
const stack = typeof err.stack === "string" ? err.stack : undefined;
|
|
11
|
+
const loc = err.loc as { file?: string; line?: number; column?: number } | undefined;
|
|
12
|
+
const file = loc?.file ?? (typeof err.id === "string" ? err.id : undefined);
|
|
13
|
+
const where = file && loc?.line != null ? `${file}:${loc.line}:${loc.column ?? 0}` : file;
|
|
14
|
+
const details = [where, typeof err.frame === "string" ? err.frame : undefined, stack]
|
|
15
|
+
.filter(Boolean)
|
|
16
|
+
.join("\n");
|
|
17
|
+
window.parent?.postMessage(
|
|
18
|
+
{
|
|
19
|
+
type: "app_error",
|
|
20
|
+
error: {
|
|
21
|
+
title: message,
|
|
22
|
+
details: details || undefined,
|
|
23
|
+
componentName: undefined,
|
|
24
|
+
originalError: { message, stack, plugin: err.plugin, id: err.id, loc },
|
|
25
|
+
stack,
|
|
26
|
+
},
|
|
28
27
|
},
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
);
|
|
28
|
+
"*"
|
|
29
|
+
);
|
|
30
|
+
});
|
|
32
31
|
}
|
|
33
32
|
|
|
34
|
-
|
|
35
|
-
import.meta.hot.on("vite:error", (payload) => reportBuildError(payload as BuildErrorPayload));
|
|
36
|
-
}
|
|
33
|
+
export {};
|
|
@@ -3,35 +3,24 @@
|
|
|
3
3
|
// The preview proxy's bridge watches the HMR socket by importing /@vite/client,
|
|
4
4
|
// which bundled dev mode does not serve. This module ships inside the bundle and
|
|
5
5
|
// reports the same events; the bridge skips its own attach when it sees the flag.
|
|
6
|
+
(window as unknown as Record<string, unknown>).__base44_bundled_dev__ = true;
|
|
6
7
|
|
|
7
|
-
|
|
8
|
-
on: (event: string, cb: (payload?: unknown) => unknown) => void;
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
// Query param the editor adds to the preview URL when it can swap in a fresh
|
|
12
|
-
// iframe on a full reload (mirrors builder_bridge_inject.py in base44-dev/apper).
|
|
13
|
-
export const PREVIEW_FE_VERSION_PARAM = "previewFE_version";
|
|
14
|
-
|
|
15
|
-
export function attachHmrSocketRelay(hot: HotEvents, win: Window = window) {
|
|
16
|
-
(win as unknown as Record<string, unknown>).__base44_bundled_dev__ = true;
|
|
17
|
-
if (win.self === win.top) return;
|
|
8
|
+
if (import.meta.hot && window.self !== window.top) {
|
|
18
9
|
const previewFEVersion =
|
|
19
|
-
Number(new URLSearchParams(
|
|
20
|
-
hot.on("vite:ws:connect", () => {
|
|
21
|
-
|
|
10
|
+
Number(new URLSearchParams(window.location.search).get("previewFE_version")) || 0;
|
|
11
|
+
import.meta.hot.on("vite:ws:connect", () => {
|
|
12
|
+
window.parent?.postMessage({ type: "SANDBOX_WS_CONNECT" }, "*");
|
|
22
13
|
});
|
|
23
|
-
hot.on("vite:ws:disconnect", () => {
|
|
24
|
-
|
|
14
|
+
import.meta.hot.on("vite:ws:disconnect", () => {
|
|
15
|
+
window.parent?.postMessage({ type: "SANDBOX_WS_DISCONNECT" }, "*");
|
|
25
16
|
});
|
|
26
|
-
// Vite
|
|
27
|
-
//
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
return
|
|
17
|
+
// Vite awaits these listeners before reloading; a pending promise lets the
|
|
18
|
+
// editor swap in a fresh iframe instead of reloading in place.
|
|
19
|
+
import.meta.hot.on("vite:beforeFullReload", () => {
|
|
20
|
+
window.parent?.postMessage({ type: "sandbox:beforeFullReload" }, "*");
|
|
21
|
+
if (previewFEVersion > 0) return new Promise<void>(() => {});
|
|
22
|
+
return undefined;
|
|
32
23
|
});
|
|
33
24
|
}
|
|
34
25
|
|
|
35
|
-
|
|
36
|
-
// listeners above are always registered before the first connect event.
|
|
37
|
-
if (import.meta.hot) attachHmrSocketRelay(import.meta.hot);
|
|
26
|
+
export {};
|