@absolutejs/absolute 0.20.0-beta.174 → 0.20.0-beta.176

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 (84) hide show
  1. package/CHANGELOG.md +32 -0
  2. package/changelog.json +76 -0
  3. package/dist/angular/browser.js +13 -2
  4. package/dist/angular/browser.js.map +3 -3
  5. package/dist/angular/components/core/streamingSlotRegistrar.js +1 -1
  6. package/dist/angular/components/core/streamingSlotRegistry.js +2 -2
  7. package/dist/angular/index.js +67 -8
  8. package/dist/angular/index.js.map +10 -8
  9. package/dist/angular/server.js +67 -8
  10. package/dist/angular/server.js.map +10 -8
  11. package/dist/build.js +315 -120
  12. package/dist/build.js.map +21 -19
  13. package/dist/cli/{compile-n6fs2vmx.js → compile-w2z6c9vt.js} +1 -1
  14. package/dist/cli/{dev-6h1f0mzq.js → dev-8br5mr7t.js} +16 -2
  15. package/dist/cli/{index-mqevg32w.js → index-6522t968.js} +21 -2
  16. package/dist/cli/{index-bhyd3ejc.js → index-7z1hh3fg.js} +1 -1
  17. package/dist/cli/index.js +6 -6
  18. package/dist/cli/{islands-vk05sj6v.js → islands-bx67g15t.js} +4 -4
  19. package/dist/cli/{mobile-62b6j3j7.js → mobile-we5q51ey.js} +2 -2
  20. package/dist/cli/{start-jh6kyp92.js → start-srs11bm8.js} +2 -2
  21. package/dist/client/chunks/index-4j1snyh2.js +18 -0
  22. package/dist/client/chunks/index-4j1snyh2.js.map +10 -0
  23. package/dist/client/chunks/{index-6b66nzyf.js → index-a3rpg5kw.js} +6 -16
  24. package/dist/client/chunks/{index-6b66nzyf.js.map → index-a3rpg5kw.js.map} +3 -4
  25. package/dist/client/chunks/{islands-s2ta5ajb.js → islands-mfjmdwnb.js} +11 -4
  26. package/dist/client/chunks/{islands-s2ta5ajb.js.map → islands-mfjmdwnb.js.map} +3 -3
  27. package/dist/client/chunks/{react-dcvkaba2.js → react-sprprqzs.js} +20 -4
  28. package/dist/client/chunks/react-sprprqzs.js.map +10 -0
  29. package/dist/client/chunks/svelte-6ewphsvj.js +30 -0
  30. package/dist/client/chunks/svelte-6ewphsvj.js.map +10 -0
  31. package/dist/client/chunks/{vue-a84fzp3v.js → vue-db6ppn1f.js} +14 -4
  32. package/dist/client/chunks/vue-db6ppn1f.js.map +10 -0
  33. package/dist/client/index.js +65 -8
  34. package/dist/client/index.js.map +4 -4
  35. package/dist/client/navigation.js +5 -3
  36. package/dist/client/navigation.js.map +2 -2
  37. package/dist/client/prefetch.js +1 -1
  38. package/dist/dev/client/handlers/islands.ts +85 -0
  39. package/dist/dev/client/hmrClient.ts +6 -0
  40. package/dist/index.js +460 -244
  41. package/dist/index.js.map +23 -21
  42. package/dist/islands/index.js +57 -10
  43. package/dist/islands/index.js.map +9 -7
  44. package/dist/react/browser.js +15 -4
  45. package/dist/react/browser.js.map +5 -5
  46. package/dist/react/components/client.js +506 -0
  47. package/dist/react/components/index.js +14 -15
  48. package/dist/react/components/index.js.map +4 -4
  49. package/dist/react/components/server/index.js +728 -0
  50. package/dist/react/hooks/index.js +14 -15
  51. package/dist/react/hooks/index.js.map +4 -4
  52. package/dist/react/index.js +66 -6
  53. package/dist/react/index.js.map +11 -9
  54. package/dist/react/router/browser.js +7 -8
  55. package/dist/react/router/browser.js.map +4 -4
  56. package/dist/react/router/index.js +7 -8
  57. package/dist/react/router/index.js.map +4 -4
  58. package/dist/react/server.js +14 -1
  59. package/dist/react/server.js.map +4 -4
  60. package/dist/src/build/buildReactServerComponents.d.ts +4 -0
  61. package/dist/src/build/islandEntries.d.ts +5 -0
  62. package/dist/src/client/hydrators/react.d.ts +7 -0
  63. package/dist/src/client/hydrators/svelte.d.ts +3 -0
  64. package/dist/src/client/hydrators/vue.d.ts +3 -0
  65. package/dist/src/client/preserveIslandMarkup.d.ts +5 -0
  66. package/dist/src/core/islandServerGeneration.d.ts +3 -0
  67. package/dist/src/react/components/client.d.ts +4 -0
  68. package/dist/src/react/components/server/index.d.ts +8 -0
  69. package/dist/src/react/serverComponents/constants.d.ts +2 -1
  70. package/dist/svelte/index.js +66 -6
  71. package/dist/svelte/index.js.map +10 -8
  72. package/dist/svelte/server.js +38 -3
  73. package/dist/svelte/server.js.map +6 -5
  74. package/dist/types/build.d.ts +3 -2
  75. package/dist/types/globals.d.ts +15 -0
  76. package/dist/vue/browser.js +26 -16
  77. package/dist/vue/browser.js.map +5 -5
  78. package/dist/vue/index.js +65 -21
  79. package/dist/vue/index.js.map +10 -9
  80. package/package.json +1 -1
  81. package/dist/client/chunks/react-dcvkaba2.js.map +0 -10
  82. package/dist/client/chunks/svelte-4yfa5bxa.js +0 -17
  83. package/dist/client/chunks/svelte-4yfa5bxa.js.map +0 -10
  84. package/dist/client/chunks/vue-a84fzp3v.js.map +0 -10
