@absolutejs/absolute 0.19.0-beta.953 → 0.19.0-beta.955

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.
package/dist/index.js CHANGED
@@ -11996,24 +11996,6 @@ var init_compileVue = __esm(() => {
11996
11996
  vueHmrMetadata = new Map;
11997
11997
  });
11998
11998
 
11999
- // src/build/rewriteProvideRouter.ts
12000
- var ROUTER_IMPORT_PATTERN, PROVIDE_ROUTER_CALL_PATTERN, CAPTURE_IMPORT_STATEMENT = `import { __abs_provideRouter } from '@absolutejs/absolute/angular';
12001
- `, SHIM_MARKER = "__abs_provideRouter", rewriteAngularProvideRouter = (source) => {
12002
- if (source.includes(SHIM_MARKER))
12003
- return source;
12004
- if (!ROUTER_IMPORT_PATTERN.test(source))
12005
- return source;
12006
- if (!PROVIDE_ROUTER_CALL_PATTERN.test(source))
12007
- return source;
12008
- PROVIDE_ROUTER_CALL_PATTERN.lastIndex = 0;
12009
- const rewritten = source.replace(PROVIDE_ROUTER_CALL_PATTERN, "__abs_provideRouter(");
12010
- return `${CAPTURE_IMPORT_STATEMENT}${rewritten}`;
12011
- };
12012
- var init_rewriteProvideRouter = __esm(() => {
12013
- ROUTER_IMPORT_PATTERN = /import\s*(?:type\s+)?\{[^}]*\bprovideRouter\b[^}]*\}\s*from\s*['"]@angular\/router['"]/;
12014
- PROVIDE_ROUTER_CALL_PATTERN = /\bprovideRouter\s*\(/g;
12015
- });
12016
-
12017
11999
  // src/angular/lowerDeferSyntax.ts
