@absolutejs/absolute 0.20.0-beta.1 → 0.20.0-beta.11

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 (68) hide show
  1. package/README.md +52 -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 +341 -22
  5. package/dist/angular/index.js.map +8 -5
  6. package/dist/angular/server.js +341 -22
  7. package/dist/angular/server.js.map +8 -5
  8. package/dist/build.js +537 -313
  9. package/dist/build.js.map +14 -13
  10. package/dist/cli/index.js +4171 -970
  11. package/dist/dev/client/cssUtils.ts +16 -2
  12. package/dist/dev/client/handlers/rebuild.ts +11 -1
  13. package/dist/dev/client/hmrTiming.ts +14 -7
  14. package/dist/index.js +857 -513
  15. package/dist/index.js.map +22 -21
  16. package/dist/mobile/browser.js +14 -1
  17. package/dist/mobile/browser.js.map +3 -3
  18. package/dist/mobile/index.js +2900 -244
  19. package/dist/mobile/index.js.map +23 -14
  20. package/dist/mobile/remoteMacAgentEntry.js +29 -0
  21. package/dist/mobile/shellAuth.js +43 -0
  22. package/dist/mobile/shellBootstrap.js +581 -0
  23. package/dist/mobile/shellSync.js +74 -0
  24. package/dist/src/angular/pageHandler.d.ts +3 -0
  25. package/dist/src/build/pwa.d.ts +15 -0
  26. package/dist/src/cli/config/server.d.ts +1 -1
  27. package/dist/src/core/pageHandlers.d.ts +11 -2
  28. package/dist/src/core/prepare.d.ts +6 -0
  29. package/dist/src/dev/clientManager.d.ts +2 -0
  30. package/dist/src/mobile/androidEmulatorController.d.ts +7 -1
  31. package/dist/src/mobile/androidRelease.d.ts +4 -0
  32. package/dist/src/mobile/buildPipeline.d.ts +1 -0
  33. package/dist/src/mobile/capacitorBundle.d.ts +15 -1
  34. package/dist/src/mobile/client.d.ts +4 -0
  35. package/dist/src/mobile/config.d.ts +1 -0
  36. package/dist/src/mobile/index.d.ts +7 -0
  37. package/dist/src/mobile/iosConformance.d.ts +15 -0
  38. package/dist/src/mobile/iosNativeWatcher.d.ts +19 -0
  39. package/dist/src/mobile/iosRelease.d.ts +61 -0
  40. package/dist/src/mobile/iosSimulatorController.d.ts +89 -0
  41. package/dist/src/mobile/nativeAuth.d.ts +17 -0
  42. package/dist/src/mobile/nativeBackgroundSync.d.ts +4 -0
  43. package/dist/src/mobile/releaseArtifact.d.ts +2 -0
  44. package/dist/src/mobile/releasePublisher.d.ts +130 -0
  45. package/dist/src/mobile/remoteMacAgent.d.ts +2 -0
  46. package/dist/src/mobile/remoteMacAgentEntry.d.ts +1 -0
  47. package/dist/src/mobile/remoteMacProtocol.d.ts +114 -0
  48. package/dist/src/mobile/remoteMacWire.d.ts +2 -0
  49. package/dist/src/mobile/shellAuth.d.ts +13 -0
  50. package/dist/src/mobile/shellBootstrap.d.ts +18 -1
  51. package/dist/src/mobile/shellSync.d.ts +19 -0
  52. package/dist/src/mobile/staticDocument.d.ts +5 -0
  53. package/dist/src/mobile/transport.d.ts +13 -1
  54. package/dist/src/plugins/hmr.d.ts +3 -0
  55. package/dist/src/plugins/imageOptimizer.d.ts +1 -1
  56. package/dist/src/svelte/pageHandler.d.ts +3 -0
  57. package/dist/src/utils/loadConfig.d.ts +1 -0
  58. package/dist/src/vue/pageHandler.d.ts +3 -0
  59. package/dist/svelte/index.js +312 -23
  60. package/dist/svelte/index.js.map +7 -4
  61. package/dist/svelte/server.js +307 -18
  62. package/dist/svelte/server.js.map +7 -4
  63. package/dist/types/build.d.ts +18 -0
  64. package/dist/vue/index.js +312 -23
  65. package/dist/vue/index.js.map +7 -4
  66. package/dist/vue/server.js +307 -18
  67. package/dist/vue/server.js.map +7 -4
  68. package/package.json +25 -9
