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

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 (40) hide show
  1. package/CHANGELOG.md +9 -0
  2. package/changelog.json +16 -0
  3. package/dist/angular/components/core/streamingSlotRegistrar.js +1 -1
  4. package/dist/angular/components/core/streamingSlotRegistry.js +2 -2
  5. package/dist/angular/index.js +6 -1
  6. package/dist/angular/index.js.map +3 -3
  7. package/dist/angular/server.js +6 -1
  8. package/dist/angular/server.js.map +3 -3
  9. package/dist/build.js +175 -37
  10. package/dist/build.js.map +7 -7
  11. package/dist/cli/{build-fntmf42w.js → build-ptx5a72p.js} +3 -3
  12. package/dist/cli/{buildReactServerComponents-fq6mw10d.js → buildReactServerComponents-01s87hnk.js} +1 -1
  13. package/dist/cli/{index-w79snsxv.js → index-5w8arh3m.js} +1 -1
  14. package/dist/cli/{index-xf9sfr8a.js → index-fgqh48qr.js} +63 -1
  15. package/dist/cli/{index-x1vvn549.js → index-jkg2h10c.js} +2 -2
  16. package/dist/cli/index.js +1 -1
  17. package/dist/cli/{staticAnalyzeSpaRoutes-2nev05m1.js → staticAnalyzeSpaRoutes-rcc1d3az.js} +3 -1
  18. package/dist/cli/{typecheck-488txsfc.js → typecheck-ynzw2eep.js} +36 -22
  19. package/dist/index.js +175 -37
  20. package/dist/index.js.map +7 -7
  21. package/dist/react/index.js +6 -1
  22. package/dist/react/index.js.map +3 -3
  23. package/dist/react/server.js +6 -1
  24. package/dist/react/server.js.map +3 -3
  25. package/dist/src/angular/staticAnalyzeSpaRoutes.d.ts +9 -0
  26. package/dist/src/cli/scripts/typecheck.d.ts +7 -0
  27. package/dist/src/dev/spaRouteRefresh.d.ts +12 -5
  28. package/dist/src/utils/spaRouteManifest.d.ts +2 -0
  29. package/dist/svelte/components/Image.svelte +1 -1
  30. package/dist/svelte/components/Island.svelte +1 -1
  31. package/dist/svelte/index.js +6 -1
  32. package/dist/svelte/index.js.map +3 -3
  33. package/dist/svelte/router/Router.svelte.d.ts +31 -1
  34. package/dist/svelte/server.js +6 -1
  35. package/dist/svelte/server.js.map +3 -3
  36. package/dist/vue/index.js +6 -1
  37. package/dist/vue/index.js.map +3 -3
  38. package/dist/vue/server.js +6 -1
  39. package/dist/vue/server.js.map +3 -3
  40. package/package.json +4 -1
@@ -3,14 +3,14 @@ import"./index-t8jmj8w1.js";
3
3
  import"./index-aqe25w4h.js";
4
4
  import"./index-47e8fwha.js";
5
5
  import"./index-4j1twret.js";
6
- import"./index-x1vvn549.js";
7
- import"./index-w79snsxv.js";
6
+ import"./index-jkg2h10c.js";
7
+ import"./index-5w8arh3m.js";
8
8
  import {
9
9
  SENTINEL
10
10
  } from "./index-jyap0bhv.js";
11
11
  import"./index-z74cqxz0.js";
12
12
  import"./index-evsnq0n2.js";
13
- import"./index-xf9sfr8a.js";
13
+ import"./index-fgqh48qr.js";
14
14
  import"./index-fxwf3n2v.js";
15
15
  import"./index-dkfwkpc8.js";
16
16
  import"./index-sq0478b0.js";
@@ -2,7 +2,7 @@
2
2
  import {
3
3
  buildReactServerComponentsPass2,
4
4
  reactServerPageManifestKeys2
5
- } from "./index-w79snsxv.js";
5
+ } from "./index-5w8arh3m.js";
6
6
  import"./index-aqe25w4h.js";
7
7
  import"./index-3ewt17wm.js";
8
8
  import"./index-pr1skxen.js";
@@ -8,7 +8,7 @@ import {
8
8
  REACT_SERVER_PAYLOAD_GLOBAL,
9
9
  REACT_SERVER_RENDERER_MANIFEST_KEY,
10
10
  REACT_SERVER_RUNTIME_FILE
11
- } from "./index-x1vvn549.js";
11
+ } from "./index-jkg2h10c.js";
12
12
  import {
13
13
  toPascal
14
14
  } from "./index-dw44xa4x.js";
@@ -200,6 +200,51 @@ var analyzeAngularSpaRouteFile = async (filePath) => {
200
200
  sourceFile: filePath
201
201
  };
202
202
  };
