@base44-preview/vite-plugin 1.0.44-pr.131.fcc59a9 → 1.0.44-pr.132.10ceed3
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/base44-runtime-plugin.d.ts.map +1 -1
- package/dist/base44-runtime-plugin.js +29 -14
- package/dist/base44-runtime-plugin.js.map +1 -1
- package/dist/visual-edit-plugin.d.ts.map +1 -1
- package/dist/visual-edit-plugin.js +1 -9
- package/dist/visual-edit-plugin.js.map +1 -1
- package/package.json +1 -1
- package/src/base44-runtime-plugin.ts +27 -15
- package/src/visual-edit-plugin.md +1 -2
- package/src/visual-edit-plugin.ts +2 -8
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base44-runtime-plugin.d.ts","sourceRoot":"","sources":["../src/base44-runtime-plugin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"base44-runtime-plugin.d.ts","sourceRoot":"","sources":["../src/base44-runtime-plugin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAmFnC,wBAAgB,mBAAmB,IAAI,MAAM,CAyC5C"}
|
|
@@ -23,9 +23,6 @@
|
|
|
23
23
|
* public import. Without that wrapper (including local dev), TCP fails closed.
|
|
24
24
|
*/
|
|
25
25
|
const SPECIFIER = "base44:runtime";
|
|
26
|
-
// Rollup convention: a resolved virtual id starts with NUL so no other plugin
|
|
27
|
-
// (and no filesystem lookup) tries to claim it.
|
|
28
|
-
const RESOLVED = "\0base44:runtime";
|
|
29
26
|
// Reserved so a route importing it fails with an explanation instead of a bare
|
|
30
27
|
// "failed to resolve import". Actors are never imported — they live in the app's
|
|
31
28
|
// actors directory, in server routes exactly as in backend functions.
|
|
@@ -78,27 +75,45 @@ export const staticEgress = Object.freeze({
|
|
|
78
75
|
});
|
|
79
76
|
`;
|
|
80
77
|
export function base44RuntimePlugin() {
|
|
78
|
+
const importers = new Map();
|
|
81
79
|
return {
|
|
82
80
|
name: "base44-runtime",
|
|
83
81
|
// Ahead of Vite's own resolution so the bare `base44:` specifier is never
|
|
84
82
|
// mistaken for a URL protocol.
|
|
85
83
|
enforce: "pre",
|
|
86
|
-
resolveId
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
84
|
+
// Errors are raised in `load`, never `resolveId`: Vite's dep scanner resolves
|
|
85
|
+
// the raw source of server routes and server-fn handlers in the client
|
|
86
|
+
// environment, before TanStack strips them, and a throw there fails the scan
|
|
87
|
+
// so Vite skips pre-bundling. This relies on the scanner externalizing
|
|
88
|
+
// resolved virtual ids rather than loading them (true of the esbuild scan in
|
|
89
|
+
// Vite 7 and the Rolldown scan in Vite 8); re-check it on a bundler change.
|
|
90
|
+
resolveId(id, importer) {
|
|
91
|
+
if (id !== SPECIFIER && !unsupportedReason(id))
|
|
92
|
+
return null;
|
|
93
|
+
if (importer)
|
|
94
|
+
importers.set(`${this.environment?.name}:${id}`, importer);
|
|
95
|
+
// Rollup convention: a NUL-prefixed id is virtual, so no other plugin
|
|
96
|
+
// (and no filesystem lookup) tries to claim it.
|
|
97
|
+
return `\0${id}`;
|
|
98
|
+
},
|
|
99
|
+
load(id) {
|
|
100
|
+
if (!id.startsWith("\0"))
|
|
92
101
|
return null;
|
|
102
|
+
const specifier = id.slice(1);
|
|
103
|
+
if (specifier !== SPECIFIER && !unsupportedReason(specifier))
|
|
104
|
+
return null;
|
|
105
|
+
// The failing module is virtual, so name the file that imported it.
|
|
106
|
+
const importer = importers.get(`${this.environment?.name}:${specifier}`);
|
|
107
|
+
const from = importer ? ` Imported from ${importer}.` : "";
|
|
108
|
+
const reason = unsupportedReason(specifier);
|
|
109
|
+
if (reason)
|
|
110
|
+
this.error(`"${specifier}" is not available in server routes. ${reason}${from}`);
|
|
93
111
|
// `cloudflare:workers` has no browser equivalent, so a client-side import
|
|
94
112
|
// would bundle a module that cannot run. Fail with the reason instead.
|
|
95
113
|
if (this.environment?.name === "client") {
|
|
96
|
-
this.error(`"${SPECIFIER}" is server-only. Move this import into a server route
|
|
114
|
+
this.error(`"${SPECIFIER}" is server-only. Move this import into a server route.${from}`);
|
|
97
115
|
}
|
|
98
|
-
return
|
|
99
|
-
},
|
|
100
|
-
load(id) {
|
|
101
|
-
return id === RESOLVED ? RUNTIME_MODULE : null;
|
|
116
|
+
return RUNTIME_MODULE;
|
|
102
117
|
},
|
|
103
118
|
};
|
|
104
119
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base44-runtime-plugin.js","sourceRoot":"","sources":["../src/base44-runtime-plugin.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,MAAM,SAAS,GAAG,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"base44-runtime-plugin.js","sourceRoot":"","sources":["../src/base44-runtime-plugin.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,MAAM,SAAS,GAAG,gBAAgB,CAAC;AAEnC,+EAA+E;AAC/E,iFAAiF;AACjF,sEAAsE;AACtE,MAAM,aAAa,GACjB,8EAA8E,CAAC;AAEjF,SAAS,iBAAiB,CAAC,EAAU;IACnC,IAAI,EAAE,KAAK,uBAAuB;QAAE,OAAO,aAAa,CAAC;IACzD,OAAO,IAAI,CAAC;AACd,CAAC;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,cAAc,GAAG;;;;;;;;;;;;;;;;;;;;;;CAsBtB,CAAC;AAEF,MAAM,UAAU,mBAAmB;IACjC,MAAM,SAAS,GAAG,IAAI,GAAG,EAAkB,CAAC;IAC5C,OAAO;QACL,IAAI,EAAE,gBAAgB;QACtB,0EAA0E;QAC1E,+BAA+B;QAC/B,OAAO,EAAE,KAAK;QAEd,8EAA8E;QAC9E,uEAAuE;QACvE,6EAA6E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C;YACD,OAAO,cAAc,CAAC;QACxB,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"visual-edit-plugin.d.ts","sourceRoot":"","sources":["../src/visual-edit-plugin.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAa,MAAM,EAAc,MAAM,MAAM,CAAC;AAK1D,wBAAgB,gBAAgB,
|
|
1
|
+
{"version":3,"file":"visual-edit-plugin.d.ts","sourceRoot":"","sources":["../src/visual-edit-plugin.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAa,MAAM,EAAc,MAAM,MAAM,CAAC;AAK1D,wBAAgB,gBAAgB,IA+EzB,MAAM,CACZ"}
|
|
@@ -25,16 +25,8 @@ export function visualEditPlugin() {
|
|
|
25
25
|
if (id.includes("node_modules") || id.includes("visual-edit-agent")) {
|
|
26
26
|
return null;
|
|
27
27
|
}
|
|
28
|
-
|
|
29
|
-
if (!/\.(jsx?|tsx?)$/.test(idPath))
|
|
28
|
+
if (!id.match(/\.(jsx?|tsx?)$/)) {
|
|
30
29
|
return null;
|
|
31
|
-
// TanStack Router serves route components as `route.jsx?tsr-split=...` modules; other
|
|
32
|
-
// queries (?raw, ?url, ?worker) must not be transformed. Tag lines stay real only while
|
|
33
|
-
// base44() precedes tanstackStart() in vite.config, so this runs before the splitter.
|
|
34
|
-
if (idQuery) {
|
|
35
|
-
const params = new URLSearchParams(idQuery);
|
|
36
|
-
if (!params.has("tsr-split") && !params.has("tsr-shared"))
|
|
37
|
-
return null;
|
|
38
30
|
}
|
|
39
31
|
const filename = extractFilename(id);
|
|
40
32
|
try {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"visual-edit-plugin.js","sourceRoot":"","sources":["../src/visual-edit-plugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACtC,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,iBAAiB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AK,EAAE,GAAG,CAAC,CAAC;IACtD,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IACjC,6EAA6E;IAC7E,qFAAqF;IACrF,MAAM,QAAQ,GAAG,KAAK,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;IAC1C,IAAI,QAAQ,IAAI,CAAC,EAAE,CAAC;QAClB,OAAO,KAAK,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,iEAAiE;IAC3G,CAAC;IACD,0EAA0E;IAC1E,OAAO,KAAK,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC;AACvC,CAAC"}
|
package/package.json
CHANGED
|
@@ -26,9 +26,6 @@ import type { Plugin } from "vite";
|
|
|
26
26
|
*/
|
|
27
27
|
|
|
28
28
|
const SPECIFIER = "base44:runtime";
|
|
29
|
-
// Rollup convention: a resolved virtual id starts with NUL so no other plugin
|
|
30
|
-
// (and no filesystem lookup) tries to claim it.
|
|
31
|
-
const RESOLVED = "\0base44:runtime";
|
|
32
29
|
|
|
33
30
|
// Reserved so a route importing it fails with an explanation instead of a bare
|
|
34
31
|
// "failed to resolve import". Actors are never imported — they live in the app's
|
|
@@ -85,29 +82,44 @@ export const staticEgress = Object.freeze({
|
|
|
85
82
|
`;
|
|
86
83
|
|
|
87
84
|
export function base44RuntimePlugin(): Plugin {
|
|
85
|
+
const importers = new Map<string, string>();
|
|
88
86
|
return {
|
|
89
87
|
name: "base44-runtime",
|
|
90
88
|
// Ahead of Vite's own resolution so the bare `base44:` specifier is never
|
|
91
89
|
// mistaken for a URL protocol.
|
|
92
90
|
enforce: "pre",
|
|
93
91
|
|
|
94
|
-
resolveId
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
92
|
+
// Errors are raised in `load`, never `resolveId`: Vite's dep scanner resolves
|
|
93
|
+
// the raw source of server routes and server-fn handlers in the client
|
|
94
|
+
// environment, before TanStack strips them, and a throw there fails the scan
|
|
95
|
+
// so Vite skips pre-bundling. This relies on the scanner externalizing
|
|
96
|
+
// resolved virtual ids rather than loading them (true of the esbuild scan in
|
|
97
|
+
// Vite 7 and the Rolldown scan in Vite 8); re-check it on a bundler change.
|
|
98
|
+
resolveId(id, importer) {
|
|
99
|
+
if (id !== SPECIFIER && !unsupportedReason(id)) return null;
|
|
100
|
+
if (importer) importers.set(`${this.environment?.name}:${id}`, importer);
|
|
101
|
+
// Rollup convention: a NUL-prefixed id is virtual, so no other plugin
|
|
102
|
+
// (and no filesystem lookup) tries to claim it.
|
|
103
|
+
return `\0${id}`;
|
|
104
|
+
},
|
|
105
|
+
|
|
106
|
+
load(id) {
|
|
107
|
+
if (!id.startsWith("\0")) return null;
|
|
108
|
+
const specifier = id.slice(1);
|
|
109
|
+
if (specifier !== SPECIFIER && !unsupportedReason(specifier)) return null;
|
|
110
|
+
// The failing module is virtual, so name the file that imported it.
|
|
111
|
+
const importer = importers.get(`${this.environment?.name}:${specifier}`);
|
|
112
|
+
const from = importer ? ` Imported from ${importer}.` : "";
|
|
113
|
+
|
|
114
|
+
const reason = unsupportedReason(specifier);
|
|
115
|
+
if (reason) this.error(`"${specifier}" is not available in server routes. ${reason}${from}`);
|
|
100
116
|
|
|
101
117
|
// `cloudflare:workers` has no browser equivalent, so a client-side import
|
|
102
118
|
// would bundle a module that cannot run. Fail with the reason instead.
|
|
103
119
|
if (this.environment?.name === "client") {
|
|
104
|
-
this.error(`"${SPECIFIER}" is server-only. Move this import into a server route
|
|
120
|
+
this.error(`"${SPECIFIER}" is server-only. Move this import into a server route.${from}`);
|
|
105
121
|
}
|
|
106
|
-
return
|
|
107
|
-
},
|
|
108
|
-
|
|
109
|
-
load(id) {
|
|
110
|
-
return id === RESOLVED ? RUNTIME_MODULE : null;
|
|
122
|
+
return RUNTIME_MODULE;
|
|
111
123
|
},
|
|
112
124
|
};
|
|
113
125
|
}
|
|
@@ -30,8 +30,7 @@ It adds two HTML `data-*` attributes to every JSX element:
|
|
|
30
30
|
|-----------|-------|-----|
|
|
31
31
|
| `MODAL_SANDBOX_ID` env var is set | `index.ts:8` | Only runs inside Modal sandbox containers |
|
|
32
32
|
| Dev **server** in `"development"` mode | `apply: (config, env) => env.command === "serve" && config.mode === "development"` | The injected `data-*` markers are only consumed by the visual-edit agent in the live preview, which the dev server serves. Builds never use them — including `vite build --mode development` (the platform's validation build), where instrumenting user code once produced compile errors on code that wasn't on disk |
|
|
33
|
-
| File is `.js`, `.jsx`, `.ts`, or `.tsx` |
|
|
34
|
-
| No query, or a `tsr-split` / `tsr-shared` key | `URLSearchParams(idQuery).has(...)` | TanStack Router serves route components as `route.jsx?tsr-split=component`; other queries (`?raw`, `?url`, `?worker`) must not be transformed. Lines stay accurate only while `base44()` precedes `tanstackStart()` in `vite.config`, so this runs before the splitter rewrites the file |
|
|
33
|
+
| File is `.js`, `.jsx`, `.ts`, or `.tsx` | `id.match(/\.(jsx?\|tsx?)$/)` | Only JSX-capable files |
|
|
35
34
|
| File is NOT in `node_modules` | `id.includes("node_modules")` | Skip third-party code |
|
|
36
35
|
| File is NOT `visual-edit-agent` | `id.includes("visual-edit-agent")` | Don't instrument the agent itself |
|
|
37
36
|
|
|
@@ -29,14 +29,8 @@ export function visualEditPlugin() {
|
|
|
29
29
|
return null;
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
// TanStack Router serves route components as `route.jsx?tsr-split=...` modules; other
|
|
35
|
-
// queries (?raw, ?url, ?worker) must not be transformed. Tag lines stay real only while
|
|
36
|
-
// base44() precedes tanstackStart() in vite.config, so this runs before the splitter.
|
|
37
|
-
if (idQuery) {
|
|
38
|
-
const params = new URLSearchParams(idQuery);
|
|
39
|
-
if (!params.has("tsr-split") && !params.has("tsr-shared")) return null;
|
|
32
|
+
if (!id.match(/\.(jsx?|tsx?)$/)) {
|
|
33
|
+
return null;
|
|
40
34
|
}
|
|
41
35
|
|
|
42
36
|
const filename = extractFilename(id);
|