@absolutejs/absolute 0.20.0-beta.179 → 0.20.0-beta.180

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.
Files changed (125) hide show
  1. package/CHANGELOG.md +23 -0
  2. package/changelog.json +45 -0
  3. package/dist/angular/browser.js +2 -2
  4. package/dist/angular/browser.js.map +3 -3
  5. package/dist/angular/components/core/streamingSlotRegistrar.js +1 -1
  6. package/dist/angular/components/core/streamingSlotRegistry.js +2 -2
  7. package/dist/angular/index.js +21 -6
  8. package/dist/angular/index.js.map +6 -6
  9. package/dist/angular/server.js +21 -6
  10. package/dist/angular/server.js.map +6 -6
  11. package/dist/build.js +5357 -4945
  12. package/dist/build.js.map +27 -24
  13. package/dist/cli/build-fntmf42w.js +495 -0
  14. package/dist/cli/{buildDepVendor-qvsh6dsj.js → buildDepVendor-qnwfct22.js} +5 -3
  15. package/dist/cli/buildReactServerComponents-fq6mw10d.js +13 -0
  16. package/dist/cli/{compile-p5yv6ecp.js → compile-54rb8szn.js} +94 -125
  17. package/dist/cli/config/server.js +10 -5
  18. package/dist/cli/{dev-2hbcsvkp.js → dev-6s6g5tnk.js} +13 -14
  19. package/dist/cli/{expoProject-1qtw97js.js → expoProject-acgfaj3f.js} +2 -1
  20. package/dist/cli/generatedDir-239r7csr.js +9 -0
  21. package/dist/cli/{index-cksezef8.js → index-0gd30trc.js} +105 -851
  22. package/dist/cli/index-2wvysvjc.js +40 -0
  23. package/dist/cli/index-42xjh6gg.js +282 -0
  24. package/dist/cli/{index-qw98g1p6.js → index-47e8fwha.js} +4 -1
  25. package/dist/cli/index-65kqn88a.js +8 -0
  26. package/dist/cli/{index-2bxfhs32.js → index-6f448d7m.js} +0 -26
  27. package/dist/cli/index-972xxwgj.js +16 -0
  28. package/dist/cli/index-aqe25w4h.js +39 -0
  29. package/dist/cli/index-assqancr.js +51 -0
  30. package/dist/cli/{index-2shf4aya.js → index-c8rcfe5a.js} +4 -6
  31. package/dist/cli/index-cba1cemz.js +8 -0
  32. package/dist/cli/{index-3ff5ztt3.js → index-djkrb7pc.js} +1 -7
  33. package/dist/cli/index-dkfwkpc8.js +138 -0
  34. package/dist/cli/{index-92g14j47.js → index-dw44xa4x.js} +2 -1
  35. package/dist/cli/index-evsnq0n2.js +17 -0
  36. package/dist/cli/index-fxwf3n2v.js +224 -0
  37. package/dist/cli/{index-zyd80s3h.js → index-js2hksgv.js} +21 -295
  38. package/dist/cli/{index-bp60baze.js → index-jyap0bhv.js} +1 -1
  39. package/dist/cli/{index-9dzdbbfc.js → index-kx2d067c.js} +8 -6
  40. package/dist/cli/index-pb31zan6.js +9 -0
  41. package/dist/cli/index-sq0478b0.js +281 -0
  42. package/dist/cli/index-va274tsf.js +7 -0
  43. package/dist/cli/{index-yd672jyq.js → index-w6xsk8cv.js} +4 -1
  44. package/dist/cli/index-w79snsxv.js +461 -0
  45. package/dist/cli/index-x1vvn549.js +835 -0
  46. package/dist/cli/index-xf9sfr8a.js +243 -0
  47. package/dist/cli/index-ycqdxy55.js +754 -0
  48. package/dist/cli/index-z74cqxz0.js +131 -0
  49. package/dist/cli/index.js +10 -9
  50. package/dist/cli/{islands-6zgb7501.js → islands-17tfx8jf.js} +6 -17
  51. package/dist/cli/{ls-0hfx323m.js → ls-0wr74w0b.js} +10 -58
  52. package/dist/cli/{mobile-93vaawcz.js → mobile-hpqpy61f.js} +11 -8
  53. package/dist/cli/{prerender-010z771p.js → prerender-w65xp6h8.js} +2 -1
  54. package/dist/cli/{rewriteImports-z6629aww.js → rewriteImports-np2d2kvc.js} +4 -11
  55. package/dist/cli/rewriteImportsPlugin-c6hcb3x6.js +12 -0
  56. package/dist/cli/{start-asxb79rc.js → start-mbn2zgs2.js} +6 -4
  57. package/dist/cli/staticAnalyzeSpaRoutes-2nev05m1.js +8 -0
  58. package/dist/cli/staticAnalyzeSpaRoutes-6vgzp0rs.js +8 -0
  59. package/dist/cli/staticAnalyzeSpaRoutes-f85q9dqk.js +8 -0
  60. package/dist/cli/staticAnalyzeSpaRoutes-yakmg22g.js +7 -0
  61. package/dist/cli/{typecheck-m2j4tkdk.js → typecheck-488txsfc.js} +92 -18
  62. package/dist/cli/vueCompiler-8bzdmf08.js +7 -0
  63. package/dist/client/chunks/{react-khr6ewhr.js → react-g8r290b8.js} +37 -2
  64. package/dist/client/chunks/react-g8r290b8.js.map +10 -0
  65. package/dist/client/chunks/vue-zcpmka32.js +85 -0
  66. package/dist/client/chunks/vue-zcpmka32.js.map +10 -0
  67. package/dist/client/index.js +58 -10
  68. package/dist/client/index.js.map +4 -4
  69. package/dist/dev/client/handlers/vue.ts +116 -0
  70. package/dist/index.js +2472 -2058
  71. package/dist/index.js.map +26 -23
  72. package/dist/islands/browser.js +2 -2
  73. package/dist/islands/browser.js.map +3 -3
  74. package/dist/islands/index.js +2 -2
  75. package/dist/islands/index.js.map +3 -3
  76. package/dist/react/browser.js +2 -2
  77. package/dist/react/browser.js.map +3 -3
  78. package/dist/react/index.js +42 -11
  79. package/dist/react/index.js.map +10 -10
  80. package/dist/react/server.js +42 -11
  81. package/dist/react/server.js.map +10 -10
  82. package/dist/src/angular/ssrRender.d.ts +2 -2
  83. package/dist/src/angular/staticAnalyzeSpaRoutes.d.ts +6 -1
  84. package/dist/src/build/generateManifest.d.ts +15 -0
  85. package/dist/src/build/manifestKeys.d.ts +22 -0
  86. package/dist/src/cli/add/dependencies.d.ts +1 -1
  87. package/dist/src/cli/scripts/typecheck.d.ts +11 -0
  88. package/dist/src/client/hydrators/react.d.ts +10 -0
  89. package/dist/src/client/hydrators/vue.d.ts +13 -0
  90. package/dist/src/client/islandRuntime.d.ts +1 -1
  91. package/dist/src/core/islandManifest.d.ts +4 -0
  92. package/dist/src/core/islandPageContext.d.ts +8 -2
  93. package/dist/src/core/lookup.d.ts +16 -1
  94. package/dist/src/dev/importCost/instrument.d.ts +1 -1
  95. package/dist/src/dev/manifestKeysRefresher.d.ts +6 -0
  96. package/dist/src/dev/spaRouteRefresh.d.ts +13 -0
  97. package/dist/src/mobile/androidConformance.d.ts +1 -1
  98. package/dist/src/react/staticAnalyzeSpaRoutes.d.ts +6 -1
  99. package/dist/src/svelte/staticAnalyzeSpaRoutes.d.ts +1 -0
  100. package/dist/src/utils/logger.d.ts +5 -0
  101. package/dist/src/utils/spaRouteManifest.d.ts +1 -0
  102. package/dist/src/vue/components/Image.d.ts +4 -4
  103. package/dist/src/vue/components/StreamSlot.d.ts +1 -1
  104. package/dist/src/vue/components/SuspenseSlot.d.ts +2 -2
  105. package/dist/src/vue/staticAnalyzeSpaRoutes.d.ts +4 -0
  106. package/dist/svelte/browser.js +2 -2
  107. package/dist/svelte/browser.js.map +3 -3
  108. package/dist/svelte/index.js +25 -9
  109. package/dist/svelte/index.js.map +8 -8
  110. package/dist/svelte/server.js +25 -9
  111. package/dist/svelte/server.js.map +8 -8
  112. package/dist/types/globals.d.ts +4 -0
  113. package/dist/types/index.d.ts +1 -0
  114. package/dist/types/island.d.ts +1 -1
  115. package/dist/types/manifest.d.ts +25 -0
  116. package/dist/vue/browser.js +2 -2
  117. package/dist/vue/browser.js.map +3 -3
  118. package/dist/vue/index.js +21 -6
  119. package/dist/vue/index.js.map +6 -6
  120. package/dist/vue/server.js +21 -6
  121. package/dist/vue/server.js.map +6 -6
  122. package/package.json +1 -1
  123. package/dist/client/chunks/react-khr6ewhr.js.map +0 -10
  124. package/dist/client/chunks/vue-db6ppn1f.js +0 -32
  125. package/dist/client/chunks/vue-db6ppn1f.js.map +0 -10
