@absolutejs/absolute 0.20.0-beta.0 → 0.20.0-beta.10

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 (118) hide show
  1. package/README.md +45 -0
  2. package/dist/angular/components/core/streamingSlotRegistrar.js +1 -1
  3. package/dist/angular/components/core/streamingSlotRegistry.js +2 -2
  4. package/dist/angular/index.js +354 -22
  5. package/dist/angular/index.js.map +9 -6
  6. package/dist/angular/server.js +354 -22
  7. package/dist/angular/server.js.map +9 -6
  8. package/dist/build.js +742 -359
  9. package/dist/build.js.map +26 -24
  10. package/dist/cli/config/server.js +2 -2
  11. package/dist/cli/index.js +16105 -8429
  12. package/dist/dev/client/cssUtils.ts +112 -41
  13. package/dist/dev/client/handlers/html.ts +75 -15
  14. package/dist/dev/client/handlers/htmx.ts +43 -8
  15. package/dist/dev/client/handlers/react.ts +114 -32
  16. package/dist/dev/client/handlers/rebuild.ts +38 -8
  17. package/dist/dev/client/handlers/svelte.ts +33 -50
  18. package/dist/dev/client/handlers/vue.ts +36 -45
  19. package/dist/dev/client/hmrClient.ts +38 -6
  20. package/dist/dev/client/hmrTiming.ts +148 -0
  21. package/dist/dev/serverBootstrap.js +20 -11
  22. package/dist/index.js +1728 -864
  23. package/dist/index.js.map +38 -33
  24. package/dist/mobile/browser.js +14 -1
  25. package/dist/mobile/browser.js.map +3 -3
  26. package/dist/mobile/index.js +4853 -279
  27. package/dist/mobile/index.js.map +34 -7
  28. package/dist/mobile/remoteMacAgentEntry.js +29 -0
  29. package/dist/mobile/shellAuth.js +43 -0
  30. package/dist/mobile/shellBootstrap.js +581 -0
  31. package/dist/mobile/shellSync.js +74 -0
  32. package/dist/react/index.js +16 -3
  33. package/dist/react/index.js.map +4 -4
  34. package/dist/react/jsxDevRuntimeCompat.js +22 -2
  35. package/dist/react/jsxDevRuntimeCompat.js.map +5 -4
  36. package/dist/react/jsxRuntimeCompat.js +90 -0
  37. package/dist/react/jsxRuntimeCompat.js.map +10 -0
  38. package/dist/react/server.js +16 -3
  39. package/dist/react/server.js.map +4 -4
  40. package/dist/src/angular/pageHandler.d.ts +3 -0
  41. package/dist/src/build/compileVue.d.ts +1 -1
  42. package/dist/src/build/pwa.d.ts +15 -0
  43. package/dist/src/build/resolveBuildMode.d.ts +7 -0
  44. package/dist/src/cli/config/server.d.ts +1 -1
  45. package/dist/src/cli/scripts/dev.d.ts +4 -1
  46. package/dist/src/cli/scripts/mobile.d.ts +1 -0
  47. package/dist/src/cli/utils.d.ts +2 -2
  48. package/dist/src/core/build.d.ts +1 -1
  49. package/dist/src/core/pageHandlers.d.ts +11 -2
  50. package/dist/src/core/prepare.d.ts +6 -0
  51. package/dist/src/dev/clientManager.d.ts +9 -0
  52. package/dist/src/dev/configResolver.d.ts +2 -0
  53. package/dist/src/dev/moduleMapper.d.ts +1 -1
  54. package/dist/src/dev/moduleServer.d.ts +2 -1
  55. package/dist/src/dev/pathUtils.d.ts +1 -1
  56. package/dist/src/dev/reactComponentClassifier.d.ts +1 -1
  57. package/dist/src/mobile/androidConformance.d.ts +42 -0
  58. package/dist/src/mobile/androidEmulatorController.d.ts +105 -0
  59. package/dist/src/mobile/androidNativeWatcher.d.ts +19 -0
  60. package/dist/src/mobile/androidRelease.d.ts +51 -0
  61. package/dist/src/mobile/androidWebView.d.ts +46 -0
  62. package/dist/src/mobile/associationFiles.d.ts +49 -0
  63. package/dist/src/mobile/buildMetadata.d.ts +10 -0
  64. package/dist/src/mobile/buildPipeline.d.ts +9 -0
  65. package/dist/src/mobile/buildRelease.d.ts +24 -0
  66. package/dist/src/mobile/capacitorBundle.d.ts +42 -0
  67. package/dist/src/mobile/capacitorProject.d.ts +9 -0
  68. package/dist/src/mobile/client.d.ts +5 -1
  69. package/dist/src/mobile/config.d.ts +17 -0
  70. package/dist/src/mobile/emulatorDoctor.d.ts +25 -0
  71. package/dist/src/mobile/emulatorInstaller.d.ts +41 -0
  72. package/dist/src/mobile/index.d.ts +19 -0
  73. package/dist/src/mobile/iosConformance.d.ts +15 -0
  74. package/dist/src/mobile/iosNativeWatcher.d.ts +19 -0
  75. package/dist/src/mobile/iosRelease.d.ts +61 -0
  76. package/dist/src/mobile/iosSimulatorController.d.ts +89 -0
  77. package/dist/src/mobile/materializedBundle.d.ts +14 -0
  78. package/dist/src/mobile/nativeAuth.d.ts +17 -0
  79. package/dist/src/mobile/nativeBackgroundSync.d.ts +4 -0
  80. package/dist/src/mobile/nativeDeepLinks.d.ts +5 -0
  81. package/dist/src/mobile/releaseArtifact.d.ts +3 -0
  82. package/dist/src/mobile/releaseDoctor.d.ts +13 -0
  83. package/dist/src/mobile/releasePublisher.d.ts +130 -0
  84. package/dist/src/mobile/remoteMacAgent.d.ts +2 -0
  85. package/dist/src/mobile/remoteMacAgentEntry.d.ts +1 -0
  86. package/dist/src/mobile/remoteMacProtocol.d.ts +114 -0
  87. package/dist/src/mobile/remoteMacWire.d.ts +2 -0
  88. package/dist/src/mobile/routeMatcher.d.ts +3 -0
  89. package/dist/src/mobile/routeMetadataTransform.d.ts +13 -0
  90. package/dist/src/mobile/shellAuth.d.ts +13 -0
  91. package/dist/src/mobile/shellBootstrap.d.ts +18 -0
  92. package/dist/src/mobile/shellSync.d.ts +19 -0
  93. package/dist/src/mobile/staticDocument.d.ts +5 -0
  94. package/dist/src/mobile/transport.d.ts +43 -0
  95. package/dist/src/plugins/hmr.d.ts +3 -0
  96. package/dist/src/plugins/imageOptimizer.d.ts +1 -1
  97. package/dist/src/react/hooks/useMediaQuery.d.ts +1 -1
  98. package/dist/src/react/jsxDevRuntimeCompat.d.ts +1 -1
  99. package/dist/src/react/jsxRuntimeCompat.d.ts +7 -0
  100. package/dist/src/react/pageHandler.d.ts +3 -0
  101. package/dist/src/svelte/pageHandler.d.ts +3 -0
  102. package/dist/src/utils/loadConfig.d.ts +2 -0
  103. package/dist/src/utils/logger.d.ts +2 -0
  104. package/dist/src/utils/userAgentFunctions.d.ts +1 -1
  105. package/dist/src/vue/pageHandler.d.ts +3 -0
  106. package/dist/svelte/index.js +325 -23
  107. package/dist/svelte/index.js.map +8 -5
  108. package/dist/svelte/server.js +320 -18
  109. package/dist/svelte/server.js.map +8 -5
  110. package/dist/types/build.d.ts +59 -0
  111. package/dist/types/cli.d.ts +2 -0
  112. package/dist/types/globals.d.ts +14 -0
  113. package/dist/types/messages.d.ts +12 -0
  114. package/dist/vue/index.js +325 -23
  115. package/dist/vue/index.js.map +8 -5
  116. package/dist/vue/server.js +320 -18
  117. package/dist/vue/server.js.map +8 -5
  118. package/package.json +52 -8
package/dist/build.js CHANGED
@@ -214,6 +214,19 @@ var colors2, frameworkColors, formatPath = (filePath) => {
214
214
  const errorMsg = error instanceof Error ? error.message : error;
215
215
  const fullMessage = `${colors2.red}error${colors2.reset} ${message}${errorMsg ? `: ${errorMsg}` : ""}`;
216
216
  console.error(`${timestamp} ${tag} ${fullMessage}`);
217
+ }, logHmrClientUpdate = (path, framework, duration, target, serverMs, clientMs, outcome = "applied", kind) => {
218
+ const timestamp = `${colors2.dim}${formatTimestamp()}${colors2.reset}`;
219
+ const targetLabel = target.startsWith("capacitor-") ? target.slice("capacitor-".length) : target;
220
+ const tag = `${colors2.cyan}[hmr:${targetLabel}]${colors2.reset}`;
221
+ const pathColor = framework ? getFrameworkColor(framework) : colors2.white;
222
+ const breakdown = serverMs === undefined || clientMs === undefined ? "" : `; server ${serverMs}ms, client ${clientMs}ms`;
223
+ let action = "failed after";
224
+ if (outcome === "applied")
225
+ action = "applied in";
226
+ else if (outcome === "reloaded")
227
+ action = "falling back to reload after";
228
+ const kindLabel = kind ? `${kind} ` : "";
229
+ console.log(`${timestamp} ${tag} ${framework ?? "update"} ${kindLabel}${pathColor}${formatPath(path)}${colors2.reset} ${colors2.dim}${action} ${duration}ms${breakdown}${colors2.reset}`);
217
230
  }, logHmrUpdate = (path, framework, duration) => {
218
231
  log("hmr update", { duration, framework, path });
219
232
  }, logInfo = (message) => {
@@ -956,19 +969,35 @@ var indexContentCache, resolveDevClientDir = () => {
956
969
  `}
957
970
  `,
958
971
  `// Attempt hydration with error handling`,
972
+ `const shouldClientRender = window.__ABSOLUTE_PAGE_RENDER_MODE__ === 'client';`,
959
973
  `// Use document (not document.body) when the page renders <html><head><body>`,
960
974
  `// to avoid "In HTML, <html> cannot be a child of <body>" hydration error`,
961
- `const container = typeof document !== 'undefined' ? document : null;`,
975
+ `const container = typeof document !== 'undefined' ? (shouldClientRender ? document.getElementById('root') : document) : null;`,
962
976
  `if (!container) {`,
963
977
  ` throw new Error('React root container not found: document is null');`,
964
978
  `}
965
979
  `,
980
+ ...isDev ? [
981
+ `// Stock Bun cannot emit Fast Refresh registrations yet. Give the dev client`,
982
+ `// a deterministic remount path that still imports only the changed module.`,
983
+ `window.__ABS_REACT_REMOUNT__ = (nextModule) => {`,
984
+ ` const NextPageComponent = resolvePageComponent(nextModule, ['default', '${pascalComponentName}', '${componentName}']);`,
985
+ ` const element = createElement(ErrorBoundary, null, createElement(NextPageComponent, mergedProps));`,
986
+ ` if (window.__REACT_ROOT__) {`,
987
+ ` window.__REACT_ROOT__.render(element);`,
988
+ ` return;`,
989
+ ` }`,
990
+ ` const nextRoot = createRoot(container);`,
991
+ ` nextRoot.render(element);`,
992
+ ` window.__REACT_ROOT__ = nextRoot;`,
993
+ `};
994
+ `
995
+ ] : [],
966
996
  `// Guard: only hydrate on first load. During HMR re-imports, skip hydration`,
967
997
  `// so React Fast Refresh can swap components in-place and preserve state.`,
968
998
  `if (!window.__REACT_ROOT__) {`,
969
999
  ` let root;`,
970
1000
  ` // Mobile data envelopes and dirty HMR pages have no matching SSR markup.`,
971
- ` const shouldClientRender = window.__ABSOLUTE_PAGE_RENDER_MODE__ === 'client';`,
972
1001
  ` if (window.__SSR_DIRTY__ || shouldClientRender) {`,
973
1002
  ` root = createRoot(container);`,
974
1003
  ` root.render(${isDev ? `createElement(ErrorBoundary, null, createElement(PageComponent, mergedProps))` : `createElement(PageComponent, mergedProps)`});`,
@@ -1048,6 +1077,15 @@ var indexContentCache, resolveDevClientDir = () => {
1048
1077
  ` };`,
1049
1078
  ` }`,
1050
1079
  `}`,
1080
+ `if (typeof window !== 'undefined') {`,
1081
+ ` window.__ABSOLUTE_PAGE_READY__ = Promise.resolve();`,
1082
+ ` window.__ABSOLUTE_PAGE_DISPOSE__ = function() {`,
1083
+ ` if (window.__REACT_ROOT__ && typeof window.__REACT_ROOT__.unmount === 'function') {`,
1084
+ ` window.__REACT_ROOT__.unmount();`,
1085
+ ` }`,
1086
+ ` window.__REACT_ROOT__ = null;`,
1087
+ ` };`,
1088
+ `}`,
1051
1089
  ...isDev ? [
1052
1090
  `
1053
1091
  // Pre-warm: import the page module from the module server`,
@@ -12035,9 +12073,23 @@ var ENTITY_DECORATOR_RE, IMPORT_RE, TOP_LEVEL_DECL_RE, extractAllTopLevelNames =
12035
12073
  // Send a server-side ack so the dev terminal can log the
12036
12074
  // full HMR latency (server compile + WS hop + client apply +
12037
12075
  // CD pulse) rather than just the server-side compile time.
12038
- const __ng_hmr_ack = (tier, applyMs, error) => {
12076
+ const __ng_hmr_ack = (tier, applyMs, error, updateId) => {
12039
12077
  try {
12040
12078
  const ws = globalThis.__HMR_WS__;
12079
+ const target = globalThis.__ABS_HMR_TARGET__ || 'web';
12080
+ const timing = {
12081
+ clientMs: Math.round(applyMs),
12082
+ duration: Math.round(applyMs),
12083
+ kind: 'component',
12084
+ outcome: error ? 'failed' : 'applied',
12085
+ serverMs: 0,
12086
+ target,
12087
+ updateId
12088
+ };
12089
+ globalThis.__ABS_HMR_LAST_APPLY__ = timing;
12090
+ const applies = globalThis.__ABS_HMR_APPLIES__ || (globalThis.__ABS_HMR_APPLIES__ = []);
12091
+ applies.push(timing);
12092
+ if (applies.length > 50) applies.splice(0, applies.length - 50);
12041
12093
  if (ws && ws.readyState === 1) {
12042
12094
  ws.send(JSON.stringify({
12043
12095
  type: 'angular:hmr-ack',
@@ -12045,7 +12097,9 @@ var ENTITY_DECORATOR_RE, IMPORT_RE, TOP_LEVEL_DECL_RE, extractAllTopLevelNames =
12045
12097
  className: ${JSON.stringify(className)},
12046
12098
  tier,
12047
12099
  applyMs,
12048
- error
12100
+ error,
12101
+ target,
12102
+ updateId
12049
12103
  }));
12050
12104
  }
12051
12105
  } catch {}
@@ -12069,16 +12123,16 @@ var ENTITY_DECORATOR_RE, IMPORT_RE, TOP_LEVEL_DECL_RE, extractAllTopLevelNames =
12069
12123
  import.meta,
12070
12124
  __ng_hmr_id
12071
12125
  );
12072
- __ng_hmr_ack('tier-0', performance.now() - t0);
12126
+ __ng_hmr_ack('tier-0', performance.now() - t0, undefined, t);
12073
12127
  } catch (err) {
12074
12128
  console.error('[abs-hmr] \u0275\u0275replaceMetadata threw for ${className}:', err);
12075
- __ng_hmr_ack('tier-0', performance.now() - t0, String(err && err.message || err));
12129
+ __ng_hmr_ack('tier-0', performance.now() - t0, String(err && err.message || err), t);
12076
12130
  }
12077
12131
  } else {
12078
12132
  // Non-component entity (pipe / directive / service) \u2014 no
12079
12133
  // LView tree to walk, just apply the prototype patch.
12080
12134
  u.default(${className}, [core]);
12081
- __ng_hmr_ack('tier-0', performance.now() - t0);
12135
+ __ng_hmr_ack('tier-0', performance.now() - t0, undefined, t);
12082
12136
  }
12083
12137
  };
12084
12138
  // Tier 1 remount: structural changes (new ctor params / new field
@@ -12110,10 +12164,10 @@ var ENTITY_DECORATOR_RE, IMPORT_RE, TOP_LEVEL_DECL_RE, extractAllTopLevelNames =
12110
12164
  ${JSON.stringify(className)}
12111
12165
  );
12112
12166
  if (mySeq !== __ng_hmr_seq) return; // newer event arrived during remount
12113
- __ng_hmr_ack('tier-1a', performance.now() - t0);
12167
+ __ng_hmr_ack('tier-1a', performance.now() - t0, undefined, t);
12114
12168
  } catch (err) {
12115
12169
  console.error('[abs-hmr] remount threw for ${className}:', err);
12116
- __ng_hmr_ack('tier-1a', performance.now() - t0, String(err && err.message || err));
12170
+ __ng_hmr_ack('tier-1a', performance.now() - t0, String(err && err.message || err), t);
12117
12171
  }
12118
12172
  } else {
12119
12173
  // No remount helper installed (older absolutejs runtime, or
@@ -12260,6 +12314,13 @@ var init_cleanup = __esm(() => {
12260
12314
  init_generatedDir();
12261
12315
  });
12262
12316
 
12317
+ // src/build/resolveBuildMode.ts
12318
+ var resolveBuildDevelopmentMode = (mode, nodeEnv) => mode === "development" || mode === undefined && nodeEnv === "development", resolveVueFeatureFlags = (development) => ({
12319
+ __VUE_OPTIONS_API__: "true",
12320
+ __VUE_PROD_DEVTOOLS__: development ? "true" : "false",
12321
+ __VUE_PROD_HYDRATION_MISMATCH_DETAILS__: development ? "true" : "false"
12322
+ });
12323
+
12263
12324
  // src/utils/commonAncestor.ts
12264
12325
  var exports_commonAncestor = {};
12265
12326
  __export(exports_commonAncestor, {
@@ -12303,7 +12364,8 @@ var heldLocks, HELD_LOCKS_ENV = "ABSOLUTE_HELD_BUILD_DIRECTORY_LOCKS", exitHandl
12303
12364
  });
12304
12365
  process.on("uncaughtException", (err) => {
12305
12366
  releaseAllSync();
12306
- throw err;
12367
+ console.error(err);
12368
+ process.exit(1);
12307
12369
  });
12308
12370
  }, isAlreadyExistsError = (error) => error instanceof Error && ("code" in error) && Reflect.get(error, "code") === "EEXIST", lockPathForBuildDirectory = (buildDirectory) => join23(dirname12(buildDirectory), ".absolutejs", "build.lock"), readHeldLockEnv = () => new Set((process.env[HELD_LOCKS_ENV] ?? "").split(`
12309
12371
  `).filter((entry) => entry.length > 0)), writeHeldLockEnv = (locks) => {
@@ -12797,13 +12859,135 @@ var isTestSourcePath = (file) => {
12797
12859
  return normalized.includes("/__tests__/") || /\.(?:test|spec)\.[cm]?[jt]sx?$/.test(normalized);
12798
12860
  };
12799
12861
 
12862
+ // src/build/pwa.ts
12863
+ import { mkdir as mkdir5, rm as rm4, writeFile as writeFile5 } from "fs/promises";
12864
+ import { dirname as dirname13, join as join24 } from "path";
12865
+ var BOOTSTRAP_PUBLIC_PATH = "/__absolute/pwa/bootstrap.js", BOOTSTRAP_MARKER = "data-absolute-pwa", publicFilePath = (value, fallback, field) => {
12866
+ const input = value ?? fallback;
12867
+ if (!input.startsWith("/") || input.startsWith("//")) {
12868
+ throw new TypeError(`${field} must be an absolute same-origin path.`);
12869
+ }
12870
+ let url;
12871
+ try {
12872
+ url = new URL(input, "https://absolute.invalid");
12873
+ } catch {
12874
+ throw new TypeError(`${field} must be an absolute same-origin path.`);
12875
+ }
12876
+ if (url.origin !== "https://absolute.invalid" || url.search || url.hash || url.pathname === "/") {
12877
+ throw new TypeError(`${field} must be a file path without query or hash.`);
12878
+ }
12879
+ for (const part of input.split("/")) {
12880
+ let decoded;
12881
+ try {
12882
+ decoded = decodeURIComponent(part);
12883
+ } catch {
12884
+ throw new TypeError(`${field} contains invalid URL encoding.`);
12885
+ }
12886
+ if (decoded === "." || decoded === ".." || decoded.includes("\\")) {
12887
+ throw new TypeError(`${field} must not contain traversal segments.`);
12888
+ }
12889
+ }
12890
+ return url.pathname;
12891
+ }, destinationFor = (buildPath, publicPath) => join24(buildPath, ...publicPath.split("/").filter(Boolean)), bootstrapEntrySource = ({
12892
+ clientModule,
12893
+ manifestPath,
12894
+ serviceWorkerPath,
12895
+ sync
12896
+ }) => `import { registerServiceWorker } from ${JSON.stringify(clientModule)};
12897
+ ${manifestPath ? `const manifest = document.querySelector('link[rel="manifest"]') ?? document.createElement('link');
12898
+ manifest.setAttribute('rel', 'manifest');
12899
+ manifest.setAttribute('href', ${JSON.stringify(manifestPath)});
12900
+ if (!manifest.isConnected) document.head.append(manifest);
12901
+ ` : ""}await registerServiceWorker(${JSON.stringify(serviceWorkerPath)}, {
12902
+ deferUntilLoad: false${sync ? `,
12903
+ sync: ${JSON.stringify(sync === true ? {} : sync)}` : ""}
12904
+ });
12905
+ `, injectionSource = () => `if (typeof window !== 'undefined') {
12906
+ await import(new URL(${JSON.stringify(BOOTSTRAP_PUBLIC_PATH)}, window.location.origin).href);
12907
+ }
12908
+ `, injectPwaBootstrapHtml = (html) => {
12909
+ if (html.includes(BOOTSTRAP_MARKER))
12910
+ return html;
12911
+ const script = `<script type="module" src="${BOOTSTRAP_PUBLIC_PATH}" ${BOOTSTRAP_MARKER}></script>`;
12912
+ const closingHead = html.toLowerCase().indexOf("</head>");
12913
+ if (closingHead >= 0) {
12914
+ return `${html.slice(0, closingHead)}${script}${html.slice(closingHead)}`;
12915
+ }
12916
+ return `${script}${html}`;
12917
+ }, materializeAbsolutePwa = async ({
12918
+ buildPath,
12919
+ config,
12920
+ generatedRoot,
12921
+ write: write2 = true
12922
+ }) => {
12923
+ const serviceWorkerPath = publicFilePath(config.serviceWorkerPath, "/sw.js", "pwa.serviceWorkerPath");
12924
+ if (serviceWorkerPath.slice(1).includes("/")) {
12925
+ throw new TypeError("pwa.serviceWorkerPath must be a root-level file so its default service-worker scope covers the application.");
12926
+ }
12927
+ const manifestPath = config.manifest ? publicFilePath(config.manifest.path, "/manifest.webmanifest", "pwa.manifest.path") : undefined;
12928
+ const artifacts = {
12929
+ bootstrapBanner: injectionSource(),
12930
+ bootstrapPublicPath: BOOTSTRAP_PUBLIC_PATH,
12931
+ manifestPath,
12932
+ serviceWorkerPath
12933
+ };
12934
+ if (!write2)
12935
+ return artifacts;
12936
+ const { createWebAppManifest, pushServiceWorker } = await import("@absolutejs/pwa");
12937
+ const workerDestination = destinationFor(buildPath, serviceWorkerPath);
12938
+ await mkdir5(dirname13(workerDestination), { recursive: true });
12939
+ await writeFile5(workerDestination, `${pushServiceWorker({
12940
+ ...config.serviceWorker ?? {},
12941
+ sync: Boolean(config.sync)
12942
+ })}
12943
+ `);
12944
+ if (config.manifest && manifestPath) {
12945
+ const { path: _path, ...manifestConfig } = config.manifest;
12946
+ const manifestDestination = destinationFor(buildPath, manifestPath);
12947
+ await mkdir5(dirname13(manifestDestination), { recursive: true });
12948
+ await writeFile5(manifestDestination, `${JSON.stringify(createWebAppManifest(manifestConfig), null, "\t")}
12949
+ `);
12950
+ }
12951
+ const generatedDirectory = join24(generatedRoot, "pwa");
12952
+ const bootstrapEntry = join24(generatedDirectory, "bootstrap.ts");
12953
+ const clientModule = Bun.resolveSync("@absolutejs/pwa/client", import.meta.dir);
12954
+ await mkdir5(generatedDirectory, { recursive: true });
12955
+ await writeFile5(bootstrapEntry, bootstrapEntrySource({
12956
+ clientModule,
12957
+ manifestPath,
12958
+ serviceWorkerPath,
12959
+ sync: config.sync
12960
+ }));
12961
+ const browserDirectory = destinationFor(buildPath, "/__absolute/pwa");
12962
+ await rm4(browserDirectory, { force: true, recursive: true });
12963
+ await mkdir5(browserDirectory, { recursive: true });
12964
+ const result = await Bun.build({
12965
+ entrypoints: [bootstrapEntry],
12966
+ format: "esm",
12967
+ minify: true,
12968
+ naming: {
12969
+ asset: "asset-[hash].[ext]",
12970
+ chunk: "chunk-[hash].[ext]",
12971
+ entry: "bootstrap.js"
12972
+ },
12973
+ outdir: browserDirectory,
12974
+ splitting: true,
12975
+ target: "browser"
12976
+ });
12977
+ if (!result.success) {
12978
+ throw new AggregateError(result.logs, "Failed to build the AbsoluteJS PWA bootstrap.");
12979
+ }
12980
+ return artifacts;
12981
+ };
12982
+ var init_pwa = () => {};
12983
+
12800
12984
  // src/build/scanVueSsrOnlyPages.ts
12801
12985
  var exports_scanVueSsrOnlyPages = {};
12802
12986
  __export(exports_scanVueSsrOnlyPages, {
12803
12987
  scanVueSsrOnlyPages: () => scanVueSsrOnlyPages
12804
12988
  });
12805
12989
  import { readdirSync as readdirSync2, readFileSync as readFileSync13 } from "fs";
12806
- import { join as join24 } from "path";
12990
+ import { join as join25 } from "path";
12807
12991
  import ts8 from "typescript";
12808
12992
  var SKIP_DIRS2, SOURCE_EXTENSIONS2, getScriptKind3 = (filePath) => {
12809
12993
  if (filePath.endsWith(".tsx"))
@@ -12836,9 +13020,9 @@ var SKIP_DIRS2, SOURCE_EXTENSIONS2, getScriptKind3 = (filePath) => {
12836
13020
  continue;
12837
13021
  if (entry.name.startsWith("."))
12838
13022
  continue;
12839
- stack.push(join24(dir, entry.name));
13023
+ stack.push(join25(dir, entry.name));
12840
13024
  } else if (entry.isFile() && hasSourceExtension2(entry.name)) {
12841
- out.push(join24(dir, entry.name));
13025
+ out.push(join25(dir, entry.name));
12842
13026
  }
12843
13027
  }
12844
13028
  }
