@absolutejs/absolute 0.20.0-beta.56 → 0.20.0-beta.57
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/angular/browser.js +1 -45
- package/dist/angular/browser.js.map +2 -2
- package/dist/angular/components/core/streamingSlotRegistrar.js +1 -1
- package/dist/angular/components/core/streamingSlotRegistry.js +2 -2
- package/dist/angular/index.js +1 -17
- package/dist/angular/index.js.map +2 -2
- package/dist/build.js +8 -2
- package/dist/build.js.map +3 -3
- package/dist/client/chunks/angularPatch-arh4sr68.js +157 -0
- package/dist/client/chunks/angularPatch-arh4sr68.js.map +10 -0
- package/dist/client/chunks/index-5py90ctf.js +87 -0
- package/dist/client/chunks/index-5py90ctf.js.map +10 -0
- package/dist/client/chunks/index-m35nbkdp.js +374 -0
- package/dist/client/chunks/index-m35nbkdp.js.map +12 -0
- package/dist/client/chunks/index-qxjc7kc5.js +12 -0
- package/dist/client/chunks/index-qxjc7kc5.js.map +9 -0
- package/dist/client/chunks/islands-xj2n8nwf.js +281 -0
- package/dist/client/chunks/islands-xj2n8nwf.js.map +14 -0
- package/dist/client/chunks/react-pdg4325x.js +65 -0
- package/dist/client/chunks/react-pdg4325x.js.map +10 -0
- package/dist/client/chunks/svelte-s0c964kb.js +19 -0
- package/dist/client/chunks/svelte-s0c964kb.js.map +10 -0
- package/dist/client/chunks/vue-rdskrnyg.js +24 -0
- package/dist/client/chunks/vue-rdskrnyg.js.map +10 -0
- package/dist/client/index.js +56 -947
- package/dist/client/index.js.map +7 -22
- package/dist/index.js +8 -2
- package/dist/index.js.map +3 -3
- package/dist/islands/browser.js +1 -17
- package/dist/islands/browser.js.map +2 -2
- package/dist/islands/index.js +1 -17
- package/dist/islands/index.js.map +2 -2
- package/dist/react/browser.js +1 -45
- package/dist/react/browser.js.map +2 -2
- package/dist/react/hooks/index.js +1 -17
- package/dist/react/hooks/index.js.map +2 -2
- package/dist/react/index.js +1 -17
- package/dist/react/index.js.map +2 -2
- package/dist/svelte/browser.js +1 -17
- package/dist/svelte/browser.js.map +2 -2
- package/dist/svelte/index.js +1 -17
- package/dist/svelte/index.js.map +2 -2
- package/dist/vue/browser.js +84 -121
- package/dist/vue/browser.js.map +4 -4
- package/dist/vue/index.js +84 -121
- package/dist/vue/index.js.map +4 -4
- package/package.json +9 -7
package/dist/client/index.js
CHANGED
|
@@ -1,69 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
return this[key];
|
|
9
|
-
}
|
|
10
|
-
var __toESMCache_node;
|
|
11
|
-
var __toESMCache_esm;
|
|
12
|
-
var __toESM = (mod, isNodeMode, target) => {
|
|
13
|
-
var canCache = mod != null && typeof mod === "object";
|
|
14
|
-
if (canCache) {
|
|
15
|
-
var cache = isNodeMode ? __toESMCache_node ??= new WeakMap : __toESMCache_esm ??= new WeakMap;
|
|
16
|
-
var cached = cache.get(mod);
|
|
17
|
-
if (cached)
|
|
18
|
-
return cached;
|
|
19
|
-
}
|
|
20
|
-
target = mod != null ? __create(__getProtoOf(mod)) : {};
|
|
21
|
-
const to = isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target;
|
|
22
|
-
if (mod && typeof mod === "object" || typeof mod === "function") {
|
|
23
|
-
for (let key of __getOwnPropNames(mod))
|
|
24
|
-
if (!__hasOwnProp.call(to, key))
|
|
25
|
-
__defProp(to, key, {
|
|
26
|
-
get: __accessProp.bind(mod, key),
|
|
27
|
-
enumerable: true
|
|
28
|
-
});
|
|
29
|
-
}
|
|
30
|
-
if (canCache)
|
|
31
|
-
cache.set(mod, to);
|
|
32
|
-
return to;
|
|
33
|
-
};
|
|
34
|
-
var __commonJS = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
|
|
35
|
-
var __returnValue = (v) => v;
|
|
36
|
-
function __exportSetter(name, newValue) {
|
|
37
|
-
this[name] = __returnValue.bind(null, newValue);
|
|
38
|
-
}
|
|
39
|
-
var __export = (target, all) => {
|
|
40
|
-
for (var name in all)
|
|
41
|
-
__defProp(target, name, {
|
|
42
|
-
get: all[name],
|
|
43
|
-
enumerable: true,
|
|
44
|
-
configurable: true,
|
|
45
|
-
set: __exportSetter.bind(all, name)
|
|
46
|
-
});
|
|
47
|
-
};
|
|
48
|
-
var __legacyDecorateClassTS = function(decorators, target, key, desc) {
|
|
49
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
50
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
51
|
-
r = Reflect.decorate(decorators, target, key, desc);
|
|
52
|
-
else
|
|
53
|
-
for (var i = decorators.length - 1;i >= 0; i--)
|
|
54
|
-
if (d = decorators[i])
|
|
55
|
-
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
56
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
57
|
-
};
|
|
58
|
-
var __legacyMetadataTS = (k, v) => {
|
|
59
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
|
60
|
-
return Reflect.metadata(k, v);
|
|
61
|
-
};
|
|
62
|
-
var __esm = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
|
|
63
|
-
var __require = import.meta.require;
|
|
1
|
+
import {
|
|
2
|
+
captureSsrTextBaselines,
|
|
3
|
+
prepareBrowserTranslationHydration
|
|
4
|
+
} from "./chunks/index-5py90ctf.js";
|
|
5
|
+
import {
|
|
6
|
+
__require
|
|
7
|
+
} from "./chunks/index-qxjc7kc5.js";
|
|
64
8
|
|
|
65
9
|
// src/core/islandManifest.ts
|
|
66
|
-
var toIslandFrameworkSegment = (framework) => framework[0]?.toUpperCase() + framework.slice(1)
|
|
10
|
+
var toIslandFrameworkSegment = (framework) => framework[0]?.toUpperCase() + framework.slice(1);
|
|
11
|
+
var collectFrameworkIslands = (manifest, prefix) => {
|
|
67
12
|
const entries = {};
|
|
68
13
|
let found = false;
|
|
69
14
|
for (const [key, value] of Object.entries(manifest)) {
|
|
@@ -76,7 +21,8 @@ var toIslandFrameworkSegment = (framework) => framework[0]?.toUpperCase() + fram
|
|
|
76
21
|
found = true;
|
|
77
22
|
}
|
|
78
23
|
return found ? entries : undefined;
|
|
79
|
-
}
|
|
24
|
+
};
|
|
25
|
+
var getIslandManifestEntries = (manifest) => {
|
|
80
26
|
const islands = {};
|
|
81
27
|
const frameworks = ["react", "svelte", "vue", "angular"];
|
|
82
28
|
for (const framework of frameworks) {
|
|
@@ -86,8 +32,20 @@ var toIslandFrameworkSegment = (framework) => framework[0]?.toUpperCase() + fram
|
|
|
86
32
|
islands[framework] = entries;
|
|
87
33
|
}
|
|
88
34
|
return islands;
|
|
89
|
-
}
|
|
35
|
+
};
|
|
36
|
+
var getIslandManifestKey = (framework, component) => `Island${toIslandFrameworkSegment(framework)}${component}`;
|
|
90
37
|
|
|
38
|
+
// src/client/islandResolver.ts
|
|
39
|
+
var createIslandManifestResolver = (manifest) => {
|
|
40
|
+
const islandManifest = getIslandManifestEntries(manifest);
|
|
41
|
+
return async (framework, component) => {
|
|
42
|
+
const modulePath = islandManifest[framework]?.[component] ?? manifest[getIslandManifestKey(framework, component)];
|
|
43
|
+
if (!modulePath)
|
|
44
|
+
return;
|
|
45
|
+
const loadedModule = await import(modulePath);
|
|
46
|
+
return loadedModule.default;
|
|
47
|
+
};
|
|
48
|
+
};
|
|
91
49
|
// src/client/streamSwap.ts
|
|
92
50
|
var streamSwapRuntime = () => {
|
|
93
51
|
const absoluteWindow = window;
|
|
@@ -189,834 +147,15 @@ var streamSwapRuntime = () => {
|
|
|
189
147
|
document.addEventListener("DOMContentLoaded", flush, { once: true });
|
|
190
148
|
}
|
|
191
149
|
flush();
|
|
192
|
-
}
|
|
150
|
+
};
|
|
151
|
+
var stripFunctionWrapper = (value) => {
|
|
193
152
|
const start = value.indexOf("{");
|
|
194
153
|
const end = value.lastIndexOf("}");
|
|
195
154
|
if (start < 0 || end <= start)
|
|
196
155
|
return "";
|
|
197
156
|
return value.slice(start + 1, end);
|
|
198
|
-
}, getStreamSwapRuntimeScript = () => `(function(){${stripFunctionWrapper(streamSwapRuntime.toString())}})();`;
|
|
199
|
-
|
|
200
|
-
// src/core/islands.ts
|
|
201
|
-
function getIslandComponent(component) {
|
|
202
|
-
if (isIslandComponentDefinition(component)) {
|
|
203
|
-
return component.component;
|
|
204
|
-
}
|
|
205
|
-
return component;
|
|
206
|
-
}
|
|
207
|
-
var defineIslandComponent = (component, options) => ({
|
|
208
|
-
component,
|
|
209
|
-
export: options.export,
|
|
210
|
-
source: options.source
|
|
211
|
-
}), defineIslandRegistry = (registry) => registry, isRecord = (value) => typeof value === "object" && value !== null, getIslandBuildReference = (component) => {
|
|
212
|
-
if (!isIslandComponentDefinition(component))
|
|
213
|
-
return null;
|
|
214
|
-
return {
|
|
215
|
-
export: component.export,
|
|
216
|
-
source: component.source
|
|
217
|
-
};
|
|
218
|
-
}, isIslandComponentDefinition = (value) => isRecord(value) && ("component" in value) && ("source" in value) && typeof value.source === "string", parseIslandProps = (rawProps) => {
|
|
219
|
-
if (!rawProps)
|
|
220
|
-
return {};
|
|
221
|
-
return JSON.parse(rawProps);
|
|
222
|
-
}, serializeIslandProps = (props) => JSON.stringify(props ?? {});
|
|
223
|
-
var init_islands = () => {};
|
|
224
|
-
|
|
225
|
-
// src/core/islandMarkupAttributes.ts
|
|
226
|
-
var getIslandMarkerAttributes = (props, islandId) => ({
|
|
227
|
-
"data-component": props.component,
|
|
228
|
-
"data-framework": props.framework,
|
|
229
|
-
"data-hydrate": props.hydrate ?? "load",
|
|
230
|
-
"data-island": "true",
|
|
231
|
-
...islandId ? { "data-island-id": islandId } : {},
|
|
232
|
-
"data-props": serializeIslandProps(props.props)
|
|
233
|
-
}), escapeHtmlAttribute = (value) => value.replaceAll("&", "&").replaceAll('"', """).replaceAll("<", "<").replaceAll(">", ">"), serializeIslandAttributes = (attributes) => Object.entries(attributes).map(([key, value]) => `${key}="${escapeHtmlAttribute(value)}"`).join(" ");
|
|
234
|
-
var init_islandMarkupAttributes = __esm(() => {
|
|
235
|
-
init_islands();
|
|
236
|
-
});
|
|
237
|
-
|
|
238
|
-
// src/client/browserTranslation.ts
|
|
239
|
-
var translationRestorer = (restore, hasTranslation) => Object.assign(restore, { hasTranslation }), emptyTranslationRestorer = () => translationRestorer(() => {
|
|
240
|
-
return;
|
|
241
|
-
}, false), textNodeAt = (parent, index) => {
|
|
242
|
-
const node = parent.childNodes[index];
|
|
243
|
-
return node instanceof Text ? node : undefined;
|
|
244
|
-
}, visitElements = (root, visit) => {
|
|
245
|
-
visit(root);
|
|
246
|
-
for (const element of root.querySelectorAll("*"))
|
|
247
|
-
visit(element);
|
|
248
|
-
}, elementPath = (root, element) => {
|
|
249
|
-
const path = [];
|
|
250
|
-
let current = element;
|
|
251
|
-
while (current !== root) {
|
|
252
|
-
const parent = current.parentElement;
|
|
253
|
-
if (parent === null)
|
|
254
|
-
return null;
|
|
255
|
-
path.unshift([...parent.children].indexOf(current));
|
|
256
|
-
current = parent;
|
|
257
|
-
}
|
|
258
|
-
return path;
|
|
259
|
-
}, elementAtPath = (root, path) => {
|
|
260
|
-
let current = root;
|
|
261
|
-
for (const index of path) {
|
|
262
|
-
const child = current.children[index];
|
|
263
|
-
if (!(child instanceof Element))
|
|
264
|
-
return null;
|
|
265
|
-
current = child;
|
|
266
|
-
}
|
|
267
|
-
return current;
|
|
268
|
-
}, captureSsrTextBaselines = (root) => {
|
|
269
|
-
if (root === null || typeof window === "undefined")
|
|
270
|
-
return;
|
|
271
|
-
const baselines = window.__ABSOLUTE_SSR_TEXT_BASELINES__ ?? new WeakMap;
|
|
272
|
-
visitElements(root, (element) => {
|
|
273
|
-
const text = new Map;
|
|
274
|
-
for (const [index, node] of [...element.childNodes].entries()) {
|
|
275
|
-
if (node.nodeType === Node.TEXT_NODE)
|
|
276
|
-
text.set(index, node.nodeValue ?? "");
|
|
277
|
-
}
|
|
278
|
-
if (text.size > 0)
|
|
279
|
-
baselines.set(element, text);
|
|
280
|
-
});
|
|
281
|
-
window.__ABSOLUTE_SSR_TEXT_BASELINES__ = baselines;
|
|
282
|
-
}, prepareBrowserTranslationHydration = (root) => {
|
|
283
|
-
if (root === null || typeof window === "undefined")
|
|
284
|
-
return emptyTranslationRestorer();
|
|
285
|
-
const baselines = window.__ABSOLUTE_SSR_TEXT_BASELINES__;
|
|
286
|
-
if (baselines === undefined)
|
|
287
|
-
return emptyTranslationRestorer();
|
|
288
|
-
const translated = [];
|
|
289
|
-
visitElements(root, (element) => {
|
|
290
|
-
const text = baselines.get(element);
|
|
291
|
-
const path = elementPath(root, element);
|
|
292
|
-
if (text === undefined || path === null)
|
|
293
|
-
return;
|
|
294
|
-
for (const [index, baseline] of text) {
|
|
295
|
-
const node = textNodeAt(element, index);
|
|
296
|
-
if (node === undefined || node.data === baseline)
|
|
297
|
-
continue;
|
|
298
|
-
translated.push({ baseline, index, path, translated: node.data });
|
|
299
|
-
node.data = baseline;
|
|
300
|
-
}
|
|
301
|
-
});
|
|
302
|
-
return translationRestorer(() => {
|
|
303
|
-
for (const snapshot of translated) {
|
|
304
|
-
const parent = elementAtPath(root, snapshot.path);
|
|
305
|
-
if (parent === null)
|
|
306
|
-
continue;
|
|
307
|
-
const node = textNodeAt(parent, snapshot.index);
|
|
308
|
-
if (node !== undefined && node.data === snapshot.baseline)
|
|
309
|
-
node.data = snapshot.translated;
|
|
310
|
-
}
|
|
311
|
-
}, translated.length > 0);
|
|
312
|
-
};
|
|
313
|
-
|
|
314
|
-
// src/client/hydrators/react.ts
|
|
315
|
-
var exports_react = {};
|
|
316
|
-
__export(exports_react, {
|
|
317
|
-
hydrateReactIsland: () => hydrateReactIsland,
|
|
318
|
-
isReactComponent: () => isReactComponent
|
|
319
|
-
});
|
|
320
|
-
import { createElement } from "react";
|
|
321
|
-
import { hydrateRoot } from "react-dom/client";
|
|
322
|
-
import { flushSync } from "react-dom";
|
|
323
|
-
var reactIslandRoots, isPropsRecord = (value) => typeof value === "object" && value !== null, HOST_REACT_EXPANDO_PREFIXES, detachFromHostReactRoot = (element) => {
|
|
324
|
-
for (const key of Object.keys(element)) {
|
|
325
|
-
const isHostExpando = HOST_REACT_EXPANDO_PREFIXES.some((prefix) => key.startsWith(prefix));
|
|
326
|
-
if (!isHostExpando)
|
|
327
|
-
continue;
|
|
328
|
-
Reflect.deleteProperty(element, key);
|
|
329
|
-
}
|
|
330
|
-
}, hydrateReactIsland = (component, element, props) => {
|
|
331
|
-
const existingRoot = reactIslandRoots.get(element);
|
|
332
|
-
if (existingRoot) {
|
|
333
|
-
existingRoot.render(isPropsRecord(props) ? createElement(component, props) : createElement(component));
|
|
334
|
-
return;
|
|
335
|
-
}
|
|
336
|
-
detachFromHostReactRoot(element);
|
|
337
|
-
const restoreTranslation = prepareBrowserTranslationHydration(element);
|
|
338
|
-
const hydrate = (elementToHydrate) => {
|
|
339
|
-
let root;
|
|
340
|
-
const startHydration = () => {
|
|
341
|
-
root = hydrateRoot(element, elementToHydrate);
|
|
342
|
-
};
|
|
343
|
-
try {
|
|
344
|
-
if (restoreTranslation.hasTranslation)
|
|
345
|
-
flushSync(startHydration);
|
|
346
|
-
else
|
|
347
|
-
startHydration();
|
|
348
|
-
} finally {
|
|
349
|
-
restoreTranslation();
|
|
350
|
-
}
|
|
351
|
-
if (root !== undefined)
|
|
352
|
-
reactIslandRoots.set(element, root);
|
|
353
|
-
};
|
|
354
|
-
if (!isPropsRecord(props)) {
|
|
355
|
-
hydrate(createElement(component));
|
|
356
|
-
return;
|
|
357
|
-
}
|
|
358
|
-
hydrate(createElement(component, props));
|
|
359
|
-
}, isReactComponent = (value) => typeof value === "function";
|
|
360
|
-
var init_react = __esm(() => {
|
|
361
|
-
reactIslandRoots = new WeakMap;
|
|
362
|
-
HOST_REACT_EXPANDO_PREFIXES = [
|
|
363
|
-
"__reactFiber$",
|
|
364
|
-
"__reactProps$",
|
|
365
|
-
"__reactContainer$",
|
|
366
|
-
"__reactEvents$",
|
|
367
|
-
"__reactListeners$",
|
|
368
|
-
"__reactHandles$"
|
|
369
|
-
];
|
|
370
|
-
});
|
|
371
|
-
|
|
372
|
-
// src/client/hydrators/svelte.ts
|
|
373
|
-
var exports_svelte = {};
|
|
374
|
-
__export(exports_svelte, {
|
|
375
|
-
hydrateSvelteIsland: () => hydrateSvelteIsland,
|
|
376
|
-
isSvelteComponent: () => isSvelteComponent
|
|
377
|
-
});
|
|
378
|
-
import { hydrate as hydrateSvelte } from "svelte";
|
|
379
|
-
var isPropsRecord2 = (value) => typeof value === "object" && value !== null, hydrateSvelteIsland = (component, element, props) => {
|
|
380
|
-
hydrateSvelte(component, {
|
|
381
|
-
props: isPropsRecord2(props) ? props : undefined,
|
|
382
|
-
target: element
|
|
383
|
-
});
|
|
384
|
-
}, isSvelteComponent = (value) => typeof value === "function";
|
|
385
|
-
var init_svelte = () => {};
|
|
386
|
-
|
|
387
|
-
// src/client/hydrators/vue.ts
|
|
388
|
-
var exports_vue = {};
|
|
389
|
-
__export(exports_vue, {
|
|
390
|
-
hydrateVueIsland: () => hydrateVueIsland,
|
|
391
|
-
isVueComponent: () => isVueComponent
|
|
392
|
-
});
|
|
393
|
-
import { createSSRApp, h } from "vue";
|
|
394
|
-
var vueIslandApps, isPropsRecord3 = (value) => typeof value === "object" && value !== null, hydrateVueIsland = (component, element, props) => {
|
|
395
|
-
if (vueIslandApps.has(element)) {
|
|
396
|
-
return;
|
|
397
|
-
}
|
|
398
|
-
const app = createSSRApp({
|
|
399
|
-
render: () => h(component, isPropsRecord3(props) ? props : undefined)
|
|
400
|
-
});
|
|
401
|
-
app.mount(element);
|
|
402
|
-
vueIslandApps.set(element, app);
|
|
403
|
-
}, isVueComponent = (value) => typeof value === "function" || isPropsRecord3(value);
|
|
404
|
-
var init_vue = __esm(() => {
|
|
405
|
-
vueIslandApps = new WeakMap;
|
|
406
|
-
});
|
|
407
|
-
|
|
408
|
-
// src/angular/resolveAngularPackage.ts
|
|
409
|
-
import { existsSync, readFileSync } from "fs";
|
|
410
|
-
import { join, resolve } from "path";
|
|
411
|
-
var resolveAngularPackageDir = (specifier) => {
|
|
412
|
-
const fromCompiledRuntime = process.env.ABSOLUTE_BUILD_DIR ? resolve(process.env.ABSOLUTE_BUILD_DIR, "node_modules", specifier) : null;
|
|
413
|
-
if (fromCompiledRuntime && existsSync(fromCompiledRuntime)) {
|
|
414
|
-
return fromCompiledRuntime;
|
|
415
|
-
}
|
|
416
|
-
const fromProject = resolve(process.cwd(), "node_modules", specifier);
|
|
417
|
-
if (existsSync(fromProject)) {
|
|
418
|
-
return fromProject;
|
|
419
|
-
}
|
|
420
|
-
return null;
|
|
421
|
-
}, resolvePackageEntry = (packageDir) => {
|
|
422
|
-
try {
|
|
423
|
-
const pkg = JSON.parse(readFileSync(join(packageDir, "package.json"), "utf-8"));
|
|
424
|
-
const rootExport = pkg.exports?.["."];
|
|
425
|
-
const entry = (typeof rootExport === "string" ? rootExport : rootExport?.default) ?? pkg.module ?? pkg.main ?? "index.js";
|
|
426
|
-
return join(packageDir, entry);
|
|
427
|
-
} catch {
|
|
428
|
-
return packageDir;
|
|
429
|
-
}
|
|
430
|
-
}, resolveAngularPackage = (specifier) => {
|
|
431
|
-
const packageDir = resolveAngularPackageDir(specifier);
|
|
432
|
-
if (packageDir)
|
|
433
|
-
return resolvePackageEntry(packageDir);
|
|
434
|
-
return specifier;
|
|
435
|
-
}, toSafeVendorName = (specifier) => specifier.replace(/^@/, "").replace(/\//g, "_"), resolveAngularRuntimePath = (specifier) => {
|
|
436
|
-
const buildDirs = [
|
|
437
|
-
process.env.ABSOLUTE_BUILD_DIR,
|
|
438
|
-
resolve(process.cwd(), "build")
|
|
439
|
-
].filter((value) => Boolean(value));
|
|
440
|
-
for (const buildDir of buildDirs) {
|
|
441
|
-
const vendorPath = join(buildDir, "angular", "vendor", "server", `${toSafeVendorName(specifier)}.js`);
|
|
442
|
-
if (existsSync(vendorPath))
|
|
443
|
-
return vendorPath;
|
|
444
|
-
}
|
|
445
|
-
return resolveAngularPackage(specifier);
|
|
446
|
-
};
|
|
447
|
-
var init_resolveAngularPackage = () => {};
|
|
448
|
-
|
|
449
|
-
// src/utils/runtimeMode.ts
|
|
450
|
-
var ENV_VAR = "NODE_ENV", isDevelopmentRuntime = () => process.env[ENV_VAR] === "development", isProductionRuntime = () => process.env[ENV_VAR] === "production";
|
|
451
|
-
|
|
452
|
-
// src/angular/angularPatch.ts
|
|
453
|
-
var exports_angularPatch = {};
|
|
454
|
-
__export(exports_angularPatch, {
|
|
455
|
-
applyPatches: () => applyPatches
|
|
456
|
-
});
|
|
457
|
-
var ensureHead = (doc) => {
|
|
458
|
-
if (!doc || doc.head || !doc.documentElement) {
|
|
459
|
-
return;
|
|
460
|
-
}
|
|
461
|
-
const head = doc.createElement("head");
|
|
462
|
-
doc.documentElement.insertBefore(head, doc.documentElement.firstChild);
|
|
463
|
-
}, SSR_LAYOUT_RECT, layoutPatchApplied = false, collectPrototypeChain = (instance) => {
|
|
464
|
-
const protos = [];
|
|
465
|
-
let current = instance ? Object.getPrototypeOf(instance) : null;
|
|
466
|
-
while (current && current !== Object.prototype) {
|
|
467
|
-
protos.push(current);
|
|
468
|
-
current = Object.getPrototypeOf(current);
|
|
469
|
-
}
|
|
470
|
-
return protos;
|
|
471
|
-
}, patchElementLayout = (doc) => {
|
|
472
|
-
if (layoutPatchApplied || !doc) {
|
|
473
|
-
return;
|
|
474
|
-
}
|
|
475
|
-
let element;
|
|
476
|
-
try {
|
|
477
|
-
element = doc.createElement("div");
|
|
478
|
-
} catch {
|
|
479
|
-
return;
|
|
480
|
-
}
|
|
481
|
-
const protos = collectPrototypeChain(element);
|
|
482
|
-
if (protos.length === 0)
|
|
483
|
-
return;
|
|
484
|
-
const copyLayoutRect = (rect) => ({ ...rect });
|
|
485
|
-
const createLayoutRect = () => copyLayoutRect(SSR_LAYOUT_RECT);
|
|
486
|
-
const getClientRects = () => [];
|
|
487
|
-
const noop = () => {
|
|
488
|
-
return;
|
|
489
|
-
};
|
|
490
|
-
const numericProps = [
|
|
491
|
-
"clientWidth",
|
|
492
|
-
"clientHeight",
|
|
493
|
-
"clientLeft",
|
|
494
|
-
"clientTop",
|
|
495
|
-
"offsetWidth",
|
|
496
|
-
"offsetHeight",
|
|
497
|
-
"offsetLeft",
|
|
498
|
-
"offsetTop",
|
|
499
|
-
"scrollWidth",
|
|
500
|
-
"scrollHeight",
|
|
501
|
-
"scrollLeft",
|
|
502
|
-
"scrollTop"
|
|
503
|
-
];
|
|
504
|
-
for (const proto of protos) {
|
|
505
|
-
const define = (name, value) => {
|
|
506
|
-
const descriptor = Object.getOwnPropertyDescriptor(proto, name);
|
|
507
|
-
if (typeof descriptor?.value === "function")
|
|
508
|
-
return;
|
|
509
|
-
Object.defineProperty(proto, name, {
|
|
510
|
-
configurable: true,
|
|
511
|
-
value,
|
|
512
|
-
writable: true
|
|
513
|
-
});
|
|
514
|
-
};
|
|
515
|
-
define("getBoundingClientRect", createLayoutRect);
|
|
516
|
-
define("getClientRects", getClientRects);
|
|
517
|
-
define("scrollTo", noop);
|
|
518
|
-
define("scrollBy", noop);
|
|
519
|
-
define("scrollIntoView", noop);
|
|
520
|
-
define("focus", noop);
|
|
521
|
-
define("blur", noop);
|
|
522
|
-
for (const prop of numericProps) {
|
|
523
|
-
const desc = Object.getOwnPropertyDescriptor(proto, prop);
|
|
524
|
-
if (desc)
|
|
525
|
-
continue;
|
|
526
|
-
Object.defineProperty(proto, prop, {
|
|
527
|
-
configurable: true,
|
|
528
|
-
get: () => 0
|
|
529
|
-
});
|
|
530
|
-
}
|
|
531
|
-
}
|
|
532
|
-
layoutPatchApplied = true;
|
|
533
|
-
}, applyPatches = async () => {
|
|
534
|
-
const spec = isProductionRuntime() ? resolveAngularRuntimePath("@angular/platform-server") : "@angular/platform-server";
|
|
535
|
-
const { \u{275}DominoAdapter } = await import(spec);
|
|
536
|
-
if (!\u{275}DominoAdapter?.prototype) {
|
|
537
|
-
console.warn("[Angular Patch] \u0275DominoAdapter not found, skipping patches");
|
|
538
|
-
return false;
|
|
539
|
-
}
|
|
540
|
-
try {
|
|
541
|
-
const adapter = new \u{275}DominoAdapter;
|
|
542
|
-
const resolveSeedDoc = () => {
|
|
543
|
-
if (typeof adapter.createHtmlDocument === "function")
|
|
544
|
-
return adapter.createHtmlDocument();
|
|
545
|
-
if (typeof adapter.getDefaultDocument === "function")
|
|
546
|
-
return adapter.getDefaultDocument();
|
|
547
|
-
return null;
|
|
548
|
-
};
|
|
549
|
-
const seedDoc = resolveSeedDoc();
|
|
550
|
-
if (seedDoc) {
|
|
551
|
-
patchElementLayout(seedDoc);
|
|
552
|
-
const probe = seedDoc.createElement("div");
|
|
553
|
-
if (typeof probe.getBoundingClientRect !== "function") {
|
|
554
|
-
console.warn("[Angular Patch] Layout shim did not stick on probe element prototype chain");
|
|
555
|
-
}
|
|
556
|
-
}
|
|
557
|
-
} catch (error) {
|
|
558
|
-
console.warn("[Angular Patch] Could not eagerly patch Element prototypes:", error);
|
|
559
|
-
}
|
|
560
|
-
const proto = \u{275}DominoAdapter.prototype;
|
|
561
|
-
const origGetBaseHref = proto.getBaseHref;
|
|
562
|
-
proto.getBaseHref = function(doc) {
|
|
563
|
-
if (!doc || !doc.head || typeof doc.head.children === "undefined") {
|
|
564
|
-
return "";
|
|
565
|
-
}
|
|
566
|
-
return origGetBaseHref.call(this, doc);
|
|
567
|
-
};
|
|
568
|
-
const origCreateHtmlDocument = proto.createHtmlDocument;
|
|
569
|
-
proto.createHtmlDocument = function() {
|
|
570
|
-
const doc = origCreateHtmlDocument.call(this);
|
|
571
|
-
ensureHead(doc);
|
|
572
|
-
patchElementLayout(doc);
|
|
573
|
-
return doc;
|
|
574
|
-
};
|
|
575
|
-
const origGetDefaultDocument = proto.getDefaultDocument;
|
|
576
|
-
proto.getDefaultDocument = function() {
|
|
577
|
-
const doc = origGetDefaultDocument.call(this);
|
|
578
|
-
ensureHead(doc);
|
|
579
|
-
patchElementLayout(doc);
|
|
580
|
-
return doc;
|
|
581
|
-
};
|
|
582
|
-
return true;
|
|
583
|
-
};
|
|
584
|
-
var init_angularPatch = __esm(() => {
|
|
585
|
-
init_resolveAngularPackage();
|
|
586
|
-
SSR_LAYOUT_RECT = Object.freeze({
|
|
587
|
-
bottom: 0,
|
|
588
|
-
height: 0,
|
|
589
|
-
left: 0,
|
|
590
|
-
right: 0,
|
|
591
|
-
top: 0,
|
|
592
|
-
width: 0,
|
|
593
|
-
x: 0,
|
|
594
|
-
y: 0,
|
|
595
|
-
toJSON() {
|
|
596
|
-
return this;
|
|
597
|
-
}
|
|
598
|
-
});
|
|
599
|
-
});
|
|
600
|
-
|
|
601
|
-
// src/angular/angularDeps.ts
|
|
602
|
-
var initDominoAdapter = (platformServer) => {
|
|
603
|
-
try {
|
|
604
|
-
platformServer.\u{275}DominoAdapter?.makeCurrent?.();
|
|
605
|
-
} catch (err) {
|
|
606
|
-
console.error("Failed to initialize DominoAdapter:", err);
|
|
607
|
-
}
|
|
608
|
-
}, loadAngularDeps = async () => {
|
|
609
|
-
if (!isProductionRuntime()) {
|
|
610
|
-
await import("@angular/compiler");
|
|
611
|
-
}
|
|
612
|
-
const { applyPatches: applyPatches2 } = await Promise.resolve().then(() => (init_angularPatch(), exports_angularPatch));
|
|
613
|
-
await applyPatches2();
|
|
614
|
-
const useBareSpecifiers = !isProductionRuntime();
|
|
615
|
-
const [platformBrowser, platformServer, common, core] = await Promise.all([
|
|
616
|
-
useBareSpecifiers ? import("@angular/platform-browser") : import(resolveAngularRuntimePath("@angular/platform-browser")),
|
|
617
|
-
useBareSpecifiers ? import("@angular/platform-server") : import(resolveAngularRuntimePath("@angular/platform-server")),
|
|
618
|
-
useBareSpecifiers ? import("@angular/common") : import(resolveAngularRuntimePath("@angular/common")),
|
|
619
|
-
useBareSpecifiers ? import("@angular/core") : import(resolveAngularRuntimePath("@angular/core"))
|
|
620
|
-
]);
|
|
621
|
-
if (!isDevelopmentRuntime()) {
|
|
622
|
-
core.enableProdMode();
|
|
623
|
-
}
|
|
624
|
-
initDominoAdapter(platformServer);
|
|
625
|
-
return {
|
|
626
|
-
APP_BASE_HREF: common.APP_BASE_HREF,
|
|
627
|
-
bootstrapApplication: platformBrowser.bootstrapApplication,
|
|
628
|
-
Component: core.Component,
|
|
629
|
-
DomSanitizer: platformBrowser.DomSanitizer,
|
|
630
|
-
ENVIRONMENT_INITIALIZER: core.ENVIRONMENT_INITIALIZER,
|
|
631
|
-
inject: core.inject,
|
|
632
|
-
InjectionToken: core.InjectionToken,
|
|
633
|
-
NgComponentOutlet: common.NgComponentOutlet,
|
|
634
|
-
provideClientHydration: platformBrowser.provideClientHydration,
|
|
635
|
-
provideServerRendering: platformServer.provideServerRendering,
|
|
636
|
-
provideZonelessChangeDetection: core.provideZonelessChangeDetection,
|
|
637
|
-
reflectComponentType: core.reflectComponentType,
|
|
638
|
-
renderApplication: platformServer.renderApplication,
|
|
639
|
-
REQUEST: core.REQUEST,
|
|
640
|
-
REQUEST_CONTEXT: core.REQUEST_CONTEXT,
|
|
641
|
-
RESPONSE_INIT: core.RESPONSE_INIT,
|
|
642
|
-
Sanitizer: core.Sanitizer,
|
|
643
|
-
SecurityContext: core.SecurityContext,
|
|
644
|
-
withHttpTransferCacheOptions: platformBrowser.withHttpTransferCacheOptions
|
|
645
|
-
};
|
|
646
|
-
}, angularDeps = null, getAngularDeps = () => {
|
|
647
|
-
if (!angularDeps) {
|
|
648
|
-
angularDeps = loadAngularDeps();
|
|
649
|
-
}
|
|
650
|
-
return angularDeps;
|
|
651
|
-
};
|
|
652
|
-
var init_angularDeps = __esm(() => {
|
|
653
|
-
init_resolveAngularPackage();
|
|
654
|
-
});
|
|
655
|
-
|
|
656
|
-
// src/utils/registerClientScript.ts
|
|
657
|
-
var scriptRegistry, requestCounter = 0, getRequestId = () => `req_${Date.now()}_${++requestCounter}`, ssrContextGetter = null, getSsrContextId = () => ssrContextGetter?.() || Object.getOwnPropertyDescriptor(globalThis, "__absolutejs_requestId")?.value, registerClientScript = (script, requestId) => {
|
|
658
|
-
const id = requestId || getSsrContextId() || getRequestId();
|
|
659
|
-
if (!scriptRegistry.has(id)) {
|
|
660
|
-
scriptRegistry.set(id, new Set);
|
|
661
|
-
}
|
|
662
|
-
scriptRegistry.get(id)?.add(script);
|
|
663
|
-
return id;
|
|
664
|
-
}, setSsrContextGetter = (getter) => {
|
|
665
|
-
ssrContextGetter = getter;
|
|
666
|
-
}, clearAllClientScripts = () => {
|
|
667
|
-
scriptRegistry.clear();
|
|
668
|
-
}, generateClientScriptCode = (scripts) => {
|
|
669
|
-
if (scripts.length === 0) {
|
|
670
|
-
return "";
|
|
671
|
-
}
|
|
672
|
-
const scriptCode = scripts.map((script, index) => {
|
|
673
|
-
const funcString = script.toString();
|
|
674
|
-
const bodyMatch = funcString.match(/\{([\s\S]*)\}/);
|
|
675
|
-
if (!bodyMatch || !bodyMatch[1]) {
|
|
676
|
-
return "";
|
|
677
|
-
}
|
|
678
|
-
const body = bodyMatch[1].trim();
|
|
679
|
-
return `
|
|
680
|
-
(function() {
|
|
681
|
-
var executed = false;
|
|
682
|
-
function executeScript_${index}() {
|
|
683
|
-
if (executed) return;
|
|
684
|
-
executed = true;
|
|
685
|
-
${body}
|
|
686
|
-
}
|
|
687
|
-
|
|
688
|
-
if (document.readyState === 'complete' || document.readyState === 'interactive') {
|
|
689
|
-
executeScript_${index}();
|
|
690
|
-
} else {
|
|
691
|
-
document.addEventListener('DOMContentLoaded', executeScript_${index});
|
|
692
|
-
}
|
|
693
|
-
|
|
694
|
-
// Watch for hydration-added elements
|
|
695
|
-
var observer = new MutationObserver(function() {
|
|
696
|
-
executeScript_${index}();
|
|
697
|
-
if (executed) observer.disconnect();
|
|
698
|
-
});
|
|
699
|
-
if (!executed) {
|
|
700
|
-
observer.observe(document.body || document.documentElement, { childList: true, subtree: true });
|
|
701
|
-
}
|
|
702
|
-
|
|
703
|
-
// Single fallback timeout
|
|
704
|
-
setTimeout(function() {
|
|
705
|
-
executeScript_${index}();
|
|
706
|
-
observer.disconnect();
|
|
707
|
-
}, 1000);
|
|
708
|
-
})();`;
|
|
709
|
-
}).join(`
|
|
710
|
-
`);
|
|
711
|
-
return `<script>
|
|
712
|
-
(function() {
|
|
713
|
-
${scriptCode}
|
|
714
|
-
})();
|
|
715
|
-
</script>`;
|
|
716
|
-
}, getAndClearClientScripts = (requestId) => {
|
|
717
|
-
const id = requestId || ssrContextGetter?.();
|
|
718
|
-
if (!id)
|
|
719
|
-
return [];
|
|
720
|
-
const scripts = scriptRegistry.get(id);
|
|
721
|
-
if (!scripts) {
|
|
722
|
-
return [];
|
|
723
|
-
}
|
|
724
|
-
const scriptArray = Array.from(scripts);
|
|
725
|
-
scriptRegistry.delete(id);
|
|
726
|
-
return scriptArray;
|
|
727
|
-
};
|
|
728
|
-
var init_registerClientScript = __esm(() => {
|
|
729
|
-
scriptRegistry = new Map;
|
|
730
|
-
if (typeof globalThis !== "undefined") {
|
|
731
|
-
Object.assign(globalThis, { registerClientScript });
|
|
732
|
-
}
|
|
733
|
-
});
|
|
734
|
-
|
|
735
|
-
// src/core/browserTranslation.ts
|
|
736
|
-
var BASELINE_MARKER = "__ABSOLUTE_SSR_TEXT_BASELINES__", BROWSER_TRANSLATION_BASELINE_SCRIPT, browserTranslationBaselineTag = () => `<script>${BROWSER_TRANSLATION_BASELINE_SCRIPT}</script>`, injectBrowserTranslationBaseline = (html) => {
|
|
737
|
-
if (html.includes(BASELINE_MARKER))
|
|
738
|
-
return html;
|
|
739
|
-
const script = browserTranslationBaselineTag();
|
|
740
|
-
const closingBodyIndex = html.lastIndexOf("</body>");
|
|
741
|
-
if (closingBodyIndex < 0)
|
|
742
|
-
return `${html}${script}`;
|
|
743
|
-
return `${html.slice(0, closingBodyIndex)}${script}${html.slice(closingBodyIndex)}`;
|
|
744
|
-
};
|
|
745
|
-
var init_browserTranslation = __esm(() => {
|
|
746
|
-
BROWSER_TRANSLATION_BASELINE_SCRIPT = "window.__ABSOLUTE_SSR_TEXT_BASELINES__=new WeakMap();" + "{const r=document.body,b=window.__ABSOLUTE_SSR_TEXT_BASELINES__;" + 'if(r)for(const e of [r,...r.querySelectorAll("*")]){' + "const t=new Map();for(const [i,n]of[...e.childNodes].entries())" + 'if(n.nodeType===3)t.set(i,n.nodeValue??"");if(t.size)b.set(e,t);}}';
|
|
747
|
-
});
|
|
748
|
-
|
|
749
|
-
// src/angular/httpTransferCache.ts
|
|
750
|
-
var ABSOLUTE_HTTP_TRANSFER_CACHE_SKIP_HEADER = "x-skip-transfer-cache", buildAbsoluteHttpTransferCacheOptions = (options = {}) => {
|
|
751
|
-
const {
|
|
752
|
-
filter: userFilter,
|
|
753
|
-
skipHeader = ABSOLUTE_HTTP_TRANSFER_CACHE_SKIP_HEADER,
|
|
754
|
-
...angularOptions
|
|
755
|
-
} = options;
|
|
756
|
-
return {
|
|
757
|
-
includePostRequests: false,
|
|
758
|
-
includeRequestsWithAuthHeaders: false,
|
|
759
|
-
...angularOptions,
|
|
760
|
-
filter: (request) => !request.headers.has(skipHeader) && (userFilter?.(request) ?? true)
|
|
761
|
-
};
|
|
762
|
-
};
|
|
763
|
-
|
|
764
|
-
// src/angular/requestProviders.ts
|
|
765
|
-
var buildRequestProviders = (deps, request, requestContext, responseInit) => [
|
|
766
|
-
{ provide: deps.REQUEST, useValue: request ?? null },
|
|
767
|
-
{ provide: deps.REQUEST_CONTEXT, useValue: requestContext ?? null },
|
|
768
|
-
{ provide: deps.RESPONSE_INIT, useValue: responseInit ?? null }
|
|
769
|
-
];
|
|
770
|
-
|
|
771
|
-
// src/angular/ssrRender.ts
|
|
772
|
-
var routeContextCache, cacheRouteData = (pagePath, data) => {
|
|
773
|
-
const cacheKey = pagePath.split("?")[0] ?? pagePath;
|
|
774
|
-
routeContextCache.set(cacheKey, data);
|
|
775
|
-
}, getCachedRouteData = (pagePath) => routeContextCache.get(pagePath), selectorCache, buildProviders = (deps, sanitizer, request, requestContext, responseInit, userProviders = []) => [
|
|
776
|
-
deps.provideServerRendering(),
|
|
777
|
-
deps.provideClientHydration(deps.withHttpTransferCacheOptions(buildAbsoluteHttpTransferCacheOptions())),
|
|
778
|
-
deps.provideZonelessChangeDetection(),
|
|
779
|
-
{ provide: deps.APP_BASE_HREF, useValue: "/" },
|
|
780
|
-
{ provide: deps.DomSanitizer, useValue: sanitizer },
|
|
781
|
-
{ provide: deps.Sanitizer, useValue: sanitizer },
|
|
782
|
-
...buildRequestProviders(deps, request, requestContext, responseInit),
|
|
783
|
-
...userProviders
|
|
784
|
-
], resolveSelector = (deps, pagePath, PageComponent) => {
|
|
785
|
-
const cached = selectorCache.get(pagePath);
|
|
786
|
-
if (cached) {
|
|
787
|
-
return cached;
|
|
788
|
-
}
|
|
789
|
-
const selector = deps.reflectComponentType(PageComponent)?.selector ?? "ng-app";
|
|
790
|
-
selectorCache.set(pagePath, selector);
|
|
791
|
-
return selector;
|
|
792
|
-
}, injectBeforeClose = (html, snippet) => {
|
|
793
|
-
if (html.includes("</body>")) {
|
|
794
|
-
return html.replace("</body>", `${snippet}</body>`);
|
|
795
|
-
}
|
|
796
|
-
if (html.includes("</html>")) {
|
|
797
|
-
return html.replace("</html>", `${snippet}</html>`);
|
|
798
|
-
}
|
|
799
|
-
return html + snippet;
|
|
800
|
-
}, injectSsrScripts = (html, requestId, indexPath, requestContext) => {
|
|
801
|
-
let result = injectBeforeClose(html, browserTranslationBaselineTag());
|
|
802
|
-
const registeredScripts = getAndClearClientScripts(requestId);
|
|
803
|
-
if (registeredScripts.length > 0) {
|
|
804
|
-
result = injectBeforeClose(result, generateClientScriptCode(registeredScripts));
|
|
805
|
-
}
|
|
806
|
-
if (requestContext !== undefined) {
|
|
807
|
-
result = injectBeforeClose(result, `<script>window.__ABS_ANGULAR_REQUEST_CONTEXT__ = ${JSON.stringify(requestContext)};</script>`);
|
|
808
|
-
}
|
|
809
|
-
if (indexPath) {
|
|
810
|
-
const escapedIndexPath = JSON.stringify(indexPath);
|
|
811
|
-
result = injectBeforeClose(result, `<script>import(${escapedIndexPath});</script>`);
|
|
812
|
-
}
|
|
813
|
-
return result;
|
|
814
|
-
}, renderAngularApp = async (deps, PageComponent, providers, document2, url = "/") => {
|
|
815
|
-
const bootstrap = (context) => deps.bootstrapApplication(PageComponent, { providers }, context);
|
|
816
|
-
return withSuppressedAngularDevLogs(() => deps.renderApplication(bootstrap, {
|
|
817
|
-
document: document2,
|
|
818
|
-
platformProviders: [],
|
|
819
|
-
url
|
|
820
|
-
}));
|
|
821
|
-
}, withSuppressedAngularDevLogs = async (render) => {
|
|
822
|
-
const origLog = console.log;
|
|
823
|
-
console.log = (...args) => {
|
|
824
|
-
if (typeof args[0] === "string" && args[0].includes("development mode")) {
|
|
825
|
-
return;
|
|
826
|
-
}
|
|
827
|
-
origLog.apply(console, args);
|
|
828
|
-
};
|
|
829
|
-
try {
|
|
830
|
-
return await render();
|
|
831
|
-
} finally {
|
|
832
|
-
console.log = origLog;
|
|
833
|
-
}
|
|
834
|
-
};
|
|
835
|
-
var init_ssrRender = __esm(() => {
|
|
836
|
-
init_registerClientScript();
|
|
837
|
-
init_browserTranslation();
|
|
838
|
-
routeContextCache = new Map;
|
|
839
|
-
selectorCache = new Map;
|
|
840
|
-
});
|
|
841
|
-
|
|
842
|
-
// src/angular/islands.ts
|
|
843
|
-
var exports_islands = {};
|
|
844
|
-
__export(exports_islands, {
|
|
845
|
-
getAngularIslandSelector: () => getAngularIslandSelector,
|
|
846
|
-
isAngularComponent: () => isAngularComponent,
|
|
847
|
-
mountAngularIsland: () => mountAngularIsland,
|
|
848
|
-
renderAngularIslandToHtml: () => renderAngularIslandToHtml
|
|
849
|
-
});
|
|
850
|
-
var angularIslandSelector = "abs-angular-island", getAngularIslandSelector = (_islandId) => angularIslandSelector, isAngularComponent = (value) => typeof value === "function", getSelectorFromRenderedIsland = (rootElement) => {
|
|
851
|
-
const firstChild = rootElement.firstElementChild;
|
|
852
|
-
if (!(firstChild instanceof HTMLElement)) {
|
|
853
|
-
return null;
|
|
854
|
-
}
|
|
855
|
-
const selector = firstChild.tagName.toLowerCase();
|
|
856
|
-
return selector.length > 0 ? selector : null;
|
|
857
|
-
}, getClientAngularComponentSelector = (component) => {
|
|
858
|
-
const maybeDef = Reflect.get(component, "\u0275cmp");
|
|
859
|
-
if (typeof maybeDef !== "object" || maybeDef === null) {
|
|
860
|
-
return null;
|
|
861
|
-
}
|
|
862
|
-
const maybeSelectors = Reflect.get(maybeDef, "selectors");
|
|
863
|
-
if (!Array.isArray(maybeSelectors)) {
|
|
864
|
-
return null;
|
|
865
|
-
}
|
|
866
|
-
const [firstSelectorGroup] = maybeSelectors;
|
|
867
|
-
if (!Array.isArray(firstSelectorGroup)) {
|
|
868
|
-
return null;
|
|
869
|
-
}
|
|
870
|
-
const [selector] = firstSelectorGroup;
|
|
871
|
-
return typeof selector === "string" && selector.length > 0 ? selector : null;
|
|
872
|
-
}, createAngularIslandApp = async () => {
|
|
873
|
-
const { EnvironmentInjector, provideZonelessChangeDetection } = await import("@angular/core");
|
|
874
|
-
const { createApplication } = await import("@angular/platform-browser");
|
|
875
|
-
const app = await createApplication({
|
|
876
|
-
providers: [provideZonelessChangeDetection()]
|
|
877
|
-
});
|
|
878
|
-
const environmentInjector = app.injector.get(EnvironmentInjector);
|
|
879
|
-
return { app, environmentInjector };
|
|
880
|
-
}, angularIslandAppPromise = null, getAngularIslandApp = async () => {
|
|
881
|
-
if (!angularIslandAppPromise) {
|
|
882
|
-
angularIslandAppPromise = createAngularIslandApp();
|
|
883
|
-
}
|
|
884
|
-
return angularIslandAppPromise;
|
|
885
|
-
}, wrapperMetadataCache, requestRenderCache, getRequestRenderCache = () => {
|
|
886
|
-
const requestId = getSsrContextId();
|
|
887
|
-
if (!requestId) {
|
|
888
|
-
return null;
|
|
889
|
-
}
|
|
890
|
-
const cached = requestRenderCache.get(requestId);
|
|
891
|
-
if (cached) {
|
|
892
|
-
return cached;
|
|
893
|
-
}
|
|
894
|
-
const renderCache = new Map;
|
|
895
|
-
requestRenderCache.set(requestId, renderCache);
|
|
896
|
-
return renderCache;
|
|
897
|
-
}, getAngularIslandWrapperKey = (component, _islandId) => {
|
|
898
|
-
const componentName = typeof component.name === "string" && component.name.length > 0 ? component.name : "AngularIsland";
|
|
899
|
-
return `${componentName}:${angularIslandSelector}`;
|
|
900
|
-
}, getIslandRenderCacheKey = (component, props) => {
|
|
901
|
-
const componentName = typeof component.name === "string" && component.name.length > 0 ? component.name : "AngularIsland";
|
|
902
|
-
return `${componentName}:${JSON.stringify(props)}`;
|
|
903
|
-
}, buildAngularIslandWrapperMetadata = async (component, islandId, wrapperKey) => {
|
|
904
|
-
const deps = await getAngularDeps();
|
|
905
|
-
const { Component, InjectionToken, NgComponentOutlet, inject } = deps;
|
|
906
|
-
const selector = getAngularIslandSelector(islandId);
|
|
907
|
-
const propsToken = new InjectionToken(`${wrapperKey}:props`);
|
|
908
|
-
|
|
909
|
-
class AngularIslandWrapperComponent {
|
|
910
|
-
constructor() {
|
|
911
|
-
this.component = component;
|
|
912
|
-
this.props = inject(propsToken);
|
|
913
|
-
}
|
|
914
|
-
}
|
|
915
|
-
return {
|
|
916
|
-
deps,
|
|
917
|
-
propsToken,
|
|
918
|
-
selector,
|
|
919
|
-
WrapperComponent: Component({
|
|
920
|
-
imports: [NgComponentOutlet, component],
|
|
921
|
-
selector,
|
|
922
|
-
standalone: true,
|
|
923
|
-
template: '<ng-container *ngComponentOutlet="component; inputs: props"></ng-container>'
|
|
924
|
-
})(AngularIslandWrapperComponent)
|
|
925
|
-
};
|
|
926
|
-
}, createAngularIslandWrapper = async (component, islandId) => {
|
|
927
|
-
const wrapperKey = getAngularIslandWrapperKey(component, islandId);
|
|
928
|
-
const cached = wrapperMetadataCache.get(wrapperKey);
|
|
929
|
-
if (cached) {
|
|
930
|
-
return cached;
|
|
931
|
-
}
|
|
932
|
-
const metadataPromise = buildAngularIslandWrapperMetadata(component, islandId, wrapperKey);
|
|
933
|
-
wrapperMetadataCache.set(wrapperKey, metadataPromise);
|
|
934
|
-
return metadataPromise;
|
|
935
|
-
}, extractAngularIslandRoot = (html, selector) => {
|
|
936
|
-
const openTag = `<${selector}`;
|
|
937
|
-
const start = html.indexOf(openTag);
|
|
938
|
-
if (start < 0) {
|
|
939
|
-
throw new Error(`Could not find Angular island root "${selector}".`);
|
|
940
|
-
}
|
|
941
|
-
const endTag = `</${selector}>`;
|
|
942
|
-
const end = html.indexOf(endTag, start);
|
|
943
|
-
if (end < 0) {
|
|
944
|
-
throw new Error(`Could not close Angular island root "${selector}".`);
|
|
945
|
-
}
|
|
946
|
-
return html.slice(start, end + endTag.length);
|
|
947
|
-
}, mountAngularIsland = async (component, element, props, islandId) => {
|
|
948
|
-
await import("@angular/compiler");
|
|
949
|
-
const { createComponent, inputBinding } = await import("@angular/core");
|
|
950
|
-
const selector = getAngularIslandSelector(islandId);
|
|
951
|
-
const { app, environmentInjector } = await getAngularIslandApp();
|
|
952
|
-
let rootElement = element.querySelector(selector);
|
|
953
|
-
if (!(rootElement instanceof HTMLElement)) {
|
|
954
|
-
element.innerHTML = `<${selector}></${selector}>`;
|
|
955
|
-
rootElement = element.querySelector(selector);
|
|
956
|
-
}
|
|
957
|
-
if (!(rootElement instanceof HTMLElement))
|
|
958
|
-
return app;
|
|
959
|
-
const componentSelector = getClientAngularComponentSelector(component) ?? getSelectorFromRenderedIsland(rootElement);
|
|
960
|
-
if (!componentSelector)
|
|
961
|
-
return app;
|
|
962
|
-
rootElement.innerHTML = `<${componentSelector}></${componentSelector}>`;
|
|
963
|
-
const hostElement = rootElement.querySelector(componentSelector);
|
|
964
|
-
if (!(hostElement instanceof HTMLElement))
|
|
965
|
-
return app;
|
|
966
|
-
const bindings = Object.entries(props).map(([key, value]) => inputBinding(key, () => value));
|
|
967
|
-
const componentRef = createComponent(component, {
|
|
968
|
-
bindings,
|
|
969
|
-
environmentInjector,
|
|
970
|
-
hostElement
|
|
971
|
-
});
|
|
972
|
-
app.attachView(componentRef.hostView);
|
|
973
|
-
componentRef.changeDetectorRef.detectChanges();
|
|
974
|
-
window.__ABS_ANGULAR_ISLAND_APPS__ ??= [];
|
|
975
|
-
window.__ABS_ANGULAR_ISLAND_APPS__.push(app);
|
|
976
|
-
return app;
|
|
977
|
-
}, renderAngularIslandToHtml = async (component, props, islandId) => {
|
|
978
|
-
const requestCache = getRequestRenderCache();
|
|
979
|
-
const renderCacheKey = getIslandRenderCacheKey(component, props);
|
|
980
|
-
const cachedHtml = requestCache?.get(renderCacheKey);
|
|
981
|
-
if (cachedHtml) {
|
|
982
|
-
return cachedHtml;
|
|
983
|
-
}
|
|
984
|
-
const { deps, propsToken, selector, WrapperComponent } = await createAngularIslandWrapper(component, islandId);
|
|
985
|
-
const providers = [
|
|
986
|
-
deps.provideServerRendering(),
|
|
987
|
-
deps.provideZonelessChangeDetection(),
|
|
988
|
-
{ provide: deps.APP_BASE_HREF, useValue: "/" },
|
|
989
|
-
{ provide: propsToken, useValue: props }
|
|
990
|
-
];
|
|
991
|
-
const document2 = `<!DOCTYPE html><html><body><${selector}></${selector}></body></html>`;
|
|
992
|
-
const html = await withSuppressedAngularDevLogs(() => deps.renderApplication((context) => deps.bootstrapApplication(WrapperComponent, { providers }, context), {
|
|
993
|
-
document: document2,
|
|
994
|
-
platformProviders: [],
|
|
995
|
-
url: "/"
|
|
996
|
-
}));
|
|
997
|
-
const islandHtml = extractAngularIslandRoot(html, selector);
|
|
998
|
-
requestCache?.set(renderCacheKey, islandHtml);
|
|
999
|
-
return islandHtml;
|
|
1000
|
-
};
|
|
1001
|
-
var init_islands2 = __esm(() => {
|
|
1002
|
-
init_angularDeps();
|
|
1003
|
-
init_ssrRender();
|
|
1004
|
-
init_registerClientScript();
|
|
1005
|
-
wrapperMetadataCache = new Map;
|
|
1006
|
-
requestRenderCache = new Map;
|
|
1007
|
-
});
|
|
1008
|
-
|
|
1009
|
-
// src/client/islandResolver.ts
|
|
1010
|
-
var createIslandManifestResolver = (manifest) => {
|
|
1011
|
-
const islandManifest = getIslandManifestEntries(manifest);
|
|
1012
|
-
return async (framework, component) => {
|
|
1013
|
-
const modulePath = islandManifest[framework]?.[component] ?? manifest[getIslandManifestKey(framework, component)];
|
|
1014
|
-
if (!modulePath)
|
|
1015
|
-
return;
|
|
1016
|
-
const loadedModule = await import(modulePath);
|
|
1017
|
-
return loadedModule.default;
|
|
1018
|
-
};
|
|
1019
157
|
};
|
|
158
|
+
var getStreamSwapRuntimeScript = () => `(function(){${stripFunctionWrapper(streamSwapRuntime.toString())}})();`;
|
|
1020
159
|
// node_modules/zustand/esm/vanilla.mjs
|
|
1021
160
|
var createStoreImpl = (createState) => {
|
|
1022
161
|
let state;
|
|
@@ -1129,11 +268,22 @@ var subscribeIslandStore = (store, selector, listener) => {
|
|
|
1129
268
|
listener(nextSelection);
|
|
1130
269
|
});
|
|
1131
270
|
};
|
|
1132
|
-
// src/
|
|
1133
|
-
|
|
271
|
+
// src/core/islands.ts
|
|
272
|
+
var isRecord = (value) => typeof value === "object" && value !== null;
|
|
273
|
+
var isIslandComponentDefinition = (value) => isRecord(value) && ("component" in value) && ("source" in value) && typeof value.source === "string";
|
|
274
|
+
function getIslandComponent(component) {
|
|
275
|
+
if (isIslandComponentDefinition(component)) {
|
|
276
|
+
return component.component;
|
|
277
|
+
}
|
|
278
|
+
return component;
|
|
279
|
+
}
|
|
280
|
+
var parseIslandProps = (rawProps) => {
|
|
281
|
+
if (!rawProps)
|
|
282
|
+
return {};
|
|
283
|
+
return JSON.parse(rawProps);
|
|
284
|
+
};
|
|
1134
285
|
|
|
1135
286
|
// src/client/preserveIslandMarkup.ts
|
|
1136
|
-
init_islandMarkupAttributes();
|
|
1137
287
|
var getSnapshotMap = () => {
|
|
1138
288
|
if (typeof window === "undefined") {
|
|
1139
289
|
return null;
|
|
@@ -1141,22 +291,6 @@ var getSnapshotMap = () => {
|
|
|
1141
291
|
window.__ABS_SERVER_ISLAND_HTML__ ??= new Map;
|
|
1142
292
|
return window.__ABS_SERVER_ISLAND_HTML__;
|
|
1143
293
|
};
|
|
1144
|
-
var getIslandSignature = (props) => {
|
|
1145
|
-
const attributes = getIslandMarkerAttributes(props);
|
|
1146
|
-
return [
|
|
1147
|
-
attributes["data-component"],
|
|
1148
|
-
attributes["data-framework"],
|
|
1149
|
-
attributes["data-hydrate"],
|
|
1150
|
-
attributes["data-props"]
|
|
1151
|
-
].join("::");
|
|
1152
|
-
};
|
|
1153
|
-
var isMatchingIslandElement = (element, props) => {
|
|
1154
|
-
if (!(element instanceof HTMLElement)) {
|
|
1155
|
-
return false;
|
|
1156
|
-
}
|
|
1157
|
-
const attributes = getIslandMarkerAttributes(props);
|
|
1158
|
-
return element.dataset.island === "true" && element.dataset.component === attributes["data-component"] && element.dataset.framework === attributes["data-framework"] && (element.dataset.hydrate ?? "load") === attributes["data-hydrate"] && (element.dataset.props ?? "{}") === attributes["data-props"];
|
|
1159
|
-
};
|
|
1160
294
|
var snapshotIslandElement = (element, snapshotMap) => {
|
|
1161
295
|
const signature = [
|
|
1162
296
|
element.dataset.component,
|
|
@@ -1185,31 +319,6 @@ var initializeIslandMarkupSnapshot = () => {
|
|
|
1185
319
|
snapshotIslandElement(element, snapshotMap);
|
|
1186
320
|
}
|
|
1187
321
|
};
|
|
1188
|
-
var preserveIslandMarkup = (props) => {
|
|
1189
|
-
if (typeof document === "undefined") {
|
|
1190
|
-
return {
|
|
1191
|
-
attributes: getIslandMarkerAttributes(props),
|
|
1192
|
-
innerHTML: ""
|
|
1193
|
-
};
|
|
1194
|
-
}
|
|
1195
|
-
const snapshotMap = getSnapshotMap();
|
|
1196
|
-
const signature = getIslandSignature(props);
|
|
1197
|
-
const snapshotCandidate = snapshotMap?.get(signature)?.[0];
|
|
1198
|
-
if (snapshotCandidate) {
|
|
1199
|
-
return snapshotCandidate;
|
|
1200
|
-
}
|
|
1201
|
-
const liveCandidate = Array.from(document.querySelectorAll('[data-island="true"]')).find((element) => isMatchingIslandElement(element, props));
|
|
1202
|
-
if (!liveCandidate) {
|
|
1203
|
-
return {
|
|
1204
|
-
attributes: getIslandMarkerAttributes(props),
|
|
1205
|
-
innerHTML: ""
|
|
1206
|
-
};
|
|
1207
|
-
}
|
|
1208
|
-
return {
|
|
1209
|
-
attributes: Object.fromEntries(liveCandidate.getAttributeNames().map((name) => [name, liveCandidate.getAttribute(name) ?? ""])),
|
|
1210
|
-
innerHTML: liveCandidate.innerHTML
|
|
1211
|
-
};
|
|
1212
|
-
};
|
|
1213
322
|
|
|
1214
323
|
// src/client/islandRuntime.ts
|
|
1215
324
|
initializeIslandMarkupSnapshot();
|
|
@@ -1218,7 +327,7 @@ var idleDeadline = {
|
|
|
1218
327
|
timeRemaining: () => 0
|
|
1219
328
|
};
|
|
1220
329
|
var requestIdle = typeof window !== "undefined" && "requestIdleCallback" in window ? window.requestIdleCallback.bind(window) : (callback) => window.setTimeout(() => callback(idleDeadline), 1);
|
|
1221
|
-
var
|
|
330
|
+
var isPropsRecord = (value) => typeof value === "object" && value !== null;
|
|
1222
331
|
var isIslandElement = (value) => value instanceof HTMLElement && value.dataset.island === "true";
|
|
1223
332
|
var observedRoots = new WeakSet;
|
|
1224
333
|
var hydratingIslands = new WeakSet;
|
|
@@ -1231,41 +340,41 @@ var hydratePreservingBrowserTranslation = async (element, hydrate) => {
|
|
|
1231
340
|
}
|
|
1232
341
|
};
|
|
1233
342
|
var hydrateByFramework = async (registry, framework, componentName, element, props, resolveComponent) => {
|
|
1234
|
-
const propsRecord =
|
|
343
|
+
const propsRecord = isPropsRecord(props) ? props : undefined;
|
|
1235
344
|
if (framework === "react") {
|
|
1236
|
-
const { hydrateReactIsland
|
|
345
|
+
const { hydrateReactIsland, isReactComponent } = await import("./chunks/react-pdg4325x.js");
|
|
1237
346
|
const resolvedComponent = await resolveComponent?.(framework, componentName) ?? getIslandComponent(registry.react?.[componentName]);
|
|
1238
|
-
if (!
|
|
347
|
+
if (!isReactComponent(resolvedComponent))
|
|
1239
348
|
return;
|
|
1240
|
-
|
|
349
|
+
hydrateReactIsland(resolvedComponent, element, propsRecord);
|
|
1241
350
|
element.dataset.hydrated = "true";
|
|
1242
351
|
return;
|
|
1243
352
|
}
|
|
1244
353
|
if (framework === "svelte") {
|
|
1245
|
-
const { hydrateSvelteIsland
|
|
354
|
+
const { hydrateSvelteIsland, isSvelteComponent } = await import("./chunks/svelte-s0c964kb.js");
|
|
1246
355
|
const resolvedComponent = await resolveComponent?.(framework, componentName) ?? getIslandComponent(registry.svelte?.[componentName]);
|
|
1247
|
-
if (!
|
|
356
|
+
if (!isSvelteComponent(resolvedComponent))
|
|
1248
357
|
return;
|
|
1249
|
-
await hydratePreservingBrowserTranslation(element, () =>
|
|
358
|
+
await hydratePreservingBrowserTranslation(element, () => hydrateSvelteIsland(resolvedComponent, element, propsRecord));
|
|
1250
359
|
element.dataset.hydrated = "true";
|
|
1251
360
|
return;
|
|
1252
361
|
}
|
|
1253
362
|
if (framework === "vue") {
|
|
1254
|
-
const { hydrateVueIsland
|
|
363
|
+
const { hydrateVueIsland, isVueComponent } = await import("./chunks/vue-rdskrnyg.js");
|
|
1255
364
|
const resolvedComponent = await resolveComponent?.(framework, componentName) ?? getIslandComponent(registry.vue?.[componentName]);
|
|
1256
|
-
if (!
|
|
365
|
+
if (!isVueComponent(resolvedComponent))
|
|
1257
366
|
return;
|
|
1258
|
-
await hydratePreservingBrowserTranslation(element, () =>
|
|
367
|
+
await hydratePreservingBrowserTranslation(element, () => hydrateVueIsland(resolvedComponent, element, propsRecord));
|
|
1259
368
|
element.dataset.hydrated = "true";
|
|
1260
369
|
return;
|
|
1261
370
|
}
|
|
1262
371
|
if (framework === "angular") {
|
|
1263
|
-
const { mountAngularIsland
|
|
372
|
+
const { mountAngularIsland, isAngularComponent } = await import("./chunks/islands-xj2n8nwf.js");
|
|
1264
373
|
const resolvedComponent = await resolveComponent?.(framework, componentName) ?? getIslandComponent(registry.angular?.[componentName]);
|
|
1265
374
|
const { islandId } = element.dataset;
|
|
1266
|
-
if (!
|
|
375
|
+
if (!isAngularComponent(resolvedComponent) || !islandId)
|
|
1267
376
|
return;
|
|
1268
|
-
await hydratePreservingBrowserTranslation(element, () =>
|
|
377
|
+
await hydratePreservingBrowserTranslation(element, () => mountAngularIsland(resolvedComponent, element, propsRecord ?? {}, islandId));
|
|
1269
378
|
element.dataset.hydrated = "true";
|
|
1270
379
|
}
|
|
1271
380
|
};
|
|
@@ -1368,5 +477,5 @@ export {
|
|
|
1368
477
|
subscribeIslandStore
|
|
1369
478
|
};
|
|
1370
479
|
|
|
1371
|
-
//# debugId=
|
|
480
|
+
//# debugId=24D0394AB472467064756E2164756E21
|
|
1372
481
|
//# sourceMappingURL=index.js.map
|