@@ -13,11 +13,17 @@ import {
13
13
  } from "./index-t8jmj8w1.js";
14
14
  import {
15
15
  ensureFileRouteModule
16
- } from "./index-qw98g1p6.js";
16
+ } from "./index-47e8fwha.js";
17
+ import"./index-aqe25w4h.js";
18
+ import {
19
+ MANIFEST_KEYS_DECLARATION,
20
+ writeManifestKeysDeclaration
21
+ } from "./index-x1vvn549.js";
17
22
  import {
18
23
  getString,
19
24
  isRecord
20
25
  } from "./index-tx0kx9zx.js";
26
+ import"./index-w6xsk8cv.js";
21
27
  import {
22
28
  DEFAULT_SERVER_ENTRY
23
29
  } from "./index-125cfzvn.js";
@@ -1458,16 +1464,29 @@ var toDeclarationGlob = (entry) => {
1458
1464
  var getProjectDeclarationIncludes = () => [...new Set(getProjectSourceEntries().map(toDeclarationGlob))].map(toGeneratedConfigPath);
1459
1465
  var vueShimPath = null;
1460
1466
  var VUE_SHIM_FILE = "typecheck-vue-shim.d.ts";
1461
- var SKIPPED_VUE_SCAN_DIRECTORIES = new Set(["build", "node_modules"]);
1462
- var collectVueFileNames = (dir) => {
1463
- if (!existsSync3(dir))
1467
+ var SKIPPED_SCAN_DIRECTORIES = new Set([
1468
+ "build",
1469
+ "generated",
1470
+ "node_modules"
1471
+ ]);
1472
+ var isScannedDirectory = (name) => !name.startsWith(".") && !SKIPPED_SCAN_DIRECTORIES.has(name);
1473
+ var walkComponentFiles = (dir, skipped) => {
1474
+ if (!existsSync3(dir) || skipped.has(dir))
1464
1475
  return [];
1465
1476
  return readdirSync2(dir, { withFileTypes: true }).flatMap((entry) => {
1477
+ const path = join2(dir, entry.name);
1466
1478
  if (entry.isDirectory())
1467
- return entry.name.startsWith(".") || SKIPPED_VUE_SCAN_DIRECTORIES.has(entry.name) ? [] : collectVueFileNames(join2(dir, entry.name));
1468
- return entry.name.endsWith(".vue") ? [entry.name] : [];
1479
+ return isScannedDirectory(entry.name) ? walkComponentFiles(path, skipped) : [];
1480
+ return entry.name.endsWith(".vue") || entry.name.endsWith(".svelte") ? [path] : [];
1469
1481
  });
1470
1482
  };
1483
+ var collectComponentFiles = (dir, skipped = new Set) => {
1484
+ const files = walkComponentFiles(dir, skipped);
1485
+ return {
1486
+ svelte: files.filter((file) => file.endsWith(".svelte")),
1487
+ vue: files.filter((file) => file.endsWith(".vue"))
1488
+ };
1489
+ };
1471
1490
  var vueShimSource = (fileNames) => [...new Set(fileNames)].sort().map((fileName) => `declare module ${JSON.stringify(`*/${fileName}`)} {
1472
1491
  import type { DefineComponent } from 'vue';
1473
1492
  const component: DefineComponent<{}, {}, any>;
@@ -1475,14 +1494,62 @@ var vueShimSource = (fileNames) => [...new Set(fileNames)].sort().map((fileName)
1475
1494
  }
1476
1495
  `).join(`
1477
1496
  `);
1478
- var prepareVueShim = async (cacheDir, vueDirs) => {
1479
- const fileNames = vueDirs.flatMap((dir) => collectVueFileNames(resolve4(dir)));
1497
+ var prepareVueShim = async (cacheDir, vueFiles) => {
1498
+ const fileNames = vueFiles.map((file) => parse3(file).base);
1480
1499
  if (fileNames.length === 0)
1481
1500
  return;
1482
1501
  const shimPath = resolve4(cacheDir, VUE_SHIM_FILE);
1483
1502
  await writeFile2(shimPath, vueShimSource(fileNames));
1484
1503
  vueShimPath = shimPath;
1485
1504
  };
1505
+ var svelteShimPath = null;
1506
+ var SVELTE_SHIM_FILE = "typecheck-svelte-shim.d.ts";
1507
+ var svelteShimSource = (fileNames) => [...new Set(fileNames)].sort().map((fileName) => `declare module ${JSON.stringify(`*/${fileName}`)} {
1508
+ import type { SvelteComponent } from 'svelte';
1509
+ import type { LegacyComponentType } from 'svelte/legacy';
1510
+ const component: LegacyComponentType;
1511
+ type component = SvelteComponent;
1512
+ export default component;
1513
+ }
1514
+ `).join(`
1515
+ `);
1516
+ var prepareSvelteShim = async (cacheDir, svelteFiles) => {
1517
+ const fileNames = svelteFiles.map((file) => parse3(file).base);
1518
+ if (fileNames.length === 0)
1519
+ return;
1520
+ const shimPath = resolve4(cacheDir, SVELTE_SHIM_FILE);
1521
+ await writeFile2(shimPath, svelteShimSource(fileNames));
1522
+ svelteShimPath = shimPath;
1523
+ };
1524
+ var isWithin = (dir, path) => {
1525
+ const rel = relative2(dir, path);
1526
+ return rel === "" || !rel.startsWith("..") && !rel.startsWith("/");
1527
+ };
1528
+ var svelteRoots = (projectRoot, svelteDirs, svelteFiles) => {
1529
+ const configured = svelteDirs.map((dir) => resolve4(projectRoot, dir));
1530
+ const strays = svelteFiles.filter((file) => !configured.some((dir) => isWithin(dir, file))).map((file) => dirname3(file));
1531
+ const candidates = [...new Set([...configured, ...strays])].sort((left, right) => left.length - right.length);
1532
+ const roots = candidates.reduce((kept, dir) => kept.some((root) => isWithin(root, dir)) ? kept : [...kept, dir], []);
1533
+ return roots.map((dir) => relative2(projectRoot, dir) || ".");
1534
+ };
1535
+ var manifestKeyDeclarations = [];
1536
+ var MANIFEST_KEYS_EDITOR_HINT = `\x1B[33mnote\x1B[0m asset(manifest, key) keys are checked by this command. For the same check in your editor, add "${MANIFEST_KEYS_DECLARATION}" to include in tsconfig.json.`;
1537
+ var prepareManifestKeys = async (targets) => {
1538
+ const byRoot = new Map;
1539
+ for (const target of targets) {
1540
+ const root = resolve4(target.cwd ?? ".");
1541
+ byRoot.set(root, [...byRoot.get(root) ?? [], target]);
1542
+ }
1543
+ const written = await Promise.all([...byRoot].map(([root, configs]) => writeManifestKeysDeclaration(configs, root)));
1544
+ manifestKeyDeclarations = written.filter((path) => path !== null);
1545
+ const config = readProjectTsconfig();
1546
+ const listed = [
1547
+ ...toStringArray(config.include),
1548
+ ...toStringArray(config.files)
1549
+ ].some((entry) => entry.replace(/^\.\//, "").startsWith(".absolutejs"));
1550
+ if (manifestKeyDeclarations.length > 0 && !listed)
1551
+ console.log(MANIFEST_KEYS_EDITOR_HINT);
1552
+ };
1486
1553
  var svelteDeclarationsReady = false;
1487
1554
  var getTypecheckRootDirs = (cacheDir) => {
1488
1555
  if (!svelteDeclarationsReady)
@@ -1523,7 +1590,8 @@ var buildVueTscCheck = async (cacheDir) => {
1523
1590
  },
1524
1591
  exclude: getProjectTypecheckExcludes(),
1525
1592
  extends: resolve4("tsconfig.json"),
1526
- include: getProjectTypecheckIncludes()
1593
+ include: getProjectTypecheckIncludes(),
1594
+ ...manifestKeyDeclarations.length > 0 ? { files: manifestKeyDeclarations } : {}
1527
1595
  }, null, "\t"));
1528
1596
  const base = [
1529
1597
  vueTscBin,
@@ -1584,7 +1652,11 @@ var TYPECHECK_CONFIG_FILES = {
1584
1652
  };
1585
1653
  var writeTypecheckConfig = async (cacheDir, checker) => {
1586
1654
  const tscConfigPath = join2(cacheDir, TYPECHECK_CONFIG_FILES[checker]);
1587
- const vueShim = checker !== "vue" && vueShimPath !== null ? [vueShimPath] : [];
1655
+ const shim = checker === "vue" ? svelteShimPath : vueShimPath;
1656
+ const shimFiles = [
1657
+ ...shim === null ? [] : [shim],
1658
+ ...manifestKeyDeclarations
1659
+ ];
1588
1660
  await writeFile2(tscConfigPath, JSON.stringify({
1589
1661
  compilerOptions: {
1590
1662
  rootDir: checker === "tsc" ? ".." : parse3(resolve4(".")).root,
@@ -1593,7 +1665,7 @@ var writeTypecheckConfig = async (cacheDir, checker) => {
1593
1665
  exclude: getProjectTypecheckExcludes(),
1594
1666
  extends: resolve4("tsconfig.json"),
1595
1667
  include: getProjectTypecheckIncludes(),
1596
- ...vueShim.length > 0 ? { files: vueShim } : {}
1668
+ ...shimFiles.length > 0 ? { files: shimFiles } : {}
1597
1669
  }, null, "\t"));
1598
1670
  return resolve4(tscConfigPath);
1599
1671
  };
@@ -1730,19 +1802,19 @@ var dedupeVueResult = (results) => {
1730
1802
  var typecheck = async (configPath) => {
1731
1803
  const targets = await getTypecheckTargets(configPath);
1732
1804
  const hasAngular = targets.some((config) => Boolean(config.angularDirectory));
1733
- const hasSvelte = targets.some((config) => Boolean(config.svelteDirectory));
1734
- const hasVue = targets.some((config) => Boolean(config.vueDirectory));
1735
- const svelteDirs = [
1805
+ const configuredSvelteDirs = [
1736
1806
  ...new Set(targets.map((config) => config.svelteDirectory).filter((dir) => typeof dir === "string" && dir.length > 0))
1737
1807
  ];
1738
- const vueDirs = [
1739
- ...new Set(targets.map((config) => config.vueDirectory).filter((dir) => typeof dir === "string" && dir.length > 0))
1740
- ];
1808
+ const componentFiles = collectComponentFiles(resolve4("."), new Set(targets.flatMap((config) => config.buildDirectory ? [resolve4(config.buildDirectory)] : [])));
1809
+ const hasVue = targets.some((config) => Boolean(config.vueDirectory)) || componentFiles.vue.length > 0;
1810
+ const svelteDirs = svelteRoots(resolve4("."), configuredSvelteDirs, componentFiles.svelte);
1811
+ const hasSvelte = svelteDirs.length > 0;
1741
1812
  const angularDirs = [
1742
1813
  ...new Set(targets.map((config) => config.angularDirectory).filter((dir) => typeof dir === "string" && dir.length > 0))
1743
1814
  ];
1744
1815
  const cacheDir = ".absolutejs";
1745
1816
  await mkdir2(cacheDir, { recursive: true });
1817
+ await prepareManifestKeys(targets);
1746
1818
  if (hasSvelte)
1747
1819
  await prepareSvelteDeclarations(svelteDirs);
1748
1820
  for (const config of targets)
@@ -1752,7 +1824,9 @@ var typecheck = async (configPath) => {
1752
1824
  const plainCheck = useBunCheck ? buildBunCheck : buildTscCheck;
1753
1825
  const vueCheck = useBunCheck ? buildVueCheck : buildVueTscCheck;
1754
1826
  if (hasVue)
1755
- await prepareVueShim(cacheDir, vueDirs);
1827
+ await prepareVueShim(cacheDir, componentFiles.vue);
1828
+ if (hasVue && useBunCheck)
1829
+ await prepareSvelteShim(cacheDir, componentFiles.svelte);
1756
1830
  checks.push(plainCheck(cacheDir));
1757
1831
  if (hasVue)
1758
1832
  checks.push(vueCheck(cacheDir));
@@ -0,0 +1,7 @@
1
+ // @bun
2
+ import {
3
+ loadVueCompiler2
4
+ } from "./index-evsnq0n2.js";
5
+ export {
6
+ loadVueCompiler2 as loadVueCompiler
7
+ };
@@ -10,6 +10,7 @@ import {
10
10
  } from "react-dom/client";
11
11
  import { flushSync } from "react-dom";
12
12
  var reactIslandRoots = new WeakMap;
13
+ var reactIslandComponents = new WeakMap;
13
14
  var isPropsRecord = (value) => typeof value === "object" && value !== null;
14
15
  var HOST_REACT_EXPANDO_PREFIXES = [
15
16
  "__reactFiber$",
@@ -31,6 +32,7 @@ var hydrateReactIsland = (component, element, props) => {
31
32
  const existingRoot = reactIslandRoots.get(element);
32
33
  if (existingRoot) {
33
34
  existingRoot.render(isPropsRecord(props) ? createElement(component, props) : createElement(component));
35
+ reactIslandComponents.set(element, component);
34
36
  return;
35
37
  }
36
38
  detachFromHostReactRoot(element);
@@ -50,6 +52,7 @@ var hydrateReactIsland = (component, element, props) => {
50
52
  }
51
53
  if (root !== undefined)
52
54
  reactIslandRoots.set(element, root);
55
+ reactIslandComponents.set(element, component);
53
56
  };
54
57
  if (!isPropsRecord(props)) {
55
58
  hydrate(createElement(component));
@@ -69,12 +72,44 @@ var remountReactIsland = (component, element, props) => {
69
72
  root.render(isPropsRecord(props) ? createElement(component, props) : createElement(component));
70
73
  });
71
74
  reactIslandRoots.set(element, root);
75
+ reactIslandComponents.set(element, component);
76
+ };
77
+ var renderedComponent = (root) => {
78
+ const fiberRoot = root && Reflect.get(root, "_internalRoot");
79
+ const hostFiber = fiberRoot && typeof fiberRoot === "object" ? Reflect.get(fiberRoot, "current") : undefined;
80
+ const child = hostFiber && typeof hostFiber === "object" ? Reflect.get(hostFiber, "child") : undefined;
81
+ return child && typeof child === "object" ? Reflect.get(child, "type") : undefined;
82
+ };
83
+ var refreshReactIslands = (component, elements) => {
84
+ const runtime = window.$RefreshRuntime$;
85
+ const getFamily = runtime?.getFamilyByType;
86
+ if (!runtime || !getFamily)
87
+ return false;
88
+ const family = getFamily(component);
89
+ if (!family)
90
+ return false;
91
+ const sameFamily = elements.every((element) => {
92
+ const previous = reactIslandComponents.get(element);
93
+ return previous !== undefined && getFamily(previous) === family;
94
+ });
95
+ if (!sameFamily)
96
+ return false;
97
+ runtime.performReactRefresh();
98
+ if (family.current !== component)
99
+ return false;
100
+ return elements.every((element) => {
101
+ if (renderedComponent(reactIslandRoots.get(element)) !== component)
102
+ return false;
103
+ reactIslandComponents.set(element, component);
104
+ return true;
105
+ });
72
106
  };
73
107
  export {
74
108
  hydrateReactIsland,
75
109
  isReactComponent,
110
+ refreshReactIslands,
76
111
  remountReactIsland
77
112
  };
78
113
 
79
- //# debugId=566183856C37B0E164756E2164756E21
80
- //# sourceMappingURL=react-khr6ewhr.js.map
114
+ //# debugId=D787D3661C10F48E64756E2164756E21
115
+ //# sourceMappingURL=react-g8r290b8.js.map
@@ -0,0 +1,10 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/client/hydrators/react.ts"],
4
+ "sourcesContent": [
5
+ "import { type ComponentType, createElement, type ReactNode } from 'react';\nimport {\n\tcreateRoot,\n\thydrateRoot,\n\ttype Root as ReactRoot\n} from 'react-dom/client';\nimport { flushSync } from 'react-dom';\nimport { prepareBrowserTranslationHydration } from '../browserTranslation';\n\nconst reactIslandRoots = new WeakMap<HTMLElement, ReactRoot>();\n// The component each island root renders, for Fast Refresh (below).\nconst reactIslandComponents = new WeakMap<HTMLElement, unknown>();\n\nconst isPropsRecord = (value: unknown): value is Record<string, unknown> =>\n\ttypeof value === 'object' && value !== null;\n\n// The island marker is rendered by the host page's React tree as a\n// `dangerouslySetInnerHTML` boundary, so the host root tags it with internal\n// fiber expandos (`__reactFiber$…`, `__reactProps$…`). React refuses to create\n// a second root on a node it already manages that also sets\n// dangerouslySetInnerHTML (\"Cannot use a ref … as a container … if that element\n// also sets dangerouslySetInnerHTML\"). Detaching those expandos hands ownership\n// of the marker (and its opaque SSR children) to the island root before it\n// hydrates. The host root never recurses into the boundary, so it has no fibers\n// for the children and won't reconcile this subtree again.\nconst HOST_REACT_EXPANDO_PREFIXES = [\n\t'__reactFiber$',\n\t'__reactProps$',\n\t'__reactContainer$',\n\t'__reactEvents$',\n\t'__reactListeners$',\n\t'__reactHandles$'\n];\n\nconst detachFromHostReactRoot = (element: HTMLElement) => {\n\tfor (const key of Object.keys(element)) {\n\t\tconst isHostExpando = HOST_REACT_EXPANDO_PREFIXES.some((prefix) =>\n\t\t\tkey.startsWith(prefix)\n\t\t);\n\t\tif (!isHostExpando) continue;\n\t\tReflect.deleteProperty(element, key);\n\t}\n};\n\nexport const hydrateReactIsland = (\n\tcomponent: ComponentType<Record<string, unknown>>,\n\telement: HTMLElement,\n\tprops: unknown\n) => {\n\tconst existingRoot = reactIslandRoots.get(element);\n\tif (existingRoot) {\n\t\texistingRoot.render(\n\t\t\tisPropsRecord(props)\n\t\t\t\t? createElement(component, props)\n\t\t\t\t: createElement(component)\n\t\t);\n\t\treactIslandComponents.set(element, component);\n\n\t\treturn;\n\t}\n\n\tdetachFromHostReactRoot(element);\n\tconst restoreTranslation = prepareBrowserTranslationHydration(element);\n\tconst hydrate = (elementToHydrate: ReactNode) => {\n\t\tlet root: ReactRoot | undefined;\n\t\tconst startHydration = () => {\n\t\t\troot = hydrateRoot(element, elementToHydrate);\n\t\t};\n\t\ttry {\n\t\t\tif (restoreTranslation.hasTranslation) flushSync(startHydration);\n\t\t\telse startHydration();\n\t\t} finally {\n\t\t\trestoreTranslation();\n\t\t}\n\t\tif (root !== undefined) reactIslandRoots.set(element, root);\n\t\treactIslandComponents.set(element, component);\n\t};\n\n\tif (!isPropsRecord(props)) {\n\t\thydrate(createElement(component));\n\n\t\treturn;\n\t}\n\n\thydrate(createElement(component, props));\n};\nexport const isReactComponent = (\n\tvalue: unknown\n): value is ComponentType<Record<string, unknown>> =>\n\ttypeof value === 'function';\n\n/** Dev HMR: replace a hydrated island with a fresh root rendering the\n * rebuilt component. Its local state starts over; island stores keep\n * theirs. A new root rather than `render()` on the old one: the host page\n * may have re-rendered the marker since, re-attaching its own React props\n * to it, and the old root's tree would then be reconciled against nodes\n * React no longer considers its own. */\nexport const remountReactIsland = (\n\tcomponent: ComponentType<Record<string, unknown>>,\n\telement: HTMLElement,\n\tprops: unknown\n) => {\n\ttry {\n\t\treactIslandRoots.get(element)?.unmount();\n\t} catch {\n\t\t// The old tree's nodes may already be gone; the marker is cleared\n\t\t// below either way.\n\t}\n\telement.replaceChildren();\n\tdetachFromHostReactRoot(element);\n\tconst root = createRoot(element);\n\t// Commit now, while the marker carries none of the host root's\n\t// expandos (see detachFromHostReactRoot): a host re-render in between\n\t// re-attaches them and React rejects the marker as a container.\n\tflushSync(() => {\n\t\troot.render(\n\t\t\tisPropsRecord(props)\n\t\t\t\t? createElement(component, props)\n\t\t\t\t: createElement(component)\n\t\t);\n\t});\n\treactIslandRoots.set(element, root);\n\treactIslandComponents.set(element, component);\n};\n\n/* The component an island root rendered in its last commit. */\nconst renderedComponent = (root: ReactRoot | undefined) => {\n\tconst fiberRoot: unknown = root && Reflect.get(root, '_internalRoot');\n\tconst hostFiber: unknown =\n\t\tfiberRoot && typeof fiberRoot === 'object'\n\t\t\t? Reflect.get(fiberRoot, 'current')\n\t\t\t: undefined;\n\tconst child: unknown =\n\t\thostFiber && typeof hostFiber === 'object'\n\t\t\t? Reflect.get(hostFiber, 'child')\n\t\t\t: undefined;\n\n\treturn child && typeof child === 'object'\n\t\t? Reflect.get(child, 'type')\n\t\t: undefined;\n};\n\n/** Dev HMR: hand a rebuilt island component to React Fast Refresh. In dev\n * the island bundles register their components with Fast Refresh, so when\n * the version on screen and the rebuilt one are the same component (one\n * Fast Refresh family), a refresh re-renders the island in place: its hook\n * state stays when its hooks are unchanged and resets when they changed,\n * as on a React page. True when every given island now renders\n * `component`; false sends the caller to remountReactIsland (no Fast\n * Refresh runtime on the page, a component not registered, or a root\n * the refresh did not reach). */\nexport const refreshReactIslands = (\n\tcomponent: unknown,\n\telements: HTMLElement[]\n) => {\n\tconst runtime = window.$RefreshRuntime$;\n\tconst getFamily = runtime?.getFamilyByType;\n\tif (!runtime || !getFamily) return false;\n\tconst family = getFamily(component);\n\tif (!family) return false;\n\tconst sameFamily = elements.every((element) => {\n\t\tconst previous = reactIslandComponents.get(element);\n\n\t\treturn previous !== undefined && getFamily(previous) === family;\n\t});\n\tif (!sameFamily) return false;\n\truntime.performReactRefresh();\n\tif (family.current !== component) return false;\n\n\treturn elements.every((element) => {\n\t\tif (renderedComponent(reactIslandRoots.get(element)) !== component)\n\t\t\treturn false;\n\t\treactIslandComponents.set(element, component);\n\n\t\treturn true;\n\t});\n};\n"
6
+ ],
7
+ "mappings": ";;;;;AAAA;AACA;AAAA;AAAA;AAAA;AAKA;AAGA,IAAM,mBAAmB,IAAI;AAE7B,IAAM,wBAAwB,IAAI;AAElC,IAAM,gBAA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O;AAAA,EACxB,QAAQ,oBAAoB;AAAA,EAC5B,IAAI,OAAO,YAAY;AAAA,IAAW,OAAO;AAAA,EAEzC,OAAO,SAAS,MAAM,CAAC,YAAY;AAAA,IAClC,IAAI,kBAAkB,iBAAiB,IAAI,OAAO,CAAC,MAAM;AAAA,MACxD,OAAO;AAAA,IACR,sBAAsB,IAAI,SAAS,SAAS;AAAA,IAE5C,OAAO;AAAA,GACP;AAAA;",
8
+ "debugId": "D787D3661C10F48E64756E2164756E21",
9
+ "names": []
10
+ }
@@ -0,0 +1,85 @@
1
+ // src/client/hydrators/vue.ts
2
+ import { createApp, createSSRApp, h } from "vue";
3
+ var vueIslandApps = new WeakMap;
4
+ var vueIslandComponents = new WeakMap;
5
+ var isPropsRecord = (value) => typeof value === "object" && value !== null;
6
+ var hydrateVueIsland = (component, element, props) => {
7
+ if (vueIslandApps.has(element)) {
8
+ return;
9
+ }
10
+ const app = createSSRApp({
11
+ render: () => h(component, isPropsRecord(props) ? props : undefined)
12
+ });
13
+ app.mount(element);
14
+ vueIslandApps.set(element, app);
15
+ if (isPropsRecord(component))
16
+ vueIslandComponents.set(element, component);
17
+ };
18
+ var isVueComponent = (value) => typeof value === "function" || isPropsRecord(value);
19
+ var remountVueIsland = (component, element, props) => {
20
+ vueIslandApps.get(element)?.unmount();
21
+ element.replaceChildren();
22
+ const app = createApp({
23
+ render: () => h(component, isPropsRecord(props) ? props : undefined)
24
+ });
25
+ app.mount(element);
26
+ vueIslandApps.set(element, app);
27
+ if (isPropsRecord(component))
28
+ vueIslandComponents.set(element, component);
29
+ };
30
+ var MAX_OPTION_DEPTH = 4;
31
+ var NON_RENDER_KEYS = new Set(["__file", "__hmrId", "render", "ssrRender"]);
32
+ var sameOption = (left, right, depth = 0) => {
33
+ if (left === right)
34
+ return true;
35
+ if (typeof left === "function" && typeof right === "function")
36
+ return left.toString() === right.toString();
37
+ if (!isPropsRecord(left) || !isPropsRecord(right) || depth > MAX_OPTION_DEPTH)
38
+ return false;
39
+ const keys = new Set([...Object.keys(left), ...Object.keys(right)]);
40
+ return [...keys].every((key) => sameOption(left[key], right[key], depth + 1));
41
+ };
42
+ var onlyRenderChanged = (previous, next) => {
43
+ const keys = new Set([...Object.keys(previous), ...Object.keys(next)]);
44
+ return [...keys].filter((key) => !NON_RENDER_KEYS.has(key)).every((key) => sameOption(previous[key], next[key]));
45
+ };
46
+ var hotUpdateVueIslands = (before, component, elements) => {
47
+ const runtime = window.__VUE_HMR_RUNTIME__;
48
+ const after = window.__VUE_HMR_COMPONENTS__;
49
+ if (!runtime || !after || !isPropsRecord(component))
50
+ return false;
51
+ const id = component.__hmrId;
52
+ if (typeof id !== "string")
53
+ return false;
54
+ const rendersIsland = elements.every((element) => {
55
+ const previous = vueIslandComponents.get(element);
56
+ return isPropsRecord(previous) && previous.__hmrId === id;
57
+ });
58
+ if (!rendersIsland)
59
+ return false;
60
+ for (const [componentId, next] of Object.entries(after)) {
61
+ const previous = before[componentId];
62
+ if (previous === next)
63
+ continue;
64
+ if (!isPropsRecord(previous) || !isPropsRecord(next))
65
+ continue;
66
+ if (onlyRenderChanged(previous, next))
67
+ runtime.rerender(componentId, next.render);
68
+ else
69
+ runtime.reload(componentId, next);
70
+ }
71
+ return true;
72
+ };
73
+ var snapshotVueHmrComponents = () => ({
74
+ ...window.__VUE_HMR_COMPONENTS__
75
+ });
76
+ export {
77
+ hotUpdateVueIslands,
78
+ hydrateVueIsland,
79
+ isVueComponent,
80
+ remountVueIsland,
81
+ snapshotVueHmrComponents
82
+ };
83
+
84
+ //# debugId=079B484CC34A6E3564756E2164756E21
85
+ //# sourceMappingURL=vue-zcpmka32.js.map
@@ -0,0 +1,10 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/client/hydrators/vue.ts"],
4
+ "sourcesContent": [
5
+ "import { createApp, createSSRApp, h, type App as VueApp } from 'vue';\n\nconst vueIslandApps = new WeakMap<HTMLElement, VueApp>();\n// The component each island app renders, for hot updates (below).\nconst vueIslandComponents = new WeakMap<HTMLElement, object>();\n\nconst isPropsRecord = (value: unknown): value is Record<string, unknown> =>\n\ttypeof value === 'object' && value !== null;\n\nexport const hydrateVueIsland = (\n\tcomponent: import('vue').Component<Record<string, unknown>>,\n\telement: HTMLElement,\n\tprops: unknown\n) => {\n\tif (vueIslandApps.has(element)) {\n\t\treturn;\n\t}\n\n\tconst app = createSSRApp({\n\t\trender: () => h(component, isPropsRecord(props) ? props : undefined)\n\t});\n\tapp.mount(element);\n\tvueIslandApps.set(element, app);\n\tif (isPropsRecord(component)) vueIslandComponents.set(element, component);\n};\nexport const isVueComponent = (\n\tvalue: unknown\n): value is import('vue').Component<Record<string, unknown>> =>\n\ttypeof value === 'function' || isPropsRecord(value);\n\n/** Dev HMR: replace a hydrated island with a fresh mount of the rebuilt\n * component. Its local state starts over; island stores keep theirs. */\nexport const remountVueIsland = (\n\tcomponent: import('vue').Component<Record<string, unknown>>,\n\telement: HTMLElement,\n\tprops: unknown\n) => {\n\tvueIslandApps.get(element)?.unmount();\n\telement.replaceChildren();\n\tconst app = createApp({\n\t\trender: () => h(component, isPropsRecord(props) ? props : undefined)\n\t});\n\tapp.mount(element);\n\tvueIslandApps.set(element, app);\n\tif (isPropsRecord(component)) vueIslandComponents.set(element, component);\n};\n\n// Component options nest shallowly (props, emits, components).\nconst MAX_OPTION_DEPTH = 4;\nconst NON_RENDER_KEYS = new Set(['__file', '__hmrId', 'render', 'ssrRender']);\n\n/* Whether two compiled versions of a component differ in more than their\n * render function: the same options, setup and script code. Functions\n * compare by source. */\nconst sameOption = (left: unknown, right: unknown, depth = 0): boolean => {\n\tif (left === right) return true;\n\tif (typeof left === 'function' && typeof right === 'function')\n\t\treturn left.toString() === right.toString();\n\tif (\n\t\t!isPropsRecord(left) ||\n\t\t!isPropsRecord(right) ||\n\t\tdepth > MAX_OPTION_DEPTH\n\t)\n\t\treturn false;\n\tconst keys = new Set([...Object.keys(left), ...Object.keys(right)]);\n\n\treturn [...keys].every((key) =>\n\t\tsameOption(left[key], right[key], depth + 1)\n\t);\n};\n\nconst onlyRenderChanged = (\n\tprevious: Record<string, unknown>,\n\tnext: Record<string, unknown>\n) => {\n\tconst keys = new Set([...Object.keys(previous), ...Object.keys(next)]);\n\n\treturn [...keys]\n\t\t.filter((key) => !NON_RENDER_KEYS.has(key))\n\t\t.every((key) => sameOption(previous[key], next[key]));\n};\n\n/** Dev HMR through Vue's own HMR runtime, after the rebuilt island bundle\n * has been imported. Every component of the bundle that changed (the\n * island's own component and any it renders) is updated in place: one\n * whose script is unchanged (a template or style edit) re-renders and\n * keeps its state; one whose script changed reloads and starts its state\n * over, as Vue's HMR does on a page. False when the runtime, the HMR id or\n * the island's current component is missing: the caller re-mounts. */\nexport const hotUpdateVueIslands = (\n\tbefore: Record<string, unknown>,\n\tcomponent: unknown,\n\telements: HTMLElement[]\n) => {\n\tconst runtime = window.__VUE_HMR_RUNTIME__;\n\tconst after = window.__VUE_HMR_COMPONENTS__;\n\tif (!runtime || !after || !isPropsRecord(component)) return false;\n\tconst id = component.__hmrId;\n\tif (typeof id !== 'string') return false;\n\tconst rendersIsland = elements.every((element) => {\n\t\tconst previous = vueIslandComponents.get(element);\n\n\t\treturn isPropsRecord(previous) && previous.__hmrId === id;\n\t});\n\tif (!rendersIsland) return false;\n\tfor (const [componentId, next] of Object.entries(after)) {\n\t\tconst previous = before[componentId];\n\t\tif (previous === next) continue;\n\t\tif (!isPropsRecord(previous) || !isPropsRecord(next)) continue;\n\t\tif (onlyRenderChanged(previous, next))\n\t\t\truntime.rerender(componentId, next.render);\n\t\telse runtime.reload(componentId, next);\n\t}\n\n\treturn true;\n};\n\n/** Dev HMR: the Vue components the page has loaded, by HMR id. Island\n * bundles are compiled with Vue's HMR ids, and evaluating one records\n * each of its components in `window.__VUE_HMR_COMPONENTS__`, replacing\n * the previous version; take this before importing a rebuilt island. */\nexport const snapshotVueHmrComponents = (): Record<string, unknown> => ({\n\t...window.__VUE_HMR_COMPONENTS__\n});\n"
6
+ ],
7
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cAAc,IAAI;AAAA,MAAG;AAAA,IACtD,IAAI,kBAAkB,UAAU,IAAI;AAAA,MACnC,QAAQ,SAAS,aAAa,KAAK,MAAM;AAAA,IACrC;AAAA,cAAQ,OAAO,aAAa,IAAI;AAAA,EACtC;AAAA,EAEA,OAAO;AAAA;AAOD,IAAM,2BAA2B,OAAgC;AAAA,KACpE,OAAO;AACX;",
8
+ "debugId": "079B484CC34A6E3564756E2164756E21",
9
+ "names": []
10
+ }
@@ -33,9 +33,10 @@ var __chunks = (base, ids, nodes, entry) => {
33
33
  __chunkSeen ||= {};
34
34
  __preload(ids[entry], 1);
35
35
  };
36
- __chunks(import.meta.url,["1d3d696r","khr6ewhr","6ewphsvj","db6ppn1f","tcadmgcx","58svs66p","4j1snyh2"],[["./index.js",5],["./chunks/react-khr6ewhr.js",5],["./chunks/svelte-6ewphsvj.js"],["./chunks/vue-db6ppn1f.js"],["./chunks/islands-tcadmgcx.js",5,6],["./chunks/index-58svs66p.js"],["./chunks/index-4j1snyh2.js"]],0);
36
+ __chunks(import.meta.url,["pndrexjd","g8r290b8","6ewphsvj","zcpmka32","tcadmgcx","58svs66p","4j1snyh2"],[["./index.js",5],["./chunks/react-g8r290b8.js",5],["./chunks/svelte-6ewphsvj.js"],["./chunks/vue-zcpmka32.js"],["./chunks/islands-tcadmgcx.js",5,6],["./chunks/index-58svs66p.js"],["./chunks/index-4j1snyh2.js"]],0);
37
37
 
38
38
  // src/core/islandManifest.ts
39
+ var REACT_PAGE_ROOT_EVENT = "absolute:react-page-root";
39
40
  var toIslandFrameworkSegment = (framework) => framework[0]?.toUpperCase() + framework.slice(1);
40
41
  var collectFrameworkIslands = (manifest, prefix) => {
41
42
  const entries = {};
@@ -450,7 +451,7 @@ var hydratePreservingBrowserTranslation = async (element, hydrate) => {
450
451
  var hydrateByFramework = async (registry, framework, componentName, element, props, resolveComponent) => {
451
452
  const propsRecord = isPropsRecord(props) ? props : undefined;
452
453
  if (framework === "react") {
453
- const { hydrateReactIsland, isReactComponent } = await (__preload("khr6ewhr"), import("./chunks/react-khr6ewhr.js"));
454
+ const { hydrateReactIsland, isReactComponent } = await (__preload("g8r290b8"), import("./chunks/react-g8r290b8.js"));
454
455
  const resolvedComponent = await resolveComponent?.(framework, componentName) ?? getIslandComponent(registry.react?.[componentName]);
455
456
  if (!isReactComponent(resolvedComponent))
456
457
  return;
@@ -468,7 +469,7 @@ var hydrateByFramework = async (registry, framework, componentName, element, pro
468
469
  return;
469
470
  }
470
471
  if (framework === "vue") {
471
- const { hydrateVueIsland, isVueComponent } = await (__preload("db6ppn1f"), import("./chunks/vue-db6ppn1f.js"));
472
+ const { hydrateVueIsland, isVueComponent } = await (__preload("zcpmka32"), import("./chunks/vue-zcpmka32.js"));
472
473
  const resolvedComponent = await resolveComponent?.(framework, componentName) ?? getIslandComponent(registry.vue?.[componentName]);
473
474
  if (!isVueComponent(resolvedComponent))
474
475
  return;
@@ -539,7 +540,7 @@ var collectIslandElements = (node) => {
539
540
  };
540
541
  var remountByFramework = async (framework, component, element, props) => {
541
542
  if (framework === "react") {
542
- const { remountReactIsland, isReactComponent } = await (__preload("khr6ewhr"), import("./chunks/react-khr6ewhr.js"));
543
+ const { remountReactIsland, isReactComponent } = await (__preload("g8r290b8"), import("./chunks/react-g8r290b8.js"));
543
544
  if (!isReactComponent(component))
544
545
  return false;
545
546
  remountReactIsland(component, element, props);
@@ -553,7 +554,7 @@ var remountByFramework = async (framework, component, element, props) => {
553
554
  return true;
554
555
  }
555
556
  if (framework === "vue") {
556
- const { remountVueIsland, isVueComponent } = await (__preload("db6ppn1f"), import("./chunks/vue-db6ppn1f.js"));
557
+ const { remountVueIsland, isVueComponent } = await (__preload("zcpmka32"), import("./chunks/vue-zcpmka32.js"));
557
558
  if (!isVueComponent(component))
558
559
  return false;
559
560
  remountVueIsland(component, element, props);
@@ -572,13 +573,37 @@ var remountIslandElement = async (update, component, element) => {
572
573
  return false;
573
574
  }
574
575
  };
576
+ var updateWithFrameworkHmr = async (update, component, hydrated, vueBefore) => {
577
+ if (update.framework === "react") {
578
+ const { refreshReactIslands } = await (__preload("g8r290b8"), import("./chunks/react-g8r290b8.js"));
579
+ return refreshReactIslands(component, hydrated);
580
+ }
581
+ if (update.framework !== "vue" || !vueBefore)
582
+ return false;
583
+ const { hotUpdateVueIslands } = await (__preload("zcpmka32"), import("./chunks/vue-zcpmka32.js"));
584
+ return hotUpdateVueIslands(vueBefore, component, hydrated);
585
+ };
586
+ var updateInPlace = async (update, component, elements, vueBefore) => {
587
+ const hydrated = elements.filter((element) => element.dataset.hydrated === "true");
588
+ if (hydrated.length === 0)
589
+ return false;
590
+ try {
591
+ return await updateWithFrameworkHmr(update, component, hydrated, vueBefore);
592
+ } catch (error) {
593
+ console.warn(`[islands] ${update.framework}:${update.component} could not update in place, re-mounting`, error);
594
+ return false;
595
+ }
596
+ };
575
597
  var applyIslandHotUpdate = async (update) => {
576
598
  const elements = findIslandElements(update.framework, update.component);
577
599
  if (elements.length === 0)
578
600
  return true;
579
601
  if (update.stylePath)
580
602
  swapIslandStylesheet(update.framework, update.component, update.stylePath);
603
+ const vueBefore = update.framework === "vue" ? (await (__preload("zcpmka32"), import("./chunks/vue-zcpmka32.js"))).snapshotVueHmrComponents() : undefined;
581
604
  const loadedModule = await import(update.modulePath);
605
+ if (await updateInPlace(update, loadedModule.default, elements, vueBefore))
606
+ return true;
582
607
  const results = await Promise.all(elements.map((element) => remountIslandElement(update, loadedModule.default, element)));
583
608
  return results.every(Boolean);
584
609
  };
@@ -591,15 +616,27 @@ var applyIslandHotUpdates = async (updates) => {
591
616
  return false;
592
617
  }
593
618
  };
594
- var startIslands = ({
619
+ var waitForReactPageRoot = () => {
620
+ if (Reflect.get(window, "__ABS_ISLAND_HOST__") !== "react")
621
+ return;
622
+ if (window.__REACT_ROOT__ || document.readyState === "complete")
623
+ return;
624
+ return new Promise((resolve) => {
625
+ const done = () => {
626
+ window.removeEventListener(REACT_PAGE_ROOT_EVENT, done);
627
+ window.removeEventListener("load", done);
628
+ resolve();
629
+ };
630
+ window.addEventListener(REACT_PAGE_ROOT_EVENT, done);
631
+ window.addEventListener("load", done);
632
+ });
633
+ };
634
+ var scheduleIslands = ({
595
635
  registry,
596
636
  resolveComponent,
597
637
  root = document.documentElement
598
638
  }) => {
599
639
  const targetRoot = root instanceof Document ? root.documentElement : root;
600
- if (typeof window !== "undefined") {
601
- window.__ABS_ISLAND_HMR__ = applyIslandHotUpdates;
602
- }
603
640
  const observer = typeof IntersectionObserver === "undefined" ? null : new IntersectionObserver((entries) => {
604
641
  for (const entry of entries) {
605
642
  if (!entry.isIntersecting)
@@ -630,6 +667,17 @@ var startIslands = ({
630
667
  subtree: true
631
668
  });
632
669
  };
670
+ var startIslands = (options) => {
671
+ if (typeof window !== "undefined") {
672
+ window.__ABS_ISLAND_HMR__ = applyIslandHotUpdates;
673
+ }
674
+ const pageRoot = typeof window === "undefined" ? undefined : waitForReactPageRoot();
675
+ if (pageRoot) {
676
+ pageRoot.then(() => scheduleIslands(options));
677
+ return;
678
+ }
679
+ scheduleIslands(options);
680
+ };
633
681
  // src/utils/formActionProtocol.ts
634
682
  var ACTION_ERROR_ATTRIBUTE = "data-action-error";
635
683
  var ACTION_FORM_ATTRIBUTE = "data-absolute-action";
@@ -800,5 +848,5 @@ export {
800
848
  subscribeIslandStore
801
849
  };
802
850
 
803
- //# debugId=598BD8F9E704CD7A64756E2164756E21
851
+ //# debugId=ABCC00A159C9E47464756E2164756E21
804
852
  //# sourceMappingURL=index.js.map