@base44-preview/vite-plugin 1.0.44-pr.131.04821df → 1.0.44-pr.131.133cb56
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.
|
@@ -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,IAoFzB,MAAM,CACZ"}
|
|
@@ -16,7 +16,6 @@ export function visualEditPlugin() {
|
|
|
16
16
|
// code that doesn't exist on disk.
|
|
17
17
|
apply: (config, env) => env.command === "serve" && config.mode === "development",
|
|
18
18
|
enforce: "pre",
|
|
19
|
-
order: "pre",
|
|
20
19
|
transformIndexHtml(html) {
|
|
21
20
|
const tailwindScript = ` <!-- Tailwind CSS CDN for visual editing -->\n <script src="${TAILWIND_CDN_SRC}"></script>\n `;
|
|
22
21
|
return html.replace("</head>", tailwindScript + "</head>");
|
|
@@ -25,11 +24,16 @@ export function visualEditPlugin() {
|
|
|
25
24
|
if (id.includes("node_modules") || id.includes("visual-edit-agent")) {
|
|
26
25
|
return null;
|
|
27
26
|
}
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
const [idPath, idQuery] = id.split("?");
|
|
31
|
-
if (!/\.(jsx?|tsx?)$/.test(idPath) || (idQuery && !/tsr-(split|shared)/.test(idQuery))) {
|
|
27
|
+
const [idPath = "", idQuery] = id.split("?");
|
|
28
|
+
if (!/\.(jsx?|tsx?)$/.test(idPath))
|
|
32
29
|
return null;
|
|
30
|
+
// TanStack Router serves route components as `route.jsx?tsr-split=...` modules; other
|
|
31
|
+
// queries (?raw, ?url, ?worker) must not be transformed. Tag lines stay real only while
|
|
32
|
+
// base44() precedes tanstackStart() in vite.config, so this runs before the splitter.
|
|
33
|
+
if (idQuery) {
|
|
34
|
+
const params = new URLSearchParams(idQuery);
|
|
35
|
+
if (!params.has("tsr-split") && !params.has("tsr-shared"))
|
|
36
|
+
return null;
|
|
33
37
|
}
|
|
34
38
|
const filename = extractFilename(id);
|
|
35
39
|
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,CAAC;AACtD,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,KAAK,CAAC,MAAM,cAAc,CAAC;AAElC,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAE/C,MAAM,UAAU,gBAAgB;IAC9B,OAAO;QACL,IAAI,EAAE,uBAAuB;QAC7B,mEAAmE;QACnE,sEAAsE;QACtE,oEAAoE;QACpE,sEAAsE;QACtE,oEAAoE;QACpE,mCAAmC;QACnC,KAAK,EAAE,CAAC,MAAkB,EAAE,GAAc,EAAE,EAAE,CAC5C,GAAG,CAAC,OAAO,KAAK,OAAO,IAAI,MAAM,CAAC,IAAI,KAAK,aAAa;QAC1D,OAAO,EAAE,KAAK;QACd,
|
|
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,O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M,CAAC,IAAI;oBACjB,GAAG,EAAE,IAAI;iBACV,CAAC;YACJ,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,OAAO,CAAC,KAAK,CAAC,uCAAuC,EAAE,KAAK,CAAC,CAAC;gBAC9D,OAAO;oBACL,IAAI,EAAE,IAAI;oBACV,GAAG,EAAE,IAAI;iBACV,CAAC;YACJ,CAAC;QACH,CAAC;KACQ,CAAC;AACd,CAAC;AAED,uFAAuF;AACvF,qFAAqF;AACrF,8EAA8E;AAC9E,SAAS,eAAe,CAAC,EAAU;IACjC,uEAAuE;IACvE,MAAM,OAAO,GAAG,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAE,CAAC,OAAO,CAAC,KAAK,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
|
@@ -30,7 +30,8 @@ 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` |
|
|
33
|
+
| File is `.js`, `.jsx`, `.ts`, or `.tsx` | `/\.(jsx?\|tsx?)$/.test(idPath)` | Only JSX-capable files |
|
|
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 |
|
|
34
35
|
| File is NOT in `node_modules` | `id.includes("node_modules")` | Skip third-party code |
|
|
35
36
|
| File is NOT `visual-edit-agent` | `id.includes("visual-edit-agent")` | Don't instrument the agent itself |
|
|
36
37
|
|
|
@@ -57,8 +58,8 @@ It adds two HTML `data-*` attributes to every JSX element:
|
|
|
57
58
|
|
|
58
59
|
### Plugin Ordering
|
|
59
60
|
|
|
60
|
-
- `enforce: "pre"`
|
|
61
|
-
-
|
|
61
|
+
- `enforce: "pre"` runs this before all `normal`/`post` transforms. Among other `enforce: "pre"` plugins, array position in `vite.config` decides, so `base44()` must be listed before `tanstackStart()`: TanStack's code splitter is also `pre`, and tagging its output would point `data-source-location` at the wrong lines
|
|
62
|
+
- It also relies on Vite loading a queried id (`route.jsx?tsr-split=component`) from disk, so the split module's transform input is the original file, not the splitter's output. Both ids then tag identically, which keeps SSR and client hydration in agreement. Tags must come from raw JSX: tagging a rewritten file points `data-source-location` at generated lines
|
|
62
63
|
|
|
63
64
|
---
|
|
64
65
|
|
|
@@ -19,7 +19,6 @@ export function visualEditPlugin() {
|
|
|
19
19
|
apply: (config: UserConfig, env: ConfigEnv) =>
|
|
20
20
|
env.command === "serve" && config.mode === "development",
|
|
21
21
|
enforce: "pre",
|
|
22
|
-
order: "pre",
|
|
23
22
|
transformIndexHtml(html: any) {
|
|
24
23
|
const tailwindScript = ` <!-- Tailwind CSS CDN for visual editing -->\n <script src="${TAILWIND_CDN_SRC}"></script>\n `;
|
|
25
24
|
return html.replace("</head>", tailwindScript + "</head>");
|
|
@@ -29,11 +28,14 @@ export function visualEditPlugin() {
|
|
|
29
28
|
return null;
|
|
30
29
|
}
|
|
31
30
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
31
|
+
const [idPath = "", idQuery] = id.split("?");
|
|
32
|
+
if (!/\.(jsx?|tsx?)$/.test(idPath)) return null;
|
|
33
|
+
// TanStack Router serves route components as `route.jsx?tsr-split=...` modules; other
|
|
34
|
+
// queries (?raw, ?url, ?worker) must not be transformed. Tag lines stay real only while
|
|
35
|
+
// base44() precedes tanstackStart() in vite.config, so this runs before the splitter.
|
|
36
|
+
if (idQuery) {
|
|
37
|
+
const params = new URLSearchParams(idQuery);
|
|
38
|
+
if (!params.has("tsr-split") && !params.has("tsr-shared")) return null;
|
|
37
39
|
}
|
|
38
40
|
|
|
39
41
|
const filename = extractFilename(id);
|