12018
12000
  var isInterpolatedExpressionStart = (value, index) => value[index] === "{" && value[index + 1] === "{", skipInterpolatedExpression = (value, start) => {
12019
12001
  const cursor = start + 2;
@@ -12709,11 +12691,9 @@ var traceAngularPhase = async (name, fn2, metadata2) => {
12709
12691
  return candidates.map((candidate) => resolve24(candidate)).find((candidate) => existsSync18(candidate) && !candidate.endsWith(".d.ts")) ?? null;
12710
12692
  }, readFileForAotTransform = async (fileName, readFile6) => {
12711
12693
  const hostSource = readFile6?.(fileName);
12712
- if (typeof hostSource === "string") {
12713
- return rewriteAngularProvideRouter(hostSource);
12714
- }
12715
- const raw = await fs.readFile(fileName, "utf-8");
12716
- return rewriteAngularProvideRouter(raw);
12694
+ if (typeof hostSource === "string")
12695
+ return hostSource;
12696
+ return fs.readFile(fileName, "utf-8");
12717
12697
  }, safeStableStringify = (value) => {
12718
12698
  const seen = new WeakSet;
12719
12699
  return JSON.stringify(value, (_key, entry) => {
@@ -13307,7 +13287,6 @@ ${fields}
13307
13287
  if (!existsSync18(actualPath))
13308
13288
  return;
13309
13289
  let sourceCode = await fs.readFile(actualPath, "utf-8");
13310
- sourceCode = rewriteAngularProvideRouter(sourceCode);
13311
13290
  const inlined = await inlineResources(sourceCode, dirname15(actualPath), stylePreprocessors);
13312
13291
  sourceCode = inlineTemplateAndLowerDeferSync(inlined.source, dirname15(actualPath)).source;
13313
13292
  const inputDir = dirname15(actualPath);
@@ -13681,7 +13660,6 @@ if (pageHasRawStreamingSlots) {
13681
13660
  };
13682
13661
  };
13683
13662
  var init_compileAngular = __esm(() => {
13684
- init_rewriteProvideRouter();
13685
13663
  init_constants();
13686
13664
  init_sourceMetadata();
13687
13665
  init_lowerDeferSyntax();
@@ -25620,27 +25598,782 @@ var init_imageOptimizer = __esm(() => {
25620
25598
  avifInProgress = new Set;
25621
25599
  });
25622
25600
 
25623
- // src/utils/spaRouteEnumeration.ts
25624
- import { AsyncLocalStorage as AsyncLocalStorage2 } from "async_hooks";
25625
- var STORAGE_KEY, isObjectRecord4 = (value) => Boolean(value) && typeof value === "object", isStorage = (value) => isObjectRecord4(value) && typeof value.getStore === "function" && typeof value.run === "function", getStorage = () => {
25626
- const existing = Reflect.get(globalThis, STORAGE_KEY);
25627
- if (isStorage(existing))
25628
- return existing;
25629
- const fresh = new AsyncLocalStorage2;
25630
- Reflect.set(globalThis, STORAGE_KEY, fresh);
25631
- return fresh;
25632
- }, isCollectingSpaRoutes = () => getStorage().getStore() !== undefined, recordSpaRoutes = (entries) => {
25633
- const store = getStorage().getStore();
25634
- if (!store)
25601
+ // src/angular/staticAnalyzeSpaRoutes.ts
25602
+ import { existsSync as existsSync31, promises as fs2 } from "fs";
25603
+ import { join as join35 } from "path";
25604
+ import ts8 from "typescript";
25605
+ var DYNAMIC_SEGMENT_PATTERN, pathHasDynamic = (path) => path.split("/").some((seg) => DYNAMIC_SEGMENT_PATTERN.test(seg) || seg === "**"), importsSymbolFrom = (sf, localName, moduleSpecifier) => {
25606
+ for (const statement of sf.statements) {
25607
+ if (!ts8.isImportDeclaration(statement))
25608
+ continue;
25609
+ if (!ts8.isStringLiteral(statement.moduleSpecifier))
25610
+ continue;
25611
+ if (statement.moduleSpecifier.text !== moduleSpecifier)
25612
+ continue;
25613
+ const named = statement.importClause?.namedBindings;
25614
+ if (!named || !ts8.isNamedImports(named))
25615
+ continue;
25616
+ for (const element of named.elements) {
25617
+ if (element.name.text === localName)
25618
+ return true;
25619
+ }
25620
+ }
25621
+ return false;
25622
+ }, readStringLiteral = (expression) => {
25623
+ if (ts8.isStringLiteral(expression) || ts8.isNoSubstitutionTemplateLiteral(expression)) {
25624
+ return expression.text;
25625
+ }
25626
+ return null;
25627
+ }, readPropertyKey = (property) => {
25628
+ if (ts8.isPropertyAssignment(property)) {
25629
+ const name = property.name;
25630
+ if (ts8.isIdentifier(name) || ts8.isStringLiteral(name))
25631
+ return name.text;
25632
+ }
25633
+ if (ts8.isShorthandPropertyAssignment(property)) {
25634
+ return property.name.text;
25635
+ }
25636
+ return null;
25637
+ }, findRoutesArrayDeclaration = (sf, identifierName) => {
25638
+ let found = null;
25639
+ const visit = (node) => {
25640
+ if (found)
25641
+ return;
25642
+ if (ts8.isVariableDeclaration(node) && ts8.isIdentifier(node.name) && node.name.text === identifierName && node.initializer && ts8.isArrayLiteralExpression(node.initializer)) {
25643
+ found = node.initializer;
25644
+ return;
25645
+ }
25646
+ ts8.forEachChild(node, visit);
25647
+ };
25648
+ ts8.forEachChild(sf, visit);
25649
+ return found;
25650
+ }, extractSitemapData = (dataLiteral) => {
25651
+ for (const prop of dataLiteral.properties) {
25652
+ const key = readPropertyKey(prop);
25653
+ if (key !== "sitemap")
25654
+ continue;
25655
+ if (!ts8.isPropertyAssignment(prop))
25656
+ continue;
25657
+ const value = readStringLiteral(prop.initializer);
25658
+ if (value === "exclude")
25659
+ return true;
25660
+ }
25661
+ return false;
25662
+ }, joinSegments = (parent, child) => {
25663
+ if (!child)
25664
+ return parent;
25665
+ if (!parent)
25666
+ return child;
25667
+ return `${parent.replace(/\/+$/, "")}/${child.replace(/^\/+/, "")}`;
25668
+ }, extractRoutePaths = (arr, parentPath, parentExcluded, out) => {
25669
+ for (const element of arr.elements) {
25670
+ if (!ts8.isObjectLiteralExpression(element))
25671
+ continue;
25672
+ let pathSegment = null;
25673
+ let redirected = false;
25674
+ let sitemapExcluded = parentExcluded;
25675
+ let childrenLiteral = null;
25676
+ for (const property of element.properties) {
25677
+ const key = readPropertyKey(property);
25678
+ if (!key)
25679
+ continue;
25680
+ if (!ts8.isPropertyAssignment(property))
25681
+ continue;
25682
+ if (key === "path") {
25683
+ pathSegment = readStringLiteral(property.initializer);
25684
+ } else if (key === "redirectTo") {
25685
+ redirected = true;
25686
+ } else if (key === "data" && ts8.isObjectLiteralExpression(property.initializer)) {
25687
+ if (extractSitemapData(property.initializer))
25688
+ sitemapExcluded = true;
25689
+ } else if (key === "children" && ts8.isArrayLiteralExpression(property.initializer)) {
25690
+ childrenLiteral = property.initializer;
25691
+ }
25692
+ }
25693
+ if (pathSegment === null)
25694
+ continue;
25695
+ const joined = joinSegments(parentPath, pathSegment);
25696
+ if (childrenLiteral) {
25697
+ extractRoutePaths(childrenLiteral, joined, sitemapExcluded, out);
25698
+ continue;
25699
+ }
25700
+ if (redirected)
25701
+ continue;
25702
+ if (joined === "")
25703
+ continue;
25704
+ out.push({
25705
+ dynamic: pathHasDynamic(joined),
25706
+ path: joined,
25707
+ redirected,
25708
+ sitemapExcluded
25709
+ });
25710
+ }
25711
+ }, findProvideRouterFirstArg = (sf) => {
25712
+ let found = null;
25713
+ const visit = (node) => {
25714
+ if (found)
25715
+ return;
25716
+ if (ts8.isCallExpression(node) && ts8.isIdentifier(node.expression) && node.expression.text === "provideRouter") {
25717
+ found = node.arguments[0] ?? null;
25718
+ return;
25719
+ }
25720
+ ts8.forEachChild(node, visit);
25721
+ };
25722
+ ts8.forEachChild(sf, visit);
25723
+ return found;
25724
+ }, findAppBaseHrefValue = (sf) => {
25725
+ let found = null;
25726
+ const visit = (node) => {
25727
+ if (found)
25728
+ return;
25729
+ if (ts8.isObjectLiteralExpression(node)) {
25730
+ let isAppBaseHref = false;
25731
+ let value = null;
25732
+ for (const property of node.properties) {
25733
+ const key = readPropertyKey(property);
25734
+ if (!key)
25735
+ continue;
25736
+ if (!ts8.isPropertyAssignment(property))
25737
+ continue;
25738
+ if (key === "provide" && ts8.isIdentifier(property.initializer) && property.initializer.text === "APP_BASE_HREF") {
25739
+ isAppBaseHref = true;
25740
+ } else if (key === "useValue") {
25741
+ value = readStringLiteral(property.initializer);
25742
+ }
25743
+ }
25744
+ if (isAppBaseHref && value !== null) {
25745
+ found = value;
25746
+ return;
25747
+ }
25748
+ }
25749
+ ts8.forEachChild(node, visit);
25750
+ };
25751
+ ts8.forEachChild(sf, visit);
25752
+ return found;
25753
+ }, analyzeFile = async (filePath) => {
25754
+ let source;
25755
+ try {
25756
+ source = await fs2.readFile(filePath, "utf-8");
25757
+ } catch {
25758
+ return null;
25759
+ }
25760
+ if (!source.includes("APP_BASE_HREF") || !source.includes("provideRouter")) {
25761
+ return null;
25762
+ }
25763
+ const sf = ts8.createSourceFile(filePath, source, ts8.ScriptTarget.Latest, true, ts8.ScriptKind.TS);
25764
+ if (!importsSymbolFrom(sf, "APP_BASE_HREF", "@angular/common"))
25765
+ return null;
25766
+ if (!importsSymbolFrom(sf, "provideRouter", "@angular/router"))
25767
+ return null;
25768
+ const baseHref = findAppBaseHrefValue(sf);
25769
+ if (!baseHref)
25770
+ return null;
25771
+ const firstArg = findProvideRouterFirstArg(sf);
25772
+ if (!firstArg)
25773
+ return null;
25774
+ let routesArray = null;
25775
+ if (ts8.isIdentifier(firstArg)) {
25776
+ routesArray = findRoutesArrayDeclaration(sf, firstArg.text);
25777
+ } else if (ts8.isArrayLiteralExpression(firstArg)) {
25778
+ routesArray = firstArg;
25779
+ }
25780
+ if (!routesArray)
25781
+ return null;
25782
+ const routes = [];
25783
+ extractRoutePaths(routesArray, "", false, routes);
25784
+ return {
25785
+ baseHref,
25786
+ routes,
25787
+ sourceFile: filePath
25788
+ };
25789
+ }, walkTsFiles = async (dir, out) => {
25790
+ let items;
25791
+ try {
25792
+ items = await fs2.readdir(dir, { withFileTypes: true });
25793
+ } catch {
25794
+ return;
25795
+ }
25796
+ for (const item of items) {
25797
+ if (item.name === "node_modules")
25798
+ continue;
25799
+ if (item.name.startsWith("."))
25800
+ continue;
25801
+ const full = join35(dir, item.name);
25802
+ if (item.isDirectory()) {
25803
+ await walkTsFiles(full, out);
25804
+ } else if (item.isFile() && item.name.endsWith(".ts") && !item.name.endsWith(".d.ts")) {
25805
+ out.push(full);
25806
+ }
25807
+ }
25808
+ }, analyzeAngularSpaRoutes = async (angularDirectory) => {
25809
+ if (!existsSync31(angularDirectory))
25810
+ return [];
25811
+ const tsFiles = [];
25812
+ await walkTsFiles(angularDirectory, tsFiles);
25813
+ const pages = [];
25814
+ await Promise.all(tsFiles.map(async (file5) => {
25815
+ try {
25816
+ const page = await analyzeFile(file5);
25817
+ if (page)
25818
+ pages.push(page);
25819
+ } catch (err) {
25820
+ console.warn(`[sitemap] Angular SPA analysis failed for ${file5}:`, err);
25821
+ }
25822
+ }));
25823
+ return pages;
25824
+ };
25825
+ var init_staticAnalyzeSpaRoutes = __esm(() => {
25826
+ DYNAMIC_SEGMENT_PATTERN = /^[:*]/;
25827
+ });
25828
+
25829
+ // src/react/staticAnalyzeSpaRoutes.ts
25830
+ import { existsSync as existsSync32, promises as fs3 } from "fs";
25831
+ import { join as join36 } from "path";
25832
+ import ts9 from "typescript";
25833
+ var DYNAMIC_SEGMENT_PATTERN2, pathHasDynamic2 = (path) => path.split("/").some((seg) => DYNAMIC_SEGMENT_PATTERN2.test(seg) || seg === "**"), readStringLiteral2 = (expression) => {
25834
+ if (ts9.isStringLiteral(expression) || ts9.isNoSubstitutionTemplateLiteral(expression)) {
25835
+ return expression.text;
25836
+ }
25837
+ return null;
25838
+ }, readPropertyKey2 = (property) => {
25839
+ if (ts9.isPropertyAssignment(property)) {
25840
+ const name = property.name;
25841
+ if (ts9.isIdentifier(name) || ts9.isStringLiteral(name))
25842
+ return name.text;
25843
+ }
25844
+ if (ts9.isShorthandPropertyAssignment(property)) {
25845
+ return property.name.text;
25846
+ }
25847
+ return null;
25848
+ }, importsSymbolFromAny = (sf, localName, moduleSpecifiers) => {
25849
+ for (const statement of sf.statements) {
25850
+ if (!ts9.isImportDeclaration(statement))
25851
+ continue;
25852
+ if (!ts9.isStringLiteral(statement.moduleSpecifier))
25853
+ continue;
25854
+ if (!moduleSpecifiers.includes(statement.moduleSpecifier.text))
25855
+ continue;
25856
+ const named = statement.importClause?.namedBindings;
25857
+ if (!named || !ts9.isNamedImports(named))
25858
+ continue;
25859
+ for (const element of named.elements) {
25860
+ if (element.name.text === localName)
25861
+ return true;
25862
+ }
25863
+ }
25864
+ return false;
25865
+ }, findVariableArrayDeclaration = (sf, identifierName) => {
25866
+ let found = null;
25867
+ const visit = (node) => {
25868
+ if (found)
25869
+ return;
25870
+ if (ts9.isVariableDeclaration(node) && ts9.isIdentifier(node.name) && node.name.text === identifierName && node.initializer && ts9.isArrayLiteralExpression(node.initializer)) {
25871
+ found = node.initializer;
25872
+ return;
25873
+ }
25874
+ ts9.forEachChild(node, visit);
25875
+ };
25876
+ ts9.forEachChild(sf, visit);
25877
+ return found;
25878
+ }, joinSegments2 = (parent, child) => {
25879
+ if (!child)
25880
+ return parent;
25881
+ if (!parent)
25882
+ return child;
25883
+ return `${parent.replace(/\/+$/, "")}/${child.replace(/^\/+/, "")}`;
25884
+ }, extractRouteEntries = (arr, parentPath, out) => {
25885
+ for (const element of arr.elements) {
25886
+ if (!ts9.isObjectLiteralExpression(element))
25887
+ continue;
25888
+ let pathSegment = null;
25889
+ let redirected = false;
25890
+ let sitemapExcluded = false;
25891
+ let childrenLiteral = null;
25892
+ let isIndex = false;
25893
+ for (const property of element.properties) {
25894
+ const key = readPropertyKey2(property);
25895
+ if (!key)
25896
+ continue;
25897
+ if (!ts9.isPropertyAssignment(property))
25898
+ continue;
25899
+ if (key === "path") {
25900
+ pathSegment = readStringLiteral2(property.initializer);
25901
+ } else if (key === "index") {
25902
+ isIndex = true;
25903
+ } else if (key === "loader" || key === "lazy") {} else if (key === "children" && ts9.isArrayLiteralExpression(property.initializer)) {
25904
+ childrenLiteral = property.initializer;
25905
+ } else if (key === "redirectTo") {
25906
+ redirected = true;
25907
+ } else if (key === "handle" && ts9.isObjectLiteralExpression(property.initializer)) {
25908
+ for (const handleProp of property.initializer.properties) {
25909
+ const handleKey = readPropertyKey2(handleProp);
25910
+ if (handleKey !== "sitemap")
25911
+ continue;
25912
+ if (!ts9.isPropertyAssignment(handleProp))
25913
+ continue;
25914
+ const value = readStringLiteral2(handleProp.initializer);
25915
+ if (value === "exclude")
25916
+ sitemapExcluded = true;
25917
+ }
25918
+ }
25919
+ }
25920
+ const segment = pathSegment ?? "";
25921
+ const joined = joinSegments2(parentPath, segment);
25922
+ if (childrenLiteral) {
25923
+ extractRouteEntries(childrenLiteral, joined, out);
25924
+ continue;
25925
+ }
25926
+ if (redirected)
25927
+ continue;
25928
+ if (!isIndex && pathSegment === null)
25929
+ continue;
25930
+ if (joined === "")
25931
+ continue;
25932
+ out.push({
25933
+ dynamic: pathHasDynamic2(joined),
25934
+ path: joined,
25935
+ redirected,
25936
+ sitemapExcluded
25937
+ });
25938
+ }
25939
+ }, findCreateBrowserRouterCall = (sf) => {
25940
+ let found = null;
25941
+ const visit = (node) => {
25942
+ if (found)
25943
+ return;
25944
+ if (ts9.isCallExpression(node) && ts9.isIdentifier(node.expression) && node.expression.text === "createBrowserRouter") {
25945
+ found = node;
25946
+ return;
25947
+ }
25948
+ ts9.forEachChild(node, visit);
25949
+ };
25950
+ ts9.forEachChild(sf, visit);
25951
+ return found;
25952
+ }, readBasenameFromOptions = (expression) => {
25953
+ if (!expression || !ts9.isObjectLiteralExpression(expression))
25954
+ return null;
25955
+ for (const property of expression.properties) {
25956
+ const key = readPropertyKey2(property);
25957
+ if (key !== "basename")
25958
+ continue;
25959
+ if (!ts9.isPropertyAssignment(property))
25960
+ continue;
25961
+ const value = readStringLiteral2(property.initializer);
25962
+ if (value !== null)
25963
+ return value;
25964
+ }
25965
+ return null;
25966
+ }, analyzeFile2 = async (filePath) => {
25967
+ let source;
25968
+ try {
25969
+ source = await fs3.readFile(filePath, "utf-8");
25970
+ } catch {
25971
+ return null;
25972
+ }
25973
+ if (!source.includes("createBrowserRouter"))
25974
+ return null;
25975
+ const sf = ts9.createSourceFile(filePath, source, ts9.ScriptTarget.Latest, true, filePath.endsWith(".tsx") ? ts9.ScriptKind.TSX : ts9.ScriptKind.TS);
25976
+ if (!importsSymbolFromAny(sf, "createBrowserRouter", [
25977
+ "react-router-dom",
25978
+ "react-router"
25979
+ ])) {
25980
+ return null;
25981
+ }
25982
+ const call = findCreateBrowserRouterCall(sf);
25983
+ if (!call)
25984
+ return null;
25985
+ const routesArg = call.arguments[0];
25986
+ if (!routesArg)
25987
+ return null;
25988
+ let routesArray = null;
25989
+ if (ts9.isArrayLiteralExpression(routesArg)) {
25990
+ routesArray = routesArg;
25991
+ } else if (ts9.isIdentifier(routesArg)) {
25992
+ routesArray = findVariableArrayDeclaration(sf, routesArg.text);
25993
+ }
25994
+ if (!routesArray)
25995
+ return null;
25996
+ const basename14 = readBasenameFromOptions(call.arguments[1]);
25997
+ const baseHref = basename14 ? `${basename14.replace(/\/+$/, "")}/` : "/";
25998
+ const routes = [];
25999
+ extractRouteEntries(routesArray, "", routes);
26000
+ return { baseHref, routes, sourceFile: filePath };
26001
+ }, walkSourceFiles = async (dir, out) => {
26002
+ let items;
26003
+ try {
26004
+ items = await fs3.readdir(dir, { withFileTypes: true });
26005
+ } catch {
25635
26006
  return;
25636
- store.entries.push(...entries);
25637
- }, collectSpaRoutes = async (task) => {
25638
- const store = { entries: [] };
25639
- await getStorage().run(store, task);
25640
- return store.entries;
26007
+ }
26008
+ for (const item of items) {
26009
+ if (item.name === "node_modules" || item.name.startsWith("."))
26010
+ continue;
26011
+ const full = join36(dir, item.name);
26012
+ if (item.isDirectory()) {
26013
+ await walkSourceFiles(full, out);
26014
+ } else if (item.isFile() && (item.name.endsWith(".tsx") || item.name.endsWith(".ts") || item.name.endsWith(".jsx") || item.name.endsWith(".js")) && !item.name.endsWith(".d.ts")) {
26015
+ out.push(full);
26016
+ }
26017
+ }
26018
+ }, analyzeReactSpaRoutes = async (reactDirectory) => {
26019
+ if (!existsSync32(reactDirectory))
26020
+ return [];
26021
+ const files = [];
26022
+ await walkSourceFiles(reactDirectory, files);
26023
+ const hosts = [];
26024
+ await Promise.all(files.map(async (file5) => {
26025
+ try {
26026
+ const host = await analyzeFile2(file5);
26027
+ if (host)
26028
+ hosts.push(host);
26029
+ } catch (err) {
26030
+ console.warn(`[sitemap] React SPA analysis failed for ${file5}:`, err);
26031
+ }
26032
+ }));
26033
+ return hosts;
25641
26034
  };
25642
- var init_spaRouteEnumeration = __esm(() => {
25643
- STORAGE_KEY = Symbol.for("absolutejs.spaRouteEnumerationStorage");
26035
+ var init_staticAnalyzeSpaRoutes2 = __esm(() => {
26036
+ DYNAMIC_SEGMENT_PATTERN2 = /^[:*]/;
26037
+ });
26038
+
26039
+ // src/svelte/staticAnalyzeSpaRoutes.ts
26040
+ import { existsSync as existsSync33, promises as fs4 } from "fs";
26041
+ import { join as join37 } from "path";
26042
+ var DYNAMIC_SEGMENT_PATTERN3, pathHasDynamic3 = (path) => path.split("/").some((seg) => DYNAMIC_SEGMENT_PATTERN3.test(seg) || seg === "**"), joinSegments3 = (parent, child) => {
26043
+ if (!child)
26044
+ return parent;
26045
+ if (!parent)
26046
+ return child;
26047
+ return `${parent.replace(/\/+$/, "")}/${child.replace(/^\/+/, "")}`;
26048
+ }, readAttribute = (tag, name) => {
26049
+ const re2 = new RegExp(`${name}\\s*=\\s*(?:"([^"]*)"|'([^']*)'|\\{?["']([^"']+)["']\\}?)`);
26050
+ const match = re2.exec(tag);
26051
+ return match ? match[1] ?? match[2] ?? match[3] ?? null : null;
26052
+ }, ROUTER_OPEN_TAG_PATTERN, ROUTE_TAG_PATTERN, findRouterBlock = (source) => {
26053
+ const openMatch = ROUTER_OPEN_TAG_PATTERN.exec(source);
26054
+ ROUTER_OPEN_TAG_PATTERN.lastIndex = 0;
26055
+ if (!openMatch)
26056
+ return null;
26057
+ const attrs = openMatch[1] ?? "";
26058
+ const basepathRaw = readAttribute(`<Router ${attrs}>`, "basepath");
26059
+ const basepath = basepathRaw ?? "/";
26060
+ const closeIndex = source.indexOf("</Router>", openMatch.index);
26061
+ if (closeIndex === -1)
26062
+ return null;
26063
+ const body = source.slice(openMatch.index + openMatch[0].length, closeIndex);
26064
+ return { basepath, body };
26065
+ }, extractRoutesFromBody = (body) => {
26066
+ const out = [];
26067
+ let match;
26068
+ ROUTE_TAG_PATTERN.lastIndex = 0;
26069
+ while ((match = ROUTE_TAG_PATTERN.exec(body)) !== null) {
26070
+ const attrs = match[1] ?? "";
26071
+ const path = readAttribute(`<Route ${attrs}/>`, "path");
26072
+ if (!path)
26073
+ continue;
26074
+ out.push({
26075
+ dynamic: pathHasDynamic3(path),
26076
+ path,
26077
+ redirected: false,
26078
+ sitemapExcluded: false
26079
+ });
26080
+ }
26081
+ return out;
26082
+ }, analyzeFile3 = async (filePath) => {
26083
+ let source;
26084
+ try {
26085
+ source = await fs4.readFile(filePath, "utf-8");
26086
+ } catch {
26087
+ return null;
26088
+ }
26089
+ if (!source.includes("<Router"))
26090
+ return null;
26091
+ const block = findRouterBlock(source);
26092
+ if (!block)
26093
+ return null;
26094
+ const routes = extractRoutesFromBody(block.body);
26095
+ if (routes.length === 0)
26096
+ return null;
26097
+ const baseHref = block.basepath.endsWith("/") ? block.basepath : `${block.basepath}/`;
26098
+ const joinedRoutes = routes.map((r) => ({
26099
+ ...r,
26100
+ path: joinSegments3("", r.path)
26101
+ }));
26102
+ return { baseHref, routes: joinedRoutes, sourceFile: filePath };
26103
+ }, walkSvelteFiles = async (dir, out) => {
26104
+ let items;
26105
+ try {
26106
+ items = await fs4.readdir(dir, { withFileTypes: true });
26107
+ } catch {
26108
+ return;
26109
+ }
26110
+ for (const item of items) {
26111
+ if (item.name === "node_modules" || item.name.startsWith("."))
26112
+ continue;
26113
+ const full = join37(dir, item.name);
26114
+ if (item.isDirectory()) {
26115
+ await walkSvelteFiles(full, out);
26116
+ } else if (item.isFile() && item.name.endsWith(".svelte")) {
26117
+ out.push(full);
26118
+ }
26119
+ }
26120
+ }, analyzeSvelteSpaRoutes = async (svelteDirectory) => {
26121
+ if (!existsSync33(svelteDirectory))
26122
+ return [];
26123
+ const files = [];
26124
+ await walkSvelteFiles(svelteDirectory, files);
26125
+ const hosts = [];
26126
+ await Promise.all(files.map(async (file5) => {
26127
+ try {
26128
+ const host = await analyzeFile3(file5);
26129
+ if (host)
26130
+ hosts.push(host);
26131
+ } catch (err) {
26132
+ console.warn(`[sitemap] Svelte SPA analysis failed for ${file5}:`, err);
26133
+ }
26134
+ }));
26135
+ return hosts;
26136
+ };
26137
+ var init_staticAnalyzeSpaRoutes3 = __esm(() => {
26138
+ DYNAMIC_SEGMENT_PATTERN3 = /^[:*]/;
26139
+ ROUTER_OPEN_TAG_PATTERN = /<Router\b([^>]*)>/g;
26140
+ ROUTE_TAG_PATTERN = /<Route\b([^>]*)\/?>/g;
26141
+ });
26142
+
26143
+ // src/vue/staticAnalyzeSpaRoutes.ts
26144
+ import { existsSync as existsSync34, promises as fs5 } from "fs";
26145
+ import { join as join38 } from "path";
26146
+ import ts10 from "typescript";
26147
+ var DYNAMIC_SEGMENT_PATTERN4, pathHasDynamic4 = (path) => path.split("/").some((seg) => DYNAMIC_SEGMENT_PATTERN4.test(seg) || seg === "**"), readStringLiteral3 = (expression) => {
26148
+ if (ts10.isStringLiteral(expression) || ts10.isNoSubstitutionTemplateLiteral(expression)) {
26149
+ return expression.text;
26150
+ }
26151
+ return null;
26152
+ }, readPropertyKey3 = (property) => {
26153
+ if (ts10.isPropertyAssignment(property)) {
26154
+ const name = property.name;
26155
+ if (ts10.isIdentifier(name) || ts10.isStringLiteral(name))
26156
+ return name.text;
26157
+ }
26158
+ if (ts10.isShorthandPropertyAssignment(property)) {
26159
+ return property.name.text;
26160
+ }
26161
+ return null;
26162
+ }, importsSymbolFrom2 = (sf, localName, moduleSpecifier) => {
26163
+ for (const statement of sf.statements) {
26164
+ if (!ts10.isImportDeclaration(statement))
26165
+ continue;
26166
+ if (!ts10.isStringLiteral(statement.moduleSpecifier))
26167
+ continue;
26168
+ if (statement.moduleSpecifier.text !== moduleSpecifier)
26169
+ continue;
26170
+ const named = statement.importClause?.namedBindings;
26171
+ if (!named || !ts10.isNamedImports(named))
26172
+ continue;
26173
+ for (const element of named.elements) {
26174
+ if (element.name.text === localName)
26175
+ return true;
26176
+ }
26177
+ }
26178
+ return false;
26179
+ }, findVariableArrayDeclaration2 = (sf, identifierName) => {
26180
+ let found = null;
26181
+ const visit = (node) => {
26182
+ if (found)
26183
+ return;
26184
+ if (ts10.isVariableDeclaration(node) && ts10.isIdentifier(node.name) && node.name.text === identifierName && node.initializer && ts10.isArrayLiteralExpression(node.initializer)) {
26185
+ found = node.initializer;
26186
+ return;
26187
+ }
26188
+ ts10.forEachChild(node, visit);
26189
+ };
26190
+ ts10.forEachChild(sf, visit);
26191
+ return found;
26192
+ }, joinSegments4 = (parent, child) => {
26193
+ if (!child)
26194
+ return parent;
26195
+ if (!parent)
26196
+ return child;
26197
+ return `${parent.replace(/\/+$/, "")}/${child.replace(/^\/+/, "")}`;
26198
+ }, extractRouteEntries2 = (arr, parentPath, out) => {
26199
+ for (const element of arr.elements) {
26200
+ if (!ts10.isObjectLiteralExpression(element))
26201
+ continue;
26202
+ let pathSegment = null;
26203
+ let redirected = false;
26204
+ let sitemapExcluded = false;
26205
+ let childrenLiteral = null;
26206
+ for (const property of element.properties) {
26207
+ const key = readPropertyKey3(property);
26208
+ if (!key)
26209
+ continue;
26210
+ if (!ts10.isPropertyAssignment(property))
26211
+ continue;
26212
+ if (key === "path") {
26213
+ pathSegment = readStringLiteral3(property.initializer);
26214
+ } else if (key === "redirect") {
26215
+ redirected = true;
26216
+ } else if (key === "children" && ts10.isArrayLiteralExpression(property.initializer)) {
26217
+ childrenLiteral = property.initializer;
26218
+ } else if (key === "meta" && ts10.isObjectLiteralExpression(property.initializer)) {
26219
+ for (const metaProp of property.initializer.properties) {
26220
+ const metaKey = readPropertyKey3(metaProp);
26221
+ if (metaKey !== "sitemap")
26222
+ continue;
26223
+ if (!ts10.isPropertyAssignment(metaProp))
26224
+ continue;
26225
+ const value = readStringLiteral3(metaProp.initializer);
26226
+ if (value === "exclude")
26227
+ sitemapExcluded = true;
26228
+ }
26229
+ }
26230
+ }
26231
+ if (pathSegment === null)
26232
+ continue;
26233
+ const joined = joinSegments4(parentPath, pathSegment);
26234
+ if (childrenLiteral) {
26235
+ extractRouteEntries2(childrenLiteral, joined, out);
26236
+ continue;
26237
+ }
26238
+ if (redirected)
26239
+ continue;
26240
+ if (joined === "")
26241
+ continue;
26242
+ out.push({
26243
+ dynamic: pathHasDynamic4(joined),
26244
+ path: joined,
26245
+ redirected,
26246
+ sitemapExcluded
26247
+ });
26248
+ }
26249
+ }, findCreateRouterCall = (sf) => {
26250
+ let found = null;
26251
+ const visit = (node) => {
26252
+ if (found)
26253
+ return;
26254
+ if (ts10.isCallExpression(node) && ts10.isIdentifier(node.expression) && node.expression.text === "createRouter") {
26255
+ found = node;
26256
+ return;
26257
+ }
26258
+ ts10.forEachChild(node, visit);
26259
+ };
26260
+ ts10.forEachChild(sf, visit);
26261
+ return found;
26262
+ }, findCreateWebHistoryBase = (sf) => {
26263
+ let found = null;
26264
+ const visit = (node) => {
26265
+ if (found)
26266
+ return;
26267
+ if (ts10.isCallExpression(node) && ts10.isIdentifier(node.expression) && (node.expression.text === "createWebHistory" || node.expression.text === "createWebHashHistory")) {
26268
+ const baseArg = node.arguments[0];
26269
+ if (baseArg) {
26270
+ const text = readStringLiteral3(baseArg);
26271
+ if (text !== null) {
26272
+ found = text;
26273
+ return;
26274
+ }
26275
+ } else {
26276
+ found = "/";
26277
+ return;
26278
+ }
26279
+ }
26280
+ ts10.forEachChild(node, visit);
26281
+ };
26282
+ ts10.forEachChild(sf, visit);
26283
+ return found;
26284
+ }, readRoutesFromCreateRouterOptions = (sf, optionsExpr) => {
26285
+ if (!ts10.isObjectLiteralExpression(optionsExpr))
26286
+ return null;
26287
+ for (const property of optionsExpr.properties) {
26288
+ const key = readPropertyKey3(property);
26289
+ if (key !== "routes")
26290
+ continue;
26291
+ if (ts10.isShorthandPropertyAssignment(property)) {
26292
+ return findVariableArrayDeclaration2(sf, property.name.text);
26293
+ }
26294
+ if (!ts10.isPropertyAssignment(property))
26295
+ continue;
26296
+ if (ts10.isArrayLiteralExpression(property.initializer)) {
26297
+ return property.initializer;
26298
+ }
26299
+ if (ts10.isIdentifier(property.initializer)) {
26300
+ return findVariableArrayDeclaration2(sf, property.initializer.text);
26301
+ }
26302
+ }
26303
+ return null;
26304
+ }, extractScriptBlockFromVueSfc = (source) => {
26305
+ const scriptRe = /<script\b[^>]*?(?:setup)?[^>]*>([\s\S]*?)<\/script>/i;
26306
+ const match = scriptRe.exec(source);
26307
+ return match ? match[1] ?? null : null;
26308
+ }, analyzeFile4 = async (filePath) => {
26309
+ let source;
26310
+ try {
26311
+ source = await fs5.readFile(filePath, "utf-8");
26312
+ } catch {
26313
+ return null;
26314
+ }
26315
+ let analysisSource = source;
26316
+ if (filePath.endsWith(".vue")) {
26317
+ const script = extractScriptBlockFromVueSfc(source);
26318
+ if (script === null)
26319
+ return null;
26320
+ analysisSource = script;
26321
+ }
26322
+ if (!analysisSource.includes("createRouter"))
26323
+ return null;
26324
+ const sf = ts10.createSourceFile(filePath, analysisSource, ts10.ScriptTarget.Latest, true, ts10.ScriptKind.TS);
26325
+ if (!importsSymbolFrom2(sf, "createRouter", "vue-router"))
26326
+ return null;
26327
+ const call = findCreateRouterCall(sf);
26328
+ if (!call)
26329
+ return null;
26330
+ const optionsArg = call.arguments[0];
26331
+ if (!optionsArg)
26332
+ return null;
26333
+ const routesArray = readRoutesFromCreateRouterOptions(sf, optionsArg);
26334
+ if (!routesArray)
26335
+ return null;
26336
+ const base = findCreateWebHistoryBase(sf) ?? "/";
26337
+ const baseHref = base.endsWith("/") ? base : `${base}/`;
26338
+ const routes = [];
26339
+ extractRouteEntries2(routesArray, "", routes);
26340
+ return { baseHref, routes, sourceFile: filePath };
26341
+ }, walkSourceFiles2 = async (dir, out) => {
26342
+ let items;
26343
+ try {
26344
+ items = await fs5.readdir(dir, { withFileTypes: true });
26345
+ } catch {
26346
+ return;
26347
+ }
26348
+ for (const item of items) {
26349
+ if (item.name === "node_modules" || item.name.startsWith("."))
26350
+ continue;
26351
+ const full = join38(dir, item.name);
26352
+ if (item.isDirectory()) {
26353
+ await walkSourceFiles2(full, out);
26354
+ } else if (item.isFile() && (item.name.endsWith(".ts") || item.name.endsWith(".js") || item.name.endsWith(".vue")) && !item.name.endsWith(".d.ts")) {
26355
+ out.push(full);
26356
+ }
26357
+ }
26358
+ }, analyzeVueSpaRoutes = async (vueDirectory) => {
26359
+ if (!existsSync34(vueDirectory))
26360
+ return [];
26361
+ const files = [];
26362
+ await walkSourceFiles2(vueDirectory, files);
26363
+ const hosts = [];
26364
+ await Promise.all(files.map(async (file5) => {
26365
+ try {
26366
+ const host = await analyzeFile4(file5);
26367
+ if (host)
26368
+ hosts.push(host);
26369
+ } catch (err) {
26370
+ console.warn(`[sitemap] Vue SPA analysis failed for ${file5}:`, err);
26371
+ }
26372
+ }));
26373
+ return hosts;
26374
+ };
26375
+ var init_staticAnalyzeSpaRoutes4 = __esm(() => {
26376
+ DYNAMIC_SEGMENT_PATTERN4 = /^[:*]/;
25644
26377
  });
25645
26378
 
25646
26379
  // src/utils/generateSitemap.ts
@@ -25657,22 +26390,31 @@ var DEFAULT_PRIORITY = 0.8, escapeXml = (str) => str.replace(/&/g, "&amp;").repl
25657
26390
  return true;
25658
26391
  }
25659
26392
  return false;
25660
- }, discoverPageRoutes = (routes, exclude) => {
26393
+ }, stripTrailingWildcard = (path) => path.replace(/\/\*+$/, ""), isWildcardPagePath = (path) => path.endsWith("/*") || path.endsWith("*"), discoverPageRoutes = (routes, exclude) => {
25661
26394
  const seen = new Set;
25662
- return routes.filter((route) => {
26395
+ const out = [];
26396
+ for (const route of routes) {
25663
26397
  if (route.method !== "GET")
25664
- return false;
25665
- if (route.path.includes("*") || route.path.includes(":"))
25666
- return false;
25667
- if (seen.has(route.path))
25668
- return false;
25669
- if (isExcluded(route.path, exclude))
25670
- return false;
26398
+ continue;
26399
+ if (route.path.includes(":"))
26400
+ continue;
26401
+ const mountPath = stripTrailingWildcard(route.path);
26402
+ if (mountPath.includes("*"))
26403
+ continue;
25671
26404
  if (!isPageHandler(route.handler))
25672
- return false;
25673
- seen.add(route.path);
25674
- return true;
25675
- });
26405
+ continue;
26406
+ if (seen.has(mountPath))
26407
+ continue;
26408
+ if (isExcluded(mountPath, exclude))
26409
+ continue;
26410
+ seen.add(mountPath);
26411
+ out.push({
26412
+ emitTopLevel: !isWildcardPagePath(route.path),
26413
+ mountPath,
26414
+ rawPath: route.path
26415
+ });
26416
+ }
26417
+ return out;
25676
26418
  }, joinMountAndSubPath = (mount, sub) => {
25677
26419
  const trimmedMount = mount.replace(/\/+$/, "");
25678
26420
  const trimmedSub = sub.replace(/^\/+/, "");
@@ -25681,27 +26423,30 @@ var DEFAULT_PRIORITY = 0.8, escapeXml = (str) => str.replace(/&/g, "&amp;").repl
25681
26423
  if (!trimmedMount)
25682
26424
  return `/${trimmedSub}`;
25683
26425
  return `${trimmedMount}/${trimmedSub}`;
26426
+ }, normalizeMountFromBaseHref = (baseHref) => {
26427
+ const stripped = baseHref.replace(/\/+$/, "");
26428
+ return stripped === "" ? "/" : stripped;
25684
26429
  }, buildSitemapXml = (entries, baseUrl, config) => {
25685
26430
  const normalizedBase = baseUrl.replace(/\/$/, "");
25686
26431
  const xml = [];
25687
26432
  for (const entry of entries) {
25688
26433
  const override = config.overrides?.[entry.path];
25689
- const changefreq = override?.changefreq ?? entry.changefreq ?? config.defaultChangefreq ?? "weekly";
25690
- const priority = override?.priority ?? entry.priority ?? config.defaultPriority ?? DEFAULT_PRIORITY;
25691
- const lastmod = override?.lastmod ?? entry.lastmod;
26434
+ const changefreq = override?.changefreq ?? config.defaultChangefreq ?? "weekly";
26435
+ const priority = override?.priority ?? config.defaultPriority ?? DEFAULT_PRIORITY;
26436
+ const lastmod = override?.lastmod;
25692
26437
  const url = escapeXml(`${normalizedBase}${entry.path}`);
25693
- let urlBlock = ` <url>
26438
+ let block = ` <url>
25694
26439
  <loc>${url}</loc>`;
25695
26440
  if (lastmod)
25696
- urlBlock += `
26441
+ block += `
25697
26442
  <lastmod>${lastmod}</lastmod>`;
25698
- urlBlock += `
26443
+ block += `
25699
26444
  <changefreq>${changefreq}</changefreq>`;
25700
- urlBlock += `
26445
+ block += `
25701
26446
  <priority>${priority}</priority>`;
25702
- urlBlock += `
26447
+ block += `
25703
26448
  </url>`;
25704
- xml.push(urlBlock);
26449
+ xml.push(block);
25705
26450
  }
25706
26451
  return [
25707
26452
  '<?xml version="1.0" encoding="UTF-8"?>',
@@ -25710,59 +26455,74 @@ var DEFAULT_PRIORITY = 0.8, escapeXml = (str) => str.replace(/&/g, "&amp;").repl
25710
26455
  "</urlset>"
25711
26456
  ].join(`
25712
26457
  `);
25713
- }, resolveSpaEntryMetadata = (entry) => {
25714
- if (!entry.sitemap || typeof entry.sitemap !== "object")
25715
- return {};
25716
- return {
25717
- changefreq: entry.sitemap.changefreq,
25718
- lastmod: entry.sitemap.lastmod,
25719
- priority: entry.sitemap.priority
25720
- };
25721
- }, collectPageSubRoutes = async (app, route, serverUrl) => {
25722
- const request = new Request(`${serverUrl}${route.path}`, {
25723
- headers: { "x-absolutejs-enumeration": "1" },
25724
- method: "GET"
25725
- });
25726
- return collectSpaRoutes(async () => {
25727
- try {
25728
- await app.handle(request);
25729
- } catch (err) {
25730
- console.warn(`[sitemap] enumeration request failed for ${route.path}:`, err);
25731
- }
25732
- });
25733
- }, generateSitemap = async (app, serverUrl, outDir, config = {}) => {
25734
- const exclude = config.exclude ?? [];
25735
- const pageRoutes = discoverPageRoutes(app.routes, exclude);
25736
- const entries = [];
25737
- const seenPaths = new Set;
25738
- for (const route of pageRoutes) {
25739
- if (!seenPaths.has(route.path)) {
25740
- entries.push({ path: route.path });
25741
- seenPaths.add(route.path);
25742
- }
25743
- const subRoutes = await collectPageSubRoutes(app, route, serverUrl);
25744
- for (const sub of subRoutes) {
25745
- if (sub.dynamic)
26458
+ }, collectFrameworkSpaEntries = (hosts, wildcardMounts, exclude, seenPaths) => {
26459
+ const out = [];
26460
+ for (const host of hosts) {
26461
+ const mount = normalizeMountFromBaseHref(host.baseHref);
26462
+ if (!wildcardMounts.has(mount))
26463
+ continue;
26464
+ for (const route of host.routes) {
26465
+ if (route.dynamic)
26466
+ continue;
26467
+ if (route.redirected)
25746
26468
  continue;
25747
- if (sub.sitemap === "exclude")
26469
+ if (route.sitemapExcluded)
25748
26470
  continue;
25749
- const fullPath = joinMountAndSubPath(route.path, sub.path);
26471
+ const fullPath = joinMountAndSubPath(mount, route.path);
25750
26472
  if (seenPaths.has(fullPath))
25751
26473
  continue;
25752
26474
  if (isExcluded(fullPath, exclude))
25753
26475
  continue;
25754
- entries.push({ path: fullPath, ...resolveSpaEntryMetadata(sub) });
25755
26476
  seenPaths.add(fullPath);
26477
+ out.push({ path: fullPath });
25756
26478
  }
25757
26479
  }
25758
- const dynamicConfigRoutes = config.routes ? await config.routes() : [];
25759
- for (const path of dynamicConfigRoutes) {
26480
+ return out;
26481
+ }, runAnalyzer = async (label, analyzer) => {
26482
+ try {
26483
+ return await analyzer();
26484
+ } catch (err) {
26485
+ console.warn(`[sitemap] ${label} SPA analysis failed:`, err);
26486
+ return [];
26487
+ }
26488
+ }, generateSitemap = async (routes, serverUrl, outDir, config = {}, pipelineConfig = {}) => {
26489
+ const exclude = config.exclude ?? [];
26490
+ const discoveredPages = discoverPageRoutes(routes, exclude);
26491
+ const seenPaths = new Set;
26492
+ const entries = [];
26493
+ for (const page of discoveredPages) {
26494
+ if (!page.emitTopLevel)
26495
+ continue;
26496
+ if (seenPaths.has(page.mountPath))
26497
+ continue;
26498
+ seenPaths.add(page.mountPath);
26499
+ entries.push({ path: page.mountPath });
26500
+ }
26501
+ const wildcardMounts = new Set(discoveredPages.filter((page) => !page.emitTopLevel).map((page) => page.mountPath));
26502
+ const analyzerJobs = [];
26503
+ if (pipelineConfig.angularDirectory) {
26504
+ analyzerJobs.push(runAnalyzer("Angular", () => analyzeAngularSpaRoutes(pipelineConfig.angularDirectory)));
26505
+ }
26506
+ if (pipelineConfig.reactDirectory) {
26507
+ analyzerJobs.push(runAnalyzer("React", () => analyzeReactSpaRoutes(pipelineConfig.reactDirectory)));
26508
+ }
26509
+ if (pipelineConfig.svelteDirectory) {
26510
+ analyzerJobs.push(runAnalyzer("Svelte", () => analyzeSvelteSpaRoutes(pipelineConfig.svelteDirectory)));
26511
+ }
26512
+ if (pipelineConfig.vueDirectory) {
26513
+ analyzerJobs.push(runAnalyzer("Vue", () => analyzeVueSpaRoutes(pipelineConfig.vueDirectory)));
26514
+ }
26515
+ const allHosts = (await Promise.all(analyzerJobs)).flat();
26516
+ const spaEntries = collectFrameworkSpaEntries(allHosts, wildcardMounts, exclude, seenPaths);
26517
+ entries.push(...spaEntries);
26518
+ const dynamicRoutes = config.routes ? await config.routes() : [];
26519
+ for (const path of dynamicRoutes) {
25760
26520
  if (seenPaths.has(path))
25761
26521
  continue;
25762
26522
  if (isExcluded(path, exclude))
25763
26523
  continue;
25764
- entries.push({ path });
25765
26524
  seenPaths.add(path);
26525
+ entries.push({ path });
25766
26526
  }
25767
26527
  const baseUrl = config.baseUrl ?? serverUrl;
25768
26528
  const xml = buildSitemapXml(entries, baseUrl, config);
@@ -25770,7 +26530,10 @@ var DEFAULT_PRIORITY = 0.8, escapeXml = (str) => str.replace(/&/g, "&amp;").repl
25770
26530
  };
25771
26531
  var init_generateSitemap = __esm(() => {
25772
26532
  init_devRouteRegistrationCallsite();
25773
- init_spaRouteEnumeration();
26533
+ init_staticAnalyzeSpaRoutes();
26534
+ init_staticAnalyzeSpaRoutes2();
26535
+ init_staticAnalyzeSpaRoutes3();
26536
+ init_staticAnalyzeSpaRoutes4();
25774
26537
  });
25775
26538
 
25776
26539
  // src/core/prerender.ts
@@ -25784,7 +26547,7 @@ __export(exports_prerender, {
25784
26547
  PRERENDER_BYPASS_HEADER: () => PRERENDER_BYPASS_HEADER
25785
26548
  });
25786
26549
  import { mkdirSync as mkdirSync16, readFileSync as readFileSync23 } from "fs";
25787
- import { join as join35 } from "path";
26550
+ import { join as join39 } from "path";
25788
26551
  var SERVER_OUTPUT_LIMIT = 4000, STARTUP_POLL_INTERVAL_MS = 100, DEFAULT_STARTUP_TIMEOUT_MS = 30000, PRERENDER_BYPASS_HEADER = "X-Absolute-Prerender-Bypass", routeToFilename = (route) => route === "/" ? "index.html" : `${route.slice(1).replace(/\//g, "-")}.html`, writeTimestamp = async (htmlPath) => {
25789
26552
  const metaPath = htmlPath.replace(/\.html$/, ".meta");
25790
26553
  await Bun.write(metaPath, String(Date.now()));
@@ -25850,7 +26613,7 @@ var SERVER_OUTPUT_LIMIT = 4000, STARTUP_POLL_INTERVAL_MS = 100, DEFAULT_STARTUP_
25850
26613
  return false;
25851
26614
  const html = await res.text();
25852
26615
  const fileName = routeToFilename(route);
25853
- const filePath = join35(prerenderDir, fileName);
26616
+ const filePath = join39(prerenderDir, fileName);
25854
26617
  await Bun.write(filePath, html);
25855
26618
  await writeTimestamp(filePath);
25856
26619
  return true;
@@ -25876,13 +26639,13 @@ var SERVER_OUTPUT_LIMIT = 4000, STARTUP_POLL_INTERVAL_MS = 100, DEFAULT_STARTUP_
25876
26639
  }
25877
26640
  const html = await res.text();
25878
26641
  const fileName = routeToFilename(route);
25879
- const filePath = join35(prerenderDir, fileName);
26642
+ const filePath = join39(prerenderDir, fileName);
25880
26643
  await Bun.write(filePath, html);
25881
26644
  await writeTimestamp(filePath);
25882
26645
  result.routes.set(route, filePath);
25883
26646
  log2?.(` Pre-rendered ${route} \u2192 ${fileName} (${html.length} bytes)`);
25884
26647
  }, prerender = async (port, outDir, staticConfig, log2) => {
25885
- const prerenderDir = join35(outDir, "_prerendered");
26648
+ const prerenderDir = join39(outDir, "_prerendered");
25886
26649
  mkdirSync16(prerenderDir, { recursive: true });
25887
26650
  const baseUrl = `http://localhost:${port}`;
25888
26651
  let routes;
@@ -25982,14 +26745,14 @@ __export(exports_serverEntryWatcher, {
25982
26745
  startServerEntryWatcher: () => startServerEntryWatcher,
25983
26746
  isAtomicWriteTemp: () => isAtomicWriteTemp
25984
26747
  });
25985
- import { existsSync as existsSync33, statSync as statSync8, watch as watch2 } from "fs";
26748
+ import { existsSync as existsSync37, statSync as statSync8, watch as watch2 } from "fs";
25986
26749
  import { createRequire as createRequire2 } from "module";
25987
- import { dirname as dirname26, join as join38, resolve as resolve46 } from "path";
26750
+ import { dirname as dirname26, join as join42, resolve as resolve46 } from "path";
25988
26751
  var ATOMIC_RECOVERY_WINDOW_MS = 1000, RELOAD_DEBOUNCE_MS = 80, ATOMIC_WRITE_TEMP_PATTERNS2, isAtomicWriteTemp = (filename) => filename.endsWith(".tmp") || filename.includes(".tmp.") || filename.endsWith("~") || filename.startsWith(".#") || ATOMIC_WRITE_TEMP_PATTERNS2.some((re2) => re2.test(filename)), startServerEntryWatcher = () => {
25989
26752
  if (globalThis.__absoluteEntryWatcherStarted)
25990
26753
  return;
25991
26754
  const main = Bun.main;
25992
- if (!main || !existsSync33(main))
26755
+ if (!main || !existsSync37(main))
25993
26756
  return;
25994
26757
  globalThis.__absoluteEntryWatcherStarted = true;
25995
26758
  const entryPath = resolve46(main);
@@ -26087,7 +26850,7 @@ var ATOMIC_RECOVERY_WINDOW_MS = 1000, RELOAD_DEBOUNCE_MS = 80, ATOMIC_WRITE_TEMP
26087
26850
  continue;
26088
26851
  let st2;
26089
26852
  try {
26090
- st2 = statSync8(join38(dir, entry.name));
26853
+ st2 = statSync8(join42(dir, entry.name));
26091
26854
  } catch {
26092
26855
  continue;
26093
26856
  }
@@ -26642,8 +27405,8 @@ var handleHTMXPageRequest = async (pagePath) => {
26642
27405
  };
26643
27406
  // src/core/prepare.ts
26644
27407
  init_loadConfig();
26645
- import { existsSync as existsSync31, readdirSync as readdirSync4, readFileSync as readFileSync24 } from "fs";
26646
- import { basename as basename14, join as join36, relative as relative17, resolve as resolve45 } from "path";
27408
+ import { existsSync as existsSync35, readdirSync as readdirSync4, readFileSync as readFileSync24 } from "fs";
27409
+ import { basename as basename14, join as join40, relative as relative17, resolve as resolve45 } from "path";
26647
27410
  import { Elysia as Elysia5 } from "elysia";
26648
27411
 
26649
27412
  // src/core/loadIslandRegistry.ts
@@ -27042,7 +27805,7 @@ var patchManifestIndexes = (manifest, devIndexDir, SRC_URL_PREFIX2) => {
27042
27805
  if (!fileName)
27043
27806
  continue;
27044
27807
  const srcPath = resolve45(devIndexDir, fileName);
27045
- if (!existsSync31(srcPath))
27808
+ if (!existsSync35(srcPath))
27046
27809
  continue;
27047
27810
  const rel = relative17(process.cwd(), srcPath).replace(/\\/g, "/");
27048
27811
  manifest[key] = `${SRC_URL_PREFIX2}${rel}`;
@@ -27140,7 +27903,12 @@ var prepareDev = async (config, buildDir) => {
27140
27903
  maxAge: null,
27141
27904
  prefix: "",
27142
27905
  staticLimit: MAX_STATIC_ROUTE_COUNT
27143
- })).use(hmrPlugin).use(createSitemapPlugin(buildDir, config.sitemap)).use(createBuildErrorRecoveryPlugin()).use(createNotFoundPlugin());
27906
+ })).use(hmrPlugin).use(createSitemapPlugin(buildDir, config.sitemap, {
27907
+ angularDirectory: config.angularDirectory,
27908
+ reactDirectory: config.reactDirectory,
27909
+ svelteDirectory: config.svelteDirectory,
27910
+ vueDirectory: config.vueDirectory
27911
+ })).use(createBuildErrorRecoveryPlugin()).use(createNotFoundPlugin());
27144
27912
  recordStep("assemble dev runtime", stepStartedAt);
27145
27913
  logStartupTimingBlock("AbsoluteJS prepareDev timing", startupSteps);
27146
27914
  return {
@@ -27150,7 +27918,7 @@ var prepareDev = async (config, buildDir) => {
27150
27918
  };
27151
27919
  var loadPrerenderMap = (prerenderDir) => {
27152
27920
  const map = new Map;
27153
- if (!existsSync31(prerenderDir))
27921
+ if (!existsSync35(prerenderDir))
27154
27922
  return map;
27155
27923
  let entries;
27156
27924
  try {
@@ -27163,15 +27931,15 @@ var loadPrerenderMap = (prerenderDir) => {
27163
27931
  continue;
27164
27932
  const name = basename14(entry, ".html");
27165
27933
  const route = name === "index" ? "/" : `/${name}`;
27166
- map.set(route, join36(prerenderDir, entry));
27934
+ map.set(route, join40(prerenderDir, entry));
27167
27935
  }
27168
27936
  return map;
27169
27937
  };
27170
- var createSitemapPlugin = (buildDir, sitemapConfig) => new Elysia5({ name: "absolutejs-sitemap" }).onStart((started) => {
27938
+ var createSitemapPlugin = (buildDir, sitemapConfig, pipelineConfig) => new Elysia5({ name: "absolutejs-sitemap" }).onStart((started) => {
27171
27939
  const { server } = started;
27172
27940
  if (!server)
27173
27941
  return;
27174
- Promise.resolve().then(() => (init_generateSitemap(), exports_generateSitemap)).then(({ generateSitemap: generateSitemap2 }) => generateSitemap2(started, server.url.origin, buildDir, sitemapConfig)).catch((err) => console.error("[sitemap] Generation failed:", err));
27942
+ Promise.resolve().then(() => (init_generateSitemap(), exports_generateSitemap)).then(({ generateSitemap: generateSitemap2 }) => generateSitemap2(started.routes, server.url.origin, buildDir, sitemapConfig, pipelineConfig)).catch((err) => console.error("[sitemap] Generation failed:", err));
27175
27943
  });
27176
27944
  var createNotFoundPlugin = () => new Elysia5({ name: "absolutejs-not-found" }).onError({ as: "global" }, async ({ code }) => {
27177
27945
  if (code !== "NOT_FOUND")
@@ -27229,8 +27997,8 @@ var prepare = async (configOrPath) => {
27229
27997
  setCurrentPageIslandMetadata(await loadPageIslandMetadata(config));
27230
27998
  recordStep("load production manifest and island metadata", stepStartedAt);
27231
27999
  stepStartedAt = performance.now();
27232
- const conventionsPath = join36(buildDir, "conventions.json");
27233
- if (existsSync31(conventionsPath)) {
28000
+ const conventionsPath = join40(buildDir, "conventions.json");
28001
+ if (existsSync35(conventionsPath)) {
27234
28002
  const conventions2 = JSON.parse(readFileSync24(conventionsPath, "utf-8"));
27235
28003
  setConventions(conventions2);
27236
28004
  }
@@ -27245,7 +28013,7 @@ var prepare = async (configOrPath) => {
27245
28013
  });
27246
28014
  recordStep("create static plugin", stepStartedAt);
27247
28015
  stepStartedAt = performance.now();
27248
- const prerenderDir = join36(buildDir, "_prerendered");
28016
+ const prerenderDir = join40(buildDir, "_prerendered");
27249
28017
  const prerenderMap = loadPrerenderMap(prerenderDir);
27250
28018
  recordStep("load prerender map", stepStartedAt);
27251
28019
  if (prerenderMap.size > 0) {
@@ -27276,14 +28044,24 @@ var prepare = async (configOrPath) => {
27276
28044
  });
27277
28045
  stepStartedAt = performance.now();
27278
28046
  const { imageOptimizer: imageOptimizer3 } = await Promise.resolve().then(() => (init_imageOptimizer(), exports_imageOptimizer));
27279
- const absolutejs2 = new Elysia5({ name: "absolutejs-runtime" }).use(imageOptimizer3(config.images, buildDir)).use(prerenderPlugin).use(staticFiles).use(createSitemapPlugin(buildDir, config.sitemap)).use(createNotFoundPlugin());
28047
+ const absolutejs2 = new Elysia5({ name: "absolutejs-runtime" }).use(imageOptimizer3(config.images, buildDir)).use(prerenderPlugin).use(staticFiles).use(createSitemapPlugin(buildDir, config.sitemap, {
28048
+ angularDirectory: config.angularDirectory,
28049
+ reactDirectory: config.reactDirectory,
28050
+ svelteDirectory: config.svelteDirectory,
28051
+ vueDirectory: config.vueDirectory
28052
+ })).use(createNotFoundPlugin());
27280
28053
  recordStep("assemble production runtime", stepStartedAt);
27281
28054
  logStartupTimingBlock("AbsoluteJS prepare timing", startupSteps);
27282
28055
  return { absolutejs: absolutejs2, manifest };
27283
28056
  }
27284
28057
  stepStartedAt = performance.now();
27285
28058
  const { imageOptimizer: imageOptimizer2 } = await Promise.resolve().then(() => (init_imageOptimizer(), exports_imageOptimizer));
27286
- const absolutejs = new Elysia5({ name: "absolutejs-runtime" }).use(imageOptimizer2(config.images, buildDir)).use(staticFiles).use(createSitemapPlugin(buildDir, config.sitemap)).use(createNotFoundPlugin());
28059
+ const absolutejs = new Elysia5({ name: "absolutejs-runtime" }).use(imageOptimizer2(config.images, buildDir)).use(staticFiles).use(createSitemapPlugin(buildDir, config.sitemap, {
28060
+ angularDirectory: config.angularDirectory,
28061
+ reactDirectory: config.reactDirectory,
28062
+ svelteDirectory: config.svelteDirectory,
28063
+ vueDirectory: config.vueDirectory
28064
+ })).use(createNotFoundPlugin());
27287
28065
  recordStep("assemble production runtime", stepStartedAt);
27288
28066
  logStartupTimingBlock("AbsoluteJS prepare timing", startupSteps);
27289
28067
  return { absolutejs, manifest };
@@ -27303,15 +28081,15 @@ import { argv } from "process";
27303
28081
  var {env: env4 } = globalThis.Bun;
27304
28082
 
27305
28083
  // src/dev/devCert.ts
27306
- import { existsSync as existsSync32, mkdirSync as mkdirSync17, readFileSync as readFileSync25, rmSync as rmSync4 } from "fs";
27307
- import { join as join37 } from "path";
27308
- var CERT_DIR = join37(process.cwd(), ".absolutejs");
27309
- var CERT_PATH = join37(CERT_DIR, "cert.pem");
27310
- var KEY_PATH = join37(CERT_DIR, "key.pem");
28084
+ import { existsSync as existsSync36, mkdirSync as mkdirSync17, readFileSync as readFileSync25, rmSync as rmSync4 } from "fs";
28085
+ import { join as join41 } from "path";
28086
+ var CERT_DIR = join41(process.cwd(), ".absolutejs");
28087
+ var CERT_PATH = join41(CERT_DIR, "cert.pem");
28088
+ var KEY_PATH = join41(CERT_DIR, "key.pem");
27311
28089
  var CERT_VALIDITY_DAYS = 365;
27312
28090
  var devLog = (msg) => console.log(`\x1B[2m${new Date().toLocaleTimeString()}\x1B[0m \x1B[36m[dev]\x1B[0m ${msg}`);
27313
28091
  var devWarn = (msg) => console.log(`\x1B[2m${new Date().toLocaleTimeString()}\x1B[0m \x1B[33m[dev]\x1B[0m \x1B[33m${msg}\x1B[0m`);
27314
- var certFilesExist = () => existsSync32(CERT_PATH) && existsSync32(KEY_PATH);
28092
+ var certFilesExist = () => existsSync36(CERT_PATH) && existsSync36(KEY_PATH);
27315
28093
  var isCertExpired = () => {
27316
28094
  try {
27317
28095
  const certPem = readFileSync25(CERT_PATH, "utf-8");
@@ -27686,7 +28464,7 @@ var generateHeadElement = ({
27686
28464
  };
27687
28465
  // src/utils/defineEnv.ts
27688
28466
  var {env: bunEnv } = globalThis.Bun;
27689
- import { existsSync as existsSync34, readFileSync as readFileSync26 } from "fs";
28467
+ import { existsSync as existsSync38, readFileSync as readFileSync26 } from "fs";
27690
28468
  import { resolve as resolve47 } from "path";
27691
28469
 
27692
28470
  // node_modules/@sinclair/typebox/build/esm/type/guard/value.mjs
@@ -33723,7 +34501,7 @@ ${lines.join(`
33723
34501
  var checkEnvFileSecurity = (properties) => {
33724
34502
  const cwd2 = process.cwd();
33725
34503
  const envPath = resolve47(cwd2, ".env");
33726
- if (!existsSync34(envPath))
34504
+ if (!existsSync38(envPath))
33727
34505
  return;
33728
34506
  const sensitiveKeys = Object.keys(properties).filter(isSensitive);
33729
34507
  if (sensitiveKeys.length === 0)
@@ -33733,7 +34511,7 @@ var checkEnvFileSecurity = (properties) => {
33733
34511
  if (presentKeys.length === 0)
33734
34512
  return;
33735
34513
  const gitignorePath = resolve47(cwd2, ".gitignore");
33736
- if (existsSync34(gitignorePath)) {
34514
+ if (existsSync38(gitignorePath)) {
33737
34515
  const gitignore = readFileSync26(gitignorePath, "utf-8");
33738
34516
  if (gitignore.split(`
33739
34517
  `).some((line) => line.trim() === ".env"))
@@ -33975,5 +34753,5 @@ export {
33975
34753
  ANGULAR_INIT_TIMEOUT_MS
33976
34754
  };
33977
34755
 
33978
- //# debugId=27DB5119E1E545AE64756E2164756E21
34756
+ //# debugId=8CC7B20D34E950DD64756E2164756E21
33979
34757
  //# sourceMappingURL=index.js.map