@@ -12950,7 +13134,7 @@ var init_scanVueSsrOnlyPages = __esm(() => {
12950
13134
 
12951
13135
  // src/build/scanAngularHandlerCalls.ts
12952
13136
  import { readdirSync as readdirSync3, readFileSync as readFileSync14 } from "fs";
12953
- import { join as join25 } from "path";
13137
+ import { join as join26 } from "path";
12954
13138
  import ts9 from "typescript";
12955
13139
  var ELYSIA_ROUTE_METHODS2, SKIP_DIRS3, SOURCE_EXTENSIONS3, SERVER_ENTRY_COPY_PREFIX = ".absolutejs-hmr-", getScriptKind4 = (filePath) => {
12956
13140
  if (filePath.endsWith(".tsx"))
@@ -12983,9 +13167,9 @@ var ELYSIA_ROUTE_METHODS2, SKIP_DIRS3, SOURCE_EXTENSIONS3, SERVER_ENTRY_COPY_PRE
12983
13167
  continue;
12984
13168
  if (entry.name.startsWith("."))
12985
13169
  continue;
12986
- stack.push(join25(dir, entry.name));
13170
+ stack.push(join26(dir, entry.name));
12987
13171
  } else if (entry.isFile() && !entry.name.startsWith(SERVER_ENTRY_COPY_PREFIX) && hasSourceExtension3(entry.name)) {
12988
- out.push(join25(dir, entry.name));
13172
+ out.push(join26(dir, entry.name));
12989
13173
  }
12990
13174
  }
12991
13175
  }