203
+ var unwrapExpression = (expression) => {
204
+ if (lazyTypescript.isAsExpression(expression) || lazyTypescript.isSatisfiesExpression(expression) || lazyTypescript.isParenthesizedExpression(expression))
205
+ return unwrapExpression(expression.expression);
206
+ return expression;
207
+ };
208
+ var findColocatedRoutesArray = (sourceFile) => {
209
+ for (const statement of sourceFile.statements) {
210
+ if (!lazyTypescript.isVariableStatement(statement))
211
+ continue;
212
+ const exported = statement.modifiers?.some((modifier) => modifier.kind === lazyTypescript.SyntaxKind.ExportKeyword);
213
+ if (!exported)
214
+ continue;
215
+ for (const declaration of statement.declarationList.declarations) {
216
+ if (!lazyTypescript.isIdentifier(declaration.name))
217
+ continue;
218
+ if (declaration.name.text !== "routes")
219
+ continue;
220
+ if (!declaration.initializer)
221
+ continue;
222
+ const initializer = unwrapExpression(declaration.initializer);
223
+ if (lazyTypescript.isArrayLiteralExpression(initializer))
224
+ return initializer;
225
+ }
226
+ }
227
+ return null;
228
+ };
229
+ var COLOCATED_ROUTES_EXPORT = /\bexport\s+(?:const|let|var)\s+routes\b/;
230
+ var analyzeAngularColocatedRouteFile = async (filePath) => {
231
+ let source;
232
+ try {
233
+ source = await fs.readFile(filePath, "utf-8");
234
+ } catch {
235
+ return null;
236
+ }
237
+ if (!COLOCATED_ROUTES_EXPORT.test(source))
238
+ return null;
239
+ const sourceFile = lazyTypescript.createSourceFile(filePath, source, lazyTypescript.ScriptTarget.Latest, true, lazyTypescript.ScriptKind.TS);
240
+ const routesArray = findColocatedRoutesArray(sourceFile);
241
+ if (!routesArray)
242
+ return null;
243
+ const routes = [];
244
+ extractRoutePaths(routesArray, "", false, routes);
245
+ const host = { baseHref: "/", routes, sourceFile: filePath };
246
+ return host;
247
+ };
203
248
  var walkTsFiles = async (dir, files) => {
204
249
  let items;
205
250
  try {
@@ -222,6 +267,23 @@ var walkTsFiles = async (dir, files) => {
222
267
  }
223
268
  await Promise.all(directories.map((directory) => walkTsFiles(directory, files)));
224
269
  };
270
+ var analyzeAngularColocatedRoutes2 = async (angularDirectory) => {
271
+ if (!existsSync(angularDirectory))
272
+ return [];
273
+ const tsFiles = [];
274
+ await walkTsFiles(angularDirectory, tsFiles);
275
+ const pages = [];
276
+ await Promise.all(tsFiles.map(async (file) => {
277
+ try {
278
+ if (await analyzeAngularSpaRouteFile(file))
279
+ return;
280
+ const page = await analyzeAngularColocatedRouteFile(file);
281
+ if (page)
282
+ pages.push(page);
283
+ } catch {}
284
+ }));
285
+ return pages;
286
+ };
225
287
  var analyzeAngularSpaRoutes2 = async (angularDirectory) => {
226
288
  if (!existsSync(angularDirectory))
227
289
  return [];
@@ -240,4 +302,4 @@ var analyzeAngularSpaRoutes2 = async (angularDirectory) => {
240
302
  return pages;
241
303
  };
242
304
 
243
- export { analyzeAngularSpaRoutes2 };
305
+ export { analyzeAngularColocatedRoutes2, analyzeAngularSpaRoutes2 };
@@ -666,7 +666,7 @@ var deriveManifestKeys = async (config, projectRoot = process.cwd()) => {
666
666
  }
667
667
  const rscDir = at(config.reactServerComponentsDirectory);
668
668
  if (rscDir && existsSync3(join2(rscDir, "pages"))) {
669
- const { reactServerPageManifestKeys } = await import("./buildReactServerComponents-fq6mw10d.js");
669
+ const { reactServerPageManifestKeys } = await import("./buildReactServerComponents-01s87hnk.js");
670
670
  const names = (await scanEntryPoints(join2(rscDir, "pages"), "*.{tsx,jsx,ts,js}")).map((page) => toPascal(stemOf(page)));
671
671
  if (names.length > 0) {
672
672
  definite.add(REACT_SERVER_CLIENT_MANIFEST_KEY);
@@ -769,7 +769,7 @@ var deriveManifestKeys = async (config, projectRoot = process.cwd()) => {
769
769
  htmxDir
770
770
  ].filter((dir) => dir !== undefined && existsSync3(dir));
771
771
  if (frameworkDirs.length > 0) {
772
- const { scanWorkerReferences } = await import("./build-fntmf42w.js");
772
+ const { scanWorkerReferences } = await import("./build-ptx5a72p.js");
773
773
  for (const worker of await scanWorkerReferences(frameworkDirs))
774
774
  possible.add(toPascal(stemOf(worker)));
775
775
  }
package/dist/cli/index.js CHANGED
@@ -222,7 +222,7 @@ if (command === "dev") {
222
222
  } else if (command === "typecheck") {
223
223
  sendTelemetryEvent("cli:command", { command });
224
224
  const configPath = parseNamedArg("--config");
225
- const { typecheck } = await import("./typecheck-488txsfc.js");
225
+ const { typecheck } = await import("./typecheck-ynzw2eep.js");
226
226
  await typecheck(configPath);
227
227
  } else if (command === "migrate") {
228
228
  sendTelemetryEvent("cli:command", { command });
@@ -1,8 +1,10 @@
1
1
  // @bun
2
2
  import {
3
+ analyzeAngularColocatedRoutes2,
3
4
  analyzeAngularSpaRoutes2
4
- } from "./index-xf9sfr8a.js";
5
+ } from "./index-fgqh48qr.js";
5
6
  import"./index-4j1twret.js";
6
7
  export {
8
+ analyzeAngularColocatedRoutes2 as analyzeAngularColocatedRoutes,
7
9
  analyzeAngularSpaRoutes2 as analyzeAngularSpaRoutes
8
10
  };
@@ -18,7 +18,7 @@ import"./index-aqe25w4h.js";
18
18
  import {
19
19
  MANIFEST_KEYS_DECLARATION,
20
20
  writeManifestKeysDeclaration
21
- } from "./index-x1vvn549.js";
21
+ } from "./index-jkg2h10c.js";
22
22
  import {
23
23
  getString,
24
24
  isRecord
@@ -1245,8 +1245,8 @@ var tsconfigHasSvelteDeclarationRoot = (rootDirs) => Array.isArray(rootDirs) &&
1245
1245
  import { resolve as resolve3 } from "path";
1246
1246
  var ANSI_COLOR_REGEX = new RegExp(`${String.fromCharCode(ANSI_ESCAPE_CODE)}\\[[0-9;]*m`, "g");
1247
1247
  var stripAnsi = (text) => text.replace(ANSI_COLOR_REGEX, "");
1248
- var PAREN_FORMAT = /^(.+?)\((\d+),(\d+)\): error (TS\d+)/;
1249
- var COLON_FORMAT = /^(.+?):(\d+):(\d+) - error (TS\d+)/;
1248
+ var PAREN_FORMAT = /^(.+?)\((\d+),(\d+)\): error ((?:TS|NG)\d+)/;
1249
+ var COLON_FORMAT = /^(.+?):(\d+):(\d+) - error ((?:TS|NG)\d+)/;
1250
1250
  var XML_FORMAT = /^<error file="([^"]+)" line="(\d+)" column="(\d+)" code="(TS\d+)">/;
1251
1251
  var PRETTY_CODE = /^error: (TS\d+): /;
1252
1252
  var PRETTY_POSITION = /^\s+at (.+):(\d+):(\d+)$/;
@@ -1621,7 +1621,7 @@ var buildVueCheck = async (cacheDir) => {
1621
1621
  `--out-dir=${resolve4(cacheDir, "vue-check")}`
1622
1622
  ]);
1623
1623
  };
