@base44-preview/vite-plugin 0.2.20-pr.27.45bb4b6 → 0.2.20-pr.27.bf4f26c
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/README.md +15 -12
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -44,25 +44,28 @@ The plugin registers four sub-plugins when running in a sandbox (`MODAL_SANDBOX_
|
|
|
44
44
|
1. **base44** — Core configuration: path aliases (`@/` → `/src/`), environment variables, dependency optimization, and legacy SDK import resolution.
|
|
45
45
|
2. **iframe-hmr** — Sets CORS and `frame-ancestors` headers to allow iframe embedding.
|
|
46
46
|
3. **error-overlay** — Replaces Vite's default error overlay with a custom one that reports errors to the parent window.
|
|
47
|
-
4. **html-injections** — Injects
|
|
47
|
+
4. **html-injections** — Injects sandbox-side scripts into the HTML.
|
|
48
48
|
|
|
49
49
|
Outside a sandbox, only the core plugin runs (with optional API proxy support via `VITE_BASE44_APP_BASE_URL`).
|
|
50
50
|
|
|
51
|
-
### Sandbox
|
|
51
|
+
### Sandbox Injections
|
|
52
52
|
|
|
53
|
-
|
|
53
|
+
In **dev mode**, individual `<script type="module" src="...">` tags are injected for each feature, loaded directly from `node_modules`:
|
|
54
54
|
|
|
55
|
-
|
|
55
|
+
- **Error handlers** (`unhandled-errors-handlers.js`) — Global `error` and `unhandledrejection` listeners that report to the parent via `postMessage`.
|
|
56
|
+
- **Mount observer** (`sandbox-mount-observer.js`) — `MutationObserver` that detects when instrumented elements (`data-source-location`) are rendered.
|
|
57
|
+
- **HMR notifier** (`sandbox-hmr-notifier.js`) — Forwards Vite's `beforeUpdate`/`afterUpdate` events to the parent.
|
|
58
|
+
- **Navigation notifier** (`navigation-notifier.js`) — Intercepts `pushState`, `replaceState`, and `popstate` to track URL changes.
|
|
56
59
|
|
|
57
|
-
-
|
|
58
|
-
- **Mount observer** — `MutationObserver` that detects when instrumented elements (`data-source-location`) are rendered.
|
|
59
|
-
- **HMR notifier** — Forwards Vite's `beforeUpdate`/`afterUpdate` events to the parent.
|
|
60
|
-
- **Navigation notifier** — Intercepts `pushState`, `replaceState`, and `popstate` to track URL changes.
|
|
61
|
-
- **Visual edit agent** — Overlay system for selecting and editing elements with source location awareness.
|
|
60
|
+
These are self-executing scripts — they run as soon as the browser loads them, with no setup call required.
|
|
62
61
|
|
|
63
|
-
|
|
62
|
+
The **visual edit agent** is the exception. It's a larger module (~560 lines) that is bundled separately via `tsup` into `dist/statics/index.mjs` and loaded via a dynamic `import()`. This allows local dev iteration: add `?sandbox-bridge=local` to load it from a local HTTPS dev server instead of `node_modules`.
|
|
64
63
|
|
|
65
|
-
|
|
64
|
+
In **production**, an inline analytics tracker script is injected instead.
|
|
65
|
+
|
|
66
|
+
### Local Development (Visual Edit Agent)
|
|
67
|
+
|
|
68
|
+
To iterate on the visual edit agent locally without publishing:
|
|
66
69
|
|
|
67
70
|
1. Generate local HTTPS certificates:
|
|
68
71
|
```bash
|
|
@@ -75,7 +78,7 @@ For developing the bridge itself, you can load it from a local dev server instea
|
|
|
75
78
|
npm run dev -- -w # same, with auto-rebuild on changes
|
|
76
79
|
```
|
|
77
80
|
|
|
78
|
-
3. Add `?sandbox-bridge=local` to your app's URL to load the
|
|
81
|
+
3. Add `?sandbox-bridge=local` to your app's URL to load the agent from `localhost:3201` instead of `node_modules`.
|
|
79
82
|
|
|
80
83
|
### Legacy SDK Compatibility
|
|
81
84
|
|