@@ -13100,7 +13284,7 @@ var init_scanAngularHandlerCalls = __esm(() => {
13100
13284
 
13101
13285
  // src/build/scanAngularPageRoutes.ts
13102
13286
  import { readdirSync as readdirSync4, readFileSync as readFileSync15 } from "fs";
13103
- import { basename as basename9, join as join26 } from "path";
13287
+ import { basename as basename9, join as join27 } from "path";
13104
13288
  import ts10 from "typescript";
13105
13289
  var SOURCE_EXTENSIONS4, SKIP_DIRS4, hasSourceExtension4 = (filePath) => {
13106
13290
  const idx = filePath.lastIndexOf(".");
@@ -13140,9 +13324,9 @@ var SOURCE_EXTENSIONS4, SKIP_DIRS4, hasSourceExtension4 = (filePath) => {
13140
13324
  continue;
13141
13325
  if (entry.name.startsWith("."))
13142
13326
  continue;
13143
- stack.push(join26(dir, entry.name));
13327
+ stack.push(join27(dir, entry.name));
13144
13328
  } else if (entry.isFile() && isPageFile(entry.name)) {
13145
- out.push(join26(dir, entry.name));
13329
+ out.push(join27(dir, entry.name));
13146
13330
  }
13147
13331
  }
13148
13332
  }
@@ -13219,7 +13403,7 @@ __export(exports_parseAngularConfigImports, {
13219
13403
  parseAngularProvidersImport: () => parseAngularProvidersImport
13220
13404
  });
13221
13405
  import { existsSync as existsSync20, readFileSync as readFileSync16 } from "fs";
13222
- import { dirname as dirname13, isAbsolute as isAbsolute3, join as join27 } from "path";
13406
+ import { dirname as dirname14, isAbsolute as isAbsolute3, join as join28 } from "path";
13223
13407
  import ts11 from "typescript";
13224
13408
  var findDefineConfigCall = (sf) => {
13225
13409
  let result = null;
@@ -13274,15 +13458,15 @@ var findDefineConfigCall = (sf) => {
13274
13458
  }, resolveConfigPath = (projectRoot) => {
13275
13459
  const envOverride = process.env.ABSOLUTE_CONFIG;
13276
13460
  if (envOverride) {
13277
- const resolved = isAbsolute3(envOverride) ? envOverride : join27(projectRoot, envOverride);
13461
+ const resolved = isAbsolute3(envOverride) ? envOverride : join28(projectRoot, envOverride);
13278
13462
  if (existsSync20(resolved))
13279
13463
  return resolved;
13280
13464
  }
13281
13465
  const candidates = [
13282
- join27(projectRoot, "absolute.config.ts"),
13283
- join27(projectRoot, "absolute.config.mts"),
13284
- join27(projectRoot, "absolute.config.js"),
13285
- join27(projectRoot, "absolute.config.mjs")
13466
+ join28(projectRoot, "absolute.config.ts"),
13467
+ join28(projectRoot, "absolute.config.mts"),
13468
+ join28(projectRoot, "absolute.config.js"),
13469
+ join28(projectRoot, "absolute.config.mjs")
13286
13470
  ];
13287
13471
  for (const candidate of candidates) {
13288
13472
  if (existsSync20(candidate))
@@ -13314,8 +13498,8 @@ var findDefineConfigCall = (sf) => {
13314
13498
  const importInfo = findImportForBinding(sf, binding);
13315
13499
  if (!importInfo)
13316
13500
  return null;
13317
- const configDir2 = dirname13(configPath2);
13318
- const absolutePath = importInfo.source.startsWith(".") ? join27(configDir2, importInfo.source).replace(/\.[cm]?[tj]sx?$/, "") : isAbsolute3(importInfo.source) ? importInfo.source.replace(/\.[cm]?[tj]sx?$/, "") : importInfo.source;
13501
+ const configDir2 = dirname14(configPath2);
13502
+ const absolutePath = importInfo.source.startsWith(".") ? join28(configDir2, importInfo.source).replace(/\.[cm]?[tj]sx?$/, "") : isAbsolute3(importInfo.source) ? importInfo.source.replace(/\.[cm]?[tj]sx?$/, "") : importInfo.source;
13319
13503
  return {
13320
13504
  absolutePath,
13321
13505
  bindingName: binding,
@@ -13464,10 +13648,10 @@ __export(exports_compileSvelte, {
13464
13648
  clearSvelteCompilerCache: () => clearSvelteCompilerCache
13465
13649
  });
13466
13650
  import { existsSync as existsSync21 } from "fs";
13467
- import { mkdir as mkdir5, stat as stat2 } from "fs/promises";
13651
+ import { mkdir as mkdir6, stat as stat2 } from "fs/promises";
13468
13652
  import {
13469
- dirname as dirname14,
13470
- join as join28,
13653
+ dirname as dirname15,
13654
+ join as join29,
13471
13655
  basename as basename10,
13472
13656
  extname as extname7,
13473
13657
  resolve as resolve20,
@@ -13515,7 +13699,7 @@ var resolveDevClientDir2 = () => {
13515
13699
  }, resolveRelativeModule2 = async (spec, from) => {
13516
13700
  if (!spec.startsWith("."))
13517
13701
  return null;
13518
- const basePath = resolve20(dirname14(from), spec);
13702
+ const basePath = resolve20(dirname15(from), spec);
13519
13703
  const candidates = [
13520
13704
  basePath,
13521
13705
  `${basePath}.ts`,
@@ -13526,14 +13710,14 @@ var resolveDevClientDir2 = () => {
13526
13710
  `${basePath}.svelte`,
13527
13711
  `${basePath}.svelte.ts`,
13528
13712
  `${basePath}.svelte.js`,
13529
- join28(basePath, "index.ts"),
13530
- join28(basePath, "index.js"),
13531
- join28(basePath, "index.mjs"),
13532
- join28(basePath, "index.cjs"),
13533
- join28(basePath, "index.json"),
13534
- join28(basePath, "index.svelte"),
13535
- join28(basePath, "index.svelte.ts"),
13536
- join28(basePath, "index.svelte.js")
13713
+ join29(basePath, "index.ts"),
13714
+ join29(basePath, "index.js"),
13715
+ join29(basePath, "index.mjs"),
13716
+ join29(basePath, "index.cjs"),
13717
+ join29(basePath, "index.json"),
13718
+ join29(basePath, "index.svelte"),
13719
+ join29(basePath, "index.svelte.ts"),
13720
+ join29(basePath, "index.svelte.js")
13537
13721
  ];
13538
13722
  const checks = await Promise.all(candidates.map(exists));
13539
13723
  return candidates.find((_2, index) => checks[index]) ?? null;
@@ -13542,7 +13726,7 @@ var resolveDevClientDir2 = () => {
13542
13726
  const resolved = resolvePackageImport(spec);
13543
13727
  return resolved && /\.svelte(\.(?:ts|js))?$/.test(resolved) ? resolved : null;
13544
13728
  }
13545
- const basePath = resolve20(dirname14(from), spec);
13729
+ const basePath = resolve20(dirname15(from), spec);
13546
13730
  const explicit = /\.(svelte|svelte\.(?:ts|js))$/.test(basePath);
13547
13731
  if (!explicit) {
13548
13732
  const extensions = [".svelte", ".svelte.ts", ".svelte.js"];
@@ -13572,10 +13756,10 @@ var resolveDevClientDir2 = () => {
13572
13756
  }, compileSvelte = async (entryPoints, svelteRoot, cache = new Map, isDev2 = false, stylePreprocessors) => {
13573
13757
  const { compile, compileModule, preprocess } = await import("svelte/compiler");
13574
13758
  const generatedDir = getFrameworkGeneratedDir("svelte");
13575
- const clientDir = join28(generatedDir, "client");
13576
- const indexDir = join28(generatedDir, "indexes");
13577
- const serverDir = join28(generatedDir, "server");
13578
- await Promise.all([clientDir, indexDir, serverDir].map((dir) => mkdir5(dir, { recursive: true })));
13759
+ const clientDir = join29(generatedDir, "client");
13760
+ const indexDir = join29(generatedDir, "indexes");
13761
+ const serverDir = join29(generatedDir, "server");
13762
+ await Promise.all([clientDir, indexDir, serverDir].map((dir) => mkdir6(dir, { recursive: true })));
13579
13763
  const dev = env.NODE_ENV !== "production";
13580
13764
  const build = async (src) => {
13581
13765
  const memoized = cache.get(src);
@@ -13602,8 +13786,8 @@ var resolveDevClientDir2 = () => {
13602
13786
  const preprocessedClient = isModule ? loweredClientSource.code : (await preprocess(loweredClientSource.code, svelteStylePreprocessor)).code;
13603
13787
  const transpiledServer = src.endsWith(".ts") || src.endsWith(".svelte.ts") ? transpiler3.transformSync(preprocessedServer) : preprocessedServer;
13604
13788
  const transpiledClient = src.endsWith(".ts") || src.endsWith(".svelte.ts") ? transpiler3.transformSync(preprocessedClient) : preprocessedClient;
13605
- const rawRel = dirname14(relative11(svelteRoot, src)).replace(/\\/g, "/");
13606
- const relDir = rawRel.startsWith("..") ? `_ext/${relative11(process.cwd(), dirname14(src)).replace(/\\/g, "/")}` : rawRel;
13789
+ const rawRel = dirname15(relative11(svelteRoot, src)).replace(/\\/g, "/");
13790
+ const relDir = rawRel.startsWith("..") ? `_ext/${relative11(process.cwd(), dirname15(src)).replace(/\\/g, "/")}` : rawRel;
13607
13791
  const baseName = basename10(src).replace(/\.svelte(\.(ts|js))?$/, "");
13608
13792
  const importPaths = Array.from(transpiledServer.matchAll(/from\s+['"]([^'"]+)['"]/g)).map((match) => match[1]).filter((path) => path !== undefined);
13609
13793
  const resolvedModuleImports = await Promise.all(importPaths.map((importPath) => resolveRelativeModule2(importPath, src)));
@@ -13612,8 +13796,8 @@ var resolveDevClientDir2 = () => {
13612
13796
  const childBuilt = await Promise.all(childSources.map((child) => build(child)));
13613
13797
  const hasAwaitSlotFromChildren = childBuilt.some((child) => child.hasAwaitSlot);
13614
13798
  const externalRewrites = new Map;
13615
- const ssrOutputDir = dirname14(join28(serverDir, relDir, `${baseName}.js`));
13616
- const clientOutputDir = dirname14(join28(clientDir, relDir, `${baseName}.js`));
13799
+ const ssrOutputDir = dirname15(join29(serverDir, relDir, `${baseName}.js`));
13800
+ const clientOutputDir = dirname15(join29(clientDir, relDir, `${baseName}.js`));
13617
13801
  for (let idx = 0;idx < importPaths.length; idx++) {
13618
13802
  const rawSpec = importPaths[idx];
13619
13803
  if (!rawSpec)
@@ -13678,11 +13862,11 @@ var resolveDevClientDir2 = () => {
13678
13862
  code += islandMetadataExports;
13679
13863
  return { code, map: compiledJs.map };
13680
13864
  };
13681
- const ssrPath = join28(serverDir, relDir, `${baseName}.js`);
13682
- const clientPath = join28(clientDir, relDir, `${baseName}.js`);
13865
+ const ssrPath = join29(serverDir, relDir, `${baseName}.js`);
13866
+ const clientPath = join29(clientDir, relDir, `${baseName}.js`);
13683
13867
  await Promise.all([
13684
- mkdir5(dirname14(ssrPath), { recursive: true }),
13685
- mkdir5(dirname14(clientPath), { recursive: true })
13868
+ mkdir6(dirname15(ssrPath), { recursive: true }),
13869
+ mkdir6(dirname15(clientPath), { recursive: true })
13686
13870
  ]);
13687
13871
  const inlineMap = (map) => map ? `
13688
13872
  //# sourceMappingURL=data:application/json;base64,${Buffer.from(JSON.stringify(map)).toString("base64")}
@@ -13717,10 +13901,10 @@ var resolveDevClientDir2 = () => {
13717
13901
  const roots = await Promise.all(entryPoints.map(build));
13718
13902
  const componentRoots = roots.filter((root) => !root.isModule);
13719
13903
  await Promise.all(componentRoots.map(async ({ client, hasAwaitSlot }) => {
13720
- const relClientDir = dirname14(relative11(clientDir, client));
13904
+ const relClientDir = dirname15(relative11(clientDir, client));
13721
13905
  const name = basename10(client, extname7(client));
13722
- const indexPath = join28(indexDir, relClientDir, `${name}.js`);
13723
- const importRaw = relative11(dirname14(indexPath), client).split(sep2).join("/");
13906
+ const indexPath = join29(indexDir, relClientDir, `${name}.js`);
13907
+ const importRaw = relative11(dirname15(indexPath), client).split(sep2).join("/");
13724
13908
  const importPath = importRaw.startsWith(".") || importRaw.startsWith("/") ? importRaw : `./${importRaw}`;
13725
13909
  const hmrImports = isDev2 ? `window.__HMR_FRAMEWORK__ = "svelte";
13726
13910
  import "${hmrClientPath3}";
@@ -13731,8 +13915,9 @@ import { hydrate, mount, unmount } from "svelte";
13731
13915
  var initialProps = (typeof window !== "undefined" && window.__INITIAL_PROPS__) ? window.__INITIAL_PROPS__ : {};
13732
13916
  var isHMR = typeof window !== "undefined" && window.__SVELTE_COMPONENT__ !== undefined;
13733
13917
  var isSsrDirty = typeof window !== "undefined" && window.__SSR_DIRTY__;
13918
+ var isClientRender = typeof window !== "undefined" && window.__ABSOLUTE_PAGE_RENDER_MODE__ === "client";
13734
13919
  var hasIslandHtml = false;
13735
- var shouldHydrate = typeof window === "undefined" ? false : ${hasAwaitSlot ? "false" : "true"};
13920
+ var shouldHydrate = typeof window === "undefined" || isClientRender ? false : ${hasAwaitSlot ? "false" : "true"};
13736
13921
  var component;
13737
13922
  var target = document.getElementById(${JSON.stringify(SVELTE_PAGE_ROOT_ID)}) || document.body;
13738
13923
 
@@ -13763,6 +13948,8 @@ if (isHMR) {
13763
13948
  }
13764
13949
  component = mount(Component, { target, props: mergedProps });
13765
13950
  window.__HMR_PRESERVED_STATE__ = undefined;
13951
+ } else if (isClientRender) {
13952
+ component = mount(Component, { target, props: initialProps });
13766
13953
  } else if (!shouldHydrate) {
13767
13954
  component = undefined;
13768
13955
  } else if (isSsrDirty || hasIslandHtml) {
@@ -13774,6 +13961,13 @@ if (isHMR) {
13774
13961
  if (typeof window !== "undefined") {
13775
13962
  window.__SVELTE_COMPONENT__ = component;
13776
13963
  window.__SVELTE_UNMOUNT__ = function() { if (component) { unmount(component); } };
13964
+ window.__ABSOLUTE_PAGE_READY__ = Promise.resolve();
13965
+ window.__ABSOLUTE_PAGE_DISPOSE__ = function() {
13966
+ if (component) { unmount(component); }
13967
+ component = undefined;
13968
+ window.__SVELTE_COMPONENT__ = undefined;
13969
+ window.__SVELTE_UNMOUNT__ = undefined;
13970
+ };
13777
13971
  window.__SVELTE_REMOUNT__ = function(props) {
13778
13972
  if (typeof window.__SVELTE_UNMOUNT__ === "function") {
13779
13973
  try { window.__SVELTE_UNMOUNT__(); } catch (err) { /* ignore */ }
@@ -13799,14 +13993,14 @@ if (typeof window !== "undefined") {
13799
13993
  setTimeout(releaseStreamingSlots, 0);
13800
13994
  }
13801
13995
  }`;
13802
- await mkdir5(dirname14(indexPath), { recursive: true });
13996
+ await mkdir6(dirname15(indexPath), { recursive: true });
13803
13997
  return write2(indexPath, bootstrap);
13804
13998
  }));
13805
13999
  return {
13806
14000
  svelteClientPaths: roots.map(({ client }) => client),
13807
14001
  svelteIndexPaths: componentRoots.map(({ client }) => {
13808
- const rel = dirname14(relative11(clientDir, client));
13809
- return join28(indexDir, rel, basename10(client));
14002
+ const rel = dirname15(relative11(clientDir, client));
14003
+ return join29(indexDir, rel, basename10(client));
13810
14004
  }),
13811
14005
  svelteServerPaths: roots.map(({ ssr }) => ssr)
13812
14006
  };
@@ -13821,7 +14015,7 @@ var init_compileSvelte = __esm(() => {
13821
14015
  init_lowerAwaitSlotSyntax();
13822
14016
  init_renderToReadableStream();
13823
14017
  devClientDir2 = resolveDevClientDir2();
13824
- hmrClientPath3 = join28(devClientDir2, "hmrClient.ts").replace(/\\/g, "/");
14018
+ hmrClientPath3 = join29(devClientDir2, "hmrClient.ts").replace(/\\/g, "/");
13825
14019
  persistentCache = new Map;
13826
14020
  sourceHashCache = new Map;
13827
14021
  transpiler3 = new Transpiler2({ loader: "ts", target: "browser" });
@@ -14299,12 +14493,12 @@ __export(exports_compileVue, {
14299
14493
  clearVueHmrCaches: () => clearVueHmrCaches
14300
14494
  });
14301
14495
  import { existsSync as existsSync22, readFileSync as readFileSync18, realpathSync as realpathSync2 } from "fs";
14302
- import { mkdir as mkdir6 } from "fs/promises";
14496
+ import { mkdir as mkdir7 } from "fs/promises";
14303
14497
  import {
14304
14498
  basename as basename11,
14305
- dirname as dirname15,
14499
+ dirname as dirname16,
14306
14500
  isAbsolute as isAbsolute4,
14307
- join as join29,
14501
+ join as join30,
14308
14502
  relative as relative12,
14309
14503
  resolve as resolve21
14310
14504
  } from "path";
@@ -14368,7 +14562,7 @@ var resolveDevClientDir3 = () => {
14368
14562
  visited.add(resolved);
14369
14563
  const importRegex = /@import\s+(?:url\(\s*)?(['"])(\.{1,2}\/[^'"]+)\1\s*\)?\s*;?/g;
14370
14564
  return cssContent.replace(importRegex, (match, _quote, relPath) => {
14371
- const importedPath = resolve21(dirname15(cssFilePath), relPath);
14565
+ const importedPath = resolve21(dirname16(cssFilePath), relPath);
14372
14566
  if (!existsSync22(importedPath))
14373
14567
  return match;
14374
14568
  const importedContent = readFileSync18(importedPath, "utf-8");
@@ -14490,12 +14684,12 @@ const ${localName} = (source) => ${importedName}(
14490
14684
  const childComponentPaths = importPaths.filter((path) => path.startsWith(".") && path.endsWith(".vue"));
14491
14685
  const packageComponentPaths = Array.from(resolvedPackageVueImports.entries());
14492
14686
  const helperModulePaths = importPaths.filter((path) => path.startsWith(".") && !path.endsWith(".vue") && !isStylePath(path));
14493
- const stylePathsImported = importPaths.filter((path) => (path.startsWith(".") || isAbsolute4(path)) && isStylePath(path)).map((path) => isAbsolute4(path) ? path : resolve21(dirname15(sourceFilePath), path));
14687
+ const stylePathsImported = importPaths.filter((path) => (path.startsWith(".") || isAbsolute4(path)) && isStylePath(path)).map((path) => isAbsolute4(path) ? path : resolve21(dirname16(sourceFilePath), path));
14494
14688
  for (const stylePath of stylePathsImported) {
14495
14689
  addStyleImporter(sourceFilePath, stylePath);
14496
14690
  }
14497
14691
  const childBuildResults = await Promise.all([
14498
- ...childComponentPaths.map((relativeChildPath) => compileVueFile(resolve21(dirname15(sourceFilePath), relativeChildPath), outputDirs, cacheMap, false, vueRootDir, compiler, stylePreprocessors)),
14692
+ ...childComponentPaths.map((relativeChildPath) => compileVueFile(resolve21(dirname16(sourceFilePath), relativeChildPath), outputDirs, cacheMap, false, vueRootDir, compiler, stylePreprocessors)),
14499
14693
  ...packageComponentPaths.map(([, absolutePath]) => compileVueFile(absolutePath, outputDirs, cacheMap, false, vueRootDir, compiler, stylePreprocessors))
14500
14694
  ]);
14501
14695
  const hasScript = descriptor.script || descriptor.scriptSetup;
@@ -14510,7 +14704,7 @@ const ${localName} = (source) => ${importedName}(
14510
14704
  sourceMap: true
14511
14705
  }) : { bindings: {}, content: "export default {};", map: undefined };
14512
14706
  const strippedScript = stripExports2(compiledScript.content);
14513
- const sourceDir = dirname15(sourceFilePath);
14707
+ const sourceDir = dirname16(sourceFilePath);
14514
14708
  const transpiledScript = transpiler4.transformSync(strippedScript).replace(/(['"])(\.{1,2}\/[^'"]+)(['"])/g, (_2, quoteStart, relativeImport, quoteEnd) => `${quoteStart}${toJs(relativeImport, sourceDir)}${quoteEnd}`);
14515
14709
  const packageImportRewrites = new Map;
14516
14710
  for (const [bareImport, absolutePath] of packageComponentPaths) {
@@ -14555,8 +14749,8 @@ const ${localName} = (source) => ${importedName}(
14555
14749
  ];
14556
14750
  let cssOutputPaths = [];
14557
14751
  if (isEntryPoint && allCss.length) {
14558
- const cssOutputFile = join29(outputDirs.css, `${toKebab(fileBaseName)}-compiled.css`);
14559
- await mkdir6(dirname15(cssOutputFile), { recursive: true });
14752
+ const cssOutputFile = join30(outputDirs.css, `${toKebab(fileBaseName)}-compiled.css`);
14753
+ await mkdir7(dirname16(cssOutputFile), { recursive: true });
14560
14754
  await write3(cssOutputFile, allCss.join(`
14561
14755
  `));
14562
14756
  cssOutputPaths = [cssOutputFile];
@@ -14586,21 +14780,21 @@ if (typeof __VUE_HMR_RUNTIME__ !== 'undefined') {
14586
14780
  };
14587
14781
  const clientCode = assembleModule(generateRenderFunction(false), "render", true) + islandMetadataExports;
14588
14782
  const serverCode = wrapServerAsyncComponentLoader(assembleModule(generateRenderFunction(true), "ssrRender", false)) + islandMetadataExports;
14589
- const clientOutputPath = join29(outputDirs.client, `${relativeWithoutExtension}.js`);
14590
- const serverOutputPath = join29(outputDirs.server, `${relativeWithoutExtension}.js`);
14783
+ const clientOutputPath = join30(outputDirs.client, `${relativeWithoutExtension}.js`);
14784
+ const serverOutputPath = join30(outputDirs.server, `${relativeWithoutExtension}.js`);
14591
14785
  const rewritePackageImports = (code, outputPath, mode) => {
14592
14786
  let result2 = code;
14593
14787
  for (const [bareImport, paths] of packageImportRewrites) {
14594
14788
  const targetPath = mode === "server" ? paths.server : paths.client;
14595
- let rel = relative12(dirname15(outputPath), targetPath).replace(/\\/g, "/");
14789
+ let rel = relative12(dirname16(outputPath), targetPath).replace(/\\/g, "/");
14596
14790
  if (!rel.startsWith("."))
14597
14791
  rel = `./${rel}`;
14598
14792
  result2 = result2.replaceAll(bareImport, rel);
14599
14793
  }
14600
14794
  return result2;
14601
14795
  };
14602
- await mkdir6(dirname15(clientOutputPath), { recursive: true });
14603
- await mkdir6(dirname15(serverOutputPath), { recursive: true });
14796
+ await mkdir7(dirname16(clientOutputPath), { recursive: true });
14797
+ await mkdir7(dirname16(serverOutputPath), { recursive: true });
14604
14798
  const clientFinal = rewritePackageImports(clientCode, clientOutputPath, "client");
14605
14799
  const serverFinal = rewritePackageImports(serverCode, serverOutputPath, "server");
14606
14800
  const inlineSourceMapFor = (finalContent) => {
@@ -14623,7 +14817,7 @@ if (typeof __VUE_HMR_RUNTIME__ !== 'undefined') {
14623
14817
  serverPath: serverOutputPath,
14624
14818
  spaRoutes: spaRoutes.length > 0 ? spaRoutes : undefined,
14625
14819
  tsHelperPaths: [
14626
- ...helperModulePaths.map((helper) => resolveHelperTsPath(dirname15(sourceFilePath), helper)),
14820
+ ...helperModulePaths.map((helper) => resolveHelperTsPath(dirname16(sourceFilePath), helper)),
14627
14821
  ...childBuildResults.flatMap((child) => child.tsHelperPaths)
14628
14822
  ]
14629
14823
  };
@@ -14633,15 +14827,15 @@ if (typeof __VUE_HMR_RUNTIME__ !== 'undefined') {
14633
14827
  }, compileVue = async (entryPoints, vueRootDir, isDev2 = false, stylePreprocessors, ssrOnlyEntries) => {
14634
14828
  const compiler = await loadVueCompiler();
14635
14829
  const generatedDir = getFrameworkGeneratedDir("vue");
14636
- const clientOutputDir = join29(generatedDir, "client");
14637
- const indexOutputDir = join29(generatedDir, "indexes");
14638
- const serverOutputDir = join29(generatedDir, "server");
14639
- const cssOutputDir = join29(generatedDir, "compiled");
14830
+ const clientOutputDir = join30(generatedDir, "client");
14831
+ const indexOutputDir = join30(generatedDir, "indexes");
14832
+ const serverOutputDir = join30(generatedDir, "server");
14833
+ const cssOutputDir = join30(generatedDir, "compiled");
14640
14834
  await Promise.all([
14641
- mkdir6(clientOutputDir, { recursive: true }),
14642
- mkdir6(indexOutputDir, { recursive: true }),
14643
- mkdir6(serverOutputDir, { recursive: true }),
14644
- mkdir6(cssOutputDir, { recursive: true })
14835
+ mkdir7(clientOutputDir, { recursive: true }),
14836
+ mkdir7(indexOutputDir, { recursive: true }),
14837
+ mkdir7(serverOutputDir, { recursive: true }),
14838
+ mkdir7(cssOutputDir, { recursive: true })
14645
14839
  ]);
14646
14840
  const buildCache = new Map;
14647
14841
  const allTsHelperPaths = new Set;
@@ -14663,7 +14857,7 @@ if (typeof __VUE_HMR_RUNTIME__ !== 'undefined') {
14663
14857
  });
14664
14858
  const routes = parseVueSpaRoutes(descriptor.script?.content ?? "");
14665
14859
  for (const { importPath } of routes) {
14666
- const childPath = resolve21(dirname15(entryPath), importPath);
14860
+ const childPath = resolve21(dirname16(entryPath), importPath);
14667
14861
  if (expanded.has(childPath) || !existsSync22(childPath)) {
14668
14862
  continue;
14669
14863
  }
@@ -14693,16 +14887,16 @@ if (typeof __VUE_HMR_RUNTIME__ !== 'undefined') {
14693
14887
  };
14694
14888
  }
14695
14889
  const entryBaseName = basename11(entryPath, ".vue");
14696
- const indexOutputFile = join29(indexOutputDir, `${entryBaseName}.js`);
14697
- const clientOutputFile = join29(clientOutputDir, relative12(vueRootDir, entryPath).replace(/\\/g, "/").replace(/\.vue$/, ".js"));
14698
- await mkdir6(dirname15(indexOutputFile), { recursive: true });
14890
+ const indexOutputFile = join30(indexOutputDir, `${entryBaseName}.js`);
14891
+ const clientOutputFile = join30(clientOutputDir, relative12(vueRootDir, entryPath).replace(/\\/g, "/").replace(/\.vue$/, ".js"));
14892
+ await mkdir7(dirname16(indexOutputFile), { recursive: true });
14699
14893
  const vueHmrImports = isDev2 ? [
14700
14894
  `window.__HMR_FRAMEWORK__ = "vue";`,
14701
14895
  `import "${hmrClientPath4}";`
14702
14896
  ] : [];
14703
14897
  await write3(indexOutputFile, [
14704
14898
  ...vueHmrImports,
14705
- `import Comp, * as PageModule from "${relative12(dirname15(indexOutputFile), clientOutputFile).replace(/\\/g, "/")}";`,
14899
+ `import Comp, * as PageModule from "${relative12(dirname16(indexOutputFile), clientOutputFile).replace(/\\/g, "/")}";`,
14706
14900
  'import { createSSRApp, createApp } from "vue";',
14707
14901
  "",
14708
14902
  "// HMR State Preservation: Check for preserved state from HMR",
@@ -14749,7 +14943,8 @@ if (typeof __VUE_HMR_RUNTIME__ !== 'undefined') {
14749
14943
  "// client-side navigation after mount.",
14750
14944
  'const isHMR = typeof window !== "undefined" && sessionStorage.getItem("__HMR_ACTIVE__");',
14751
14945
  'const isSsrDirty = typeof window !== "undefined" && window.__SSR_DIRTY__;',
14752
- 'const shouldHydrate = typeof window === "undefined" ? false : !(isHMR || isSsrDirty || hasSpaRoutes);',
14946
+ 'const isClientRender = typeof window !== "undefined" && window.__ABSOLUTE_PAGE_RENDER_MODE__ === "client";',
14947
+ 'const shouldHydrate = typeof window === "undefined" ? false : !(isHMR || isSsrDirty || hasSpaRoutes || isClientRender);',
14753
14948
  "const app = shouldHydrate ? createSSRApp(Comp, mergedProps) : createApp(Comp, mergedProps);",
14754
14949
  "",
14755
14950
  "async function bootstrapApp() {",
@@ -14767,11 +14962,17 @@ if (typeof __VUE_HMR_RUNTIME__ !== 'undefined') {
14767
14962
  " }",
14768
14963
  ' app.mount("#root");',
14769
14964
  "}",
14770
- "bootstrapApp();",
14965
+ "const absolutePageReady = bootstrapApp();",
14771
14966
  "",
14772
14967
  "// Store app instance for HMR - used for manual component updates",
14773
14968
  'if (typeof window !== "undefined") {',
14774
14969
  " window.__VUE_APP__ = app;",
14970
+ " window.__ABSOLUTE_PAGE_READY__ = absolutePageReady;",
14971
+ " window.__ABSOLUTE_PAGE_DISPOSE__ = async function() {",
14972
+ " await absolutePageReady;",
14973
+ " app.unmount();",
14974
+ " window.__VUE_APP__ = undefined;",
14975
+ " };",
14775
14976
  "}",
14776
14977
  "",
14777
14978
  "// Post-mount: Apply preserved state to reactive refs in component tree",
@@ -14857,7 +15058,7 @@ if (typeof __VUE_HMR_RUNTIME__ !== 'undefined') {
14857
15058
  if (!tsPath)
14858
15059
  continue;
14859
15060
  const sourceCode = await file2(tsPath).text();
14860
- const helperDir = dirname15(tsPath);
15061
+ const helperDir = dirname16(tsPath);
14861
15062
  for (const dep of extractImports(sourceCode)) {
14862
15063
  if (!dep.startsWith(".") || isStylePath(dep) || dep.endsWith(".vue")) {
14863
15064
  continue;
@@ -14876,10 +15077,10 @@ if (typeof __VUE_HMR_RUNTIME__ !== 'undefined') {
14876
15077
  const transpiledCode = transpiler4.transformSync(sourceCode);
14877
15078
  const withMap = transpiledCode + inlineLineMapComment(tsPath, sourceCode, transpiledCode);
14878
15079
  const relativeJsPath = relative12(vueRootDir, tsPath).replace(/\.ts$/, ".js");
14879
- const outClientPath = join29(clientOutputDir, relativeJsPath);
14880
- const outServerPath = join29(serverOutputDir, relativeJsPath);
14881
- await mkdir6(dirname15(outClientPath), { recursive: true });
14882
- await mkdir6(dirname15(outServerPath), { recursive: true });
15080
+ const outClientPath = join30(clientOutputDir, relativeJsPath);
15081
+ const outServerPath = join30(serverOutputDir, relativeJsPath);
15082
+ await mkdir7(dirname16(outClientPath), { recursive: true });
15083
+ await mkdir7(dirname16(outServerPath), { recursive: true });
14883
15084
  await write3(outClientPath, withMap);
14884
15085
  await write3(outServerPath, withMap);
14885
15086
  }));
@@ -14909,7 +15110,7 @@ var init_compileVue = __esm(() => {
14909
15110
  init_vueAutoRouterTransform();
14910
15111
  init_stylePreprocessor();
14911
15112
  devClientDir3 = resolveDevClientDir3();
14912
- hmrClientPath4 = join29(devClientDir3, "hmrClient.ts").replace(/\\/g, "/");
15113
+ hmrClientPath4 = join30(devClientDir3, "hmrClient.ts").replace(/\\/g, "/");
14913
15114
  transpiler4 = new Transpiler3({ loader: "ts", target: "browser" });
14914
15115
  scriptCache = new Map;
14915
15116
  scriptSetupCache = new Map;
@@ -15391,7 +15592,7 @@ __export(exports_compileAngular, {
15391
15592
  compileAngular: () => compileAngular
15392
15593
  });
15393
15594
  import { existsSync as existsSync23, readFileSync as readFileSync19, promises as fs5 } from "fs";
15394
- import { join as join30, basename as basename12, sep as sep3, dirname as dirname16, resolve as resolve22, relative as relative13 } from "path";
15595
+ import { join as join31, basename as basename12, sep as sep3, dirname as dirname17, resolve as resolve22, relative as relative13 } from "path";
15395
15596
  var {Glob: Glob6 } = globalThis.Bun;
15396
15597
  import ts13 from "typescript";
15397
15598
  var traceAngularPhase = async (name, fn2, metadata) => {
@@ -15434,10 +15635,10 @@ var traceAngularPhase = async (name, fn2, metadata) => {
15434
15635
  `${candidate}.tsx`,
15435
15636
  `${candidate}.js`,
15436
15637
  `${candidate}.jsx`,
15437
- join30(candidate, "index.ts"),
15438
- join30(candidate, "index.tsx"),
15439
- join30(candidate, "index.js"),
15440
- join30(candidate, "index.jsx")
15638
+ join31(candidate, "index.ts"),
15639
+ join31(candidate, "index.tsx"),
15640
+ join31(candidate, "index.js"),
15641
+ join31(candidate, "index.jsx")
15441
15642
  ];
15442
15643
  return candidates.find((file3) => existsSync23(file3));
15443
15644
  }, createLegacyAngularAnimationUsageResolver = (rootDir) => {
@@ -15509,7 +15710,7 @@ var traceAngularPhase = async (name, fn2, metadata) => {
15509
15710
  if (scan.usesLegacyAnimations)
15510
15711
  return true;
15511
15712
  for (const specifier of scan.imports) {
15512
- const importedPath = resolveLocalImport(specifier, dirname16(resolved));
15713
+ const importedPath = resolveLocalImport(specifier, dirname17(resolved));
15513
15714
  if (importedPath && await visit(importedPath, visited)) {
15514
15715
  return true;
15515
15716
  }
@@ -15568,7 +15769,7 @@ var traceAngularPhase = async (name, fn2, metadata) => {
15568
15769
  return `${path.replace(/\.ts$/, ".js")}${query}`;
15569
15770
  if (hasJsLikeExtension(path))
15570
15771
  return `${path}${query}`;
15571
- const importerDir = dirname16(importerOutputPath);
15772
+ const importerDir = dirname17(importerOutputPath);
15572
15773
  const fileCandidate = resolve22(importerDir, `${path}.js`);
15573
15774
  if (outputFiles?.has(fileCandidate) || existsSync23(fileCandidate)) {
15574
15775
  return `${path}.js${query}`;
@@ -15601,16 +15802,16 @@ var traceAngularPhase = async (name, fn2, metadata) => {
15601
15802
  }, resolveLocalTsImport = (fromFile, specifier) => {
15602
15803
  if (!isRelativeModuleSpecifier(specifier))
15603
15804
  return null;
15604
- const basePath = resolve22(dirname16(fromFile), specifier);
15805
+ const basePath = resolve22(dirname17(fromFile), specifier);
15605
15806
  const candidates = /\.[cm]?[tj]sx?$/.test(basePath) ? [basePath] : [
15606
15807
  `${basePath}.ts`,
15607
15808
  `${basePath}.tsx`,
15608
15809
  `${basePath}.mts`,
15609
15810
  `${basePath}.cts`,
15610
- join30(basePath, "index.ts"),
15611
- join30(basePath, "index.tsx"),
15612
- join30(basePath, "index.mts"),
15613
- join30(basePath, "index.cts")
15811
+ join31(basePath, "index.ts"),
15812
+ join31(basePath, "index.tsx"),
15813
+ join31(basePath, "index.mts"),
15814
+ join31(basePath, "index.cts")
15614
15815
  ];
15615
15816
  return candidates.map((candidate) => resolve22(candidate)).find((candidate) => existsSync23(candidate) && !candidate.endsWith(".d.ts")) ?? null;
15616
15817
  }, readFileForAotTransform = async (fileName, readFile6) => {
@@ -15636,15 +15837,15 @@ var traceAngularPhase = async (name, fn2, metadata) => {
15636
15837
  const paths = [];
15637
15838
  const templateUrlMatch = findUncommentedMatch(source, /templateUrl\s*:\s*['"]([^'"]+)['"]/);
15638
15839
  if (templateUrlMatch?.[1])
15639
- paths.push(join30(fileDir, templateUrlMatch[1]));
15840
+ paths.push(join31(fileDir, templateUrlMatch[1]));
15640
15841
  const styleUrlMatch = findUncommentedMatch(source, /styleUrl\s*:\s*['"]([^'"]+)['"]/);
15641
15842
  if (styleUrlMatch?.[1])
15642
- paths.push(join30(fileDir, styleUrlMatch[1]));
15843
+ paths.push(join31(fileDir, styleUrlMatch[1]));
15643
15844
  const styleUrlsMatch = findUncommentedMatch(source, /styleUrls\s*:\s*\[([^\]]+)\]/);
15644
15845
  const urlMatches = styleUrlsMatch?.[1]?.match(/['"]([^'"]+)['"]/g);
15645
15846
  if (urlMatches) {
15646
15847
  for (const urlMatch of urlMatches) {
15647
- paths.push(join30(fileDir, urlMatch.replace(/['"]/g, "")));
15848
+ paths.push(join31(fileDir, urlMatch.replace(/['"]/g, "")));
15648
15849
  }
15649
15850
  }
15650
15851
  return paths.map((path) => resolve22(path));
@@ -15659,13 +15860,13 @@ var traceAngularPhase = async (name, fn2, metadata) => {
15659
15860
  return null;
15660
15861
  }
15661
15862
  }, writeResourceCacheFile = async (cachePath, source) => {
15662
- await fs5.mkdir(dirname16(cachePath), { recursive: true });
15863
+ await fs5.mkdir(dirname17(cachePath), { recursive: true });
15663
15864
  await fs5.writeFile(cachePath, JSON.stringify({
15664
15865
  source,
15665
15866
  version: 1
15666
15867
  }), "utf-8");
15667
15868
  }, resolveResourceTransformCachePath = async (filePath, source, stylePreprocessors) => {
15668
- const resourcePaths = collectAngularResourcePaths(source, dirname16(filePath));
15869
+ const resourcePaths = collectAngularResourcePaths(source, dirname17(filePath));
15669
15870
  const resourceContents = await Promise.all(resourcePaths.map(async (resourcePath) => {
15670
15871
  const content = await fs5.readFile(resourcePath, "utf-8");
15671
15872
  return `${resourcePath}\x00${content}`;
@@ -15678,7 +15879,7 @@ var traceAngularPhase = async (name, fn2, metadata) => {
15678
15879
  safeStableStringify(stylePreprocessors ?? null)
15679
15880
  ].join("\x00");
15680
15881
  const cacheKey2 = Bun.hash(cacheInput).toString(BASE_36_RADIX);
15681
- return join30(process.cwd(), ".absolutejs", "cache", "angular-resources", `${cacheKey2}.json`);
15882
+ return join31(process.cwd(), ".absolutejs", "cache", "angular-resources", `${cacheKey2}.json`);
15682
15883
  }, precomputeAotResourceTransforms = async (inputPaths, readFile6, stylePreprocessors) => {
15683
15884
  const transformedSources = new Map;
15684
15885
  const visited = new Set;
@@ -15705,7 +15906,7 @@ var traceAngularPhase = async (name, fn2, metadata) => {
15705
15906
  transformedSource = cached.source;
15706
15907
  } else {
15707
15908
  stats.cacheMisses += 1;
15708
- const transformed = await inlineResources(source, dirname16(resolvedPath), stylePreprocessors);
15909
+ const transformed = await inlineResources(source, dirname17(resolvedPath), stylePreprocessors);
15709
15910
  transformedSource = transformed.source;
15710
15911
  await writeResourceCacheFile(cachePath, transformedSource);
15711
15912
  }
@@ -15724,7 +15925,7 @@ var traceAngularPhase = async (name, fn2, metadata) => {
15724
15925
  return { stats, transformedSources };
15725
15926
  }, compileAngularFiles = async (inputPaths, outDir, stylePreprocessors) => {
15726
15927
  const islandMetadataByOutputPath = await traceAngularPhase("aot/island-metadata", () => new Map(inputPaths.map((inputPath) => {
15727
- const outputPath = resolve22(join30(outDir, relative13(process.cwd(), resolve22(inputPath)).replace(/\.[cm]?[tj]sx?$/, ".js")));
15928
+ const outputPath = resolve22(join31(outDir, relative13(process.cwd(), resolve22(inputPath)).replace(/\.[cm]?[tj]sx?$/, ".js")));
15728
15929
  return [
15729
15930
  outputPath,
15730
15931
  buildIslandMetadataExports(readFileSync19(inputPath, "utf-8"))
@@ -15734,7 +15935,7 @@ var traceAngularPhase = async (name, fn2, metadata) => {
15734
15935
  const { readConfiguration, performCompilation, EmitFlags } = await traceAngularPhase("aot/import-compiler-cli", () => import("@angular/compiler-cli"));
15735
15936
  const tsLibDir = await traceAngularPhase("aot/resolve-typescript-lib", () => {
15736
15937
  const tsPath = __require.resolve("typescript");
15737
- const tsRootDir = dirname16(tsPath);
15938
+ const tsRootDir = dirname17(tsPath);
15738
15939
  return tsRootDir.endsWith("lib") ? tsRootDir : resolve22(tsRootDir, "lib");
15739
15940
  });
15740
15941
  const config = await traceAngularPhase("aot/read-configuration", () => readConfiguration("./tsconfig.json"));
@@ -15771,7 +15972,7 @@ var traceAngularPhase = async (name, fn2, metadata) => {
15771
15972
  const originalGetSourceFile = host.getSourceFile;
15772
15973
  host.getSourceFile = (fileName, languageVersion, onError) => {
15773
15974
  if (fileName.startsWith("lib.") && fileName.endsWith(".d.ts") && tsLibDir) {
15774
- const resolvedPath = join30(tsLibDir, fileName);
15975
+ const resolvedPath = join31(tsLibDir, fileName);
15775
15976
  return originalGetSourceFile?.call(host, resolvedPath, languageVersion, onError);
15776
15977
  }
15777
15978
  return originalGetSourceFile?.call(host, fileName, languageVersion, onError);
@@ -15826,7 +16027,7 @@ var traceAngularPhase = async (name, fn2, metadata) => {
15826
16027
  const entries = await traceAngularPhase("aot/postprocess-emitted-js", () => {
15827
16028
  const rawEntries = Object.entries(emitted).filter(([fileName]) => fileName.endsWith(".js")).map(([fileName, content]) => ({
15828
16029
  content,
15829
- target: join30(outDir, fileName)
16030
+ target: join31(outDir, fileName)
15830
16031
  }));
15831
16032
  const outputFiles = new Set(rawEntries.map(({ target }) => resolve22(target)));
15832
16033
  return rawEntries.map(({ content, target }) => {
@@ -15848,7 +16049,7 @@ var traceAngularPhase = async (name, fn2, metadata) => {
15848
16049
  });
15849
16050
  });
15850
16051
  await traceAngularPhase("aot/write-output", () => Promise.all(entries.map(async ({ target, content }) => {
15851
- await fs5.mkdir(dirname16(target), { recursive: true });
16052
+ await fs5.mkdir(dirname17(target), { recursive: true });
15852
16053
  await fs5.writeFile(target, content, "utf-8");
15853
16054
  })), { outputs: entries.length });
15854
16055
  return await traceAngularPhase("aot/collect-output-paths", () => entries.map(({ target }) => target), { outputs: entries.length });
@@ -16003,7 +16204,7 @@ ${fields}
16003
16204
  }, inlineTemplateAndLowerDefer = async (source, fileDir) => {
16004
16205
  const templateUrlMatch = findUncommentedMatch(source, /templateUrl\s*:\s*['"]([^'"]+)['"]/);
16005
16206
  if (templateUrlMatch?.[1]) {
16006
- const templatePath = join30(fileDir, templateUrlMatch[1]);
16207
+ const templatePath = join31(fileDir, templateUrlMatch[1]);
16007
16208
  if (!existsSync23(templatePath)) {
16008
16209
  throw new Error(`Unable to inline Angular templateUrl "${templateUrlMatch[1]}": file not found at ${templatePath}`);
16009
16210
  }
@@ -16034,7 +16235,7 @@ ${fields}
16034
16235
  }, inlineTemplateAndLowerDeferSync = (source, fileDir) => {
16035
16236
  const templateUrlMatch = findUncommentedMatch(source, /templateUrl\s*:\s*['"]([^'"]+)['"]/);
16036
16237
  if (templateUrlMatch?.[1]) {
16037
- const templatePath = join30(fileDir, templateUrlMatch[1]);
16238
+ const templatePath = join31(fileDir, templateUrlMatch[1]);
16038
16239
  if (!existsSync23(templatePath)) {
16039
16240
  throw new Error(`Unable to inline Angular templateUrl "${templateUrlMatch[1]}": file not found at ${templatePath}`);
16040
16241
  }
@@ -16071,7 +16272,7 @@ ${fields}
16071
16272
  return source;
16072
16273
  const stylePromises = urlMatches.map((urlMatch) => {
16073
16274
  const styleUrl = urlMatch.replace(/['"]/g, "");
16074
- return readAndEscapeFile(join30(fileDir, styleUrl), stylePreprocessors);
16275
+ return readAndEscapeFile(join31(fileDir, styleUrl), stylePreprocessors);
16075
16276
  });
16076
16277
  const results = await Promise.all(stylePromises);
16077
16278
  const inlinedStyles = results.filter(Boolean).map((escaped) => `\`${escaped}\``);
@@ -16082,7 +16283,7 @@ ${fields}
16082
16283
  const styleUrlMatch = findUncommentedMatch(source, /styleUrl\s*:\s*['"]([^'"]+)['"]/);
16083
16284
  if (!styleUrlMatch?.[1])
16084
16285
  return source;
16085
- const escaped = await readAndEscapeFile(join30(fileDir, styleUrlMatch[1]), stylePreprocessors);
16286
+ const escaped = await readAndEscapeFile(join31(fileDir, styleUrlMatch[1]), stylePreprocessors);
16086
16287
  if (!escaped)
16087
16288
  return source;
16088
16289
  return source.slice(0, styleUrlMatch.index) + `styles: [\`${escaped}\`]` + source.slice(styleUrlMatch.index + styleUrlMatch[0].length);
@@ -16178,10 +16379,10 @@ ${fields}
16178
16379
  `${candidate}.js`,
16179
16380
  `${candidate}.jsx`,
16180
16381
  `${candidate}.json`,
16181
- join30(candidate, "index.ts"),
16182
- join30(candidate, "index.tsx"),
16183
- join30(candidate, "index.js"),
16184
- join30(candidate, "index.jsx")
16382
+ join31(candidate, "index.ts"),
16383
+ join31(candidate, "index.tsx"),
16384
+ join31(candidate, "index.js"),
16385
+ join31(candidate, "index.jsx")
16185
16386
  ];
16186
16387
  return candidates.find((file3) => existsSync23(file3));
16187
16388
  };
@@ -16205,13 +16406,13 @@ ${fields}
16205
16406
  }
16206
16407
  };
16207
16408
  const toOutputPath = (sourcePath) => {
16208
- const inputDir = dirname16(sourcePath);
16409
+ const inputDir = dirname17(sourcePath);
16209
16410
  const fileBase = basename12(sourcePath).replace(/\.[cm]?[tj]sx?$/, ".js");
16210
16411
  if (inputDir === outDir || inputDir.startsWith(`${outDir}${sep3}`)) {
16211
- return join30(inputDir, fileBase);
16412
+ return join31(inputDir, fileBase);
16212
16413
  }
16213
16414
  const relativeDir = inputDir.startsWith(baseDir) ? inputDir.substring(baseDir.length + 1) : inputDir;
16214
- return join30(outDir, relativeDir, fileBase);
16415
+ return join31(outDir, relativeDir, fileBase);
16215
16416
  };
16216
16417
  const withCacheBuster = (specifier) => {
16217
16418
  if (!cacheBuster)
@@ -16259,10 +16460,10 @@ ${fields}
16259
16460
  return;
16260
16461
  visited.add(resolved);
16261
16462
  if (resolved.endsWith(".json") && existsSync23(resolved)) {
16262
- const inputDir2 = dirname16(resolved);
16463
+ const inputDir2 = dirname17(resolved);
16263
16464
  const relativeDir2 = inputDir2.startsWith(baseDir) ? inputDir2.substring(baseDir.length + 1) : inputDir2;
16264
- const targetDir2 = join30(outDir, relativeDir2);
16265
- const targetPath2 = join30(targetDir2, basename12(resolved));
16465
+ const targetDir2 = join31(outDir, relativeDir2);
16466
+ const targetPath2 = join31(targetDir2, basename12(resolved));
16266
16467
  await fs5.mkdir(targetDir2, { recursive: true });
16267
16468
  await fs5.copyFile(resolved, targetPath2);
16268
16469
  allOutputs.push(targetPath2);
@@ -16274,12 +16475,12 @@ ${fields}
16274
16475
  if (!existsSync23(actualPath))
16275
16476
  return;
16276
16477
  let sourceCode = await fs5.readFile(actualPath, "utf-8");
16277
- const inlined = await inlineResources(sourceCode, dirname16(actualPath), stylePreprocessors);
16278
- sourceCode = inlineTemplateAndLowerDeferSync(inlined.source, dirname16(actualPath)).source;
16279
- const inputDir = dirname16(actualPath);
16478
+ const inlined = await inlineResources(sourceCode, dirname17(actualPath), stylePreprocessors);
16479
+ sourceCode = inlineTemplateAndLowerDeferSync(inlined.source, dirname17(actualPath)).source;
16480
+ const inputDir = dirname17(actualPath);
16280
16481
  const fileBase = basename12(actualPath).replace(/\.[cm]?[tj]sx?$/, ".js");
16281
16482
  const targetPath = toOutputPath(actualPath);
16282
- const targetDir = dirname16(targetPath);
16483
+ const targetDir = dirname17(targetPath);
16283
16484
  const relativeDir = relative13(outDir, targetDir).replace(/\\/g, "/");
16284
16485
  const localImports = [];
16285
16486
  const importRewrites = new Map;
@@ -16341,7 +16542,7 @@ export const __ABSOLUTE_PAGE_USES_LEGACY_ANIMATIONS__ = true;
16341
16542
  return { clientPaths: [...emptyPaths], serverPaths: [...emptyPaths] };
16342
16543
  }
16343
16544
  const compiledRoot = compiledParent;
16344
- const indexesDir = join30(compiledParent, "indexes");
16545
+ const indexesDir = join31(compiledParent, "indexes");
16345
16546
  await traceAngularPhase("setup/create-indexes-dir", () => fs5.mkdir(indexesDir, { recursive: true }));
16346
16547
  const aotOutputs = hmr ? [] : await traceAngularPhase("aot/compile-files", () => compileAngularFiles(entryPoints.map((entry) => resolve22(entry)), compiledRoot, stylePreprocessors), { entries: entryPoints.length });
16347
16548
  if (!hmr) {
@@ -16355,10 +16556,10 @@ export const __ABSOLUTE_PAGE_USES_LEGACY_ANIMATIONS__ = true;
16355
16556
  absolute: false,
16356
16557
  cwd: angularSrcDir
16357
16558
  })) {
16358
- const sourcePath = join30(angularSrcDir, rel);
16559
+ const sourcePath = join31(angularSrcDir, rel);
16359
16560
  const cwdRel = relative13(cwd, sourcePath);
16360
- const targetPath = join30(compiledRoot, cwdRel);
16361
- await fs5.mkdir(dirname16(targetPath), { recursive: true });
16561
+ const targetPath = join31(compiledRoot, cwdRel);
16562
+ await fs5.mkdir(dirname17(targetPath), { recursive: true });
16362
16563
  await fs5.copyFile(sourcePath, targetPath);
16363
16564
  }
16364
16565
  });
@@ -16374,9 +16575,9 @@ export const __ABSOLUTE_PAGE_USES_LEGACY_ANIMATIONS__ = true;
16374
16575
  const fileBase = basename12(resolvedEntry).replace(/\.[tj]s$/, "");
16375
16576
  const jsName = `${fileBase}.js`;
16376
16577
  const compiledFallbackPaths = [
16377
- join30(compiledRoot, relativeEntry),
16378
- join30(compiledRoot, "pages", jsName),
16379
- join30(compiledRoot, jsName)
16578
+ join31(compiledRoot, relativeEntry),
16579
+ join31(compiledRoot, "pages", jsName),
16580
+ join31(compiledRoot, jsName)
16380
16581
  ].map((file3) => resolve22(file3));
16381
16582
  const resolveRawServerFile = (candidatePaths) => {
16382
16583
  const normalizedCandidates = [
@@ -16438,7 +16639,7 @@ export const __ABSOLUTE_PAGE_USES_LEGACY_ANIMATIONS__ = true;
16438
16639
  })() : "no-providers";
16439
16640
  const serverContentHash = `${Bun.hash(original).toString(BASE_36_RADIX)}.${Bun.hash(providersHashInput).toString(BASE_36_RADIX)}`;
16440
16641
  const cachedWrapper = wrapperOutputCache.get(resolvedEntry);
16441
- const clientFile = join30(indexesDir, jsName);
16642
+ const clientFile = join31(indexesDir, jsName);
16442
16643
  if (hmr && cachedWrapper && cachedWrapper.serverHash === serverContentHash && existsSync23(clientFile) && (usesLegacyAnimations || !original.includes("__ABSOLUTE_PAGE_USES_LEGACY_ANIMATIONS__")) && (!usesLegacyAnimations || original.includes("__ABSOLUTE_PAGE_USES_LEGACY_ANIMATIONS__"))) {
16443
16644
  return {
16444
16645
  clientPath: clientFile,
@@ -16473,10 +16674,10 @@ export const __ABSOLUTE_PAGE_USES_LEGACY_ANIMATIONS__ = true;
16473
16674
  const angularDirAbs = resolve22(outRoot);
16474
16675
  const appSourceAbs = resolve22(providersInjection.appProvidersSource);
16475
16676
  const rel = relative13(angularDirAbs, appSourceAbs).replace(/\\/g, "/");
16476
- return join30(compiledParent, rel).replace(/\.[cm]?[tj]sx?$/, ".js");
16677
+ return join31(compiledParent, rel).replace(/\.[cm]?[tj]sx?$/, ".js");
16477
16678
  })();
16478
16679
  const appProvidersSpec = (() => {
16479
- const rel = relative13(dirname16(rawServerFile), compiledAppProvidersPath).replace(/\\/g, "/");
16680
+ const rel = relative13(dirname17(rawServerFile), compiledAppProvidersPath).replace(/\\/g, "/");
16480
16681
  return rel.startsWith(".") ? rel : `./${rel}`;
16481
16682
  })();
16482
16683
  importLines.push(`import { appProviders as __abs_globalProviders } from "${appProvidersSpec}";`);
@@ -16524,6 +16725,7 @@ var requestContext = Object.prototype.hasOwnProperty.call(window, '__ABS_ANGULAR
16524
16725
  var pageHasIslands = Boolean(pageModule.__ABSOLUTE_PAGE_HAS_ISLANDS__) || Boolean(document.querySelector('[data-island="true"]'));
16525
16726
  var pageHasRawStreamingSlots = Boolean(document.querySelector('[data-absolute-raw-slot="true"]'));
16526
16727
  var pageHasStreamingSlots = Boolean(document.querySelector('[data-absolute-slot="true"]'));
16728
+ var isClientRender = window.__ABSOLUTE_PAGE_RENDER_MODE__ === 'client';
16527
16729
  var contextProviders = [{ provide: REQUEST_CONTEXT, useValue: requestContext }];
16528
16730
  // Page-level providers are injected directly into the page module's
16529
16731
  // server output by \`compileAngular\`'s providers-injection step
@@ -16574,13 +16776,14 @@ if (!document.querySelector(_sel)) {
16574
16776
  }
16575
16777
 
16576
16778
  var providers = [provideZonelessChangeDetection()];
16577
- if (!window.__HMR_SKIP_HYDRATION__ && !pageHasIslands) {
16779
+ if (!isClientRender && !window.__HMR_SKIP_HYDRATION__ && !pageHasIslands) {
16578
16780
  providers.push(provideClientHydration(withHttpTransferCacheOptions(absoluteHttpTransferCacheOptions)));
16579
16781
  }
16580
16782
  delete window.__HMR_SKIP_HYDRATION__;
16581
16783
  providers.push.apply(providers, pageProviders);
16582
16784
  providers.push.apply(providers, contextProviders);
16583
16785
  window.__ABS_SLOT_HYDRATION_PENDING__ = pageHasRawStreamingSlots;
16786
+ var absolutePageReady = Promise.resolve();
16584
16787
 
16585
16788
  if (pageHasRawStreamingSlots) {
16586
16789
  window.__ABS_SLOT_HYDRATION_PENDING__ = false;
@@ -16590,7 +16793,7 @@ if (pageHasRawStreamingSlots) {
16590
16793
  });
16591
16794
  }
16592
16795
  } else {
16593
- bootstrapApplication(${componentClassName}, {
16796
+ absolutePageReady = bootstrapApplication(${componentClassName}, {
16594
16797
  providers: providers
16595
16798
  }).then(function (appRef) {
16596
16799
  window.__ANGULAR_APP__ = appRef;
@@ -16600,8 +16803,17 @@ if (pageHasRawStreamingSlots) {
16600
16803
  window.__ABS_SLOT_FLUSH__();
16601
16804
  });
16602
16805
  }
16806
+ return appRef;
16603
16807
  });
16604
16808
  }
16809
+ window.__ABSOLUTE_PAGE_READY__ = absolutePageReady;
16810
+ window.__ABSOLUTE_PAGE_DISPOSE__ = async function() {
16811
+ await absolutePageReady;
16812
+ if (window.__ANGULAR_APP__) {
16813
+ window.__ANGULAR_APP__.destroy();
16814
+ window.__ANGULAR_APP__ = null;
16815
+ }
16816
+ };
16605
16817
  `.trim() : `
16606
16818
  import '@angular/compiler';
16607
16819
  import { bootstrapApplication } from '@angular/platform-browser';
@@ -16620,6 +16832,7 @@ var requestContext = Object.prototype.hasOwnProperty.call(window, '__ABS_ANGULAR
16620
16832
  var pageHasIslands = Boolean(pageModule.__ABSOLUTE_PAGE_HAS_ISLANDS__) || Boolean(document.querySelector('[data-island="true"]'));
16621
16833
  var pageHasRawStreamingSlots = Boolean(document.querySelector('[data-absolute-raw-slot="true"]'));
16622
16834
  var pageHasStreamingSlots = Boolean(document.querySelector('[data-absolute-slot="true"]'));
16835
+ var isClientRender = window.__ABSOLUTE_PAGE_RENDER_MODE__ === 'client';
16623
16836
  var contextProviders = [{ provide: REQUEST_CONTEXT, useValue: requestContext }];
16624
16837
  // Page-level providers are injected directly into the page module's
16625
16838
  // server output by \`compileAngular\`'s providers-injection step
@@ -16639,11 +16852,21 @@ var absoluteHttpTransferCacheOptions = {
16639
16852
 
16640
16853
  enableProdMode();
16641
16854
 
16855
+ // Production mobile/client-only activation starts from AbsoluteJS's empty
16856
+ // #root shell rather than server-rendered Angular markup. Create the page's
16857
+ // actual Angular host from its compiled selector so application authors do
16858
+ // not need framework-specific mobile configuration.
16859
+ var _sel = ${componentClassName}.\u0275cmp?.selectors?.[0]?.[0] || 'ng-app';
16860
+ if (!document.querySelector(_sel)) {
16861
+ (document.getElementById('root') || document.body).appendChild(document.createElement(_sel));
16862
+ }
16863
+
16642
16864
  var providers = [provideZonelessChangeDetection()].concat(pageProviders).concat(contextProviders);
16643
- if (!pageHasIslands) {
16865
+ if (!isClientRender && !pageHasIslands) {
16644
16866
  providers.unshift(provideClientHydration(withHttpTransferCacheOptions(absoluteHttpTransferCacheOptions)));
16645
16867
  }
16646
16868
  window.__ABS_SLOT_HYDRATION_PENDING__ = pageHasRawStreamingSlots;
16869
+ var absolutePageReady = Promise.resolve();
16647
16870
 
16648
16871
  if (pageHasRawStreamingSlots) {
16649
16872
  window.__ABS_SLOT_HYDRATION_PENDING__ = false;
@@ -16653,7 +16876,7 @@ if (pageHasRawStreamingSlots) {
16653
16876
  });
16654
16877
  }
16655
16878
  } else {
16656
- bootstrapApplication(${componentClassName}, {
16879
+ absolutePageReady = bootstrapApplication(${componentClassName}, {
16657
16880
  providers: providers
16658
16881
  }).then(function (appRef) {
16659
16882
  window.__ANGULAR_APP__ = appRef;
@@ -16663,8 +16886,17 @@ if (pageHasRawStreamingSlots) {
16663
16886
  window.__ABS_SLOT_FLUSH__();
16664
16887
  });
16665
16888
  }
16889
+ return appRef;
16666
16890
  });
16667
16891
  }
16892
+ window.__ABSOLUTE_PAGE_READY__ = absolutePageReady;
16893
+ window.__ABSOLUTE_PAGE_DISPOSE__ = async function() {
16894
+ await absolutePageReady;
16895
+ if (window.__ANGULAR_APP__) {
16896
+ window.__ANGULAR_APP__.destroy();
16897
+ window.__ANGULAR_APP__ = null;
16898
+ }
16899
+ };
16668
16900
  `.trim();
16669
16901
  const indexHash = Bun.hash(hydration).toString(BASE_36_RADIX);
16670
16902
  const indexUnchanged = cachedWrapper?.indexHash === indexHash;
@@ -16697,7 +16929,7 @@ var init_compileAngular = __esm(() => {
16697
16929
  init_stylePreprocessor();
16698
16930
  init_generatedDir();
16699
16931
  devClientDir4 = resolveDevClientDir4();
16700
- hmrClientPath5 = join30(devClientDir4, "hmrClient.ts").replace(/\\/g, "/");
16932
+ hmrClientPath5 = join31(devClientDir4, "hmrClient.ts").replace(/\\/g, "/");
16701
16933
  jitContentCache = new Map;
16702
16934
  wrapperOutputCache = new Map;
16703
16935
  PROVIDERS_INJECTION_BLOCK_RE = /\n\/\* __ABS_PROVIDERS_INJECTION_START \*\/[\s\S]*?\/\* __ABS_PROVIDERS_INJECTION_END \*\/\n?/;
@@ -17422,7 +17654,7 @@ __export(exports_fastHmrCompiler, {
17422
17654
  invalidateFingerprintCache: () => invalidateFingerprintCache
17423
17655
  });
17424
17656
  import { existsSync as existsSync24, readFileSync as readFileSync20, statSync as statSync2 } from "fs";
17425
- import { dirname as dirname17, extname as extname8, relative as relative14, resolve as resolve23 } from "path";
17657
+ import { dirname as dirname18, extname as extname8, relative as relative14, resolve as resolve23 } from "path";
17426
17658
  import ts17 from "typescript";
17427
17659
  var fail = (reason, detail, location) => ({
17428
17660
  detail,
@@ -17552,7 +17784,7 @@ var fail = (reason, detail, location) => ({
17552
17784
  continue;
17553
17785
  const decoratorMeta = readDecoratorMeta(args);
17554
17786
  const { inputs, outputs } = extractInputsAndOutputs(stmt, null);
17555
- const componentDir = dirname17(componentFilePath);
17787
+ const componentDir = dirname18(componentFilePath);
17556
17788
  const fingerprint = extractFingerprint(stmt, className, decoratorMeta, inputs, outputs, sourceFile, componentDir);
17557
17789
  fingerprintCache.set(id, fingerprint);
17558
17790
  } else {
@@ -18533,7 +18765,7 @@ var fail = (reason, detail, location) => ({
18533
18765
  });
18534
18766
  if (!names.includes(className))
18535
18767
  continue;
18536
- const nextDts = resolveDtsFromSpec(fromPath, dirname17(startDtsPath));
18768
+ const nextDts = resolveDtsFromSpec(fromPath, dirname18(startDtsPath));
18537
18769
  if (!nextDts)
18538
18770
  continue;
18539
18771
  const found = findDtsContainingClass(nextDts, className, visited);
@@ -18543,7 +18775,7 @@ var fail = (reason, detail, location) => ({
18543
18775
  const starReExportRe = /export\s*\*\s*from\s*["']([^"']+)["']/g;
18544
18776
  while ((item = starReExportRe.exec(content)) !== null) {
18545
18777
  const fromPath = item[1] || "";
18546
- const nextDts = resolveDtsFromSpec(fromPath, dirname17(startDtsPath));
18778
+ const nextDts = resolveDtsFromSpec(fromPath, dirname18(startDtsPath));
18547
18779
  if (!nextDts)
18548
18780
  continue;
18549
18781
  const found = findDtsContainingClass(nextDts, className, visited);
@@ -19144,7 +19376,7 @@ ${block}
19144
19376
  rebootstrapRequired: false
19145
19377
  };
19146
19378
  }
19147
- if (inheritsDecoratedClass(classNode, sourceFile, dirname17(componentFilePath), projectRoot)) {
19379
+ if (inheritsDecoratedClass(classNode, sourceFile, dirname18(componentFilePath), projectRoot)) {
19148
19380
  return fail("inherits-decorated-class");
19149
19381
  }
19150
19382
  const decorator = findComponentDecorator(classNode);
@@ -19156,7 +19388,7 @@ ${block}
19156
19388
  const projectDefaults = readProjectAngularCompilerOptions(projectRoot);
19157
19389
  const decoratorMeta = readDecoratorMeta(decoratorArgs, projectDefaults);
19158
19390
  const advancedMetadata = extractAdvancedMetadata(classNode, decoratorArgs, compiler);
19159
- const componentDir = dirname17(componentFilePath);
19391
+ const componentDir = dirname18(componentFilePath);
19160
19392
  let templateText;
19161
19393
  let templatePath;
19162
19394
  if (decoratorMeta.template !== null) {
@@ -19926,7 +20158,7 @@ __export(exports_compileEmber, {
19926
20158
  getEmberServerCompiledDir: () => getEmberServerCompiledDir,
19927
20159
  getEmberCompiledRoot: () => getEmberCompiledRoot,
19928
20160
  getEmberClientCompiledDir: () => getEmberClientCompiledDir,
19929
- dirname: () => dirname18,
20161
+ dirname: () => dirname19,
19930
20162
  compileEmberFileSource: () => compileEmberFileSource,
19931
20163
  compileEmberFile: () => compileEmberFile,
19932
20164
  compileEmber: () => compileEmber,
@@ -19934,8 +20166,8 @@ __export(exports_compileEmber, {
19934
20166
  basename: () => basename13
19935
20167
  });
19936
20168
  import { existsSync as existsSync25 } from "fs";
19937
- import { mkdir as mkdir7, rm as rm4 } from "fs/promises";
19938
- import { basename as basename13, dirname as dirname18, extname as extname9, join as join31, resolve as resolve24 } from "path";
20169
+ import { mkdir as mkdir8, rm as rm5 } from "fs/promises";
20170
+ import { basename as basename13, dirname as dirname19, extname as extname9, join as join32, resolve as resolve24 } from "path";
19939
20171
  var {build: bunBuild2, Transpiler: Transpiler4, write: write4, file: file3 } = globalThis.Bun;
19940
20172
  var cachedPreprocessor = null, getPreprocessor = async () => {
19941
20173
  if (cachedPreprocessor)
@@ -20031,7 +20263,7 @@ export const importSync = (specifier) => {
20031
20263
  const originalImporter = stagedSourceMap.get(args.importer);
20032
20264
  if (!originalImporter)
20033
20265
  return;
20034
- const candidateBase = resolve24(dirname18(originalImporter), args.path);
20266
+ const candidateBase = resolve24(dirname19(originalImporter), args.path);
20035
20267
  const extensionsToTry = ["", ".gts", ".gjs", ".ts", ".js"];
20036
20268
  for (const ext of extensionsToTry) {
20037
20269
  const candidate = candidateBase + ext;
@@ -20054,7 +20286,7 @@ export const importSync = (specifier) => {
20054
20286
  build.onResolve({ filter: /^@(?:ember|glimmer|simple-dom)\// }, (args) => {
20055
20287
  if (standalonePackages.has(args.path))
20056
20288
  return;
20057
- const internal = join31(cwd, "node_modules/ember-source/dist/packages", args.path, "index.js");
20289
+ const internal = join32(cwd, "node_modules/ember-source/dist/packages", args.path, "index.js");
20058
20290
  if (existsSync25(internal))
20059
20291
  return { path: internal };
20060
20292
  return;
@@ -20102,16 +20334,16 @@ export default PageComponent;
20102
20334
  }
20103
20335
  const transpiled = transpiler5.transformSync(preprocessed);
20104
20336
  const baseName = basename13(resolvedEntry).replace(/\.(gjs|gts|ts|js)$/, "");
20105
- const tmpDir = join31(compiledRoot, "_tmp");
20106
- const serverDir = join31(compiledRoot, "server");
20107
- const clientDir = join31(compiledRoot, "client");
20337
+ const tmpDir = join32(compiledRoot, "_tmp");
20338
+ const serverDir = join32(compiledRoot, "server");
20339
+ const clientDir = join32(compiledRoot, "client");
20108
20340
  await Promise.all([
20109
- mkdir7(tmpDir, { recursive: true }),
20110
- mkdir7(serverDir, { recursive: true }),
20111
- mkdir7(clientDir, { recursive: true })
20341
+ mkdir8(tmpDir, { recursive: true }),
20342
+ mkdir8(serverDir, { recursive: true }),
20343
+ mkdir8(clientDir, { recursive: true })
20112
20344
  ]);
20113
- const tmpPagePath = resolve24(join31(tmpDir, `${baseName}.module.js`));
20114
- const tmpHarnessPath = resolve24(join31(tmpDir, `${baseName}.harness.js`));
20345
+ const tmpPagePath = resolve24(join32(tmpDir, `${baseName}.module.js`));
20346
+ const tmpHarnessPath = resolve24(join32(tmpDir, `${baseName}.harness.js`));
20115
20347
  await Promise.all([
20116
20348
  write4(tmpPagePath, transpiled),
20117
20349
  write4(tmpHarnessPath, generateServerHarness(tmpPagePath))
@@ -20119,7 +20351,7 @@ export default PageComponent;
20119
20351
  const stagedSourceMap = new Map([
20120
20352
  [tmpPagePath, resolvedEntry]
20121
20353
  ]);
20122
- const serverPath = join31(serverDir, `${baseName}.js`);
20354
+ const serverPath = join32(serverDir, `${baseName}.js`);
20123
20355
  const buildResult = await bunBuild2({
20124
20356
  entrypoints: [tmpHarnessPath],
20125
20357
  format: "esm",
@@ -20135,8 +20367,8 @@ export default PageComponent;
20135
20367
  if (!buildResult.success) {
20136
20368
  console.warn(`\u26A0\uFE0F Ember server build for ${baseName} had errors:`, buildResult.logs);
20137
20369
  }
20138
- await rm4(tmpDir, { force: true, recursive: true });
20139
- const clientPath = join31(clientDir, `${baseName}.js`);
20370
+ await rm5(tmpDir, { force: true, recursive: true });
20371
+ const clientPath = join32(clientDir, `${baseName}.js`);
20140
20372
  await write4(clientPath, transpiled);
20141
20373
  return { clientPath, serverPath };
20142
20374
  }, compileEmber = async (entries, emberDir, cwd = process.cwd(), _hmr = false) => {
@@ -20164,7 +20396,7 @@ export default PageComponent;
20164
20396
  preprocessed = rewriteTemplateEvalToScope(result.code);
20165
20397
  }
20166
20398
  return transpiler5.transformSync(preprocessed);
20167
- }, clearEmberCompilerCache = () => {}, getEmberCompiledRoot = (_emberDir) => getFrameworkGeneratedDir("ember"), getEmberServerCompiledDir = (emberDir) => join31(getEmberCompiledRoot(emberDir), "server"), getEmberClientCompiledDir = (emberDir) => join31(getEmberCompiledRoot(emberDir), "client");
20399
+ }, clearEmberCompilerCache = () => {}, getEmberCompiledRoot = (_emberDir) => getFrameworkGeneratedDir("ember"), getEmberServerCompiledDir = (emberDir) => join32(getEmberCompiledRoot(emberDir), "server"), getEmberClientCompiledDir = (emberDir) => join32(getEmberCompiledRoot(emberDir), "client");
20168
20400
  var init_compileEmber = __esm(() => {
20169
20401
  init_generatedDir();
20170
20402
  transpiler5 = new Transpiler4({
@@ -20186,8 +20418,8 @@ __export(exports_buildReactVendor, {
20186
20418
  buildReactVendor: () => buildReactVendor
20187
20419
  });
20188
20420
  import { existsSync as existsSync26, mkdirSync as mkdirSync8 } from "fs";
20189
- import { join as join32, resolve as resolve25 } from "path";
20190
- import { rm as rm5 } from "fs/promises";
20421
+ import { join as join33, resolve as resolve25 } from "path";
20422
+ import { rm as rm6 } from "fs/promises";
20191
20423
  var {build: bunBuild3 } = globalThis.Bun;
20192
20424
  var resolveJsxDevRuntimeCompatPath = () => {
20193
20425
  const candidates = [
@@ -20204,13 +20436,17 @@ var resolveJsxDevRuntimeCompatPath = () => {
20204
20436
  }
20205
20437
  }
20206
20438
  return (candidates[0] ?? resolve25(import.meta.dir, "react", "jsxDevRuntimeCompat.js")).replace(/\\/g, "/");
20207
- }, jsxDevRuntimeCompatPath, reactSpecifiers, toSafeFileName = (specifier) => specifier.replace(/\//g, "_"), computeVendorPaths = () => {
20439
+ }, jsxDevRuntimeCompatPath, jsxRuntimeCompatPath, reactSpecifiers, toSafeFileName = (specifier) => specifier.replace(/\//g, "_"), computeVendorPaths = () => {
20208
20440
  const paths = {};
20209
20441
  for (const specifier of reactSpecifiers) {
20210
20442
  paths[specifier] = `/react/vendor/${toSafeFileName(specifier)}.js`;
20211
20443
  }
20212
20444
  return paths;
20213
20445
  }, generateEntrySource = async (specifier) => {
20446
+ if (specifier === "react/jsx-runtime") {
20447
+ return `export { Fragment, jsx, jsxs } from '${jsxRuntimeCompatPath}';
20448
+ `;
20449
+ }
20214
20450
  if (specifier === "react/jsx-dev-runtime") {
20215
20451
  return `export { Fragment, jsxDEV } from '${jsxDevRuntimeCompatPath}';
20216
20452
  `;
@@ -20232,14 +20468,14 @@ var resolveJsxDevRuntimeCompatPath = () => {
20232
20468
  `)}
20233
20469
  `;
20234
20470
  }, buildReactVendor = async (buildDir) => {
20235
- const vendorDir = join32(buildDir, "react", "vendor");
20471
+ const vendorDir = join33(buildDir, "react", "vendor");
20236
20472
  mkdirSync8(vendorDir, { recursive: true });
20237
- const tmpDir = join32(buildDir, "_vendor_tmp");
20473
+ const tmpDir = join33(buildDir, "_vendor_tmp");
20238
20474
  mkdirSync8(tmpDir, { recursive: true });
20239
20475
  const specifiers = reactSpecifiers;
20240
20476
  const entrypoints = await Promise.all(specifiers.map(async (specifier) => {
20241
20477
  const safeName = toSafeFileName(specifier);
20242
- const entryPath = join32(tmpDir, `${safeName}.ts`);
20478
+ const entryPath = join33(tmpDir, `${safeName}.ts`);
20243
20479
  const source = await generateEntrySource(specifier);
20244
20480
  await Bun.write(entryPath, source);
20245
20481
  return entryPath;
@@ -20254,7 +20490,7 @@ var resolveJsxDevRuntimeCompatPath = () => {
20254
20490
  target: "browser",
20255
20491
  throw: false
20256
20492
  });
20257
- await rm5(tmpDir, { force: true, recursive: true });
20493
+ await rm6(tmpDir, { force: true, recursive: true });
20258
20494
  if (!result.success) {
20259
20495
  console.warn("\u26A0\uFE0F React vendor build had errors:", result.logs);
20260
20496
  }
@@ -20262,6 +20498,7 @@ var resolveJsxDevRuntimeCompatPath = () => {
20262
20498
  var init_buildReactVendor = __esm(() => {
20263
20499
  init_generateReactIndexes();
20264
20500
  jsxDevRuntimeCompatPath = resolveJsxDevRuntimeCompatPath();
20501
+ jsxRuntimeCompatPath = jsxDevRuntimeCompatPath.replace("jsxDevRuntimeCompat", "jsxRuntimeCompat");
20265
20502
  reactSpecifiers = [
20266
20503
  "react",
20267
20504
  "react-dom",
@@ -20306,8 +20543,8 @@ __export(exports_buildAngularVendor, {
20306
20543
  buildAngularServerVendor: () => buildAngularServerVendor
20307
20544
  });
20308
20545
  import { mkdirSync as mkdirSync9 } from "fs";
20309
- import { join as join33 } from "path";
20310
- import { rm as rm6 } from "fs/promises";
20546
+ import { join as join34 } from "path";
20547
+ import { rm as rm7 } from "fs/promises";
20311
20548
  var {build: bunBuild4, Glob: Glob7 } = globalThis.Bun;
20312
20549
  var REQUIRED_ANGULAR_SPECIFIERS_BASE, requiredAngularSpecifiers = (jitMode) => jitMode ? [...REQUIRED_ANGULAR_SPECIFIERS_BASE, "@angular/compiler"] : REQUIRED_ANGULAR_SPECIFIERS_BASE, SERVER_ONLY_ANGULAR_SPECIFIERS, BUILD_ONLY_ANGULAR_SPECIFIER_PREFIXES, isBuildOnlyAngularSpecifier = (spec) => BUILD_ONLY_ANGULAR_SPECIFIER_PREFIXES.some((prefix) => spec === prefix || spec.startsWith(`${prefix}/`)), SCAN_SKIP_DIRS, isResolvable = (specifier) => {
20313
20550
  try {
@@ -20403,14 +20640,14 @@ var REQUIRED_ANGULAR_SPECIFIERS_BASE, requiredAngularSpecifiers = (jitMode) => j
20403
20640
  await collectTransitiveAngularSpecs([...angular, ...transitiveRoots], angular);
20404
20641
  return Array.from(angular).filter(isResolvable);
20405
20642
  }, buildAngularVendor = async (buildDir, directories = [], linkerJitMode = false, depVendorSpecifiers = []) => {
20406
- const vendorDir = join33(buildDir, "angular", "vendor");
20643
+ const vendorDir = join34(buildDir, "angular", "vendor");
20407
20644
  mkdirSync9(vendorDir, { recursive: true });
20408
- const tmpDir = join33(buildDir, "_angular_vendor_tmp");
20645
+ const tmpDir = join34(buildDir, "_angular_vendor_tmp");
20409
20646
  mkdirSync9(tmpDir, { recursive: true });
20410
20647
  const specifiers = await resolveAngularSpecifiers(directories, linkerJitMode);
20411
20648
  const entrypoints = await Promise.all(specifiers.map(async (specifier) => {
20412
20649
  const safeName = toSafeFileName2(specifier);
20413
- const entryPath = join33(tmpDir, `${safeName}.ts`);
20650
+ const entryPath = join34(tmpDir, `${safeName}.ts`);
20414
20651
  await Bun.write(entryPath, await generateVendorEntrySource(specifier));
20415
20652
  return entryPath;
20416
20653
  }));
@@ -20426,7 +20663,7 @@ var REQUIRED_ANGULAR_SPECIFIERS_BASE, requiredAngularSpecifiers = (jitMode) => j
20426
20663
  target: "browser",
20427
20664
  throw: false
20428
20665
  });
20429
- await rm6(tmpDir, { force: true, recursive: true });
20666
+ await rm7(tmpDir, { force: true, recursive: true });
20430
20667
  if (!result.success) {
20431
20668
  console.warn("\u26A0\uFE0F Angular vendor build had errors:", result.logs);
20432
20669
  }
@@ -20441,9 +20678,9 @@ var REQUIRED_ANGULAR_SPECIFIERS_BASE, requiredAngularSpecifiers = (jitMode) => j
20441
20678
  const specifiers = await resolveAngularSpecifiers(directories, linkerJitMode);
20442
20679
  return computeAngularVendorPaths(specifiers);
20443
20680
  }, buildAngularServerVendor = async (buildDir, directories = [], linkerJitMode = false) => {
20444
- const vendorDir = join33(buildDir, "angular", "vendor", "server");
20681
+ const vendorDir = join34(buildDir, "angular", "vendor", "server");
20445
20682
  mkdirSync9(vendorDir, { recursive: true });
20446
- const tmpDir = join33(buildDir, "_angular_server_vendor_tmp");
20683
+ const tmpDir = join34(buildDir, "_angular_server_vendor_tmp");
20447
20684
  mkdirSync9(tmpDir, { recursive: true });
20448
20685
  const browserSpecs = await resolveAngularSpecifiers(directories, linkerJitMode);
20449
20686
  const allSpecs = new Set(browserSpecs);
@@ -20454,7 +20691,7 @@ var REQUIRED_ANGULAR_SPECIFIERS_BASE, requiredAngularSpecifiers = (jitMode) => j
20454
20691
  const specifiers = Array.from(allSpecs);
20455
20692
  const entrypoints = await Promise.all(specifiers.map(async (specifier) => {
20456
20693
  const safeName = toSafeFileName2(specifier);
20457
- const entryPath = join33(tmpDir, `${safeName}.ts`);
20694
+ const entryPath = join34(tmpDir, `${safeName}.ts`);
20458
20695
  await Bun.write(entryPath, await generateVendorEntrySource(specifier));
20459
20696
  return entryPath;
20460
20697
  }));
@@ -20469,16 +20706,16 @@ var REQUIRED_ANGULAR_SPECIFIERS_BASE, requiredAngularSpecifiers = (jitMode) => j
20469
20706
  target: "bun",
20470
20707
  throw: false
20471
20708
  });
20472
- await rm6(tmpDir, { force: true, recursive: true });
20709
+ await rm7(tmpDir, { force: true, recursive: true });
20473
20710
  if (!result.success) {
20474
20711
  console.warn("\u26A0\uFE0F Angular server vendor build had errors:", result.logs);
20475
20712
  }
20476
20713
  return specifiers;
20477
20714
  }, computeAngularServerVendorPaths = (buildDir, specifiers) => {
20478
20715
  const paths = {};
20479
- const vendorDir = join33(buildDir, "angular", "vendor", "server");
20716
+ const vendorDir = join34(buildDir, "angular", "vendor", "server");
20480
20717
  for (const specifier of specifiers) {
20481
- paths[specifier] = join33(vendorDir, `${toSafeFileName2(specifier)}.js`);
20718
+ paths[specifier] = join34(vendorDir, `${toSafeFileName2(specifier)}.js`);
20482
20719
  }
20483
20720
  return paths;
20484
20721
  }, computeAngularServerVendorPathsAsync = async (buildDir, directories = [], linkerJitMode = true) => {
@@ -20534,17 +20771,17 @@ __export(exports_buildVueVendor, {
20534
20771
  buildVueVendor: () => buildVueVendor
20535
20772
  });
20536
20773
  import { mkdirSync as mkdirSync10 } from "fs";
20537
- import { join as join34 } from "path";
20538
- import { rm as rm7 } from "fs/promises";
20774
+ import { join as join35 } from "path";
20775
+ import { rm as rm8 } from "fs/promises";
20539
20776
  var {build: bunBuild5 } = globalThis.Bun;
20540
20777
  var vueSpecifiers, toSafeFileName3 = (specifier) => specifier.replace(/\//g, "_"), buildVueVendor = async (buildDir) => {
20541
- const vendorDir = join34(buildDir, "vue", "vendor");
20778
+ const vendorDir = join35(buildDir, "vue", "vendor");
20542
20779
  mkdirSync10(vendorDir, { recursive: true });
20543
- const tmpDir = join34(buildDir, "_vue_vendor_tmp");
20780
+ const tmpDir = join35(buildDir, "_vue_vendor_tmp");
20544
20781
  mkdirSync10(tmpDir, { recursive: true });
20545
20782
  const entrypoints = await Promise.all(vueSpecifiers.map(async (specifier) => {
20546
20783
  const safeName = toSafeFileName3(specifier);
20547
- const entryPath = join34(tmpDir, `${safeName}.ts`);
20784
+ const entryPath = join35(tmpDir, `${safeName}.ts`);
20548
20785
  await Bun.write(entryPath, `export * from '${specifier}';
20549
20786
  `);
20550
20787
  return entryPath;
@@ -20564,7 +20801,7 @@ var vueSpecifiers, toSafeFileName3 = (specifier) => specifier.replace(/\//g, "_"
20564
20801
  target: "browser",
20565
20802
  throw: false
20566
20803
  });
20567
- await rm7(tmpDir, { force: true, recursive: true });
20804
+ await rm8(tmpDir, { force: true, recursive: true });
20568
20805
  if (!result.success) {
20569
20806
  console.warn("\u26A0\uFE0F Vue vendor build had errors:", result.logs);
20570
20807
  return;
@@ -20572,7 +20809,7 @@ var vueSpecifiers, toSafeFileName3 = (specifier) => specifier.replace(/\//g, "_"
20572
20809
  const { readFileSync: readFileSync21, writeFileSync: writeFileSync8, readdirSync: readdirSync5 } = await import("fs");
20573
20810
  const files = readdirSync5(vendorDir).filter((f2) => f2.endsWith(".js"));
20574
20811
  for (const file4 of files) {
20575
- const filePath = join34(vendorDir, file4);
20812
+ const filePath = join35(vendorDir, file4);
20576
20813
  const content = readFileSync21(filePath, "utf-8");
20577
20814
  if (!content.includes("__VUE_HMR_RUNTIME__"))
20578
20815
  continue;
@@ -20599,8 +20836,8 @@ __export(exports_buildSvelteVendor, {
20599
20836
  buildSvelteVendor: () => buildSvelteVendor
20600
20837
  });
20601
20838
  import { mkdirSync as mkdirSync11 } from "fs";
20602
- import { join as join35 } from "path";
20603
- import { rm as rm8 } from "fs/promises";
20839
+ import { join as join36 } from "path";
20840
+ import { rm as rm9 } from "fs/promises";
20604
20841
  var {build: bunBuild6 } = globalThis.Bun;
20605
20842
  var svelteSpecifiers, isResolvable2 = (specifier) => {
20606
20843
  try {
@@ -20613,13 +20850,13 @@ var svelteSpecifiers, isResolvable2 = (specifier) => {
20613
20850
  const specifiers = resolveVendorSpecifiers();
20614
20851
  if (specifiers.length === 0)
20615
20852
  return;
20616
- const vendorDir = join35(buildDir, "svelte", "vendor");
20853
+ const vendorDir = join36(buildDir, "svelte", "vendor");
20617
20854
  mkdirSync11(vendorDir, { recursive: true });
20618
- const tmpDir = join35(buildDir, "_svelte_vendor_tmp");
20855
+ const tmpDir = join36(buildDir, "_svelte_vendor_tmp");
20619
20856
  mkdirSync11(tmpDir, { recursive: true });
20620
20857
  const entrypoints = await Promise.all(specifiers.map(async (specifier) => {
20621
20858
  const safeName = toSafeFileName4(specifier);
20622
- const entryPath = join35(tmpDir, `${safeName}.ts`);
20859
+ const entryPath = join36(tmpDir, `${safeName}.ts`);
20623
20860
  await Bun.write(entryPath, `export * from '${specifier}';
20624
20861
  `);
20625
20862
  return entryPath;
@@ -20634,7 +20871,7 @@ var svelteSpecifiers, isResolvable2 = (specifier) => {
20634
20871
  target: "browser",
20635
20872
  throw: false
20636
20873
  });
20637
- await rm8(tmpDir, { force: true, recursive: true });
20874
+ await rm9(tmpDir, { force: true, recursive: true });
20638
20875
  if (!result.success) {
20639
20876
  console.warn("\u26A0\uFE0F Svelte vendor build had errors:", result.logs);
20640
20877
  }
@@ -20670,10 +20907,10 @@ import {
20670
20907
  statSync as statSync3,
20671
20908
  writeFileSync as writeFileSync8
20672
20909
  } from "fs";
20673
- import { basename as basename14, dirname as dirname19, extname as extname10, join as join36, relative as relative15, resolve as resolve26 } from "path";
20910
+ import { basename as basename14, dirname as dirname20, extname as extname10, join as join37, relative as relative15, resolve as resolve26 } from "path";
20674
20911
  import { cwd, env as env2, exit } from "process";
20675
20912
  var {build: bunBuild7, Glob: Glob8 } = globalThis.Bun;
20676
- var isDev2, isBuildTraceEnabled = () => {
20913
+ var isBuildTraceEnabled = () => {
20677
20914
  const value = env2.ABSOLUTE_BUILD_TRACE?.toLowerCase();
20678
20915
  return value === "1" || value === "true" || value === "yes";
20679
20916
  }, collectConventionSourceFiles = (entry) => {
@@ -20804,8 +21041,8 @@ ${offenders.map((o3) => ` \u2022 ${o3}`).join(`
20804
21041
  mkdirSync12(htmxDestDir, { recursive: true });
20805
21042
  const glob = new Glob8("htmx*.min.js");
20806
21043
  for (const relPath of glob.scanSync({ cwd: htmxDir })) {
20807
- const src = join36(htmxDir, relPath);
20808
- const dest = join36(htmxDestDir, "htmx.min.js");
21044
+ const src = join37(htmxDir, relPath);
21045
+ const dest = join37(htmxDestDir, "htmx.min.js");
20809
21046
  copyFileSync2(src, dest);
20810
21047
  return;
20811
21048
  }
@@ -20882,7 +21119,7 @@ ${offenders.map((o3) => ` \u2022 ${o3}`).join(`
20882
21119
  vuePagesPath
20883
21120
  }) => {
20884
21121
  const { readdirSync: readDir } = await import("fs");
20885
- const devIndexDir = join36(buildPath, "_src_indexes");
21122
+ const devIndexDir = join37(buildPath, "_src_indexes");
20886
21123
  mkdirSync12(devIndexDir, { recursive: true });
20887
21124
  if (reactIndexesPath && reactPagesPath) {
20888
21125
  copyReactDevIndexes(reactIndexesPath, reactPagesPath, devIndexDir, readDir);
@@ -20900,35 +21137,35 @@ ${offenders.map((o3) => ` \u2022 ${o3}`).join(`
20900
21137
  const indexFiles = readDir(reactIndexesPath).filter((file4) => file4.endsWith(".tsx"));
20901
21138
  const pagesRel = relative15(process.cwd(), resolve26(reactPagesPath)).replace(/\\/g, "/");
20902
21139
  for (const file4 of indexFiles) {
20903
- let content = readFileSync21(join36(reactIndexesPath, file4), "utf-8");
21140
+ let content = readFileSync21(join37(reactIndexesPath, file4), "utf-8");
20904
21141
  content = content.replace(/from\s*['"]([^'"]*\/pages\/([^'"]+))['"]/g, (_match, _fullPath, componentName) => `from '/@src/${pagesRel}/${componentName}'`);
20905
- writeFileSync8(join36(devIndexDir, file4), content);
21142
+ writeFileSync8(join37(devIndexDir, file4), content);
20906
21143
  }
20907
21144
  }, copySvelteDevIndexes = (svelteDir, sveltePagesPath, svelteEntries, devIndexDir) => {
20908
- const svelteIndexDir = join36(getFrameworkGeneratedDir("svelte"), "indexes");
21145
+ const svelteIndexDir = join37(getFrameworkGeneratedDir("svelte"), "indexes");
20909
21146
  const sveltePageEntries = svelteEntries.filter((file4) => resolve26(file4).startsWith(resolve26(sveltePagesPath)));
20910
21147
  for (const entry of sveltePageEntries) {
20911
21148
  const name = basename14(entry).replace(/\.svelte(\.(ts|js))?$/, "");
20912
- const indexFile = join36(svelteIndexDir, "pages", `${name}.js`);
21149
+ const indexFile = join37(svelteIndexDir, "pages", `${name}.js`);
20913
21150
  if (!existsSync27(indexFile))
20914
21151
  continue;
20915
21152
  let content = readFileSync21(indexFile, "utf-8");
20916
21153
  const srcRel = relative15(process.cwd(), resolve26(entry)).replace(/\\/g, "/");
20917
21154
  content = content.replace(/import\s+Component\s+from\s+['"]([^'"]+)['"]/, `import Component from "/@src/${srcRel}"`);
20918
- writeFileSync8(join36(devIndexDir, `${name}.svelte.js`), content);
21155
+ writeFileSync8(join37(devIndexDir, `${name}.svelte.js`), content);
20919
21156
  }
20920
21157
  }, copyVueDevIndexes = (vueDir, vuePagesPath, vueEntries, devIndexDir) => {
20921
- const vueIndexDir = join36(getFrameworkGeneratedDir("vue"), "indexes");
21158
+ const vueIndexDir = join37(getFrameworkGeneratedDir("vue"), "indexes");
20922
21159
  const vuePageEntries = vueEntries.filter((file4) => resolve26(file4).startsWith(resolve26(vuePagesPath)));
20923
21160
  for (const entry of vuePageEntries) {
20924
21161
  const name = basename14(entry, ".vue");
20925
- const indexFile = join36(vueIndexDir, `${name}.js`);
21162
+ const indexFile = join37(vueIndexDir, `${name}.js`);
20926
21163
  if (!existsSync27(indexFile))
20927
21164
  continue;
20928
21165
  let content = readFileSync21(indexFile, "utf-8");
20929
21166
  const srcRel = relative15(process.cwd(), resolve26(entry)).replace(/\\/g, "/");
20930
21167
  content = content.replace(/import\s+Comp(?:\s*,\s*\*\s+as\s+\w+)?\s+from\s+['"]([^'"]+)['"]/, (match) => match.replace(/from\s+['"][^'"]+['"]/, `from "/@src/${srcRel}"`));
20931
- writeFileSync8(join36(devIndexDir, `${name}.vue.js`), content);
21168
+ writeFileSync8(join37(devIndexDir, `${name}.vue.js`), content);
20932
21169
  }
20933
21170
  }, resolveVueRuntimeId = (content, firstUseName, outputPath, projectRoot) => {
20934
21171
  const varIdx = content.indexOf(`var ${firstUseName} =`);
@@ -21039,7 +21276,7 @@ ${content.slice(firstUseIdx)}`;
21039
21276
  if (changed)
21040
21277
  writeFileSync8(outputPath, content);
21041
21278
  }
21042
- }, vueFeatureFlags, bunBuildPassKeys, bunBuildPassKeySet, reservedBunBuildConfigKeys, passLockedKeys, isObject = (value) => typeof value === "object" && value !== null, isBunBuildPassConfig = (config) => isObject(config) && Object.keys(config).some((key) => bunBuildPassKeySet.has(key)), sanitizeBunBuildOverride = (override, extraReservedKeys = new Set) => {
21279
+ }, bunBuildPassKeys, bunBuildPassKeySet, reservedBunBuildConfigKeys, passLockedKeys, isObject = (value) => typeof value === "object" && value !== null, isBunBuildPassConfig = (config) => isObject(config) && Object.keys(config).some((key) => bunBuildPassKeySet.has(key)), sanitizeBunBuildOverride = (override, extraReservedKeys = new Set) => {
21043
21280
  if (!override)
21044
21281
  return {};
21045
21282
  const sanitized = { ...override };
@@ -21077,6 +21314,8 @@ ${content.slice(firstUseIdx)}`;
21077
21314
  };
21078
21315
  const result = {
21079
21316
  ...merged,
21317
+ banner: [base.banner, sanitized.banner].filter(Boolean).join(`
21318
+ `) || undefined,
21080
21319
  define: base.define || sanitized.define ? {
21081
21320
  ...sanitized.define ?? {},
21082
21321
  ...base.define ?? {}
@@ -21098,6 +21337,7 @@ ${content.slice(firstUseIdx)}`;
21098
21337
  htmxDirectory,
21099
21338
  angularDirectory,
21100
21339
  emberDirectory,
21340
+ pwa,
21101
21341
  svelteDirectory,
21102
21342
  vueDirectory,
21103
21343
  stylesConfig,
@@ -21112,6 +21352,8 @@ ${content.slice(firstUseIdx)}`;
21112
21352
  sourcemaps
21113
21353
  }) => {
21114
21354
  const buildStart = performance.now();
21355
+ const isDev2 = resolveBuildDevelopmentMode(mode, env2.NODE_ENV);
21356
+ const vueFeatureFlags = resolveVueFeatureFlags(isDev2);
21115
21357
  const projectRoot = cwd();
21116
21358
  const traceEnabled = isBuildTraceEnabled();
21117
21359
  const traceEvents = [];
@@ -21161,10 +21403,10 @@ ${content.slice(firstUseIdx)}`;
21161
21403
  restoreTracePhase();
21162
21404
  return;
21163
21405
  }
21164
- const traceDir = join36(buildPath2, ".absolute-trace");
21406
+ const traceDir = join37(buildPath2, ".absolute-trace");
21165
21407
  const timestamp = new Date().toISOString().replace(/[:.]/g, "-");
21166
21408
  mkdirSync12(traceDir, { recursive: true });
21167
- writeFileSync8(join36(traceDir, `build-trace-${timestamp}.json`), JSON.stringify({
21409
+ writeFileSync8(join37(traceDir, `build-trace-${timestamp}.json`), JSON.stringify({
21168
21410
  events: traceEvents,
21169
21411
  frameworks: traceFrameworkNames,
21170
21412
  generatedAt: new Date().toISOString(),
@@ -21195,16 +21437,16 @@ ${content.slice(firstUseIdx)}`;
21195
21437
  const stylesPath = typeof stylesConfig === "string" ? stylesConfig : stylesConfig?.path;
21196
21438
  const stylesIgnore = typeof stylesConfig === "object" ? stylesConfig.ignore : undefined;
21197
21439
  const stylesDir = stylesPath && validateSafePath(stylesPath, projectRoot);
21198
- const reactIndexesPath = reactDir && join36(getFrameworkGeneratedDir("react"), "indexes");
21199
- const reactPagesPath = reactDir && join36(reactDir, "pages");
21200
- const htmlPagesPath = htmlDir && join36(htmlDir, "pages");
21201
- const htmlScriptsPath = htmlDir && join36(htmlDir, "scripts");
21202
- const sveltePagesPath = svelteDir && join36(svelteDir, "pages");
21203
- const vuePagesPath = vueDir && join36(vueDir, "pages");
21204
- const htmxPagesPath = htmxDir && join36(htmxDir, "pages");
21205
- const htmxScriptsPath = htmxDir && join36(htmxDir, "scripts");
21206
- const angularPagesPath = angularDir && join36(angularDir, "pages");
21207
- const emberPagesPath = emberDir && join36(emberDir, "pages");
21440
+ const reactIndexesPath = reactDir && join37(getFrameworkGeneratedDir("react"), "indexes");
21441
+ const reactPagesPath = reactDir && join37(reactDir, "pages");
21442
+ const htmlPagesPath = htmlDir && join37(htmlDir, "pages");
21443
+ const htmlScriptsPath = htmlDir && join37(htmlDir, "scripts");
21444
+ const sveltePagesPath = svelteDir && join37(svelteDir, "pages");
21445
+ const vuePagesPath = vueDir && join37(vueDir, "pages");
21446
+ const htmxPagesPath = htmxDir && join37(htmxDir, "pages");
21447
+ const htmxScriptsPath = htmxDir && join37(htmxDir, "scripts");
21448
+ const angularPagesPath = angularDir && join37(angularDir, "pages");
21449
+ const emberPagesPath = emberDir && join37(emberDir, "pages");
21208
21450
  const frontends = [
21209
21451
  reactDir,
21210
21452
  htmlDir,
@@ -21229,13 +21471,15 @@ ${content.slice(firstUseIdx)}`;
21229
21471
  framework: frameworkNames[0],
21230
21472
  frameworks: frameworkNames,
21231
21473
  mode: mode ?? (isDev2 ? "development" : "production"),
21474
+ pwa: Boolean(pwa),
21475
+ pwaSync: Boolean(pwa?.sync),
21232
21476
  tailwind: Boolean(tailwind)
21233
21477
  });
21234
21478
  const generatedRoot = getGeneratedRoot(projectRoot);
21235
21479
  const sourceClientRoots = [
21236
21480
  htmlDir,
21237
21481
  htmxDir,
21238
- islandBootstrapPath && dirname19(islandBootstrapPath)
21482
+ islandBootstrapPath && dirname20(islandBootstrapPath)
21239
21483
  ].filter((dir) => Boolean(dir));
21240
21484
  const usesGenerated = Boolean(reactDir) || Boolean(svelteDir) || Boolean(vueDir) || Boolean(angularDir);
21241
21485
  if (usesGenerated)
@@ -21263,8 +21507,8 @@ ${content.slice(firstUseIdx)}`;
21263
21507
  const [firstEntry] = serverDirMap;
21264
21508
  if (!firstEntry)
21265
21509
  throw new Error("Expected at least one server directory entry");
21266
- serverRoot = join36(firstEntry.dir, firstEntry.subdir);
21267
- serverOutDir = join36(buildPath, basename14(firstEntry.dir));
21510
+ serverRoot = join37(firstEntry.dir, firstEntry.subdir);
21511
+ serverOutDir = join37(buildPath, basename14(firstEntry.dir));
21268
21512
  } else if (serverDirMap.length > 1) {
21269
21513
  serverRoot = commonAncestor(serverDirMap.map((entry) => entry.dir), projectRoot);
21270
21514
  serverOutDir = buildPath;
@@ -21273,6 +21517,12 @@ ${content.slice(firstUseIdx)}`;
21273
21517
  await tracePhase("build-dir/create", () => mkdirSync12(buildPath, { recursive: true }));
21274
21518
  if (publicPath)
21275
21519
  await tracePhase("public/copy", () => cpSync(publicPath, buildPath, { force: true, recursive: true }));
21520
+ const pwaArtifacts = pwa ? await tracePhase("pwa/materialize", () => materializeAbsolutePwa({
21521
+ buildPath,
21522
+ config: pwa,
21523
+ generatedRoot,
21524
+ write: !isIncremental
21525
+ })) : undefined;
21276
21526
  const filterToIncrementalEntries = (entryPoints, mapToSource) => {
21277
21527
  if (!isIncremental || !incrementalFiles)
21278
21528
  return entryPoints;
@@ -21292,7 +21542,7 @@ ${content.slice(firstUseIdx)}`;
21292
21542
  await tracePhase("react/index-generation", () => generateReactIndexFiles(reactPagesPath, reactIndexesPath, hmr));
21293
21543
  }
21294
21544
  if (assetsPath && (!isIncremental || normalizedIncrementalFiles?.some((f2) => f2.includes("/assets/")))) {
21295
- await tracePhase("assets/copy", () => cpSync(assetsPath, join36(buildPath, "assets"), {
21545
+ await tracePhase("assets/copy", () => cpSync(assetsPath, join37(buildPath, "assets"), {
21296
21546
  force: true,
21297
21547
  recursive: true
21298
21548
  }));
@@ -21406,11 +21656,11 @@ ${content.slice(firstUseIdx)}`;
21406
21656
  }
21407
21657
  }
21408
21658
  if (htmlDefaults.error || htmlDefaults.notFound || htmlDefaults.loading || Object.keys(htmlPages).length > 0) {
21409
- const htmlConventionsOutDir = join36(buildPath, "conventions", "html");
21659
+ const htmlConventionsOutDir = join37(buildPath, "conventions", "html");
21410
21660
  mkdirSync12(htmlConventionsOutDir, { recursive: true });
21411
21661
  const htmlPathRemap = new Map;
21412
21662
  for (const sourcePath of htmlConventionSources) {
21413
- const dest = join36(htmlConventionsOutDir, basename14(sourcePath));
21663
+ const dest = join37(htmlConventionsOutDir, basename14(sourcePath));
21414
21664
  cpSync(sourcePath, dest, { force: true });
21415
21665
  htmlPathRemap.set(sourcePath, dest);
21416
21666
  }
@@ -21453,7 +21703,7 @@ ${content.slice(firstUseIdx)}`;
21453
21703
  const reactEntries = isIncremental && reactIndexesPath && reactPagesPath ? filterToIncrementalEntries(allReactEntries, (entry) => {
21454
21704
  if (entry.startsWith(resolve26(reactIndexesPath))) {
21455
21705
  const pageName = basename14(entry, ".tsx");
21456
- return join36(reactPagesPath, `${pageName}.tsx`);
21706
+ return join37(reactPagesPath, `${pageName}.tsx`);
21457
21707
  }
21458
21708
  return null;
21459
21709
  }) : allReactEntries;
@@ -21649,7 +21899,7 @@ ${content.slice(firstUseIdx)}`;
21649
21899
  const compileReactConventions = async () => {
21650
21900
  if (reactConventionSources.length === 0)
21651
21901
  return emptyStringArray;
21652
- const destDir = join36(buildPath, "conventions", "react");
21902
+ const destDir = join37(buildPath, "conventions", "react");
21653
21903
  rmSync2(destDir, { force: true, recursive: true });
21654
21904
  mkdirSync12(destDir, { recursive: true });
21655
21905
  const destPaths = await Promise.all(reactConventionSources.map(async (source, idx) => {
@@ -21664,7 +21914,7 @@ ${content.slice(firstUseIdx)}`;
21664
21914
  stylePreprocessorPlugin2,
21665
21915
  createBunStringRawUnicodePlugin()
21666
21916
  ],
21667
- root: dirname19(source),
21917
+ root: dirname20(source),
21668
21918
  target: "bun",
21669
21919
  throw: false,
21670
21920
  tsconfig: "./tsconfig.json"
@@ -21692,7 +21942,7 @@ ${content.slice(firstUseIdx)}`;
21692
21942
  angularConventionSources.length > 0 && angularDir ? tracePhase("compile/convention-angular", () => Promise.resolve().then(() => (init_compileAngular(), exports_compileAngular)).then((mod) => mod.compileAngular(angularConventionSources, angularDir, hmr, styleTransformConfig))) : { serverPaths: emptyStringArray }
21693
21943
  ]);
21694
21944
  const bundleConventionFiles = async (framework, compiledPaths) => {
21695
- const destDir = join36(buildPath, "conventions", framework);
21945
+ const destDir = join37(buildPath, "conventions", framework);
21696
21946
  rmSync2(destDir, { force: true, recursive: true });
21697
21947
  mkdirSync12(destDir, { recursive: true });
21698
21948
  const destPaths = await Promise.all(compiledPaths.map(async (compiledPath, idx) => {
@@ -21753,7 +22003,7 @@ ${content.slice(firstUseIdx)}`;
21753
22003
  ...islandBootstrapPath ? [islandBootstrapPath] : []
21754
22004
  ];
21755
22005
  const [onlyWorkerClientEntry] = urlReferencedFiles;
21756
- const workerClientRoot = urlReferencedFiles.length === 1 && onlyWorkerClientEntry ? dirname19(onlyWorkerClientEntry) : commonAncestor(urlReferencedFiles.map((file4) => dirname19(file4)), projectRoot);
22006
+ const workerClientRoot = urlReferencedFiles.length === 1 && onlyWorkerClientEntry ? dirname20(onlyWorkerClientEntry) : commonAncestor(urlReferencedFiles.map((file4) => dirname20(file4)), projectRoot);
21757
22007
  const islandEntryResult = islandBuildInfo ? await tracePhase("islands/client-entry-generation", () => generateIslandEntryPoints({
21758
22008
  buildInfo: islandBuildInfo,
21759
22009
  buildPath,
@@ -21764,7 +22014,7 @@ ${content.slice(firstUseIdx)}`;
21764
22014
  }
21765
22015
  })) : {
21766
22016
  entries: [],
21767
- generatedRoot: join36(buildPath, "_island_entries")
22017
+ generatedRoot: join37(buildPath, "_island_entries")
21768
22018
  };
21769
22019
  const islandClientEntryPoints = islandEntryResult.entries.map((entry) => entry.entryPath);
21770
22020
  if (serverEntryPoints.length === 0 && reactClientEntryPoints.length === 0 && nonReactClientEntryPoints.length === 0 && urlReferencedFiles.length === 0 && islandClientEntryPoints.length === 0 && htmxDir === undefined && htmlDir === undefined) {
@@ -21800,7 +22050,7 @@ ${content.slice(firstUseIdx)}`;
21800
22050
  return {};
21801
22051
  }
21802
22052
  if (hmr && reactIndexesPath && reactClientEntryPoints.length > 0) {
21803
- const refreshEntry = join36(reactIndexesPath, "_refresh.tsx");
22053
+ const refreshEntry = join37(reactIndexesPath, "_refresh.tsx");
21804
22054
  if (!reactClientEntryPoints.includes(refreshEntry))
21805
22055
  reactClientEntryPoints.push(refreshEntry);
21806
22056
  }
@@ -21889,6 +22139,7 @@ ${content.slice(firstUseIdx)}`;
21889
22139
  const svelteResolveConditions = svelteDir ? ["svelte", "main"] : undefined;
21890
22140
  const htmlScriptPlugin = hmr ? createHTMLScriptHMRPlugin(htmlDir, htmxDir) : undefined;
21891
22141
  const reactBuildConfig = reactClientEntryPoints.length > 0 ? mergeBunBuildConfig({
22142
+ banner: pwaArtifacts?.bootstrapBanner,
21892
22143
  entrypoints: reactClientEntryPoints,
21893
22144
  ...Object.keys(reactExternalPaths).length > 0 ? { external: Object.keys(reactExternalPaths) } : {},
21894
22145
  format: "esm",
@@ -21910,19 +22161,19 @@ ${content.slice(firstUseIdx)}`;
21910
22161
  throw: false
21911
22162
  }, resolveBunBuildOverride(bunBuildConfig, "reactClient")) : undefined;
21912
22163
  if (reactDir && reactClientEntryPoints.length > 0) {
21913
- rmSync2(join36(buildPath, "react", "generated", "indexes"), {
22164
+ rmSync2(join37(buildPath, "react", "generated", "indexes"), {
21914
22165
  force: true,
21915
22166
  recursive: true
21916
22167
  });
21917
22168
  }
21918
22169
  if (angularDir && angularClientPaths.length > 0) {
21919
- rmSync2(join36(buildPath, "angular", "indexes"), {
22170
+ rmSync2(join37(buildPath, "angular", "indexes"), {
21920
22171
  force: true,
21921
22172
  recursive: true
21922
22173
  });
21923
22174
  }
21924
22175
  if (islandClientEntryPoints.length > 0) {
21925
- rmSync2(join36(buildPath, "islands"), {
22176
+ rmSync2(join37(buildPath, "islands"), {
21926
22177
  force: true,
21927
22178
  recursive: true
21928
22179
  });
@@ -21959,6 +22210,7 @@ ${content.slice(firstUseIdx)}`;
21959
22210
  }, resolveBunBuildOverride(bunBuildConfig, "server")))) : undefined,
21960
22211
  reactBuildConfig ? tracePhase("bun/react-client", () => bunBuild7(reactBuildConfig)) : undefined,
21961
22212
  nonReactClientEntryPoints.length > 0 ? tracePhase("bun/non-react-client", () => bunBuild7(mergeBunBuildConfig({
22213
+ banner: pwaArtifacts?.bootstrapBanner,
21962
22214
  conditions: svelteResolveConditions,
21963
22215
  define: vueDirectory ? vueFeatureFlags : undefined,
21964
22216
  entrypoints: nonReactClientEntryPoints,
@@ -22004,6 +22256,7 @@ ${content.slice(firstUseIdx)}`;
22004
22256
  tsconfig: "./tsconfig.json"
22005
22257
  }, resolveBunBuildOverride(bunBuildConfig, "nonReactClient")))) : undefined,
22006
22258
  islandClientEntryPoints.length > 0 ? tracePhase("bun/island-client", () => bunBuild7(mergeBunBuildConfig({
22259
+ banner: pwaArtifacts?.bootstrapBanner,
22007
22260
  conditions: svelteResolveConditions,
22008
22261
  define: vueDirectory ? vueFeatureFlags : undefined,
22009
22262
  entrypoints: islandClientEntryPoints,
@@ -22034,7 +22287,7 @@ ${content.slice(firstUseIdx)}`;
22034
22287
  globalCssEntries.length > 0 ? tracePhase("bun/global-css", () => bunBuild7(mergeBunBuildConfig({
22035
22288
  entrypoints: globalCssEntries,
22036
22289
  naming: `[dir]/[name].[hash].[ext]`,
22037
- outdir: stylesDir ? join36(buildPath, basename14(stylesDir)) : buildPath,
22290
+ outdir: stylesDir ? join37(buildPath, basename14(stylesDir)) : buildPath,
22038
22291
  plugins: [stylePreprocessorPlugin2],
22039
22292
  root: stylesDir || clientRoot,
22040
22293
  target: "browser",
@@ -22043,7 +22296,7 @@ ${content.slice(firstUseIdx)}`;
22043
22296
  vueCssPaths.length > 0 ? tracePhase("bun/vue-css", () => bunBuild7(mergeBunBuildConfig({
22044
22297
  entrypoints: vueCssPaths,
22045
22298
  naming: `[name].[hash].[ext]`,
22046
- outdir: join36(buildPath, assetsPath ? basename14(assetsPath) : "assets", "css"),
22299
+ outdir: join37(buildPath, assetsPath ? basename14(assetsPath) : "assets", "css"),
22047
22300
  target: "browser",
22048
22301
  throw: false
22049
22302
  }, resolveBunBuildOverride(bunBuildConfig, "vueCss")))) : undefined
@@ -22067,15 +22320,15 @@ ${content.slice(firstUseIdx)}`;
22067
22320
  }
22068
22321
  if (!isDev2 && resolveClientSourcemap(sourcemaps, isDev2) === "external") {
22069
22322
  const { chainExternalSourcemap: chainExternalSourcemap2 } = await Promise.resolve().then(() => (init_chainInlineSourcemaps(), exports_chainInlineSourcemaps));
22070
- const sourcemapDir = join36(projectRoot, "sourcemaps");
22323
+ const sourcemapDir = join37(projectRoot, "sourcemaps");
22071
22324
  mkdirSync12(sourcemapDir, { recursive: true });
22072
22325
  const mapFiles = readdirSync5(buildPath, {
22073
22326
  encoding: "utf8",
22074
22327
  recursive: true
22075
- }).filter((entry) => entry.endsWith(".js.map") && !entry.includes("node_modules")).map((entry) => join36(buildPath, entry));
22328
+ }).filter((entry) => entry.endsWith(".js.map") && !entry.includes("node_modules")).map((entry) => join37(buildPath, entry));
22076
22329
  for (const mapPath of mapFiles) {
22077
22330
  chainExternalSourcemap2(mapPath);
22078
- renameSync(mapPath, join36(sourcemapDir, basename14(mapPath)));
22331
+ renameSync(mapPath, join37(sourcemapDir, basename14(mapPath)));
22079
22332
  const jsPath = mapPath.slice(0, -4);
22080
22333
  try {
22081
22334
  const javascript = readFileSync21(jsPath, "utf-8").replace(/\n?\/\/# sourceMappingURL=[^\n]*\s*$/, `
@@ -22149,7 +22402,7 @@ ${content.slice(firstUseIdx)}`;
22149
22402
  await tracePhase("postprocess/island-vendor-imports", () => rewriteBuildOutputs2(islandClientOutputs, allIslandVendorPaths));
22150
22403
  }
22151
22404
  if (!hmr) {
22152
- const reactVendorDir = join36(buildPath, "react", "vendor");
22405
+ const reactVendorDir = join37(buildPath, "react", "vendor");
22153
22406
  const vendorChunkPaths = existsSync27(reactVendorDir) ? [
22154
22407
  ...new Glob8("**/*.js").scanSync({
22155
22408
  absolute: true,
@@ -22166,7 +22419,7 @@ ${content.slice(firstUseIdx)}`;
22166
22419
  if (serverOutputs.length > 0 && angularServerVendorPaths2 && Object.keys(angularServerVendorPaths2).length > 0) {
22167
22420
  const { rewriteBuildOutputsWith: rewriteBuildOutputsWith2 } = await Promise.resolve().then(() => (init_rewriteImportsPlugin(), exports_rewriteImportsPlugin));
22168
22421
  await tracePhase("postprocess/server-angular-vendor-imports", () => rewriteBuildOutputsWith2(serverOutputs, (artifact) => {
22169
- const fileDir = dirname19(artifact.path);
22422
+ const fileDir = dirname20(artifact.path);
22170
22423
  const relativePaths = {};
22171
22424
  for (const [specifier, absolute] of Object.entries(angularServerVendorPaths2)) {
22172
22425
  const rel = relative15(fileDir, absolute);
@@ -22305,7 +22558,7 @@ ${content.slice(firstUseIdx)}`;
22305
22558
  const processHtmlPages = async () => {
22306
22559
  if (!(htmlDir && htmlPagesPath))
22307
22560
  return;
22308
- const outputHtmlPages = isSingle ? join36(buildPath, "pages") : join36(buildPath, basename14(htmlDir), "pages");
22561
+ const outputHtmlPages = isSingle ? join37(buildPath, "pages") : join37(buildPath, basename14(htmlDir), "pages");
22309
22562
  mkdirSync12(outputHtmlPages, { recursive: true });
22310
22563
  cpSync(htmlPagesPath, outputHtmlPages, {
22311
22564
  force: true,
@@ -22320,6 +22573,10 @@ ${content.slice(firstUseIdx)}`;
22320
22573
  for (const htmlFile of htmlPageFiles) {
22321
22574
  if (hmr)
22322
22575
  injectHMRIntoHTMLFile(htmlFile, "html");
22576
+ if (pwaArtifacts) {
22577
+ const source = readFileSync21(htmlFile, "utf8");
22578
+ writeFileSync8(htmlFile, injectPwaBootstrapHtml(source));
22579
+ }
22323
22580
  const fileName = basename14(htmlFile, ".html");
22324
22581
  if (manifest[fileName] && manifest[fileName] !== htmlFile) {
22325
22582
  warnManifestKeyCollision(fileName, manifest[fileName], htmlFile);
@@ -22330,14 +22587,14 @@ ${content.slice(firstUseIdx)}`;
22330
22587
  const processHtmxPages = async () => {
22331
22588
  if (!(htmxDir && htmxPagesPath))
22332
22589
  return;
22333
- const outputHtmxPages = isSingle ? join36(buildPath, "pages") : join36(buildPath, basename14(htmxDir), "pages");
22590
+ const outputHtmxPages = isSingle ? join37(buildPath, "pages") : join37(buildPath, basename14(htmxDir), "pages");
22334
22591
  mkdirSync12(outputHtmxPages, { recursive: true });
22335
22592
  cpSync(htmxPagesPath, outputHtmxPages, {
22336
22593
  force: true,
22337
22594
  recursive: true
22338
22595
  });
22339
22596
  if (shouldCopyHtmx) {
22340
- const htmxDestDir = isSingle ? buildPath : join36(buildPath, basename14(htmxDir));
22597
+ const htmxDestDir = isSingle ? buildPath : join37(buildPath, basename14(htmxDir));
22341
22598
  copyHtmxVendor(htmxDir, htmxDestDir);
22342
22599
  }
22343
22600
  if (shouldUpdateHtmxAssetPaths) {
@@ -22349,6 +22606,10 @@ ${content.slice(firstUseIdx)}`;
22349
22606
  for (const htmxFile of htmxPageFiles) {
22350
22607
  if (hmr)
22351
22608
  injectHMRIntoHTMLFile(htmxFile, "htmx");
22609
+ if (pwaArtifacts) {
22610
+ const source = readFileSync21(htmxFile, "utf8");
22611
+ writeFileSync8(htmxFile, injectPwaBootstrapHtml(source));
22612
+ }
22352
22613
  const fileName = basename14(htmxFile, ".html");
22353
22614
  if (manifest[fileName] && manifest[fileName] !== htmxFile) {
22354
22615
  warnManifestKeyCollision(fileName, manifest[fileName], htmxFile);
@@ -22387,7 +22648,7 @@ ${content.slice(firstUseIdx)}`;
22387
22648
  }
22388
22649
  await tracePhase("cleanup/generated", () => cleanup({
22389
22650
  angularDir,
22390
- preserveAngularGenerated: skipAngularClientBundle,
22651
+ preserveAngularGenerated: hmr && angularDir !== undefined,
22391
22652
  reactDir,
22392
22653
  svelteDir,
22393
22654
  vueDir
@@ -22398,7 +22659,9 @@ ${content.slice(firstUseIdx)}`;
22398
22659
  sendTelemetryEvent("build:complete", {
22399
22660
  durationMs: Math.round(performance.now() - buildStart),
22400
22661
  frameworks: frameworkNames,
22401
- mode: mode ?? (isDev2 ? "development" : "production")
22662
+ mode: mode ?? (isDev2 ? "development" : "production"),
22663
+ pwa: Boolean(pwa),
22664
+ pwaSync: Boolean(pwa?.sync)
22402
22665
  });
22403
22666
  const [reactSpaHosts, svelteSpaHosts, vueSpaHosts, angularSpaHosts] = await Promise.all([
22404
22667
  reactDir ? Promise.resolve().then(() => (init_staticAnalyzeSpaRoutes2(), exports_staticAnalyzeSpaRoutes2)).then((module) => module.analyzeReactSpaRoutes(reactDir)) : [],
@@ -22422,7 +22685,7 @@ ${content.slice(firstUseIdx)}`;
22422
22685
  }))
22423
22686
  ];
22424
22687
  setSpaRouteManifest(spaRouteHosts);
22425
- writeFileSync8(join36(buildPath, "spa-routes.json"), JSON.stringify(spaRouteHosts, null, "\t"));
22688
+ writeFileSync8(join37(buildPath, "spa-routes.json"), JSON.stringify(spaRouteHosts, null, "\t"));
22426
22689
  if (isIncremental) {
22427
22690
  writeBuildTrace(buildPath);
22428
22691
  return {
@@ -22431,9 +22694,9 @@ ${content.slice(firstUseIdx)}`;
22431
22694
  manifest
22432
22695
  };
22433
22696
  }
22434
- writeFileSync8(join36(buildPath, "manifest.json"), JSON.stringify(manifest, null, "\t"));
22697
+ writeFileSync8(join37(buildPath, "manifest.json"), JSON.stringify(manifest, null, "\t"));
22435
22698
  if (Object.keys(conventionsMap).length > 0) {
22436
- writeFileSync8(join36(buildPath, "conventions.json"), JSON.stringify(conventionsMap, null, "\t"));
22699
+ writeFileSync8(join37(buildPath, "conventions.json"), JSON.stringify(conventionsMap, null, "\t"));
22437
22700
  }
22438
22701
  writeBuildTrace(buildPath);
22439
22702
  if (mode === "production") {
@@ -22504,7 +22767,7 @@ var init_build = __esm(() => {
22504
22767
  init_logger();
22505
22768
  init_validateSafePath();
22506
22769
  init_spaRouteManifest();
22507
- isDev2 = env2.NODE_ENV === "development";
22770
+ init_pwa();
22508
22771
  REACT_VENDOR_SPECIFIERS = [
22509
22772
  "react-dom/client",
22510
22773
  "react-refresh/runtime",
@@ -22541,11 +22804,6 @@ var init_build = __esm(() => {
22541
22804
  `if(nv&&ov&&typeof nv==="object"&&"value"in nv&&!nv.effect&&typeof nv.value===typeof ov.value)nv.value=ov.value;}`,
22542
22805
  `}}return r;};}`
22543
22806
  ].join("");
22544
- vueFeatureFlags = {
22545
- __VUE_OPTIONS_API__: "true",
22546
- __VUE_PROD_DEVTOOLS__: isDev2 ? "true" : "false",
22547
- __VUE_PROD_HYDRATION_MISMATCH_DETAILS__: isDev2 ? "true" : "false"
22548
- };
22549
22807
  bunBuildPassKeys = [
22550
22808
  "server",
22551
22809
  "reactClient",
@@ -22572,8 +22830,8 @@ var init_build = __esm(() => {
22572
22830
 
22573
22831
  // src/build/buildEmberVendor.ts
22574
22832
  import { mkdirSync as mkdirSync13, existsSync as existsSync28 } from "fs";
22575
- import { join as join37 } from "path";
22576
- import { rm as rm9 } from "fs/promises";
22833
+ import { join as join38 } from "path";
22834
+ import { rm as rm10 } from "fs/promises";
22577
22835
  var {build: bunBuild8 } = globalThis.Bun;
22578
22836
  var toSafeFileName5 = (specifier) => specifier.replace(/^@/, "").replace(/\//g, "_"), generateMacrosShim = () => `// Generated shim for @embroider/macros \u2014 provides minimal runtime
22579
22837
  // implementations for macros that would normally be replaced at
@@ -22624,7 +22882,7 @@ export const importSync = (specifier) => {
22624
22882
  if (standaloneSpecifiers.has(specifier)) {
22625
22883
  return { resolveTo: specifier, specifier };
22626
22884
  }
22627
- const emberInternalPath = join37(cwd2, "node_modules/ember-source/dist/packages", specifier, "index.js");
22885
+ const emberInternalPath = join38(cwd2, "node_modules/ember-source/dist/packages", specifier, "index.js");
22628
22886
  if (!existsSync28(emberInternalPath)) {
22629
22887
  throw new Error(`Ember vendor build: cannot find ${specifier} at ${emberInternalPath}. ` + `Is ember-source installed and at least 6.12?`);
22630
22888
  }
@@ -22656,7 +22914,7 @@ export const importSync = (specifier) => {
22656
22914
  if (standalonePackages.has(args.path)) {
22657
22915
  return;
22658
22916
  }
22659
- const internal = join37(cwd2, "node_modules/ember-source/dist/packages", args.path, "index.js");
22917
+ const internal = join38(cwd2, "node_modules/ember-source/dist/packages", args.path, "index.js");
22660
22918
  if (existsSync28(internal)) {
22661
22919
  return { path: internal };
22662
22920
  }
@@ -22664,16 +22922,16 @@ export const importSync = (specifier) => {
22664
22922
  });
22665
22923
  }
22666
22924
  }), buildEmberVendor = async (buildDir, cwd2 = process.cwd()) => {
22667
- const vendorDir = join37(buildDir, "ember", "vendor");
22925
+ const vendorDir = join38(buildDir, "ember", "vendor");
22668
22926
  mkdirSync13(vendorDir, { recursive: true });
22669
- const tmpDir = join37(buildDir, "_ember_vendor_tmp");
22927
+ const tmpDir = join38(buildDir, "_ember_vendor_tmp");
22670
22928
  mkdirSync13(tmpDir, { recursive: true });
22671
- const macrosShimPath = join37(tmpDir, "embroider_macros_shim.js");
22929
+ const macrosShimPath = join38(tmpDir, "embroider_macros_shim.js");
22672
22930
  await Bun.write(macrosShimPath, generateMacrosShim());
22673
22931
  const resolutions = REQUIRED_EMBER_SPECIFIERS.map((specifier) => resolveEmberSpecifier(specifier, cwd2));
22674
22932
  const entrypoints = await Promise.all(resolutions.map(async (resolution) => {
22675
22933
  const safeName = toSafeFileName5(resolution.specifier);
22676
- const entryPath = join37(tmpDir, `${safeName}.js`);
22934
+ const entryPath = join38(tmpDir, `${safeName}.js`);
22677
22935
  const source = resolution.specifier === "@embroider/macros" ? `export * from ${JSON.stringify(macrosShimPath)};
22678
22936
  ` : generateVendorEntrySource2(resolution);
22679
22937
  await Bun.write(entryPath, source);
@@ -22690,7 +22948,7 @@ export const importSync = (specifier) => {
22690
22948
  target: "browser",
22691
22949
  throw: false
22692
22950
  });
22693
- await rm9(tmpDir, { force: true, recursive: true });
22951
+ await rm10(tmpDir, { force: true, recursive: true });
22694
22952
  if (!result.success) {
22695
22953
  console.warn("\u26A0\uFE0F Ember vendor build had errors:", result.logs);
22696
22954
  }
@@ -23106,6 +23364,8 @@ var resolveBuildPaths = (config) => {
23106
23364
  emberDir: optional(config.emberDirectory),
23107
23365
  htmlDir: optional(config.htmlDirectory),
23108
23366
  htmxDir: optional(config.htmxDirectory),
23367
+ mobileBundleDir: optional(config.mobile?.bundleDirectory ?? (config.mobile ? ".absolutejs/mobile/web" : undefined)),
23368
+ mobileNativeDir: optional(config.mobile?.nativeProject?.directory ?? (config.mobile ? "mobile" : undefined)),
23109
23369
  publicDir: optional(config.publicDirectory),
23110
23370
  reactDir: optional(config.reactDirectory),
23111
23371
  stylesDir: optional(typeof config.stylesConfig === "string" ? config.stylesConfig : config.stylesConfig?.path),
@@ -23119,13 +23379,16 @@ var init_configResolver = () => {};
23119
23379
  var createHMRState = (config) => ({
23120
23380
  activeFrameworks: new Set,
23121
23381
  assetStore: new Map,
23382
+ clientTargets: new Map,
23122
23383
  config,
23123
23384
  connectedClients: new Set,
23124
23385
  debounceTimeout: null,
23125
23386
  dependencyGraph: emptyDependencyGraph,
23126
23387
  fileChangeQueue: new Map,
23127
23388
  fileHashes: new Map,
23389
+ hmrUpdates: new Map,
23128
23390
  isRebuilding: false,
23391
+ lastBroadcastTimestamp: 0,
23129
23392
  manifest: {},
23130
23393
  moduleVersions: createModuleVersionTracker(),
23131
23394
  rebuildCount: 0,
@@ -23152,7 +23415,7 @@ var init_clientManager = __esm(() => {
23152
23415
 
23153
23416
  // src/dev/pathUtils.ts
23154
23417
  import { existsSync as existsSync30, readdirSync as readdirSync6, readFileSync as readFileSync23 } from "fs";
23155
- import { dirname as dirname20, resolve as resolve29 } from "path";
23418
+ import { dirname as dirname21, resolve as resolve29 } from "path";
23156
23419
  var STYLE_EXTENSION_PATTERN2, detectFramework = (filePath, resolved) => {
23157
23420
  if (shouldIgnorePath(filePath, resolved)) {
23158
23421
  return "ignored";
@@ -23280,10 +23543,10 @@ var STYLE_EXTENSION_PATTERN2, detectFramework = (filePath, resolved) => {
23280
23543
  refs.push(strMatch[1]);
23281
23544
  }
23282
23545
  }
23283
- const componentDir = dirname20(full);
23546
+ const componentDir = dirname21(full);
23284
23547
  for (const ref of refs) {
23285
23548
  const refAbs = normalizePath(resolve29(componentDir, ref));
23286
- const refDir = normalizePath(dirname20(refAbs));
23549
+ const refDir = normalizePath(dirname21(refAbs));
23287
23550
  if (refDir === angularRootNormalized || refDir.startsWith(`${angularRootNormalized}/`)) {
23288
23551
  continue;
23289
23552
  }
@@ -23392,6 +23655,15 @@ var STYLE_EXTENSION_PATTERN2, detectFramework = (filePath, resolved) => {
23392
23655
  if (styles)
23393
23656
  return false;
23394
23657
  }
23658
+ const isInside = (root) => {
23659
+ if (!root)
23660
+ return false;
23661
+ const normalizedRoot = root.replace(/\\/g, "/").replace(/\/$/, "");
23662
+ return normalized === normalizedRoot || normalized.startsWith(`${normalizedRoot}/`);
23663
+ };
23664
+ if (isInside(resolved?.buildDir) || isInside(resolved?.mobileBundleDir) || isInside(resolved?.mobileNativeDir)) {
23665
+ return true;
23666
+ }
23395
23667
  if (HARD_DENY_PATTERN.test(normalized))
23396
23668
  return true;
23397
23669
  if (normalized.endsWith(".log"))
@@ -23410,7 +23682,7 @@ var init_pathUtils = __esm(() => {
23410
23682
  // src/dev/fileWatcher.ts
23411
23683
  import { watch } from "fs";
23412
23684
  import { existsSync as existsSync31, readdirSync as readdirSync7, statSync as statSync4 } from "fs";
23413
- import { dirname as dirname21, join as join38, resolve as resolve30 } from "path";
23685
+ import { dirname as dirname22, join as join39, resolve as resolve30 } from "path";
23414
23686
  var safeRemoveFromGraph = (graph, fullPath) => {
23415
23687
  try {
23416
23688
  removeFileFromGraph(graph, fullPath);
@@ -23430,7 +23702,7 @@ var safeRemoveFromGraph = (graph, fullPath) => {
23430
23702
  });
23431
23703
  }
23432
23704
  }, ATOMIC_WRITE_TEMP_PATTERNS, shouldSkipFilename = (filename, isStylesDir) => !isStylesDir && (filename === "compiled" || filename === "generated" || filename === "build" || filename === "indexes" || filename === "server" || filename === "client" || filename.includes("/compiled/") || filename.includes("/generated/") || filename.includes("/build/") || filename.includes("/indexes/") || filename.includes("/server/") || filename.includes("/client/") || filename.startsWith("compiled/") || filename.startsWith("generated/") || filename.startsWith("build/") || filename.startsWith("indexes/") || filename.startsWith("server/") || filename.startsWith("client/")) || filename.endsWith("/") || filename.includes(".tmp.") || filename.endsWith(".tmp") || filename.endsWith("~") || filename.startsWith(".#") || filename.startsWith(".absolutejs-hmr-") || ATOMIC_WRITE_TEMP_PATTERNS.some((pattern) => pattern.test(filename)), setupWatcher = (absolutePath, isStylesDir, state, onFileChange) => {
23433
- const ATOMIC_RECOVERY_WINDOW_MS = 1000;
23705
+ const ATOMIC_RECOVERY_WINDOW_MS = 5000;
23434
23706
  const atomicRecoveryScan = (eventDir) => {
23435
23707
  let entries;
23436
23708
  try {
@@ -23442,7 +23714,7 @@ var safeRemoveFromGraph = (graph, fullPath) => {
23442
23714
  for (const name of entries) {
23443
23715
  if (shouldSkipFilename(name, isStylesDir))
23444
23716
  continue;
23445
- const child = join38(eventDir, name).replace(/\\/g, "/");
23717
+ const child = join39(eventDir, name).replace(/\\/g, "/");
23446
23718
  let st2;
23447
23719
  try {
23448
23720
  st2 = statSync4(child);
@@ -23463,7 +23735,7 @@ var safeRemoveFromGraph = (graph, fullPath) => {
23463
23735
  return;
23464
23736
  if (shouldSkipFilename(filename, isStylesDir)) {
23465
23737
  if (event === "rename") {
23466
- const eventDir = dirname21(join38(absolutePath, filename)).replace(/\\/g, "/");
23738
+ const eventDir = dirname22(join39(absolutePath, filename)).replace(/\\/g, "/");
23467
23739
  atomicRecoveryScan(eventDir);
23468
23740
  for (const delay of [25, 100]) {
23469
23741
  const timer = setTimeout(() => atomicRecoveryScan(eventDir), delay);
@@ -23472,7 +23744,7 @@ var safeRemoveFromGraph = (graph, fullPath) => {
23472
23744
  }
23473
23745
  return;
23474
23746
  }
23475
- const fullPath = join38(absolutePath, filename).replace(/\\/g, "/");
23747
+ const fullPath = join39(absolutePath, filename).replace(/\\/g, "/");
23476
23748
  if (shouldIgnorePath(fullPath, state.resolvedPaths)) {
23477
23749
  return;
23478
23750
  }
@@ -23640,7 +23912,7 @@ var init_assetStore = __esm(() => {
23640
23912
 
23641
23913
  // src/islands/pageMetadata.ts
23642
23914
  import { readFileSync as readFileSync24 } from "fs";
23643
- import { dirname as dirname22, resolve as resolve32 } from "path";
23915
+ import { dirname as dirname23, resolve as resolve32 } from "path";
23644
23916
  var pagePatterns, getPageDirs = (config) => [
23645
23917
  { dir: config.angularDirectory, framework: "angular" },
23646
23918
  { dir: config.emberDirectory, framework: "ember" },
@@ -23660,7 +23932,7 @@ var pagePatterns, getPageDirs = (config) => [
23660
23932
  const source = definition.buildReference?.source;
23661
23933
  if (!source)
23662
23934
  continue;
23663
- const resolvedSource = source.startsWith("file://") ? new URL(source).pathname : resolve32(dirname22(buildInfo.resolvedRegistryPath), source);
23935
+ const resolvedSource = source.startsWith("file://") ? new URL(source).pathname : resolve32(dirname23(buildInfo.resolvedRegistryPath), source);
23664
23936
  lookup.set(`${definition.framework}:${definition.component}`, resolve32(resolvedSource));
23665
23937
  }
23666
23938
  return lookup;
@@ -23925,7 +24197,7 @@ var init_moduleMapper = __esm(() => {
23925
24197
 
23926
24198
  // src/utils/spaRouteCss.ts
23927
24199
  import { readFile as readFile6 } from "fs/promises";
23928
- import { dirname as dirname23, isAbsolute as isAbsolute5, resolve as resolve35 } from "path";
24200
+ import { dirname as dirname24, isAbsolute as isAbsolute5, resolve as resolve35 } from "path";
23929
24201
  var sideManifestCache, readSideManifest = async (sideManifestPath) => {
23930
24202
  const cached = sideManifestCache.get(sideManifestPath);
23931
24203
  if (cached !== undefined)
@@ -23963,7 +24235,7 @@ var sideManifestCache, readSideManifest = async (sideManifestPath) => {
23963
24235
  }, readChildCss = async (cssPath, sideManifestPath) => {
23964
24236
  if (!cssPath)
23965
24237
  return "";
23966
- const resolvedCssPath = isAbsolute5(cssPath) ? cssPath : resolve35(dirname23(sideManifestPath), cssPath);
24238
+ const resolvedCssPath = isAbsolute5(cssPath) ? cssPath : resolve35(dirname24(sideManifestPath), cssPath);
23967
24239
  const cached = childCssCache.get(resolvedCssPath);
23968
24240
  if (cached !== undefined)
23969
24241
  return cached;
@@ -24047,7 +24319,7 @@ __export(exports_resolveOwningComponents, {
24047
24319
  invalidateResourceIndex: () => invalidateResourceIndex
24048
24320
  });
24049
24321
  import { readdirSync as readdirSync8, readFileSync as readFileSync26, statSync as statSync5 } from "fs";
24050
- import { dirname as dirname24, extname as extname11, join as join39, resolve as resolve36 } from "path";
24322
+ import { dirname as dirname25, extname as extname11, join as join40, resolve as resolve36 } from "path";
24051
24323
  import ts18 from "typescript";
24052
24324
  var ENTITY_DECORATORS, isAngularSourceFile = (file4) => file4.endsWith(".ts") || file4.endsWith(".tsx"), walkAngularSourceFiles = (root) => {
24053
24325
  const out = [];
@@ -24062,7 +24334,7 @@ var ENTITY_DECORATORS, isAngularSourceFile = (file4) => file4.endsWith(".ts") ||
24062
24334
  if (entry.name.startsWith(".") || entry.name === "node_modules") {
24063
24335
  continue;
24064
24336
  }
24065
- const full = join39(dir, entry.name);
24337
+ const full = join40(dir, entry.name);
24066
24338
  if (entry.isDirectory()) {
24067
24339
  visit(full);
24068
24340
  } else if (entry.isFile() && isAngularSourceFile(entry.name)) {
@@ -24201,7 +24473,7 @@ var ENTITY_DECORATORS, isAngularSourceFile = (file4) => file4.endsWith(".ts") ||
24201
24473
  return null;
24202
24474
  }
24203
24475
  const sourceFile = ts18.createSourceFile(childFilePath, source, ts18.ScriptTarget.ES2022, true, ts18.ScriptKind.TS);
24204
- const childDir = dirname24(childFilePath);
24476
+ const childDir = dirname25(childFilePath);
24205
24477
  for (const stmt of sourceFile.statements) {
24206
24478
  if (!ts18.isImportDeclaration(stmt))
24207
24479
  continue;
@@ -24258,7 +24530,7 @@ var ENTITY_DECORATORS, isAngularSourceFile = (file4) => file4.endsWith(".ts") ||
24258
24530
  const parentFile = new Map;
24259
24531
  for (const tsPath of walkAngularSourceFiles(userAngularRoot)) {
24260
24532
  const classes = parseDecoratedClasses(tsPath);
24261
- const componentDir = dirname24(tsPath);
24533
+ const componentDir = dirname25(tsPath);
24262
24534
  for (const cls of classes) {
24263
24535
  const entity = {
24264
24536
  className: cls.className,
@@ -24328,13 +24600,14 @@ var isValidHMRClientMessage = (data) => {
24328
24600
  case "ready":
24329
24601
  case "request-rebuild":
24330
24602
  case "hydration-error":
24331
- case "hmr-timing":
24332
24603
  case "angular:hmr-ack":
24333
24604
  return true;
24605
+ case "hmr-timing":
24606
+ return typeof Reflect.get(data, "duration") === "number" && Number.isFinite(Reflect.get(data, "duration")) && isOptionalHmrApplyKind(Reflect.get(data, "kind")) && isOptionalHmrApplyOutcome(Reflect.get(data, "outcome"));
24334
24607
  default:
24335
24608
  return false;
24336
24609
  }
24337
- };
24610
+ }, isOptionalHmrApplyKind = (value) => value === undefined || value === "component" || value === "css" || value === "full-reload" || value === "html" || value === "htmx" || value === "script", isOptionalHmrApplyOutcome = (value) => value === undefined || value === "applied" || value === "failed" || value === "reloaded";
24338
24611
 
24339
24612
  // src/dev/webSocket.ts
24340
24613
  var exports_webSocket = {};
@@ -24344,7 +24617,33 @@ __export(exports_webSocket, {
24344
24617
  handleClientConnect: () => handleClientConnect,
24345
24618
  broadcastToClients: () => broadcastToClients
24346
24619
  });
24347
- var trySendMessage = (client, messageStr) => {
24620
+ var MAX_RETAINED_HMR_UPDATES = 100, normalizedHmrTarget = (value) => {
24621
+ if (value === "capacitor-android")
24622
+ return value;
24623
+ if (value === "capacitor-ios")
24624
+ return value;
24625
+ if (value === "capacitor-native")
24626
+ return value;
24627
+ return "web";
24628
+ }, hmrMessageMetadata = (state, message) => {
24629
+ const data = Reflect.get(message, "data");
24630
+ const framework = typeof data === "object" && data !== null && typeof Reflect.get(data, "framework") === "string" ? String(Reflect.get(data, "framework")) : state.lastHmrFramework;
24631
+ const source = typeof data === "object" && data !== null ? Reflect.get(data, "primarySource") ?? Reflect.get(data, "sourceFile") : undefined;
24632
+ return {
24633
+ framework,
24634
+ path: typeof source === "string" ? source : state.lastHmrPath
24635
+ };
24636
+ }, retainHmrUpdate = (state, updateId, message) => {
24637
+ const metadata = hmrMessageMetadata(state, message);
24638
+ if (!metadata.framework && !metadata.path)
24639
+ return;
24640
+ state.hmrUpdates.set(updateId, metadata);
24641
+ if (state.hmrUpdates.size <= MAX_RETAINED_HMR_UPDATES)
24642
+ return;
24643
+ const oldest = state.hmrUpdates.keys().next().value;
24644
+ if (typeof oldest === "number")
24645
+ state.hmrUpdates.delete(oldest);
24646
+ }, trySendMessage = (client, messageStr) => {
24348
24647
  try {
24349
24648
  client.send(messageStr);
24350
24649
  return true;
@@ -24352,9 +24651,12 @@ var trySendMessage = (client, messageStr) => {
24352
24651
  return false;
24353
24652
  }
24354
24653
  }, broadcastToClients = (state, message) => {
24654
+ const timestamp = Math.max(Date.now(), state.lastBroadcastTimestamp + 1);
24655
+ state.lastBroadcastTimestamp = timestamp;
24656
+ retainHmrUpdate(state, timestamp, message);
24355
24657
  const messageStr = JSON.stringify({
24356
24658
  ...message,
24357
- timestamp: Date.now()
24659
+ timestamp
24358
24660
  });
24359
24661
  const shouldRemove = (client) => !trySendMessage(client, messageStr);
24360
24662
  const clientsToRemove = [];
@@ -24364,6 +24666,7 @@ var trySendMessage = (client, messageStr) => {
24364
24666
  });
24365
24667
  clientsToRemove.forEach((client) => {
24366
24668
  state.connectedClients.delete(client);
24669
+ state.clientTargets.delete(client);
24367
24670
  });
24368
24671
  }, handleClientConnect = (state, client, manifest) => {
24369
24672
  state.connectedClients.add(client);
@@ -24404,6 +24707,7 @@ var trySendMessage = (client, messageStr) => {
24404
24707
  }
24405
24708
  }, handleClientDisconnect = (state, client) => {
24406
24709
  state.connectedClients.delete(client);
24710
+ state.clientTargets.delete(client);
24407
24711
  }, parseJsonSafe = (raw) => JSON.parse(raw), parseMessage = (message) => {
24408
24712
  if (typeof message === "string") {
24409
24713
  return parseJsonSafe(message);
@@ -24433,17 +24737,40 @@ var trySendMessage = (client, messageStr) => {
24433
24737
  case "request-rebuild":
24434
24738
  break;
24435
24739
  case "ready":
24740
+ state.clientTargets.set(client, normalizedHmrTarget(data.target));
24436
24741
  if (data.framework) {
24437
24742
  state.activeFrameworks.add(data.framework);
24438
24743
  }
24439
24744
  break;
24440
- case "hmr-timing":
24441
- logHmrUpdate(state.lastHmrPath ?? "", state.lastHmrFramework, data.duration);
24745
+ case "hmr-timing": {
24746
+ state.clientTargets.set(client, normalizedHmrTarget(data.target));
24747
+ const update = typeof data.updateId === "number" ? state.hmrUpdates.get(data.updateId) : undefined;
24748
+ logHmrClientUpdate(update?.path ?? state.lastHmrPath ?? "", update?.framework ?? state.lastHmrFramework, data.duration, normalizedHmrTarget(data.target), data.serverMs, data.clientMs, data.outcome, data.kind);
24749
+ sendTelemetryEvent("hmr:client-applied", {
24750
+ clientMs: data.clientMs,
24751
+ durationMs: data.duration,
24752
+ framework: update?.framework ?? state.lastHmrFramework ?? "unknown",
24753
+ kind: data.kind,
24754
+ outcome: data.outcome ?? "applied",
24755
+ serverMs: data.serverMs,
24756
+ success: (data.outcome ?? "applied") === "applied",
24757
+ target: normalizedHmrTarget(data.target)
24758
+ });
24442
24759
  break;
24760
+ }
24443
24761
  case "angular:hmr-ack": {
24444
24762
  const tag = data.tier === "tier-0" ? "tier-0" : "tier-1a";
24445
24763
  const suffix = data.error ? ` FAILED \u2014 ${data.error}` : ` applied in ${data.applyMs.toFixed(0)}ms`;
24446
- logInfo(`[ng-hmr] ${tag} ${data.className}${suffix}`);
24764
+ const target = normalizedHmrTarget(data.target);
24765
+ logInfo(`[ng-hmr:${target}] ${tag} ${data.className}${suffix}`);
24766
+ sendTelemetryEvent("hmr:client-applied", {
24767
+ clientMs: data.applyMs,
24768
+ durationMs: data.applyMs,
24769
+ framework: "angular",
24770
+ success: data.error === undefined,
24771
+ target,
24772
+ tier: data.tier
24773
+ });
24447
24774
  break;
24448
24775
  }
24449
24776
  }
@@ -24460,6 +24787,7 @@ var trySendMessage = (client, messageStr) => {
24460
24787
  } catch {}
24461
24788
  };
24462
24789
  var init_webSocket = __esm(() => {
24790
+ init_telemetryEvent();
24463
24791
  init_logger();
24464
24792
  });
24465
24793
 
@@ -24555,6 +24883,7 @@ var init_loadConfig = __esm(() => {
24555
24883
  "islands",
24556
24884
  "kind",
24557
24885
  "mode",
24886
+ "mobile",
24558
24887
  "options",
24559
24888
  "port",
24560
24889
  "postcss",
@@ -24578,12 +24907,13 @@ __export(exports_moduleServer, {
24578
24907
  warmCompilers: () => warmCompilers,
24579
24908
  warmCache: () => warmCache,
24580
24909
  setGlobalModuleServer: () => setGlobalModuleServer,
24910
+ isReactFastRefreshSupported: () => isReactFastRefreshSupported,
24581
24911
  invalidateModule: () => invalidateModule,
24582
24912
  createModuleServer: () => createModuleServer,
24583
24913
  SRC_URL_PREFIX: () => SRC_URL_PREFIX
24584
24914
  });
24585
24915
  import { existsSync as existsSync32, readFileSync as readFileSync27, realpathSync as realpathSync3, statSync as statSync6 } from "fs";
24586
- import { basename as basename16, dirname as dirname25, extname as extname12, join as join40, resolve as resolve38, relative as relative16 } from "path";
24916
+ import { basename as basename16, dirname as dirname26, extname as extname12, join as join41, resolve as resolve38, relative as relative16 } from "path";
24587
24917
  var SRC_PREFIX = "/@src/", BROWSER_DEFINE, jsTranspiler2, legacyDecoratorTsconfig, tsTranspiler2, tsxTranspiler, TRANSPILABLE, ALL_EXPORTS_RE, STRING_CONTENTS_RE, preserveTypeExports = (originalSource, transpiled, valueExports) => {
24588
24918
  const codeOnly = originalSource.replace(STRING_CONTENTS_RE, '""');
24589
24919
  const allExports = [];
@@ -24666,7 +24996,7 @@ ${stubs}
24666
24996
  const subpath = isScoped ? parts.slice(2).join("/") : parts.slice(1).join("/");
24667
24997
  if (!subpath) {
24668
24998
  const pkgDir = resolve38(projectRoot, "node_modules", packageName ?? "");
24669
- const pkgJsonPath = join40(pkgDir, "package.json");
24999
+ const pkgJsonPath = join41(pkgDir, "package.json");
24670
25000
  if (existsSync32(pkgJsonPath)) {
24671
25001
  const pkg = JSON.parse(readFileSync27(pkgJsonPath, "utf-8"));
24672
25002
  const esmEntry = typeof pkg.module === "string" && pkg.module || typeof pkg.browser === "string" && pkg.browser;
@@ -24709,7 +25039,7 @@ ${stubs}
24709
25039
  };
24710
25040
  result = result.replace(/^((?:import\s+[^"'`;]+?\s+from|export\s+[^"'`;]+?\s+from|import)\s*["'])([^"'./][^"']*)(["'])/gm, stubReplace);
24711
25041
  result = result.replace(/(import\s*\(\s*["'])([^"'./][^"']*)(["']\s*\))/g, stubReplace);
24712
- const fileDir = dirname25(filePath);
25042
+ const fileDir = dirname26(filePath);
24713
25043
  result = result.replace(/(from\s*["'])(\.\.?\/[^"']+)(["'])/g, (_match, prefix, relPath, suffix) => isRealImport(relPath) ? `${prefix}${resolveRelativeImport(relPath, fileDir, projectRoot, IMPORT_EXTENSIONS)}${suffix}` : _match);
24714
25044
  result = result.replace(/(import\s*\(\s*["'])(\.\.?\/[^"']+)(["']\s*\))/g, (_match, prefix, relPath, suffix) => isRealImport(relPath) ? `${prefix}${resolveRelativeImport(relPath, fileDir, projectRoot, IMPORT_EXTENSIONS)}${suffix}` : _match);
24715
25045
  result = result.replace(/(import\s*["'])(\.\.?\/[^"']+)(["']\s*;?)/g, (_match, prefix, relPath, suffix) => isRealImport(relPath) ? `${prefix}${resolveRelativeImport(relPath, fileDir, projectRoot, SIDE_EFFECT_EXTENSIONS)}${suffix}` : _match);
@@ -24769,11 +25099,11 @@ ${code}`;
24769
25099
  } catch {
24770
25100
  return false;
24771
25101
  }
24772
- }, reactFastRefreshSupported, reactFastRefreshWarningEmitted = false, warnIfReactFastRefreshUnsupported = () => {
25102
+ }, reactFastRefreshSupported, isReactFastRefreshSupported = () => reactFastRefreshSupported, reactFastRefreshWarningEmitted = false, warnIfReactFastRefreshUnsupported = () => {
24773
25103
  if (reactFastRefreshSupported || reactFastRefreshWarningEmitted)
24774
25104
  return;
24775
25105
  reactFastRefreshWarningEmitted = true;
24776
- logWarn("React HMR is blocked: this Bun build ignores " + "`reactFastRefresh` on Bun.Transpiler, so component state " + "cannot be preserved across edits. Tracking " + "https://github.com/oven-sh/bun/pull/28312 \u2014 if it still has " + "not merged, leave a \uD83D\uDC4D on the PR so the Bun team knows it " + "is blocking you. Until then, React edits trigger a full " + "reload instead of a fast refresh.");
25106
+ logWarn("React HMR is blocked: this Bun build ignores " + "`reactFastRefresh` on Bun.Transpiler, so component state " + "cannot be preserved across edits. Tracking " + "https://github.com/oven-sh/bun/pull/28312 \u2014 if it still has " + "not merged, leave a \uD83D\uDC4D on the PR so the Bun team knows it " + "is blocking you. Until then, React edits trigger a targeted " + "page remount instead of a state-preserving fast refresh.");
24777
25107
  }, transformReactFile = (filePath, projectRoot, rewriter) => {
24778
25108
  const raw = readFileSync27(filePath, "utf-8");
24779
25109
  const valueExports = tsxTranspiler.scan(raw).exports;
@@ -25375,12 +25705,12 @@ export default {};
25375
25705
  invalidate(resolved);
25376
25706
  mtimeCache.delete(filePath);
25377
25707
  mtimeCache.delete(resolved);
25378
- }, warmCache = (pathname) => {
25708
+ }, warmCache = async (pathname) => {
25379
25709
  if (!pathname.startsWith(SRC_PREFIX))
25380
25710
  return;
25381
25711
  if (!globalModuleServer)
25382
25712
  return;
25383
- globalModuleServer(pathname);
25713
+ await globalModuleServer(pathname);
25384
25714
  }, globalModuleServer = null, SRC_URL_PREFIX, setGlobalModuleServer = (handler) => {
25385
25715
  globalModuleServer = handler;
25386
25716
  };
@@ -25532,7 +25862,7 @@ __export(exports_hmrCompiler, {
25532
25862
  getApplyMetadataModule: () => getApplyMetadataModule,
25533
25863
  encodeHmrComponentId: () => encodeHmrComponentId
25534
25864
  });
25535
- import { dirname as dirname26, relative as relative17, resolve as resolve39 } from "path";
25865
+ import { dirname as dirname27, relative as relative17, resolve as resolve39 } from "path";
25536
25866
  import { performance as performance2 } from "perf_hooks";
25537
25867
  var encodeHmrComponentId = (absoluteFilePath, className) => {
25538
25868
  const projectRel = relative17(process.cwd(), absoluteFilePath).replace(/\\/g, "/");
@@ -25555,7 +25885,7 @@ var encodeHmrComponentId = (absoluteFilePath, className) => {
25555
25885
  const { resolveOwningComponents: resolveOwningComponents2 } = await Promise.resolve().then(() => (init_resolveOwningComponents(), exports_resolveOwningComponents));
25556
25886
  const owners = resolveOwningComponents2({
25557
25887
  changedFilePath: componentFilePath,
25558
- userAngularRoot: dirname26(componentFilePath)
25888
+ userAngularRoot: dirname27(componentFilePath)
25559
25889
  });
25560
25890
  const owner = owners.find((o3) => o3.className === className);
25561
25891
  const kind = owner?.kind ?? "component";
@@ -25693,10 +26023,18 @@ var resolveRequestPathname = (request) => {
25693
26023
  return moduleUrl.href;
25694
26024
  }, invalidateEmberSsrCache = () => {
25695
26025
  emberCacheBuster = Date.now();
25696
- }, buildHtmlShell = (headTag, bodyContent, indexPath, props) => {
26026
+ }, buildHtmlShell = (headTag, bodyContent, indexPath, props, hmrShim) => {
25697
26027
  const propsScript = `window.__INITIAL_PROPS__=${JSON.stringify(props ?? {})};`;
25698
26028
  const indexImport = indexPath ? `<script type="module" src="${indexPath}"></script>` : "";
25699
- return `<!DOCTYPE html><html>${headTag}<body>` + `<div id="ember-root">${bodyContent}</div>` + `<script>${propsScript}</script>${indexImport}</body></html>`;
26029
+ return `<!DOCTYPE html><html>${headTag}<body>` + `<div id="ember-root">${bodyContent}</div>` + `<script>${propsScript}</script>${indexImport}${hmrShim}</body></html>`;
26030
+ }, cachedEmberHmrShim = null, getEmberHmrShim = () => {
26031
+ if (cachedEmberHmrShim)
26032
+ return cachedEmberHmrShim;
26033
+ cachedEmberHmrShim = Promise.resolve().then(() => (init_buildHMRClient(), exports_buildHMRClient)).then(async ({ buildHMRClient: buildHMRClient2 }) => {
26034
+ const bundle = await buildHMRClient2();
26035
+ return `<script>window.__HMR_FRAMEWORK__="ember";</script><script data-hmr-client>${bundle}</script>`;
26036
+ });
26037
+ return cachedEmberHmrShim;
25700
26038
  }, handleEmberPageRequest = async (input) => {
25701
26039
  const { indexPath, pagePath, headTag } = input;
25702
26040
  const userProps = input.props;
@@ -25710,7 +26048,8 @@ var resolveRequestPathname = (request) => {
25710
26048
  throw new Error(`Ember page bundle at ${pagePath} does not export renderToHTML(). Was it compiled by compileEmber()?`);
25711
26049
  }
25712
26050
  const innerHtml = bundle.renderToHTML(props ?? {});
25713
- const html = buildHtmlShell(resolvedHeadTag, innerHtml.replace(/^<div>|<\/div>$/g, ""), indexPath, props);
26051
+ const hmrShim = !indexPath ? await getEmberHmrShim() : "";
26052
+ const html = buildHtmlShell(resolvedHeadTag, innerHtml.replace(/^<div>|<\/div>$/g, ""), indexPath, props, hmrShim);
25714
26053
  return withPageCacheHeaders(new Response(html, {
25715
26054
  headers: { "Content-Type": "text/html" }
25716
26055
  }), input.request);
@@ -25800,9 +26139,9 @@ var init_simpleHTMXHMR = () => {};
25800
26139
  import { existsSync as existsSync33, readdirSync as readdirSync9, rmSync as rmSync3 } from "fs";
25801
26140
  import {
25802
26141
  basename as basename17,
25803
- dirname as dirname27,
26142
+ dirname as dirname28,
25804
26143
  isAbsolute as isAbsolute6,
25805
- join as join41,
26144
+ join as join42,
25806
26145
  relative as relative18,
25807
26146
  resolve as resolvePath,
25808
26147
  sep as sep4
@@ -25815,6 +26154,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, clearDevSs
25815
26154
  return;
25816
26155
  if (!files.some(isTailwindCandidate))
25817
26156
  return;
26157
+ const startedAt = performance.now();
25818
26158
  try {
25819
26159
  const { computeFrameworkTailwindSources: computeFrameworkTailwindSources2 } = await Promise.resolve().then(() => (init_compileTailwind(), exports_compileTailwind));
25820
26160
  const { cssChanged } = await incrementalTailwindBuild(config.tailwind, state.resolvedPaths.buildDir, files, getStyleTransformConfig(config), computeFrameworkTailwindSources2(config));
@@ -25830,7 +26170,8 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, clearDevSs
25830
26170
  data: {
25831
26171
  cause: files.filter(isTailwindCandidate),
25832
26172
  framework: "tailwind",
25833
- manifest: state.manifest
26173
+ manifest: state.manifest,
26174
+ serverDuration: Math.round(performance.now() - startedAt)
25834
26175
  },
25835
26176
  message: "Tailwind utilities recompiled",
25836
26177
  type: "style-update"
@@ -25927,8 +26268,8 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, clearDevSs
25927
26268
  const relJs = `${rel.slice(0, -ext[0].length)}.js`;
25928
26269
  const generatedDir = getFrameworkGeneratedDir(framework, cwd2);
25929
26270
  for (const candidate of [
25930
- join41(generatedDir, relJs),
25931
- `${join41(generatedDir, relJs)}.map`
26271
+ join42(generatedDir, relJs),
26272
+ `${join42(generatedDir, relJs)}.map`
25932
26273
  ]) {
25933
26274
  try {
25934
26275
  rmSync3(candidate, { force: true });
@@ -26152,6 +26493,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, clearDevSs
26152
26493
  const { publicDir } = state.resolvedPaths;
26153
26494
  const { assetsDir } = state.resolvedPaths;
26154
26495
  const handleStaticMirror = async (sourceDir, urlPrefix) => {
26496
+ const startedAt = performance.now();
26155
26497
  const absSource = resolvePath(filePath);
26156
26498
  const normalizedSource = absSource.replace(/\\/g, "/");
26157
26499
  const normalizedDir = sourceDir.replace(/\\/g, "/");
@@ -26161,8 +26503,8 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, clearDevSs
26161
26503
  const relFromDir = normalizedSource.slice(normalizedDir.length + 1);
26162
26504
  const { buildDir } = state.resolvedPaths;
26163
26505
  const destPath = resolvePath(buildDir, urlPrefix ? `${urlPrefix}/${relFromDir}` : relFromDir);
26164
- const { mkdir: mkdir8, copyFile, readFile: readFile7 } = await import("fs/promises");
26165
- await mkdir8(dirname27(destPath), { recursive: true });
26506
+ const { mkdir: mkdir9, copyFile, readFile: readFile7 } = await import("fs/promises");
26507
+ await mkdir9(dirname28(destPath), { recursive: true });
26166
26508
  await copyFile(absSource, destPath);
26167
26509
  const bytes = await readFile7(destPath);
26168
26510
  const webPath = urlPrefix ? `/${urlPrefix}/${relFromDir}` : `/${relFromDir}`;
@@ -26172,7 +26514,9 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, clearDevSs
26172
26514
  broadcastToClients(state, {
26173
26515
  data: {
26174
26516
  framework: urlPrefix || "public",
26175
- manifest: state.manifest
26517
+ manifest: state.manifest,
26518
+ serverDuration: Math.round(performance.now() - startedAt),
26519
+ sourceFile: absSource
26176
26520
  },
26177
26521
  message: `${urlPrefix || "Public"} asset updated`,
26178
26522
  type: "style-update"
@@ -26341,7 +26685,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, clearDevSs
26341
26685
  const keepStemsByDir = new Map;
26342
26686
  const prefixByDir = new Map;
26343
26687
  for (const artifact of freshOutputs) {
26344
- const dir = dirname27(artifact.path);
26688
+ const dir = dirname28(artifact.path);
26345
26689
  const name = basename17(artifact.path);
26346
26690
  const [prefix] = name.split(".");
26347
26691
  if (!prefix)
@@ -26827,7 +27171,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, clearDevSs
26827
27171
  const entries = await readdir5(dir, { withFileTypes: true });
26828
27172
  const files = [];
26829
27173
  for (const entry of entries) {
26830
- const full = join41(dir, entry.name);
27174
+ const full = join42(dir, entry.name);
26831
27175
  if (entry.isDirectory()) {
26832
27176
  files.push(...await walk(full));
26833
27177
  } else if (entry.isFile() && entry.name.endsWith(".ts") && !entry.name.endsWith(".d.ts")) {
@@ -26864,6 +27208,9 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, clearDevSs
26864
27208
  await bundleAngularClient(state, clientPaths, state.resolvedPaths.buildDir, angularDir);
26865
27209
  }
26866
27210
  await Promise.all(pageEntries.map((entry) => compileAngularFileJIT2(entry, generatedAngularRoot, resolvedAngularDir, styleTransformConfig)));
27211
+ if (providersInjection.appProvidersSource) {
27212
+ await compileAngularFileJIT2(providersInjection.appProvidersSource, generatedAngularRoot, resolvedAngularDir, styleTransformConfig);
27213
+ }
26867
27214
  broadcastToClients(state, {
26868
27215
  data: { manifest: state.manifest },
26869
27216
  type: "angular-tier-zero-ssr-rebuild-complete"
@@ -26928,7 +27275,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, clearDevSs
26928
27275
  invalidateModule2(pageFile);
26929
27276
  const rel = relative18(process.cwd(), pageFile).replace(/\\/g, "/");
26930
27277
  const url = `${SRC_URL_PREFIX2}${rel}`;
26931
- warmCache2(url);
27278
+ await warmCache2(url);
26932
27279
  return url;
26933
27280
  }, getReactModuleUrl, resolveBroadcastTarget = async (primaryFile) => {
26934
27281
  const isComponentFile2 = primaryFile.endsWith(".tsx") || primaryFile.endsWith(".jsx");
@@ -26937,7 +27284,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, clearDevSs
26937
27284
  const { findNearestComponent: findNearestComponent2 } = await Promise.resolve().then(() => (init_transformCache(), exports_transformCache));
26938
27285
  const nearest = findNearestComponent2(resolvePath(primaryFile));
26939
27286
  return nearest ?? primaryFile;
26940
- }, handleReactModuleServerPath = async (state, reactFiles, startTime, onRebuildComplete) => {
27287
+ }, handleReactModuleServerPath = async (state, reactFiles, startTime, fastRefreshSupported, onRebuildComplete) => {
26941
27288
  const primaryFile = reactFiles.find((file4) => !file4.replace(/\\/g, "/").includes("/pages/")) ?? reactFiles[0];
26942
27289
  if (!primaryFile) {
26943
27290
  onRebuildComplete({
@@ -26958,6 +27305,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, clearDevSs
26958
27305
  state.lastHmrFramework = "react";
26959
27306
  broadcastToClients(state, {
26960
27307
  data: {
27308
+ fastRefreshSupported,
26961
27309
  framework: "react",
26962
27310
  hasComponentChanges: true,
26963
27311
  hasCSSChanges: false,
@@ -26981,9 +27329,10 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, clearDevSs
26981
27329
  onRebuildComplete({ hmrState: state, manifest: state.manifest });
26982
27330
  return state.manifest;
26983
27331
  }
26984
- const { warnIfReactFastRefreshUnsupported: warnIfReactFastRefreshUnsupported2 } = await Promise.resolve().then(() => (init_moduleServer(), exports_moduleServer));
27332
+ const { isReactFastRefreshSupported: isReactFastRefreshSupported2, warnIfReactFastRefreshUnsupported: warnIfReactFastRefreshUnsupported2 } = await Promise.resolve().then(() => (init_moduleServer(), exports_moduleServer));
26985
27333
  warnIfReactFastRefreshUnsupported2();
26986
- return handleReactModuleServerPath(state, reactFiles, startTime, onRebuildComplete);
27334
+ const fastRefreshSupported = isReactFastRefreshSupported2();
27335
+ return handleReactModuleServerPath(state, reactFiles, startTime, fastRefreshSupported, onRebuildComplete);
26987
27336
  }, getClientVendorPaths = async () => {
26988
27337
  const {
26989
27338
  getDevVendorPaths: getDevVendorPaths2,
@@ -27119,7 +27468,8 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, clearDevSs
27119
27468
  }
27120
27469
  return ctx;
27121
27470
  }, runSvelteBundleRebuild = async (state, svelteFiles, config) => {
27122
- if (svelteFiles.length === 0)
27471
+ const existingSvelteFiles = svelteFiles.filter((file4) => existsSync33(file4));
27472
+ if (existingSvelteFiles.length === 0)
27123
27473
  return;
27124
27474
  const svelteDir = config.svelteDirectory ?? "";
27125
27475
  if (!svelteDir)
@@ -27128,7 +27478,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, clearDevSs
27128
27478
  const { compileSvelte: compileSvelte2 } = await Promise.resolve().then(() => (init_compileSvelte(), exports_compileSvelte));
27129
27479
  const { build: bunBuild9 } = await Promise.resolve(globalThis.Bun);
27130
27480
  const clientRoot = await computeClientRoot(state.resolvedPaths);
27131
- const { svelteServerPaths, svelteIndexPaths, svelteClientPaths } = await compileSvelte2(svelteFiles, svelteDir, new Map, true, getStyleTransformConfig(state.config));
27481
+ const { svelteServerPaths, svelteIndexPaths, svelteClientPaths } = await compileSvelte2(existingSvelteFiles, svelteDir, new Map, true, getStyleTransformConfig(state.config));
27132
27482
  const serverEntries = [...svelteServerPaths];
27133
27483
  const clientEntries = [...svelteIndexPaths, ...svelteClientPaths];
27134
27484
  const { serverRoot, serverOutDir } = await computeServerOutPaths(state.resolvedPaths, "svelte");
@@ -27381,7 +27731,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, clearDevSs
27381
27731
  } = await compileVue2(vueFiles, vueDir, true, getStyleTransformConfig(state.config));
27382
27732
  const serverEntries = [...vueServerPaths];
27383
27733
  const clientEntries = [...vueIndexPaths, ...vueClientPaths];
27384
- const cssOutDir = join41(buildDir, state.resolvedPaths.assetsDir ? basename17(state.resolvedPaths.assetsDir) : "assets", "css");
27734
+ const cssOutDir = join42(buildDir, state.resolvedPaths.assetsDir ? basename17(state.resolvedPaths.assetsDir) : "assets", "css");
27385
27735
  const { serverRoot, serverOutDir } = await computeServerOutPaths(state.resolvedPaths, "vue");
27386
27736
  const serverExternals = await getServerBundleExternals();
27387
27737
  const clientVendorPaths = await getClientVendorPaths();
@@ -27567,7 +27917,10 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, clearDevSs
27567
27917
  broadcastToClients(state, {
27568
27918
  data: {
27569
27919
  affectedPages: allPageEntries,
27570
- manifest: state.manifest
27920
+ framework: "ember",
27921
+ manifest: state.manifest,
27922
+ serverDuration: duration,
27923
+ sourceFile: primary
27571
27924
  },
27572
27925
  type: "full-reload"
27573
27926
  });
@@ -27590,7 +27943,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, clearDevSs
27590
27943
  });
27591
27944
  });
27592
27945
  return allModuleUpdates;
27593
- }, handleReactHMR = (state, affectedFrameworks, filesToRebuild, manifest, duration) => {
27946
+ }, handleReactHMR = async (state, affectedFrameworks, filesToRebuild, manifest, duration) => {
27594
27947
  if (!affectedFrameworks.includes("react") || !state.resolvedPaths.reactDir) {
27595
27948
  return;
27596
27949
  }
@@ -27602,21 +27955,28 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, clearDevSs
27602
27955
  const sourceFiles = reactPageFiles.length > 0 ? reactPageFiles : reactFiles;
27603
27956
  const [primarySource] = sourceFiles;
27604
27957
  try {
27605
- const hasComponentChanges = reactFiles.some((file4) => file4.endsWith(".tsx") || file4.endsWith(".ts") || file4.endsWith(".jsx"));
27606
- const hasCSSChanges = reactFiles.some(isStylePath);
27958
+ const {
27959
+ isReactFastRefreshSupported: isReactFastRefreshSupported2,
27960
+ warnIfReactFastRefreshUnsupported: warnIfReactFastRefreshUnsupported2
27961
+ } = await Promise.resolve().then(() => (init_moduleServer(), exports_moduleServer));
27962
+ warnIfReactFastRefreshUnsupported2();
27963
+ await handleReactModuleServerPath(state, reactFiles, Date.now() - duration, isReactFastRefreshSupported2(), () => {
27964
+ return;
27965
+ });
27966
+ } catch (err) {
27607
27967
  logHmrUpdate(primarySource ?? reactFiles[0] ?? "", "react", duration);
27608
27968
  broadcastToClients(state, {
27609
27969
  data: {
27610
27970
  framework: "react",
27611
- hasComponentChanges,
27612
- hasCSSChanges,
27971
+ hasComponentChanges: true,
27972
+ hasCSSChanges: reactFiles.some(isStylePath),
27613
27973
  manifest,
27614
27974
  primarySource,
27975
+ serverDuration: duration,
27615
27976
  sourceFiles
27616
27977
  },
27617
27978
  type: "react-update"
27618
27979
  });
27619
- } catch (err) {
27620
27980
  console.error("[hmr] react live update failed:", err instanceof Error ? err.message : err);
27621
27981
  sendTelemetryEvent("hmr:error", {
27622
27982
  framework: "react",
@@ -27637,6 +27997,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, clearDevSs
27637
27997
  framework,
27638
27998
  manifest,
27639
27999
  scriptPath,
28000
+ serverDuration: duration,
27640
28001
  sourceFile: scriptFile
27641
28002
  },
27642
28003
  type: "script-update"
@@ -27646,7 +28007,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, clearDevSs
27646
28007
  if (!buildReference?.source) {
27647
28008
  return;
27648
28009
  }
27649
- const sourcePath = buildReference.source.startsWith("file://") ? new URL(buildReference.source).pathname : resolvePath(dirname27(buildInfo.resolvedRegistryPath), buildReference.source);
28010
+ const sourcePath = buildReference.source.startsWith("file://") ? new URL(buildReference.source).pathname : resolvePath(dirname28(buildInfo.resolvedRegistryPath), buildReference.source);
27650
28011
  islandFiles.add(resolvePath(sourcePath));
27651
28012
  }, resolveIslandSourceFiles = async (config) => {
27652
28013
  const registryPath = config.islands?.registry;
@@ -27667,17 +28028,26 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, clearDevSs
27667
28028
  return false;
27668
28029
  }
27669
28030
  return filesToRebuild.some((file4) => islandFiles.has(resolvePath(file4)));
27670
- }, handleIslandSourceReload = async (state, config, filesToRebuild, manifest) => {
28031
+ }, handleIslandSourceReload = async (state, config, filesToRebuild, manifest, serverDuration) => {
27671
28032
  const shouldReload = await didStaticPagesNeedIslandRefresh(config, filesToRebuild);
27672
28033
  if (!shouldReload) {
27673
28034
  return false;
27674
28035
  }
27675
28036
  setCurrentPageIslandMetadata(await loadPageIslandMetadata(config));
27676
28037
  const affectedPages = filesToRebuild.flatMap((file4) => getPagesUsingIslandSource(file4));
28038
+ if (affectedPages.length === 0)
28039
+ return true;
28040
+ const affectedFrameworks = [
28041
+ ...new Set(affectedPages.map((page) => detectFramework(page, state.resolvedPaths)).filter((framework) => framework !== "ignored"))
28042
+ ];
27677
28043
  broadcastToClients(state, {
27678
28044
  data: {
28045
+ affectedFrameworks,
27679
28046
  affectedPages,
27680
- manifest
28047
+ framework: "islands",
28048
+ manifest,
28049
+ serverDuration,
28050
+ sourceFile: filesToRebuild[0]
27681
28051
  },
27682
28052
  type: "full-reload"
27683
28053
  });
@@ -27718,6 +28088,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, clearDevSs
27718
28088
  framework: "html",
27719
28089
  html: newHTML,
27720
28090
  manifest,
28091
+ serverDuration: duration,
27721
28092
  sourceFile: builtHtmlPagePath
27722
28093
  },
27723
28094
  type: "html-update"
@@ -27763,6 +28134,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, clearDevSs
27763
28134
  cssUrl,
27764
28135
  framework: "vue",
27765
28136
  manifest,
28137
+ serverDuration: duration,
27766
28138
  sourceFile: cssFile,
27767
28139
  updateType: "css-only"
27768
28140
  },
@@ -27778,6 +28150,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, clearDevSs
27778
28150
  framework: "vue",
27779
28151
  hmrId,
27780
28152
  manifest,
28153
+ serverDuration: duration,
27781
28154
  sourceFile: vuePagePath,
27782
28155
  updateType: "css-only"
27783
28156
  },
@@ -27795,6 +28168,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, clearDevSs
27795
28168
  hmrId,
27796
28169
  html: null,
27797
28170
  manifest,
28171
+ serverDuration: duration,
27798
28172
  sourceFile: vuePagePath,
27799
28173
  updateType: "full"
27800
28174
  },
@@ -27859,6 +28233,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, clearDevSs
27859
28233
  cssUrl,
27860
28234
  framework: "svelte",
27861
28235
  manifest,
28236
+ serverDuration: duration,
27862
28237
  sourceFile: cssFile,
27863
28238
  updateType: "css-only"
27864
28239
  },
@@ -27879,6 +28254,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, clearDevSs
27879
28254
  framework: "svelte",
27880
28255
  html: null,
27881
28256
  manifest,
28257
+ serverDuration: duration,
27882
28258
  sourceFile: sveltePagePath,
27883
28259
  updateType: "full"
27884
28260
  },
@@ -27927,6 +28303,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, clearDevSs
27927
28303
  cssUrl,
27928
28304
  framework: "angular",
27929
28305
  manifest,
28306
+ serverDuration: duration,
27930
28307
  sourceFile: cssFile,
27931
28308
  updateType: "style"
27932
28309
  },
@@ -27972,6 +28349,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, clearDevSs
27972
28349
  framework: "htmx",
27973
28350
  html: newHTML,
27974
28351
  manifest,
28352
+ serverDuration: duration,
27975
28353
  sourceFile: builtHtmxPagePath
27976
28354
  },
27977
28355
  type: "htmx-update"
@@ -28056,7 +28434,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, clearDevSs
28056
28434
  }
28057
28435
  }, handleFullBuildHMR = async (state, config, affectedFrameworks, filesToRebuild, manifest, duration) => {
28058
28436
  const allModuleUpdates = collectAllModuleUpdates(affectedFrameworks, filesToRebuild, manifest, state);
28059
- handleReactHMR(state, affectedFrameworks, filesToRebuild, manifest, duration);
28437
+ await handleReactHMR(state, affectedFrameworks, filesToRebuild, manifest, duration);
28060
28438
  handleHTMLScriptHMR(state, filesToRebuild, manifest, duration);
28061
28439
  await handleHTMLPageHMR(state, config, filesToRebuild, manifest, duration);
28062
28440
  await handleVueHMR(state, config, filesToRebuild, manifest, duration);
@@ -28080,7 +28458,9 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, clearDevSs
28080
28458
  broadcastToClients(state, {
28081
28459
  data: {
28082
28460
  framework,
28083
- manifest
28461
+ manifest,
28462
+ serverDuration: Date.now() - startTime,
28463
+ sourceFile: filesToRebuild?.find((file4) => detectFramework(file4, state.resolvedPaths) === framework)
28084
28464
  },
28085
28465
  message: `${framework} framework updated`,
28086
28466
  type
@@ -28281,7 +28661,8 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, clearDevSs
28281
28661
  message: "Rebuild completed successfully",
28282
28662
  type: "rebuild-complete"
28283
28663
  });
28284
- if (config.tailwind && filesToRebuild && filesToRebuild.some(isTailwindCandidate)) {
28664
+ const hasDedicatedStyleUpdate = affectedFrameworks.some((framework) => framework === "styles" || framework === "assets");
28665
+ if (config.tailwind && filesToRebuild && filesToRebuild.some(isTailwindCandidate) && !hasDedicatedStyleUpdate) {
28285
28666
  try {
28286
28667
  const outputPath = resolvePath(state.resolvedPaths.buildDir, config.tailwind.output);
28287
28668
  const bytes = await Bun.file(outputPath).bytes();
@@ -28292,15 +28673,17 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, clearDevSs
28292
28673
  data: {
28293
28674
  cause: filesToRebuild?.filter(isTailwindCandidate) ?? [],
28294
28675
  framework: "tailwind",
28295
- manifest
28676
+ manifest,
28677
+ serverDuration: duration
28296
28678
  },
28297
28679
  message: "Tailwind utilities recompiled",
28298
28680
  type: "style-update"
28299
28681
  });
28300
28682
  }
28301
28683
  const hasFilesToRebuild = filesToRebuild && filesToRebuild.length > 0;
28302
- const didReloadForIslandChange = hasFilesToRebuild ? await handleIslandSourceReload(state, config, filesToRebuild, manifest) : false;
28684
+ const didReloadForIslandChange = hasFilesToRebuild ? await handleIslandSourceReload(state, config, filesToRebuild, manifest, duration) : false;
28303
28685
  if (didReloadForIslandChange) {
28686
+ await runFrameworkFastPaths(state, config, affectedFrameworks, filesToRebuild ?? [], startTime, onRebuildComplete);
28304
28687
  onRebuildComplete({ hmrState: state, manifest });
28305
28688
  return manifest;
28306
28689
  }
@@ -28457,8 +28840,8 @@ __export(exports_buildDepVendor, {
28457
28840
  });
28458
28841
  import { mkdirSync as mkdirSync14 } from "fs";
28459
28842
  import { isBuiltin } from "module";
28460
- import { join as join42 } from "path";
28461
- import { rm as rm10 } from "fs/promises";
28843
+ import { join as join43 } from "path";
28844
+ import { rm as rm11 } from "fs/promises";
28462
28845
  var {build: bunBuild9, Glob: Glob10 } = globalThis.Bun;
28463
28846
  var toSafeFileName6 = (specifier) => {
28464
28847
  const prefix = specifier.startsWith("@") ? "_" : "";
@@ -28517,7 +28900,7 @@ var toSafeFileName6 = (specifier) => {
28517
28900
  };
28518
28901
  }, collectBareImportsFromFile = async (entryPath, transpiler6, maxDepth = 8) => {
28519
28902
  const { readFileSync: readFileSync28 } = await import("fs");
28520
- const { dirname: dirname28 } = await import("path");
28903
+ const { dirname: dirname29 } = await import("path");
28521
28904
  const seenFiles = new Set;
28522
28905
  const bareOut = new Set;
28523
28906
  const queue = [
@@ -28542,7 +28925,7 @@ var toSafeFileName6 = (specifier) => {
28542
28925
  } catch {
28543
28926
  continue;
28544
28927
  }
28545
- const fromDir = dirname28(path);
28928
+ const fromDir = dirname29(path);
28546
28929
  for (const imp of imports) {
28547
28930
  const child = imp.path;
28548
28931
  if (child.startsWith(".") || child.startsWith("/")) {
@@ -28606,7 +28989,7 @@ var toSafeFileName6 = (specifier) => {
28606
28989
  }), buildDepVendorPass = async (specifiers, vendorDir, tmpDir) => {
28607
28990
  const entries = await Promise.all(specifiers.map(async (specifier) => {
28608
28991
  const safeName = toSafeFileName6(specifier);
28609
- const entryPath = join42(tmpDir, `${safeName}.ts`);
28992
+ const entryPath = join43(tmpDir, `${safeName}.ts`);
28610
28993
  await Bun.write(entryPath, await generateVendorEntrySource(specifier));
28611
28994
  return { entryPath, specifier };
28612
28995
  }));
@@ -28697,9 +29080,9 @@ var toSafeFileName6 = (specifier) => {
28697
29080
  const { dep: initialSpecs, framework: frameworkRoots } = await scanBareImports(directories);
28698
29081
  if (initialSpecs.length === 0 && frameworkRoots.length === 0)
28699
29082
  return {};
28700
- const vendorDir = join42(buildDir, "vendor");
29083
+ const vendorDir = join43(buildDir, "vendor");
28701
29084
  mkdirSync14(vendorDir, { recursive: true });
28702
- const tmpDir = join42(buildDir, "_dep_vendor_tmp");
29085
+ const tmpDir = join43(buildDir, "_dep_vendor_tmp");
28703
29086
  mkdirSync14(tmpDir, { recursive: true });
28704
29087
  const allSpecs = new Set(initialSpecs);
28705
29088
  const alreadyScanned = new Set;
@@ -28719,7 +29102,7 @@ var toSafeFileName6 = (specifier) => {
28719
29102
  if (!success) {
28720
29103
  console.warn("\u26A0\uFE0F Dependency vendor build had errors:", result.logs);
28721
29104
  }
28722
- await rm10(tmpDir, { force: true, recursive: true });
29105
+ await rm11(tmpDir, { force: true, recursive: true });
28723
29106
  const paths = {};
28724
29107
  for (const specifier of allSpecs) {
28725
29108
  paths[specifier] = `/vendor/${toSafeFileName6(specifier)}.js`;
@@ -28990,6 +29373,9 @@ var FRAMEWORK_DIR_KEYS, collectDepVendorSourceDirs = (config) => {
28990
29373
  await handleCachedReload();
28991
29374
  return cached;
28992
29375
  }
29376
+ if (config.reactDirectory && !globalThis.__reactModuleRef) {
29377
+ globalThis.__reactModuleRef = await import("react");
29378
+ }
28993
29379
  const startupSteps = [];
28994
29380
  const recordStep = (label, startedAt) => {
28995
29381
  const durationMs = performance.now() - startedAt;
@@ -29165,9 +29551,6 @@ var FRAMEWORK_DIR_KEYS, collectDepVendorSourceDirs = (config) => {
29165
29551
  config.vueDirectory ? loadVendorFiles(state.assetStore, vueVendorDir, "vue") : Promise.resolve(),
29166
29552
  loadVendorFiles(state.assetStore, depVendorDir, "vendor")
29167
29553
  ]);
29168
- if (config.reactDirectory && !globalThis.__reactModuleRef) {
29169
- globalThis.__reactModuleRef = await import("react");
29170
- }
29171
29554
  recordStep("load vendor files", stepStartedAt);
29172
29555
  stepStartedAt = performance.now();
29173
29556
  const { warmCompilers: warmCompilers2 } = await Promise.resolve().then(() => (init_moduleServer(), exports_moduleServer));
@@ -29239,5 +29622,5 @@ export {
29239
29622
  build
29240
29623
  };
29241
29624
 
29242
- //# debugId=B2F810836F80A55464756E2164756E21
29625
+ //# debugId=E8337E5C2B5EAADD64756E2164756E21
29243
29626
  //# sourceMappingURL=build.js.map