1624
- var buildAngularCheck = async (cacheDir, angularDir) => {
1624
+ var buildAngularCheck = async (cacheDir, angularDirs) => {
1625
1625
  const ngcBin = findBin("ngc");
1626
1626
  if (!ngcBin) {
1627
1627
  console.error("\x1B[31m\u2717\x1B[0m @angular/compiler-cli is required for Angular type checking. Install it: bun add -d @angular/compiler-cli");
@@ -1640,7 +1640,7 @@ var buildAngularCheck = async (cacheDir, angularDir) => {
1640
1640
  extends: resolve4("tsconfig.json"),
1641
1641
  include: [
1642
1642
  ...getProjectDeclarationIncludes(),
1643
- `../${angularDir}/**/*`
1643
+ ...angularDirs.map((angularDir) => `../${angularDir}/**/*`)
1644
1644
  ]
1645
1645
  }, null, "\t"));
1646
1646
  return runShell("ngc", `${shellEscape(ngcBin)} -p ${shellEscape(resolve4(angularTsconfigPath))}`);
@@ -1712,7 +1712,15 @@ var buildBunCheck = async (cacheDir) => {
1712
1712
  await rm2(passFile, { force: true });
1713
1713
  return result;
1714
1714
  };
1715
- var buildSvelteCheck = async (cacheDir, svelteDir) => {
1715
+ var svelteCheckIncludes = (projectRoot, configuredDirs, roots) => {
1716
+ const configured = configuredDirs.map((dir) => resolve4(projectRoot, dir));
1717
+ const strays = roots.filter((root) => !configured.some((dir) => isWithin(dir, resolve4(projectRoot, root))));
1718
+ return [
1719
+ ...configured.map((dir) => `../${relative2(projectRoot, dir) || "."}/**/*`),
1720
+ ...strays.map((root) => `../${root}/**/*.svelte`)
1721
+ ];
1722
+ };
1723
+ var buildSvelteCheck = async (cacheDir, includes) => {
1716
1724
  const svelteBin = findBin("svelte-check");
1717
1725
  if (!svelteBin) {
1718
1726
  console.error("\x1B[31m\u2717\x1B[0m svelte-check is required for Svelte type checking. Install it: bun add -d svelte-check");
@@ -1721,12 +1729,13 @@ var buildSvelteCheck = async (cacheDir, svelteDir) => {
1721
1729
  const svelteTsconfigPath = join2(cacheDir, "tsconfig.svelte-check.json");
1722
1730
  await writeFile2(svelteTsconfigPath, JSON.stringify({
1723
1731
  compilerOptions: { allowJs: true },
1732
+ exclude: getProjectTypecheckExcludes(),
1724
1733
  extends: resolve4("tsconfig.json"),
1725
- files: ABSOLUTE_TYPECHECK_FILES,
1726
- include: [
1727
- ...getProjectDeclarationIncludes(),
1728
- `../${svelteDir}/**/*`
1729
- ]
1734
+ files: [
1735
+ ...ABSOLUTE_TYPECHECK_FILES,
1736
+ ...vueShimPath === null ? [] : [vueShimPath]
1737
+ ],
1738
+ include: [...getProjectDeclarationIncludes(), ...includes]
1730
1739
  }, null, "\t"));
1731
1740
  return run("svelte-check", [
1732
1741
  svelteBin,
@@ -1783,29 +1792,36 @@ var prepareSvelteDeclarations = async (svelteDirs) => {
1783
1792
  console.log(SVELTE_EDITOR_HINT);
1784
1793
  };
1785
1794
  var VUE_CHECKERS = new Set(["vue-check", "vue-tsc"]);
1795
+ var ANGULAR_CHECKERS = new Set(["ngc"]);
1786
1796
  var PLAIN_CHECKERS = new Set(["bun check", "tsc"]);
1787
- var dedupeVueResult = (results) => {
1797
+ var dedupeAgainstPlain = (results, checkers, checkerCwd = process.cwd()) => {
1788
1798
  const plain = results.find((res) => PLAIN_CHECKERS.has(res.name));
1789
1799
  if (!plain || plain.exitCode === 0)
1790
1800
  return results;
1791
1801
  const reported = diagnosticKeys(plain.output);
1792
1802
  return results.map((res) => {
1793
- if (!VUE_CHECKERS.has(res.name) || res.exitCode === 0)
1803
+ if (!checkers.has(res.name) || res.exitCode === 0)
1794
1804
  return res;
1795
- const { dropped, output, remaining } = withoutReported(res.output, reported);
1805
+ const { dropped, output, remaining } = withoutReported(res.output, reported, checkerCwd);
1796
1806
  if (dropped === 0)
1797
1807
  return res;
1798
1808
  const passed = remaining === 0 && output.length === 0;
1799
1809
  return { ...res, exitCode: passed ? 0 : res.exitCode, output };
1800
1810
  });
1801
1811
  };
1812
+ var dedupeAngularResult = (results, cacheDir) => dedupeAgainstPlain(results, ANGULAR_CHECKERS, resolve4(cacheDir));
1813
+ var dedupeVueResult = (results) => dedupeAgainstPlain(results, VUE_CHECKERS);
1802
1814
  var typecheck = async (configPath) => {
1803
1815
  const targets = await getTypecheckTargets(configPath);
1804
1816
  const hasAngular = targets.some((config) => Boolean(config.angularDirectory));
1805
1817
  const configuredSvelteDirs = [
1806
1818
  ...new Set(targets.map((config) => config.svelteDirectory).filter((dir) => typeof dir === "string" && dir.length > 0))
1807
1819
  ];
1808
- const componentFiles = collectComponentFiles(resolve4("."), new Set(targets.flatMap((config) => config.buildDirectory ? [resolve4(config.buildDirectory)] : [])));
1820
+ const outDir = getString(readProjectTsconfig().compilerOptions, "outDir");
1821
+ const componentFiles = collectComponentFiles(resolve4("."), new Set([
1822
+ ...targets.flatMap((config) => config.buildDirectory ? [resolve4(config.buildDirectory)] : []),
1823
+ ...outDir === null ? [] : [resolve4(outDir)]
1824
+ ]));
1809
1825
  const hasVue = targets.some((config) => Boolean(config.vueDirectory)) || componentFiles.vue.length > 0;
1810
1826
  const svelteDirs = svelteRoots(resolve4("."), configuredSvelteDirs, componentFiles.svelte);
1811
1827
  const hasSvelte = svelteDirs.length > 0;
@@ -1830,13 +1846,11 @@ var typecheck = async (configPath) => {
1830
1846
  checks.push(plainCheck(cacheDir));
1831
1847
  if (hasVue)
1832
1848
  checks.push(vueCheck(cacheDir));
1833
- for (const svelteDir of hasSvelte ? svelteDirs : []) {
1834
- checks.push(buildSvelteCheck(cacheDir, svelteDir));
1835
- }
1836
- for (const angularDir of hasAngular ? angularDirs : []) {
1837
- checks.push(buildAngularCheck(cacheDir, angularDir));
1838
- }
1839
- const results = dedupeVueResult(await Promise.all(checks));
1849
+ if (hasSvelte)
1850
+ checks.push(buildSvelteCheck(cacheDir, svelteCheckIncludes(resolve4("."), configuredSvelteDirs, svelteDirs)));
1851
+ if (hasAngular && angularDirs.length > 0)
1852
+ checks.push(buildAngularCheck(cacheDir, angularDirs));
1853
+ const results = dedupeAngularResult(dedupeVueResult(await Promise.all(checks)), cacheDir);
1840
1854
  const failed = results.filter((res) => res.exitCode !== 0);
1841
1855
  const detailedAdvice = importAdviceRequested();
1842
1856
  if (failed.length === 0) {
package/dist/index.js CHANGED
@@ -11268,6 +11268,11 @@ var SPA_ROUTES_KEY = "__absoluteSpaRoutes", setSpaRouteManifest = (hosts) => {
11268
11268
  }, isRuntimeSpaHost = (value) => typeof value === "object" && value !== null && typeof Reflect.get(value, "framework") === "string", getSpaRouteManifest = () => {
11269
11269
  const value = Reflect.get(globalThis, SPA_ROUTES_KEY);
11270
11270
  return Array.isArray(value) ? value.filter(isRuntimeSpaHost) : [];
11271
+ }, OBSERVED_SPA_ROUTES_KEY = "__absoluteObservedSpaRoutes", getObservedSpaRoutes = () => {
11272
+ const value = Reflect.get(globalThis, OBSERVED_SPA_ROUTES_KEY);
11273
+ return Array.isArray(value) ? value.filter(isRuntimeSpaHost) : [];
11274
+ }, setObservedSpaRoutes = (hosts) => {
11275
+ Reflect.set(globalThis, OBSERVED_SPA_ROUTES_KEY, hosts);
11271
11276
  }, normalizePath = (path) => {
11272
11277
  const withLeadingSlash = path.startsWith("/") ? path : `/${path}`;
11273
11278
  const trimmed = withLeadingSlash.replace(/\/+$/, "");
@@ -17541,6 +17546,8 @@ var init_routing = __esm(() => {
17541
17546
  // src/angular/staticAnalyzeSpaRoutes.ts
17542
17547
  var exports_staticAnalyzeSpaRoutes = {};
17543
17548
  __export(exports_staticAnalyzeSpaRoutes, {
17549
+ analyzeAngularColocatedRouteFile: () => analyzeAngularColocatedRouteFile,
17550
+ analyzeAngularColocatedRoutes: () => analyzeAngularColocatedRoutes,
17544
17551
  analyzeAngularSpaRouteFile: () => analyzeAngularSpaRouteFile,
17545
17552
  analyzeAngularSpaRoutes: () => analyzeAngularSpaRoutes
17546
17553
  });
@@ -17728,6 +17735,47 @@ var DYNAMIC_SEGMENT_PATTERN, pathHasDynamic = (path) => path.split("/").some((se
17728
17735
  routes,
17729
17736
  sourceFile: filePath
17730
17737
  };
17738
+ }, unwrapExpression = (expression) => {
17739
+ if (lazyTypescript.isAsExpression(expression) || lazyTypescript.isSatisfiesExpression(expression) || lazyTypescript.isParenthesizedExpression(expression))
17740
+ return unwrapExpression(expression.expression);
17741
+ return expression;
17742
+ }, findColocatedRoutesArray = (sourceFile) => {
17743
+ for (const statement of sourceFile.statements) {
17744
+ if (!lazyTypescript.isVariableStatement(statement))
17745
+ continue;
17746
+ const exported = statement.modifiers?.some((modifier) => modifier.kind === lazyTypescript.SyntaxKind.ExportKeyword);
17747
+ if (!exported)
17748
+ continue;
17749
+ for (const declaration of statement.declarationList.declarations) {
17750
+ if (!lazyTypescript.isIdentifier(declaration.name))
17751
+ continue;
17752
+ if (declaration.name.text !== "routes")
17753
+ continue;
17754
+ if (!declaration.initializer)
17755
+ continue;
17756
+ const initializer = unwrapExpression(declaration.initializer);
17757
+ if (lazyTypescript.isArrayLiteralExpression(initializer))
17758
+ return initializer;
17759
+ }
17760
+ }
17761
+ return null;
17762
+ }, COLOCATED_ROUTES_EXPORT, analyzeAngularColocatedRouteFile = async (filePath) => {
17763
+ let source;
17764
+ try {
17765
+ source = await fs.readFile(filePath, "utf-8");
17766
+ } catch {
17767
+ return null;
17768
+ }
17769
+ if (!COLOCATED_ROUTES_EXPORT.test(source))
17770
+ return null;
17771
+ const sourceFile = lazyTypescript.createSourceFile(filePath, source, lazyTypescript.ScriptTarget.Latest, true, lazyTypescript.ScriptKind.TS);
17772
+ const routesArray = findColocatedRoutesArray(sourceFile);
17773
+ if (!routesArray)
17774
+ return null;
17775
+ const routes = [];
17776
+ extractRoutePaths(routesArray, "", false, routes);
17777
+ const host = { baseHref: "/", routes, sourceFile: filePath };
17778
+ return host;
17731
17779
  }, walkTsFiles = async (dir, files) => {
17732
17780
  let items;
17733
17781
  try {
@@ -17749,6 +17797,22 @@ var DYNAMIC_SEGMENT_PATTERN, pathHasDynamic = (path) => path.split("/").some((se
17749
17797
  }
17750
17798
  }
17751
17799
  await Promise.all(directories.map((directory) => walkTsFiles(directory, files)));
17800
+ }, analyzeAngularColocatedRoutes = async (angularDirectory) => {
17801
+ if (!existsSync27(angularDirectory))
17802
+ return [];
17803
+ const tsFiles = [];
17804
+ await walkTsFiles(angularDirectory, tsFiles);
17805
+ const pages = [];
17806
+ await Promise.all(tsFiles.map(async (file) => {
17807
+ try {
17808
+ if (await analyzeAngularSpaRouteFile(file))
17809
+ return;
17810
+ const page = await analyzeAngularColocatedRouteFile(file);
17811
+ if (page)
17812
+ pages.push(page);
17813
+ } catch {}
17814
+ }));
17815
+ return pages;
17752
17816
  }, analyzeAngularSpaRoutes = async (angularDirectory) => {
17753
17817
  if (!existsSync27(angularDirectory))
17754
17818
  return [];
@@ -17769,6 +17833,7 @@ var DYNAMIC_SEGMENT_PATTERN, pathHasDynamic = (path) => path.split("/").some((se
17769
17833
  var init_staticAnalyzeSpaRoutes = __esm(() => {
17770
17834
  init_lazyTypescript();
17771
17835
  DYNAMIC_SEGMENT_PATTERN = /^[:*]/;
17836
+ COLOCATED_ROUTES_EXPORT = /\bexport\s+(?:const|let|var)\s+routes\b/;
17772
17837
  });
17773
17838
 
17774
17839
  // src/react/staticAnalyzeSpaRoutes.ts
@@ -23498,13 +23563,13 @@ var SKIP_DIRS2, SOURCE_EXTENSIONS3, getScriptKind3 = (filePath) => {
23498
23563
  return name.text;
23499
23564
  }
23500
23565
  return null;
23501
- }, unwrapExpression = (node) => {
23566
+ }, unwrapExpression2 = (node) => {
23502
23567
  if (lazyTypescript.isAsExpression(node) || lazyTypescript.isSatisfiesExpression(node) || lazyTypescript.isParenthesizedExpression(node) || lazyTypescript.isTypeAssertionExpression(node)) {
23503
- return unwrapExpression(node.expression);
23568
+ return unwrapExpression2(node.expression);
23504
23569
  }
23505
23570
  return node;
23506
23571
  }, readLiteral = (node) => {
23507
- const inner = unwrapExpression(node);
23572
+ const inner = unwrapExpression2(node);
23508
23573
  if (lazyTypescript.isStringLiteral(inner) || lazyTypescript.isNoSubstitutionTemplateLiteral(inner)) {
23509
23574
  return inner.text;
23510
23575
  }
@@ -23523,7 +23588,7 @@ var SKIP_DIRS2, SOURCE_EXTENSIONS3, getScriptKind3 = (filePath) => {
23523
23588
  lazyTypescript.forEachChild(sourceFile, visit);
23524
23589
  return constants;
23525
23590
  }, readStringValue = (node, constants) => {
23526
- const inner = unwrapExpression(node);
23591
+ const inner = unwrapExpression2(node);
23527
23592
  if (lazyTypescript.isIdentifier(inner))
23528
23593
  return constants.get(inner.text) ?? null;
23529
23594
  return readLiteral(inner);
@@ -31511,6 +31576,11 @@ ${offenders.map((o) => ` \u2022 ${o}`).join(`
31511
31576
  }))
31512
31577
  ];
31513
31578
  setSpaRouteManifest(spaRouteHosts);
31579
+ const observedAngularHosts = isDev && angularDir ? await Promise.resolve().then(() => (init_staticAnalyzeSpaRoutes(), {})).then((module) => analyzeAngularColocatedRoutes(angularDir)) : [];
31580
+ setObservedSpaRoutes(observedAngularHosts.map((host) => ({
31581
+ ...host,
31582
+ framework: "angular"
31583
+ })));
31514
31584
  writeFileSync16(join64(buildPath, "spa-routes.json"), JSON.stringify(spaRouteHosts, null, "\t"));
31515
31585
  if (isIncremental) {
31516
31586
  writeBuildTrace(buildPath);
@@ -33674,10 +33744,15 @@ var normalizePath3 = (path) => resolve61(path).replace(/\\/g, "/"), owningFramew
33674
33744
  default:
33675
33745
  return null;
33676
33746
  }
33747
+ }, analyzeObservedFile = async (framework, file) => {
33748
+ if (framework !== "angular")
33749
+ return null;
33750
+ return (await Promise.resolve().then(() => (init_staticAnalyzeSpaRoutes(), exports_staticAnalyzeSpaRoutes))).analyzeAngularColocatedRouteFile(file);
33677
33751
  }, readHost = async (framework, file) => {
33678
33752
  try {
33679
33753
  const host = await analyzeFile(framework, file);
33680
- return { host };
33754
+ const observed = host ? null : await analyzeObservedFile(framework, file);
33755
+ return { host, observed };
33681
33756
  } catch (error) {
33682
33757
  logWarn(`Could not re-read SPA routes from ${file}: ${error instanceof Error ? error.message : String(error)}`);
33683
33758
  return null;
@@ -33689,43 +33764,73 @@ var normalizePath3 = (path) => resolve61(path).replace(/\\/g, "/"), owningFramew
33689
33764
  added: [...afterPaths].filter((path) => !beforePaths.has(path)),
33690
33765
  removed: [...beforePaths].filter((path) => !afterPaths.has(path))
33691
33766
  };
33692
- }, refreshSpaRoutesForFiles = async (files, paths) => {
33767
+ }, findHost = (hosts, framework, file) => hosts.find((host) => host.framework === framework && normalizePath3(host.sourceFile) === file), replaceHost = (hosts, change, next) => {
33768
+ const previous = findHost(hosts, change.framework, change.file);
33769
+ return [
33770
+ ...hosts.filter((host) => host !== previous),
33771
+ ...next ? [{ ...next, framework: change.framework }] : []
33772
+ ];
33773
+ }, writeRouteTable = async (hosts, paths) => {
33774
+ setSpaRouteManifest(hosts);
33775
+ try {
33776
+ await writeFile16(join70(paths.buildDir, "spa-routes.json"), JSON.stringify(hosts, null, "\t"));
33777
+ } catch {}
33778
+ }, publishRouteChanges = async (pending, paths) => {
33779
+ if (pending.length === 0)
33780
+ return;
33781
+ let hosts = getSpaRouteManifest();
33782
+ let observed = getObservedSpaRoutes();
33783
+ let enforcedChanged = false;
33784
+ for (const change of pending) {
33785
+ const previous = findHost(hosts, change.framework, change.file);
33786
+ if (hostSignature(previous) !== hostSignature(change.next))
33787
+ enforcedChanged = true;
33788
+ hosts = replaceHost(hosts, change, change.next);
33789
+ observed = replaceHost(observed, change, change.nextObserved);
33790
+ }
33791
+ setObservedSpaRoutes(observed);
33792
+ if (enforcedChanged)
33793
+ await writeRouteTable(hosts, paths);
33794
+ for (const change of pending) {
33795
+ logRoutesUpdate(change.file, change.framework, change.added, change.removed);
33796
+ }
33797
+ }, readSpaRouteChanges = async (files, paths) => {
33693
33798
  const candidates = [...new Set(files.map(normalizePath3))].flatMap((file) => {
33694
33799
  const framework = owningFramework(file, paths);
33695
33800
  return framework ? [{ file, framework }] : [];
33696
33801
  });
33697
- if (candidates.length === 0)
33698
- return [];
33699
- let hosts = getSpaRouteManifest();
33700
- const changes = [];
33802
+ const hosts = getSpaRouteManifest();
33803
+ const observed = getObservedSpaRoutes();
33804
+ const pending = [];
33701
33805
  await Promise.all(candidates.map(async ({ file, framework }) => {
33702
33806
  const read = await readHost(framework, file);
33703
33807
  if (!read)
33704
33808
  return;
33705
- const next = read.host;
33706
- const previous = hosts.find((host) => host.framework === framework && normalizePath3(host.sourceFile) === file);
33707
- if (hostSignature(previous) === hostSignature(next ?? undefined))
33809
+ const previous = findHost(hosts, framework, file);
33810
+ const previousObserved = findHost(observed, framework, file);
33811
+ if (hostSignature(previous) === hostSignature(read.host) && hostSignature(previousObserved) === hostSignature(read.observed))
33708
33812
  return;
33709
- hosts = [
33710
- ...hosts.filter((host) => host !== previous),
33711
- ...next ? [{ ...next, framework }] : []
33712
- ];
33713
- changes.push({
33813
+ pending.push({
33714
33814
  file,
33715
33815
  framework,
33716
- ...diffRoutes(previous, next ?? undefined)
33816
+ next: read.host,
33817
+ nextObserved: read.observed,
33818
+ ...diffRoutes(previous ?? previousObserved, read.host ?? read.observed)
33717
33819
  });
33718
33820
  }));
33719
- if (changes.length === 0)
33720
- return changes;
33721
- setSpaRouteManifest(hosts);
33722
- try {
33723
- await writeFile16(join70(paths.buildDir, "spa-routes.json"), JSON.stringify(hosts, null, "\t"));
33724
- } catch {}
33725
- for (const change of changes) {
33726
- logRoutesUpdate(change.file, change.framework, change.added, change.removed);
33727
- }
33728
- return changes;
33821
+ const changes = pending.map(({ added, file, framework, removed }) => ({
33822
+ added,
33823
+ file,
33824
+ framework,
33825
+ removed
33826
+ }));
33827
+ const publish = async (frameworks) => {
33828
+ const batch = pending.filter((change) => !frameworks || frameworks.includes(change.framework));
33829
+ for (const change of batch)
33830
+ pending.splice(pending.indexOf(change), 1);
33831
+ await publishRouteChanges(batch, paths);
33832
+ };
33833
+ return { changes, publish };
33729
33834
  };
33730
33835
  var init_spaRouteRefresh = __esm(() => {
33731
33836
  init_logger();
@@ -38174,16 +38279,21 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, clearDevSs
38174
38279
  ctx.inFlight = drive();
38175
38280
  ctx.inFlight.then(resolveFn, resolveFn);
38176
38281
  };
38177
- return () => {
38282
+ return ({ immediate = false } = {}) => {
38178
38283
  if (!ctx.debouncedPromise) {
38179
38284
  ctx.debouncedPromise = new Promise((resolve) => {
38180
38285
  ctx.debouncedResolve = resolve;
38181
38286
  });
38182
38287
  }
38288
+ const scheduled = ctx.debouncedPromise;
38183
38289
  if (ctx.debounceTimer)
38184
38290
  clearTimeout(ctx.debounceTimer);
38185
- ctx.debounceTimer = setTimeout(fire, SVELTE_BUNDLE_DEBOUNCE_MS);
38186
- return ctx.debouncedPromise;
38291
+ ctx.debounceTimer = null;
38292
+ if (immediate)
38293
+ fire();
38294
+ else
38295
+ ctx.debounceTimer = setTimeout(fire, SVELTE_BUNDLE_DEBOUNCE_MS);
38296
+ return scheduled;
38187
38297
  };
38188
38298
  }, handleSvelteFastPath = async (state, config, filesToRebuild, startTime, onRebuildComplete) => {
38189
38299
  const svelteDir = config.svelteDirectory ?? "";
@@ -38458,16 +38568,21 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, clearDevSs
38458
38568
  ctx.inFlight = drive();
38459
38569
  ctx.inFlight.then(resolveFn, resolveFn);
38460
38570
  };
38461
- return () => {
38571
+ return ({ immediate = false } = {}) => {
38462
38572
  if (!ctx.debouncedPromise) {
38463
38573
  ctx.debouncedPromise = new Promise((resolve) => {
38464
38574
  ctx.debouncedResolve = resolve;
38465
38575
  });
38466
38576
  }
38577
+ const scheduled = ctx.debouncedPromise;
38467
38578
  if (ctx.debounceTimer)
38468
38579
  clearTimeout(ctx.debounceTimer);
38469
- ctx.debounceTimer = setTimeout(fire, VUE_BUNDLE_DEBOUNCE_MS);
38470
- return ctx.debouncedPromise;
38580
+ ctx.debounceTimer = null;
38581
+ if (immediate)
38582
+ fire();
38583
+ else
38584
+ ctx.debounceTimer = setTimeout(fire, VUE_BUNDLE_DEBOUNCE_MS);
38585
+ return scheduled;
38471
38586
  };
38472
38587
  }, handleVueFastPath = async (state, config, filesToRebuild, startTime, onRebuildComplete) => {
38473
38588
  const vueFiles = filesToRebuild.filter((file) => file.endsWith(".vue") && detectFramework(file, state.resolvedPaths) === "vue");
@@ -39197,9 +39312,29 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, clearDevSs
39197
39312
  await processMarkupFiles(markupFiles);
39198
39313
  }, runHtmlFastPath = async (state, config, filesToRebuild, startTime) => runMarkupFastPath(state, config, filesToRebuild, startTime, "html"), runHtmxFastPath = async (state, config, filesToRebuild, startTime) => runMarkupFastPath(state, config, filesToRebuild, startTime, "htmx"), markHandledFiles = (files, framework, resolvedPaths, handled) => {
39199
39314
  files.filter((f) => detectFramework(f, resolvedPaths) === framework).forEach((f) => handled.add(f));
39315
+ }, rebuildSsrForRouteChanges = async (state, config, changes) => {
39316
+ const changedFiles = (framework) => changes.filter((change) => change.framework === framework).map((change) => change.file);
39317
+ const vueFiles = changedFiles("vue");
39318
+ const svelteFiles = changedFiles("svelte");
39319
+ await Promise.all([
39320
+ vueFiles.length > 0 && config.vueDirectory ? scheduleVueBundleRebuild(state, vueFiles, config)({ immediate: true }) : undefined,
39321
+ svelteFiles.length > 0 && config.svelteDirectory ? scheduleSvelteBundleRebuild(state, svelteFiles, config)({ immediate: true }) : undefined
39322
+ ]);
39323
+ }, flushAngularBundleRebuild = async (state) => {
39324
+ const ctx = angularBundleState.get(state);
39325
+ if (!ctx)
39326
+ return;
39327
+ if (ctx.debounceTimer) {
39328
+ await scheduleAngularBundleRebuild(state, ctx.pageEntries, ctx.angularDir)({ immediate: true });
39329
+ return;
39330
+ }
39331
+ if (ctx.inFlight)
39332
+ await ctx.inFlight;
39200
39333
  }, runFrameworkFastPaths = async (state, config, affectedFrameworks, files, startTime, onRebuildComplete) => {
39201
39334
  const handled = new Set;
39202
- await refreshSpaRoutesForFiles(files, state.resolvedPaths);
39335
+ const routeChanges = await readSpaRouteChanges(files, state.resolvedPaths);
39336
+ await rebuildSsrForRouteChanges(state, config, routeChanges.changes);
39337
+ await routeChanges.publish(["react", "svelte", "vue"]);
39203
39338
  const fastPaths = [
39204
39339
  {
39205
39340
  directory: config.angularDirectory,
@@ -39233,6 +39368,9 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, clearDevSs
39233
39368
  await fastPath.handler(state, config, files, startTime, onRebuildComplete);
39234
39369
  markHandledFiles(files, fastPath.framework, state.resolvedPaths, handled);
39235
39370
  });
39371
+ if (routeChanges.changes.some((change) => change.framework === "angular"))
39372
+ await flushAngularBundleRebuild(state);
39373
+ await routeChanges.publish();
39236
39374
  for (const file of files) {
39237
39375
  if (!handled.has(file) && detectFramework(file, state.resolvedPaths) === "unknown" && !state.lastUserEditedFiles?.has(resolvePath(file)))
39238
39376
  handled.add(file);
@@ -49999,5 +50137,5 @@ export {
49999
50137
  wrapPageHandlerWithStreamingSlots
50000
50138
  };
50001
50139
 
50002
- //# debugId=778B763A7556641B64756E2164756E21
50140
+ //# debugId=87831CE3E620F8A864756E2164756E21
50003
50141
  //# sourceMappingURL=index.js.map