@ape-egg/vibe 1.8.0 → 1.9.0
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/CHANGELOG.md +88 -0
- package/README.md +28 -0
- package/boot.js +5 -1
- package/compiler/native/vibe-compiler-darwin-arm64 +0 -0
- package/compiler/native/vibe-compiler-linux-x64 +0 -0
- package/compiler/src/parser/html.rs +15 -15
- package/index.js +15 -0
- package/package.json +2 -2
- package/runtime/_vibe-compiled-iteration-batch.js +18 -9
- package/runtime/affected.js +36 -16
- package/runtime/component.js +154 -45
- package/runtime/conditionals.js +12 -1
- package/runtime/constants.js +5 -3
- package/runtime/index.js +77 -33
- package/runtime/iterate.js +270 -108
- package/runtime/manifest.js +2 -1
- package/runtime/parse.js +66 -80
- package/runtime/pre-compiled-manifest.js +38 -13
- package/runtime/reconcile.js +621 -0
- package/runtime/state.js +5 -2
- package/runtime/utils.js +74 -1
- package/vibe.css +3 -1
|
@@ -134,6 +134,14 @@ const detectHyperspeed = async () => {
|
|
|
134
134
|
if (hyperspeedDetectionAttempted) return hyperspeedData;
|
|
135
135
|
hyperspeedDetectionAttempted = true;
|
|
136
136
|
|
|
137
|
+
// Runtime-mode pages still have [vibe-fouc] / .vibe-fouc on their vibe root
|
|
138
|
+
// at this point — the compiler strips it at build time, and the runtime only
|
|
139
|
+
// clears it after hydration (PHASE_READY). Vibe can latch to any element, so
|
|
140
|
+
// search the whole document. If any fouc marker is still here, we're in
|
|
141
|
+
// runtime mode and no hyperspeed manifest will exist — skip the network
|
|
142
|
+
// fetches and avoid the 404 devtools noise.
|
|
143
|
+
const skipNetwork = !!document.querySelector("[vibe-fouc], .vibe-fouc");
|
|
144
|
+
|
|
137
145
|
try {
|
|
138
146
|
let pagePath = window.location.pathname;
|
|
139
147
|
|
|
@@ -185,21 +193,38 @@ const detectHyperspeed = async () => {
|
|
|
185
193
|
);
|
|
186
194
|
}
|
|
187
195
|
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
196
|
+
if (!skipNetwork) {
|
|
197
|
+
// Fully-runtime dynamic import. Hidden behind `new Function` so any
|
|
198
|
+
// bundler's static-analysis can't read into it — there's nothing we
|
|
199
|
+
// could or should tell it about these manifest paths, which are decided
|
|
200
|
+
// at runtime by searching a list.
|
|
201
|
+
const dynamicImport = new Function('p', 'return import(p)');
|
|
202
|
+
// Try each possible path
|
|
203
|
+
for (const manifestPath of possiblePaths) {
|
|
204
|
+
try {
|
|
205
|
+
const module = await dynamicImport(manifestPath);
|
|
206
|
+
hyperspeedData = {
|
|
207
|
+
manifest: module.default,
|
|
208
|
+
path: manifestPath,
|
|
209
|
+
};
|
|
210
|
+
return hyperspeedData;
|
|
211
|
+
} catch (e) {
|
|
212
|
+
// Try next path
|
|
213
|
+
continue;
|
|
214
|
+
}
|
|
200
215
|
}
|
|
201
216
|
}
|
|
202
217
|
|
|
218
|
+
// When skipping network, yield a macrotask so module-graph timing matches
|
|
219
|
+
// the old behavior where `await import()` on a missing manifest resolved
|
|
220
|
+
// via a network 404 (macrotask), not a microtask. Without this yield, the
|
|
221
|
+
// vibe module-graph resolves too fast and the post-boot microtask fires
|
|
222
|
+
// before sibling `<script type="module">` tags (e.g. component scripts)
|
|
223
|
+
// have had a chance to register their state.
|
|
224
|
+
if (skipNetwork) {
|
|
225
|
+
await new Promise((resolve) => setTimeout(resolve, 0));
|
|
226
|
+
}
|
|
227
|
+
|
|
203
228
|
// No manifest found
|
|
204
229
|
return null;
|
|
205
230
|
} catch {
|
|
@@ -468,7 +493,7 @@ export const restoreMarkersFromManifest = (
|
|
|
468
493
|
if (text.startsWith("if")) {
|
|
469
494
|
if (!startComment) {
|
|
470
495
|
const expression = childTree.meta?.expression;
|
|
471
|
-
const expectedText = expression ?
|
|
496
|
+
const expectedText = expression ? "if " + expression : null;
|
|
472
497
|
if (expectedText && text === expectedText) {
|
|
473
498
|
startComment = comment;
|
|
474
499
|
conditionalDepth = 1;
|