package/dist/build.js CHANGED
@@ -1173,8 +1173,9 @@ var defineIslandComponent = (component, options) => ({
1173
1173
  var init_islands = () => {};
1174
1174
 
1175
1175
  // src/build/islandEntries.ts
1176
- import { mkdirSync as mkdirSync2, rmSync, writeFileSync as writeFileSync2 } from "fs";
1176
+ import { mkdirSync as mkdirSync2, rmSync, statSync, writeFileSync as writeFileSync2 } from "fs";
1177
1177
  import { dirname, extname as extname3, join as join2, relative, resolve as resolve3 } from "path";
1178
+ import { fileURLToPath } from "url";
1178
1179
  var frameworks, isRecord2 = (value) => typeof value === "object" && value !== null, resolveRegistryExport = (mod) => {
1179
1180
  if (isRecord2(mod.islandRegistry))
1180
1181
  return mod.islandRegistry;
@@ -1186,9 +1187,24 @@ var frameworks, isRecord2 = (value) => typeof value === "object" && value !== nu
1186
1187
  return importPath.startsWith(".") ? importPath : `./${importPath}`;
1187
1188
  }, isIdentifier = (value) => /^[A-Za-z_$][A-Za-z0-9_$]*$/.test(value), resolveIslandSourcePath = (registryPath, sourcePath) => {
1188
1189
  if (sourcePath.startsWith("file://")) {
1189
- return new URL(sourcePath).pathname;
1190
+ return fileURLToPath(sourcePath);
1190
1191
  }
1191
1192
  return resolve3(dirname(registryPath), sourcePath);
1193
+ }, isExistingFile = (path) => {
1194
+ try {
1195
+ return statSync(path).isFile();
1196
+ } catch {
1197
+ return false;
1198
+ }
1199
+ }, resolveIslandSourceFile = (registryPath, sourcePath) => {
1200
+ const joinedPath = resolveIslandSourcePath(registryPath, sourcePath);
1201
+ if (isExistingFile(joinedPath))
1202
+ return joinedPath;
1203
+ try {
1204
+ return Bun.resolveSync(joinedPath, dirname(registryPath));
1205
+ } catch {
1206
+ return joinedPath;
1207
+ }
1192
1208
  }, getObjectPropertyName = (name) => {
1193
1209
  if (lazyTypescript.isIdentifier(name) || lazyTypescript.isStringLiteral(name)) {
1194
1210
  return name.text;
@@ -1907,9 +1923,9 @@ var PAGE_PATTERN = "*.{tsx,jsx,ts,js}", SOURCE_FILTER, USE_CLIENT_PATTERN, MANIF
1907
1923
  }, clientModuleId = (projectRoot, path) => createHash2("sha256").update(relative4(projectRoot, path).replace(/\\/g, "/")).digest("hex").slice(0, MODULE_ID_LENGTH), isClientModuleSource = (source) => USE_CLIENT_PATTERN.test(source), scanExportNames = (path, source) => {
1908
1924
  const transpiler = new Transpiler({ loader: loaderFor(path) });
1909
1925
  return transpiler.scan(source).exports;
1910
- }, clientReferenceSource = (module) => {
1926
+ }, clientReferenceSource = (module, flightServer) => {
1911
1927
  const lines = [
1912
- `import { registerClientReference } from 'react-server-dom-webpack/server.edge';`,
1928
+ `import { registerClientReference } from ${JSON.stringify(flightServer)};`,
1913
1929
  `import { clientManifest } from ${JSON.stringify(MANIFEST_SPECIFIER)};`,
1914
1930
  `const id = ${JSON.stringify(module.id)};`,
1915
1931
  `clientManifest[id] = { chunks: [id, id], id, name: '' };`,
@@ -1921,7 +1937,16 @@ var PAGE_PATTERN = "*.{tsx,jsx,ts,js}", SOURCE_FILTER, USE_CLIENT_PATTERN, MANIF
1921
1937
  return `${lines.join(`
1922
1938
  `)}
1923
1939
  `;
1940
+ }, REACT_COMPONENTS_SPECIFIER, resolveReactComponentsServerEntry = (importer) => {
1941
+ try {
1942
+ const regularEntry = Bun.resolveSync("@absolutejs/absolute/react/components", dirname2(importer));
1943
+ const serverEntry = join4(dirname2(regularEntry), "server", "index.js");
1944
+ return existsSync4(serverEntry) ? serverEntry : undefined;
1945
+ } catch {
1946
+ return;
1947
+ }
1924
1948
  }, createClientReferencePlugin = (projectRoot, clientModules) => {
1949
+ const flightServer = Bun.resolveSync("react-server-dom-webpack/server.edge", projectRoot);
1925
1950
  const plugin = {
1926
1951
  name: "absolute-react-server-client-references",
1927
1952
  setup(builder) {
@@ -1934,6 +1959,10 @@ var PAGE_PATTERN = "*.{tsx,jsx,ts,js}", SOURCE_FILTER, USE_CLIENT_PATTERN, MANIF
1934
1959
  `,
1935
1960
  loader: "js"
1936
1961
  }));
1962
+ builder.onResolve({ filter: REACT_COMPONENTS_SPECIFIER }, (args) => {
1963
+ const path = resolveReactComponentsServerEntry(args.importer);
1964
+ return path ? { path } : undefined;
1965
+ });
1937
1966
  builder.onLoad({ filter: SOURCE_FILTER }, (args) => {
1938
1967
  const source = readFileSync2(args.path, "utf8");
1939
1968
  const loader = loaderFor(args.path);
@@ -1947,7 +1976,7 @@ var PAGE_PATTERN = "*.{tsx,jsx,ts,js}", SOURCE_FILTER, USE_CLIENT_PATTERN, MANIF
1947
1976
  };
1948
1977
  clientModules.set(module.id, module);
1949
1978
  return {
1950
- contents: clientReferenceSource(module),
1979
+ contents: clientReferenceSource(module, flightServer),
1951
1980
  loader: "js"
1952
1981
  };
1953
1982
  });
@@ -2071,7 +2100,18 @@ hydrateRoot(document, createElement(Root));
2071
2100
  mkdirSync4(dirname2(path), { recursive: true });
2072
2101
  writeFileSync3(path, contents);
2073
2102
  return path;
2074
- }, pageEntryName = (pagePath) => toPascal(basename2(pagePath, extname4(pagePath))), buildReactServerComponents = async ({
2103
+ }, pageEntryName = (pagePath) => toPascal(basename2(pagePath, extname4(pagePath))), endsWithPageSuffix = (name) => name.length > REACT_SERVER_PAGE_MANIFEST_SUFFIX.length && name.endsWith(REACT_SERVER_PAGE_MANIFEST_SUFFIX), pageManifestKeys = (name, names) => {
2104
+ const doubled = `${name}${REACT_SERVER_PAGE_MANIFEST_SUFFIX}`;
2105
+ if (!endsWithPageSuffix(name))
2106
+ return { keys: [doubled] };
2107
+ const base = name.slice(0, -REACT_SERVER_PAGE_MANIFEST_SUFFIX.length);
2108
+ if (!names.has(base))
2109
+ return { keys: [name, doubled] };
2110
+ return {
2111
+ collision: `React Server Components pages ${base} and ${name} both map to the manifest key "${name}"; ${base} keeps it and ${name} is only reachable as "${doubled}". Rename one of them.`,
2112
+ keys: [doubled]
2113
+ };
2114
+ }, buildReactServerComponents = async ({
2075
2115
  buildPath,
2076
2116
  directory,
2077
2117
  isDev,
@@ -2172,10 +2212,15 @@ hydrateRoot(document, createElement(Root));
2172
2212
  [REACT_SERVER_CLIENT_MANIFEST_KEY]: clientUrl,
2173
2213
  [REACT_SERVER_RENDERER_MANIFEST_KEY]: resolve6(ssrOutput.path)
2174
2214
  };
2215
+ const pageKeys = reactServerPageManifestKeys(pageEntries.map((page) => page.name));
2216
+ for (const collision of pageKeys.collisions)
2217
+ logWarn(collision);
2175
2218
  for (const page of pageEntries) {
2176
2219
  const output = findOutput(serverResult.outputs, page.name);
2177
- if (output)
2178
- manifest[`${page.name}${REACT_SERVER_PAGE_MANIFEST_SUFFIX}`] = resolve6(output.path);
2220
+ if (!output)
2221
+ continue;
2222
+ for (const key of pageKeys.keys.get(page.name) ?? [])
2223
+ manifest[key] = resolve6(output.path);
2179
2224
  }
2180
2225
  const result = {
2181
2226
  logs,
@@ -2205,11 +2250,24 @@ hydrateRoot(document, createElement(Root));
2205
2250
  ...options,
2206
2251
  directory: absoluteDirectory
2207
2252
  });
2253
+ }, reactServerPageManifestKeys = (pageNames) => {
2254
+ const names = new Set(pageNames);
2255
+ const keys = new Map;
2256
+ const collisions = [];
2257
+ for (const name of pageNames) {
2258
+ const page = pageManifestKeys(name, names);
2259
+ keys.set(name, page.keys);
2260
+ if (page.collision)
2261
+ collisions.push(page.collision);
2262
+ }
2263
+ return { collisions, keys };
2208
2264
  };
2209
2265
  var init_buildReactServerComponents = __esm(() => {
2266
+ init_logger();
2210
2267
  init_validateSafePath();
2211
2268
  SOURCE_FILTER = /\.[cm]?[jt]sx?$/;
2212
2269
  USE_CLIENT_PATTERN = /^(?:\s|\/\/[^\n]*\n|\/\*[\s\S]*?\*\/)*(['"])use client\1/;
2270
+ REACT_COMPONENTS_SPECIFIER = /^@absolutejs\/absolute\/react\/components$/;
2213
2271
  });
2214
2272
 
2215
2273
  // src/build/wrapHTMLScript.ts
@@ -3483,6 +3541,19 @@ var init_ssrRender = __esm(() => {
3483
3541
  selectorCache = new Map;
3484
3542
  });
3485
3543
 
3544
+ // src/dev/client/cspNonce.ts
3545
+ var applyPageNonce = (element) => {
3546
+ const nonce = readPageNonce();
3547
+ if (nonce)
3548
+ element.nonce = nonce;
3549
+ return element;
3550
+ }, readPageNonce = () => {
3551
+ if (typeof document === "undefined")
3552
+ return;
3553
+ const carrier = document.querySelector("script[nonce], style[nonce]");
3554
+ return carrier?.nonce || undefined;
3555
+ };
3556
+
3486
3557
  // src/angular/islands.ts
3487
3558
  var angularIslandSelector = "abs-angular-island", getAngularIslandSelector = (_islandId) => angularIslandSelector, wrapperMetadataCache, requestRenderCache, getRequestRenderCache = () => {
3488
3559
  const requestId = getSsrContextId();
@@ -4386,7 +4457,7 @@ import {
4386
4457
  relative as relative6,
4387
4458
  resolve as resolve9
4388
4459
  } from "path";
4389
- import { fileURLToPath, pathToFileURL } from "url";
4460
+ import { fileURLToPath as fileURLToPath2, pathToFileURL } from "url";
4390
4461
  var CSS_EXTENSION_PATTERN, STYLE_EXTENSION_PATTERN, STYLE_MODULE_EXTENSION_PATTERN, STYLE_LANGUAGE_PATTERN, importOptionalPeer, requireOptionalPeer, requireFromCwd, isPreprocessableStylePath = (filePath) => STYLE_EXTENSION_PATTERN.test(filePath), isStyleModulePath = (filePath) => STYLE_MODULE_EXTENSION_PATTERN.test(filePath), isStylePath = (filePath) => /\.(css|s[ac]ss|less|styl(?:us)?)$/i.test(filePath), getStyleBaseName = (filePath) => filePath.replace(/\.(css|s[ac]ss|less|styl(?:us)?)$/i, ""), getStyleLanguage = (filePathOrLanguage) => {
4391
4462
  const normalized = filePathOrLanguage.toLowerCase();
4392
4463
  if (normalized === "scss" || normalized.endsWith(".scss"))
@@ -4618,12 +4689,12 @@ ${contents}` : contents, normalizePostcssModule = (mod) => {
4618
4689
  return result.css;
4619
4690
  }, createSassImporter = (entryFile, loadPaths, language, config, deps) => ({
4620
4691
  canonicalize(specifier, options) {
4621
- const fromDirectory = options.containingUrl ? dirname4(fileURLToPath(options.containingUrl)) : dirname4(entryFile);
4692
+ const fromDirectory = options.containingUrl ? dirname4(fileURLToPath2(options.containingUrl)) : dirname4(entryFile);
4622
4693
  const resolved = resolveImportPath(specifier, fromDirectory, loadPaths, language, config);
4623
4694
  return resolved ? new URL(pathToFileURL(resolve9(resolved)).href) : null;
4624
4695
  },
4625
4696
  load(canonicalUrl) {
4626
- const filePath = fileURLToPath(canonicalUrl);
4697
+ const filePath = fileURLToPath2(canonicalUrl);
4627
4698
  deps?.add(filePath);
4628
4699
  const fileLanguage = getStyleLanguage(filePath);
4629
4700
  if (fileLanguage !== "scss" && fileLanguage !== "sass" && fileLanguage !== null)
@@ -4735,7 +4806,7 @@ ${contents}` : contents, normalizePostcssModule = (mod) => {
4735
4806
  for (const url of loadedUrls) {
4736
4807
  if (url.protocol !== "file:")
4737
4808
  continue;
4738
- const dep = fileURLToPath(url);
4809
+ const dep = fileURLToPath2(url);
4739
4810
  if (resolve9(dep) === resolve9(filePath))
4740
4811
  continue;
4741
4812
  deps.add(dep);
@@ -4921,7 +4992,7 @@ ${contents}` : contents, normalizePostcssModule = (mod) => {
4921
4992
  for (const url of loadedUrls) {
4922
4993
  if (url.protocol !== "file:")
4923
4994
  continue;
4924
- const dep = fileURLToPath(url);
4995
+ const dep = fileURLToPath2(url);
4925
4996
  if (resolve9(dep) === resolve9(filePath))
4926
4997
  continue;
4927
4998
  addStyleImporter(filePath, dep);
@@ -4976,10 +5047,25 @@ var init_lazyModule = __esm(() => {
4976
5047
  LAZY_RESOLVED_KEY = Symbol.for("absolutejs.svelte.lazy-resolved");
4977
5048
  });
4978
5049
 
5050
+ // src/core/islandServerGeneration.ts
5051
+ var readGeneration = () => globalThis.__absoluteIslandServerGeneration ?? 0, bumpIslandServerGeneration = () => {
5052
+ globalThis.__absoluteIslandServerGeneration = readGeneration() + 1;
5053
+ }, createIslandGenerationGuard = (reset) => {
5054
+ let seen = readGeneration();
5055
+ return () => {
5056
+ const current = readGeneration();
5057
+ if (current === seen)
5058
+ return current;
5059
+ seen = current;
5060
+ reset();
5061
+ return current;
5062
+ };
5063
+ };
5064
+
4979
5065
  // src/core/svelteServerModule.ts
4980
5066
  import { mkdir as mkdir2, readdir as readdir3 } from "fs/promises";
4981
5067
  import { basename as basename3, dirname as dirname5, extname as extname6, join as join10, relative as relative7, resolve as resolve10 } from "path";
4982
- var serverCacheRoot2, compiledModuleCache2, originalSourcePathCache, transpiler, ensureRelativeImportPath = (from, target) => {
5068
+ var serverCacheRoot2, compiledModuleCache2, originalSourcePathCache, syncIslandGeneration, transpiler, ensureRelativeImportPath = (from, target) => {
4983
5069
  const importPath = relative7(dirname5(from), target).replace(/\\/g, "/");
4984
5070
  return importPath.startsWith(".") ? importPath : `./${importPath}`;
4985
5071
  }, processDirectoryEntries = (entries, dir, targetFileName, stack) => {
@@ -5046,7 +5132,9 @@ var serverCacheRoot2, compiledModuleCache2, originalSourcePathCache, transpiler,
5046
5132
  }, getCachedModulePath2 = (sourcePath) => {
5047
5133
  const relativeSourcePath = relative7(process.cwd(), sourcePath).replace(/\\/g, "/");
5048
5134
  const normalizedSourcePath = relativeSourcePath.startsWith("..") ? sourcePath.replace(/[:\\/]/g, "_") : relativeSourcePath;
5049
- return join10(serverCacheRoot2, `${normalizedSourcePath}.server.js`);
5135
+ const generation = syncIslandGeneration();
5136
+ const generationSuffix = generation > 0 ? `.g${generation}` : "";
5137
+ return join10(serverCacheRoot2, `${normalizedSourcePath}${generationSuffix}.server.js`);
5050
5138
  }, resolveSvelteImport = async (spec, from) => {
5051
5139
  if (!spec.startsWith(".") && !spec.startsWith("/")) {
5052
5140
  const resolved = resolvePackageImport(spec);
@@ -5078,6 +5166,7 @@ var serverCacheRoot2, compiledModuleCache2, originalSourcePathCache, transpiler,
5078
5166
  }
5079
5167
  await Bun.write(path, content);
5080
5168
  }, compileSvelteServerModule = async (sourcePath) => {
5169
+ syncIslandGeneration();
5081
5170
  const cachedModulePath = compiledModuleCache2.get(sourcePath);
5082
5171
  if (cachedModulePath) {
5083
5172
  return cachedModulePath;
@@ -5160,6 +5249,10 @@ var init_svelteServerModule = __esm(() => {
5160
5249
  serverCacheRoot2 = join10(process.cwd(), ".absolutejs", "islands", "svelte");
5161
5250
  compiledModuleCache2 = new Map;
5162
5251
  originalSourcePathCache = new Map;
5252
+ syncIslandGeneration = createIslandGenerationGuard(() => {
5253
+ compiledModuleCache2.clear();
5254
+ originalSourcePathCache.clear();
5255
+ });
5163
5256
  transpiler = new Bun.Transpiler({
5164
5257
  loader: "ts",
5165
5258
  target: "browser"
@@ -5167,8 +5260,8 @@ var init_svelteServerModule = __esm(() => {
5167
5260
  });
5168
5261
 
5169
5262
  // src/utils/isFile.ts
5170
- import { statSync } from "fs";
5171
- var isFile = (path) => statSync(path, { throwIfNoEntry: false })?.isFile() ?? false;
5263
+ import { statSync as statSync2 } from "fs";
5264
+ var isFile = (path) => statSync2(path, { throwIfNoEntry: false })?.isFile() ?? false;
5172
5265
  var init_isFile = () => {};
5173
5266
 
5174
5267
  // src/utils/vueCompiler.ts
@@ -5193,13 +5286,15 @@ import { readFileSync as readFileSync6, realpathSync } from "fs";
5193
5286
  import { mkdir as mkdir3 } from "fs/promises";
5194
5287
  import { dirname as dirname6, join as join11, relative as relative8, resolve as resolve11 } from "path";
5195
5288
  var {Transpiler: Transpiler2 } = globalThis.Bun;
5196
- var ISLAND_COMPONENT_ID_LENGTH = 8, serverCacheRoot3, compiledModuleCache3, transpiler2, ensureRelativeImportPath2 = (from, target) => {
5289
+ var ISLAND_COMPONENT_ID_LENGTH = 8, serverCacheRoot3, compiledModuleCache3, syncIslandGeneration2, transpiler2, ensureRelativeImportPath2 = (from, target) => {
5197
5290
  const importPath = relative8(dirname6(from), target).replace(/\\/g, "/");
5198
5291
  return importPath.startsWith(".") ? importPath : `./${importPath}`;
5199
5292
  }, getCachedModulePath3 = (sourcePath) => {
5200
5293
  const relativeSourcePath = relative8(process.cwd(), sourcePath).replace(/\\/g, "/");
5201
5294
  const normalizedSourcePath = relativeSourcePath.startsWith("..") ? sourcePath.replace(/[:\\/]/g, "_") : relativeSourcePath;
5202
- return join11(serverCacheRoot3, `${normalizedSourcePath}.server.js`);
5295
+ const generation = syncIslandGeneration2();
5296
+ const generationSuffix = generation > 0 ? `.g${generation}` : "";
5297
+ return join11(serverCacheRoot3, `${normalizedSourcePath}${generationSuffix}.server.js`);
5203
5298
  }, writeIfChanged2 = async (path, content) => {
5204
5299
  const targetFile = Bun.file(path);
5205
5300
  if (await targetFile.exists()) {
@@ -5226,6 +5321,7 @@ var ISLAND_COMPONENT_ID_LENGTH = 8, serverCacheRoot3, compiledModuleCache3, tran
5226
5321
  `) : nonVueLines.join(`
5227
5322
  `);
5228
5323
  }, extractRelativeVueImports = (sourceCode) => Array.from(sourceCode.matchAll(/import\s+[\s\S]+?['"]([^'"]+)['"]/g)).map((match) => match[1]).filter((importPath) => typeof importPath === "string" && importPath.startsWith(".") && importPath.endsWith(".vue")), compileVueServerModule = async (sourcePath) => {
5324
+ syncIslandGeneration2();
5229
5325
  const cachedModulePath = compiledModuleCache3.get(sourcePath);
5230
5326
  if (cachedModulePath)
5231
5327
  return cachedModulePath;
@@ -5286,6 +5382,9 @@ var init_vueServerModule = __esm(() => {
5286
5382
  init_isFile();
5287
5383
  serverCacheRoot3 = join11(process.cwd(), ".absolutejs", "islands", "vue");
5288
5384
  compiledModuleCache3 = new Map;
5385
+ syncIslandGeneration2 = createIslandGenerationGuard(() => {
5386
+ compiledModuleCache3.clear();
5387
+ });
5289
5388
  transpiler2 = new Transpiler2({ loader: "ts", target: "browser" });
5290
5389
  });
5291
5390
 
@@ -5303,7 +5402,7 @@ var init_islandMarkupAttributes = __esm(() => {
5303
5402
  });
5304
5403
 
5305
5404
  // src/core/renderIslandMarkup.ts
5306
- var islandSequence = 0, resolvedServerComponentCache, resolvedServerBuildComponentCache, nextIslandId = () => {
5405
+ var islandSequence = 0, resolvedServerComponentCache, resolvedServerBuildComponentCache, syncIslandGeneration3, nextIslandId = () => {
5307
5406
  islandSequence += 1;
5308
5407
  return `island-${islandSequence}`;
5309
5408
  }, isRecord6 = (value) => typeof value === "object" && value !== null, isReactServerIslandComponent = (value) => typeof value === "function", isSvelteServerIslandComponent = (value) => typeof value === "function", isVueServerIslandComponent = (value) => typeof value === "function" || isRecord6(value), isAngularServerIslandComponent = (value) => typeof value === "function", resolveBuildReferencePath = (source, registryPath) => {
@@ -5317,6 +5416,7 @@ var islandSequence = 0, resolvedServerComponentCache, resolvedServerBuildCompone
5317
5416
  const loadedModule = await import(compiledModulePath);
5318
5417
  return "default" in loadedModule ? loadedModule.default : loadedModule;
5319
5418
  }, loadServerBuildComponent = async (buildReferencePath) => {
5419
+ syncIslandGeneration3();
5320
5420
  const cachedBuildComponent = resolvedServerBuildComponentCache.get(buildReferencePath);
5321
5421
  if (cachedBuildComponent) {
5322
5422
  return cachedBuildComponent;
@@ -5355,6 +5455,7 @@ var islandSequence = 0, resolvedServerComponentCache, resolvedServerBuildCompone
5355
5455
  }
5356
5456
  return loadServerImportComponent(resolvedComponent);
5357
5457
  }, resolveServerIslandComponent = async (component) => {
5458
+ syncIslandGeneration3();
5358
5459
  const cachedResolvedComponent = resolvedServerComponentCache.get(component);
5359
5460
  if (cachedResolvedComponent) {
5360
5461
  return cachedResolvedComponent;
@@ -5453,6 +5554,10 @@ var init_renderIslandMarkup = __esm(() => {
5453
5554
  init_islands();
5454
5555
  resolvedServerComponentCache = new Map;
5455
5556
  resolvedServerBuildComponentCache = new Map;
5557
+ syncIslandGeneration3 = createIslandGenerationGuard(() => {
5558
+ resolvedServerComponentCache.clear();
5559
+ resolvedServerBuildComponentCache.clear();
5560
+ });
5456
5561
  });
5457
5562
 
5458
5563
  // src/core/currentIslandRegistry.ts
@@ -5704,14 +5809,14 @@ var init_outputLogs = __esm(() => {
5704
5809
  });
5705
5810
 
5706
5811
  // src/build/stampedFileCache.ts
5707
- import { statSync as statSync2 } from "fs";
5812
+ import { statSync as statSync3 } from "fs";
5708
5813
  var STAMP_SETTLE_MS = 2000, createStampedFileCache = () => {
5709
5814
  const entries = new Map;
5710
5815
  const seen = new Set;
5711
5816
  const read = (path, compute) => {
5712
5817
  let stamp;
5713
5818
  try {
5714
- const stats = statSync2(path);
5819
+ const stats = statSync3(path);
5715
5820
  stamp = { mtimeMs: stats.mtimeMs, size: stats.size };
5716
5821
  } catch {
5717
5822
  return compute();
@@ -14019,7 +14124,7 @@ var init_bunStringRawUnicodePlugin = __esm(() => {
14019
14124
  });
14020
14125
 
14021
14126
  // src/build/externalAssetPlugin.ts
14022
- import { copyFileSync, existsSync as existsSync26, mkdirSync as mkdirSync10, statSync as statSync3 } from "fs";
14127
+ import { copyFileSync, existsSync as existsSync26, mkdirSync as mkdirSync10, statSync as statSync4 } from "fs";
14023
14128
  import { basename as basename9, dirname as dirname18, join as join29, resolve as resolve21 } from "path";
14024
14129
  var createExternalAssetPlugin = (outDir, userSourceRoots = []) => ({
14025
14130
  name: "absolute-external-asset",
@@ -14043,7 +14148,7 @@ var createExternalAssetPlugin = (outDir, userSourceRoots = []) => ({
14043
14148
  const assetPath = resolve21(sourceDir, relPath);
14044
14149
  if (!existsSync26(assetPath))
14045
14150
  continue;
14046
- if (!statSync3(assetPath).isFile())
14151
+ if (!statSync4(assetPath).isFile())
14047
14152
  continue;
14048
14153
  const targetPath = join29(outDir, basename9(assetPath));
14049
14154
  if (existsSync26(targetPath))
@@ -15517,7 +15622,7 @@ var isTestSourcePath = (file) => {
15517
15622
  // src/mobile/deviceCapabilities.ts
15518
15623
  import { existsSync as existsSync29, readFileSync as readFileSync22 } from "fs";
15519
15624
  import { extname as extname13, join as join35, relative as relative19, resolve as resolve26 } from "path";
15520
- import { fileURLToPath as fileURLToPath2 } from "url";
15625
+ import { fileURLToPath as fileURLToPath3 } from "url";
15521
15626
  var DEVICES_PACKAGE = "@absolutejs/devices", ABSOLUTE_MOBILE_SHELL_DEVICE_CAPABILITIES, ADAPTERS2, SOURCE_GLOB, IGNORED_DIRECTORIES, IDENTIFIER_PATTERN, providerModulePattern = (provider) => new RegExp(`^@absolutejs/devices-${provider}/[a-z][a-z0-9-]*$`, "u"), providerPackagePattern = (provider) => provider === "capacitor" ? /^@capacitor\/[a-z][a-z0-9-]*@\d+\.\d+\.\d+$/u : /^(?:expo-[a-z][a-z0-9-]*|@react-native-[a-z0-9-]+\/[a-z][a-z0-9-]*)@\d+\.\d+\.\d+$/u, providerLabel = (provider) => provider === "capacitor" ? "Capacitor" : "Expo", ANDROID_PERMISSION_PATTERN, IOS_USAGE_DESCRIPTIONS, IOS_PRIVACY_ACCESSED_API_REASONS, IOS_PRIVACY_ACCESSED_APIS, object = (value) => typeof value === "object" && value !== null && !Array.isArray(value), readJson = (path) => {
15522
15627
  const value = JSON.parse(readFileSync22(path, "utf8"));
15523
15628
  if (!object(value))
@@ -15643,7 +15748,7 @@ var DEVICES_PACKAGE = "@absolutejs/devices", ABSOLUTE_MOBILE_SHELL_DEVICE_CAPABI
15643
15748
  };
15644
15749
  }, resolveAdapterManifest = (adapter, provider) => {
15645
15750
  try {
15646
- return fileURLToPath2(import.meta.resolve(`${adapter}/package.json`));
15751
+ return fileURLToPath3(import.meta.resolve(`${adapter}/package.json`));
15647
15752
  } catch {
15648
15753
  throw new TypeError(`${adapter} is not installed. Run \`absolute mobile init\` to install the ${provider === "expo" ? "Expo" : "Capacitor"} device adapters.`);
15649
15754
  }
@@ -17322,7 +17427,7 @@ var init_typescript_translator = __esm(() => {
17322
17427
  });
17323
17428
 
17324
17429
  // src/dev/angular/fastHmrCompiler.ts
17325
- import { existsSync as existsSync30, readFileSync as readFileSync24, statSync as statSync4 } from "fs";
17430
+ import { existsSync as existsSync30, readFileSync as readFileSync24, statSync as statSync5 } from "fs";
17326
17431
  import { dirname as dirname23, extname as extname15, relative as relative21, resolve as resolve29 } from "path";
17327
17432
  var fail2 = (reason, detail, location) => ({
17328
17433
  detail,
@@ -18226,7 +18331,7 @@ var fail2 = (reason, detail, location) => ({
18226
18331
  const cacheKey = `ts:${filePath}:${className}`;
18227
18332
  let stat;
18228
18333
  try {
18229
- stat = statSync4(filePath);
18334
+ stat = statSync5(filePath);
18230
18335
  } catch {
18231
18336
  return null;
18232
18337
  }
@@ -18280,7 +18385,7 @@ var fail2 = (reason, detail, location) => ({
18280
18385
  const cacheKey = `dts:${dtsPath}:${className}`;
18281
18386
  let stat;
18282
18387
  try {
18283
- stat = statSync4(dtsPath);
18388
+ stat = statSync5(dtsPath);
18284
18389
  } catch {
18285
18390
  return null;
18286
18391
  }
@@ -18621,7 +18726,7 @@ var fail2 = (reason, detail, location) => ({
18621
18726
  }, providerProbeCache, fileHasModuleProviders = (filePath) => {
18622
18727
  let stat;
18623
18728
  try {
18624
- stat = statSync4(filePath);
18729
+ stat = statSync5(filePath);
18625
18730
  } catch {
18626
18731
  return true;
18627
18732
  }
@@ -21147,7 +21252,7 @@ __export(exports_emitTsHelpers, {
21147
21252
  emitTsHelpers: () => emitTsHelpers
21148
21253
  });
21149
21254
  var {file: file2, Transpiler: Transpiler4, write: write3 } = globalThis.Bun;
21150
- import { copyFileSync as copyFileSync2, existsSync as existsSync34, readdirSync as readdirSync6, statSync as statSync5 } from "fs";
21255
+ import { copyFileSync as copyFileSync2, existsSync as existsSync34, readdirSync as readdirSync6, statSync as statSync6 } from "fs";
21151
21256
  import { mkdir as mkdir9, rename as rename2, writeFile as writeFile10 } from "fs/promises";
21152
21257
  import { dirname as dirname26, join as join46, resolve as resolve32, sep as sep8 } from "path";
21153
21258
  var CACHE_DIR_NAME2 = "vue-helpers", CACHE_FORMAT_VERSION2 = 2, HASH_LENGTH4 = 24, transpiler4, cacheDir = () => join46(process.cwd(), ".absolutejs", "compile-cache", CACHE_DIR_NAME2), cacheKey2 = (sourcePath, sourceCode) => {
@@ -21211,7 +21316,7 @@ var CACHE_DIR_NAME2 = "vue-helpers", CACHE_FORMAT_VERSION2 = 2, HASH_LENGTH4 = 2
21211
21316
  copyFileSync2(cachedPath, serverOutputPath);
21212
21317
  }, QUOTES2, MIRRORED_MODULE, IMPORT_CANDIDATE_SUFFIXES, isFilePath = (path) => {
21213
21318
  try {
21214
- return statSync5(path).isFile();
21319
+ return statSync6(path).isFile();
21215
21320
  } catch {
21216
21321
  return false;
21217
21322
  }
@@ -24198,7 +24303,7 @@ import '@angular/compiler';
24198
24303
  import { bootstrapApplication } from '@angular/platform-browser';
24199
24304
  import { provideClientHydration } from '@angular/platform-browser';
24200
24305
  import { withHttpTransferCacheOptions } from '@angular/platform-browser';
24201
- import { ${changeDetectionImport}, REQUEST_CONTEXT } from '@angular/core';
24306
+ import { ${changeDetectionImport}, CSP_NONCE, REQUEST_CONTEXT } from '@angular/core';
24202
24307
  import { APP_BASE_HREF as __abs_APP_BASE_HREF } from '@angular/common';
24203
24308
  import { prepareBrowserTranslationHydration } from '@absolutejs/absolute/client';
24204
24309
  import * as pageModule from '${normalizedImportPath}';
@@ -24215,6 +24320,12 @@ var pageHasRawStreamingSlots = Boolean(document.querySelector('[data-absolute-ra
24215
24320
  var pageHasStreamingSlots = Boolean(document.querySelector('[data-absolute-slot="true"]'));
24216
24321
  var isClientRender = window.__ABSOLUTE_PAGE_RENDER_MODE__ === 'client';
24217
24322
  var contextProviders = [{ provide: REQUEST_CONTEXT, useValue: requestContext }];
24323
+ // Under secureHeaders() the policy only allows <style> elements that carry
24324
+ // the page's nonce. Angular adds one for every component it renders or
24325
+ // hot-updates in the browser, so hand it the nonce the server put on the
24326
+ // page (browsers hide the attribute's value; the property keeps it).
24327
+ var cspNonce = (document.querySelector('script[nonce], style[nonce]') || {}).nonce;
24328
+ if (cspNonce) contextProviders.push({ provide: CSP_NONCE, useValue: cspNonce });
24218
24329
  // Page-level providers are injected directly into the page module's
24219
24330
  // server output by \`compileAngular\`'s providers-injection step
24220
24331
  // (\`...appProviders, provideRouter(routes), { APP_BASE_HREF }\`),
@@ -24318,7 +24429,7 @@ ${zoneImport}import '@angular/compiler';
24318
24429
  import { bootstrapApplication } from '@angular/platform-browser';
24319
24430
  import { provideClientHydration } from '@angular/platform-browser';
24320
24431
  import { withHttpTransferCacheOptions } from '@angular/platform-browser';
24321
- import { enableProdMode, ${changeDetectionImport}, REQUEST_CONTEXT } from '@angular/core';
24432
+ import { enableProdMode, ${changeDetectionImport}, CSP_NONCE, REQUEST_CONTEXT } from '@angular/core';
24322
24433
  import { APP_BASE_HREF as __abs_APP_BASE_HREF } from '@angular/common';
24323
24434
  import { prepareBrowserTranslationHydration } from '@absolutejs/absolute/client';
24324
24435
  import * as pageModule from '${normalizedImportPath}';
@@ -24335,6 +24446,12 @@ var pageHasRawStreamingSlots = Boolean(document.querySelector('[data-absolute-ra
24335
24446
  var pageHasStreamingSlots = Boolean(document.querySelector('[data-absolute-slot="true"]'));
24336
24447
  var isClientRender = window.__ABSOLUTE_PAGE_RENDER_MODE__ === 'client';
24337
24448
  var contextProviders = [{ provide: REQUEST_CONTEXT, useValue: requestContext }];
24449
+ // Under secureHeaders() the policy only allows <style> elements that carry
24450
+ // the page's nonce. Angular adds one for every component it renders or
24451
+ // hot-updates in the browser, so hand it the nonce the server put on the
24452
+ // page (browsers hide the attribute's value; the property keeps it).
24453
+ var cspNonce = (document.querySelector('script[nonce], style[nonce]') || {}).nonce;
24454
+ if (cspNonce) contextProviders.push({ provide: CSP_NONCE, useValue: cspNonce });
24338
24455
  // Page-level providers are injected directly into the page module's
24339
24456
  // server output by \`compileAngular\`'s providers-injection step
24340
24457
  // (\`...appProviders, provideRouter(routes), { APP_BASE_HREF }\`),
@@ -25597,7 +25714,7 @@ import {
25597
25714
  readFileSync as readFileSync35,
25598
25715
  renameSync,
25599
25716
  rmSync as rmSync2,
25600
- statSync as statSync6,
25717
+ statSync as statSync7,
25601
25718
  writeFileSync as writeFileSync14
25602
25719
  } from "fs";
25603
25720
  import {
@@ -25809,7 +25926,7 @@ ${offenders.map((o) => ` \u2022 ${o}`).join(`
25809
25926
  }, SKIP_DIRS5, addWorkerPathIfExists = (file, relPath, workerPaths) => {
25810
25927
  const absPath = resolve39(file, "..", relPath);
25811
25928
  try {
25812
- statSync6(absPath);
25929
+ statSync7(absPath);
25813
25930
  workerPaths.add(absPath);
25814
25931
  } catch {}
25815
25932
  }, extractWorkerSpecifiers = (file, patterns) => {
@@ -25954,7 +26071,7 @@ ${offenders.map((o) => ` \u2022 ${o}`).join(`
25954
26071
  for (const srcPath of urlReferencedFiles) {
25955
26072
  const rel = relative26(projectRoot, srcPath).replace(/\\/g, "/");
25956
26073
  const name = basename19(srcPath);
25957
- const mtime = Math.round(statSync6(srcPath).mtimeMs);
26074
+ const mtime = Math.round(statSync7(srcPath).mtimeMs);
25958
26075
  const url = `/@src/${rel}?v=${mtime}`;
25959
26076
  urlFileMap.set(name, url);
25960
26077
  urlFileMap.set(name.replace(/\.tsx?$/, ".js"), url);
@@ -27414,9 +27531,18 @@ ${offenders.map((o) => ` \u2022 ${o}`).join(`
27414
27531
  recordManifestKey(basename19(htmxFile, ".html"), htmxFile, join56(htmxPagesPath, relative26(outputHtmxPages, htmxFile)));
27415
27532
  }
27416
27533
  };
27534
+ const processStaticConventions = async () => {
27535
+ const conventionDirs = ["html", "htmx"].filter((framework) => conventionsMap[framework]).map((framework) => join56(buildPath, "conventions", framework)).filter((dir) => existsSync41(dir));
27536
+ await Promise.all(conventionDirs.map(async (dir) => {
27537
+ await updateAssetPaths(manifest, dir);
27538
+ if (fonts && fonts.injectHtml !== false)
27539
+ await injectFontTags(dir, fontAssets(manifest));
27540
+ }));
27541
+ };
27417
27542
  await Promise.all([
27418
27543
  tracePhase("postprocess/html-pages", processHtmlPages),
27419
- tracePhase("postprocess/htmx-pages", processHtmxPages)
27544
+ tracePhase("postprocess/htmx-pages", processHtmxPages),
27545
+ tracePhase("postprocess/static-conventions", processStaticConventions)
27420
27546
  ]);
27421
27547
  if (manifestKeyCollisions.length > 0) {
27422
27548
  const message = formatManifestKeyCollisions(manifestKeyCollisions, projectRoot);
@@ -28501,6 +28627,13 @@ var STYLE_EXTENSION_PATTERN2, detectFramework = (filePath, resolved) => {
28501
28627
  }
28502
28628
  } catch {}
28503
28629
  }
28630
+ const registryPath = config.islands?.registry;
28631
+ if (registryPath) {
28632
+ const registryDir = normalizePath(dirname34(resolve43(cwd, registryPath)));
28633
+ const isWatched = roots.some((root) => registryDir === root || registryDir.startsWith(`${root}/`));
28634
+ if (!isWatched && registryDir !== normalizePath(cwd))
28635
+ push(registryDir);
28636
+ }
28504
28637
  const extraDirs = config.dev?.watchDirs ?? [];
28505
28638
  for (const dir of extraDirs)
28506
28639
  push(dir);
@@ -28679,7 +28812,7 @@ var init_editorTempFiles = __esm(() => {
28679
28812
 
28680
28813
  // src/dev/fileWatcher.ts
28681
28814
  import { watch } from "fs";
28682
- import { existsSync as existsSync47, readdirSync as readdirSync10, statSync as statSync7 } from "fs";
28815
+ import { existsSync as existsSync47, readdirSync as readdirSync10, statSync as statSync8 } from "fs";
28683
28816
  import { dirname as dirname35, join as join60, resolve as resolve44 } from "path";
28684
28817
  var safeRemoveFromGraph = (graph, fullPath) => {
28685
28818
  try {
@@ -28717,7 +28850,7 @@ var safeRemoveFromGraph = (graph, fullPath) => {
28717
28850
  continue;
28718
28851
  let st;
28719
28852
  try {
28720
- st = statSync7(child);
28853
+ st = statSync8(child);
28721
28854
  } catch {
28722
28855
  continue;
28723
28856
  }
@@ -28781,7 +28914,7 @@ var safeRemoveFromGraph = (graph, fullPath) => {
28781
28914
  ];
28782
28915
  const fingerprint = (name) => {
28783
28916
  try {
28784
- const value = statSync7(join60(root, name));
28917
+ const value = statSync8(join60(root, name));
28785
28918
  return value.isFile() ? `${value.ino}:${value.size}:${value.mtimeMs}:${value.ctimeMs}` : null;
28786
28919
  } catch {
28787
28920
  return null;
@@ -28848,7 +28981,7 @@ var init_fileWatcher = __esm(() => {
28848
28981
  });
28849
28982
 
28850
28983
  // src/build/svelteDeclarations.ts
28851
- import { existsSync as existsSync48, readdirSync as readdirSync11, readFileSync as readFileSync39, statSync as statSync8 } from "fs";
28984
+ import { existsSync as existsSync48, readdirSync as readdirSync11, readFileSync as readFileSync39, statSync as statSync9 } from "fs";
28852
28985
  import { mkdir as mkdir13, rename as rename4, rm as rm12, writeFile as writeFile12 } from "fs/promises";
28853
28986
  import { dirname as dirname36, join as join61, relative as relative27, resolve as resolve45 } from "path";
28854
28987
  var SVELTE_DECLARATIONS_ROOT = ".absolutejs/types/svelte", FINGERPRINT_FILE = ".fingerprint", SKIPPED_DIRECTORIES, EMIT_SCRIPT = `
@@ -28906,7 +29039,7 @@ emitDts({
28906
29039
  return SKIPPED_DIRECTORIES.has(entry.name) ? [] : collectInputs(path);
28907
29040
  if (!DECLARATION_INPUT.test(entry.name))
28908
29041
  return [];
28909
- const { mtimeMs, size } = statSync8(path);
29042
+ const { mtimeMs, size } = statSync9(path);
28910
29043
  return [`${path}\x00${mtimeMs}\x00${size}`];
28911
29044
  }), fingerprintOf = (svelteDir, tsconfigPath, svelte2tsxPath) => {
28912
29045
  const svelte2tsxManifest = join61(dirname36(svelte2tsxPath), "package.json");
@@ -29195,19 +29328,25 @@ var init_assetStore = __esm(() => {
29195
29328
  });
29196
29329
 
29197
29330
  // src/dev/restartScope.ts
29198
- import { realpathSync as realpathSync7 } from "fs";
29331
+ import { realpathSync as realpathSync7, statSync as statSync10 } from "fs";
29199
29332
  var MODULE_FILE, DOCUMENT_FILE, realPath = (path) => {
29200
29333
  try {
29201
29334
  return realpathSync7(path);
29202
29335
  } catch {
29203
29336
  return path;
29204
29337
  }
29338
+ }, isDirectory = (path) => {
29339
+ try {
29340
+ return statSync10(path).isDirectory();
29341
+ } catch {
29342
+ return false;
29343
+ }
29205
29344
  }, isLoadedByThisProcess = (path) => (path in __require.cache) || (realPath(path) in __require.cache), changeNeedsRestart = (path, isLoaded = isLoadedByThisProcess) => {
29206
29345
  if (DOCUMENT_FILE.test(path) || isTestSourcePath(path))
29207
29346
  return false;
29208
29347
  if (MODULE_FILE.test(path))
29209
29348
  return isLoaded(path);
29210
- return true;
29349
+ return !isDirectory(path);
29211
29350
  };
29212
29351
  var init_restartScope = __esm(() => {
29213
29352
  MODULE_FILE = /\.(?:[cm]?[jt]sx?|mts|cts)$/;
@@ -29216,7 +29355,7 @@ var init_restartScope = __esm(() => {
29216
29355
 
29217
29356
  // src/islands/pageMetadata.ts
29218
29357
  import { readFileSync as readFileSync40 } from "fs";
29219
- import { dirname as dirname37, resolve as resolve48 } from "path";
29358
+ import { resolve as resolve48 } from "path";
29220
29359
  var pagePatterns, getPageDirs = (config) => [
29221
29360
  { dir: config.angularDirectory, framework: "angular" },
29222
29361
  { dir: config.emberDirectory, framework: "ember" },
@@ -29236,17 +29375,10 @@ var pagePatterns, getPageDirs = (config) => [
29236
29375
  const source = definition.buildReference?.source;
29237
29376
  if (!source)
29238
29377
  continue;
29239
- const resolvedSource = source.startsWith("file://") ? new URL(source).pathname : resolve48(dirname37(buildInfo.resolvedRegistryPath), source);
29240
- lookup.set(`${definition.framework}:${definition.component}`, resolve48(resolvedSource));
29378
+ lookup.set(`${definition.framework}:${definition.component}`, resolve48(resolveIslandSourceFile(buildInfo.resolvedRegistryPath, source)));
29241
29379
  }
29242
29380
  return lookup;
29243
- }, getCurrentPageIslandMetadata = () => globalThis.__absolutePageIslandMetadata ?? new Map, metadataUsesSource = (metadata, target) => metadata.islands.some((usage) => {
29244
- const candidate = usage.source;
29245
- return candidate ? resolve48(candidate) === target : false;
29246
- }), getPagesUsingIslandSource = (sourcePath) => {
29247
- const target = resolve48(sourcePath);
29248
- return [...getCurrentPageIslandMetadata().values()].filter((metadata) => metadataUsesSource(metadata, target)).map((metadata) => metadata.pagePath);
29249
- }, resolveIslandUsages = (islands, islandSourceLookup) => islands.map((usage) => {
29381
+ }, getCurrentPageIslandMetadata = () => globalThis.__absolutePageIslandMetadata ?? new Map, resolveIslandUsages = (islands, islandSourceLookup) => islands.map((usage) => {
29250
29382
  const sourcePath = islandSourceLookup.get(`${usage.framework}:${usage.component}`);
29251
29383
  return sourcePath ? {
29252
29384
  ...usage,
@@ -29289,7 +29421,7 @@ var init_pageMetadata = __esm(() => {
29289
29421
  });
29290
29422
 
29291
29423
  // src/dev/fileHashTracker.ts
29292
- import { readFileSync as readFileSync41, statSync as statSync9 } from "fs";
29424
+ import { readFileSync as readFileSync41, statSync as statSync11 } from "fs";
29293
29425
  var computeFileHash = (filePath) => {
29294
29426
  try {
29295
29427
  const fileContent = readFileSync41(filePath);
@@ -29308,7 +29440,7 @@ var computeFileHash = (filePath) => {
29308
29440
  if (previousHashes.has(normalizePath(filePath)))
29309
29441
  return false;
29310
29442
  try {
29311
- return statSync9(filePath).mtimeMs < processStart;
29443
+ return statSync11(filePath).mtimeMs < processStart;
29312
29444
  } catch {
29313
29445
  return false;
29314
29446
  }
@@ -29538,7 +29670,7 @@ var init_reactServerComponentsRebuild = __esm(() => {
29538
29670
 
29539
29671
  // src/utils/spaRouteCss.ts
29540
29672
  import { readFile as readFile9 } from "fs/promises";
29541
- import { dirname as dirname38, isAbsolute as isAbsolute11, resolve as resolve52 } from "path";
29673
+ import { dirname as dirname37, isAbsolute as isAbsolute11, resolve as resolve52 } from "path";
29542
29674
  var sideManifestCache, readSideManifest = async (sideManifestPath) => {
29543
29675
  const cached = sideManifestCache.get(sideManifestPath);
29544
29676
  if (cached !== undefined)
@@ -29576,7 +29708,7 @@ var sideManifestCache, readSideManifest = async (sideManifestPath) => {
29576
29708
  }, readChildCss = async (cssPath, sideManifestPath) => {
29577
29709
  if (!cssPath)
29578
29710
  return "";
29579
- const resolvedCssPath = isAbsolute11(cssPath) ? cssPath : resolve52(dirname38(sideManifestPath), cssPath);
29711
+ const resolvedCssPath = isAbsolute11(cssPath) ? cssPath : resolve52(dirname37(sideManifestPath), cssPath);
29580
29712
  const cached = childCssCache.get(resolvedCssPath);
29581
29713
  if (cached !== undefined)
29582
29714
  return cached;
@@ -29660,8 +29792,8 @@ __export(exports_resolveOwningComponents, {
29660
29792
  resolveDescendantsOfParent: () => resolveDescendantsOfParent,
29661
29793
  resolveOwningComponents: () => resolveOwningComponents
29662
29794
  });
29663
- import { readdirSync as readdirSync12, readFileSync as readFileSync42, statSync as statSync10 } from "fs";
29664
- import { dirname as dirname39, extname as extname19, join as join62, resolve as resolve53 } from "path";
29795
+ import { readdirSync as readdirSync12, readFileSync as readFileSync42, statSync as statSync12 } from "fs";
29796
+ import { dirname as dirname38, extname as extname19, join as join62, resolve as resolve53 } from "path";
29665
29797
  var ENTITY_DECORATORS, isAngularSourceFile = (file) => file.endsWith(".ts") || file.endsWith(".tsx"), walkAngularSourceFiles = (root) => {
29666
29798
  const out = [];
29667
29799
  const visit = (dir) => {
@@ -29794,7 +29926,7 @@ var ENTITY_DECORATORS, isAngularSourceFile = (file) => file.endsWith(".ts") || f
29794
29926
  }
29795
29927
  let rootStat;
29796
29928
  try {
29797
- rootStat = statSync10(userAngularRoot);
29929
+ rootStat = statSync12(userAngularRoot);
29798
29930
  } catch {
29799
29931
  return out;
29800
29932
  }
@@ -29814,7 +29946,7 @@ var ENTITY_DECORATORS, isAngularSourceFile = (file) => file.endsWith(".ts") || f
29814
29946
  return null;
29815
29947
  }
29816
29948
  const sourceFile = lazyTypescript.createSourceFile(childFilePath, source, lazyTypescript.ScriptTarget.ES2022, true, lazyTypescript.ScriptKind.TS);
29817
- const childDir = dirname39(childFilePath);
29949
+ const childDir = dirname38(childFilePath);
29818
29950
  for (const stmt of sourceFile.statements) {
29819
29951
  if (!lazyTypescript.isImportDeclaration(stmt))
29820
29952
  continue;
@@ -29852,7 +29984,7 @@ var ENTITY_DECORATORS, isAngularSourceFile = (file) => file.endsWith(".ts") || f
29852
29984
  const angularRootNorm = safeNormalize(angularRoot);
29853
29985
  for (const candidate of candidates) {
29854
29986
  try {
29855
- if (statSync10(candidate).isFile()) {
29987
+ if (statSync12(candidate).isFile()) {
29856
29988
  const norm = safeNormalize(candidate);
29857
29989
  if (!norm.startsWith(angularRootNorm))
29858
29990
  return null;
@@ -29871,7 +30003,7 @@ var ENTITY_DECORATORS, isAngularSourceFile = (file) => file.endsWith(".ts") || f
29871
30003
  const parentFile = new Map;
29872
30004
  for (const tsPath of walkAngularSourceFiles(userAngularRoot)) {
29873
30005
  const classes = parseDecoratedClasses(tsPath);
29874
- const componentDir = dirname39(tsPath);
30006
+ const componentDir = dirname38(tsPath);
29875
30007
  for (const cls of classes) {
29876
30008
  const entity = {
29877
30009
  className: cls.className,
@@ -29909,7 +30041,7 @@ var ENTITY_DECORATORS, isAngularSourceFile = (file) => file.endsWith(".ts") || f
29909
30041
  const norm = safeNormalize(params.changedFilePath);
29910
30042
  let rootStat;
29911
30043
  try {
29912
- rootStat = statSync10(params.userAngularRoot);
30044
+ rootStat = statSync12(params.userAngularRoot);
29913
30045
  } catch {
29914
30046
  return [];
29915
30047
  }
@@ -32870,7 +33002,7 @@ import {
32870
33002
  X509Certificate as X509Certificate3
32871
33003
  } from "crypto";
32872
33004
  import { access as access4, mkdir as mkdir15 } from "fs/promises";
32873
- import { dirname as dirname40, isAbsolute as isAbsolute12, relative as relative29, resolve as resolve58, sep as sep13 } from "path";
33005
+ import { dirname as dirname39, isAbsolute as isAbsolute12, relative as relative29, resolve as resolve58, sep as sep13 } from "path";
32874
33006
  import { pathToFileURL as pathToFileURL3 } from "url";
32875
33007
  import { Elysia as Elysia8 } from "elysia";
32876
33008
  var ABSOLUTE_MOBILE_UPDATE_SERVER_FORMAT = 1, DEFAULT_MOBILE_UPDATE_REGISTRY_MODULE = "mobile.update.ts", object4 = (value) => typeof value === "object" && value !== null && !Array.isArray(value), projectPath = (projectRoot, requested) => {
@@ -33095,7 +33227,7 @@ ${generated}`);
33095
33227
  return;
33096
33228
  });
33097
33229
  }
33098
- await mkdir15(dirname40(path), { recursive: true });
33230
+ await mkdir15(dirname39(path), { recursive: true });
33099
33231
  await Bun.write(path, renderAbsoluteMobileUpdateRegistry({
33100
33232
  ...options.health ? { health: options.health } : {},
33101
33233
  ...options.rollout ? { rollout: options.rollout } : {},
@@ -33146,7 +33278,7 @@ var init_bridgeInternals = __esm(() => {
33146
33278
  });
33147
33279
 
33148
33280
  // src/dev/angular/hmrCompiler.ts
33149
- import { dirname as dirname41, relative as relative30, resolve as resolve59 } from "path";
33281
+ import { dirname as dirname40, relative as relative30, resolve as resolve59 } from "path";
33150
33282
  import { performance as performance2 } from "perf_hooks";
33151
33283
  var encodeHmrComponentId = (absoluteFilePath, className) => {
33152
33284
  const projectRel = relative30(process.cwd(), absoluteFilePath).replace(/\\/g, "/");
@@ -33169,7 +33301,7 @@ var encodeHmrComponentId = (absoluteFilePath, className) => {
33169
33301
  await Promise.resolve().then(() => init_resolveOwningComponents());
33170
33302
  const owners = resolveOwningComponents({
33171
33303
  changedFilePath: componentFilePath,
33172
- userAngularRoot: dirname41(componentFilePath)
33304
+ userAngularRoot: dirname40(componentFilePath)
33173
33305
  });
33174
33306
  const owner = owners.find((o) => o.className === className);
33175
33307
  const kind = owner?.kind ?? "component";
@@ -33364,7 +33496,7 @@ var init_hmr = __esm(() => {
33364
33496
 
33365
33497
  // src/plugins/devtoolsJson.ts
33366
33498
  import { existsSync as existsSync53, mkdirSync as mkdirSync19, readFileSync as readFileSync49, writeFileSync as writeFileSync16 } from "fs";
33367
- import { dirname as dirname42, join as join69, resolve as resolve60 } from "path";
33499
+ import { dirname as dirname41, join as join69, resolve as resolve60 } from "path";
33368
33500
  import { Elysia as Elysia10 } from "elysia";
33369
33501
  var ENDPOINT = "/.well-known/appspecific/com.chrome.devtools.json", UUID_CACHE_KEY = "__absoluteDevtoolsWorkspaceUuid", getGlobalUuid = () => Reflect.get(globalThis, UUID_CACHE_KEY), setGlobalUuid = (uuid) => {
33370
33502
  Reflect.set(globalThis, UUID_CACHE_KEY, uuid);
@@ -33391,7 +33523,7 @@ var ENDPOINT = "/.well-known/appspecific/com.chrome.devtools.json", UUID_CACHE_K
33391
33523
  if (cachedUuid)
33392
33524
  return setGlobalUuid(cachedUuid);
33393
33525
  const uuid = crypto.randomUUID();
33394
- mkdirSync19(dirname42(cachePath), { recursive: true });
33526
+ mkdirSync19(dirname41(cachePath), { recursive: true });
33395
33527
  writeFileSync16(cachePath, uuid, "utf-8");
33396
33528
  return setGlobalUuid(uuid);
33397
33529
  }, devtoolsJson = (buildDir, options = {}) => {
@@ -34160,7 +34292,7 @@ import {
34160
34292
  rm as rm17,
34161
34293
  writeFile as writeFile16
34162
34294
  } from "fs/promises";
34163
- import { dirname as dirname43, join as join71, resolve as resolvePath2 } from "path";
34295
+ import { dirname as dirname42, join as join71, resolve as resolvePath2 } from "path";
34164
34296
  import { pathToFileURL as pathToFileURL5 } from "url";
34165
34297
  var ABSOLUTE_MOBILE_MATERIALIZED_BUNDLE_FORMAT = 1, CURRENT_BUNDLE_FILE = "current.json", BUNDLES_DIRECTORY = "bundles", ARTIFACT_FILE2 = "artifact.json", BUNDLE_ID_PATTERN, isRecord13 = (value) => typeof value === "object" && value !== null && !Array.isArray(value), errorHasCode2 = (error, code) => typeof error === "object" && error !== null && Reflect.get(error, "code") === code, bundleIdFor = (currentReleaseId, releases) => {
34166
34298
  const identity = JSON.stringify({
@@ -34193,7 +34325,7 @@ var ABSOLUTE_MOBILE_MATERIALIZED_BUNDLE_FORMAT = 1, CURRENT_BUNDLE_FILE = "curre
34193
34325
  }, writeRelease = async (root, release) => {
34194
34326
  const directory = join71(root, release.artifact.releaseId);
34195
34327
  const producerPath = join71(directory, release.artifact.producer.module);
34196
- await mkdir17(dirname43(producerPath), { recursive: true });
34328
+ await mkdir17(dirname42(producerPath), { recursive: true });
34197
34329
  await Promise.all([
34198
34330
  writeFile16(join71(directory, ARTIFACT_FILE2), `${JSON.stringify(release.artifact, null, "\t")}
34199
34331
  `),
@@ -35386,6 +35518,7 @@ var MS_PER_SECOND2 = 1000, DEFAULT_PORT2 = 3000, MAX_STATIC_ROUTE_COUNT, STATIC_
35386
35518
  return statusCode === undefined || statusCode === HTTP_STATUS_INTERNAL_SERVER_ERROR;
35387
35519
  }, createStaticErrorPlugin = (owner) => {
35388
35520
  let startedApp;
35521
+ const loggedErrors = new WeakSet;
35389
35522
  return new Elysia15({ name: "absolutejs-static-error" }).onStart((app) => {
35390
35523
  startedApp = app;
35391
35524
  }).onError("global", async ({ error, request, set }) => {
@@ -35394,11 +35527,11 @@ var MS_PER_SECOND2 = 1000, DEFAULT_PORT2 = 3000, MAX_STATIC_ROUTE_COUNT, STATIC_
35394
35527
  const app = globalThis.__absoluteLiveApp ?? startedApp;
35395
35528
  if (hasForeignErrorHook(app, owner()))
35396
35529
  return;
35397
- const response = await renderStaticRouteError(request, error);
35398
- if (!response)
35399
- return;
35400
- console.error(`[SSR] ${request.method} ${new URL(request.url).pathname} threw:`, error);
35401
- return response;
35530
+ if (!loggedErrors.has(error)) {
35531
+ loggedErrors.add(error);
35532
+ console.error(`[SSR] ${request.method} ${new URL(request.url).pathname} threw:`, error);
35533
+ }
35534
+ return await renderStaticRouteError(request, error) ?? undefined;
35402
35535
  });
35403
35536
  }, createBuildErrorRecoveryPlugin = () => new Elysia15({ name: "absolutejs-build-error-recovery" }).onError("global", async ({ error }) => {
35404
35537
  const message = error instanceof Error ? error.message : String(error);
@@ -35660,8 +35793,8 @@ __export(exports_moduleServer, {
35660
35793
  warmPage: () => warmPage,
35661
35794
  warnIfReactFastRefreshUnsupported: () => warnIfReactFastRefreshUnsupported
35662
35795
  });
35663
- import { existsSync as existsSync57, readFileSync as readFileSync53, realpathSync as realpathSync8, statSync as statSync11 } from "fs";
35664
- import { basename as basename22, dirname as dirname44, extname as extname20, join as join74, resolve as resolve62, relative as relative32 } from "path";
35796
+ import { existsSync as existsSync57, readFileSync as readFileSync53, realpathSync as realpathSync8, statSync as statSync13 } from "fs";
35797
+ import { basename as basename22, dirname as dirname43, extname as extname20, join as join74, resolve as resolve62, relative as relative32 } from "path";
35665
35798
  var SRC_PREFIX = "/@src/", BROWSER_DEFINE, jsTranspiler2, legacyDecoratorTsconfig, tsTranspiler2, tsxTranspiler, TRANSPILABLE, ALL_EXPORTS_RE, STRING_CONTENTS_RE, preserveTypeExports = (originalSource, transpiled, valueExports) => {
35666
35799
  const codeOnly = originalSource.replace(STRING_CONTENTS_RE, '""');
35667
35800
  const allExports = [];
@@ -35718,7 +35851,7 @@ ${stubs}
35718
35851
  if (cached !== undefined)
35719
35852
  return `${base}?v=${buildVersion(cached, absPath)}`;
35720
35853
  try {
35721
- const mtime = Math.round(statSync11(absPath).mtimeMs);
35854
+ const mtime = Math.round(statSync13(absPath).mtimeMs);
35722
35855
  mtimeCache.set(absPath, mtime);
35723
35856
  return `${base}?v=${buildVersion(mtime, absPath)}`;
35724
35857
  } catch {
@@ -35795,7 +35928,7 @@ ${stubs}
35795
35928
  };
35796
35929
  result = result.replace(/^((?:import\s+[^"'`;]+?\s+from|export\s+[^"'`;]+?\s+from|import)\s*["'])([^"'./][^"']*)(["'])/gm, stubReplace);
35797
35930
  result = result.replace(/(import\s*\(\s*["'])([^"'./][^"']*)(["']\s*\))/g, stubReplace);
35798
- const fileDir = dirname44(filePath);
35931
+ const fileDir = dirname43(filePath);
35799
35932
  result = result.replace(/(from\s*["'])(\.\.?\/[^"']+)(["'])/g, (_match, prefix, relPath, suffix) => isRealImport(relPath) ? `${prefix}${resolveRelativeImport(relPath, fileDir, projectRoot, IMPORT_EXTENSIONS)}${suffix}` : _match);
35800
35933
  result = result.replace(/(import\s*\(\s*["'])(\.\.?\/[^"']+)(["']\s*\))/g, (_match, prefix, relPath, suffix) => isRealImport(relPath) ? `${prefix}${resolveRelativeImport(relPath, fileDir, projectRoot, IMPORT_EXTENSIONS)}${suffix}` : _match);
35801
35934
  result = result.replace(/(import\s*["'])(\.\.?\/[^"']+)(["']\s*;?)/g, (_match, prefix, relPath, suffix) => isRealImport(relPath) ? `${prefix}${resolveRelativeImport(relPath, fileDir, projectRoot, SIDE_EFFECT_EXTENSIONS)}${suffix}` : _match);
@@ -36035,7 +36168,7 @@ ${code}`;
36035
36168
  if (compiled.css?.code) {
36036
36169
  const cssPath = `${filePath}.css`;
36037
36170
  svelteExternalCss.set(cssPath, compiled.css.code);
36038
- const cssUrl = srcUrl(relative32(projectRoot, cssPath), projectRoot);
36171
+ const cssUrl = `${SRC_PREFIX}${encodeSrcPath(relative32(projectRoot, cssPath))}?v=${Bun.hash(compiled.css.code).toString(BASE_36_RADIX)}`;
36039
36172
  code = `import "${cssUrl}";
36040
36173
  ${code}`;
36041
36174
  }
@@ -36044,7 +36177,7 @@ ${code}`;
36044
36177
  ` + ` if (!window.__SVELTE_HMR_ACCEPT__) window.__SVELTE_HMR_ACCEPT__ = {};
36045
36178
  ` + ` var __hmr_accept = function(cb) { window.__SVELTE_HMR_ACCEPT__[${JSON.stringify(moduleUrl)}] = cb; };`);
36046
36179
  return code.replace(/import\.meta\.hot\.accept\(/g, "__hmr_accept(");
36047
- }, svelteLazyRegistrations = (raw, filePath, projectRoot) => Array.from(raw.matchAll(/\bimport\s*\(\s*['"](\.[^'"]+\.svelte)['"]\s*\)/g)).map((match) => match[1]).filter((spec) => spec !== undefined).filter((spec) => existsSync57(resolve62(dirname44(filePath), spec))).map((spec) => lazyModuleRegistration(relative32(projectRoot, resolve62(dirname44(filePath), spec)).replace(/\\/g, "/"), spec)).join(""), transformSvelteFile = async (filePath, projectRoot, rewriter, stylePreprocessors) => {
36180
+ }, svelteLazyRegistrations = (raw, filePath, projectRoot) => Array.from(raw.matchAll(/\bimport\s*\(\s*['"](\.[^'"]+\.svelte)['"]\s*\)/g)).map((match) => match[1]).filter((spec) => spec !== undefined).filter((spec) => existsSync57(resolve62(dirname43(filePath), spec))).map((spec) => lazyModuleRegistration(relative32(projectRoot, resolve62(dirname43(filePath), spec)).replace(/\\/g, "/"), spec)).join(""), transformSvelteFile = async (filePath, projectRoot, rewriter, stylePreprocessors) => {
36048
36181
  const raw = readFileSync53(filePath, "utf-8");
36049
36182
  if (!svelteCompiler) {
36050
36183
  svelteCompiler = await import("svelte/compiler");
@@ -36363,7 +36496,7 @@ export default {};
36363
36496
  return transformAndCacheVue(filePath, projectRoot, rewriter, vueDir, stylePreprocessors);
36364
36497
  if (!TRANSPILABLE.has(ext))
36365
36498
  return;
36366
- const stat = statSync11(filePath);
36499
+ const stat = statSync13(filePath);
36367
36500
  const resolvedVueDir = vueDir ? resolve62(vueDir) : undefined;
36368
36501
  let content = REACT_EXTENSIONS.has(ext) ? transformReactFile(filePath, projectRoot, rewriter) : transformPlainFile(filePath, projectRoot, rewriter, resolvedVueDir);
36369
36502
  const isAngularGeneratedJs = ext === ".js" && filePath.replace(/\\/g, "/").includes("/.absolutejs/generated/angular/");
@@ -36391,12 +36524,12 @@ export default {};
36391
36524
  cachedAngularUserRoot = configuredAngularUserRoot ?? null;
36392
36525
  return cachedAngularUserRoot;
36393
36526
  }, configuredAngularUserRoot, transformAndCacheSvelte = async (filePath, projectRoot, rewriter, stylePreprocessors) => {
36394
- const stat = statSync11(filePath);
36527
+ const stat = statSync13(filePath);
36395
36528
  const content = await transformSvelteFile(filePath, projectRoot, rewriter, stylePreprocessors);
36396
36529
  setTransformed(filePath, content, stat.mtimeMs, extractImportedFiles(content, projectRoot));
36397
36530
  return jsResponse(content);
36398
36531
  }, transformAndCacheVue = async (filePath, projectRoot, rewriter, vueDir, stylePreprocessors) => {
36399
- const stat = statSync11(filePath);
36532
+ const stat = statSync13(filePath);
36400
36533
  const content = await transformVueFile(filePath, projectRoot, rewriter, vueDir, stylePreprocessors);
36401
36534
  setTransformed(filePath, content, stat.mtimeMs, extractImportedFiles(content, projectRoot));
36402
36535
  return jsResponse(content);
@@ -36855,8 +36988,8 @@ var handleHTMXUpdate = async (htmxFilePath) => {
36855
36988
  var init_simpleHTMXHMR = () => {};
36856
36989
 
36857
36990
  // src/dev/backendGraph.ts
36858
- import { readFileSync as readFileSync54, realpathSync as realpathSync9, statSync as statSync12 } from "fs";
36859
- import { dirname as dirname45, extname as extname21, resolve as resolve65 } from "path";
36991
+ import { readFileSync as readFileSync54, realpathSync as realpathSync9, statSync as statSync14 } from "fs";
36992
+ import { dirname as dirname44, extname as extname21, resolve as resolve65 } from "path";
36860
36993
  var SOURCE_FILE, VENDORED, LOADERS, fileCache, transpilers, transpilerFor = (path) => {
36861
36994
  const loader = LOADERS[extname21(path)] ?? "ts";
36862
36995
  const existing = transpilers.get(loader);
@@ -36873,14 +37006,14 @@ var SOURCE_FILE, VENDORED, LOADERS, fileCache, transpilers, transpilerFor = (pat
36873
37006
  }
36874
37007
  }, isProjectModule = (path, root = process.cwd()) => SOURCE_FILE.test(path) && !VENDORED.test(path) && resolve65(path).startsWith(resolve65(root)), resolveImport = (specifier, fromFile) => {
36875
37008
  try {
36876
- return realPath2(Bun.resolveSync(specifier, dirname45(fromFile)));
37009
+ return realPath2(Bun.resolveSync(specifier, dirname44(fromFile)));
36877
37010
  } catch {
36878
37011
  return;
36879
37012
  }
36880
37013
  }, readImports = (path) => {
36881
37014
  let mtimeMs;
36882
37015
  try {
36883
- ({ mtimeMs } = statSync12(path));
37016
+ ({ mtimeMs } = statSync14(path));
36884
37017
  } catch {
36885
37018
  fileCache.delete(path);
36886
37019
  return [];
@@ -36932,7 +37065,7 @@ var init_backendGraph = __esm(() => {
36932
37065
  });
36933
37066
 
36934
37067
  // src/dev/hot/analyze.ts
36935
- import { dirname as dirname46, extname as extname22 } from "path";
37068
+ import { dirname as dirname45, extname as extname22 } from "path";
36936
37069
  var ANALYZER_VERSION = 2, hashText = (text) => Bun.hash(text).toString(36), scriptKindFor = (tsc, path) => {
36937
37070
  switch (extname22(path)) {
36938
37071
  case ".tsx":
@@ -37690,7 +37823,7 @@ var ANALYZER_VERSION = 2, hashText = (text) => Bun.hash(text).toString(36), scri
37690
37823
  return analysis;
37691
37824
  }, resolveFrom2 = (fromFile, isManaged) => (specifier) => {
37692
37825
  try {
37693
- const resolved = Bun.resolveSync(specifier, dirname46(fromFile));
37826
+ const resolved = Bun.resolveSync(specifier, dirname45(fromFile));
37694
37827
  return isManaged(resolved) ? resolved : undefined;
37695
37828
  } catch {
37696
37829
  return;
@@ -37898,7 +38031,7 @@ var MAX_PROPAGATION_STEPS = 500, realPath4 = (path) => {
37898
38031
  if (typeof namespace !== "object" || namespace === null)
37899
38032
  throw new Error(`${path} did not evaluate to a module`);
37900
38033
  return Object.fromEntries(Object.entries(namespace));
37901
- }, display = (path) => relative34(process.cwd(), path) || path, SLOW_UPDATE_MS = 500, SLOWEST_SHOWN = 3, statementLabel = (id) => {
38034
+ }, isMissingFile3 = (error) => error instanceof Error && ("code" in error) && error.code === "ENOENT", display = (path) => relative34(process.cwd(), path) || path, SLOW_UPDATE_MS = 500, SLOWEST_SHOWN = 3, statementLabel = (id) => {
37902
38035
  const name = id.slice(id.indexOf(":") + 1);
37903
38036
  return /^\d+$/.test(name) ? `statement #${name}` : name;
37904
38037
  }, slowestStatements = (modules) => modules.flatMap((module) => [...moduleRecord(module)?.lastTimings ?? []].map(([id, duration]) => ({
@@ -37941,6 +38074,8 @@ var MAX_PROPAGATION_STEPS = 500, realPath4 = (path) => {
37941
38074
  try {
37942
38075
  source = readFileSync56(path, "utf-8");
37943
38076
  } catch (error) {
38077
+ if (isMissingFile3(error))
38078
+ return { status: "unchanged" };
37944
38079
  reportFailure(path, error);
37945
38080
  return { error, status: "failed" };
37946
38081
  }
@@ -38048,10 +38183,10 @@ var init_reload = __esm(() => {
38048
38183
  });
38049
38184
 
38050
38185
  // src/dev/rebuildTrigger.ts
38051
- import { existsSync as existsSync58, readdirSync as readdirSync14, rmSync as rmSync4, statSync as statSync13 } from "fs";
38186
+ import { existsSync as existsSync58, readdirSync as readdirSync14, rmSync as rmSync4, statSync as statSync15 } from "fs";
38052
38187
  import {
38053
38188
  basename as basename23,
38054
- dirname as dirname47,
38189
+ dirname as dirname46,
38055
38190
  isAbsolute as isAbsolute13,
38056
38191
  join as join76,
38057
38192
  relative as relative35,
@@ -38406,6 +38541,8 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, clearDevSs
38406
38541
  if (!hasFileChanged(filePath, currentHash, state.fileHashes)) {
38407
38542
  return;
38408
38543
  }
38544
+ if (framework === "unknown")
38545
+ state.fileHashes.set(normalizePath(filePath), currentHash);
38409
38546
  const { publicDir } = state.resolvedPaths;
38410
38547
  const { assetsDir } = state.resolvedPaths;
38411
38548
  const handleStaticMirror = async (sourceDir, urlPrefix) => {
@@ -38420,7 +38557,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, clearDevSs
38420
38557
  const { buildDir } = state.resolvedPaths;
38421
38558
  const destPath = resolvePath4(buildDir, urlPrefix ? `${urlPrefix}/${relFromDir}` : relFromDir);
38422
38559
  const { mkdir, copyFile, readFile } = await import("fs/promises");
38423
- await mkdir(dirname47(destPath), { recursive: true });
38560
+ await mkdir(dirname46(destPath), { recursive: true });
38424
38561
  await copyFile(absSource, destPath);
38425
38562
  const bytes = await readFile(destPath);
38426
38563
  const webPath = urlPrefix ? `/${urlPrefix}/${relFromDir}` : `/${relFromDir}`;
@@ -38619,7 +38756,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, clearDevSs
38619
38756
  const keepStemsByDir = new Map;
38620
38757
  const prefixByDir = new Map;
38621
38758
  for (const artifact of freshOutputs) {
38622
- const dir = dirname47(artifact.path);
38759
+ const dir = dirname46(artifact.path);
38623
38760
  const name = basename23(artifact.path);
38624
38761
  const [prefix] = name.split(".");
38625
38762
  if (!prefix)
@@ -39217,7 +39354,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, clearDevSs
39217
39354
  return url;
39218
39355
  }, getReactModuleUrl, isReactComponentPath = (file) => file.endsWith(".tsx") || file.endsWith(".jsx"), isReactPagePath = (file) => file.replace(/\\/g, "/").includes("/pages/"), isImportableModule = (file) => {
39219
39356
  try {
39220
- return statSync13(file).isFile();
39357
+ return statSync15(file).isFile();
39221
39358
  } catch {
39222
39359
  return false;
39223
39360
  }
@@ -40036,8 +40173,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, clearDevSs
40036
40173
  if (!buildReference?.source) {
40037
40174
  return;
40038
40175
  }
40039
- const sourcePath = buildReference.source.startsWith("file://") ? new URL(buildReference.source).pathname : resolvePath4(dirname47(buildInfo.resolvedRegistryPath), buildReference.source);
40040
- islandFiles.add(resolvePath4(sourcePath));
40176
+ islandFiles.add(resolvePath4(resolveIslandSourceFile(buildInfo.resolvedRegistryPath, buildReference.source)));
40041
40177
  }, resolveIslandSourceFiles = async (config) => {
40042
40178
  const registryPath = config.islands?.registry;
40043
40179
  if (!registryPath) {
@@ -40057,15 +40193,33 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, clearDevSs
40057
40193
  return false;
40058
40194
  }
40059
40195
  return filesToRebuild.some((file) => islandFiles.has(resolvePath4(file)));
40060
- }, handleIslandSourceReload = async (state, config, filesToRebuild, manifest, serverDuration) => {
40061
- const shouldReload = await didStaticPagesNeedIslandRefresh(config, filesToRebuild);
40062
- if (!shouldReload) {
40196
+ }, collectChangedIslands = async (config, filesToRebuild) => {
40197
+ const registryPath = config.islands?.registry;
40198
+ if (!registryPath)
40199
+ return [];
40200
+ const buildInfo = await loadIslandRegistryBuildInfo(registryPath);
40201
+ const changedFiles = new Set(filesToRebuild.map((file) => resolvePath4(file)));
40202
+ return buildInfo.definitions.filter((definition) => {
40203
+ const source = definition.buildReference?.source;
40204
+ if (!source)
40205
+ return false;
40206
+ return changedFiles.has(resolvePath4(resolveIslandSourceFile(buildInfo.resolvedRegistryPath, source)));
40207
+ });
40208
+ }, filterFilesReachingPages = async (state, config, files) => {
40209
+ const islandFiles = await resolveIslandSourceFiles(config);
40210
+ return files.filter((file) => {
40211
+ const resolvedFile = resolvePath4(file);
40212
+ const dependents = getAffectedFiles(state.dependencyGraph, resolvedFile).filter((dependent) => dependent !== resolvedFile);
40213
+ if (dependents.length === 0)
40214
+ return !islandFiles.has(resolvedFile);
40215
+ return dependents.some((dependent) => !islandFiles.has(dependent));
40216
+ });
40217
+ }, isRegistryEdit = (state, config) => {
40218
+ const registryPath = config.islands?.registry;
40219
+ if (!registryPath)
40063
40220
  return false;
40064
- }
40065
- setCurrentPageIslandMetadata(await loadPageIslandMetadata(config));
40066
- const affectedPages = filesToRebuild.flatMap((file) => getPagesUsingIslandSource(file));
40067
- if (affectedPages.length === 0)
40068
- return true;
40221
+ return state.lastUserEditedFiles?.has(resolvePath4(registryPath)) === true;
40222
+ }, broadcastIslandFullReload = (state, affectedPages, manifest, serverDuration, sourceFile) => {
40069
40223
  const affectedFrameworks = [
40070
40224
  ...new Set(affectedPages.map((page) => detectFramework(page, state.resolvedPaths)).filter((framework) => framework !== "ignored"))
40071
40225
  ];
@@ -40076,10 +40230,40 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, clearDevSs
40076
40230
  framework: "islands",
40077
40231
  manifest,
40078
40232
  serverDuration,
40079
- sourceFile: filesToRebuild[0]
40233
+ sourceFile
40080
40234
  },
40081
40235
  type: "full-reload"
40082
40236
  });
40237
+ }, handleIslandSourceReload = async (state, config, filesToRebuild, manifest, serverDuration) => {
40238
+ const shouldReload = await didStaticPagesNeedIslandRefresh(config, filesToRebuild);
40239
+ if (!shouldReload) {
40240
+ return false;
40241
+ }
40242
+ bumpIslandServerGeneration();
40243
+ setCurrentPageIslandMetadata(await loadPageIslandMetadata(config));
40244
+ const [sourceFile] = filesToRebuild;
40245
+ if (isRegistryEdit(state, config)) {
40246
+ const pagesWithIslands = [...getCurrentPageIslandMetadata().values()].filter((metadata) => metadata.islands.length > 0).map((metadata) => metadata.pagePath);
40247
+ if (pagesWithIslands.length > 0)
40248
+ broadcastIslandFullReload(state, pagesWithIslands, manifest, serverDuration, sourceFile);
40249
+ return true;
40250
+ }
40251
+ const changedIslands = await collectChangedIslands(config, filesToRebuild);
40252
+ const islands = changedIslands.flatMap(({ component, framework }) => {
40253
+ const modulePath = manifest[getIslandManifestKey(framework, component)];
40254
+ return modulePath ? [{ component, framework, modulePath }] : [];
40255
+ });
40256
+ if (islands.length === 0)
40257
+ return true;
40258
+ logHmrUpdate(relative35(process.cwd(), sourceFile ?? ""), "islands", serverDuration);
40259
+ broadcastToClients(state, {
40260
+ data: {
40261
+ islands,
40262
+ serverDuration,
40263
+ sourceFile
40264
+ },
40265
+ type: "island-update"
40266
+ });
40083
40267
  return true;
40084
40268
  }, handleHTMLScriptHMR = (state, filesToRebuild, manifest, duration) => {
40085
40269
  if (!state.resolvedPaths.htmlDir) {
@@ -40100,8 +40284,8 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, clearDevSs
40100
40284
  }, resolveStaticPageTargets = async (files, sourcePagesDir) => {
40101
40285
  const pagesDir = resolvePath4(sourcePagesDir);
40102
40286
  const htmlFiles = files.filter((file) => file.endsWith(".html")).map((file) => resolvePath4(file));
40103
- const pages = htmlFiles.filter((file) => dirname47(file) === pagesDir);
40104
- const partials = new Set(htmlFiles.filter((file) => dirname47(file) !== pagesDir));
40287
+ const pages = htmlFiles.filter((file) => dirname46(file) === pagesDir);
40288
+ const partials = new Set(htmlFiles.filter((file) => dirname46(file) !== pagesDir));
40105
40289
  if (partials.size === 0)
40106
40290
  return pages;
40107
40291
  await Promise.resolve().then(() => init_htmlIncludes());
@@ -40617,14 +40801,22 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, clearDevSs
40617
40801
  handled.add(configPath);
40618
40802
  }
40619
40803
  return files.every((f) => handled.has(f));
40804
+ }, keepReactIndexesOnModuleServer = async (state, manifest) => {
40805
+ const reactIndexes = Object.fromEntries(Object.entries(manifest).filter(([key, value]) => key.endsWith("Index") && value.includes("/indexes/") && value.includes("/react/")));
40806
+ if (Object.keys(reactIndexes).length === 0)
40807
+ return;
40808
+ await Promise.resolve().then(() => init_prepare());
40809
+ await Promise.resolve().then(() => init_moduleServer());
40810
+ patchManifestIndexes(reactIndexes, resolvePath4(state.resolvedPaths.buildDir, "_src_indexes"), SRC_URL_PREFIX2);
40811
+ Object.assign(manifest, reactIndexes);
40620
40812
  }, performFullRebuild = async (state, config, affectedFrameworks, filesToRebuild, startTime, onRebuildComplete, options) => {
40621
40813
  state.svelteSurgicallyHandled = undefined;
40622
40814
  const hasManifest = Object.keys(state.manifest).length > 0;
40623
40815
  const files = filesToRebuild ?? [];
40624
40816
  const onDemandPage = options?.onDemandPage;
40625
- let allHandled = !onDemandPage && files.length > 0 && hasManifest;
40626
40817
  const hasIslandSourceChanges = files.length > 0 ? await didStaticPagesNeedIslandRefresh(config, files) : false;
40627
- if (allHandled && !hasIslandSourceChanges) {
40818
+ let allHandled = !onDemandPage && files.length > 0 && hasManifest && !hasIslandSourceChanges;
40819
+ if (allHandled) {
40628
40820
  allHandled = await runFrameworkFastPaths(state, config, affectedFrameworks, files, startTime, onRebuildComplete);
40629
40821
  }
40630
40822
  if (allHandled && config.htmlDirectory && affectedFrameworks.includes("html")) {
@@ -40656,6 +40848,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, clearDevSs
40656
40848
  throw new Error("Build failed - no manifest generated");
40657
40849
  }
40658
40850
  const { manifest } = buildResult;
40851
+ await keepReactIndexesOnModuleServer(state, manifest);
40659
40852
  if (state.lazyPages && buildResult.pageEntries) {
40660
40853
  updateLazyPageRegistry(state.lazyPages.registry, buildResult.pageEntries);
40661
40854
  }
@@ -40734,7 +40927,9 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, clearDevSs
40734
40927
  const hasFilesToRebuild = filesToRebuild && filesToRebuild.length > 0;
40735
40928
  const didReloadForIslandChange = hasFilesToRebuild ? await handleIslandSourceReload(state, config, filesToRebuild, manifest, duration) : false;
40736
40929
  if (didReloadForIslandChange) {
40737
- await runFrameworkFastPaths(state, config, affectedFrameworks, filesToRebuild ?? [], startTime, onRebuildComplete);
40930
+ const pageFiles = await filterFilesReachingPages(state, config, filesToRebuild ?? []);
40931
+ if (pageFiles.length > 0)
40932
+ await runFrameworkFastPaths(state, config, affectedFrameworks, pageFiles, startTime, onRebuildComplete);
40738
40933
  onRebuildComplete({ hmrState: state, manifest });
40739
40934
  return manifest;
40740
40935
  }
@@ -41334,7 +41529,7 @@ var init_vendorCache = __esm(() => {
41334
41529
 
41335
41530
  // src/core/devBuild.ts
41336
41531
  import { readdir as readdir7 } from "fs/promises";
41337
- import { existsSync as existsSync60, statSync as statSync14 } from "fs";
41532
+ import { existsSync as existsSync60, statSync as statSync16 } from "fs";
41338
41533
  import { resolve as resolve68 } from "path";
41339
41534
  var FRAMEWORK_DIR_KEYS, devClientVendorSourceDir, collectDepVendorSourceDirs = (config) => {
41340
41535
  const configuredDirs = [
@@ -41474,7 +41669,7 @@ var FRAMEWORK_DIR_KEYS, devClientVendorSourceDir, collectDepVendorSourceDirs = (
41474
41669
  });
41475
41670
  }
41476
41671
  }, handleCachedReload = async () => {
41477
- const serverMtime = statSync14(resolve68(Bun.main)).mtimeMs;
41672
+ const serverMtime = statSync16(resolve68(Bun.main)).mtimeMs;
41478
41673
  const lastMtime = globalThis.__hmrServerMtime;
41479
41674
  globalThis.__hmrServerMtime = serverMtime;
41480
41675
  const cached = globalThis.__hmrDevResult;
@@ -41855,7 +42050,7 @@ var FRAMEWORK_DIR_KEYS, devClientVendorSourceDir, collectDepVendorSourceDirs = (
41855
42050
  manifest
41856
42051
  };
41857
42052
  globalThis.__hmrDevResult = result;
41858
- globalThis.__hmrServerMtime = statSync14(resolve68(Bun.main)).mtimeMs;
42053
+ globalThis.__hmrServerMtime = statSync16(resolve68(Bun.main)).mtimeMs;
41859
42054
  return result;
41860
42055
  };
41861
42056
  var init_devBuild = __esm(() => {
@@ -41901,5 +42096,5 @@ export {
41901
42096
  devBuild
41902
42097
  };
41903
42098
 
41904
- //# debugId=63DFF81D034C7C2D64756E2164756E21
42099
+ //# debugId=2C9457EC4704C29664756E2164756E21
41905
42100
  //# sourceMappingURL=build.js.map