package/dist/index.js CHANGED
@@ -10213,9 +10213,10 @@ var indexContentCache, resolveDevClientDir = () => {
10213
10213
  `}
10214
10214
  `,
10215
10215
  `// Attempt hydration with error handling`,
10216
+ `const shouldClientRender = window.__ABSOLUTE_PAGE_RENDER_MODE__ === 'client';`,
10216
10217
  `// Use document (not document.body) when the page renders <html><head><body>`,
10217
10218
  `// to avoid "In HTML, <html> cannot be a child of <body>" hydration error`,
10218
- `const container = typeof document !== 'undefined' ? document : null;`,
10219
+ `const container = typeof document !== 'undefined' ? (shouldClientRender ? document.getElementById('root') : document) : null;`,
10219
10220
  `if (!container) {`,
10220
10221
  ` throw new Error('React root container not found: document is null');`,
10221
10222
  `}
@@ -10241,7 +10242,6 @@ var indexContentCache, resolveDevClientDir = () => {
10241
10242
  `if (!window.__REACT_ROOT__) {`,
10242
10243
  ` let root;`,
10243
10244
  ` // Mobile data envelopes and dirty HMR pages have no matching SSR markup.`,
10244
- ` const shouldClientRender = window.__ABSOLUTE_PAGE_RENDER_MODE__ === 'client';`,
10245
10245
  ` if (window.__SSR_DIRTY__ || shouldClientRender) {`,
10246
10246
  ` root = createRoot(container);`,
10247
10247
  ` root.render(${isDev2 ? `createElement(ErrorBoundary, null, createElement(PageComponent, mergedProps))` : `createElement(PageComponent, mergedProps)`});`,
@@ -10321,6 +10321,15 @@ var indexContentCache, resolveDevClientDir = () => {
10321
10321
  ` };`,
10322
10322
  ` }`,
10323
10323
  `}`,
10324
+ `if (typeof window !== 'undefined') {`,
10325
+ ` window.__ABSOLUTE_PAGE_READY__ = Promise.resolve();`,
10326
+ ` window.__ABSOLUTE_PAGE_DISPOSE__ = function() {`,
10327
+ ` if (window.__REACT_ROOT__ && typeof window.__REACT_ROOT__.unmount === 'function') {`,
10328
+ ` window.__REACT_ROOT__.unmount();`,
10329
+ ` }`,
10330
+ ` window.__REACT_ROOT__ = null;`,
10331
+ ` };`,
10332
+ `}`,
10324
10333
  ...isDev2 ? [
10325
10334
  `
10326
10335
  // Pre-warm: import the page module from the module server`,
@@ -13031,7 +13040,8 @@ var heldLocks, HELD_LOCKS_ENV = "ABSOLUTE_HELD_BUILD_DIRECTORY_LOCKS", exitHandl
13031
13040
  });
13032
13041
  process.on("uncaughtException", (err) => {
13033
13042
  releaseAllSync();
13034
- throw err;
13043
+ console.error(err);
13044
+ process.exit(1);
13035
13045
  });
13036
13046
  }, isAlreadyExistsError = (error) => error instanceof Error && ("code" in error) && Reflect.get(error, "code") === "EEXIST", lockPathForBuildDirectory = (buildDirectory) => join28(dirname15(buildDirectory), ".absolutejs", "build.lock"), readHeldLockEnv = () => new Set((process.env[HELD_LOCKS_ENV] ?? "").split(`
13037
13047
  `).filter((entry) => entry.length > 0)), writeHeldLockEnv = (locks) => {
@@ -13188,13 +13198,135 @@ var isTestSourcePath = (file2) => {
13188
13198
  return normalized.includes("/__tests__/") || /\.(?:test|spec)\.[cm]?[jt]sx?$/.test(normalized);
13189
13199
  };
13190
13200
 
13201
+ // src/build/pwa.ts
13202
+ import { mkdir as mkdir8, rm as rm7, writeFile as writeFile8 } from "fs/promises";
13203
+ import { dirname as dirname16, join as join29 } from "path";
13204
+ var BOOTSTRAP_PUBLIC_PATH = "/__absolute/pwa/bootstrap.js", BOOTSTRAP_MARKER = "data-absolute-pwa", publicFilePath = (value, fallback, field) => {
13205
+ const input = value ?? fallback;
13206
+ if (!input.startsWith("/") || input.startsWith("//")) {
13207
+ throw new TypeError(`${field} must be an absolute same-origin path.`);
13208
+ }
13209
+ let url;
13210
+ try {
13211
+ url = new URL(input, "https://absolute.invalid");
13212
+ } catch {
13213
+ throw new TypeError(`${field} must be an absolute same-origin path.`);
13214
+ }
13215
+ if (url.origin !== "https://absolute.invalid" || url.search || url.hash || url.pathname === "/") {
13216
+ throw new TypeError(`${field} must be a file path without query or hash.`);
13217
+ }
13218
+ for (const part of input.split("/")) {
13219
+ let decoded;
13220
+ try {
13221
+ decoded = decodeURIComponent(part);
13222
+ } catch {
13223
+ throw new TypeError(`${field} contains invalid URL encoding.`);
13224
+ }
13225
+ if (decoded === "." || decoded === ".." || decoded.includes("\\")) {
13226
+ throw new TypeError(`${field} must not contain traversal segments.`);
13227
+ }
13228
+ }
13229
+ return url.pathname;
13230
+ }, destinationFor = (buildPath, publicPath) => join29(buildPath, ...publicPath.split("/").filter(Boolean)), bootstrapEntrySource = ({
13231
+ clientModule,
13232
+ manifestPath,
13233
+ serviceWorkerPath,
13234
+ sync
13235
+ }) => `import { registerServiceWorker } from ${JSON.stringify(clientModule)};
13236
+ ${manifestPath ? `const manifest = document.querySelector('link[rel="manifest"]') ?? document.createElement('link');
13237
+ manifest.setAttribute('rel', 'manifest');
13238
+ manifest.setAttribute('href', ${JSON.stringify(manifestPath)});
13239
+ if (!manifest.isConnected) document.head.append(manifest);
13240
+ ` : ""}await registerServiceWorker(${JSON.stringify(serviceWorkerPath)}, {
13241
+ deferUntilLoad: false${sync ? `,
13242
+ sync: ${JSON.stringify(sync === true ? {} : sync)}` : ""}
13243
+ });
13244
+ `, injectionSource = () => `if (typeof window !== 'undefined') {
13245
+ await import(new URL(${JSON.stringify(BOOTSTRAP_PUBLIC_PATH)}, window.location.origin).href);
13246
+ }
13247
+ `, injectPwaBootstrapHtml = (html) => {
13248
+ if (html.includes(BOOTSTRAP_MARKER))
13249
+ return html;
13250
+ const script = `<script type="module" src="${BOOTSTRAP_PUBLIC_PATH}" ${BOOTSTRAP_MARKER}></script>`;
13251
+ const closingHead = html.toLowerCase().indexOf("</head>");
13252
+ if (closingHead >= 0) {
13253
+ return `${html.slice(0, closingHead)}${script}${html.slice(closingHead)}`;
13254
+ }
13255
+ return `${script}${html}`;
13256
+ }, materializeAbsolutePwa = async ({
13257
+ buildPath,
13258
+ config,
13259
+ generatedRoot,
13260
+ write: write2 = true
13261
+ }) => {
13262
+ const serviceWorkerPath = publicFilePath(config.serviceWorkerPath, "/sw.js", "pwa.serviceWorkerPath");
13263
+ if (serviceWorkerPath.slice(1).includes("/")) {
13264
+ throw new TypeError("pwa.serviceWorkerPath must be a root-level file so its default service-worker scope covers the application.");
13265
+ }
13266
+ const manifestPath = config.manifest ? publicFilePath(config.manifest.path, "/manifest.webmanifest", "pwa.manifest.path") : undefined;
13267
+ const artifacts = {
13268
+ bootstrapBanner: injectionSource(),
13269
+ bootstrapPublicPath: BOOTSTRAP_PUBLIC_PATH,
13270
+ manifestPath,
13271
+ serviceWorkerPath
13272
+ };
13273
+ if (!write2)
13274
+ return artifacts;
13275
+ const { createWebAppManifest, pushServiceWorker } = await import("@absolutejs/pwa");
13276
+ const workerDestination = destinationFor(buildPath, serviceWorkerPath);
13277
+ await mkdir8(dirname16(workerDestination), { recursive: true });
13278
+ await writeFile8(workerDestination, `${pushServiceWorker({
13279
+ ...config.serviceWorker ?? {},
13280
+ sync: Boolean(config.sync)
13281
+ })}
13282
+ `);
13283
+ if (config.manifest && manifestPath) {
13284
+ const { path: _path, ...manifestConfig } = config.manifest;
13285
+ const manifestDestination = destinationFor(buildPath, manifestPath);
13286
+ await mkdir8(dirname16(manifestDestination), { recursive: true });
13287
+ await writeFile8(manifestDestination, `${JSON.stringify(createWebAppManifest(manifestConfig), null, "\t")}
13288
+ `);
13289
+ }
13290
+ const generatedDirectory = join29(generatedRoot, "pwa");
13291
+ const bootstrapEntry = join29(generatedDirectory, "bootstrap.ts");
13292
+ const clientModule = Bun.resolveSync("@absolutejs/pwa/client", import.meta.dir);
13293
+ await mkdir8(generatedDirectory, { recursive: true });
13294
+ await writeFile8(bootstrapEntry, bootstrapEntrySource({
13295
+ clientModule,
13296
+ manifestPath,
13297
+ serviceWorkerPath,
13298
+ sync: config.sync
13299
+ }));
13300
+ const browserDirectory = destinationFor(buildPath, "/__absolute/pwa");
13301
+ await rm7(browserDirectory, { force: true, recursive: true });
13302
+ await mkdir8(browserDirectory, { recursive: true });
13303
+ const result = await Bun.build({
13304
+ entrypoints: [bootstrapEntry],
13305
+ format: "esm",
13306
+ minify: true,
13307
+ naming: {
13308
+ asset: "asset-[hash].[ext]",
13309
+ chunk: "chunk-[hash].[ext]",
13310
+ entry: "bootstrap.js"
13311
+ },
13312
+ outdir: browserDirectory,
13313
+ splitting: true,
13314
+ target: "browser"
13315
+ });
13316
+ if (!result.success) {
13317
+ throw new AggregateError(result.logs, "Failed to build the AbsoluteJS PWA bootstrap.");
13318
+ }
13319
+ return artifacts;
13320
+ };
13321
+ var init_pwa = () => {};
13322
+
13191
13323
  // src/build/scanVueSsrOnlyPages.ts
13192
13324
  var exports_scanVueSsrOnlyPages = {};
13193
13325
  __export(exports_scanVueSsrOnlyPages, {
13194
13326
  scanVueSsrOnlyPages: () => scanVueSsrOnlyPages
13195
13327
  });
13196
13328
  import { readdirSync as readdirSync2, readFileSync as readFileSync17 } from "fs";
13197
- import { join as join29 } from "path";
13329
+ import { join as join30 } from "path";
13198
13330
  import ts8 from "typescript";
13199
13331
  var SKIP_DIRS2, SOURCE_EXTENSIONS2, getScriptKind3 = (filePath) => {
13200
13332
  if (filePath.endsWith(".tsx"))
@@ -13227,9 +13359,9 @@ var SKIP_DIRS2, SOURCE_EXTENSIONS2, getScriptKind3 = (filePath) => {
13227
13359
  continue;
13228
13360
  if (entry.name.startsWith("."))
13229
13361
  continue;
13230
- stack.push(join29(dir, entry.name));
13362
+ stack.push(join30(dir, entry.name));
13231
13363
  } else if (entry.isFile() && hasSourceExtension2(entry.name)) {
13232
- out.push(join29(dir, entry.name));
13364
+ out.push(join30(dir, entry.name));
13233
13365
  }
13234
13366
  }
13235
13367
  }
@@ -13341,7 +13473,7 @@ var init_scanVueSsrOnlyPages = __esm(() => {
13341
13473
 
13342
13474
  // src/build/scanAngularHandlerCalls.ts
13343
13475
  import { readdirSync as readdirSync3, readFileSync as readFileSync18 } from "fs";
13344
- import { join as join30 } from "path";
13476
+ import { join as join31 } from "path";
13345
13477
  import ts9 from "typescript";
13346
13478
  var ELYSIA_ROUTE_METHODS2, SKIP_DIRS3, SOURCE_EXTENSIONS3, SERVER_ENTRY_COPY_PREFIX = ".absolutejs-hmr-", getScriptKind4 = (filePath) => {
13347
13479
  if (filePath.endsWith(".tsx"))
@@ -13374,9 +13506,9 @@ var ELYSIA_ROUTE_METHODS2, SKIP_DIRS3, SOURCE_EXTENSIONS3, SERVER_ENTRY_COPY_PRE
13374
13506
  continue;
13375
13507
  if (entry.name.startsWith("."))
13376
13508
  continue;
13377
- stack.push(join30(dir, entry.name));
13509
+ stack.push(join31(dir, entry.name));
13378
13510
  } else if (entry.isFile() && !entry.name.startsWith(SERVER_ENTRY_COPY_PREFIX) && hasSourceExtension3(entry.name)) {
13379
- out.push(join30(dir, entry.name));
13511
+ out.push(join31(dir, entry.name));
13380
13512
  }
13381
13513
  }
13382
13514
  }
@@ -13491,7 +13623,7 @@ var init_scanAngularHandlerCalls = __esm(() => {
13491
13623
 
13492
13624
  // src/build/scanAngularPageRoutes.ts
13493
13625
  import { readdirSync as readdirSync4, readFileSync as readFileSync19 } from "fs";
13494
- import { basename as basename9, join as join31 } from "path";
13626
+ import { basename as basename9, join as join32 } from "path";
13495
13627
  import ts10 from "typescript";
13496
13628
  var SOURCE_EXTENSIONS4, SKIP_DIRS4, hasSourceExtension4 = (filePath) => {
13497
13629
  const idx = filePath.lastIndexOf(".");
@@ -13531,9 +13663,9 @@ var SOURCE_EXTENSIONS4, SKIP_DIRS4, hasSourceExtension4 = (filePath) => {
13531
13663
  continue;
13532
13664
  if (entry.name.startsWith("."))
13533
13665
  continue;
13534
- stack.push(join31(dir, entry.name));
13666
+ stack.push(join32(dir, entry.name));
13535
13667
  } else if (entry.isFile() && isPageFile(entry.name)) {
13536
- out.push(join31(dir, entry.name));
13668
+ out.push(join32(dir, entry.name));
13537
13669
  }
13538
13670
  }
13539
13671
  }
@@ -13610,7 +13742,7 @@ __export(exports_parseAngularConfigImports, {
13610
13742
  parseAngularProvidersImport: () => parseAngularProvidersImport
13611
13743
  });
13612
13744
  import { existsSync as existsSync23, readFileSync as readFileSync20 } from "fs";
13613
- import { dirname as dirname16, isAbsolute as isAbsolute3, join as join32 } from "path";
13745
+ import { dirname as dirname17, isAbsolute as isAbsolute3, join as join33 } from "path";
13614
13746
  import ts11 from "typescript";
13615
13747
  var findDefineConfigCall = (sf) => {
13616
13748
  let result = null;
@@ -13665,15 +13797,15 @@ var findDefineConfigCall = (sf) => {
13665
13797
  }, resolveConfigPath = (projectRoot) => {
13666
13798
  const envOverride = process.env.ABSOLUTE_CONFIG;
13667
13799
  if (envOverride) {
13668
- const resolved = isAbsolute3(envOverride) ? envOverride : join32(projectRoot, envOverride);
13800
+ const resolved = isAbsolute3(envOverride) ? envOverride : join33(projectRoot, envOverride);
13669
13801
  if (existsSync23(resolved))
13670
13802
  return resolved;
13671
13803
  }
13672
13804
  const candidates = [
13673
- join32(projectRoot, "absolute.config.ts"),
13674
- join32(projectRoot, "absolute.config.mts"),
13675
- join32(projectRoot, "absolute.config.js"),
13676
- join32(projectRoot, "absolute.config.mjs")
13805
+ join33(projectRoot, "absolute.config.ts"),
13806
+ join33(projectRoot, "absolute.config.mts"),
13807
+ join33(projectRoot, "absolute.config.js"),
13808
+ join33(projectRoot, "absolute.config.mjs")
13677
13809
  ];
13678
13810
  for (const candidate of candidates) {
13679
13811
  if (existsSync23(candidate))
@@ -13705,8 +13837,8 @@ var findDefineConfigCall = (sf) => {
13705
13837
  const importInfo = findImportForBinding(sf, binding);
13706
13838
  if (!importInfo)
13707
13839
  return null;
13708
- const configDir2 = dirname16(configPath2);
13709
- const absolutePath = importInfo.source.startsWith(".") ? join32(configDir2, importInfo.source).replace(/\.[cm]?[tj]sx?$/, "") : isAbsolute3(importInfo.source) ? importInfo.source.replace(/\.[cm]?[tj]sx?$/, "") : importInfo.source;
13840
+ const configDir2 = dirname17(configPath2);
13841
+ const absolutePath = importInfo.source.startsWith(".") ? join33(configDir2, importInfo.source).replace(/\.[cm]?[tj]sx?$/, "") : isAbsolute3(importInfo.source) ? importInfo.source.replace(/\.[cm]?[tj]sx?$/, "") : importInfo.source;
13710
13842
  return {
13711
13843
  absolutePath,
13712
13844
  bindingName: binding,
@@ -13778,10 +13910,10 @@ __export(exports_compileSvelte, {
13778
13910
  clearSvelteCompilerCache: () => clearSvelteCompilerCache
13779
13911
  });
13780
13912
  import { existsSync as existsSync24 } from "fs";
13781
- import { mkdir as mkdir8, stat as stat2 } from "fs/promises";
13913
+ import { mkdir as mkdir9, stat as stat2 } from "fs/promises";
13782
13914
  import {
13783
- dirname as dirname17,
13784
- join as join33,
13915
+ dirname as dirname18,
13916
+ join as join34,
13785
13917
  basename as basename10,
13786
13918
  extname as extname7,
13787
13919
  resolve as resolve25,
@@ -13829,7 +13961,7 @@ var resolveDevClientDir2 = () => {
13829
13961
  }, resolveRelativeModule2 = async (spec, from) => {
13830
13962
  if (!spec.startsWith("."))
13831
13963
  return null;
13832
- const basePath = resolve25(dirname17(from), spec);
13964
+ const basePath = resolve25(dirname18(from), spec);
13833
13965
  const candidates = [
13834
13966
  basePath,
13835
13967
  `${basePath}.ts`,
@@ -13840,14 +13972,14 @@ var resolveDevClientDir2 = () => {
13840
13972
  `${basePath}.svelte`,
13841
13973
  `${basePath}.svelte.ts`,
13842
13974
  `${basePath}.svelte.js`,
13843
- join33(basePath, "index.ts"),
13844
- join33(basePath, "index.js"),
13845
- join33(basePath, "index.mjs"),
13846
- join33(basePath, "index.cjs"),
13847
- join33(basePath, "index.json"),
13848
- join33(basePath, "index.svelte"),
13849
- join33(basePath, "index.svelte.ts"),
13850
- join33(basePath, "index.svelte.js")
13975
+ join34(basePath, "index.ts"),
13976
+ join34(basePath, "index.js"),
13977
+ join34(basePath, "index.mjs"),
13978
+ join34(basePath, "index.cjs"),
13979
+ join34(basePath, "index.json"),
13980
+ join34(basePath, "index.svelte"),
13981
+ join34(basePath, "index.svelte.ts"),
13982
+ join34(basePath, "index.svelte.js")
13851
13983
  ];
13852
13984
  const checks = await Promise.all(candidates.map(exists2));
13853
13985
  return candidates.find((_2, index) => checks[index]) ?? null;
@@ -13856,7 +13988,7 @@ var resolveDevClientDir2 = () => {
13856
13988
  const resolved = resolvePackageImport(spec);
13857
13989
  return resolved && /\.svelte(\.(?:ts|js))?$/.test(resolved) ? resolved : null;
13858
13990
  }
13859
- const basePath = resolve25(dirname17(from), spec);
13991
+ const basePath = resolve25(dirname18(from), spec);
13860
13992
  const explicit = /\.(svelte|svelte\.(?:ts|js))$/.test(basePath);
13861
13993
  if (!explicit) {
13862
13994
  const extensions = [".svelte", ".svelte.ts", ".svelte.js"];
@@ -13886,10 +14018,10 @@ var resolveDevClientDir2 = () => {
13886
14018
  }, compileSvelte = async (entryPoints, svelteRoot, cache = new Map, isDev2 = false, stylePreprocessors) => {
13887
14019
  const { compile, compileModule, preprocess } = await import("svelte/compiler");
13888
14020
  const generatedDir = getFrameworkGeneratedDir("svelte");
13889
- const clientDir = join33(generatedDir, "client");
13890
- const indexDir = join33(generatedDir, "indexes");
13891
- const serverDir = join33(generatedDir, "server");
13892
- await Promise.all([clientDir, indexDir, serverDir].map((dir) => mkdir8(dir, { recursive: true })));
14021
+ const clientDir = join34(generatedDir, "client");
14022
+ const indexDir = join34(generatedDir, "indexes");
14023
+ const serverDir = join34(generatedDir, "server");
14024
+ await Promise.all([clientDir, indexDir, serverDir].map((dir) => mkdir9(dir, { recursive: true })));
13893
14025
  const dev = env2.NODE_ENV !== "production";
13894
14026
  const build2 = async (src) => {
13895
14027
  const memoized = cache.get(src);
@@ -13916,8 +14048,8 @@ var resolveDevClientDir2 = () => {
13916
14048
  const preprocessedClient = isModule ? loweredClientSource.code : (await preprocess(loweredClientSource.code, svelteStylePreprocessor)).code;
13917
14049
  const transpiledServer = src.endsWith(".ts") || src.endsWith(".svelte.ts") ? transpiler3.transformSync(preprocessedServer) : preprocessedServer;
13918
14050
  const transpiledClient = src.endsWith(".ts") || src.endsWith(".svelte.ts") ? transpiler3.transformSync(preprocessedClient) : preprocessedClient;
13919
- const rawRel = dirname17(relative11(svelteRoot, src)).replace(/\\/g, "/");
13920
- const relDir = rawRel.startsWith("..") ? `_ext/${relative11(process.cwd(), dirname17(src)).replace(/\\/g, "/")}` : rawRel;
14051
+ const rawRel = dirname18(relative11(svelteRoot, src)).replace(/\\/g, "/");
14052
+ const relDir = rawRel.startsWith("..") ? `_ext/${relative11(process.cwd(), dirname18(src)).replace(/\\/g, "/")}` : rawRel;
13921
14053
  const baseName = basename10(src).replace(/\.svelte(\.(ts|js))?$/, "");
13922
14054
  const importPaths = Array.from(transpiledServer.matchAll(/from\s+['"]([^'"]+)['"]/g)).map((match) => match[1]).filter((path) => path !== undefined);
13923
14055
  const resolvedModuleImports = await Promise.all(importPaths.map((importPath) => resolveRelativeModule2(importPath, src)));
@@ -13926,8 +14058,8 @@ var resolveDevClientDir2 = () => {
13926
14058
  const childBuilt = await Promise.all(childSources.map((child) => build2(child)));
13927
14059
  const hasAwaitSlotFromChildren = childBuilt.some((child) => child.hasAwaitSlot);
13928
14060
  const externalRewrites = new Map;
13929
- const ssrOutputDir = dirname17(join33(serverDir, relDir, `${baseName}.js`));
13930
- const clientOutputDir = dirname17(join33(clientDir, relDir, `${baseName}.js`));
14061
+ const ssrOutputDir = dirname18(join34(serverDir, relDir, `${baseName}.js`));
14062
+ const clientOutputDir = dirname18(join34(clientDir, relDir, `${baseName}.js`));
13931
14063
  for (let idx = 0;idx < importPaths.length; idx++) {
13932
14064
  const rawSpec = importPaths[idx];
13933
14065
  if (!rawSpec)
@@ -13992,11 +14124,11 @@ var resolveDevClientDir2 = () => {
13992
14124
  code += islandMetadataExports;
13993
14125
  return { code, map: compiledJs.map };
13994
14126
  };
13995
- const ssrPath = join33(serverDir, relDir, `${baseName}.js`);
13996
- const clientPath = join33(clientDir, relDir, `${baseName}.js`);
14127
+ const ssrPath = join34(serverDir, relDir, `${baseName}.js`);
14128
+ const clientPath = join34(clientDir, relDir, `${baseName}.js`);
13997
14129
  await Promise.all([
13998
- mkdir8(dirname17(ssrPath), { recursive: true }),
13999
- mkdir8(dirname17(clientPath), { recursive: true })
14130
+ mkdir9(dirname18(ssrPath), { recursive: true }),
14131
+ mkdir9(dirname18(clientPath), { recursive: true })
14000
14132
  ]);
14001
14133
  const inlineMap = (map) => map ? `
14002
14134
  //# sourceMappingURL=data:application/json;base64,${Buffer.from(JSON.stringify(map)).toString("base64")}
@@ -14031,10 +14163,10 @@ var resolveDevClientDir2 = () => {
14031
14163
  const roots = await Promise.all(entryPoints.map(build2));
14032
14164
  const componentRoots = roots.filter((root) => !root.isModule);
14033
14165
  await Promise.all(componentRoots.map(async ({ client: client2, hasAwaitSlot }) => {
14034
- const relClientDir = dirname17(relative11(clientDir, client2));
14166
+ const relClientDir = dirname18(relative11(clientDir, client2));
14035
14167
  const name = basename10(client2, extname7(client2));
14036
- const indexPath = join33(indexDir, relClientDir, `${name}.js`);
14037
- const importRaw = relative11(dirname17(indexPath), client2).split(sep2).join("/");
14168
+ const indexPath = join34(indexDir, relClientDir, `${name}.js`);
14169
+ const importRaw = relative11(dirname18(indexPath), client2).split(sep2).join("/");
14038
14170
  const importPath = importRaw.startsWith(".") || importRaw.startsWith("/") ? importRaw : `./${importRaw}`;
14039
14171
  const hmrImports = isDev2 ? `window.__HMR_FRAMEWORK__ = "svelte";
14040
14172
  import "${hmrClientPath3}";
@@ -14045,8 +14177,9 @@ import { hydrate, mount, unmount } from "svelte";
14045
14177
  var initialProps = (typeof window !== "undefined" && window.__INITIAL_PROPS__) ? window.__INITIAL_PROPS__ : {};
14046
14178
  var isHMR = typeof window !== "undefined" && window.__SVELTE_COMPONENT__ !== undefined;
14047
14179
  var isSsrDirty = typeof window !== "undefined" && window.__SSR_DIRTY__;
14180
+ var isClientRender = typeof window !== "undefined" && window.__ABSOLUTE_PAGE_RENDER_MODE__ === "client";
14048
14181
  var hasIslandHtml = false;
14049
- var shouldHydrate = typeof window === "undefined" ? false : ${hasAwaitSlot ? "false" : "true"};
14182
+ var shouldHydrate = typeof window === "undefined" || isClientRender ? false : ${hasAwaitSlot ? "false" : "true"};
14050
14183
  var component;
14051
14184
  var target = document.getElementById(${JSON.stringify(SVELTE_PAGE_ROOT_ID)}) || document.body;
14052
14185
 
@@ -14077,6 +14210,8 @@ if (isHMR) {
14077
14210
  }
14078
14211
  component = mount(Component, { target, props: mergedProps });
14079
14212
  window.__HMR_PRESERVED_STATE__ = undefined;
14213
+ } else if (isClientRender) {
14214
+ component = mount(Component, { target, props: initialProps });
14080
14215
  } else if (!shouldHydrate) {
14081
14216
  component = undefined;
14082
14217
  } else if (isSsrDirty || hasIslandHtml) {
@@ -14088,6 +14223,13 @@ if (isHMR) {
14088
14223
  if (typeof window !== "undefined") {
14089
14224
  window.__SVELTE_COMPONENT__ = component;
14090
14225
  window.__SVELTE_UNMOUNT__ = function() { if (component) { unmount(component); } };
14226
+ window.__ABSOLUTE_PAGE_READY__ = Promise.resolve();
14227
+ window.__ABSOLUTE_PAGE_DISPOSE__ = function() {
14228
+ if (component) { unmount(component); }
14229
+ component = undefined;
14230
+ window.__SVELTE_COMPONENT__ = undefined;
14231
+ window.__SVELTE_UNMOUNT__ = undefined;
14232
+ };
14091
14233
  window.__SVELTE_REMOUNT__ = function(props) {
14092
14234
  if (typeof window.__SVELTE_UNMOUNT__ === "function") {
14093
14235
  try { window.__SVELTE_UNMOUNT__(); } catch (err) { /* ignore */ }
@@ -14113,14 +14255,14 @@ if (typeof window !== "undefined") {
14113
14255
  setTimeout(releaseStreamingSlots, 0);
14114
14256
  }
14115
14257
  }`;
14116
- await mkdir8(dirname17(indexPath), { recursive: true });
14258
+ await mkdir9(dirname18(indexPath), { recursive: true });
14117
14259
  return write2(indexPath, bootstrap);
14118
14260
  }));
14119
14261
  return {
14120
14262
  svelteClientPaths: roots.map(({ client: client2 }) => client2),
14121
14263
  svelteIndexPaths: componentRoots.map(({ client: client2 }) => {
14122
- const rel = dirname17(relative11(clientDir, client2));
14123
- return join33(indexDir, rel, basename10(client2));
14264
+ const rel = dirname18(relative11(clientDir, client2));
14265
+ return join34(indexDir, rel, basename10(client2));
14124
14266
  }),
14125
14267
  svelteServerPaths: roots.map(({ ssr }) => ssr)
14126
14268
  };
@@ -14135,7 +14277,7 @@ var init_compileSvelte = __esm(() => {
14135
14277
  init_lowerAwaitSlotSyntax();
14136
14278
  init_renderToReadableStream();
14137
14279
  devClientDir2 = resolveDevClientDir2();
14138
- hmrClientPath3 = join33(devClientDir2, "hmrClient.ts").replace(/\\/g, "/");
14280
+ hmrClientPath3 = join34(devClientDir2, "hmrClient.ts").replace(/\\/g, "/");
14139
14281
  persistentCache = new Map;
14140
14282
  sourceHashCache = new Map;
14141
14283
  transpiler3 = new Transpiler2({ loader: "ts", target: "browser" });
@@ -14613,12 +14755,12 @@ __export(exports_compileVue, {
14613
14755
  clearVueHmrCaches: () => clearVueHmrCaches
14614
14756
  });
14615
14757
  import { existsSync as existsSync25, readFileSync as readFileSync22, realpathSync as realpathSync2 } from "fs";
14616
- import { mkdir as mkdir9 } from "fs/promises";
14758
+ import { mkdir as mkdir10 } from "fs/promises";
14617
14759
  import {
14618
14760
  basename as basename11,
14619
- dirname as dirname18,
14761
+ dirname as dirname19,
14620
14762
  isAbsolute as isAbsolute4,
14621
- join as join34,
14763
+ join as join35,
14622
14764
  relative as relative12,
14623
14765
  resolve as resolve26
14624
14766
  } from "path";
@@ -14682,7 +14824,7 @@ var resolveDevClientDir3 = () => {
14682
14824
  visited.add(resolved);
14683
14825
  const importRegex = /@import\s+(?:url\(\s*)?(['"])(\.{1,2}\/[^'"]+)\1\s*\)?\s*;?/g;
14684
14826
  return cssContent.replace(importRegex, (match, _quote, relPath) => {
14685
- const importedPath = resolve26(dirname18(cssFilePath), relPath);
14827
+ const importedPath = resolve26(dirname19(cssFilePath), relPath);
14686
14828
  if (!existsSync25(importedPath))
14687
14829
  return match;
14688
14830
  const importedContent = readFileSync22(importedPath, "utf-8");
@@ -14804,12 +14946,12 @@ const ${localName} = (source) => ${importedName}(
14804
14946
  const childComponentPaths = importPaths.filter((path) => path.startsWith(".") && path.endsWith(".vue"));
14805
14947
  const packageComponentPaths = Array.from(resolvedPackageVueImports.entries());
14806
14948
  const helperModulePaths = importPaths.filter((path) => path.startsWith(".") && !path.endsWith(".vue") && !isStylePath(path));
14807
- const stylePathsImported = importPaths.filter((path) => (path.startsWith(".") || isAbsolute4(path)) && isStylePath(path)).map((path) => isAbsolute4(path) ? path : resolve26(dirname18(sourceFilePath), path));
14949
+ const stylePathsImported = importPaths.filter((path) => (path.startsWith(".") || isAbsolute4(path)) && isStylePath(path)).map((path) => isAbsolute4(path) ? path : resolve26(dirname19(sourceFilePath), path));
14808
14950
  for (const stylePath of stylePathsImported) {
14809
14951
  addStyleImporter(sourceFilePath, stylePath);
14810
14952
  }
14811
14953
  const childBuildResults = await Promise.all([
14812
- ...childComponentPaths.map((relativeChildPath) => compileVueFile(resolve26(dirname18(sourceFilePath), relativeChildPath), outputDirs, cacheMap, false, vueRootDir, compiler, stylePreprocessors)),
14954
+ ...childComponentPaths.map((relativeChildPath) => compileVueFile(resolve26(dirname19(sourceFilePath), relativeChildPath), outputDirs, cacheMap, false, vueRootDir, compiler, stylePreprocessors)),
14813
14955
  ...packageComponentPaths.map(([, absolutePath]) => compileVueFile(absolutePath, outputDirs, cacheMap, false, vueRootDir, compiler, stylePreprocessors))
14814
14956
  ]);
14815
14957
  const hasScript = descriptor.script || descriptor.scriptSetup;
@@ -14824,7 +14966,7 @@ const ${localName} = (source) => ${importedName}(
14824
14966
  sourceMap: true
14825
14967
  }) : { bindings: {}, content: "export default {};", map: undefined };
14826
14968
  const strippedScript = stripExports2(compiledScript.content);
14827
- const sourceDir = dirname18(sourceFilePath);
14969
+ const sourceDir = dirname19(sourceFilePath);
14828
14970
  const transpiledScript = transpiler4.transformSync(strippedScript).replace(/(['"])(\.{1,2}\/[^'"]+)(['"])/g, (_2, quoteStart, relativeImport, quoteEnd) => `${quoteStart}${toJs(relativeImport, sourceDir)}${quoteEnd}`);
14829
14971
  const packageImportRewrites = new Map;
14830
14972
  for (const [bareImport, absolutePath] of packageComponentPaths) {
@@ -14869,8 +15011,8 @@ const ${localName} = (source) => ${importedName}(
14869
15011
  ];
14870
15012
  let cssOutputPaths = [];
14871
15013
  if (isEntryPoint && allCss.length) {
14872
- const cssOutputFile = join34(outputDirs.css, `${toKebab(fileBaseName)}-compiled.css`);
14873
- await mkdir9(dirname18(cssOutputFile), { recursive: true });
15014
+ const cssOutputFile = join35(outputDirs.css, `${toKebab(fileBaseName)}-compiled.css`);
15015
+ await mkdir10(dirname19(cssOutputFile), { recursive: true });
14874
15016
  await write3(cssOutputFile, allCss.join(`
14875
15017
  `));
14876
15018
  cssOutputPaths = [cssOutputFile];
@@ -14900,21 +15042,21 @@ if (typeof __VUE_HMR_RUNTIME__ !== 'undefined') {
14900
15042
  };
14901
15043
  const clientCode = assembleModule(generateRenderFunction(false), "render", true) + islandMetadataExports;
14902
15044
  const serverCode = wrapServerAsyncComponentLoader(assembleModule(generateRenderFunction(true), "ssrRender", false)) + islandMetadataExports;
14903
- const clientOutputPath = join34(outputDirs.client, `${relativeWithoutExtension}.js`);
14904
- const serverOutputPath = join34(outputDirs.server, `${relativeWithoutExtension}.js`);
15045
+ const clientOutputPath = join35(outputDirs.client, `${relativeWithoutExtension}.js`);
15046
+ const serverOutputPath = join35(outputDirs.server, `${relativeWithoutExtension}.js`);
14905
15047
  const rewritePackageImports = (code, outputPath, mode) => {
14906
15048
  let result2 = code;
14907
15049
  for (const [bareImport, paths] of packageImportRewrites) {
14908
15050
  const targetPath = mode === "server" ? paths.server : paths.client;
14909
- let rel = relative12(dirname18(outputPath), targetPath).replace(/\\/g, "/");
15051
+ let rel = relative12(dirname19(outputPath), targetPath).replace(/\\/g, "/");
14910
15052
  if (!rel.startsWith("."))
14911
15053
  rel = `./${rel}`;
14912
15054
  result2 = result2.replaceAll(bareImport, rel);
14913
15055
  }
14914
15056
  return result2;
14915
15057
  };
14916
- await mkdir9(dirname18(clientOutputPath), { recursive: true });
14917
- await mkdir9(dirname18(serverOutputPath), { recursive: true });
15058
+ await mkdir10(dirname19(clientOutputPath), { recursive: true });
15059
+ await mkdir10(dirname19(serverOutputPath), { recursive: true });
14918
15060
  const clientFinal = rewritePackageImports(clientCode, clientOutputPath, "client");
14919
15061
  const serverFinal = rewritePackageImports(serverCode, serverOutputPath, "server");
14920
15062
  const inlineSourceMapFor = (finalContent) => {
@@ -14937,7 +15079,7 @@ if (typeof __VUE_HMR_RUNTIME__ !== 'undefined') {
14937
15079
  serverPath: serverOutputPath,
14938
15080
  spaRoutes: spaRoutes.length > 0 ? spaRoutes : undefined,
14939
15081
  tsHelperPaths: [
14940
- ...helperModulePaths.map((helper) => resolveHelperTsPath(dirname18(sourceFilePath), helper)),
15082
+ ...helperModulePaths.map((helper) => resolveHelperTsPath(dirname19(sourceFilePath), helper)),
14941
15083
  ...childBuildResults.flatMap((child) => child.tsHelperPaths)
14942
15084
  ]
14943
15085
  };
@@ -14947,15 +15089,15 @@ if (typeof __VUE_HMR_RUNTIME__ !== 'undefined') {
14947
15089
  }, compileVue = async (entryPoints, vueRootDir, isDev2 = false, stylePreprocessors, ssrOnlyEntries) => {
14948
15090
  const compiler = await loadVueCompiler();
14949
15091
  const generatedDir = getFrameworkGeneratedDir("vue");
14950
- const clientOutputDir = join34(generatedDir, "client");
14951
- const indexOutputDir = join34(generatedDir, "indexes");
14952
- const serverOutputDir = join34(generatedDir, "server");
14953
- const cssOutputDir = join34(generatedDir, "compiled");
15092
+ const clientOutputDir = join35(generatedDir, "client");
15093
+ const indexOutputDir = join35(generatedDir, "indexes");
15094
+ const serverOutputDir = join35(generatedDir, "server");
15095
+ const cssOutputDir = join35(generatedDir, "compiled");
14954
15096
  await Promise.all([
14955
- mkdir9(clientOutputDir, { recursive: true }),
14956
- mkdir9(indexOutputDir, { recursive: true }),
14957
- mkdir9(serverOutputDir, { recursive: true }),
14958
- mkdir9(cssOutputDir, { recursive: true })
15097
+ mkdir10(clientOutputDir, { recursive: true }),
15098
+ mkdir10(indexOutputDir, { recursive: true }),
15099
+ mkdir10(serverOutputDir, { recursive: true }),
15100
+ mkdir10(cssOutputDir, { recursive: true })
14959
15101
  ]);
14960
15102
  const buildCache = new Map;
14961
15103
  const allTsHelperPaths = new Set;
@@ -14977,7 +15119,7 @@ if (typeof __VUE_HMR_RUNTIME__ !== 'undefined') {
14977
15119
  });
14978
15120
  const routes = parseVueSpaRoutes(descriptor.script?.content ?? "");
14979
15121
  for (const { importPath } of routes) {
14980
- const childPath = resolve26(dirname18(entryPath), importPath);
15122
+ const childPath = resolve26(dirname19(entryPath), importPath);
14981
15123
  if (expanded.has(childPath) || !existsSync25(childPath)) {
14982
15124
  continue;
14983
15125
  }
@@ -15007,16 +15149,16 @@ if (typeof __VUE_HMR_RUNTIME__ !== 'undefined') {
15007
15149
  };
15008
15150
  }
15009
15151
  const entryBaseName = basename11(entryPath, ".vue");
15010
- const indexOutputFile = join34(indexOutputDir, `${entryBaseName}.js`);
15011
- const clientOutputFile = join34(clientOutputDir, relative12(vueRootDir, entryPath).replace(/\\/g, "/").replace(/\.vue$/, ".js"));
15012
- await mkdir9(dirname18(indexOutputFile), { recursive: true });
15152
+ const indexOutputFile = join35(indexOutputDir, `${entryBaseName}.js`);
15153
+ const clientOutputFile = join35(clientOutputDir, relative12(vueRootDir, entryPath).replace(/\\/g, "/").replace(/\.vue$/, ".js"));
15154
+ await mkdir10(dirname19(indexOutputFile), { recursive: true });
15013
15155
  const vueHmrImports = isDev2 ? [
15014
15156
  `window.__HMR_FRAMEWORK__ = "vue";`,
15015
15157
  `import "${hmrClientPath4}";`
15016
15158
  ] : [];
15017
15159
  await write3(indexOutputFile, [
15018
15160
  ...vueHmrImports,
15019
- `import Comp, * as PageModule from "${relative12(dirname18(indexOutputFile), clientOutputFile).replace(/\\/g, "/")}";`,
15161
+ `import Comp, * as PageModule from "${relative12(dirname19(indexOutputFile), clientOutputFile).replace(/\\/g, "/")}";`,
15020
15162
  'import { createSSRApp, createApp } from "vue";',
15021
15163
  "",
15022
15164
  "// HMR State Preservation: Check for preserved state from HMR",
@@ -15063,7 +15205,8 @@ if (typeof __VUE_HMR_RUNTIME__ !== 'undefined') {
15063
15205
  "// client-side navigation after mount.",
15064
15206
  'const isHMR = typeof window !== "undefined" && sessionStorage.getItem("__HMR_ACTIVE__");',
15065
15207
  'const isSsrDirty = typeof window !== "undefined" && window.__SSR_DIRTY__;',
15066
- 'const shouldHydrate = typeof window === "undefined" ? false : !(isHMR || isSsrDirty || hasSpaRoutes);',
15208
+ 'const isClientRender = typeof window !== "undefined" && window.__ABSOLUTE_PAGE_RENDER_MODE__ === "client";',
15209
+ 'const shouldHydrate = typeof window === "undefined" ? false : !(isHMR || isSsrDirty || hasSpaRoutes || isClientRender);',
15067
15210
  "const app = shouldHydrate ? createSSRApp(Comp, mergedProps) : createApp(Comp, mergedProps);",
15068
15211
  "",
15069
15212
  "async function bootstrapApp() {",
@@ -15081,11 +15224,17 @@ if (typeof __VUE_HMR_RUNTIME__ !== 'undefined') {
15081
15224
  " }",
15082
15225
  ' app.mount("#root");',
15083
15226
  "}",
15084
- "bootstrapApp();",
15227
+ "const absolutePageReady = bootstrapApp();",
15085
15228
  "",
15086
15229
  "// Store app instance for HMR - used for manual component updates",
15087
15230
  'if (typeof window !== "undefined") {',
15088
15231
  " window.__VUE_APP__ = app;",
15232
+ " window.__ABSOLUTE_PAGE_READY__ = absolutePageReady;",
15233
+ " window.__ABSOLUTE_PAGE_DISPOSE__ = async function() {",
15234
+ " await absolutePageReady;",
15235
+ " app.unmount();",
15236
+ " window.__VUE_APP__ = undefined;",
15237
+ " };",
15089
15238
  "}",
15090
15239
  "",
15091
15240
  "// Post-mount: Apply preserved state to reactive refs in component tree",
@@ -15171,7 +15320,7 @@ if (typeof __VUE_HMR_RUNTIME__ !== 'undefined') {
15171
15320
  if (!tsPath)
15172
15321
  continue;
15173
15322
  const sourceCode = await file3(tsPath).text();
15174
- const helperDir = dirname18(tsPath);
15323
+ const helperDir = dirname19(tsPath);
15175
15324
  for (const dep of extractImports(sourceCode)) {
15176
15325
  if (!dep.startsWith(".") || isStylePath(dep) || dep.endsWith(".vue")) {
15177
15326
  continue;
@@ -15190,10 +15339,10 @@ if (typeof __VUE_HMR_RUNTIME__ !== 'undefined') {
15190
15339
  const transpiledCode = transpiler4.transformSync(sourceCode);
15191
15340
  const withMap = transpiledCode + inlineLineMapComment(tsPath, sourceCode, transpiledCode);
15192
15341
  const relativeJsPath = relative12(vueRootDir, tsPath).replace(/\.ts$/, ".js");
15193
- const outClientPath = join34(clientOutputDir, relativeJsPath);
15194
- const outServerPath = join34(serverOutputDir, relativeJsPath);
15195
- await mkdir9(dirname18(outClientPath), { recursive: true });
15196
- await mkdir9(dirname18(outServerPath), { recursive: true });
15342
+ const outClientPath = join35(clientOutputDir, relativeJsPath);
15343
+ const outServerPath = join35(serverOutputDir, relativeJsPath);
15344
+ await mkdir10(dirname19(outClientPath), { recursive: true });
15345
+ await mkdir10(dirname19(outServerPath), { recursive: true });
15197
15346
  await write3(outClientPath, withMap);
15198
15347
  await write3(outServerPath, withMap);
15199
15348
  }));
@@ -15223,7 +15372,7 @@ var init_compileVue = __esm(() => {
15223
15372
  init_vueAutoRouterTransform();
15224
15373
  init_stylePreprocessor();
15225
15374
  devClientDir3 = resolveDevClientDir3();
15226
- hmrClientPath4 = join34(devClientDir3, "hmrClient.ts").replace(/\\/g, "/");
15375
+ hmrClientPath4 = join35(devClientDir3, "hmrClient.ts").replace(/\\/g, "/");
15227
15376
  transpiler4 = new Transpiler3({ loader: "ts", target: "browser" });
15228
15377
  scriptCache = new Map;
15229
15378
  scriptSetupCache = new Map;
@@ -15705,7 +15854,7 @@ __export(exports_compileAngular, {
15705
15854
  compileAngular: () => compileAngular
15706
15855
  });
15707
15856
  import { existsSync as existsSync26, readFileSync as readFileSync23, promises as fs5 } from "fs";
15708
- import { join as join35, basename as basename12, sep as sep3, dirname as dirname19, resolve as resolve27, relative as relative13 } from "path";
15857
+ import { join as join36, basename as basename12, sep as sep3, dirname as dirname20, resolve as resolve27, relative as relative13 } from "path";
15709
15858
  var {Glob: Glob6 } = globalThis.Bun;
15710
15859
  import ts13 from "typescript";
15711
15860
  var traceAngularPhase = async (name, fn2, metadata2) => {
@@ -15748,10 +15897,10 @@ var traceAngularPhase = async (name, fn2, metadata2) => {
15748
15897
  `${candidate}.tsx`,
15749
15898
  `${candidate}.js`,
15750
15899
  `${candidate}.jsx`,
15751
- join35(candidate, "index.ts"),
15752
- join35(candidate, "index.tsx"),
15753
- join35(candidate, "index.js"),
15754
- join35(candidate, "index.jsx")
15900
+ join36(candidate, "index.ts"),
15901
+ join36(candidate, "index.tsx"),
15902
+ join36(candidate, "index.js"),
15903
+ join36(candidate, "index.jsx")
15755
15904
  ];
15756
15905
  return candidates.find((file4) => existsSync26(file4));
15757
15906
  }, createLegacyAngularAnimationUsageResolver = (rootDir) => {
@@ -15823,7 +15972,7 @@ var traceAngularPhase = async (name, fn2, metadata2) => {
15823
15972
  if (scan.usesLegacyAnimations)
15824
15973
  return true;
15825
15974
  for (const specifier of scan.imports) {
15826
- const importedPath = resolveLocalImport(specifier, dirname19(resolved));
15975
+ const importedPath = resolveLocalImport(specifier, dirname20(resolved));
15827
15976
  if (importedPath && await visit(importedPath, visited)) {
15828
15977
  return true;
15829
15978
  }
@@ -15882,7 +16031,7 @@ var traceAngularPhase = async (name, fn2, metadata2) => {
15882
16031
  return `${path.replace(/\.ts$/, ".js")}${query}`;
15883
16032
  if (hasJsLikeExtension(path))
15884
16033
  return `${path}${query}`;
15885
- const importerDir = dirname19(importerOutputPath);
16034
+ const importerDir = dirname20(importerOutputPath);
15886
16035
  const fileCandidate = resolve27(importerDir, `${path}.js`);
15887
16036
  if (outputFiles?.has(fileCandidate) || existsSync26(fileCandidate)) {
15888
16037
  return `${path}.js${query}`;
@@ -15915,16 +16064,16 @@ var traceAngularPhase = async (name, fn2, metadata2) => {
15915
16064
  }, resolveLocalTsImport = (fromFile, specifier) => {
15916
16065
  if (!isRelativeModuleSpecifier(specifier))
15917
16066
  return null;
15918
- const basePath = resolve27(dirname19(fromFile), specifier);
16067
+ const basePath = resolve27(dirname20(fromFile), specifier);
15919
16068
  const candidates = /\.[cm]?[tj]sx?$/.test(basePath) ? [basePath] : [
15920
16069
  `${basePath}.ts`,
15921
16070
  `${basePath}.tsx`,
15922
16071
  `${basePath}.mts`,
15923
16072
  `${basePath}.cts`,
15924
- join35(basePath, "index.ts"),
15925
- join35(basePath, "index.tsx"),
15926
- join35(basePath, "index.mts"),
15927
- join35(basePath, "index.cts")
16073
+ join36(basePath, "index.ts"),
16074
+ join36(basePath, "index.tsx"),
16075
+ join36(basePath, "index.mts"),
16076
+ join36(basePath, "index.cts")
15928
16077
  ];
15929
16078
  return candidates.map((candidate) => resolve27(candidate)).find((candidate) => existsSync26(candidate) && !candidate.endsWith(".d.ts")) ?? null;
15930
16079
  }, readFileForAotTransform = async (fileName, readFile9) => {
@@ -15950,15 +16099,15 @@ var traceAngularPhase = async (name, fn2, metadata2) => {
15950
16099
  const paths = [];
15951
16100
  const templateUrlMatch = findUncommentedMatch(source, /templateUrl\s*:\s*['"]([^'"]+)['"]/);
15952
16101
  if (templateUrlMatch?.[1])
15953
- paths.push(join35(fileDir, templateUrlMatch[1]));
16102
+ paths.push(join36(fileDir, templateUrlMatch[1]));
15954
16103
  const styleUrlMatch = findUncommentedMatch(source, /styleUrl\s*:\s*['"]([^'"]+)['"]/);
15955
16104
  if (styleUrlMatch?.[1])
15956
- paths.push(join35(fileDir, styleUrlMatch[1]));
16105
+ paths.push(join36(fileDir, styleUrlMatch[1]));
15957
16106
  const styleUrlsMatch = findUncommentedMatch(source, /styleUrls\s*:\s*\[([^\]]+)\]/);
15958
16107
  const urlMatches = styleUrlsMatch?.[1]?.match(/['"]([^'"]+)['"]/g);
15959
16108
  if (urlMatches) {
15960
16109
  for (const urlMatch of urlMatches) {
15961
- paths.push(join35(fileDir, urlMatch.replace(/['"]/g, "")));
16110
+ paths.push(join36(fileDir, urlMatch.replace(/['"]/g, "")));
15962
16111
  }
15963
16112
  }
15964
16113
  return paths.map((path) => resolve27(path));
@@ -15973,13 +16122,13 @@ var traceAngularPhase = async (name, fn2, metadata2) => {
15973
16122
  return null;
15974
16123
  }
15975
16124
  }, writeResourceCacheFile = async (cachePath, source) => {
15976
- await fs5.mkdir(dirname19(cachePath), { recursive: true });
16125
+ await fs5.mkdir(dirname20(cachePath), { recursive: true });
15977
16126
  await fs5.writeFile(cachePath, JSON.stringify({
15978
16127
  source,
15979
16128
  version: 1
15980
16129
  }), "utf-8");
15981
16130
  }, resolveResourceTransformCachePath = async (filePath, source, stylePreprocessors) => {
15982
- const resourcePaths = collectAngularResourcePaths(source, dirname19(filePath));
16131
+ const resourcePaths = collectAngularResourcePaths(source, dirname20(filePath));
15983
16132
  const resourceContents = await Promise.all(resourcePaths.map(async (resourcePath) => {
15984
16133
  const content = await fs5.readFile(resourcePath, "utf-8");
15985
16134
  return `${resourcePath}\x00${content}`;
@@ -15992,7 +16141,7 @@ var traceAngularPhase = async (name, fn2, metadata2) => {
15992
16141
  safeStableStringify(stylePreprocessors ?? null)
15993
16142
  ].join("\x00");
15994
16143
  const cacheKey2 = Bun.hash(cacheInput).toString(BASE_36_RADIX);
15995
- return join35(process.cwd(), ".absolutejs", "cache", "angular-resources", `${cacheKey2}.json`);
16144
+ return join36(process.cwd(), ".absolutejs", "cache", "angular-resources", `${cacheKey2}.json`);
15996
16145
  }, precomputeAotResourceTransforms = async (inputPaths, readFile9, stylePreprocessors) => {
15997
16146
  const transformedSources = new Map;
15998
16147
  const visited = new Set;
@@ -16019,7 +16168,7 @@ var traceAngularPhase = async (name, fn2, metadata2) => {
16019
16168
  transformedSource = cached.source;
16020
16169
  } else {
16021
16170
  stats.cacheMisses += 1;
16022
- const transformed = await inlineResources(source, dirname19(resolvedPath), stylePreprocessors);
16171
+ const transformed = await inlineResources(source, dirname20(resolvedPath), stylePreprocessors);
16023
16172
  transformedSource = transformed.source;
16024
16173
  await writeResourceCacheFile(cachePath, transformedSource);
16025
16174
  }
@@ -16038,7 +16187,7 @@ var traceAngularPhase = async (name, fn2, metadata2) => {
16038
16187
  return { stats, transformedSources };
16039
16188
  }, compileAngularFiles = async (inputPaths, outDir, stylePreprocessors) => {
16040
16189
  const islandMetadataByOutputPath = await traceAngularPhase("aot/island-metadata", () => new Map(inputPaths.map((inputPath) => {
16041
- const outputPath = resolve27(join35(outDir, relative13(process.cwd(), resolve27(inputPath)).replace(/\.[cm]?[tj]sx?$/, ".js")));
16190
+ const outputPath = resolve27(join36(outDir, relative13(process.cwd(), resolve27(inputPath)).replace(/\.[cm]?[tj]sx?$/, ".js")));
16042
16191
  return [
16043
16192
  outputPath,
16044
16193
  buildIslandMetadataExports(readFileSync23(inputPath, "utf-8"))
@@ -16048,7 +16197,7 @@ var traceAngularPhase = async (name, fn2, metadata2) => {
16048
16197
  const { readConfiguration, performCompilation, EmitFlags } = await traceAngularPhase("aot/import-compiler-cli", () => import("@angular/compiler-cli"));
16049
16198
  const tsLibDir = await traceAngularPhase("aot/resolve-typescript-lib", () => {
16050
16199
  const tsPath = __require.resolve("typescript");
16051
- const tsRootDir = dirname19(tsPath);
16200
+ const tsRootDir = dirname20(tsPath);
16052
16201
  return tsRootDir.endsWith("lib") ? tsRootDir : resolve27(tsRootDir, "lib");
16053
16202
  });
16054
16203
  const config = await traceAngularPhase("aot/read-configuration", () => readConfiguration("./tsconfig.json"));
@@ -16085,7 +16234,7 @@ var traceAngularPhase = async (name, fn2, metadata2) => {
16085
16234
  const originalGetSourceFile = host.getSourceFile;
16086
16235
  host.getSourceFile = (fileName, languageVersion, onError) => {
16087
16236
  if (fileName.startsWith("lib.") && fileName.endsWith(".d.ts") && tsLibDir) {
16088
- const resolvedPath = join35(tsLibDir, fileName);
16237
+ const resolvedPath = join36(tsLibDir, fileName);
16089
16238
  return originalGetSourceFile?.call(host, resolvedPath, languageVersion, onError);
16090
16239
  }
16091
16240
  return originalGetSourceFile?.call(host, fileName, languageVersion, onError);
@@ -16140,7 +16289,7 @@ var traceAngularPhase = async (name, fn2, metadata2) => {
16140
16289
  const entries = await traceAngularPhase("aot/postprocess-emitted-js", () => {
16141
16290
  const rawEntries = Object.entries(emitted).filter(([fileName]) => fileName.endsWith(".js")).map(([fileName, content]) => ({
16142
16291
  content,
16143
- target: join35(outDir, fileName)
16292
+ target: join36(outDir, fileName)
16144
16293
  }));
16145
16294
  const outputFiles = new Set(rawEntries.map(({ target }) => resolve27(target)));
16146
16295
  return rawEntries.map(({ content, target }) => {
@@ -16162,7 +16311,7 @@ var traceAngularPhase = async (name, fn2, metadata2) => {
16162
16311
  });
16163
16312
  });
16164
16313
  await traceAngularPhase("aot/write-output", () => Promise.all(entries.map(async ({ target, content }) => {
16165
- await fs5.mkdir(dirname19(target), { recursive: true });
16314
+ await fs5.mkdir(dirname20(target), { recursive: true });
16166
16315
  await fs5.writeFile(target, content, "utf-8");
16167
16316
  })), { outputs: entries.length });
16168
16317
  return await traceAngularPhase("aot/collect-output-paths", () => entries.map(({ target }) => target), { outputs: entries.length });
@@ -16317,7 +16466,7 @@ ${fields}
16317
16466
  }, inlineTemplateAndLowerDefer = async (source, fileDir) => {
16318
16467
  const templateUrlMatch = findUncommentedMatch(source, /templateUrl\s*:\s*['"]([^'"]+)['"]/);
16319
16468
  if (templateUrlMatch?.[1]) {
16320
- const templatePath = join35(fileDir, templateUrlMatch[1]);
16469
+ const templatePath = join36(fileDir, templateUrlMatch[1]);
16321
16470
  if (!existsSync26(templatePath)) {
16322
16471
  throw new Error(`Unable to inline Angular templateUrl "${templateUrlMatch[1]}": file not found at ${templatePath}`);
16323
16472
  }
@@ -16348,7 +16497,7 @@ ${fields}
16348
16497
  }, inlineTemplateAndLowerDeferSync = (source, fileDir) => {
16349
16498
  const templateUrlMatch = findUncommentedMatch(source, /templateUrl\s*:\s*['"]([^'"]+)['"]/);
16350
16499
  if (templateUrlMatch?.[1]) {
16351
- const templatePath = join35(fileDir, templateUrlMatch[1]);
16500
+ const templatePath = join36(fileDir, templateUrlMatch[1]);
16352
16501
  if (!existsSync26(templatePath)) {
16353
16502
  throw new Error(`Unable to inline Angular templateUrl "${templateUrlMatch[1]}": file not found at ${templatePath}`);
16354
16503
  }
@@ -16385,7 +16534,7 @@ ${fields}
16385
16534
  return source;
16386
16535
  const stylePromises = urlMatches.map((urlMatch) => {
16387
16536
  const styleUrl = urlMatch.replace(/['"]/g, "");
16388
- return readAndEscapeFile(join35(fileDir, styleUrl), stylePreprocessors);
16537
+ return readAndEscapeFile(join36(fileDir, styleUrl), stylePreprocessors);
16389
16538
  });
16390
16539
  const results = await Promise.all(stylePromises);
16391
16540
  const inlinedStyles = results.filter(Boolean).map((escaped) => `\`${escaped}\``);
@@ -16396,7 +16545,7 @@ ${fields}
16396
16545
  const styleUrlMatch = findUncommentedMatch(source, /styleUrl\s*:\s*['"]([^'"]+)['"]/);
16397
16546
  if (!styleUrlMatch?.[1])
16398
16547
  return source;
16399
- const escaped = await readAndEscapeFile(join35(fileDir, styleUrlMatch[1]), stylePreprocessors);
16548
+ const escaped = await readAndEscapeFile(join36(fileDir, styleUrlMatch[1]), stylePreprocessors);
16400
16549
  if (!escaped)
16401
16550
  return source;
16402
16551
  return source.slice(0, styleUrlMatch.index) + `styles: [\`${escaped}\`]` + source.slice(styleUrlMatch.index + styleUrlMatch[0].length);
@@ -16492,10 +16641,10 @@ ${fields}
16492
16641
  `${candidate}.js`,
16493
16642
  `${candidate}.jsx`,
16494
16643
  `${candidate}.json`,
16495
- join35(candidate, "index.ts"),
16496
- join35(candidate, "index.tsx"),
16497
- join35(candidate, "index.js"),
16498
- join35(candidate, "index.jsx")
16644
+ join36(candidate, "index.ts"),
16645
+ join36(candidate, "index.tsx"),
16646
+ join36(candidate, "index.js"),
16647
+ join36(candidate, "index.jsx")
16499
16648
  ];
16500
16649
  return candidates.find((file4) => existsSync26(file4));
16501
16650
  };
@@ -16519,13 +16668,13 @@ ${fields}
16519
16668
  }
16520
16669
  };
16521
16670
  const toOutputPath = (sourcePath) => {
16522
- const inputDir = dirname19(sourcePath);
16671
+ const inputDir = dirname20(sourcePath);
16523
16672
  const fileBase = basename12(sourcePath).replace(/\.[cm]?[tj]sx?$/, ".js");
16524
16673
  if (inputDir === outDir || inputDir.startsWith(`${outDir}${sep3}`)) {
16525
- return join35(inputDir, fileBase);
16674
+ return join36(inputDir, fileBase);
16526
16675
  }
16527
16676
  const relativeDir = inputDir.startsWith(baseDir) ? inputDir.substring(baseDir.length + 1) : inputDir;
16528
- return join35(outDir, relativeDir, fileBase);
16677
+ return join36(outDir, relativeDir, fileBase);
16529
16678
  };
16530
16679
  const withCacheBuster = (specifier) => {
16531
16680
  if (!cacheBuster)
@@ -16573,10 +16722,10 @@ ${fields}
16573
16722
  return;
16574
16723
  visited.add(resolved);
16575
16724
  if (resolved.endsWith(".json") && existsSync26(resolved)) {
16576
- const inputDir2 = dirname19(resolved);
16725
+ const inputDir2 = dirname20(resolved);
16577
16726
  const relativeDir2 = inputDir2.startsWith(baseDir) ? inputDir2.substring(baseDir.length + 1) : inputDir2;
16578
- const targetDir2 = join35(outDir, relativeDir2);
16579
- const targetPath2 = join35(targetDir2, basename12(resolved));
16727
+ const targetDir2 = join36(outDir, relativeDir2);
16728
+ const targetPath2 = join36(targetDir2, basename12(resolved));
16580
16729
  await fs5.mkdir(targetDir2, { recursive: true });
16581
16730
  await fs5.copyFile(resolved, targetPath2);
16582
16731
  allOutputs.push(targetPath2);
@@ -16588,12 +16737,12 @@ ${fields}
16588
16737
  if (!existsSync26(actualPath))
16589
16738
  return;
16590
16739
  let sourceCode = await fs5.readFile(actualPath, "utf-8");
16591
- const inlined = await inlineResources(sourceCode, dirname19(actualPath), stylePreprocessors);
16592
- sourceCode = inlineTemplateAndLowerDeferSync(inlined.source, dirname19(actualPath)).source;
16593
- const inputDir = dirname19(actualPath);
16740
+ const inlined = await inlineResources(sourceCode, dirname20(actualPath), stylePreprocessors);
16741
+ sourceCode = inlineTemplateAndLowerDeferSync(inlined.source, dirname20(actualPath)).source;
16742
+ const inputDir = dirname20(actualPath);
16594
16743
  const fileBase = basename12(actualPath).replace(/\.[cm]?[tj]sx?$/, ".js");
16595
16744
  const targetPath = toOutputPath(actualPath);
16596
- const targetDir = dirname19(targetPath);
16745
+ const targetDir = dirname20(targetPath);
16597
16746
  const relativeDir = relative13(outDir, targetDir).replace(/\\/g, "/");
16598
16747
  const localImports = [];
16599
16748
  const importRewrites = new Map;
@@ -16655,7 +16804,7 @@ export const __ABSOLUTE_PAGE_USES_LEGACY_ANIMATIONS__ = true;
16655
16804
  return { clientPaths: [...emptyPaths], serverPaths: [...emptyPaths] };
16656
16805
  }
16657
16806
  const compiledRoot = compiledParent;
16658
- const indexesDir = join35(compiledParent, "indexes");
16807
+ const indexesDir = join36(compiledParent, "indexes");
16659
16808
  await traceAngularPhase("setup/create-indexes-dir", () => fs5.mkdir(indexesDir, { recursive: true }));
16660
16809
  const aotOutputs = hmr ? [] : await traceAngularPhase("aot/compile-files", () => compileAngularFiles(entryPoints.map((entry) => resolve27(entry)), compiledRoot, stylePreprocessors), { entries: entryPoints.length });
16661
16810
  if (!hmr) {
@@ -16669,10 +16818,10 @@ export const __ABSOLUTE_PAGE_USES_LEGACY_ANIMATIONS__ = true;
16669
16818
  absolute: false,
16670
16819
  cwd: angularSrcDir
16671
16820
  })) {
16672
- const sourcePath = join35(angularSrcDir, rel);
16821
+ const sourcePath = join36(angularSrcDir, rel);
16673
16822
  const cwdRel = relative13(cwd, sourcePath);
16674
- const targetPath = join35(compiledRoot, cwdRel);
16675
- await fs5.mkdir(dirname19(targetPath), { recursive: true });
16823
+ const targetPath = join36(compiledRoot, cwdRel);
16824
+ await fs5.mkdir(dirname20(targetPath), { recursive: true });
16676
16825
  await fs5.copyFile(sourcePath, targetPath);
16677
16826
  }
16678
16827
  });
@@ -16688,9 +16837,9 @@ export const __ABSOLUTE_PAGE_USES_LEGACY_ANIMATIONS__ = true;
16688
16837
  const fileBase = basename12(resolvedEntry).replace(/\.[tj]s$/, "");
16689
16838
  const jsName = `${fileBase}.js`;
16690
16839
  const compiledFallbackPaths = [
16691
- join35(compiledRoot, relativeEntry),
16692
- join35(compiledRoot, "pages", jsName),
16693
- join35(compiledRoot, jsName)
16840
+ join36(compiledRoot, relativeEntry),
16841
+ join36(compiledRoot, "pages", jsName),
16842
+ join36(compiledRoot, jsName)
16694
16843
  ].map((file4) => resolve27(file4));
16695
16844
  const resolveRawServerFile = (candidatePaths) => {
16696
16845
  const normalizedCandidates = [
@@ -16752,7 +16901,7 @@ export const __ABSOLUTE_PAGE_USES_LEGACY_ANIMATIONS__ = true;
16752
16901
  })() : "no-providers";
16753
16902
  const serverContentHash = `${Bun.hash(original).toString(BASE_36_RADIX)}.${Bun.hash(providersHashInput).toString(BASE_36_RADIX)}`;
16754
16903
  const cachedWrapper = wrapperOutputCache.get(resolvedEntry);
16755
- const clientFile = join35(indexesDir, jsName);
16904
+ const clientFile = join36(indexesDir, jsName);
16756
16905
  if (hmr && cachedWrapper && cachedWrapper.serverHash === serverContentHash && existsSync26(clientFile) && (usesLegacyAnimations || !original.includes("__ABSOLUTE_PAGE_USES_LEGACY_ANIMATIONS__")) && (!usesLegacyAnimations || original.includes("__ABSOLUTE_PAGE_USES_LEGACY_ANIMATIONS__"))) {
16757
16906
  return {
16758
16907
  clientPath: clientFile,
@@ -16787,10 +16936,10 @@ export const __ABSOLUTE_PAGE_USES_LEGACY_ANIMATIONS__ = true;
16787
16936
  const angularDirAbs = resolve27(outRoot);
16788
16937
  const appSourceAbs = resolve27(providersInjection.appProvidersSource);
16789
16938
  const rel = relative13(angularDirAbs, appSourceAbs).replace(/\\/g, "/");
16790
- return join35(compiledParent, rel).replace(/\.[cm]?[tj]sx?$/, ".js");
16939
+ return join36(compiledParent, rel).replace(/\.[cm]?[tj]sx?$/, ".js");
16791
16940
  })();
16792
16941
  const appProvidersSpec = (() => {
16793
- const rel = relative13(dirname19(rawServerFile), compiledAppProvidersPath).replace(/\\/g, "/");
16942
+ const rel = relative13(dirname20(rawServerFile), compiledAppProvidersPath).replace(/\\/g, "/");
16794
16943
  return rel.startsWith(".") ? rel : `./${rel}`;
16795
16944
  })();
16796
16945
  importLines.push(`import { appProviders as __abs_globalProviders } from "${appProvidersSpec}";`);
@@ -16838,6 +16987,7 @@ var requestContext = Object.prototype.hasOwnProperty.call(window, '__ABS_ANGULAR
16838
16987
  var pageHasIslands = Boolean(pageModule.__ABSOLUTE_PAGE_HAS_ISLANDS__) || Boolean(document.querySelector('[data-island="true"]'));
16839
16988
  var pageHasRawStreamingSlots = Boolean(document.querySelector('[data-absolute-raw-slot="true"]'));
16840
16989
  var pageHasStreamingSlots = Boolean(document.querySelector('[data-absolute-slot="true"]'));
16990
+ var isClientRender = window.__ABSOLUTE_PAGE_RENDER_MODE__ === 'client';
16841
16991
  var contextProviders = [{ provide: REQUEST_CONTEXT, useValue: requestContext }];
16842
16992
  // Page-level providers are injected directly into the page module's
16843
16993
  // server output by \`compileAngular\`'s providers-injection step
@@ -16888,13 +17038,14 @@ if (!document.querySelector(_sel)) {
16888
17038
  }
16889
17039
 
16890
17040
  var providers = [provideZonelessChangeDetection()];
16891
- if (!window.__HMR_SKIP_HYDRATION__ && !pageHasIslands) {
17041
+ if (!isClientRender && !window.__HMR_SKIP_HYDRATION__ && !pageHasIslands) {
16892
17042
  providers.push(provideClientHydration(withHttpTransferCacheOptions(absoluteHttpTransferCacheOptions)));
16893
17043
  }
16894
17044
  delete window.__HMR_SKIP_HYDRATION__;
16895
17045
  providers.push.apply(providers, pageProviders);
16896
17046
  providers.push.apply(providers, contextProviders);
16897
17047
  window.__ABS_SLOT_HYDRATION_PENDING__ = pageHasRawStreamingSlots;
17048
+ var absolutePageReady = Promise.resolve();
16898
17049
 
16899
17050
  if (pageHasRawStreamingSlots) {
16900
17051
  window.__ABS_SLOT_HYDRATION_PENDING__ = false;
@@ -16904,7 +17055,7 @@ if (pageHasRawStreamingSlots) {
16904
17055
  });
16905
17056
  }
16906
17057
  } else {
16907
- bootstrapApplication(${componentClassName}, {
17058
+ absolutePageReady = bootstrapApplication(${componentClassName}, {
16908
17059
  providers: providers
16909
17060
  }).then(function (appRef) {
16910
17061
  window.__ANGULAR_APP__ = appRef;
@@ -16914,8 +17065,17 @@ if (pageHasRawStreamingSlots) {
16914
17065
  window.__ABS_SLOT_FLUSH__();
16915
17066
  });
16916
17067
  }
17068
+ return appRef;
16917
17069
  });
16918
17070
  }
17071
+ window.__ABSOLUTE_PAGE_READY__ = absolutePageReady;
17072
+ window.__ABSOLUTE_PAGE_DISPOSE__ = async function() {
17073
+ await absolutePageReady;
17074
+ if (window.__ANGULAR_APP__) {
17075
+ window.__ANGULAR_APP__.destroy();
17076
+ window.__ANGULAR_APP__ = null;
17077
+ }
17078
+ };
16919
17079
  `.trim() : `
16920
17080
  import '@angular/compiler';
16921
17081
  import { bootstrapApplication } from '@angular/platform-browser';
@@ -16934,6 +17094,7 @@ var requestContext = Object.prototype.hasOwnProperty.call(window, '__ABS_ANGULAR
16934
17094
  var pageHasIslands = Boolean(pageModule.__ABSOLUTE_PAGE_HAS_ISLANDS__) || Boolean(document.querySelector('[data-island="true"]'));
16935
17095
  var pageHasRawStreamingSlots = Boolean(document.querySelector('[data-absolute-raw-slot="true"]'));
16936
17096
  var pageHasStreamingSlots = Boolean(document.querySelector('[data-absolute-slot="true"]'));
17097
+ var isClientRender = window.__ABSOLUTE_PAGE_RENDER_MODE__ === 'client';
16937
17098
  var contextProviders = [{ provide: REQUEST_CONTEXT, useValue: requestContext }];
16938
17099
  // Page-level providers are injected directly into the page module's
16939
17100
  // server output by \`compileAngular\`'s providers-injection step
@@ -16953,11 +17114,21 @@ var absoluteHttpTransferCacheOptions = {
16953
17114
 
16954
17115
  enableProdMode();
16955
17116
 
17117
+ // Production mobile/client-only activation starts from AbsoluteJS's empty
17118
+ // #root shell rather than server-rendered Angular markup. Create the page's
17119
+ // actual Angular host from its compiled selector so application authors do
17120
+ // not need framework-specific mobile configuration.
17121
+ var _sel = ${componentClassName}.\u0275cmp?.selectors?.[0]?.[0] || 'ng-app';
17122
+ if (!document.querySelector(_sel)) {
17123
+ (document.getElementById('root') || document.body).appendChild(document.createElement(_sel));
17124
+ }
17125
+
16956
17126
  var providers = [provideZonelessChangeDetection()].concat(pageProviders).concat(contextProviders);
16957
- if (!pageHasIslands) {
17127
+ if (!isClientRender && !pageHasIslands) {
16958
17128
  providers.unshift(provideClientHydration(withHttpTransferCacheOptions(absoluteHttpTransferCacheOptions)));
16959
17129
  }
16960
17130
  window.__ABS_SLOT_HYDRATION_PENDING__ = pageHasRawStreamingSlots;
17131
+ var absolutePageReady = Promise.resolve();
16961
17132
 
16962
17133
  if (pageHasRawStreamingSlots) {
16963
17134
  window.__ABS_SLOT_HYDRATION_PENDING__ = false;
@@ -16967,7 +17138,7 @@ if (pageHasRawStreamingSlots) {
16967
17138
  });
16968
17139
  }
16969
17140
  } else {
16970
- bootstrapApplication(${componentClassName}, {
17141
+ absolutePageReady = bootstrapApplication(${componentClassName}, {
16971
17142
  providers: providers
16972
17143
  }).then(function (appRef) {
16973
17144
  window.__ANGULAR_APP__ = appRef;
@@ -16977,8 +17148,17 @@ if (pageHasRawStreamingSlots) {
16977
17148
  window.__ABS_SLOT_FLUSH__();
16978
17149
  });
16979
17150
  }
17151
+ return appRef;
16980
17152
  });
16981
17153
  }
17154
+ window.__ABSOLUTE_PAGE_READY__ = absolutePageReady;
17155
+ window.__ABSOLUTE_PAGE_DISPOSE__ = async function() {
17156
+ await absolutePageReady;
17157
+ if (window.__ANGULAR_APP__) {
17158
+ window.__ANGULAR_APP__.destroy();
17159
+ window.__ANGULAR_APP__ = null;
17160
+ }
17161
+ };
16982
17162
  `.trim();
16983
17163
  const indexHash = Bun.hash(hydration).toString(BASE_36_RADIX);
16984
17164
  const indexUnchanged = cachedWrapper?.indexHash === indexHash;
@@ -17011,7 +17191,7 @@ var init_compileAngular = __esm(() => {
17011
17191
  init_stylePreprocessor();
17012
17192
  init_generatedDir();
17013
17193
  devClientDir4 = resolveDevClientDir4();
17014
- hmrClientPath5 = join35(devClientDir4, "hmrClient.ts").replace(/\\/g, "/");
17194
+ hmrClientPath5 = join36(devClientDir4, "hmrClient.ts").replace(/\\/g, "/");
17015
17195
  jitContentCache = new Map;
17016
17196
  wrapperOutputCache = new Map;
17017
17197
  PROVIDERS_INJECTION_BLOCK_RE = /\n\/\* __ABS_PROVIDERS_INJECTION_START \*\/[\s\S]*?\/\* __ABS_PROVIDERS_INJECTION_END \*\/\n?/;
@@ -17736,7 +17916,7 @@ __export(exports_fastHmrCompiler, {
17736
17916
  invalidateFingerprintCache: () => invalidateFingerprintCache
17737
17917
  });
17738
17918
  import { existsSync as existsSync27, readFileSync as readFileSync24, statSync as statSync2 } from "fs";
17739
- import { dirname as dirname20, extname as extname8, relative as relative14, resolve as resolve28 } from "path";
17919
+ import { dirname as dirname21, extname as extname8, relative as relative14, resolve as resolve28 } from "path";
17740
17920
  import ts17 from "typescript";
17741
17921
  var fail = (reason, detail, location) => ({
17742
17922
  detail,
@@ -17866,7 +18046,7 @@ var fail = (reason, detail, location) => ({
17866
18046
  continue;
17867
18047
  const decoratorMeta = readDecoratorMeta(args);
17868
18048
  const { inputs, outputs } = extractInputsAndOutputs(stmt, null);
17869
- const componentDir = dirname20(componentFilePath);
18049
+ const componentDir = dirname21(componentFilePath);
17870
18050
  const fingerprint = extractFingerprint(stmt, className, decoratorMeta, inputs, outputs, sourceFile, componentDir);
17871
18051
  fingerprintCache.set(id, fingerprint);
17872
18052
  } else {
@@ -18847,7 +19027,7 @@ var fail = (reason, detail, location) => ({
18847
19027
  });
18848
19028
  if (!names.includes(className))
18849
19029
  continue;
18850
- const nextDts = resolveDtsFromSpec(fromPath, dirname20(startDtsPath));
19030
+ const nextDts = resolveDtsFromSpec(fromPath, dirname21(startDtsPath));
18851
19031
  if (!nextDts)
18852
19032
  continue;
18853
19033
  const found = findDtsContainingClass(nextDts, className, visited);
@@ -18857,7 +19037,7 @@ var fail = (reason, detail, location) => ({
18857
19037
  const starReExportRe = /export\s*\*\s*from\s*["']([^"']+)["']/g;
18858
19038
  while ((item = starReExportRe.exec(content)) !== null) {
18859
19039
  const fromPath = item[1] || "";
18860
- const nextDts = resolveDtsFromSpec(fromPath, dirname20(startDtsPath));
19040
+ const nextDts = resolveDtsFromSpec(fromPath, dirname21(startDtsPath));
18861
19041
  if (!nextDts)
18862
19042
  continue;
18863
19043
  const found = findDtsContainingClass(nextDts, className, visited);
@@ -19458,7 +19638,7 @@ ${block}
19458
19638
  rebootstrapRequired: false
19459
19639
  };
19460
19640
  }
19461
- if (inheritsDecoratedClass(classNode, sourceFile, dirname20(componentFilePath), projectRoot)) {
19641
+ if (inheritsDecoratedClass(classNode, sourceFile, dirname21(componentFilePath), projectRoot)) {
19462
19642
  return fail("inherits-decorated-class");
19463
19643
  }
19464
19644
  const decorator = findComponentDecorator(classNode);
@@ -19470,7 +19650,7 @@ ${block}
19470
19650
  const projectDefaults = readProjectAngularCompilerOptions(projectRoot);
19471
19651
  const decoratorMeta = readDecoratorMeta(decoratorArgs, projectDefaults);
19472
19652
  const advancedMetadata = extractAdvancedMetadata(classNode, decoratorArgs, compiler);
19473
- const componentDir = dirname20(componentFilePath);
19653
+ const componentDir = dirname21(componentFilePath);
19474
19654
  let templateText;
19475
19655
  let templatePath;
19476
19656
  if (decoratorMeta.template !== null) {
@@ -20240,7 +20420,7 @@ __export(exports_compileEmber, {
20240
20420
  getEmberServerCompiledDir: () => getEmberServerCompiledDir,
20241
20421
  getEmberCompiledRoot: () => getEmberCompiledRoot,
20242
20422
  getEmberClientCompiledDir: () => getEmberClientCompiledDir,
20243
- dirname: () => dirname21,
20423
+ dirname: () => dirname22,
20244
20424
  compileEmberFileSource: () => compileEmberFileSource,
20245
20425
  compileEmberFile: () => compileEmberFile,
20246
20426
  compileEmber: () => compileEmber,
@@ -20248,8 +20428,8 @@ __export(exports_compileEmber, {
20248
20428
  basename: () => basename13
20249
20429
  });
20250
20430
  import { existsSync as existsSync28 } from "fs";
20251
- import { mkdir as mkdir10, rm as rm7 } from "fs/promises";
20252
- import { basename as basename13, dirname as dirname21, extname as extname9, join as join36, resolve as resolve29 } from "path";
20431
+ import { mkdir as mkdir11, rm as rm8 } from "fs/promises";
20432
+ import { basename as basename13, dirname as dirname22, extname as extname9, join as join37, resolve as resolve29 } from "path";
20253
20433
  var {build: bunBuild2, Transpiler: Transpiler4, write: write4, file: file4 } = globalThis.Bun;
20254
20434
  var cachedPreprocessor = null, getPreprocessor = async () => {
20255
20435
  if (cachedPreprocessor)
@@ -20345,7 +20525,7 @@ export const importSync = (specifier) => {
20345
20525
  const originalImporter = stagedSourceMap.get(args.importer);
20346
20526
  if (!originalImporter)
20347
20527
  return;
20348
- const candidateBase = resolve29(dirname21(originalImporter), args.path);
20528
+ const candidateBase = resolve29(dirname22(originalImporter), args.path);
20349
20529
  const extensionsToTry = ["", ".gts", ".gjs", ".ts", ".js"];
20350
20530
  for (const ext of extensionsToTry) {
20351
20531
  const candidate = candidateBase + ext;
@@ -20368,7 +20548,7 @@ export const importSync = (specifier) => {
20368
20548
  build2.onResolve({ filter: /^@(?:ember|glimmer|simple-dom)\// }, (args) => {
20369
20549
  if (standalonePackages.has(args.path))
20370
20550
  return;
20371
- const internal = join36(cwd, "node_modules/ember-source/dist/packages", args.path, "index.js");
20551
+ const internal = join37(cwd, "node_modules/ember-source/dist/packages", args.path, "index.js");
20372
20552
  if (existsSync28(internal))
20373
20553
  return { path: internal };
20374
20554
  return;
@@ -20416,16 +20596,16 @@ export default PageComponent;
20416
20596
  }
20417
20597
  const transpiled = transpiler5.transformSync(preprocessed);
20418
20598
  const baseName = basename13(resolvedEntry).replace(/\.(gjs|gts|ts|js)$/, "");
20419
- const tmpDir = join36(compiledRoot, "_tmp");
20420
- const serverDir = join36(compiledRoot, "server");
20421
- const clientDir = join36(compiledRoot, "client");
20599
+ const tmpDir = join37(compiledRoot, "_tmp");
20600
+ const serverDir = join37(compiledRoot, "server");
20601
+ const clientDir = join37(compiledRoot, "client");
20422
20602
  await Promise.all([
20423
- mkdir10(tmpDir, { recursive: true }),
20424
- mkdir10(serverDir, { recursive: true }),
20425
- mkdir10(clientDir, { recursive: true })
20603
+ mkdir11(tmpDir, { recursive: true }),
20604
+ mkdir11(serverDir, { recursive: true }),
20605
+ mkdir11(clientDir, { recursive: true })
20426
20606
  ]);
20427
- const tmpPagePath = resolve29(join36(tmpDir, `${baseName}.module.js`));
20428
- const tmpHarnessPath = resolve29(join36(tmpDir, `${baseName}.harness.js`));
20607
+ const tmpPagePath = resolve29(join37(tmpDir, `${baseName}.module.js`));
20608
+ const tmpHarnessPath = resolve29(join37(tmpDir, `${baseName}.harness.js`));
20429
20609
  await Promise.all([
20430
20610
  write4(tmpPagePath, transpiled),
20431
20611
  write4(tmpHarnessPath, generateServerHarness(tmpPagePath))
@@ -20433,7 +20613,7 @@ export default PageComponent;
20433
20613
  const stagedSourceMap = new Map([
20434
20614
  [tmpPagePath, resolvedEntry]
20435
20615
  ]);
20436
- const serverPath = join36(serverDir, `${baseName}.js`);
20616
+ const serverPath = join37(serverDir, `${baseName}.js`);
20437
20617
  const buildResult = await bunBuild2({
20438
20618
  entrypoints: [tmpHarnessPath],
20439
20619
  format: "esm",
@@ -20449,8 +20629,8 @@ export default PageComponent;
20449
20629
  if (!buildResult.success) {
20450
20630
  console.warn(`\u26A0\uFE0F Ember server build for ${baseName} had errors:`, buildResult.logs);
20451
20631
  }
20452
- await rm7(tmpDir, { force: true, recursive: true });
20453
- const clientPath = join36(clientDir, `${baseName}.js`);
20632
+ await rm8(tmpDir, { force: true, recursive: true });
20633
+ const clientPath = join37(clientDir, `${baseName}.js`);
20454
20634
  await write4(clientPath, transpiled);
20455
20635
  return { clientPath, serverPath };
20456
20636
  }, compileEmber = async (entries, emberDir, cwd = process.cwd(), _hmr = false) => {
@@ -20478,7 +20658,7 @@ export default PageComponent;
20478
20658
  preprocessed = rewriteTemplateEvalToScope(result.code);
20479
20659
  }
20480
20660
  return transpiler5.transformSync(preprocessed);
20481
- }, clearEmberCompilerCache = () => {}, getEmberCompiledRoot = (_emberDir) => getFrameworkGeneratedDir("ember"), getEmberServerCompiledDir = (emberDir) => join36(getEmberCompiledRoot(emberDir), "server"), getEmberClientCompiledDir = (emberDir) => join36(getEmberCompiledRoot(emberDir), "client");
20661
+ }, clearEmberCompilerCache = () => {}, getEmberCompiledRoot = (_emberDir) => getFrameworkGeneratedDir("ember"), getEmberServerCompiledDir = (emberDir) => join37(getEmberCompiledRoot(emberDir), "server"), getEmberClientCompiledDir = (emberDir) => join37(getEmberCompiledRoot(emberDir), "client");
20482
20662
  var init_compileEmber = __esm(() => {
20483
20663
  init_generatedDir();
20484
20664
  transpiler5 = new Transpiler4({
@@ -20500,8 +20680,8 @@ __export(exports_buildReactVendor, {
20500
20680
  buildReactVendor: () => buildReactVendor
20501
20681
  });
20502
20682
  import { existsSync as existsSync29, mkdirSync as mkdirSync8 } from "fs";
20503
- import { join as join37, resolve as resolve30 } from "path";
20504
- import { rm as rm8 } from "fs/promises";
20683
+ import { join as join38, resolve as resolve30 } from "path";
20684
+ import { rm as rm9 } from "fs/promises";
20505
20685
  var {build: bunBuild3 } = globalThis.Bun;
20506
20686
  var resolveJsxDevRuntimeCompatPath = () => {
20507
20687
  const candidates = [
@@ -20550,14 +20730,14 @@ var resolveJsxDevRuntimeCompatPath = () => {
20550
20730
  `)}
20551
20731
  `;
20552
20732
  }, buildReactVendor = async (buildDir) => {
20553
- const vendorDir = join37(buildDir, "react", "vendor");
20733
+ const vendorDir = join38(buildDir, "react", "vendor");
20554
20734
  mkdirSync8(vendorDir, { recursive: true });
20555
- const tmpDir = join37(buildDir, "_vendor_tmp");
20735
+ const tmpDir = join38(buildDir, "_vendor_tmp");
20556
20736
  mkdirSync8(tmpDir, { recursive: true });
20557
20737
  const specifiers = reactSpecifiers;
20558
20738
  const entrypoints = await Promise.all(specifiers.map(async (specifier) => {
20559
20739
  const safeName = toSafeFileName(specifier);
20560
- const entryPath = join37(tmpDir, `${safeName}.ts`);
20740
+ const entryPath = join38(tmpDir, `${safeName}.ts`);
20561
20741
  const source = await generateEntrySource(specifier);
20562
20742
  await Bun.write(entryPath, source);
20563
20743
  return entryPath;
@@ -20572,7 +20752,7 @@ var resolveJsxDevRuntimeCompatPath = () => {
20572
20752
  target: "browser",
20573
20753
  throw: false
20574
20754
  });
20575
- await rm8(tmpDir, { force: true, recursive: true });
20755
+ await rm9(tmpDir, { force: true, recursive: true });
20576
20756
  if (!result.success) {
20577
20757
  console.warn("\u26A0\uFE0F React vendor build had errors:", result.logs);
20578
20758
  }
@@ -20625,8 +20805,8 @@ __export(exports_buildAngularVendor, {
20625
20805
  buildAngularServerVendor: () => buildAngularServerVendor
20626
20806
  });
20627
20807
  import { mkdirSync as mkdirSync9 } from "fs";
20628
- import { join as join38 } from "path";
20629
- import { rm as rm9 } from "fs/promises";
20808
+ import { join as join39 } from "path";
20809
+ import { rm as rm10 } from "fs/promises";
20630
20810
  var {build: bunBuild4, Glob: Glob7 } = globalThis.Bun;
20631
20811
  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) => {
20632
20812
  try {
@@ -20722,14 +20902,14 @@ var REQUIRED_ANGULAR_SPECIFIERS_BASE, requiredAngularSpecifiers = (jitMode) => j
20722
20902
  await collectTransitiveAngularSpecs([...angular, ...transitiveRoots], angular);
20723
20903
  return Array.from(angular).filter(isResolvable);
20724
20904
  }, buildAngularVendor = async (buildDir, directories = [], linkerJitMode = false, depVendorSpecifiers = []) => {
20725
- const vendorDir = join38(buildDir, "angular", "vendor");
20905
+ const vendorDir = join39(buildDir, "angular", "vendor");
20726
20906
  mkdirSync9(vendorDir, { recursive: true });
20727
- const tmpDir = join38(buildDir, "_angular_vendor_tmp");
20907
+ const tmpDir = join39(buildDir, "_angular_vendor_tmp");
20728
20908
  mkdirSync9(tmpDir, { recursive: true });
20729
20909
  const specifiers = await resolveAngularSpecifiers(directories, linkerJitMode);
20730
20910
  const entrypoints = await Promise.all(specifiers.map(async (specifier) => {
20731
20911
  const safeName = toSafeFileName2(specifier);
20732
- const entryPath = join38(tmpDir, `${safeName}.ts`);
20912
+ const entryPath = join39(tmpDir, `${safeName}.ts`);
20733
20913
  await Bun.write(entryPath, await generateVendorEntrySource(specifier));
20734
20914
  return entryPath;
20735
20915
  }));
@@ -20745,7 +20925,7 @@ var REQUIRED_ANGULAR_SPECIFIERS_BASE, requiredAngularSpecifiers = (jitMode) => j
20745
20925
  target: "browser",
20746
20926
  throw: false
20747
20927
  });
20748
- await rm9(tmpDir, { force: true, recursive: true });
20928
+ await rm10(tmpDir, { force: true, recursive: true });
20749
20929
  if (!result.success) {
20750
20930
  console.warn("\u26A0\uFE0F Angular vendor build had errors:", result.logs);
20751
20931
  }
@@ -20760,9 +20940,9 @@ var REQUIRED_ANGULAR_SPECIFIERS_BASE, requiredAngularSpecifiers = (jitMode) => j
20760
20940
  const specifiers = await resolveAngularSpecifiers(directories, linkerJitMode);
20761
20941
  return computeAngularVendorPaths(specifiers);
20762
20942
  }, buildAngularServerVendor = async (buildDir, directories = [], linkerJitMode = false) => {
20763
- const vendorDir = join38(buildDir, "angular", "vendor", "server");
20943
+ const vendorDir = join39(buildDir, "angular", "vendor", "server");
20764
20944
  mkdirSync9(vendorDir, { recursive: true });
20765
- const tmpDir = join38(buildDir, "_angular_server_vendor_tmp");
20945
+ const tmpDir = join39(buildDir, "_angular_server_vendor_tmp");
20766
20946
  mkdirSync9(tmpDir, { recursive: true });
20767
20947
  const browserSpecs = await resolveAngularSpecifiers(directories, linkerJitMode);
20768
20948
  const allSpecs = new Set(browserSpecs);
@@ -20773,7 +20953,7 @@ var REQUIRED_ANGULAR_SPECIFIERS_BASE, requiredAngularSpecifiers = (jitMode) => j
20773
20953
  const specifiers = Array.from(allSpecs);
20774
20954
  const entrypoints = await Promise.all(specifiers.map(async (specifier) => {
20775
20955
  const safeName = toSafeFileName2(specifier);
20776
- const entryPath = join38(tmpDir, `${safeName}.ts`);
20956
+ const entryPath = join39(tmpDir, `${safeName}.ts`);
20777
20957
  await Bun.write(entryPath, await generateVendorEntrySource(specifier));
20778
20958
  return entryPath;
20779
20959
  }));
@@ -20788,16 +20968,16 @@ var REQUIRED_ANGULAR_SPECIFIERS_BASE, requiredAngularSpecifiers = (jitMode) => j
20788
20968
  target: "bun",
20789
20969
  throw: false
20790
20970
  });
20791
- await rm9(tmpDir, { force: true, recursive: true });
20971
+ await rm10(tmpDir, { force: true, recursive: true });
20792
20972
  if (!result.success) {
20793
20973
  console.warn("\u26A0\uFE0F Angular server vendor build had errors:", result.logs);
20794
20974
  }
20795
20975
  return specifiers;
20796
20976
  }, computeAngularServerVendorPaths = (buildDir, specifiers) => {
20797
20977
  const paths = {};
20798
- const vendorDir = join38(buildDir, "angular", "vendor", "server");
20978
+ const vendorDir = join39(buildDir, "angular", "vendor", "server");
20799
20979
  for (const specifier of specifiers) {
20800
- paths[specifier] = join38(vendorDir, `${toSafeFileName2(specifier)}.js`);
20980
+ paths[specifier] = join39(vendorDir, `${toSafeFileName2(specifier)}.js`);
20801
20981
  }
20802
20982
  return paths;
20803
20983
  }, computeAngularServerVendorPathsAsync = async (buildDir, directories = [], linkerJitMode = true) => {
@@ -20853,17 +21033,17 @@ __export(exports_buildVueVendor, {
20853
21033
  buildVueVendor: () => buildVueVendor
20854
21034
  });
20855
21035
  import { mkdirSync as mkdirSync10 } from "fs";
20856
- import { join as join39 } from "path";
20857
- import { rm as rm10 } from "fs/promises";
21036
+ import { join as join40 } from "path";
21037
+ import { rm as rm11 } from "fs/promises";
20858
21038
  var {build: bunBuild5 } = globalThis.Bun;
20859
21039
  var vueSpecifiers, toSafeFileName3 = (specifier) => specifier.replace(/\//g, "_"), buildVueVendor = async (buildDir) => {
20860
- const vendorDir = join39(buildDir, "vue", "vendor");
21040
+ const vendorDir = join40(buildDir, "vue", "vendor");
20861
21041
  mkdirSync10(vendorDir, { recursive: true });
20862
- const tmpDir = join39(buildDir, "_vue_vendor_tmp");
21042
+ const tmpDir = join40(buildDir, "_vue_vendor_tmp");
20863
21043
  mkdirSync10(tmpDir, { recursive: true });
20864
21044
  const entrypoints = await Promise.all(vueSpecifiers.map(async (specifier) => {
20865
21045
  const safeName = toSafeFileName3(specifier);
20866
- const entryPath = join39(tmpDir, `${safeName}.ts`);
21046
+ const entryPath = join40(tmpDir, `${safeName}.ts`);
20867
21047
  await Bun.write(entryPath, `export * from '${specifier}';
20868
21048
  `);
20869
21049
  return entryPath;
@@ -20883,7 +21063,7 @@ var vueSpecifiers, toSafeFileName3 = (specifier) => specifier.replace(/\//g, "_"
20883
21063
  target: "browser",
20884
21064
  throw: false
20885
21065
  });
20886
- await rm10(tmpDir, { force: true, recursive: true });
21066
+ await rm11(tmpDir, { force: true, recursive: true });
20887
21067
  if (!result.success) {
20888
21068
  console.warn("\u26A0\uFE0F Vue vendor build had errors:", result.logs);
20889
21069
  return;
@@ -20891,7 +21071,7 @@ var vueSpecifiers, toSafeFileName3 = (specifier) => specifier.replace(/\//g, "_"
20891
21071
  const { readFileSync: readFileSync25, writeFileSync: writeFileSync9, readdirSync: readdirSync5 } = await import("fs");
20892
21072
  const files = readdirSync5(vendorDir).filter((f2) => f2.endsWith(".js"));
20893
21073
  for (const file5 of files) {
20894
- const filePath = join39(vendorDir, file5);
21074
+ const filePath = join40(vendorDir, file5);
20895
21075
  const content = readFileSync25(filePath, "utf-8");
20896
21076
  if (!content.includes("__VUE_HMR_RUNTIME__"))
20897
21077
  continue;
@@ -20918,8 +21098,8 @@ __export(exports_buildSvelteVendor, {
20918
21098
  buildSvelteVendor: () => buildSvelteVendor
20919
21099
  });
20920
21100
  import { mkdirSync as mkdirSync11 } from "fs";
20921
- import { join as join40 } from "path";
20922
- import { rm as rm11 } from "fs/promises";
21101
+ import { join as join41 } from "path";
21102
+ import { rm as rm12 } from "fs/promises";
20923
21103
  var {build: bunBuild6 } = globalThis.Bun;
20924
21104
  var svelteSpecifiers, isResolvable2 = (specifier) => {
20925
21105
  try {
@@ -20932,13 +21112,13 @@ var svelteSpecifiers, isResolvable2 = (specifier) => {
20932
21112
  const specifiers = resolveVendorSpecifiers();
20933
21113
  if (specifiers.length === 0)
20934
21114
  return;
20935
- const vendorDir = join40(buildDir, "svelte", "vendor");
21115
+ const vendorDir = join41(buildDir, "svelte", "vendor");
20936
21116
  mkdirSync11(vendorDir, { recursive: true });
20937
- const tmpDir = join40(buildDir, "_svelte_vendor_tmp");
21117
+ const tmpDir = join41(buildDir, "_svelte_vendor_tmp");
20938
21118
  mkdirSync11(tmpDir, { recursive: true });
20939
21119
  const entrypoints = await Promise.all(specifiers.map(async (specifier) => {
20940
21120
  const safeName = toSafeFileName4(specifier);
20941
- const entryPath = join40(tmpDir, `${safeName}.ts`);
21121
+ const entryPath = join41(tmpDir, `${safeName}.ts`);
20942
21122
  await Bun.write(entryPath, `export * from '${specifier}';
20943
21123
  `);
20944
21124
  return entryPath;
@@ -20953,7 +21133,7 @@ var svelteSpecifiers, isResolvable2 = (specifier) => {
20953
21133
  target: "browser",
20954
21134
  throw: false
20955
21135
  });
20956
- await rm11(tmpDir, { force: true, recursive: true });
21136
+ await rm12(tmpDir, { force: true, recursive: true });
20957
21137
  if (!result.success) {
20958
21138
  console.warn("\u26A0\uFE0F Svelte vendor build had errors:", result.logs);
20959
21139
  }
@@ -20989,7 +21169,7 @@ import {
20989
21169
  statSync as statSync3,
20990
21170
  writeFileSync as writeFileSync9
20991
21171
  } from "fs";
20992
- import { basename as basename14, dirname as dirname22, extname as extname10, join as join41, relative as relative15, resolve as resolve31 } from "path";
21172
+ import { basename as basename14, dirname as dirname23, extname as extname10, join as join42, relative as relative15, resolve as resolve31 } from "path";
20993
21173
  import { cwd, env as env3, exit } from "process";
20994
21174
  var {build: bunBuild7, Glob: Glob8 } = globalThis.Bun;
20995
21175
  var isBuildTraceEnabled = () => {
@@ -21123,8 +21303,8 @@ ${offenders.map((o3) => ` \u2022 ${o3}`).join(`
21123
21303
  mkdirSync12(htmxDestDir, { recursive: true });
21124
21304
  const glob = new Glob8("htmx*.min.js");
21125
21305
  for (const relPath of glob.scanSync({ cwd: htmxDir })) {
21126
- const src = join41(htmxDir, relPath);
21127
- const dest = join41(htmxDestDir, "htmx.min.js");
21306
+ const src = join42(htmxDir, relPath);
21307
+ const dest = join42(htmxDestDir, "htmx.min.js");
21128
21308
  copyFileSync2(src, dest);
21129
21309
  return;
21130
21310
  }
@@ -21201,7 +21381,7 @@ ${offenders.map((o3) => ` \u2022 ${o3}`).join(`
21201
21381
  vuePagesPath
21202
21382
  }) => {
21203
21383
  const { readdirSync: readDir } = await import("fs");
21204
- const devIndexDir = join41(buildPath, "_src_indexes");
21384
+ const devIndexDir = join42(buildPath, "_src_indexes");
21205
21385
  mkdirSync12(devIndexDir, { recursive: true });
21206
21386
  if (reactIndexesPath && reactPagesPath) {
21207
21387
  copyReactDevIndexes(reactIndexesPath, reactPagesPath, devIndexDir, readDir);
@@ -21219,35 +21399,35 @@ ${offenders.map((o3) => ` \u2022 ${o3}`).join(`
21219
21399
  const indexFiles = readDir(reactIndexesPath).filter((file5) => file5.endsWith(".tsx"));
21220
21400
  const pagesRel = relative15(process.cwd(), resolve31(reactPagesPath)).replace(/\\/g, "/");
21221
21401
  for (const file5 of indexFiles) {
21222
- let content = readFileSync25(join41(reactIndexesPath, file5), "utf-8");
21402
+ let content = readFileSync25(join42(reactIndexesPath, file5), "utf-8");
21223
21403
  content = content.replace(/from\s*['"]([^'"]*\/pages\/([^'"]+))['"]/g, (_match, _fullPath, componentName) => `from '/@src/${pagesRel}/${componentName}'`);
21224
- writeFileSync9(join41(devIndexDir, file5), content);
21404
+ writeFileSync9(join42(devIndexDir, file5), content);
21225
21405
  }
21226
21406
  }, copySvelteDevIndexes = (svelteDir, sveltePagesPath, svelteEntries, devIndexDir) => {
21227
- const svelteIndexDir = join41(getFrameworkGeneratedDir("svelte"), "indexes");
21407
+ const svelteIndexDir = join42(getFrameworkGeneratedDir("svelte"), "indexes");
21228
21408
  const sveltePageEntries = svelteEntries.filter((file5) => resolve31(file5).startsWith(resolve31(sveltePagesPath)));
21229
21409
  for (const entry of sveltePageEntries) {
21230
21410
  const name = basename14(entry).replace(/\.svelte(\.(ts|js))?$/, "");
21231
- const indexFile = join41(svelteIndexDir, "pages", `${name}.js`);
21411
+ const indexFile = join42(svelteIndexDir, "pages", `${name}.js`);
21232
21412
  if (!existsSync30(indexFile))
21233
21413
  continue;
21234
21414
  let content = readFileSync25(indexFile, "utf-8");
21235
21415
  const srcRel = relative15(process.cwd(), resolve31(entry)).replace(/\\/g, "/");
21236
21416
  content = content.replace(/import\s+Component\s+from\s+['"]([^'"]+)['"]/, `import Component from "/@src/${srcRel}"`);
21237
- writeFileSync9(join41(devIndexDir, `${name}.svelte.js`), content);
21417
+ writeFileSync9(join42(devIndexDir, `${name}.svelte.js`), content);
21238
21418
  }
21239
21419
  }, copyVueDevIndexes = (vueDir, vuePagesPath, vueEntries, devIndexDir) => {
21240
- const vueIndexDir = join41(getFrameworkGeneratedDir("vue"), "indexes");
21420
+ const vueIndexDir = join42(getFrameworkGeneratedDir("vue"), "indexes");
21241
21421
  const vuePageEntries = vueEntries.filter((file5) => resolve31(file5).startsWith(resolve31(vuePagesPath)));
21242
21422
  for (const entry of vuePageEntries) {
21243
21423
  const name = basename14(entry, ".vue");
21244
- const indexFile = join41(vueIndexDir, `${name}.js`);
21424
+ const indexFile = join42(vueIndexDir, `${name}.js`);
21245
21425
  if (!existsSync30(indexFile))
21246
21426
  continue;
21247
21427
  let content = readFileSync25(indexFile, "utf-8");
21248
21428
  const srcRel = relative15(process.cwd(), resolve31(entry)).replace(/\\/g, "/");
21249
21429
  content = content.replace(/import\s+Comp(?:\s*,\s*\*\s+as\s+\w+)?\s+from\s+['"]([^'"]+)['"]/, (match) => match.replace(/from\s+['"][^'"]+['"]/, `from "/@src/${srcRel}"`));
21250
- writeFileSync9(join41(devIndexDir, `${name}.vue.js`), content);
21430
+ writeFileSync9(join42(devIndexDir, `${name}.vue.js`), content);
21251
21431
  }
21252
21432
  }, resolveVueRuntimeId = (content, firstUseName, outputPath, projectRoot) => {
21253
21433
  const varIdx = content.indexOf(`var ${firstUseName} =`);
@@ -21396,6 +21576,8 @@ ${content.slice(firstUseIdx)}`;
21396
21576
  };
21397
21577
  const result = {
21398
21578
  ...merged,
21579
+ banner: [base.banner, sanitized.banner].filter(Boolean).join(`
21580
+ `) || undefined,
21399
21581
  define: base.define || sanitized.define ? {
21400
21582
  ...sanitized.define ?? {},
21401
21583
  ...base.define ?? {}
@@ -21417,6 +21599,7 @@ ${content.slice(firstUseIdx)}`;
21417
21599
  htmxDirectory,
21418
21600
  angularDirectory,
21419
21601
  emberDirectory,
21602
+ pwa,
21420
21603
  svelteDirectory,
21421
21604
  vueDirectory,
21422
21605
  stylesConfig,
@@ -21482,10 +21665,10 @@ ${content.slice(firstUseIdx)}`;
21482
21665
  restoreTracePhase();
21483
21666
  return;
21484
21667
  }
21485
- const traceDir = join41(buildPath2, ".absolute-trace");
21668
+ const traceDir = join42(buildPath2, ".absolute-trace");
21486
21669
  const timestamp = new Date().toISOString().replace(/[:.]/g, "-");
21487
21670
  mkdirSync12(traceDir, { recursive: true });
21488
- writeFileSync9(join41(traceDir, `build-trace-${timestamp}.json`), JSON.stringify({
21671
+ writeFileSync9(join42(traceDir, `build-trace-${timestamp}.json`), JSON.stringify({
21489
21672
  events: traceEvents,
21490
21673
  frameworks: traceFrameworkNames,
21491
21674
  generatedAt: new Date().toISOString(),
@@ -21516,16 +21699,16 @@ ${content.slice(firstUseIdx)}`;
21516
21699
  const stylesPath = typeof stylesConfig === "string" ? stylesConfig : stylesConfig?.path;
21517
21700
  const stylesIgnore = typeof stylesConfig === "object" ? stylesConfig.ignore : undefined;
21518
21701
  const stylesDir = stylesPath && validateSafePath(stylesPath, projectRoot);
21519
- const reactIndexesPath = reactDir && join41(getFrameworkGeneratedDir("react"), "indexes");
21520
- const reactPagesPath = reactDir && join41(reactDir, "pages");
21521
- const htmlPagesPath = htmlDir && join41(htmlDir, "pages");
21522
- const htmlScriptsPath = htmlDir && join41(htmlDir, "scripts");
21523
- const sveltePagesPath = svelteDir && join41(svelteDir, "pages");
21524
- const vuePagesPath = vueDir && join41(vueDir, "pages");
21525
- const htmxPagesPath = htmxDir && join41(htmxDir, "pages");
21526
- const htmxScriptsPath = htmxDir && join41(htmxDir, "scripts");
21527
- const angularPagesPath = angularDir && join41(angularDir, "pages");
21528
- const emberPagesPath = emberDir && join41(emberDir, "pages");
21702
+ const reactIndexesPath = reactDir && join42(getFrameworkGeneratedDir("react"), "indexes");
21703
+ const reactPagesPath = reactDir && join42(reactDir, "pages");
21704
+ const htmlPagesPath = htmlDir && join42(htmlDir, "pages");
21705
+ const htmlScriptsPath = htmlDir && join42(htmlDir, "scripts");
21706
+ const sveltePagesPath = svelteDir && join42(svelteDir, "pages");
21707
+ const vuePagesPath = vueDir && join42(vueDir, "pages");
21708
+ const htmxPagesPath = htmxDir && join42(htmxDir, "pages");
21709
+ const htmxScriptsPath = htmxDir && join42(htmxDir, "scripts");
21710
+ const angularPagesPath = angularDir && join42(angularDir, "pages");
21711
+ const emberPagesPath = emberDir && join42(emberDir, "pages");
21529
21712
  const frontends = [
21530
21713
  reactDir,
21531
21714
  htmlDir,
@@ -21550,13 +21733,15 @@ ${content.slice(firstUseIdx)}`;
21550
21733
  framework: frameworkNames[0],
21551
21734
  frameworks: frameworkNames,
21552
21735
  mode: mode ?? (isDev2 ? "development" : "production"),
21736
+ pwa: Boolean(pwa),
21737
+ pwaSync: Boolean(pwa?.sync),
21553
21738
  tailwind: Boolean(tailwind)
21554
21739
  });
21555
21740
  const generatedRoot = getGeneratedRoot(projectRoot);
21556
21741
  const sourceClientRoots = [
21557
21742
  htmlDir,
21558
21743
  htmxDir,
21559
- islandBootstrapPath && dirname22(islandBootstrapPath)
21744
+ islandBootstrapPath && dirname23(islandBootstrapPath)
21560
21745
  ].filter((dir) => Boolean(dir));
21561
21746
  const usesGenerated = Boolean(reactDir) || Boolean(svelteDir) || Boolean(vueDir) || Boolean(angularDir);
21562
21747
  if (usesGenerated)
@@ -21584,8 +21769,8 @@ ${content.slice(firstUseIdx)}`;
21584
21769
  const [firstEntry] = serverDirMap;
21585
21770
  if (!firstEntry)
21586
21771
  throw new Error("Expected at least one server directory entry");
21587
- serverRoot = join41(firstEntry.dir, firstEntry.subdir);
21588
- serverOutDir = join41(buildPath, basename14(firstEntry.dir));
21772
+ serverRoot = join42(firstEntry.dir, firstEntry.subdir);
21773
+ serverOutDir = join42(buildPath, basename14(firstEntry.dir));
21589
21774
  } else if (serverDirMap.length > 1) {
21590
21775
  serverRoot = commonAncestor(serverDirMap.map((entry) => entry.dir), projectRoot);
21591
21776
  serverOutDir = buildPath;
@@ -21594,6 +21779,12 @@ ${content.slice(firstUseIdx)}`;
21594
21779
  await tracePhase("build-dir/create", () => mkdirSync12(buildPath, { recursive: true }));
21595
21780
  if (publicPath)
21596
21781
  await tracePhase("public/copy", () => cpSync(publicPath, buildPath, { force: true, recursive: true }));
21782
+ const pwaArtifacts = pwa ? await tracePhase("pwa/materialize", () => materializeAbsolutePwa({
21783
+ buildPath,
21784
+ config: pwa,
21785
+ generatedRoot,
21786
+ write: !isIncremental
21787
+ })) : undefined;
21597
21788
  const filterToIncrementalEntries = (entryPoints, mapToSource) => {
21598
21789
  if (!isIncremental || !incrementalFiles)
21599
21790
  return entryPoints;
@@ -21613,7 +21804,7 @@ ${content.slice(firstUseIdx)}`;
21613
21804
  await tracePhase("react/index-generation", () => generateReactIndexFiles(reactPagesPath, reactIndexesPath, hmr));
21614
21805
  }
21615
21806
  if (assetsPath && (!isIncremental || normalizedIncrementalFiles?.some((f2) => f2.includes("/assets/")))) {
21616
- await tracePhase("assets/copy", () => cpSync(assetsPath, join41(buildPath, "assets"), {
21807
+ await tracePhase("assets/copy", () => cpSync(assetsPath, join42(buildPath, "assets"), {
21617
21808
  force: true,
21618
21809
  recursive: true
21619
21810
  }));
@@ -21727,11 +21918,11 @@ ${content.slice(firstUseIdx)}`;
21727
21918
  }
21728
21919
  }
21729
21920
  if (htmlDefaults.error || htmlDefaults.notFound || htmlDefaults.loading || Object.keys(htmlPages).length > 0) {
21730
- const htmlConventionsOutDir = join41(buildPath, "conventions", "html");
21921
+ const htmlConventionsOutDir = join42(buildPath, "conventions", "html");
21731
21922
  mkdirSync12(htmlConventionsOutDir, { recursive: true });
21732
21923
  const htmlPathRemap = new Map;
21733
21924
  for (const sourcePath of htmlConventionSources) {
21734
- const dest = join41(htmlConventionsOutDir, basename14(sourcePath));
21925
+ const dest = join42(htmlConventionsOutDir, basename14(sourcePath));
21735
21926
  cpSync(sourcePath, dest, { force: true });
21736
21927
  htmlPathRemap.set(sourcePath, dest);
21737
21928
  }
@@ -21774,7 +21965,7 @@ ${content.slice(firstUseIdx)}`;
21774
21965
  const reactEntries = isIncremental && reactIndexesPath && reactPagesPath ? filterToIncrementalEntries(allReactEntries, (entry) => {
21775
21966
  if (entry.startsWith(resolve31(reactIndexesPath))) {
21776
21967
  const pageName = basename14(entry, ".tsx");
21777
- return join41(reactPagesPath, `${pageName}.tsx`);
21968
+ return join42(reactPagesPath, `${pageName}.tsx`);
21778
21969
  }
21779
21970
  return null;
21780
21971
  }) : allReactEntries;
@@ -21970,7 +22161,7 @@ ${content.slice(firstUseIdx)}`;
21970
22161
  const compileReactConventions = async () => {
21971
22162
  if (reactConventionSources.length === 0)
21972
22163
  return emptyStringArray;
21973
- const destDir = join41(buildPath, "conventions", "react");
22164
+ const destDir = join42(buildPath, "conventions", "react");
21974
22165
  rmSync2(destDir, { force: true, recursive: true });
21975
22166
  mkdirSync12(destDir, { recursive: true });
21976
22167
  const destPaths = await Promise.all(reactConventionSources.map(async (source, idx) => {
@@ -21985,7 +22176,7 @@ ${content.slice(firstUseIdx)}`;
21985
22176
  stylePreprocessorPlugin2,
21986
22177
  createBunStringRawUnicodePlugin()
21987
22178
  ],
21988
- root: dirname22(source),
22179
+ root: dirname23(source),
21989
22180
  target: "bun",
21990
22181
  throw: false,
21991
22182
  tsconfig: "./tsconfig.json"
@@ -22013,7 +22204,7 @@ ${content.slice(firstUseIdx)}`;
22013
22204
  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 }
22014
22205
  ]);
22015
22206
  const bundleConventionFiles = async (framework, compiledPaths) => {
22016
- const destDir = join41(buildPath, "conventions", framework);
22207
+ const destDir = join42(buildPath, "conventions", framework);
22017
22208
  rmSync2(destDir, { force: true, recursive: true });
22018
22209
  mkdirSync12(destDir, { recursive: true });
22019
22210
  const destPaths = await Promise.all(compiledPaths.map(async (compiledPath, idx) => {
@@ -22074,7 +22265,7 @@ ${content.slice(firstUseIdx)}`;
22074
22265
  ...islandBootstrapPath ? [islandBootstrapPath] : []
22075
22266
  ];
22076
22267
  const [onlyWorkerClientEntry] = urlReferencedFiles;
22077
- const workerClientRoot = urlReferencedFiles.length === 1 && onlyWorkerClientEntry ? dirname22(onlyWorkerClientEntry) : commonAncestor(urlReferencedFiles.map((file5) => dirname22(file5)), projectRoot);
22268
+ const workerClientRoot = urlReferencedFiles.length === 1 && onlyWorkerClientEntry ? dirname23(onlyWorkerClientEntry) : commonAncestor(urlReferencedFiles.map((file5) => dirname23(file5)), projectRoot);
22078
22269
  const islandEntryResult = islandBuildInfo ? await tracePhase("islands/client-entry-generation", () => generateIslandEntryPoints({
22079
22270
  buildInfo: islandBuildInfo,
22080
22271
  buildPath,
@@ -22085,7 +22276,7 @@ ${content.slice(firstUseIdx)}`;
22085
22276
  }
22086
22277
  })) : {
22087
22278
  entries: [],
22088
- generatedRoot: join41(buildPath, "_island_entries")
22279
+ generatedRoot: join42(buildPath, "_island_entries")
22089
22280
  };
22090
22281
  const islandClientEntryPoints = islandEntryResult.entries.map((entry) => entry.entryPath);
22091
22282
  if (serverEntryPoints.length === 0 && reactClientEntryPoints.length === 0 && nonReactClientEntryPoints.length === 0 && urlReferencedFiles.length === 0 && islandClientEntryPoints.length === 0 && htmxDir === undefined && htmlDir === undefined) {
@@ -22121,7 +22312,7 @@ ${content.slice(firstUseIdx)}`;
22121
22312
  return {};
22122
22313
  }
22123
22314
  if (hmr && reactIndexesPath && reactClientEntryPoints.length > 0) {
22124
- const refreshEntry = join41(reactIndexesPath, "_refresh.tsx");
22315
+ const refreshEntry = join42(reactIndexesPath, "_refresh.tsx");
22125
22316
  if (!reactClientEntryPoints.includes(refreshEntry))
22126
22317
  reactClientEntryPoints.push(refreshEntry);
22127
22318
  }
@@ -22210,6 +22401,7 @@ ${content.slice(firstUseIdx)}`;
22210
22401
  const svelteResolveConditions = svelteDir ? ["svelte", "main"] : undefined;
22211
22402
  const htmlScriptPlugin = hmr ? createHTMLScriptHMRPlugin(htmlDir, htmxDir) : undefined;
22212
22403
  const reactBuildConfig = reactClientEntryPoints.length > 0 ? mergeBunBuildConfig({
22404
+ banner: pwaArtifacts?.bootstrapBanner,
22213
22405
  entrypoints: reactClientEntryPoints,
22214
22406
  ...Object.keys(reactExternalPaths).length > 0 ? { external: Object.keys(reactExternalPaths) } : {},
22215
22407
  format: "esm",
@@ -22231,19 +22423,19 @@ ${content.slice(firstUseIdx)}`;
22231
22423
  throw: false
22232
22424
  }, resolveBunBuildOverride(bunBuildConfig, "reactClient")) : undefined;
22233
22425
  if (reactDir && reactClientEntryPoints.length > 0) {
22234
- rmSync2(join41(buildPath, "react", "generated", "indexes"), {
22426
+ rmSync2(join42(buildPath, "react", "generated", "indexes"), {
22235
22427
  force: true,
22236
22428
  recursive: true
22237
22429
  });
22238
22430
  }
22239
22431
  if (angularDir && angularClientPaths.length > 0) {
22240
- rmSync2(join41(buildPath, "angular", "indexes"), {
22432
+ rmSync2(join42(buildPath, "angular", "indexes"), {
22241
22433
  force: true,
22242
22434
  recursive: true
22243
22435
  });
22244
22436
  }
22245
22437
  if (islandClientEntryPoints.length > 0) {
22246
- rmSync2(join41(buildPath, "islands"), {
22438
+ rmSync2(join42(buildPath, "islands"), {
22247
22439
  force: true,
22248
22440
  recursive: true
22249
22441
  });
@@ -22280,6 +22472,7 @@ ${content.slice(firstUseIdx)}`;
22280
22472
  }, resolveBunBuildOverride(bunBuildConfig, "server")))) : undefined,
22281
22473
  reactBuildConfig ? tracePhase("bun/react-client", () => bunBuild7(reactBuildConfig)) : undefined,
22282
22474
  nonReactClientEntryPoints.length > 0 ? tracePhase("bun/non-react-client", () => bunBuild7(mergeBunBuildConfig({
22475
+ banner: pwaArtifacts?.bootstrapBanner,
22283
22476
  conditions: svelteResolveConditions,
22284
22477
  define: vueDirectory ? vueFeatureFlags : undefined,
22285
22478
  entrypoints: nonReactClientEntryPoints,
@@ -22325,6 +22518,7 @@ ${content.slice(firstUseIdx)}`;
22325
22518
  tsconfig: "./tsconfig.json"
22326
22519
  }, resolveBunBuildOverride(bunBuildConfig, "nonReactClient")))) : undefined,
22327
22520
  islandClientEntryPoints.length > 0 ? tracePhase("bun/island-client", () => bunBuild7(mergeBunBuildConfig({
22521
+ banner: pwaArtifacts?.bootstrapBanner,
22328
22522
  conditions: svelteResolveConditions,
22329
22523
  define: vueDirectory ? vueFeatureFlags : undefined,
22330
22524
  entrypoints: islandClientEntryPoints,
@@ -22355,7 +22549,7 @@ ${content.slice(firstUseIdx)}`;
22355
22549
  globalCssEntries.length > 0 ? tracePhase("bun/global-css", () => bunBuild7(mergeBunBuildConfig({
22356
22550
  entrypoints: globalCssEntries,
22357
22551
  naming: `[dir]/[name].[hash].[ext]`,
22358
- outdir: stylesDir ? join41(buildPath, basename14(stylesDir)) : buildPath,
22552
+ outdir: stylesDir ? join42(buildPath, basename14(stylesDir)) : buildPath,
22359
22553
  plugins: [stylePreprocessorPlugin2],
22360
22554
  root: stylesDir || clientRoot,
22361
22555
  target: "browser",
@@ -22364,7 +22558,7 @@ ${content.slice(firstUseIdx)}`;
22364
22558
  vueCssPaths.length > 0 ? tracePhase("bun/vue-css", () => bunBuild7(mergeBunBuildConfig({
22365
22559
  entrypoints: vueCssPaths,
22366
22560
  naming: `[name].[hash].[ext]`,
22367
- outdir: join41(buildPath, assetsPath ? basename14(assetsPath) : "assets", "css"),
22561
+ outdir: join42(buildPath, assetsPath ? basename14(assetsPath) : "assets", "css"),
22368
22562
  target: "browser",
22369
22563
  throw: false
22370
22564
  }, resolveBunBuildOverride(bunBuildConfig, "vueCss")))) : undefined
@@ -22388,15 +22582,15 @@ ${content.slice(firstUseIdx)}`;
22388
22582
  }
22389
22583
  if (!isDev2 && resolveClientSourcemap(sourcemaps, isDev2) === "external") {
22390
22584
  const { chainExternalSourcemap: chainExternalSourcemap2 } = await Promise.resolve().then(() => (init_chainInlineSourcemaps(), exports_chainInlineSourcemaps));
22391
- const sourcemapDir = join41(projectRoot, "sourcemaps");
22585
+ const sourcemapDir = join42(projectRoot, "sourcemaps");
22392
22586
  mkdirSync12(sourcemapDir, { recursive: true });
22393
22587
  const mapFiles = readdirSync5(buildPath, {
22394
22588
  encoding: "utf8",
22395
22589
  recursive: true
22396
- }).filter((entry) => entry.endsWith(".js.map") && !entry.includes("node_modules")).map((entry) => join41(buildPath, entry));
22590
+ }).filter((entry) => entry.endsWith(".js.map") && !entry.includes("node_modules")).map((entry) => join42(buildPath, entry));
22397
22591
  for (const mapPath of mapFiles) {
22398
22592
  chainExternalSourcemap2(mapPath);
22399
- renameSync(mapPath, join41(sourcemapDir, basename14(mapPath)));
22593
+ renameSync(mapPath, join42(sourcemapDir, basename14(mapPath)));
22400
22594
  const jsPath = mapPath.slice(0, -4);
22401
22595
  try {
22402
22596
  const javascript = readFileSync25(jsPath, "utf-8").replace(/\n?\/\/# sourceMappingURL=[^\n]*\s*$/, `
@@ -22470,7 +22664,7 @@ ${content.slice(firstUseIdx)}`;
22470
22664
  await tracePhase("postprocess/island-vendor-imports", () => rewriteBuildOutputs2(islandClientOutputs, allIslandVendorPaths));
22471
22665
  }
22472
22666
  if (!hmr) {
22473
- const reactVendorDir = join41(buildPath, "react", "vendor");
22667
+ const reactVendorDir = join42(buildPath, "react", "vendor");
22474
22668
  const vendorChunkPaths = existsSync30(reactVendorDir) ? [
22475
22669
  ...new Glob8("**/*.js").scanSync({
22476
22670
  absolute: true,
@@ -22487,7 +22681,7 @@ ${content.slice(firstUseIdx)}`;
22487
22681
  if (serverOutputs.length > 0 && angularServerVendorPaths2 && Object.keys(angularServerVendorPaths2).length > 0) {
22488
22682
  const { rewriteBuildOutputsWith: rewriteBuildOutputsWith2 } = await Promise.resolve().then(() => (init_rewriteImportsPlugin(), exports_rewriteImportsPlugin));
22489
22683
  await tracePhase("postprocess/server-angular-vendor-imports", () => rewriteBuildOutputsWith2(serverOutputs, (artifact) => {
22490
- const fileDir = dirname22(artifact.path);
22684
+ const fileDir = dirname23(artifact.path);
22491
22685
  const relativePaths = {};
22492
22686
  for (const [specifier, absolute] of Object.entries(angularServerVendorPaths2)) {
22493
22687
  const rel = relative15(fileDir, absolute);
@@ -22626,7 +22820,7 @@ ${content.slice(firstUseIdx)}`;
22626
22820
  const processHtmlPages = async () => {
22627
22821
  if (!(htmlDir && htmlPagesPath))
22628
22822
  return;
22629
- const outputHtmlPages = isSingle ? join41(buildPath, "pages") : join41(buildPath, basename14(htmlDir), "pages");
22823
+ const outputHtmlPages = isSingle ? join42(buildPath, "pages") : join42(buildPath, basename14(htmlDir), "pages");
22630
22824
  mkdirSync12(outputHtmlPages, { recursive: true });
22631
22825
  cpSync(htmlPagesPath, outputHtmlPages, {
22632
22826
  force: true,
@@ -22641,6 +22835,10 @@ ${content.slice(firstUseIdx)}`;
22641
22835
  for (const htmlFile of htmlPageFiles) {
22642
22836
  if (hmr)
22643
22837
  injectHMRIntoHTMLFile(htmlFile, "html");
22838
+ if (pwaArtifacts) {
22839
+ const source = readFileSync25(htmlFile, "utf8");
22840
+ writeFileSync9(htmlFile, injectPwaBootstrapHtml(source));
22841
+ }
22644
22842
  const fileName = basename14(htmlFile, ".html");
22645
22843
  if (manifest[fileName] && manifest[fileName] !== htmlFile) {
22646
22844
  warnManifestKeyCollision(fileName, manifest[fileName], htmlFile);
@@ -22651,14 +22849,14 @@ ${content.slice(firstUseIdx)}`;
22651
22849
  const processHtmxPages = async () => {
22652
22850
  if (!(htmxDir && htmxPagesPath))
22653
22851
  return;
22654
- const outputHtmxPages = isSingle ? join41(buildPath, "pages") : join41(buildPath, basename14(htmxDir), "pages");
22852
+ const outputHtmxPages = isSingle ? join42(buildPath, "pages") : join42(buildPath, basename14(htmxDir), "pages");
22655
22853
  mkdirSync12(outputHtmxPages, { recursive: true });
22656
22854
  cpSync(htmxPagesPath, outputHtmxPages, {
22657
22855
  force: true,
22658
22856
  recursive: true
22659
22857
  });
22660
22858
  if (shouldCopyHtmx) {
22661
- const htmxDestDir = isSingle ? buildPath : join41(buildPath, basename14(htmxDir));
22859
+ const htmxDestDir = isSingle ? buildPath : join42(buildPath, basename14(htmxDir));
22662
22860
  copyHtmxVendor(htmxDir, htmxDestDir);
22663
22861
  }
22664
22862
  if (shouldUpdateHtmxAssetPaths) {
@@ -22670,6 +22868,10 @@ ${content.slice(firstUseIdx)}`;
22670
22868
  for (const htmxFile of htmxPageFiles) {
22671
22869
  if (hmr)
22672
22870
  injectHMRIntoHTMLFile(htmxFile, "htmx");
22871
+ if (pwaArtifacts) {
22872
+ const source = readFileSync25(htmxFile, "utf8");
22873
+ writeFileSync9(htmxFile, injectPwaBootstrapHtml(source));
22874
+ }
22673
22875
  const fileName = basename14(htmxFile, ".html");
22674
22876
  if (manifest[fileName] && manifest[fileName] !== htmxFile) {
22675
22877
  warnManifestKeyCollision(fileName, manifest[fileName], htmxFile);
@@ -22719,7 +22921,9 @@ ${content.slice(firstUseIdx)}`;
22719
22921
  sendTelemetryEvent("build:complete", {
22720
22922
  durationMs: Math.round(performance.now() - buildStart),
22721
22923
  frameworks: frameworkNames,
22722
- mode: mode ?? (isDev2 ? "development" : "production")
22924
+ mode: mode ?? (isDev2 ? "development" : "production"),
22925
+ pwa: Boolean(pwa),
22926
+ pwaSync: Boolean(pwa?.sync)
22723
22927
  });
22724
22928
  const [reactSpaHosts, svelteSpaHosts, vueSpaHosts, angularSpaHosts] = await Promise.all([
22725
22929
  reactDir ? Promise.resolve().then(() => (init_staticAnalyzeSpaRoutes2(), exports_staticAnalyzeSpaRoutes2)).then((module) => module.analyzeReactSpaRoutes(reactDir)) : [],
@@ -22743,7 +22947,7 @@ ${content.slice(firstUseIdx)}`;
22743
22947
  }))
22744
22948
  ];
22745
22949
  setSpaRouteManifest(spaRouteHosts);
22746
- writeFileSync9(join41(buildPath, "spa-routes.json"), JSON.stringify(spaRouteHosts, null, "\t"));
22950
+ writeFileSync9(join42(buildPath, "spa-routes.json"), JSON.stringify(spaRouteHosts, null, "\t"));
22747
22951
  if (isIncremental) {
22748
22952
  writeBuildTrace(buildPath);
22749
22953
  return {
@@ -22752,9 +22956,9 @@ ${content.slice(firstUseIdx)}`;
22752
22956
  manifest
22753
22957
  };
22754
22958
  }
22755
- writeFileSync9(join41(buildPath, "manifest.json"), JSON.stringify(manifest, null, "\t"));
22959
+ writeFileSync9(join42(buildPath, "manifest.json"), JSON.stringify(manifest, null, "\t"));
22756
22960
  if (Object.keys(conventionsMap).length > 0) {
22757
- writeFileSync9(join41(buildPath, "conventions.json"), JSON.stringify(conventionsMap, null, "\t"));
22961
+ writeFileSync9(join42(buildPath, "conventions.json"), JSON.stringify(conventionsMap, null, "\t"));
22758
22962
  }
22759
22963
  writeBuildTrace(buildPath);
22760
22964
  if (mode === "production") {
@@ -22825,6 +23029,7 @@ var init_build = __esm(() => {
22825
23029
  init_logger();
22826
23030
  init_validateSafePath();
22827
23031
  init_spaRouteManifest();
23032
+ init_pwa();
22828
23033
  REACT_VENDOR_SPECIFIERS = [
22829
23034
  "react-dom/client",
22830
23035
  "react-refresh/runtime",
@@ -22887,8 +23092,8 @@ var init_build = __esm(() => {
22887
23092
 
22888
23093
  // src/build/buildEmberVendor.ts
22889
23094
  import { mkdirSync as mkdirSync13, existsSync as existsSync31 } from "fs";
22890
- import { join as join42 } from "path";
22891
- import { rm as rm12 } from "fs/promises";
23095
+ import { join as join43 } from "path";
23096
+ import { rm as rm13 } from "fs/promises";
22892
23097
  var {build: bunBuild8 } = globalThis.Bun;
22893
23098
  var toSafeFileName5 = (specifier) => specifier.replace(/^@/, "").replace(/\//g, "_"), generateMacrosShim = () => `// Generated shim for @embroider/macros \u2014 provides minimal runtime
22894
23099
  // implementations for macros that would normally be replaced at
@@ -22939,7 +23144,7 @@ export const importSync = (specifier) => {
22939
23144
  if (standaloneSpecifiers.has(specifier)) {
22940
23145
  return { resolveTo: specifier, specifier };
22941
23146
  }
22942
- const emberInternalPath = join42(cwd2, "node_modules/ember-source/dist/packages", specifier, "index.js");
23147
+ const emberInternalPath = join43(cwd2, "node_modules/ember-source/dist/packages", specifier, "index.js");
22943
23148
  if (!existsSync31(emberInternalPath)) {
22944
23149
  throw new Error(`Ember vendor build: cannot find ${specifier} at ${emberInternalPath}. ` + `Is ember-source installed and at least 6.12?`);
22945
23150
  }
@@ -22971,7 +23176,7 @@ export const importSync = (specifier) => {
22971
23176
  if (standalonePackages.has(args.path)) {
22972
23177
  return;
22973
23178
  }
22974
- const internal = join42(cwd2, "node_modules/ember-source/dist/packages", args.path, "index.js");
23179
+ const internal = join43(cwd2, "node_modules/ember-source/dist/packages", args.path, "index.js");
22975
23180
  if (existsSync31(internal)) {
22976
23181
  return { path: internal };
22977
23182
  }
@@ -22979,16 +23184,16 @@ export const importSync = (specifier) => {
22979
23184
  });
22980
23185
  }
22981
23186
  }), buildEmberVendor = async (buildDir, cwd2 = process.cwd()) => {
22982
- const vendorDir = join42(buildDir, "ember", "vendor");
23187
+ const vendorDir = join43(buildDir, "ember", "vendor");
22983
23188
  mkdirSync13(vendorDir, { recursive: true });
22984
- const tmpDir = join42(buildDir, "_ember_vendor_tmp");
23189
+ const tmpDir = join43(buildDir, "_ember_vendor_tmp");
22985
23190
  mkdirSync13(tmpDir, { recursive: true });
22986
- const macrosShimPath = join42(tmpDir, "embroider_macros_shim.js");
23191
+ const macrosShimPath = join43(tmpDir, "embroider_macros_shim.js");
22987
23192
  await Bun.write(macrosShimPath, generateMacrosShim());
22988
23193
  const resolutions = REQUIRED_EMBER_SPECIFIERS.map((specifier) => resolveEmberSpecifier(specifier, cwd2));
22989
23194
  const entrypoints = await Promise.all(resolutions.map(async (resolution) => {
22990
23195
  const safeName = toSafeFileName5(resolution.specifier);
22991
- const entryPath = join42(tmpDir, `${safeName}.js`);
23196
+ const entryPath = join43(tmpDir, `${safeName}.js`);
22992
23197
  const source = resolution.specifier === "@embroider/macros" ? `export * from ${JSON.stringify(macrosShimPath)};
22993
23198
  ` : generateVendorEntrySource2(resolution);
22994
23199
  await Bun.write(entryPath, source);
@@ -23005,7 +23210,7 @@ export const importSync = (specifier) => {
23005
23210
  target: "browser",
23006
23211
  throw: false
23007
23212
  });
23008
- await rm12(tmpDir, { force: true, recursive: true });
23213
+ await rm13(tmpDir, { force: true, recursive: true });
23009
23214
  if (!result.success) {
23010
23215
  console.warn("\u26A0\uFE0F Ember vendor build had errors:", result.logs);
23011
23216
  }
@@ -23436,6 +23641,7 @@ var init_configResolver = () => {};
23436
23641
  var createHMRState = (config) => ({
23437
23642
  activeFrameworks: new Set,
23438
23643
  assetStore: new Map,
23644
+ clientTargets: new Map,
23439
23645
  config,
23440
23646
  connectedClients: new Set,
23441
23647
  debounceTimeout: null,
@@ -23471,7 +23677,7 @@ var init_clientManager = __esm(() => {
23471
23677
 
23472
23678
  // src/dev/pathUtils.ts
23473
23679
  import { existsSync as existsSync33, readdirSync as readdirSync6, readFileSync as readFileSync27 } from "fs";
23474
- import { dirname as dirname23, resolve as resolve34 } from "path";
23680
+ import { dirname as dirname24, resolve as resolve34 } from "path";
23475
23681
  var STYLE_EXTENSION_PATTERN2, detectFramework = (filePath, resolved) => {
23476
23682
  if (shouldIgnorePath(filePath, resolved)) {
23477
23683
  return "ignored";
@@ -23599,10 +23805,10 @@ var STYLE_EXTENSION_PATTERN2, detectFramework = (filePath, resolved) => {
23599
23805
  refs.push(strMatch[1]);
23600
23806
  }
23601
23807
  }
23602
- const componentDir = dirname23(full);
23808
+ const componentDir = dirname24(full);
23603
23809
  for (const ref of refs) {
23604
23810
  const refAbs = normalizePath2(resolve34(componentDir, ref));
23605
- const refDir = normalizePath2(dirname23(refAbs));
23811
+ const refDir = normalizePath2(dirname24(refAbs));
23606
23812
  if (refDir === angularRootNormalized || refDir.startsWith(`${angularRootNormalized}/`)) {
23607
23813
  continue;
23608
23814
  }
@@ -23738,7 +23944,7 @@ var init_pathUtils = __esm(() => {
23738
23944
  // src/dev/fileWatcher.ts
23739
23945
  import { watch } from "fs";
23740
23946
  import { existsSync as existsSync34, readdirSync as readdirSync7, statSync as statSync4 } from "fs";
23741
- import { dirname as dirname24, join as join43, resolve as resolve35 } from "path";
23947
+ import { dirname as dirname25, join as join44, resolve as resolve35 } from "path";
23742
23948
  var safeRemoveFromGraph = (graph, fullPath) => {
23743
23949
  try {
23744
23950
  removeFileFromGraph(graph, fullPath);
@@ -23770,7 +23976,7 @@ var safeRemoveFromGraph = (graph, fullPath) => {
23770
23976
  for (const name of entries) {
23771
23977
  if (shouldSkipFilename(name, isStylesDir))
23772
23978
  continue;
23773
- const child = join43(eventDir, name).replace(/\\/g, "/");
23979
+ const child = join44(eventDir, name).replace(/\\/g, "/");
23774
23980
  let st2;
23775
23981
  try {
23776
23982
  st2 = statSync4(child);
@@ -23791,7 +23997,7 @@ var safeRemoveFromGraph = (graph, fullPath) => {
23791
23997
  return;
23792
23998
  if (shouldSkipFilename(filename, isStylesDir)) {
23793
23999
  if (event === "rename") {
23794
- const eventDir = dirname24(join43(absolutePath, filename)).replace(/\\/g, "/");
24000
+ const eventDir = dirname25(join44(absolutePath, filename)).replace(/\\/g, "/");
23795
24001
  atomicRecoveryScan(eventDir);
23796
24002
  for (const delay of [25, 100]) {
23797
24003
  const timer = setTimeout(() => atomicRecoveryScan(eventDir), delay);
@@ -23800,7 +24006,7 @@ var safeRemoveFromGraph = (graph, fullPath) => {
23800
24006
  }
23801
24007
  return;
23802
24008
  }
23803
- const fullPath = join43(absolutePath, filename).replace(/\\/g, "/");
24009
+ const fullPath = join44(absolutePath, filename).replace(/\\/g, "/");
23804
24010
  if (shouldIgnorePath(fullPath, state.resolvedPaths)) {
23805
24011
  return;
23806
24012
  }
@@ -24179,7 +24385,7 @@ var init_moduleMapper = __esm(() => {
24179
24385
 
24180
24386
  // src/utils/spaRouteCss.ts
24181
24387
  import { readFile as readFile9 } from "fs/promises";
24182
- import { dirname as dirname25, isAbsolute as isAbsolute5, resolve as resolve39 } from "path";
24388
+ import { dirname as dirname26, isAbsolute as isAbsolute5, resolve as resolve39 } from "path";
24183
24389
  var sideManifestCache, readSideManifest = async (sideManifestPath) => {
24184
24390
  const cached = sideManifestCache.get(sideManifestPath);
24185
24391
  if (cached !== undefined)
@@ -24217,7 +24423,7 @@ var sideManifestCache, readSideManifest = async (sideManifestPath) => {
24217
24423
  }, readChildCss = async (cssPath, sideManifestPath) => {
24218
24424
  if (!cssPath)
24219
24425
  return "";
24220
- const resolvedCssPath = isAbsolute5(cssPath) ? cssPath : resolve39(dirname25(sideManifestPath), cssPath);
24426
+ const resolvedCssPath = isAbsolute5(cssPath) ? cssPath : resolve39(dirname26(sideManifestPath), cssPath);
24221
24427
  const cached = childCssCache.get(resolvedCssPath);
24222
24428
  if (cached !== undefined)
24223
24429
  return cached;
@@ -24301,7 +24507,7 @@ __export(exports_resolveOwningComponents, {
24301
24507
  invalidateResourceIndex: () => invalidateResourceIndex
24302
24508
  });
24303
24509
  import { readdirSync as readdirSync8, readFileSync as readFileSync29, statSync as statSync5 } from "fs";
24304
- import { dirname as dirname26, extname as extname11, join as join44, resolve as resolve40 } from "path";
24510
+ import { dirname as dirname27, extname as extname11, join as join45, resolve as resolve40 } from "path";
24305
24511
  import ts18 from "typescript";
24306
24512
  var ENTITY_DECORATORS, isAngularSourceFile = (file5) => file5.endsWith(".ts") || file5.endsWith(".tsx"), walkAngularSourceFiles = (root) => {
24307
24513
  const out = [];
@@ -24316,7 +24522,7 @@ var ENTITY_DECORATORS, isAngularSourceFile = (file5) => file5.endsWith(".ts") ||
24316
24522
  if (entry.name.startsWith(".") || entry.name === "node_modules") {
24317
24523
  continue;
24318
24524
  }
24319
- const full = join44(dir, entry.name);
24525
+ const full = join45(dir, entry.name);
24320
24526
  if (entry.isDirectory()) {
24321
24527
  visit(full);
24322
24528
  } else if (entry.isFile() && isAngularSourceFile(entry.name)) {
@@ -24455,7 +24661,7 @@ var ENTITY_DECORATORS, isAngularSourceFile = (file5) => file5.endsWith(".ts") ||
24455
24661
  return null;
24456
24662
  }
24457
24663
  const sourceFile = ts18.createSourceFile(childFilePath, source, ts18.ScriptTarget.ES2022, true, ts18.ScriptKind.TS);
24458
- const childDir = dirname26(childFilePath);
24664
+ const childDir = dirname27(childFilePath);
24459
24665
  for (const stmt of sourceFile.statements) {
24460
24666
  if (!ts18.isImportDeclaration(stmt))
24461
24667
  continue;
@@ -24512,7 +24718,7 @@ var ENTITY_DECORATORS, isAngularSourceFile = (file5) => file5.endsWith(".ts") ||
24512
24718
  const parentFile = new Map;
24513
24719
  for (const tsPath of walkAngularSourceFiles(userAngularRoot)) {
24514
24720
  const classes = parseDecoratedClasses(tsPath);
24515
- const componentDir = dirname26(tsPath);
24721
+ const componentDir = dirname27(tsPath);
24516
24722
  for (const cls of classes) {
24517
24723
  const entity = {
24518
24724
  className: cls.className,
@@ -24626,6 +24832,7 @@ var MAX_RETAINED_HMR_UPDATES = 100, normalizedHmrTarget = (value) => {
24626
24832
  });
24627
24833
  clientsToRemove.forEach((client2) => {
24628
24834
  state.connectedClients.delete(client2);
24835
+ state.clientTargets.delete(client2);
24629
24836
  });
24630
24837
  }, handleClientConnect = (state, client2, manifest) => {
24631
24838
  state.connectedClients.add(client2);
@@ -24666,6 +24873,7 @@ var MAX_RETAINED_HMR_UPDATES = 100, normalizedHmrTarget = (value) => {
24666
24873
  }
24667
24874
  }, handleClientDisconnect = (state, client2) => {
24668
24875
  state.connectedClients.delete(client2);
24876
+ state.clientTargets.delete(client2);
24669
24877
  }, parseJsonSafe = (raw) => JSON.parse(raw), parseMessage = (message) => {
24670
24878
  if (typeof message === "string") {
24671
24879
  return parseJsonSafe(message);
@@ -24695,11 +24903,13 @@ var MAX_RETAINED_HMR_UPDATES = 100, normalizedHmrTarget = (value) => {
24695
24903
  case "request-rebuild":
24696
24904
  break;
24697
24905
  case "ready":
24906
+ state.clientTargets.set(client2, normalizedHmrTarget(data.target));
24698
24907
  if (data.framework) {
24699
24908
  state.activeFrameworks.add(data.framework);
24700
24909
  }
24701
24910
  break;
24702
24911
  case "hmr-timing": {
24912
+ state.clientTargets.set(client2, normalizedHmrTarget(data.target));
24703
24913
  const update = typeof data.updateId === "number" ? state.hmrUpdates.get(data.updateId) : undefined;
24704
24914
  logHmrClientUpdate(update?.path ?? state.lastHmrPath ?? "", update?.framework ?? state.lastHmrFramework, data.duration, normalizedHmrTarget(data.target), data.serverMs, data.clientMs, data.outcome, data.kind);
24705
24915
  sendTelemetryEvent("hmr:client-applied", {
@@ -24760,7 +24970,7 @@ __export(exports_moduleServer, {
24760
24970
  SRC_URL_PREFIX: () => SRC_URL_PREFIX
24761
24971
  });
24762
24972
  import { existsSync as existsSync35, readFileSync as readFileSync30, realpathSync as realpathSync3, statSync as statSync6 } from "fs";
24763
- import { basename as basename16, dirname as dirname27, extname as extname12, join as join45, resolve as resolve41, relative as relative16 } from "path";
24973
+ import { basename as basename16, dirname as dirname28, extname as extname12, join as join46, resolve as resolve41, relative as relative16 } from "path";
24764
24974
  var SRC_PREFIX = "/@src/", BROWSER_DEFINE, jsTranspiler2, legacyDecoratorTsconfig, tsTranspiler2, tsxTranspiler, TRANSPILABLE, ALL_EXPORTS_RE, STRING_CONTENTS_RE, preserveTypeExports = (originalSource, transpiled, valueExports) => {
24765
24975
  const codeOnly = originalSource.replace(STRING_CONTENTS_RE, '""');
24766
24976
  const allExports = [];
@@ -24843,7 +25053,7 @@ ${stubs}
24843
25053
  const subpath = isScoped ? parts.slice(2).join("/") : parts.slice(1).join("/");
24844
25054
  if (!subpath) {
24845
25055
  const pkgDir = resolve41(projectRoot, "node_modules", packageName ?? "");
24846
- const pkgJsonPath = join45(pkgDir, "package.json");
25056
+ const pkgJsonPath = join46(pkgDir, "package.json");
24847
25057
  if (existsSync35(pkgJsonPath)) {
24848
25058
  const pkg = JSON.parse(readFileSync30(pkgJsonPath, "utf-8"));
24849
25059
  const esmEntry = typeof pkg.module === "string" && pkg.module || typeof pkg.browser === "string" && pkg.browser;
@@ -24886,7 +25096,7 @@ ${stubs}
24886
25096
  };
24887
25097
  result = result.replace(/^((?:import\s+[^"'`;]+?\s+from|export\s+[^"'`;]+?\s+from|import)\s*["'])([^"'./][^"']*)(["'])/gm, stubReplace);
24888
25098
  result = result.replace(/(import\s*\(\s*["'])([^"'./][^"']*)(["']\s*\))/g, stubReplace);
24889
- const fileDir = dirname27(filePath);
25099
+ const fileDir = dirname28(filePath);
24890
25100
  result = result.replace(/(from\s*["'])(\.\.?\/[^"']+)(["'])/g, (_match, prefix, relPath, suffix) => isRealImport(relPath) ? `${prefix}${resolveRelativeImport(relPath, fileDir, projectRoot, IMPORT_EXTENSIONS)}${suffix}` : _match);
24891
25101
  result = result.replace(/(import\s*\(\s*["'])(\.\.?\/[^"']+)(["']\s*\))/g, (_match, prefix, relPath, suffix) => isRealImport(relPath) ? `${prefix}${resolveRelativeImport(relPath, fileDir, projectRoot, IMPORT_EXTENSIONS)}${suffix}` : _match);
24892
25102
  result = result.replace(/(import\s*["'])(\.\.?\/[^"']+)(["']\s*;?)/g, (_match, prefix, relPath, suffix) => isRealImport(relPath) ? `${prefix}${resolveRelativeImport(relPath, fileDir, projectRoot, SIDE_EFFECT_EXTENSIONS)}${suffix}` : _match);
@@ -25709,7 +25919,7 @@ __export(exports_hmrCompiler, {
25709
25919
  getApplyMetadataModule: () => getApplyMetadataModule,
25710
25920
  encodeHmrComponentId: () => encodeHmrComponentId
25711
25921
  });
25712
- import { dirname as dirname28, relative as relative17, resolve as resolve42 } from "path";
25922
+ import { dirname as dirname29, relative as relative17, resolve as resolve42 } from "path";
25713
25923
  import { performance as performance2 } from "perf_hooks";
25714
25924
  var encodeHmrComponentId = (absoluteFilePath, className) => {
25715
25925
  const projectRel = relative17(process.cwd(), absoluteFilePath).replace(/\\/g, "/");
@@ -25732,7 +25942,7 @@ var encodeHmrComponentId = (absoluteFilePath, className) => {
25732
25942
  const { resolveOwningComponents: resolveOwningComponents2 } = await Promise.resolve().then(() => (init_resolveOwningComponents(), exports_resolveOwningComponents));
25733
25943
  const owners = resolveOwningComponents2({
25734
25944
  changedFilePath: componentFilePath,
25735
- userAngularRoot: dirname28(componentFilePath)
25945
+ userAngularRoot: dirname29(componentFilePath)
25736
25946
  });
25737
25947
  const owner = owners.find((o3) => o3.className === className);
25738
25948
  const kind = owner?.kind ?? "component";
@@ -25949,9 +26159,9 @@ var init_simpleHTMXHMR = () => {};
25949
26159
  import { existsSync as existsSync36, readdirSync as readdirSync9, rmSync as rmSync3 } from "fs";
25950
26160
  import {
25951
26161
  basename as basename17,
25952
- dirname as dirname29,
26162
+ dirname as dirname30,
25953
26163
  isAbsolute as isAbsolute6,
25954
- join as join46,
26164
+ join as join47,
25955
26165
  relative as relative18,
25956
26166
  resolve as resolvePath3,
25957
26167
  sep as sep4
@@ -26078,8 +26288,8 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, clearDevSs
26078
26288
  const relJs = `${rel.slice(0, -ext[0].length)}.js`;
26079
26289
  const generatedDir = getFrameworkGeneratedDir(framework, cwd2);
26080
26290
  for (const candidate of [
26081
- join46(generatedDir, relJs),
26082
- `${join46(generatedDir, relJs)}.map`
26291
+ join47(generatedDir, relJs),
26292
+ `${join47(generatedDir, relJs)}.map`
26083
26293
  ]) {
26084
26294
  try {
26085
26295
  rmSync3(candidate, { force: true });
@@ -26313,8 +26523,8 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, clearDevSs
26313
26523
  const relFromDir = normalizedSource.slice(normalizedDir.length + 1);
26314
26524
  const { buildDir } = state.resolvedPaths;
26315
26525
  const destPath = resolvePath3(buildDir, urlPrefix ? `${urlPrefix}/${relFromDir}` : relFromDir);
26316
- const { mkdir: mkdir11, copyFile, readFile: readFile10 } = await import("fs/promises");
26317
- await mkdir11(dirname29(destPath), { recursive: true });
26526
+ const { mkdir: mkdir12, copyFile, readFile: readFile10 } = await import("fs/promises");
26527
+ await mkdir12(dirname30(destPath), { recursive: true });
26318
26528
  await copyFile(absSource, destPath);
26319
26529
  const bytes = await readFile10(destPath);
26320
26530
  const webPath = urlPrefix ? `/${urlPrefix}/${relFromDir}` : `/${relFromDir}`;
@@ -26495,7 +26705,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, clearDevSs
26495
26705
  const keepStemsByDir = new Map;
26496
26706
  const prefixByDir = new Map;
26497
26707
  for (const artifact of freshOutputs) {
26498
- const dir = dirname29(artifact.path);
26708
+ const dir = dirname30(artifact.path);
26499
26709
  const name = basename17(artifact.path);
26500
26710
  const [prefix] = name.split(".");
26501
26711
  if (!prefix)
@@ -26981,7 +27191,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, clearDevSs
26981
27191
  const entries = await readdir6(dir, { withFileTypes: true });
26982
27192
  const files = [];
26983
27193
  for (const entry of entries) {
26984
- const full = join46(dir, entry.name);
27194
+ const full = join47(dir, entry.name);
26985
27195
  if (entry.isDirectory()) {
26986
27196
  files.push(...await walk(full));
26987
27197
  } else if (entry.isFile() && entry.name.endsWith(".ts") && !entry.name.endsWith(".d.ts")) {
@@ -27541,7 +27751,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, clearDevSs
27541
27751
  } = await compileVue2(vueFiles, vueDir, true, getStyleTransformConfig(state.config));
27542
27752
  const serverEntries = [...vueServerPaths];
27543
27753
  const clientEntries = [...vueIndexPaths, ...vueClientPaths];
27544
- const cssOutDir = join46(buildDir, state.resolvedPaths.assetsDir ? basename17(state.resolvedPaths.assetsDir) : "assets", "css");
27754
+ const cssOutDir = join47(buildDir, state.resolvedPaths.assetsDir ? basename17(state.resolvedPaths.assetsDir) : "assets", "css");
27545
27755
  const { serverRoot, serverOutDir } = await computeServerOutPaths(state.resolvedPaths, "vue");
27546
27756
  const serverExternals = await getServerBundleExternals();
27547
27757
  const clientVendorPaths = await getClientVendorPaths();
@@ -27753,7 +27963,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, clearDevSs
27753
27963
  });
27754
27964
  });
27755
27965
  return allModuleUpdates;
27756
- }, handleReactHMR = (state, affectedFrameworks, filesToRebuild, manifest, duration) => {
27966
+ }, handleReactHMR = async (state, affectedFrameworks, filesToRebuild, manifest, duration) => {
27757
27967
  if (!affectedFrameworks.includes("react") || !state.resolvedPaths.reactDir) {
27758
27968
  return;
27759
27969
  }
@@ -27765,14 +27975,21 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, clearDevSs
27765
27975
  const sourceFiles = reactPageFiles.length > 0 ? reactPageFiles : reactFiles;
27766
27976
  const [primarySource] = sourceFiles;
27767
27977
  try {
27768
- const hasComponentChanges = reactFiles.some((file5) => file5.endsWith(".tsx") || file5.endsWith(".ts") || file5.endsWith(".jsx"));
27769
- const hasCSSChanges = reactFiles.some(isStylePath);
27978
+ const {
27979
+ isReactFastRefreshSupported: isReactFastRefreshSupported2,
27980
+ warnIfReactFastRefreshUnsupported: warnIfReactFastRefreshUnsupported2
27981
+ } = await Promise.resolve().then(() => (init_moduleServer(), exports_moduleServer));
27982
+ warnIfReactFastRefreshUnsupported2();
27983
+ await handleReactModuleServerPath(state, reactFiles, Date.now() - duration, isReactFastRefreshSupported2(), () => {
27984
+ return;
27985
+ });
27986
+ } catch (err) {
27770
27987
  logHmrUpdate(primarySource ?? reactFiles[0] ?? "", "react", duration);
27771
27988
  broadcastToClients(state, {
27772
27989
  data: {
27773
27990
  framework: "react",
27774
- hasComponentChanges,
27775
- hasCSSChanges,
27991
+ hasComponentChanges: true,
27992
+ hasCSSChanges: reactFiles.some(isStylePath),
27776
27993
  manifest,
27777
27994
  primarySource,
27778
27995
  serverDuration: duration,
@@ -27780,7 +27997,6 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, clearDevSs
27780
27997
  },
27781
27998
  type: "react-update"
27782
27999
  });
27783
- } catch (err) {
27784
28000
  console.error("[hmr] react live update failed:", err instanceof Error ? err.message : err);
27785
28001
  sendTelemetryEvent("hmr:error", {
27786
28002
  framework: "react",
@@ -27811,7 +28027,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, clearDevSs
27811
28027
  if (!buildReference?.source) {
27812
28028
  return;
27813
28029
  }
27814
- const sourcePath = buildReference.source.startsWith("file://") ? new URL(buildReference.source).pathname : resolvePath3(dirname29(buildInfo.resolvedRegistryPath), buildReference.source);
28030
+ const sourcePath = buildReference.source.startsWith("file://") ? new URL(buildReference.source).pathname : resolvePath3(dirname30(buildInfo.resolvedRegistryPath), buildReference.source);
27815
28031
  islandFiles.add(resolvePath3(sourcePath));
27816
28032
  }, resolveIslandSourceFiles = async (config) => {
27817
28033
  const registryPath = config.islands?.registry;
@@ -27839,8 +28055,14 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, clearDevSs
27839
28055
  }
27840
28056
  setCurrentPageIslandMetadata(await loadPageIslandMetadata(config));
27841
28057
  const affectedPages = filesToRebuild.flatMap((file5) => getPagesUsingIslandSource(file5));
28058
+ if (affectedPages.length === 0)
28059
+ return true;
28060
+ const affectedFrameworks = [
28061
+ ...new Set(affectedPages.map((page) => detectFramework(page, state.resolvedPaths)).filter((framework) => framework !== "ignored"))
28062
+ ];
27842
28063
  broadcastToClients(state, {
27843
28064
  data: {
28065
+ affectedFrameworks,
27844
28066
  affectedPages,
27845
28067
  framework: "islands",
27846
28068
  manifest,
@@ -28232,7 +28454,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, clearDevSs
28232
28454
  }
28233
28455
  }, handleFullBuildHMR = async (state, config, affectedFrameworks, filesToRebuild, manifest, duration) => {
28234
28456
  const allModuleUpdates = collectAllModuleUpdates(affectedFrameworks, filesToRebuild, manifest, state);
28235
- handleReactHMR(state, affectedFrameworks, filesToRebuild, manifest, duration);
28457
+ await handleReactHMR(state, affectedFrameworks, filesToRebuild, manifest, duration);
28236
28458
  handleHTMLScriptHMR(state, filesToRebuild, manifest, duration);
28237
28459
  await handleHTMLPageHMR(state, config, filesToRebuild, manifest, duration);
28238
28460
  await handleVueHMR(state, config, filesToRebuild, manifest, duration);
@@ -28459,7 +28681,8 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, clearDevSs
28459
28681
  message: "Rebuild completed successfully",
28460
28682
  type: "rebuild-complete"
28461
28683
  });
28462
- if (config.tailwind && filesToRebuild && filesToRebuild.some(isTailwindCandidate)) {
28684
+ const hasDedicatedStyleUpdate = affectedFrameworks.some((framework) => framework === "styles" || framework === "assets");
28685
+ if (config.tailwind && filesToRebuild && filesToRebuild.some(isTailwindCandidate) && !hasDedicatedStyleUpdate) {
28463
28686
  try {
28464
28687
  const outputPath = resolvePath3(state.resolvedPaths.buildDir, config.tailwind.output);
28465
28688
  const bytes = await Bun.file(outputPath).bytes();
@@ -28480,6 +28703,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, clearDevSs
28480
28703
  const hasFilesToRebuild = filesToRebuild && filesToRebuild.length > 0;
28481
28704
  const didReloadForIslandChange = hasFilesToRebuild ? await handleIslandSourceReload(state, config, filesToRebuild, manifest, duration) : false;
28482
28705
  if (didReloadForIslandChange) {
28706
+ await runFrameworkFastPaths(state, config, affectedFrameworks, filesToRebuild ?? [], startTime, onRebuildComplete);
28483
28707
  onRebuildComplete({ hmrState: state, manifest });
28484
28708
  return manifest;
28485
28709
  }
@@ -28616,8 +28840,8 @@ __export(exports_buildDepVendor, {
28616
28840
  });
28617
28841
  import { mkdirSync as mkdirSync14 } from "fs";
28618
28842
  import { isBuiltin } from "module";
28619
- import { join as join47 } from "path";
28620
- import { rm as rm13 } from "fs/promises";
28843
+ import { join as join48 } from "path";
28844
+ import { rm as rm14 } from "fs/promises";
28621
28845
  var {build: bunBuild9, Glob: Glob10 } = globalThis.Bun;
28622
28846
  var toSafeFileName6 = (specifier) => {
28623
28847
  const prefix = specifier.startsWith("@") ? "_" : "";
@@ -28676,7 +28900,7 @@ var toSafeFileName6 = (specifier) => {
28676
28900
  };
28677
28901
  }, collectBareImportsFromFile = async (entryPath, transpiler6, maxDepth = 8) => {
28678
28902
  const { readFileSync: readFileSync31 } = await import("fs");
28679
- const { dirname: dirname30 } = await import("path");
28903
+ const { dirname: dirname31 } = await import("path");
28680
28904
  const seenFiles = new Set;
28681
28905
  const bareOut = new Set;
28682
28906
  const queue = [
@@ -28701,7 +28925,7 @@ var toSafeFileName6 = (specifier) => {
28701
28925
  } catch {
28702
28926
  continue;
28703
28927
  }
28704
- const fromDir = dirname30(path);
28928
+ const fromDir = dirname31(path);
28705
28929
  for (const imp of imports) {
28706
28930
  const child = imp.path;
28707
28931
  if (child.startsWith(".") || child.startsWith("/")) {
@@ -28765,7 +28989,7 @@ var toSafeFileName6 = (specifier) => {
28765
28989
  }), buildDepVendorPass = async (specifiers, vendorDir, tmpDir) => {
28766
28990
  const entries = await Promise.all(specifiers.map(async (specifier) => {
28767
28991
  const safeName = toSafeFileName6(specifier);
28768
- const entryPath = join47(tmpDir, `${safeName}.ts`);
28992
+ const entryPath = join48(tmpDir, `${safeName}.ts`);
28769
28993
  await Bun.write(entryPath, await generateVendorEntrySource(specifier));
28770
28994
  return { entryPath, specifier };
28771
28995
  }));
@@ -28856,9 +29080,9 @@ var toSafeFileName6 = (specifier) => {
28856
29080
  const { dep: initialSpecs, framework: frameworkRoots } = await scanBareImports(directories);
28857
29081
  if (initialSpecs.length === 0 && frameworkRoots.length === 0)
28858
29082
  return {};
28859
- const vendorDir = join47(buildDir, "vendor");
29083
+ const vendorDir = join48(buildDir, "vendor");
28860
29084
  mkdirSync14(vendorDir, { recursive: true });
28861
- const tmpDir = join47(buildDir, "_dep_vendor_tmp");
29085
+ const tmpDir = join48(buildDir, "_dep_vendor_tmp");
28862
29086
  mkdirSync14(tmpDir, { recursive: true });
28863
29087
  const allSpecs = new Set(initialSpecs);
28864
29088
  const alreadyScanned = new Set;
@@ -28878,7 +29102,7 @@ var toSafeFileName6 = (specifier) => {
28878
29102
  if (!success) {
28879
29103
  console.warn("\u26A0\uFE0F Dependency vendor build had errors:", result.logs);
28880
29104
  }
28881
- await rm13(tmpDir, { force: true, recursive: true });
29105
+ await rm14(tmpDir, { force: true, recursive: true });
28882
29106
  const paths = {};
28883
29107
  for (const specifier of allSpecs) {
28884
29108
  paths[specifier] = `/vendor/${toSafeFileName6(specifier)}.js`;
@@ -29149,6 +29373,9 @@ var FRAMEWORK_DIR_KEYS, collectDepVendorSourceDirs = (config) => {
29149
29373
  await handleCachedReload();
29150
29374
  return cached;
29151
29375
  }
29376
+ if (config.reactDirectory && !globalThis.__reactModuleRef) {
29377
+ globalThis.__reactModuleRef = await import("react");
29378
+ }
29152
29379
  const startupSteps = [];
29153
29380
  const recordStep = (label, startedAt) => {
29154
29381
  const durationMs = performance.now() - startedAt;
@@ -29324,9 +29551,6 @@ var FRAMEWORK_DIR_KEYS, collectDepVendorSourceDirs = (config) => {
29324
29551
  config.vueDirectory ? loadVendorFiles(state.assetStore, vueVendorDir, "vue") : Promise.resolve(),
29325
29552
  loadVendorFiles(state.assetStore, depVendorDir, "vendor")
29326
29553
  ]);
29327
- if (config.reactDirectory && !globalThis.__reactModuleRef) {
29328
- globalThis.__reactModuleRef = await import("react");
29329
- }
29330
29554
  recordStep("load vendor files", stepStartedAt);
29331
29555
  stepStartedAt = performance.now();
29332
29556
  const { warmCompilers: warmCompilers2 } = await Promise.resolve().then(() => (init_moduleServer(), exports_moduleServer));
@@ -29575,6 +29799,15 @@ var STORE_KEY = "__elysiaStore", restoredStores, getGlobalValue = (key) => Refle
29575
29799
  open: (ws) => handleClientConnect(hmrState2, ws, manifest)
29576
29800
  }).get("/hmr-status", () => ({
29577
29801
  connectedClients: hmrState2.connectedClients.size,
29802
+ connectedTargets: Object.fromEntries([
29803
+ "web",
29804
+ "capacitor-android",
29805
+ "capacitor-ios",
29806
+ "capacitor-native"
29807
+ ].map((target) => [
29808
+ target,
29809
+ [...hmrState2.clientTargets.values()].filter((value) => value === target).length
29810
+ ])),
29578
29811
  entryWatcherReady: globalThis.__absoluteEntryWatcherReady === true,
29579
29812
  isRebuilding: hmrState2.isRebuilding,
29580
29813
  manifestKeys: Object.keys(manifest),
@@ -29599,12 +29832,12 @@ __export(exports_devtoolsJson, {
29599
29832
  devtoolsJson: () => devtoolsJson
29600
29833
  });
29601
29834
  import { existsSync as existsSync37, mkdirSync as mkdirSync15, readFileSync as readFileSync31, writeFileSync as writeFileSync10 } from "fs";
29602
- import { dirname as dirname30, join as join48, resolve as resolve46 } from "path";
29835
+ import { dirname as dirname31, join as join49, resolve as resolve46 } from "path";
29603
29836
  import { Elysia as Elysia6 } from "elysia";
29604
29837
  var ENDPOINT = "/.well-known/appspecific/com.chrome.devtools.json", UUID_CACHE_KEY = "__absoluteDevtoolsWorkspaceUuid", getGlobalUuid = () => Reflect.get(globalThis, UUID_CACHE_KEY), setGlobalUuid = (uuid) => {
29605
29838
  Reflect.set(globalThis, UUID_CACHE_KEY, uuid);
29606
29839
  return uuid;
29607
- }, isUuidV4 = (value) => /^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(value), resolveDevtoolsUuidCachePath = (buildDir, uuidCachePath) => resolve46(uuidCachePath ?? join48(buildDir, ".absolute", "chrome-devtools-workspace-uuid")), readCachedUuid = (cachePath) => {
29840
+ }, isUuidV4 = (value) => /^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(value), resolveDevtoolsUuidCachePath = (buildDir, uuidCachePath) => resolve46(uuidCachePath ?? join49(buildDir, ".absolute", "chrome-devtools-workspace-uuid")), readCachedUuid = (cachePath) => {
29608
29841
  if (!existsSync37(cachePath))
29609
29842
  return null;
29610
29843
  try {
@@ -29626,7 +29859,7 @@ var ENDPOINT = "/.well-known/appspecific/com.chrome.devtools.json", UUID_CACHE_K
29626
29859
  if (cachedUuid)
29627
29860
  return setGlobalUuid(cachedUuid);
29628
29861
  const uuid = crypto.randomUUID();
29629
- mkdirSync15(dirname30(cachePath), { recursive: true });
29862
+ mkdirSync15(dirname31(cachePath), { recursive: true });
29630
29863
  writeFileSync10(cachePath, uuid, "utf-8");
29631
29864
  return setGlobalUuid(uuid);
29632
29865
  }, devtoolsJson = (buildDir, options = {}) => {
@@ -29643,11 +29876,11 @@ var ENDPOINT = "/.well-known/appspecific/com.chrome.devtools.json", UUID_CACHE_K
29643
29876
  if (process.env.WSL_DISTRO_NAME) {
29644
29877
  const distro = process.env.WSL_DISTRO_NAME;
29645
29878
  const withoutLeadingSlash = root.replace(/^\//, "");
29646
- return join48("\\\\wsl.localhost", distro, withoutLeadingSlash).replace(/\//g, "\\");
29879
+ return join49("\\\\wsl.localhost", distro, withoutLeadingSlash).replace(/\//g, "\\");
29647
29880
  }
29648
29881
  if (process.env.DOCKER_DESKTOP && !root.startsWith("\\\\")) {
29649
29882
  const withoutLeadingSlash = root.replace(/^\//, "");
29650
- return join48("\\\\wsl.localhost", "docker-desktop-data", withoutLeadingSlash).replace(/\//g, "\\");
29883
+ return join49("\\\\wsl.localhost", "docker-desktop-data", withoutLeadingSlash).replace(/\//g, "\\");
29651
29884
  }
29652
29885
  return root;
29653
29886
  };
@@ -29950,7 +30183,7 @@ __export(exports_prerender, {
29950
30183
  PRERENDER_BYPASS_HEADER: () => PRERENDER_BYPASS_HEADER
29951
30184
  });
29952
30185
  import { mkdirSync as mkdirSync16, readFileSync as readFileSync32 } from "fs";
29953
- import { join as join49 } from "path";
30186
+ import { join as join50 } from "path";
29954
30187
  var SERVER_OUTPUT_LIMIT = 4000, STARTUP_POLL_INTERVAL_MS = 100, DEFAULT_STARTUP_TIMEOUT_MS = 30000, DEFAULT_FETCH_TIMEOUT_MS = 1e4, PRERENDER_BYPASS_HEADER = "X-Absolute-Prerender-Bypass", routeToFilename = (route) => route === "/" ? "index.html" : `${route.slice(1).replace(/\//g, "-")}.html`, writeTimestamp = async (htmlPath) => {
29955
30188
  const metaPath = htmlPath.replace(/\.html$/, ".meta");
29956
30189
  await Bun.write(metaPath, String(Date.now()));
@@ -30020,7 +30253,7 @@ var SERVER_OUTPUT_LIMIT = 4000, STARTUP_POLL_INTERVAL_MS = 100, DEFAULT_STARTUP_
30020
30253
  if (!isCompleteHtml(html))
30021
30254
  return false;
30022
30255
  const fileName = routeToFilename(route);
30023
- const filePath = join49(prerenderDir, fileName);
30256
+ const filePath = join50(prerenderDir, fileName);
30024
30257
  await Bun.write(filePath, html);
30025
30258
  await writeTimestamp(filePath);
30026
30259
  return true;
@@ -30050,13 +30283,13 @@ var SERVER_OUTPUT_LIMIT = 4000, STARTUP_POLL_INTERVAL_MS = 100, DEFAULT_STARTUP_
30050
30283
  return;
30051
30284
  }
30052
30285
  const fileName = routeToFilename(route);
30053
- const filePath = join49(prerenderDir, fileName);
30286
+ const filePath = join50(prerenderDir, fileName);
30054
30287
  await Bun.write(filePath, html);
30055
30288
  await writeTimestamp(filePath);
30056
30289
  result.routes.set(route, filePath);
30057
30290
  log2?.(` Pre-rendered ${route} \u2192 ${fileName} (${html.length} bytes)`);
30058
30291
  }, prerender = async (port, outDir, staticConfig, log2) => {
30059
- const prerenderDir = join49(outDir, "_prerendered");
30292
+ const prerenderDir = join50(outDir, "_prerendered");
30060
30293
  mkdirSync16(prerenderDir, { recursive: true });
30061
30294
  const baseUrl = `http://localhost:${port}`;
30062
30295
  let routes;
@@ -30182,7 +30415,7 @@ import {
30182
30415
  watch as watch2
30183
30416
  } from "fs";
30184
30417
  import { createHash as createHash9 } from "crypto";
30185
- import { dirname as dirname31, join as join53, resolve as resolve48 } from "path";
30418
+ import { dirname as dirname32, join as join54, resolve as resolve48 } from "path";
30186
30419
  var ATOMIC_RECOVERY_WINDOW_MS = 1000, RELOAD_DEBOUNCE_MS = 80, ENTRY_IMPORT_RETRY_DELAY_MS = 250, MAX_ENTRY_IMPORT_ATTEMPTS = 3, WATCH_FALLBACK_INTERVAL_MS = 250, ATOMIC_WRITE_TEMP_PATTERNS2, isAtomicWriteTemp = (filename) => filename.endsWith(".tmp") || filename.includes(".tmp.") || filename.endsWith("~") || filename.startsWith(".#") || filename.startsWith(".absolutejs-hmr-") || ATOMIC_WRITE_TEMP_PATTERNS2.some((pattern) => pattern.test(filename)), fileHash = (path) => {
30187
30420
  try {
30188
30421
  return createHash9("sha256").update(readFileSync36(path)).digest("hex");
@@ -30211,10 +30444,10 @@ var ATOMIC_RECOVERY_WINDOW_MS = 1000, RELOAD_DEBOUNCE_MS = 80, ENTRY_IMPORT_RETR
30211
30444
  globalThis.__absoluteEntryWatcherStarted = true;
30212
30445
  globalThis.__absoluteEntryWatcherReady = false;
30213
30446
  const entryPath = resolve48(originalEntry);
30214
- const entryDir = dirname31(entryPath);
30447
+ const entryDir = dirname32(entryPath);
30215
30448
  const entryBase = entryPath.slice(entryDir.length + 1);
30216
30449
  const configPath2 = resolve48(process.env.ABSOLUTE_CONFIG ?? "absolute.config.ts");
30217
- const configDir2 = dirname31(configPath2);
30450
+ const configDir2 = dirname32(configPath2);
30218
30451
  const configBase = configPath2.slice(configDir2.length + 1);
30219
30452
  const recentlyHandled = new Map;
30220
30453
  let entryReloadTimer = null;
@@ -30224,7 +30457,7 @@ var ATOMIC_RECOVERY_WINDOW_MS = 1000, RELOAD_DEBOUNCE_MS = 80, ENTRY_IMPORT_RETR
30224
30457
  let pendingEntryCause = null;
30225
30458
  let siblingSequence = 0;
30226
30459
  const importFreshEntry = async (attempt = 1) => {
30227
- const siblingPath = join53(entryDir, `.absolutejs-hmr-${process.pid}-${siblingSequence++}.ts`);
30460
+ const siblingPath = join54(entryDir, `.absolutejs-hmr-${process.pid}-${siblingSequence++}.ts`);
30228
30461
  let failure;
30229
30462
  try {
30230
30463
  copyFileSync4(entryPath, siblingPath);
@@ -30337,7 +30570,7 @@ var ATOMIC_RECOVERY_WINDOW_MS = 1000, RELOAD_DEBOUNCE_MS = 80, ENTRY_IMPORT_RETR
30337
30570
  continue;
30338
30571
  let st2;
30339
30572
  try {
30340
- st2 = statSync8(join53(dir, entry.name));
30573
+ st2 = statSync8(join54(dir, entry.name));
30341
30574
  } catch {
30342
30575
  continue;
30343
30576
  }
@@ -30881,157 +31114,6 @@ var withRegisteredStreamingSlots = async (renderResponse, options = {}) => {
30881
31114
  });
30882
31115
  };
30883
31116
 
30884
- // src/core/pageHandlers.ts
30885
- var handleStaticPageRequest = async (pagePath, options = {}, settings = {}) => {
30886
- const html = await file(pagePath).text();
30887
- const transformedHtml = await transformCurrentStaticPageHtml(html, settings);
30888
- return withPageCacheHeaders(await withStreamingSlots(new Response(injectIslandPageContext(transformedHtml), {
30889
- headers: { "Content-Type": "text/html" }
30890
- }), {
30891
- ...options,
30892
- streamingSlots: options.streamingSlots ?? []
30893
- }));
30894
- };
30895
- var handleHTMLPageRequest = (pagePath, options) => {
30896
- const htmlFile = file(pagePath);
30897
- return htmlFile.text().then((html) => {
30898
- if (extractStaticStreamingTags(html).length > 0) {
30899
- throw new Error(`HTML page "${pagePath}" uses <abs-stream-slot>, but HTML pages should pass explicit streamingSlots to handleHTMLPageRequest(...).`);
30900
- }
30901
- return handleStaticPageRequest(pagePath, options, {
30902
- enableStaticStreaming: false
30903
- });
30904
- });
30905
- };
30906
- var handleHTMXPageRequest = async (pagePath) => {
30907
- const html = await file(pagePath).text();
30908
- if (extractStaticStreamingTags(html).length > 0) {
30909
- throw new Error(`HTMX page "${pagePath}" uses <abs-stream-slot>, but HTMX pages should use native hx-* fragment requests instead.`);
30910
- }
30911
- return handleStaticPageRequest(pagePath, {}, {
30912
- enableHTMXStreaming: true,
30913
- enableStaticStreaming: false
30914
- });
30915
- };
30916
- // src/core/prepare.ts
30917
- import { createHash as createHash8 } from "crypto";
30918
- import { existsSync as existsSync39, readdirSync as readdirSync10, readFileSync as readFileSync33 } from "fs";
30919
- import { basename as basename18, join as join50, relative as relative19, resolve as resolvePath4 } from "path";
30920
- import { Elysia as Elysia9, NotFound } from "elysia";
30921
-
30922
- // src/plugins/openApiPlugin.ts
30923
- import { existsSync as existsSync7, readFileSync as readFileSync8 } from "fs";
30924
- import { join as join11 } from "path";
30925
- var FALLBACK_NAME = "AbsoluteJS API";
30926
- var FALLBACK_VERSION = "1.0.0";
30927
- var projectInfo = (cwd) => {
30928
- const path = join11(cwd, "package.json");
30929
- if (!existsSync7(path)) {
30930
- return { name: FALLBACK_NAME, version: FALLBACK_VERSION };
30931
- }
30932
- try {
30933
- const pkg = JSON.parse(readFileSync8(path, "utf-8"));
30934
- return {
30935
- name: typeof pkg.name === "string" ? pkg.name : FALLBACK_NAME,
30936
- version: typeof pkg.version === "string" ? pkg.version : FALLBACK_VERSION
30937
- };
30938
- } catch {
30939
- return { name: FALLBACK_NAME, version: FALLBACK_VERSION };
30940
- }
30941
- };
30942
- var openApiEnabled = (config, isDev) => isDev ? config.openapi !== false : Boolean(config.openapi);
30943
- var createOpenApiPlugin = async (config, cwd) => {
30944
- const setting = config.openapi;
30945
- const options = typeof setting === "object" ? setting : {};
30946
- const info = projectInfo(cwd);
30947
- const { openapi } = await import("@elysia/openapi");
30948
- return openapi({
30949
- documentation: {
30950
- info: {
30951
- description: options.documentation?.description,
30952
- title: options.documentation?.title ?? info.name,
30953
- version: options.documentation?.version ?? info.version
30954
- }
30955
- },
30956
- exclude: {
30957
- paths: [
30958
- /^\/_/,
30959
- /^\/@/,
30960
- /^\/__absolute/,
30961
- /^\/hmr/,
30962
- /^\/\.well-known/,
30963
- /^\/chunk-/,
30964
- /^\/node_modules/
30965
- ]
30966
- },
30967
- path: options.path ?? "/openapi",
30968
- provider: options.provider === "swagger" ? "swagger-ui" : "scalar"
30969
- });
30970
- };
30971
- var withOpenApi = async (app, config, cwd, isDev) => {
30972
- if (!openApiEnabled(config, isDev))
30973
- return app;
30974
- try {
30975
- return app.use(await createOpenApiPlugin(config, cwd));
30976
- } catch (error) {
30977
- const detail = error instanceof Error ? error.message : String(error);
30978
- console.warn(`[absolute] OpenAPI docs disabled \u2014 install @elysia/openapi (${detail})`);
30979
- return app;
30980
- }
30981
- };
30982
-
30983
- // src/plugins/telemetryPlugin.ts
30984
- import { existsSync as existsSync8, readFileSync as readFileSync9 } from "fs";
30985
- import { join as join12 } from "path";
30986
- var OTEL_PACKAGE = "@elysia/opentelemetry";
30987
- var readPackageName = (cwd) => {
30988
- const path = join12(cwd, "package.json");
30989
- if (!existsSync8(path))
30990
- return null;
30991
- try {
30992
- const pkg = JSON.parse(readFileSync9(path, "utf-8"));
30993
- return typeof pkg.name === "string" ? pkg.name : null;
30994
- } catch {
30995
- return null;
30996
- }
30997
- };
30998
- var serviceNameFor = (config, cwd) => {
30999
- const setting = config.telemetry;
31000
- if (typeof setting === "object" && setting.serviceName) {
31001
- return setting.serviceName;
31002
- }
31003
- return readPackageName(cwd) ?? "absolutejs-app";
31004
- };
31005
- var withTelemetry = async (app, config, cwd) => {
31006
- if (!config.telemetry)
31007
- return app;
31008
- try {
31009
- const { opentelemetry } = await import(OTEL_PACKAGE);
31010
- return app.use(opentelemetry({ serviceName: serviceNameFor(config, cwd) }));
31011
- } catch (error) {
31012
- const detail = error instanceof Error ? error.message : String(error);
31013
- console.warn(`[absolute] telemetry enabled but ${OTEL_PACKAGE} isn't installed \u2014 run \`bun add ${OTEL_PACKAGE}\` (${detail})`);
31014
- return app;
31015
- }
31016
- };
31017
-
31018
- // src/core/prepare.ts
31019
- init_loadConfig();
31020
-
31021
- // src/utils/iconVersion.ts
31022
- var iconMimeType = (icon) => {
31023
- if (icon.endsWith(".svg"))
31024
- return "image/svg+xml";
31025
- if (icon.endsWith(".png"))
31026
- return "image/png";
31027
- return "image/x-icon";
31028
- };
31029
- var resolver;
31030
- var applyIconVersion = (href) => resolver ? resolver(href) : href;
31031
- var setIconVersionResolver = (resolverFn) => {
31032
- resolver = resolverFn;
31033
- };
31034
-
31035
31117
  // src/core/requestContext.ts
31036
31118
  import { AsyncLocalStorage } from "async_hooks";
31037
31119
  import { Elysia } from "elysia";
@@ -31057,9 +31139,6 @@ var absoluteRequestContext = new Elysia({
31057
31139
  var getCurrentAbsoluteRequest = () => getRequestStorage()?.getStore()?.request;
31058
31140
  var runWithAbsoluteRequest = (request, callback) => ensureRequestStorage().run({ request }, callback);
31059
31141
 
31060
- // src/mobile/compatibilityDispatcher.ts
31061
- import { Elysia as Elysia2 } from "elysia";
31062
-
31063
31142
  // src/mobile/producerContextState.ts
31064
31143
  var ABSOLUTE_MOBILE_PRODUCER_STORAGE_KEY = Symbol.for("absolutejs.mobileProducerAsyncLocalStorage");
31065
31144
  var frameworks2 = new Set([
@@ -31305,6 +31384,180 @@ var finalizeAbsoluteMobilePage = (input) => {
31305
31384
  }
31306
31385
  };
31307
31386
 
31387
+ // src/core/pageHandlers.ts
31388
+ var finalizeStaticMobilePage = (framework, pagePath, metadata2) => {
31389
+ const pageId = metadata2?.pageId ?? `${framework}:${pagePath}`;
31390
+ const contract = metadata2?.contract ?? `${framework}:${pageId}:${ABSOLUTE_MOBILE_PAGE_PROTOCOL_VERSION}`;
31391
+ return finalizeAbsoluteMobilePage({
31392
+ compatibility: {
31393
+ framework,
31394
+ pageId,
31395
+ representations: [{ contract, mapProps: () => ({}) }],
31396
+ runtimes: [String(ABSOLUTE_MOBILE_PAGE_PROTOCOL_VERSION)]
31397
+ },
31398
+ props: {},
31399
+ request: getCurrentAbsoluteRequest()
31400
+ });
31401
+ };
31402
+ var handleStaticPageRequest = async (pagePath, options = {}, settings = {}) => {
31403
+ const html = await file(pagePath).text();
31404
+ const transformedHtml = await transformCurrentStaticPageHtml(html, settings);
31405
+ return withPageCacheHeaders(await withStreamingSlots(new Response(injectIslandPageContext(transformedHtml), {
31406
+ headers: { "Content-Type": "text/html" }
31407
+ }), {
31408
+ ...options,
31409
+ streamingSlots: options.streamingSlots ?? []
31410
+ }));
31411
+ };
31412
+ var handleHTMLPageRequest = (pagePath, options) => {
31413
+ const mobileResponse = finalizeStaticMobilePage("html", pagePath, options?.__absoluteMobile);
31414
+ if (mobileResponse)
31415
+ return Promise.resolve(mobileResponse);
31416
+ const htmlFile = file(pagePath);
31417
+ return htmlFile.text().then((html) => {
31418
+ if (extractStaticStreamingTags(html).length > 0) {
31419
+ throw new Error(`HTML page "${pagePath}" uses <abs-stream-slot>, but HTML pages should pass explicit streamingSlots to handleHTMLPageRequest(...).`);
31420
+ }
31421
+ return handleStaticPageRequest(pagePath, options, {
31422
+ enableStaticStreaming: false
31423
+ });
31424
+ });
31425
+ };
31426
+ var handleHTMXPageRequest = async (pagePath, options = {}) => {
31427
+ const mobileResponse = finalizeStaticMobilePage("htmx", pagePath, options.__absoluteMobile);
31428
+ if (mobileResponse)
31429
+ return mobileResponse;
31430
+ const html = await file(pagePath).text();
31431
+ if (extractStaticStreamingTags(html).length > 0) {
31432
+ throw new Error(`HTMX page "${pagePath}" uses <abs-stream-slot>, but HTMX pages should use native hx-* fragment requests instead.`);
31433
+ }
31434
+ return handleStaticPageRequest(pagePath, {}, {
31435
+ enableHTMXStreaming: true,
31436
+ enableStaticStreaming: false
31437
+ });
31438
+ };
31439
+ // src/core/prepare.ts
31440
+ import { createHash as createHash8 } from "crypto";
31441
+ import { existsSync as existsSync39, readdirSync as readdirSync10, readFileSync as readFileSync33 } from "fs";
31442
+ import { basename as basename18, join as join51, relative as relative19, resolve as resolvePath4 } from "path";
31443
+ import { Elysia as Elysia9, NotFound } from "elysia";
31444
+
31445
+ // src/plugins/openApiPlugin.ts
31446
+ import { existsSync as existsSync7, readFileSync as readFileSync8 } from "fs";
31447
+ import { join as join11 } from "path";
31448
+ var FALLBACK_NAME = "AbsoluteJS API";
31449
+ var FALLBACK_VERSION = "1.0.0";
31450
+ var projectInfo = (cwd) => {
31451
+ const path = join11(cwd, "package.json");
31452
+ if (!existsSync7(path)) {
31453
+ return { name: FALLBACK_NAME, version: FALLBACK_VERSION };
31454
+ }
31455
+ try {
31456
+ const pkg = JSON.parse(readFileSync8(path, "utf-8"));
31457
+ return {
31458
+ name: typeof pkg.name === "string" ? pkg.name : FALLBACK_NAME,
31459
+ version: typeof pkg.version === "string" ? pkg.version : FALLBACK_VERSION
31460
+ };
31461
+ } catch {
31462
+ return { name: FALLBACK_NAME, version: FALLBACK_VERSION };
31463
+ }
31464
+ };
31465
+ var openApiEnabled = (config, isDev) => isDev ? config.openapi !== false : Boolean(config.openapi);
31466
+ var createOpenApiPlugin = async (config, cwd) => {
31467
+ const setting = config.openapi;
31468
+ const options = typeof setting === "object" ? setting : {};
31469
+ const info = projectInfo(cwd);
31470
+ const { openapi } = await import("@elysia/openapi");
31471
+ return openapi({
31472
+ documentation: {
31473
+ info: {
31474
+ description: options.documentation?.description,
31475
+ title: options.documentation?.title ?? info.name,
31476
+ version: options.documentation?.version ?? info.version
31477
+ }
31478
+ },
31479
+ exclude: {
31480
+ paths: [
31481
+ /^\/_/,
31482
+ /^\/@/,
31483
+ /^\/__absolute/,
31484
+ /^\/hmr/,
31485
+ /^\/\.well-known/,
31486
+ /^\/chunk-/,
31487
+ /^\/node_modules/
31488
+ ]
31489
+ },
31490
+ path: options.path ?? "/openapi",
31491
+ provider: options.provider === "swagger" ? "swagger-ui" : "scalar"
31492
+ });
31493
+ };
31494
+ var withOpenApi = async (app, config, cwd, isDev) => {
31495
+ if (!openApiEnabled(config, isDev))
31496
+ return app;
31497
+ try {
31498
+ return app.use(await createOpenApiPlugin(config, cwd));
31499
+ } catch (error) {
31500
+ const detail = error instanceof Error ? error.message : String(error);
31501
+ console.warn(`[absolute] OpenAPI docs disabled \u2014 install @elysia/openapi (${detail})`);
31502
+ return app;
31503
+ }
31504
+ };
31505
+
31506
+ // src/plugins/telemetryPlugin.ts
31507
+ import { existsSync as existsSync8, readFileSync as readFileSync9 } from "fs";
31508
+ import { join as join12 } from "path";
31509
+ var OTEL_PACKAGE = "@elysia/opentelemetry";
31510
+ var readPackageName = (cwd) => {
31511
+ const path = join12(cwd, "package.json");
31512
+ if (!existsSync8(path))
31513
+ return null;
31514
+ try {
31515
+ const pkg = JSON.parse(readFileSync9(path, "utf-8"));
31516
+ return typeof pkg.name === "string" ? pkg.name : null;
31517
+ } catch {
31518
+ return null;
31519
+ }
31520
+ };
31521
+ var serviceNameFor = (config, cwd) => {
31522
+ const setting = config.telemetry;
31523
+ if (typeof setting === "object" && setting.serviceName) {
31524
+ return setting.serviceName;
31525
+ }
31526
+ return readPackageName(cwd) ?? "absolutejs-app";
31527
+ };
31528
+ var withTelemetry = async (app, config, cwd) => {
31529
+ if (!config.telemetry)
31530
+ return app;
31531
+ try {
31532
+ const { opentelemetry } = await import(OTEL_PACKAGE);
31533
+ return app.use(opentelemetry({ serviceName: serviceNameFor(config, cwd) }));
31534
+ } catch (error) {
31535
+ const detail = error instanceof Error ? error.message : String(error);
31536
+ console.warn(`[absolute] telemetry enabled but ${OTEL_PACKAGE} isn't installed \u2014 run \`bun add ${OTEL_PACKAGE}\` (${detail})`);
31537
+ return app;
31538
+ }
31539
+ };
31540
+
31541
+ // src/core/prepare.ts
31542
+ init_loadConfig();
31543
+
31544
+ // src/utils/iconVersion.ts
31545
+ var iconMimeType = (icon) => {
31546
+ if (icon.endsWith(".svg"))
31547
+ return "image/svg+xml";
31548
+ if (icon.endsWith(".png"))
31549
+ return "image/png";
31550
+ return "image/x-icon";
31551
+ };
31552
+ var resolver;
31553
+ var applyIconVersion = (href) => resolver ? resolver(href) : href;
31554
+ var setIconVersionResolver = (resolverFn) => {
31555
+ resolver = resolverFn;
31556
+ };
31557
+
31558
+ // src/mobile/compatibilityDispatcher.ts
31559
+ import { Elysia as Elysia2 } from "elysia";
31560
+
31308
31561
  // src/mobile/releaseArtifact.ts
31309
31562
  import { createHash as createHash4 } from "crypto";
31310
31563
  var ABSOLUTE_MOBILE_COMPATIBILITY_FORMAT = 1;
@@ -31382,13 +31635,19 @@ var parseCompatibilityPage = (value) => {
31382
31635
  if (!isCanonicalRecord(value) || !isPageFramework(value.framework)) {
31383
31636
  throw new TypeError("Compatibility artifact contains an invalid page.");
31384
31637
  }
31638
+ const styleBundleHash = typeof value.styleBundleHash === "string" ? value.styleBundleHash : undefined;
31639
+ const styleBundlePath = typeof value.styleBundlePath === "string" ? value.styleBundlePath : undefined;
31640
+ if (Boolean(styleBundleHash) !== Boolean(styleBundlePath)) {
31641
+ throw new TypeError("Compatibility page style hash and path must be provided together.");
31642
+ }
31385
31643
  return {
31386
31644
  bundleHash: readString(value.bundleHash, "page.bundleHash"),
31387
31645
  bundlePath: readString(value.bundlePath, "page.bundlePath"),
31388
31646
  contract: readString(value.contract, "page.contract"),
31389
31647
  framework: value.framework,
31390
31648
  pageId: readString(value.pageId, "page.pageId"),
31391
- propsSchemaHash: readString(value.propsSchemaHash, "page.propsSchemaHash")
31649
+ propsSchemaHash: readString(value.propsSchemaHash, "page.propsSchemaHash"),
31650
+ ...styleBundleHash && styleBundlePath ? { styleBundleHash, styleBundlePath } : {}
31392
31651
  };
31393
31652
  };
31394
31653
  var parseCompatibilityRoute = (value) => {
@@ -31420,14 +31679,23 @@ var validateProducerModule = (module) => {
31420
31679
  }
31421
31680
  return module;
31422
31681
  };
31423
- var normalizePage = (page) => ({
31424
- bundleHash: requireNonEmpty(page.bundleHash, "page.bundleHash"),
31425
- bundlePath: requireNonEmpty(page.bundlePath, "page.bundlePath"),
31426
- contract: requireNonEmpty(page.contract, "page.contract"),
31427
- framework: page.framework,
31428
- pageId: requireNonEmpty(page.pageId, "page.pageId"),
31429
- propsSchemaHash: requireNonEmpty(page.propsSchemaHash, "page.propsSchemaHash")
31430
- });
31682
+ var normalizePage = (page) => {
31683
+ if (Boolean(page.styleBundleHash) !== Boolean(page.styleBundlePath)) {
31684
+ throw new TypeError("Compatibility page style hash and path must be provided together.");
31685
+ }
31686
+ return {
31687
+ bundleHash: requireNonEmpty(page.bundleHash, "page.bundleHash"),
31688
+ bundlePath: requireNonEmpty(page.bundlePath, "page.bundlePath"),
31689
+ contract: requireNonEmpty(page.contract, "page.contract"),
31690
+ framework: page.framework,
31691
+ pageId: requireNonEmpty(page.pageId, "page.pageId"),
31692
+ propsSchemaHash: requireNonEmpty(page.propsSchemaHash, "page.propsSchemaHash"),
31693
+ ...page.styleBundleHash && page.styleBundlePath ? {
31694
+ styleBundleHash: requireNonEmpty(page.styleBundleHash, "page.styleBundleHash"),
31695
+ styleBundlePath: requireNonEmpty(page.styleBundlePath, "page.styleBundlePath")
31696
+ } : {}
31697
+ };
31698
+ };
31431
31699
  var normalizeRoute = (route) => {
31432
31700
  if (!route.pattern.startsWith("/")) {
31433
31701
  throw new TypeError("route.pattern must start with /.");
@@ -31576,6 +31844,64 @@ var matchesAbsoluteMobileRoutePattern = (pattern, pathname) => {
31576
31844
  var resolveAbsoluteMobileRoute = (routes, pathname, method = "GET") => routes.find((route) => route.method === method && matchesAbsoluteMobileRoutePattern(route.pattern, pathname));
31577
31845
 
31578
31846
  // src/mobile/compatibilityDispatcher.ts
31847
+ var MOBILE_WEBVIEW_ORIGINS = new Set([
31848
+ "capacitor://localhost",
31849
+ "http://localhost",
31850
+ "https://localhost"
31851
+ ]);
31852
+ var MOBILE_REQUEST_HEADER_NAMES = Object.values(MOBILE_PAGE_REQUEST_HEADERS);
31853
+ var MOBILE_CORS_ALLOW_HEADERS = [
31854
+ "accept",
31855
+ "content-type",
31856
+ "authorization",
31857
+ "hx-current-url",
31858
+ "hx-request",
31859
+ "hx-target",
31860
+ "hx-trigger",
31861
+ "hx-trigger-name",
31862
+ ...MOBILE_REQUEST_HEADER_NAMES
31863
+ ].join(", ");
31864
+ var MOBILE_CORS_METHODS = new Set([
31865
+ "DELETE",
31866
+ "GET",
31867
+ "HEAD",
31868
+ "OPTIONS",
31869
+ "PATCH",
31870
+ "POST",
31871
+ "PUT"
31872
+ ]);
31873
+ var mobileWebViewOrigin = (request) => {
31874
+ const origin = request.headers.get("origin");
31875
+ return origin && MOBILE_WEBVIEW_ORIGINS.has(origin) ? origin : undefined;
31876
+ };
31877
+ var applyMobileCorsHeaders = (response, origin) => {
31878
+ response.headers.set("access-control-allow-credentials", "true");
31879
+ response.headers.set("access-control-allow-origin", origin);
31880
+ response.headers.append("vary", "Origin");
31881
+ return response;
31882
+ };
31883
+ var mobilePreflightResponse = (request) => {
31884
+ if (request.method !== "OPTIONS")
31885
+ return;
31886
+ const origin = mobileWebViewOrigin(request);
31887
+ if (!origin)
31888
+ return;
31889
+ const requestedHeaders = request.headers.get("access-control-request-headers");
31890
+ const requestedMethod = request.headers.get("access-control-request-method")?.toUpperCase() ?? "";
31891
+ if (!MOBILE_CORS_METHODS.has(requestedMethod))
31892
+ return;
31893
+ return new Response(null, {
31894
+ headers: {
31895
+ "access-control-allow-credentials": "true",
31896
+ "access-control-allow-headers": requestedHeaders || MOBILE_CORS_ALLOW_HEADERS,
31897
+ "access-control-allow-methods": [...MOBILE_CORS_METHODS].join(", "),
31898
+ "access-control-allow-origin": origin,
31899
+ "access-control-max-age": "600",
31900
+ vary: "Origin, Access-Control-Request-Headers"
31901
+ },
31902
+ status: 204
31903
+ });
31904
+ };
31579
31905
  var artifactOwnsRequest = (artifact, pageId, request) => {
31580
31906
  const { pathname } = new URL(request.url);
31581
31907
  return artifact.routes.some((route) => route.pageId === pageId && route.method === request.method && matchesAbsoluteMobileRoutePattern(route.pattern, pathname));
@@ -31603,6 +31929,9 @@ var createAbsoluteMobileCompatibilityDispatcher = (options) => {
31603
31929
  return new Elysia2({ name: "absolutejs-mobile-compatibility-dispatcher" }).request(async ({ request }) => {
31604
31930
  if (getCurrentAbsoluteMobileProducerContext())
31605
31931
  return;
31932
+ const preflight = mobilePreflightResponse(request);
31933
+ if (preflight)
31934
+ return preflight;
31606
31935
  const parsed = parseAbsoluteMobilePageRequest(request);
31607
31936
  if (parsed.kind !== "mobile")
31608
31937
  return;
@@ -31626,6 +31955,11 @@ var createAbsoluteMobileCompatibilityDispatcher = (options) => {
31626
31955
  console.error(`[Mobile] Failed to load retained producer ${resolved.artifact.releaseId}:`, error);
31627
31956
  return createAbsoluteMobilePageErrorResponse(parsed.client.pageId);
31628
31957
  }
31958
+ }).afterHandle("global", ({ request, responseValue }) => {
31959
+ const origin = mobileWebViewOrigin(request);
31960
+ if (!origin || !(responseValue instanceof Response))
31961
+ return;
31962
+ applyMobileCorsHeaders(responseValue, origin);
31629
31963
  }).as("global");
31630
31964
  };
31631
31965
 
@@ -31671,8 +32005,9 @@ var normalizeEntry = (entry) => {
31671
32005
  };
31672
32006
  var normalizeProductionOrigin = (value) => {
31673
32007
  const parsed = new URL(requireText(value, "mobile.server.productionOrigin"));
31674
- if (parsed.protocol !== "https:") {
31675
- throw new TypeError("mobile.server.productionOrigin must use HTTPS in production.");
32008
+ const isLoopbackHttp = parsed.protocol === "http:" && (parsed.hostname === "localhost" || parsed.hostname === "127.0.0.1" || parsed.hostname === "[::1]");
32009
+ if (parsed.protocol !== "https:" && !isLoopbackHttp) {
32010
+ throw new TypeError("mobile.server.productionOrigin must use HTTPS, except for a loopback development origin.");
31676
32011
  }
31677
32012
  if (parsed.username || parsed.password || parsed.pathname !== "/" || parsed.search || parsed.hash) {
31678
32013
  throw new TypeError("mobile.server.productionOrigin must be an origin without credentials, path, query, or hash.");
@@ -31696,9 +32031,8 @@ var normalizeHosts = (hosts, productionOrigin) => {
31696
32031
  }
31697
32032
  return value;
31698
32033
  };
31699
- const normalized = new Set([
31700
- normalizeHostname(new URL(productionOrigin).hostname)
31701
- ]);
32034
+ const productionHostname = new URL(productionOrigin).hostname;
32035
+ const normalized = new Set(productionHostname === "[::1]" ? [] : [normalizeHostname(productionHostname)]);
31702
32036
  for (const host of hosts ?? []) {
31703
32037
  normalized.add(normalizeHostname(host));
31704
32038
  }
@@ -31713,6 +32047,15 @@ var normalizeAppleAppIdPrefix = (value) => {
31713
32047
  }
31714
32048
  return normalized;
31715
32049
  };
32050
+ var normalizeIosVersion = (value) => {
32051
+ if (value === undefined)
32052
+ return;
32053
+ const normalized = requireText(value, "mobile.ios.version");
32054
+ if (!/^\d+(?:\.\d+){0,2}$/u.test(normalized)) {
32055
+ throw new TypeError("mobile.ios.version must contain one to three dot-separated integer components, for example 1.4.0.");
32056
+ }
32057
+ return normalized;
32058
+ };
31716
32059
  var normalizeCertificateFingerprints = (values) => [
31717
32060
  ...new Set((values ?? []).map((value) => requireText(value, "mobile.deepLinks.android.sha256CertificateFingerprints").replaceAll(":", "").toUpperCase()).map((value) => {
31718
32061
  if (!CERTIFICATE_FINGERPRINT_PATTERN.test(value)) {
@@ -31727,7 +32070,7 @@ var normalizeAbsoluteMobileConfig = (config, projectRoot) => {
31727
32070
  throw new TypeError("mobile.appId must use reverse-domain notation, for example com.example.app.");
31728
32071
  }
31729
32072
  const productionOrigin = normalizeProductionOrigin(config.server.productionOrigin);
31730
- const deepLinkScheme = config.deepLinks?.scheme?.trim().toLowerCase();
32073
+ const deepLinkScheme = (config.deepLinks?.scheme ?? appId).trim().toLowerCase();
31731
32074
  if (deepLinkScheme && !SCHEME_PATTERN.test(deepLinkScheme)) {
31732
32075
  throw new TypeError("mobile.deepLinks.scheme is not a valid URL scheme.");
31733
32076
  }
@@ -31741,6 +32084,7 @@ var normalizeAbsoluteMobileConfig = (config, projectRoot) => {
31741
32084
  deepLinkScheme,
31742
32085
  engine: "capacitor",
31743
32086
  entry: normalizeEntry(config.entry),
32087
+ iosVersion: normalizeIosVersion(config.ios?.version),
31744
32088
  nativeProjectDirectory: resolveProjectPath(projectRoot, config.nativeProject?.directory ?? "mobile", "mobile.nativeProject.directory"),
31745
32089
  platforms: normalizePlatforms(config.platforms),
31746
32090
  productionOrigin
@@ -32496,7 +32840,7 @@ var registerIconVersioning = (buildDir) => {
32496
32840
  if (cached !== undefined)
32497
32841
  return cached;
32498
32842
  const path = href.split("?")[0] ?? href;
32499
- const filePath = join50(buildDir, path);
32843
+ const filePath = join51(buildDir, path);
32500
32844
  let versioned = href;
32501
32845
  if (existsSync39(filePath)) {
32502
32846
  const hash = createHash8("sha256").update(readFileSync33(filePath)).digest("hex").slice(0, ICON_HASH_LENGTH);
@@ -32626,13 +32970,13 @@ var loadPrerenderMap = (prerenderDir) => {
32626
32970
  continue;
32627
32971
  const name = basename18(entry, ".html");
32628
32972
  const route = name === "index" ? "/" : `/${name}`;
32629
- map.set(route, join50(prerenderDir, entry));
32973
+ map.set(route, join51(prerenderDir, entry));
32630
32974
  }
32631
32975
  return map;
32632
32976
  };
32633
32977
  var loadMobileCompatibilityPlugin = async (buildDir) => {
32634
- const root = join50(buildDir, ".absolutejs", "mobile-compatibility");
32635
- if (!existsSync39(join50(root, "current.json"))) {
32978
+ const root = join51(buildDir, ".absolutejs", "mobile-compatibility");
32979
+ if (!existsSync39(join51(root, "current.json"))) {
32636
32980
  return new Elysia9({ name: "absolutejs-mobile-compatibility-empty" });
32637
32981
  }
32638
32982
  const options = await loadAbsoluteMobileMaterializedBundle(root);
@@ -32693,12 +33037,12 @@ var prepare = async (configOrPath) => {
32693
33037
  setCurrentPageIslandMetadata(await loadPageIslandMetadata(config));
32694
33038
  recordStep("load production manifest and island metadata", stepStartedAt);
32695
33039
  stepStartedAt = performance.now();
32696
- const conventionsPath = join50(buildDir, "conventions.json");
33040
+ const conventionsPath = join51(buildDir, "conventions.json");
32697
33041
  if (existsSync39(conventionsPath)) {
32698
33042
  const conventions2 = JSON.parse(readFileSync33(conventionsPath, "utf-8"));
32699
33043
  setConventions(conventions2);
32700
33044
  }
32701
- const spaRoutesPath = join50(buildDir, "spa-routes.json");
33045
+ const spaRoutesPath = join51(buildDir, "spa-routes.json");
32702
33046
  if (existsSync39(spaRoutesPath)) {
32703
33047
  setSpaRouteManifest(JSON.parse(readFileSync33(spaRoutesPath, "utf-8")));
32704
33048
  }
@@ -32711,7 +33055,7 @@ var prepare = async (configOrPath) => {
32711
33055
  prefix: "",
32712
33056
  staticLimit: MAX_STATIC_ROUTE_COUNT
32713
33057
  });
32714
- const generatedAssetsRoot = join50(buildDir, ".absolutejs");
33058
+ const generatedAssetsRoot = join51(buildDir, ".absolutejs");
32715
33059
  const generatedAssetsPlugin = new Elysia9({
32716
33060
  name: "absolutejs-generated-assets"
32717
33061
  }).get("/.absolutejs/*", async ({ params, set }) => {
@@ -32749,7 +33093,7 @@ var prepare = async (configOrPath) => {
32749
33093
  responseValue.headers.set("cache-control", isFingerprintedAsset(pathname) ? "public, max-age=31536000, immutable" : "public, max-age=0, must-revalidate");
32750
33094
  });
32751
33095
  stepStartedAt = performance.now();
32752
- const prerenderDir = join50(buildDir, "_prerendered");
33096
+ const prerenderDir = join51(buildDir, "_prerendered");
32753
33097
  const prerenderMap = loadPrerenderMap(prerenderDir);
32754
33098
  const mobileCompatibilityPlugin = await loadMobileCompatibilityPlugin(buildDir);
32755
33099
  const mobileAssociationPlugin = createAbsoluteMobileAssociationPlugin(config.mobile, process.cwd(), { requireAll: true });
@@ -32822,10 +33166,10 @@ import {
32822
33166
  readFileSync as readFileSync34,
32823
33167
  rmSync as rmSync4
32824
33168
  } from "fs";
32825
- import { join as join51 } from "path";
32826
- var CERT_DIR = join51(process.cwd(), ".absolutejs");
32827
- var CERT_PATH = join51(CERT_DIR, "cert.pem");
32828
- var KEY_PATH = join51(CERT_DIR, "key.pem");
33169
+ import { join as join52 } from "path";
33170
+ var CERT_DIR = join52(process.cwd(), ".absolutejs");
33171
+ var CERT_PATH = join52(CERT_DIR, "cert.pem");
33172
+ var KEY_PATH = join52(CERT_DIR, "key.pem");
32829
33173
  var CERT_VALIDITY_DAYS = 365;
32830
33174
  var devLog = (msg) => console.log(`\x1B[2m${new Date().toLocaleTimeString()}\x1B[0m \x1B[36m[dev]\x1B[0m ${msg}`);
32831
33175
  var devWarn = (msg) => console.log(`\x1B[2m${new Date().toLocaleTimeString()}\x1B[0m \x1B[33m[dev]\x1B[0m \x1B[33m${msg}\x1B[0m`);
@@ -32945,12 +33289,12 @@ import {
32945
33289
  writeFileSync as writeFileSync11
32946
33290
  } from "fs";
32947
33291
  import { homedir as homedir2 } from "os";
32948
- import { basename as basename19, join as join52 } from "path";
33292
+ import { basename as basename19, join as join53 } from "path";
32949
33293
  var registeredPids = new Set;
32950
33294
  var exitHandlerRegistered = false;
32951
- var instanceFilePath = (pid) => join52(instanceRegistryDir(), `${pid}.json`);
32952
- var instanceLogPath = (pid) => join52(instanceRegistryDir(), `${pid}.log`);
32953
- var instanceRegistryDir = () => join52(homedir2(), ".absolutejs", "instances");
33295
+ var instanceFilePath = (pid) => join53(instanceRegistryDir(), `${pid}.json`);
33296
+ var instanceLogPath = (pid) => join53(instanceRegistryDir(), `${pid}.log`);
33297
+ var instanceRegistryDir = () => join53(homedir2(), ".absolutejs", "instances");
32954
33298
  var removeInstanceFilesSync = (pid) => {
32955
33299
  try {
32956
33300
  unlinkSync2(instanceFilePath(pid));
@@ -32985,7 +33329,7 @@ var registerInstance = (record) => {
32985
33329
  return record;
32986
33330
  };
32987
33331
  var resolveProjectName = (cwd2) => {
32988
- const parsed = readJsonFile(join52(cwd2, "package.json"));
33332
+ const parsed = readJsonFile(join53(cwd2, "package.json"));
32989
33333
  if (parsed !== null && typeof parsed === "object" && typeof parsed.name === "string" && parsed.name.trim().length > 0) {
32990
33334
  return parsed.name;
32991
33335
  }
@@ -39376,7 +39720,7 @@ var getEnv = (key) => {
39376
39720
  };
39377
39721
  // src/utils/projectRoot.ts
39378
39722
  import { existsSync as existsSync43 } from "fs";
39379
- import { dirname as dirname32, resolve as resolve50 } from "path";
39723
+ import { dirname as dirname33, resolve as resolve50 } from "path";
39380
39724
  var CONFIG_CANDIDATES = [
39381
39725
  "absolute.config.ts",
39382
39726
  "absolute.config.js",
@@ -39397,7 +39741,7 @@ var findProjectRoot = () => {
39397
39741
  if (packageRoot === null && existsSync43(resolve50(directory, "package.json"))) {
39398
39742
  packageRoot = directory;
39399
39743
  }
39400
- const parent = dirname32(directory);
39744
+ const parent = dirname33(directory);
39401
39745
  if (parent === directory) {
39402
39746
  return packageRoot ?? start;
39403
39747
  }
@@ -39643,5 +39987,5 @@ export {
39643
39987
  ANGULAR_INIT_TIMEOUT_MS
39644
39988
  };
39645
39989
 
39646
- //# debugId=9019476FB119209B64756E2164756E21
39990
+ //# debugId=C36F3DE38F8FB23964756E2164756E21
39647
39991
  //# sourceMappingURL=index.js.map