@absolutejs/absolute 0.19.0-beta.954 → 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
@@ -25625,11 +25625,14 @@ var DYNAMIC_SEGMENT_PATTERN, pathHasDynamic = (path) => path.split("/").some((se
25625
25625
  }
25626
25626
  return null;
25627
25627
  }, readPropertyKey = (property) => {
25628
- if (!ts8.isPropertyAssignment(property))
25629
- return null;
25630
- const name = property.name;
25631
- if (ts8.isIdentifier(name) || ts8.isStringLiteral(name))
25632
- return name.text;
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
+ }
25633
25636
  return null;
25634
25637
  }, findRoutesArrayDeclaration = (sf, identifierName) => {
25635
25638
  let found = null;
@@ -25823,6 +25826,556 @@ var init_staticAnalyzeSpaRoutes = __esm(() => {
25823
25826
  DYNAMIC_SEGMENT_PATTERN = /^[:*]/;
25824
25827
  });
25825
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 {
26006
+ return;
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;
26034
+ };
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 = /^[:*]/;
26377
+ });
26378
+
25826
26379
  // src/utils/generateSitemap.ts
25827
26380
  var exports_generateSitemap = {};
25828
26381
  __export(exports_generateSitemap, {
@@ -25902,14 +26455,13 @@ var DEFAULT_PRIORITY = 0.8, escapeXml = (str) => str.replace(/&/g, "&amp;").repl
25902
26455
  "</urlset>"
25903
26456
  ].join(`
25904
26457
  `);
25905
- }, collectAngularSpaEntries = async (pages, discovered, exclude, seenPaths) => {
25906
- const wildcardMounts = new Set(discovered.filter((page) => !page.emitTopLevel).map((page) => page.mountPath));
26458
+ }, collectFrameworkSpaEntries = (hosts, wildcardMounts, exclude, seenPaths) => {
25907
26459
  const out = [];
25908
- for (const page of pages) {
25909
- const mount = normalizeMountFromBaseHref(page.baseHref);
26460
+ for (const host of hosts) {
26461
+ const mount = normalizeMountFromBaseHref(host.baseHref);
25910
26462
  if (!wildcardMounts.has(mount))
25911
26463
  continue;
25912
- for (const route of page.routes) {
26464
+ for (const route of host.routes) {
25913
26465
  if (route.dynamic)
25914
26466
  continue;
25915
26467
  if (route.redirected)
@@ -25926,6 +26478,13 @@ var DEFAULT_PRIORITY = 0.8, escapeXml = (str) => str.replace(/&/g, "&amp;").repl
25926
26478
  }
25927
26479
  }
25928
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
+ }
25929
26488
  }, generateSitemap = async (routes, serverUrl, outDir, config = {}, pipelineConfig = {}) => {
25930
26489
  const exclude = config.exclude ?? [];
25931
26490
  const discoveredPages = discoverPageRoutes(routes, exclude);
@@ -25939,15 +26498,23 @@ var DEFAULT_PRIORITY = 0.8, escapeXml = (str) => str.replace(/&/g, "&amp;").repl
25939
26498
  seenPaths.add(page.mountPath);
25940
26499
  entries.push({ path: page.mountPath });
25941
26500
  }
26501
+ const wildcardMounts = new Set(discoveredPages.filter((page) => !page.emitTopLevel).map((page) => page.mountPath));
26502
+ const analyzerJobs = [];
25942
26503
  if (pipelineConfig.angularDirectory) {
25943
- try {
25944
- const angularPages = await analyzeAngularSpaRoutes(pipelineConfig.angularDirectory);
25945
- const spaEntries = await collectAngularSpaEntries(angularPages, discoveredPages, exclude, seenPaths);
25946
- entries.push(...spaEntries);
25947
- } catch (err) {
25948
- console.warn("[sitemap] Angular SPA analysis failed:", err);
25949
- }
26504
+ analyzerJobs.push(runAnalyzer("Angular", () => analyzeAngularSpaRoutes(pipelineConfig.angularDirectory)));
26505
+ }
26506
+ if (pipelineConfig.reactDirectory) {
26507
+ analyzerJobs.push(runAnalyzer("React", () => analyzeReactSpaRoutes(pipelineConfig.reactDirectory)));
25950
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);
25951
26518
  const dynamicRoutes = config.routes ? await config.routes() : [];
25952
26519
  for (const path of dynamicRoutes) {
25953
26520
  if (seenPaths.has(path))
@@ -25964,6 +26531,9 @@ var DEFAULT_PRIORITY = 0.8, escapeXml = (str) => str.replace(/&/g, "&amp;").repl
25964
26531
  var init_generateSitemap = __esm(() => {
25965
26532
  init_devRouteRegistrationCallsite();
25966
26533
  init_staticAnalyzeSpaRoutes();
26534
+ init_staticAnalyzeSpaRoutes2();
26535
+ init_staticAnalyzeSpaRoutes3();
26536
+ init_staticAnalyzeSpaRoutes4();
25967
26537
  });
25968
26538
 
25969
26539
  // src/core/prerender.ts
@@ -25977,7 +26547,7 @@ __export(exports_prerender, {
25977
26547
  PRERENDER_BYPASS_HEADER: () => PRERENDER_BYPASS_HEADER
25978
26548
  });
25979
26549
  import { mkdirSync as mkdirSync16, readFileSync as readFileSync23 } from "fs";
25980
- import { join as join36 } from "path";
26550
+ import { join as join39 } from "path";
25981
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) => {
25982
26552
  const metaPath = htmlPath.replace(/\.html$/, ".meta");
25983
26553
  await Bun.write(metaPath, String(Date.now()));
@@ -26043,7 +26613,7 @@ var SERVER_OUTPUT_LIMIT = 4000, STARTUP_POLL_INTERVAL_MS = 100, DEFAULT_STARTUP_
26043
26613
  return false;
26044
26614
  const html = await res.text();
26045
26615
  const fileName = routeToFilename(route);
26046
- const filePath = join36(prerenderDir, fileName);
26616
+ const filePath = join39(prerenderDir, fileName);
26047
26617
  await Bun.write(filePath, html);
26048
26618
  await writeTimestamp(filePath);
26049
26619
  return true;
@@ -26069,13 +26639,13 @@ var SERVER_OUTPUT_LIMIT = 4000, STARTUP_POLL_INTERVAL_MS = 100, DEFAULT_STARTUP_
26069
26639
  }
26070
26640
  const html = await res.text();
26071
26641
  const fileName = routeToFilename(route);
26072
- const filePath = join36(prerenderDir, fileName);
26642
+ const filePath = join39(prerenderDir, fileName);
26073
26643
  await Bun.write(filePath, html);
26074
26644
  await writeTimestamp(filePath);
26075
26645
  result.routes.set(route, filePath);
26076
26646
  log2?.(` Pre-rendered ${route} \u2192 ${fileName} (${html.length} bytes)`);
26077
26647
  }, prerender = async (port, outDir, staticConfig, log2) => {
26078
- const prerenderDir = join36(outDir, "_prerendered");
26648
+ const prerenderDir = join39(outDir, "_prerendered");
26079
26649
  mkdirSync16(prerenderDir, { recursive: true });
26080
26650
  const baseUrl = `http://localhost:${port}`;
26081
26651
  let routes;
@@ -26175,14 +26745,14 @@ __export(exports_serverEntryWatcher, {
26175
26745
  startServerEntryWatcher: () => startServerEntryWatcher,
26176
26746
  isAtomicWriteTemp: () => isAtomicWriteTemp
26177
26747
  });
26178
- import { existsSync as existsSync34, statSync as statSync8, watch as watch2 } from "fs";
26748
+ import { existsSync as existsSync37, statSync as statSync8, watch as watch2 } from "fs";
26179
26749
  import { createRequire as createRequire2 } from "module";
26180
- import { dirname as dirname26, join as join39, resolve as resolve46 } from "path";
26750
+ import { dirname as dirname26, join as join42, resolve as resolve46 } from "path";
26181
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 = () => {
26182
26752
  if (globalThis.__absoluteEntryWatcherStarted)
26183
26753
  return;
26184
26754
  const main = Bun.main;
26185
- if (!main || !existsSync34(main))
26755
+ if (!main || !existsSync37(main))
26186
26756
  return;
26187
26757
  globalThis.__absoluteEntryWatcherStarted = true;
26188
26758
  const entryPath = resolve46(main);
@@ -26280,7 +26850,7 @@ var ATOMIC_RECOVERY_WINDOW_MS = 1000, RELOAD_DEBOUNCE_MS = 80, ATOMIC_WRITE_TEMP
26280
26850
  continue;
26281
26851
  let st2;
26282
26852
  try {
26283
- st2 = statSync8(join39(dir, entry.name));
26853
+ st2 = statSync8(join42(dir, entry.name));
26284
26854
  } catch {
26285
26855
  continue;
26286
26856
  }
@@ -26835,8 +27405,8 @@ var handleHTMXPageRequest = async (pagePath) => {
26835
27405
  };
26836
27406
  // src/core/prepare.ts
26837
27407
  init_loadConfig();
26838
- import { existsSync as existsSync32, readdirSync as readdirSync4, readFileSync as readFileSync24 } from "fs";
26839
- import { basename as basename14, join as join37, 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";
26840
27410
  import { Elysia as Elysia5 } from "elysia";
26841
27411
 
26842
27412
  // src/core/loadIslandRegistry.ts
@@ -27235,7 +27805,7 @@ var patchManifestIndexes = (manifest, devIndexDir, SRC_URL_PREFIX2) => {
27235
27805
  if (!fileName)
27236
27806
  continue;
27237
27807
  const srcPath = resolve45(devIndexDir, fileName);
27238
- if (!existsSync32(srcPath))
27808
+ if (!existsSync35(srcPath))
27239
27809
  continue;
27240
27810
  const rel = relative17(process.cwd(), srcPath).replace(/\\/g, "/");
27241
27811
  manifest[key] = `${SRC_URL_PREFIX2}${rel}`;
@@ -27334,7 +27904,10 @@ var prepareDev = async (config, buildDir) => {
27334
27904
  prefix: "",
27335
27905
  staticLimit: MAX_STATIC_ROUTE_COUNT
27336
27906
  })).use(hmrPlugin).use(createSitemapPlugin(buildDir, config.sitemap, {
27337
- angularDirectory: config.angularDirectory
27907
+ angularDirectory: config.angularDirectory,
27908
+ reactDirectory: config.reactDirectory,
27909
+ svelteDirectory: config.svelteDirectory,
27910
+ vueDirectory: config.vueDirectory
27338
27911
  })).use(createBuildErrorRecoveryPlugin()).use(createNotFoundPlugin());
27339
27912
  recordStep("assemble dev runtime", stepStartedAt);
27340
27913
  logStartupTimingBlock("AbsoluteJS prepareDev timing", startupSteps);
@@ -27345,7 +27918,7 @@ var prepareDev = async (config, buildDir) => {
27345
27918
  };
27346
27919
  var loadPrerenderMap = (prerenderDir) => {
27347
27920
  const map = new Map;
27348
- if (!existsSync32(prerenderDir))
27921
+ if (!existsSync35(prerenderDir))
27349
27922
  return map;
27350
27923
  let entries;
27351
27924
  try {
@@ -27358,7 +27931,7 @@ var loadPrerenderMap = (prerenderDir) => {
27358
27931
  continue;
27359
27932
  const name = basename14(entry, ".html");
27360
27933
  const route = name === "index" ? "/" : `/${name}`;
27361
- map.set(route, join37(prerenderDir, entry));
27934
+ map.set(route, join40(prerenderDir, entry));
27362
27935
  }
27363
27936
  return map;
27364
27937
  };
@@ -27424,8 +27997,8 @@ var prepare = async (configOrPath) => {
27424
27997
  setCurrentPageIslandMetadata(await loadPageIslandMetadata(config));
27425
27998
  recordStep("load production manifest and island metadata", stepStartedAt);
27426
27999
  stepStartedAt = performance.now();
27427
- const conventionsPath = join37(buildDir, "conventions.json");
27428
- if (existsSync32(conventionsPath)) {
28000
+ const conventionsPath = join40(buildDir, "conventions.json");
28001
+ if (existsSync35(conventionsPath)) {
27429
28002
  const conventions2 = JSON.parse(readFileSync24(conventionsPath, "utf-8"));
27430
28003
  setConventions(conventions2);
27431
28004
  }
@@ -27440,7 +28013,7 @@ var prepare = async (configOrPath) => {
27440
28013
  });
27441
28014
  recordStep("create static plugin", stepStartedAt);
27442
28015
  stepStartedAt = performance.now();
27443
- const prerenderDir = join37(buildDir, "_prerendered");
28016
+ const prerenderDir = join40(buildDir, "_prerendered");
27444
28017
  const prerenderMap = loadPrerenderMap(prerenderDir);
27445
28018
  recordStep("load prerender map", stepStartedAt);
27446
28019
  if (prerenderMap.size > 0) {
@@ -27472,7 +28045,10 @@ var prepare = async (configOrPath) => {
27472
28045
  stepStartedAt = performance.now();
27473
28046
  const { imageOptimizer: imageOptimizer3 } = await Promise.resolve().then(() => (init_imageOptimizer(), exports_imageOptimizer));
27474
28047
  const absolutejs2 = new Elysia5({ name: "absolutejs-runtime" }).use(imageOptimizer3(config.images, buildDir)).use(prerenderPlugin).use(staticFiles).use(createSitemapPlugin(buildDir, config.sitemap, {
27475
- angularDirectory: config.angularDirectory
28048
+ angularDirectory: config.angularDirectory,
28049
+ reactDirectory: config.reactDirectory,
28050
+ svelteDirectory: config.svelteDirectory,
28051
+ vueDirectory: config.vueDirectory
27476
28052
  })).use(createNotFoundPlugin());
27477
28053
  recordStep("assemble production runtime", stepStartedAt);
27478
28054
  logStartupTimingBlock("AbsoluteJS prepare timing", startupSteps);
@@ -27481,7 +28057,10 @@ var prepare = async (configOrPath) => {
27481
28057
  stepStartedAt = performance.now();
27482
28058
  const { imageOptimizer: imageOptimizer2 } = await Promise.resolve().then(() => (init_imageOptimizer(), exports_imageOptimizer));
27483
28059
  const absolutejs = new Elysia5({ name: "absolutejs-runtime" }).use(imageOptimizer2(config.images, buildDir)).use(staticFiles).use(createSitemapPlugin(buildDir, config.sitemap, {
27484
- angularDirectory: config.angularDirectory
28060
+ angularDirectory: config.angularDirectory,
28061
+ reactDirectory: config.reactDirectory,
28062
+ svelteDirectory: config.svelteDirectory,
28063
+ vueDirectory: config.vueDirectory
27485
28064
  })).use(createNotFoundPlugin());
27486
28065
  recordStep("assemble production runtime", stepStartedAt);
27487
28066
  logStartupTimingBlock("AbsoluteJS prepare timing", startupSteps);
@@ -27502,15 +28081,15 @@ import { argv } from "process";
27502
28081
  var {env: env4 } = globalThis.Bun;
27503
28082
 
27504
28083
  // src/dev/devCert.ts
27505
- import { existsSync as existsSync33, mkdirSync as mkdirSync17, readFileSync as readFileSync25, rmSync as rmSync4 } from "fs";
27506
- import { join as join38 } from "path";
27507
- var CERT_DIR = join38(process.cwd(), ".absolutejs");
27508
- var CERT_PATH = join38(CERT_DIR, "cert.pem");
27509
- var KEY_PATH = join38(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");
27510
28089
  var CERT_VALIDITY_DAYS = 365;
27511
28090
  var devLog = (msg) => console.log(`\x1B[2m${new Date().toLocaleTimeString()}\x1B[0m \x1B[36m[dev]\x1B[0m ${msg}`);
27512
28091
  var devWarn = (msg) => console.log(`\x1B[2m${new Date().toLocaleTimeString()}\x1B[0m \x1B[33m[dev]\x1B[0m \x1B[33m${msg}\x1B[0m`);
27513
- var certFilesExist = () => existsSync33(CERT_PATH) && existsSync33(KEY_PATH);
28092
+ var certFilesExist = () => existsSync36(CERT_PATH) && existsSync36(KEY_PATH);
27514
28093
  var isCertExpired = () => {
27515
28094
  try {
27516
28095
  const certPem = readFileSync25(CERT_PATH, "utf-8");
@@ -27885,7 +28464,7 @@ var generateHeadElement = ({
27885
28464
  };
27886
28465
  // src/utils/defineEnv.ts
27887
28466
  var {env: bunEnv } = globalThis.Bun;
27888
- import { existsSync as existsSync35, readFileSync as readFileSync26 } from "fs";
28467
+ import { existsSync as existsSync38, readFileSync as readFileSync26 } from "fs";
27889
28468
  import { resolve as resolve47 } from "path";
27890
28469
 
27891
28470
  // node_modules/@sinclair/typebox/build/esm/type/guard/value.mjs
@@ -33922,7 +34501,7 @@ ${lines.join(`
33922
34501
  var checkEnvFileSecurity = (properties) => {
33923
34502
  const cwd2 = process.cwd();
33924
34503
  const envPath = resolve47(cwd2, ".env");
33925
- if (!existsSync35(envPath))
34504
+ if (!existsSync38(envPath))
33926
34505
  return;
33927
34506
  const sensitiveKeys = Object.keys(properties).filter(isSensitive);
33928
34507
  if (sensitiveKeys.length === 0)
@@ -33932,7 +34511,7 @@ var checkEnvFileSecurity = (properties) => {
33932
34511
  if (presentKeys.length === 0)
33933
34512
  return;
33934
34513
  const gitignorePath = resolve47(cwd2, ".gitignore");
33935
- if (existsSync35(gitignorePath)) {
34514
+ if (existsSync38(gitignorePath)) {
33936
34515
  const gitignore = readFileSync26(gitignorePath, "utf-8");
33937
34516
  if (gitignore.split(`
33938
34517
  `).some((line) => line.trim() === ".env"))
@@ -34174,5 +34753,5 @@ export {
34174
34753
  ANGULAR_INIT_TIMEOUT_MS
34175
34754
  };
34176
34755
 
34177
- //# debugId=CBA359F82BDAEEE464756E2164756E21
34756
+ //# debugId=8CC7B20D34E950DD64756E2164756E21
34178
34757
  //# sourceMappingURL=index.js.map