@absolutejs/absolute 0.19.0-beta.954 → 0.19.0-beta.956
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/angular/components/core/streamingSlotRegistrar.js +1 -1
- package/dist/angular/components/core/streamingSlotRegistry.js +2 -2
- package/dist/angular/index.js +12 -3
- package/dist/angular/index.js.map +4 -4
- package/dist/angular/server.js +12 -3
- package/dist/angular/server.js.map +4 -4
- package/dist/index.js +696 -57
- package/dist/index.js.map +10 -7
- package/dist/react/index.js +12 -3
- package/dist/react/index.js.map +4 -4
- package/dist/react/server.js +12 -3
- package/dist/react/server.js.map +4 -4
- package/dist/src/angular/pageHandler.d.ts +5 -0
- package/dist/src/angular/staticAnalyzeSpaRoutes.d.ts +2 -21
- package/dist/src/core/devRouteRegistrationCallsite.d.ts +5 -0
- package/dist/src/react/pageHandler.d.ts +4 -0
- package/dist/src/react/staticAnalyzeSpaRoutes.d.ts +7 -0
- package/dist/src/svelte/pageHandler.d.ts +4 -0
- package/dist/src/svelte/staticAnalyzeSpaRoutes.d.ts +7 -0
- package/dist/src/utils/generateSitemap.d.ts +3 -0
- package/dist/src/utils/spaRouteTypes.d.ts +25 -0
- package/dist/src/vue/pageHandler.d.ts +4 -0
- package/dist/src/vue/staticAnalyzeSpaRoutes.d.ts +7 -0
- package/dist/svelte/index.js +12 -3
- package/dist/svelte/index.js.map +4 -4
- package/dist/svelte/server.js +12 -3
- package/dist/svelte/server.js.map +4 -4
- package/dist/types/sitemap.d.ts +5 -0
- package/dist/vue/index.js +12 -3
- package/dist/vue/index.js.map +4 -4
- package/dist/vue/server.js +12 -3
- package/dist/vue/server.js.map +4 -4
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -8687,6 +8687,7 @@ var exports_devRouteRegistrationCallsite = {};
|
|
|
8687
8687
|
__export(exports_devRouteRegistrationCallsite, {
|
|
8688
8688
|
patchElysiaRouteRegistrationCallsites: () => patchElysiaRouteRegistrationCallsites,
|
|
8689
8689
|
isPageHandler: () => isPageHandler,
|
|
8690
|
+
getOriginalPageHandlerSource: () => getOriginalPageHandlerSource,
|
|
8690
8691
|
getCurrentRouteRegistrationCallsite: () => getCurrentRouteRegistrationCallsite
|
|
8691
8692
|
});
|
|
8692
8693
|
import { AsyncLocalStorage } from "async_hooks";
|
|
@@ -8701,6 +8702,12 @@ var ROUTE_CALLSITE_STORAGE_KEY, ROUTE_CALLSITE_PATCHED_KEY, ROUTE_METHOD_NAMES,
|
|
|
8701
8702
|
if (pageHandlerWrappers.has(fn2))
|
|
8702
8703
|
return true;
|
|
8703
8704
|
return handlerSourceMentionsPageHelper(fn2);
|
|
8705
|
+
}, getOriginalPageHandlerSource = (handler) => {
|
|
8706
|
+
if (typeof handler !== "function")
|
|
8707
|
+
return;
|
|
8708
|
+
const fn2 = handler;
|
|
8709
|
+
const info = pageHandlerWrappers.get(fn2);
|
|
8710
|
+
return (info?.originalHandler ?? fn2).toString();
|
|
8704
8711
|
}, isObjectRecord3 = (value) => Boolean(value) && typeof value === "object", isAsyncLocalStorage2 = (value) => isObjectRecord3(value) && ("getStore" in value) && typeof value.getStore === "function" && ("run" in value) && typeof value.run === "function", isRouteMethod = (value) => typeof value === "function", getRouteCallsiteStorage = () => {
|
|
8705
8712
|
const value = Reflect.get(globalThis, ROUTE_CALLSITE_STORAGE_KEY);
|
|
8706
8713
|
if (value === null || typeof value === "undefined") {
|
|
@@ -8738,7 +8745,9 @@ var ROUTE_CALLSITE_STORAGE_KEY, ROUTE_CALLSITE_PATCHED_KEY, ROUTE_METHOD_NAMES,
|
|
|
8738
8745
|
const callsite = captureRouteRegistrationCallsite();
|
|
8739
8746
|
const wrapped = wrapRouteHandlerWithCallsite(handler, callsite);
|
|
8740
8747
|
if (methodName === "get" && typeof handler === "function" && typeof wrapped === "function" && handlerSourceMentionsPageHelper(handler)) {
|
|
8741
|
-
pageHandlerWrappers.
|
|
8748
|
+
pageHandlerWrappers.set(wrapped, {
|
|
8749
|
+
originalHandler: handler
|
|
8750
|
+
});
|
|
8742
8751
|
}
|
|
8743
8752
|
return Reflect.apply(originalMethod, this, [path, wrapped, ...rest]);
|
|
8744
8753
|
}, getCurrentRouteRegistrationCallsite = () => getRouteCallsiteStorage()?.getStore()?.callsite, patchElysiaRouteRegistrationCallsites = () => {
|
|
@@ -8776,7 +8785,7 @@ var init_devRouteRegistrationCallsite = __esm(() => {
|
|
|
8776
8785
|
"handleHTMLPageRequest",
|
|
8777
8786
|
"handleHTMXPageRequest"
|
|
8778
8787
|
];
|
|
8779
|
-
pageHandlerWrappers = new
|
|
8788
|
+
pageHandlerWrappers = new WeakMap;
|
|
8780
8789
|
});
|
|
8781
8790
|
|
|
8782
8791
|
// src/utils/startupBanner.ts
|
|
@@ -25625,11 +25634,14 @@ var DYNAMIC_SEGMENT_PATTERN, pathHasDynamic = (path) => path.split("/").some((se
|
|
|
25625
25634
|
}
|
|
25626
25635
|
return null;
|
|
25627
25636
|
}, readPropertyKey = (property) => {
|
|
25628
|
-
if (
|
|
25629
|
-
|
|
25630
|
-
|
|
25631
|
-
|
|
25632
|
-
|
|
25637
|
+
if (ts8.isPropertyAssignment(property)) {
|
|
25638
|
+
const name = property.name;
|
|
25639
|
+
if (ts8.isIdentifier(name) || ts8.isStringLiteral(name))
|
|
25640
|
+
return name.text;
|
|
25641
|
+
}
|
|
25642
|
+
if (ts8.isShorthandPropertyAssignment(property)) {
|
|
25643
|
+
return property.name.text;
|
|
25644
|
+
}
|
|
25633
25645
|
return null;
|
|
25634
25646
|
}, findRoutesArrayDeclaration = (sf, identifierName) => {
|
|
25635
25647
|
let found = null;
|
|
@@ -25823,6 +25835,556 @@ var init_staticAnalyzeSpaRoutes = __esm(() => {
|
|
|
25823
25835
|
DYNAMIC_SEGMENT_PATTERN = /^[:*]/;
|
|
25824
25836
|
});
|
|
25825
25837
|
|
|
25838
|
+
// src/react/staticAnalyzeSpaRoutes.ts
|
|
25839
|
+
import { existsSync as existsSync32, promises as fs3 } from "fs";
|
|
25840
|
+
import { join as join36 } from "path";
|
|
25841
|
+
import ts9 from "typescript";
|
|
25842
|
+
var DYNAMIC_SEGMENT_PATTERN2, pathHasDynamic2 = (path) => path.split("/").some((seg) => DYNAMIC_SEGMENT_PATTERN2.test(seg) || seg === "**"), readStringLiteral2 = (expression) => {
|
|
25843
|
+
if (ts9.isStringLiteral(expression) || ts9.isNoSubstitutionTemplateLiteral(expression)) {
|
|
25844
|
+
return expression.text;
|
|
25845
|
+
}
|
|
25846
|
+
return null;
|
|
25847
|
+
}, readPropertyKey2 = (property) => {
|
|
25848
|
+
if (ts9.isPropertyAssignment(property)) {
|
|
25849
|
+
const name = property.name;
|
|
25850
|
+
if (ts9.isIdentifier(name) || ts9.isStringLiteral(name))
|
|
25851
|
+
return name.text;
|
|
25852
|
+
}
|
|
25853
|
+
if (ts9.isShorthandPropertyAssignment(property)) {
|
|
25854
|
+
return property.name.text;
|
|
25855
|
+
}
|
|
25856
|
+
return null;
|
|
25857
|
+
}, importsSymbolFromAny = (sf, localName, moduleSpecifiers) => {
|
|
25858
|
+
for (const statement of sf.statements) {
|
|
25859
|
+
if (!ts9.isImportDeclaration(statement))
|
|
25860
|
+
continue;
|
|
25861
|
+
if (!ts9.isStringLiteral(statement.moduleSpecifier))
|
|
25862
|
+
continue;
|
|
25863
|
+
if (!moduleSpecifiers.includes(statement.moduleSpecifier.text))
|
|
25864
|
+
continue;
|
|
25865
|
+
const named = statement.importClause?.namedBindings;
|
|
25866
|
+
if (!named || !ts9.isNamedImports(named))
|
|
25867
|
+
continue;
|
|
25868
|
+
for (const element of named.elements) {
|
|
25869
|
+
if (element.name.text === localName)
|
|
25870
|
+
return true;
|
|
25871
|
+
}
|
|
25872
|
+
}
|
|
25873
|
+
return false;
|
|
25874
|
+
}, findVariableArrayDeclaration = (sf, identifierName) => {
|
|
25875
|
+
let found = null;
|
|
25876
|
+
const visit = (node) => {
|
|
25877
|
+
if (found)
|
|
25878
|
+
return;
|
|
25879
|
+
if (ts9.isVariableDeclaration(node) && ts9.isIdentifier(node.name) && node.name.text === identifierName && node.initializer && ts9.isArrayLiteralExpression(node.initializer)) {
|
|
25880
|
+
found = node.initializer;
|
|
25881
|
+
return;
|
|
25882
|
+
}
|
|
25883
|
+
ts9.forEachChild(node, visit);
|
|
25884
|
+
};
|
|
25885
|
+
ts9.forEachChild(sf, visit);
|
|
25886
|
+
return found;
|
|
25887
|
+
}, joinSegments2 = (parent, child) => {
|
|
25888
|
+
if (!child)
|
|
25889
|
+
return parent;
|
|
25890
|
+
if (!parent)
|
|
25891
|
+
return child;
|
|
25892
|
+
return `${parent.replace(/\/+$/, "")}/${child.replace(/^\/+/, "")}`;
|
|
25893
|
+
}, extractRouteEntries = (arr, parentPath, out) => {
|
|
25894
|
+
for (const element of arr.elements) {
|
|
25895
|
+
if (!ts9.isObjectLiteralExpression(element))
|
|
25896
|
+
continue;
|
|
25897
|
+
let pathSegment = null;
|
|
25898
|
+
let redirected = false;
|
|
25899
|
+
let sitemapExcluded = false;
|
|
25900
|
+
let childrenLiteral = null;
|
|
25901
|
+
let isIndex = false;
|
|
25902
|
+
for (const property of element.properties) {
|
|
25903
|
+
const key = readPropertyKey2(property);
|
|
25904
|
+
if (!key)
|
|
25905
|
+
continue;
|
|
25906
|
+
if (!ts9.isPropertyAssignment(property))
|
|
25907
|
+
continue;
|
|
25908
|
+
if (key === "path") {
|
|
25909
|
+
pathSegment = readStringLiteral2(property.initializer);
|
|
25910
|
+
} else if (key === "index") {
|
|
25911
|
+
isIndex = true;
|
|
25912
|
+
} else if (key === "loader" || key === "lazy") {} else if (key === "children" && ts9.isArrayLiteralExpression(property.initializer)) {
|
|
25913
|
+
childrenLiteral = property.initializer;
|
|
25914
|
+
} else if (key === "redirectTo") {
|
|
25915
|
+
redirected = true;
|
|
25916
|
+
} else if (key === "handle" && ts9.isObjectLiteralExpression(property.initializer)) {
|
|
25917
|
+
for (const handleProp of property.initializer.properties) {
|
|
25918
|
+
const handleKey = readPropertyKey2(handleProp);
|
|
25919
|
+
if (handleKey !== "sitemap")
|
|
25920
|
+
continue;
|
|
25921
|
+
if (!ts9.isPropertyAssignment(handleProp))
|
|
25922
|
+
continue;
|
|
25923
|
+
const value = readStringLiteral2(handleProp.initializer);
|
|
25924
|
+
if (value === "exclude")
|
|
25925
|
+
sitemapExcluded = true;
|
|
25926
|
+
}
|
|
25927
|
+
}
|
|
25928
|
+
}
|
|
25929
|
+
const segment = pathSegment ?? "";
|
|
25930
|
+
const joined = joinSegments2(parentPath, segment);
|
|
25931
|
+
if (childrenLiteral) {
|
|
25932
|
+
extractRouteEntries(childrenLiteral, joined, out);
|
|
25933
|
+
continue;
|
|
25934
|
+
}
|
|
25935
|
+
if (redirected)
|
|
25936
|
+
continue;
|
|
25937
|
+
if (!isIndex && pathSegment === null)
|
|
25938
|
+
continue;
|
|
25939
|
+
if (joined === "")
|
|
25940
|
+
continue;
|
|
25941
|
+
out.push({
|
|
25942
|
+
dynamic: pathHasDynamic2(joined),
|
|
25943
|
+
path: joined,
|
|
25944
|
+
redirected,
|
|
25945
|
+
sitemapExcluded
|
|
25946
|
+
});
|
|
25947
|
+
}
|
|
25948
|
+
}, findCreateBrowserRouterCall = (sf) => {
|
|
25949
|
+
let found = null;
|
|
25950
|
+
const visit = (node) => {
|
|
25951
|
+
if (found)
|
|
25952
|
+
return;
|
|
25953
|
+
if (ts9.isCallExpression(node) && ts9.isIdentifier(node.expression) && node.expression.text === "createBrowserRouter") {
|
|
25954
|
+
found = node;
|
|
25955
|
+
return;
|
|
25956
|
+
}
|
|
25957
|
+
ts9.forEachChild(node, visit);
|
|
25958
|
+
};
|
|
25959
|
+
ts9.forEachChild(sf, visit);
|
|
25960
|
+
return found;
|
|
25961
|
+
}, readBasenameFromOptions = (expression) => {
|
|
25962
|
+
if (!expression || !ts9.isObjectLiteralExpression(expression))
|
|
25963
|
+
return null;
|
|
25964
|
+
for (const property of expression.properties) {
|
|
25965
|
+
const key = readPropertyKey2(property);
|
|
25966
|
+
if (key !== "basename")
|
|
25967
|
+
continue;
|
|
25968
|
+
if (!ts9.isPropertyAssignment(property))
|
|
25969
|
+
continue;
|
|
25970
|
+
const value = readStringLiteral2(property.initializer);
|
|
25971
|
+
if (value !== null)
|
|
25972
|
+
return value;
|
|
25973
|
+
}
|
|
25974
|
+
return null;
|
|
25975
|
+
}, analyzeFile2 = async (filePath) => {
|
|
25976
|
+
let source;
|
|
25977
|
+
try {
|
|
25978
|
+
source = await fs3.readFile(filePath, "utf-8");
|
|
25979
|
+
} catch {
|
|
25980
|
+
return null;
|
|
25981
|
+
}
|
|
25982
|
+
if (!source.includes("createBrowserRouter"))
|
|
25983
|
+
return null;
|
|
25984
|
+
const sf = ts9.createSourceFile(filePath, source, ts9.ScriptTarget.Latest, true, filePath.endsWith(".tsx") ? ts9.ScriptKind.TSX : ts9.ScriptKind.TS);
|
|
25985
|
+
if (!importsSymbolFromAny(sf, "createBrowserRouter", [
|
|
25986
|
+
"react-router-dom",
|
|
25987
|
+
"react-router"
|
|
25988
|
+
])) {
|
|
25989
|
+
return null;
|
|
25990
|
+
}
|
|
25991
|
+
const call = findCreateBrowserRouterCall(sf);
|
|
25992
|
+
if (!call)
|
|
25993
|
+
return null;
|
|
25994
|
+
const routesArg = call.arguments[0];
|
|
25995
|
+
if (!routesArg)
|
|
25996
|
+
return null;
|
|
25997
|
+
let routesArray = null;
|
|
25998
|
+
if (ts9.isArrayLiteralExpression(routesArg)) {
|
|
25999
|
+
routesArray = routesArg;
|
|
26000
|
+
} else if (ts9.isIdentifier(routesArg)) {
|
|
26001
|
+
routesArray = findVariableArrayDeclaration(sf, routesArg.text);
|
|
26002
|
+
}
|
|
26003
|
+
if (!routesArray)
|
|
26004
|
+
return null;
|
|
26005
|
+
const basename14 = readBasenameFromOptions(call.arguments[1]);
|
|
26006
|
+
const baseHref = basename14 ? `${basename14.replace(/\/+$/, "")}/` : "/";
|
|
26007
|
+
const routes = [];
|
|
26008
|
+
extractRouteEntries(routesArray, "", routes);
|
|
26009
|
+
return { baseHref, routes, sourceFile: filePath };
|
|
26010
|
+
}, walkSourceFiles = async (dir, out) => {
|
|
26011
|
+
let items;
|
|
26012
|
+
try {
|
|
26013
|
+
items = await fs3.readdir(dir, { withFileTypes: true });
|
|
26014
|
+
} catch {
|
|
26015
|
+
return;
|
|
26016
|
+
}
|
|
26017
|
+
for (const item of items) {
|
|
26018
|
+
if (item.name === "node_modules" || item.name.startsWith("."))
|
|
26019
|
+
continue;
|
|
26020
|
+
const full = join36(dir, item.name);
|
|
26021
|
+
if (item.isDirectory()) {
|
|
26022
|
+
await walkSourceFiles(full, out);
|
|
26023
|
+
} 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")) {
|
|
26024
|
+
out.push(full);
|
|
26025
|
+
}
|
|
26026
|
+
}
|
|
26027
|
+
}, analyzeReactSpaRoutes = async (reactDirectory) => {
|
|
26028
|
+
if (!existsSync32(reactDirectory))
|
|
26029
|
+
return [];
|
|
26030
|
+
const files = [];
|
|
26031
|
+
await walkSourceFiles(reactDirectory, files);
|
|
26032
|
+
const hosts = [];
|
|
26033
|
+
await Promise.all(files.map(async (file5) => {
|
|
26034
|
+
try {
|
|
26035
|
+
const host = await analyzeFile2(file5);
|
|
26036
|
+
if (host)
|
|
26037
|
+
hosts.push(host);
|
|
26038
|
+
} catch (err) {
|
|
26039
|
+
console.warn(`[sitemap] React SPA analysis failed for ${file5}:`, err);
|
|
26040
|
+
}
|
|
26041
|
+
}));
|
|
26042
|
+
return hosts;
|
|
26043
|
+
};
|
|
26044
|
+
var init_staticAnalyzeSpaRoutes2 = __esm(() => {
|
|
26045
|
+
DYNAMIC_SEGMENT_PATTERN2 = /^[:*]/;
|
|
26046
|
+
});
|
|
26047
|
+
|
|
26048
|
+
// src/svelte/staticAnalyzeSpaRoutes.ts
|
|
26049
|
+
import { existsSync as existsSync33, promises as fs4 } from "fs";
|
|
26050
|
+
import { join as join37 } from "path";
|
|
26051
|
+
var DYNAMIC_SEGMENT_PATTERN3, pathHasDynamic3 = (path) => path.split("/").some((seg) => DYNAMIC_SEGMENT_PATTERN3.test(seg) || seg === "**"), joinSegments3 = (parent, child) => {
|
|
26052
|
+
if (!child)
|
|
26053
|
+
return parent;
|
|
26054
|
+
if (!parent)
|
|
26055
|
+
return child;
|
|
26056
|
+
return `${parent.replace(/\/+$/, "")}/${child.replace(/^\/+/, "")}`;
|
|
26057
|
+
}, readAttribute = (tag, name) => {
|
|
26058
|
+
const re2 = new RegExp(`${name}\\s*=\\s*(?:"([^"]*)"|'([^']*)'|\\{?["']([^"']+)["']\\}?)`);
|
|
26059
|
+
const match = re2.exec(tag);
|
|
26060
|
+
return match ? match[1] ?? match[2] ?? match[3] ?? null : null;
|
|
26061
|
+
}, ROUTER_OPEN_TAG_PATTERN, ROUTE_TAG_PATTERN, findRouterBlock = (source) => {
|
|
26062
|
+
const openMatch = ROUTER_OPEN_TAG_PATTERN.exec(source);
|
|
26063
|
+
ROUTER_OPEN_TAG_PATTERN.lastIndex = 0;
|
|
26064
|
+
if (!openMatch)
|
|
26065
|
+
return null;
|
|
26066
|
+
const attrs = openMatch[1] ?? "";
|
|
26067
|
+
const basepathRaw = readAttribute(`<Router ${attrs}>`, "basepath");
|
|
26068
|
+
const basepath = basepathRaw ?? "/";
|
|
26069
|
+
const closeIndex = source.indexOf("</Router>", openMatch.index);
|
|
26070
|
+
if (closeIndex === -1)
|
|
26071
|
+
return null;
|
|
26072
|
+
const body = source.slice(openMatch.index + openMatch[0].length, closeIndex);
|
|
26073
|
+
return { basepath, body };
|
|
26074
|
+
}, extractRoutesFromBody = (body) => {
|
|
26075
|
+
const out = [];
|
|
26076
|
+
let match;
|
|
26077
|
+
ROUTE_TAG_PATTERN.lastIndex = 0;
|
|
26078
|
+
while ((match = ROUTE_TAG_PATTERN.exec(body)) !== null) {
|
|
26079
|
+
const attrs = match[1] ?? "";
|
|
26080
|
+
const path = readAttribute(`<Route ${attrs}/>`, "path");
|
|
26081
|
+
if (!path)
|
|
26082
|
+
continue;
|
|
26083
|
+
out.push({
|
|
26084
|
+
dynamic: pathHasDynamic3(path),
|
|
26085
|
+
path,
|
|
26086
|
+
redirected: false,
|
|
26087
|
+
sitemapExcluded: false
|
|
26088
|
+
});
|
|
26089
|
+
}
|
|
26090
|
+
return out;
|
|
26091
|
+
}, analyzeFile3 = async (filePath) => {
|
|
26092
|
+
let source;
|
|
26093
|
+
try {
|
|
26094
|
+
source = await fs4.readFile(filePath, "utf-8");
|
|
26095
|
+
} catch {
|
|
26096
|
+
return null;
|
|
26097
|
+
}
|
|
26098
|
+
if (!source.includes("<Router"))
|
|
26099
|
+
return null;
|
|
26100
|
+
const block = findRouterBlock(source);
|
|
26101
|
+
if (!block)
|
|
26102
|
+
return null;
|
|
26103
|
+
const routes = extractRoutesFromBody(block.body);
|
|
26104
|
+
if (routes.length === 0)
|
|
26105
|
+
return null;
|
|
26106
|
+
const baseHref = block.basepath.endsWith("/") ? block.basepath : `${block.basepath}/`;
|
|
26107
|
+
const joinedRoutes = routes.map((r) => ({
|
|
26108
|
+
...r,
|
|
26109
|
+
path: joinSegments3("", r.path)
|
|
26110
|
+
}));
|
|
26111
|
+
return { baseHref, routes: joinedRoutes, sourceFile: filePath };
|
|
26112
|
+
}, walkSvelteFiles = async (dir, out) => {
|
|
26113
|
+
let items;
|
|
26114
|
+
try {
|
|
26115
|
+
items = await fs4.readdir(dir, { withFileTypes: true });
|
|
26116
|
+
} catch {
|
|
26117
|
+
return;
|
|
26118
|
+
}
|
|
26119
|
+
for (const item of items) {
|
|
26120
|
+
if (item.name === "node_modules" || item.name.startsWith("."))
|
|
26121
|
+
continue;
|
|
26122
|
+
const full = join37(dir, item.name);
|
|
26123
|
+
if (item.isDirectory()) {
|
|
26124
|
+
await walkSvelteFiles(full, out);
|
|
26125
|
+
} else if (item.isFile() && item.name.endsWith(".svelte")) {
|
|
26126
|
+
out.push(full);
|
|
26127
|
+
}
|
|
26128
|
+
}
|
|
26129
|
+
}, analyzeSvelteSpaRoutes = async (svelteDirectory) => {
|
|
26130
|
+
if (!existsSync33(svelteDirectory))
|
|
26131
|
+
return [];
|
|
26132
|
+
const files = [];
|
|
26133
|
+
await walkSvelteFiles(svelteDirectory, files);
|
|
26134
|
+
const hosts = [];
|
|
26135
|
+
await Promise.all(files.map(async (file5) => {
|
|
26136
|
+
try {
|
|
26137
|
+
const host = await analyzeFile3(file5);
|
|
26138
|
+
if (host)
|
|
26139
|
+
hosts.push(host);
|
|
26140
|
+
} catch (err) {
|
|
26141
|
+
console.warn(`[sitemap] Svelte SPA analysis failed for ${file5}:`, err);
|
|
26142
|
+
}
|
|
26143
|
+
}));
|
|
26144
|
+
return hosts;
|
|
26145
|
+
};
|
|
26146
|
+
var init_staticAnalyzeSpaRoutes3 = __esm(() => {
|
|
26147
|
+
DYNAMIC_SEGMENT_PATTERN3 = /^[:*]/;
|
|
26148
|
+
ROUTER_OPEN_TAG_PATTERN = /<Router\b([^>]*)>/g;
|
|
26149
|
+
ROUTE_TAG_PATTERN = /<Route\b([^>]*)\/?>/g;
|
|
26150
|
+
});
|
|
26151
|
+
|
|
26152
|
+
// src/vue/staticAnalyzeSpaRoutes.ts
|
|
26153
|
+
import { existsSync as existsSync34, promises as fs5 } from "fs";
|
|
26154
|
+
import { join as join38 } from "path";
|
|
26155
|
+
import ts10 from "typescript";
|
|
26156
|
+
var DYNAMIC_SEGMENT_PATTERN4, pathHasDynamic4 = (path) => path.split("/").some((seg) => DYNAMIC_SEGMENT_PATTERN4.test(seg) || seg === "**"), readStringLiteral3 = (expression) => {
|
|
26157
|
+
if (ts10.isStringLiteral(expression) || ts10.isNoSubstitutionTemplateLiteral(expression)) {
|
|
26158
|
+
return expression.text;
|
|
26159
|
+
}
|
|
26160
|
+
return null;
|
|
26161
|
+
}, readPropertyKey3 = (property) => {
|
|
26162
|
+
if (ts10.isPropertyAssignment(property)) {
|
|
26163
|
+
const name = property.name;
|
|
26164
|
+
if (ts10.isIdentifier(name) || ts10.isStringLiteral(name))
|
|
26165
|
+
return name.text;
|
|
26166
|
+
}
|
|
26167
|
+
if (ts10.isShorthandPropertyAssignment(property)) {
|
|
26168
|
+
return property.name.text;
|
|
26169
|
+
}
|
|
26170
|
+
return null;
|
|
26171
|
+
}, importsSymbolFrom2 = (sf, localName, moduleSpecifier) => {
|
|
26172
|
+
for (const statement of sf.statements) {
|
|
26173
|
+
if (!ts10.isImportDeclaration(statement))
|
|
26174
|
+
continue;
|
|
26175
|
+
if (!ts10.isStringLiteral(statement.moduleSpecifier))
|
|
26176
|
+
continue;
|
|
26177
|
+
if (statement.moduleSpecifier.text !== moduleSpecifier)
|
|
26178
|
+
continue;
|
|
26179
|
+
const named = statement.importClause?.namedBindings;
|
|
26180
|
+
if (!named || !ts10.isNamedImports(named))
|
|
26181
|
+
continue;
|
|
26182
|
+
for (const element of named.elements) {
|
|
26183
|
+
if (element.name.text === localName)
|
|
26184
|
+
return true;
|
|
26185
|
+
}
|
|
26186
|
+
}
|
|
26187
|
+
return false;
|
|
26188
|
+
}, findVariableArrayDeclaration2 = (sf, identifierName) => {
|
|
26189
|
+
let found = null;
|
|
26190
|
+
const visit = (node) => {
|
|
26191
|
+
if (found)
|
|
26192
|
+
return;
|
|
26193
|
+
if (ts10.isVariableDeclaration(node) && ts10.isIdentifier(node.name) && node.name.text === identifierName && node.initializer && ts10.isArrayLiteralExpression(node.initializer)) {
|
|
26194
|
+
found = node.initializer;
|
|
26195
|
+
return;
|
|
26196
|
+
}
|
|
26197
|
+
ts10.forEachChild(node, visit);
|
|
26198
|
+
};
|
|
26199
|
+
ts10.forEachChild(sf, visit);
|
|
26200
|
+
return found;
|
|
26201
|
+
}, joinSegments4 = (parent, child) => {
|
|
26202
|
+
if (!child)
|
|
26203
|
+
return parent;
|
|
26204
|
+
if (!parent)
|
|
26205
|
+
return child;
|
|
26206
|
+
return `${parent.replace(/\/+$/, "")}/${child.replace(/^\/+/, "")}`;
|
|
26207
|
+
}, extractRouteEntries2 = (arr, parentPath, out) => {
|
|
26208
|
+
for (const element of arr.elements) {
|
|
26209
|
+
if (!ts10.isObjectLiteralExpression(element))
|
|
26210
|
+
continue;
|
|
26211
|
+
let pathSegment = null;
|
|
26212
|
+
let redirected = false;
|
|
26213
|
+
let sitemapExcluded = false;
|
|
26214
|
+
let childrenLiteral = null;
|
|
26215
|
+
for (const property of element.properties) {
|
|
26216
|
+
const key = readPropertyKey3(property);
|
|
26217
|
+
if (!key)
|
|
26218
|
+
continue;
|
|
26219
|
+
if (!ts10.isPropertyAssignment(property))
|
|
26220
|
+
continue;
|
|
26221
|
+
if (key === "path") {
|
|
26222
|
+
pathSegment = readStringLiteral3(property.initializer);
|
|
26223
|
+
} else if (key === "redirect") {
|
|
26224
|
+
redirected = true;
|
|
26225
|
+
} else if (key === "children" && ts10.isArrayLiteralExpression(property.initializer)) {
|
|
26226
|
+
childrenLiteral = property.initializer;
|
|
26227
|
+
} else if (key === "meta" && ts10.isObjectLiteralExpression(property.initializer)) {
|
|
26228
|
+
for (const metaProp of property.initializer.properties) {
|
|
26229
|
+
const metaKey = readPropertyKey3(metaProp);
|
|
26230
|
+
if (metaKey !== "sitemap")
|
|
26231
|
+
continue;
|
|
26232
|
+
if (!ts10.isPropertyAssignment(metaProp))
|
|
26233
|
+
continue;
|
|
26234
|
+
const value = readStringLiteral3(metaProp.initializer);
|
|
26235
|
+
if (value === "exclude")
|
|
26236
|
+
sitemapExcluded = true;
|
|
26237
|
+
}
|
|
26238
|
+
}
|
|
26239
|
+
}
|
|
26240
|
+
if (pathSegment === null)
|
|
26241
|
+
continue;
|
|
26242
|
+
const joined = joinSegments4(parentPath, pathSegment);
|
|
26243
|
+
if (childrenLiteral) {
|
|
26244
|
+
extractRouteEntries2(childrenLiteral, joined, out);
|
|
26245
|
+
continue;
|
|
26246
|
+
}
|
|
26247
|
+
if (redirected)
|
|
26248
|
+
continue;
|
|
26249
|
+
if (joined === "")
|
|
26250
|
+
continue;
|
|
26251
|
+
out.push({
|
|
26252
|
+
dynamic: pathHasDynamic4(joined),
|
|
26253
|
+
path: joined,
|
|
26254
|
+
redirected,
|
|
26255
|
+
sitemapExcluded
|
|
26256
|
+
});
|
|
26257
|
+
}
|
|
26258
|
+
}, findCreateRouterCall = (sf) => {
|
|
26259
|
+
let found = null;
|
|
26260
|
+
const visit = (node) => {
|
|
26261
|
+
if (found)
|
|
26262
|
+
return;
|
|
26263
|
+
if (ts10.isCallExpression(node) && ts10.isIdentifier(node.expression) && node.expression.text === "createRouter") {
|
|
26264
|
+
found = node;
|
|
26265
|
+
return;
|
|
26266
|
+
}
|
|
26267
|
+
ts10.forEachChild(node, visit);
|
|
26268
|
+
};
|
|
26269
|
+
ts10.forEachChild(sf, visit);
|
|
26270
|
+
return found;
|
|
26271
|
+
}, findCreateWebHistoryBase = (sf) => {
|
|
26272
|
+
let found = null;
|
|
26273
|
+
const visit = (node) => {
|
|
26274
|
+
if (found)
|
|
26275
|
+
return;
|
|
26276
|
+
if (ts10.isCallExpression(node) && ts10.isIdentifier(node.expression) && (node.expression.text === "createWebHistory" || node.expression.text === "createWebHashHistory")) {
|
|
26277
|
+
const baseArg = node.arguments[0];
|
|
26278
|
+
if (baseArg) {
|
|
26279
|
+
const text = readStringLiteral3(baseArg);
|
|
26280
|
+
if (text !== null) {
|
|
26281
|
+
found = text;
|
|
26282
|
+
return;
|
|
26283
|
+
}
|
|
26284
|
+
} else {
|
|
26285
|
+
found = "/";
|
|
26286
|
+
return;
|
|
26287
|
+
}
|
|
26288
|
+
}
|
|
26289
|
+
ts10.forEachChild(node, visit);
|
|
26290
|
+
};
|
|
26291
|
+
ts10.forEachChild(sf, visit);
|
|
26292
|
+
return found;
|
|
26293
|
+
}, readRoutesFromCreateRouterOptions = (sf, optionsExpr) => {
|
|
26294
|
+
if (!ts10.isObjectLiteralExpression(optionsExpr))
|
|
26295
|
+
return null;
|
|
26296
|
+
for (const property of optionsExpr.properties) {
|
|
26297
|
+
const key = readPropertyKey3(property);
|
|
26298
|
+
if (key !== "routes")
|
|
26299
|
+
continue;
|
|
26300
|
+
if (ts10.isShorthandPropertyAssignment(property)) {
|
|
26301
|
+
return findVariableArrayDeclaration2(sf, property.name.text);
|
|
26302
|
+
}
|
|
26303
|
+
if (!ts10.isPropertyAssignment(property))
|
|
26304
|
+
continue;
|
|
26305
|
+
if (ts10.isArrayLiteralExpression(property.initializer)) {
|
|
26306
|
+
return property.initializer;
|
|
26307
|
+
}
|
|
26308
|
+
if (ts10.isIdentifier(property.initializer)) {
|
|
26309
|
+
return findVariableArrayDeclaration2(sf, property.initializer.text);
|
|
26310
|
+
}
|
|
26311
|
+
}
|
|
26312
|
+
return null;
|
|
26313
|
+
}, extractScriptBlockFromVueSfc = (source) => {
|
|
26314
|
+
const scriptRe = /<script\b[^>]*?(?:setup)?[^>]*>([\s\S]*?)<\/script>/i;
|
|
26315
|
+
const match = scriptRe.exec(source);
|
|
26316
|
+
return match ? match[1] ?? null : null;
|
|
26317
|
+
}, analyzeFile4 = async (filePath) => {
|
|
26318
|
+
let source;
|
|
26319
|
+
try {
|
|
26320
|
+
source = await fs5.readFile(filePath, "utf-8");
|
|
26321
|
+
} catch {
|
|
26322
|
+
return null;
|
|
26323
|
+
}
|
|
26324
|
+
let analysisSource = source;
|
|
26325
|
+
if (filePath.endsWith(".vue")) {
|
|
26326
|
+
const script = extractScriptBlockFromVueSfc(source);
|
|
26327
|
+
if (script === null)
|
|
26328
|
+
return null;
|
|
26329
|
+
analysisSource = script;
|
|
26330
|
+
}
|
|
26331
|
+
if (!analysisSource.includes("createRouter"))
|
|
26332
|
+
return null;
|
|
26333
|
+
const sf = ts10.createSourceFile(filePath, analysisSource, ts10.ScriptTarget.Latest, true, ts10.ScriptKind.TS);
|
|
26334
|
+
if (!importsSymbolFrom2(sf, "createRouter", "vue-router"))
|
|
26335
|
+
return null;
|
|
26336
|
+
const call = findCreateRouterCall(sf);
|
|
26337
|
+
if (!call)
|
|
26338
|
+
return null;
|
|
26339
|
+
const optionsArg = call.arguments[0];
|
|
26340
|
+
if (!optionsArg)
|
|
26341
|
+
return null;
|
|
26342
|
+
const routesArray = readRoutesFromCreateRouterOptions(sf, optionsArg);
|
|
26343
|
+
if (!routesArray)
|
|
26344
|
+
return null;
|
|
26345
|
+
const base = findCreateWebHistoryBase(sf) ?? "/";
|
|
26346
|
+
const baseHref = base.endsWith("/") ? base : `${base}/`;
|
|
26347
|
+
const routes = [];
|
|
26348
|
+
extractRouteEntries2(routesArray, "", routes);
|
|
26349
|
+
return { baseHref, routes, sourceFile: filePath };
|
|
26350
|
+
}, walkSourceFiles2 = async (dir, out) => {
|
|
26351
|
+
let items;
|
|
26352
|
+
try {
|
|
26353
|
+
items = await fs5.readdir(dir, { withFileTypes: true });
|
|
26354
|
+
} catch {
|
|
26355
|
+
return;
|
|
26356
|
+
}
|
|
26357
|
+
for (const item of items) {
|
|
26358
|
+
if (item.name === "node_modules" || item.name.startsWith("."))
|
|
26359
|
+
continue;
|
|
26360
|
+
const full = join38(dir, item.name);
|
|
26361
|
+
if (item.isDirectory()) {
|
|
26362
|
+
await walkSourceFiles2(full, out);
|
|
26363
|
+
} else if (item.isFile() && (item.name.endsWith(".ts") || item.name.endsWith(".js") || item.name.endsWith(".vue")) && !item.name.endsWith(".d.ts")) {
|
|
26364
|
+
out.push(full);
|
|
26365
|
+
}
|
|
26366
|
+
}
|
|
26367
|
+
}, analyzeVueSpaRoutes = async (vueDirectory) => {
|
|
26368
|
+
if (!existsSync34(vueDirectory))
|
|
26369
|
+
return [];
|
|
26370
|
+
const files = [];
|
|
26371
|
+
await walkSourceFiles2(vueDirectory, files);
|
|
26372
|
+
const hosts = [];
|
|
26373
|
+
await Promise.all(files.map(async (file5) => {
|
|
26374
|
+
try {
|
|
26375
|
+
const host = await analyzeFile4(file5);
|
|
26376
|
+
if (host)
|
|
26377
|
+
hosts.push(host);
|
|
26378
|
+
} catch (err) {
|
|
26379
|
+
console.warn(`[sitemap] Vue SPA analysis failed for ${file5}:`, err);
|
|
26380
|
+
}
|
|
26381
|
+
}));
|
|
26382
|
+
return hosts;
|
|
26383
|
+
};
|
|
26384
|
+
var init_staticAnalyzeSpaRoutes4 = __esm(() => {
|
|
26385
|
+
DYNAMIC_SEGMENT_PATTERN4 = /^[:*]/;
|
|
26386
|
+
});
|
|
26387
|
+
|
|
25826
26388
|
// src/utils/generateSitemap.ts
|
|
25827
26389
|
var exports_generateSitemap = {};
|
|
25828
26390
|
__export(exports_generateSitemap, {
|
|
@@ -25837,7 +26399,38 @@ var DEFAULT_PRIORITY = 0.8, escapeXml = (str) => str.replace(/&/g, "&").repl
|
|
|
25837
26399
|
return true;
|
|
25838
26400
|
}
|
|
25839
26401
|
return false;
|
|
25840
|
-
}, stripTrailingWildcard = (path) => path.replace(/\/\*+$/, ""), isWildcardPagePath = (path) => path.endsWith("/*") || path.endsWith("*"),
|
|
26402
|
+
}, stripTrailingWildcard = (path) => path.replace(/\/\*+$/, ""), isWildcardPagePath = (path) => path.endsWith("/*") || path.endsWith("*"), SITEMAP_BLOCK_PATTERN, SITEMAP_STRING_FIELD_PATTERN, SITEMAP_NUMBER_FIELD_PATTERN, VALID_CHANGEFREQ, extractSitemapMetadataFromHandlerSource = (source) => {
|
|
26403
|
+
const block = SITEMAP_BLOCK_PATTERN.exec(source);
|
|
26404
|
+
if (!block)
|
|
26405
|
+
return;
|
|
26406
|
+
const body = block[1];
|
|
26407
|
+
if (typeof body !== "string")
|
|
26408
|
+
return;
|
|
26409
|
+
const out = {};
|
|
26410
|
+
SITEMAP_STRING_FIELD_PATTERN.lastIndex = 0;
|
|
26411
|
+
let m;
|
|
26412
|
+
while ((m = SITEMAP_STRING_FIELD_PATTERN.exec(body)) !== null) {
|
|
26413
|
+
const key = m[1];
|
|
26414
|
+
const value = m[2];
|
|
26415
|
+
if (key === "changefreq" && VALID_CHANGEFREQ.has(value)) {
|
|
26416
|
+
out.changefreq = value;
|
|
26417
|
+
} else if (key === "lastmod") {
|
|
26418
|
+
out.lastmod = value;
|
|
26419
|
+
}
|
|
26420
|
+
}
|
|
26421
|
+
SITEMAP_NUMBER_FIELD_PATTERN.lastIndex = 0;
|
|
26422
|
+
while ((m = SITEMAP_NUMBER_FIELD_PATTERN.exec(body)) !== null) {
|
|
26423
|
+
const num = parseFloat(m[1]);
|
|
26424
|
+
if (!Number.isNaN(num))
|
|
26425
|
+
out.priority = num;
|
|
26426
|
+
}
|
|
26427
|
+
return Object.keys(out).length > 0 ? out : undefined;
|
|
26428
|
+
}, sitemapMetadataForRouteHandler = (handler) => {
|
|
26429
|
+
const source = getOriginalPageHandlerSource(handler);
|
|
26430
|
+
if (!source)
|
|
26431
|
+
return;
|
|
26432
|
+
return extractSitemapMetadataFromHandlerSource(source);
|
|
26433
|
+
}, discoverPageRoutes = (routes, exclude) => {
|
|
25841
26434
|
const seen = new Set;
|
|
25842
26435
|
const out = [];
|
|
25843
26436
|
for (const route of routes) {
|
|
@@ -25858,7 +26451,8 @@ var DEFAULT_PRIORITY = 0.8, escapeXml = (str) => str.replace(/&/g, "&").repl
|
|
|
25858
26451
|
out.push({
|
|
25859
26452
|
emitTopLevel: !isWildcardPagePath(route.path),
|
|
25860
26453
|
mountPath,
|
|
25861
|
-
rawPath: route.path
|
|
26454
|
+
rawPath: route.path,
|
|
26455
|
+
sitemap: sitemapMetadataForRouteHandler(route.handler)
|
|
25862
26456
|
});
|
|
25863
26457
|
}
|
|
25864
26458
|
return out;
|
|
@@ -25877,10 +26471,11 @@ var DEFAULT_PRIORITY = 0.8, escapeXml = (str) => str.replace(/&/g, "&").repl
|
|
|
25877
26471
|
const normalizedBase = baseUrl.replace(/\/$/, "");
|
|
25878
26472
|
const xml = [];
|
|
25879
26473
|
for (const entry of entries) {
|
|
25880
|
-
const
|
|
25881
|
-
const
|
|
25882
|
-
const
|
|
25883
|
-
const
|
|
26474
|
+
const configOverride = config.overrides?.[entry.path];
|
|
26475
|
+
const handlerOverride = entry.override;
|
|
26476
|
+
const changefreq = configOverride?.changefreq ?? handlerOverride?.changefreq ?? config.defaultChangefreq ?? "weekly";
|
|
26477
|
+
const priority = configOverride?.priority ?? handlerOverride?.priority ?? config.defaultPriority ?? DEFAULT_PRIORITY;
|
|
26478
|
+
const lastmod = configOverride?.lastmod ?? handlerOverride?.lastmod;
|
|
25884
26479
|
const url = escapeXml(`${normalizedBase}${entry.path}`);
|
|
25885
26480
|
let block = ` <url>
|
|
25886
26481
|
<loc>${url}</loc>`;
|
|
@@ -25902,14 +26497,14 @@ var DEFAULT_PRIORITY = 0.8, escapeXml = (str) => str.replace(/&/g, "&").repl
|
|
|
25902
26497
|
"</urlset>"
|
|
25903
26498
|
].join(`
|
|
25904
26499
|
`);
|
|
25905
|
-
},
|
|
25906
|
-
const wildcardMounts = new Set(discovered.filter((page) => !page.emitTopLevel).map((page) => page.mountPath));
|
|
26500
|
+
}, collectFrameworkSpaEntries = (hosts, mountOverridesByPath, exclude, seenPaths) => {
|
|
25907
26501
|
const out = [];
|
|
25908
|
-
for (const
|
|
25909
|
-
const mount = normalizeMountFromBaseHref(
|
|
25910
|
-
if (!
|
|
26502
|
+
for (const host of hosts) {
|
|
26503
|
+
const mount = normalizeMountFromBaseHref(host.baseHref);
|
|
26504
|
+
if (!mountOverridesByPath.has(mount))
|
|
25911
26505
|
continue;
|
|
25912
|
-
|
|
26506
|
+
const mountOverride = mountOverridesByPath.get(mount);
|
|
26507
|
+
for (const route of host.routes) {
|
|
25913
26508
|
if (route.dynamic)
|
|
25914
26509
|
continue;
|
|
25915
26510
|
if (route.redirected)
|
|
@@ -25922,10 +26517,17 @@ var DEFAULT_PRIORITY = 0.8, escapeXml = (str) => str.replace(/&/g, "&").repl
|
|
|
25922
26517
|
if (isExcluded(fullPath, exclude))
|
|
25923
26518
|
continue;
|
|
25924
26519
|
seenPaths.add(fullPath);
|
|
25925
|
-
out.push({ path: fullPath });
|
|
26520
|
+
out.push({ override: mountOverride, path: fullPath });
|
|
25926
26521
|
}
|
|
25927
26522
|
}
|
|
25928
26523
|
return out;
|
|
26524
|
+
}, runAnalyzer = async (label, analyzer) => {
|
|
26525
|
+
try {
|
|
26526
|
+
return await analyzer();
|
|
26527
|
+
} catch (err) {
|
|
26528
|
+
console.warn(`[sitemap] ${label} SPA analysis failed:`, err);
|
|
26529
|
+
return [];
|
|
26530
|
+
}
|
|
25929
26531
|
}, generateSitemap = async (routes, serverUrl, outDir, config = {}, pipelineConfig = {}) => {
|
|
25930
26532
|
const exclude = config.exclude ?? [];
|
|
25931
26533
|
const discoveredPages = discoverPageRoutes(routes, exclude);
|
|
@@ -25937,17 +26539,30 @@ var DEFAULT_PRIORITY = 0.8, escapeXml = (str) => str.replace(/&/g, "&").repl
|
|
|
25937
26539
|
if (seenPaths.has(page.mountPath))
|
|
25938
26540
|
continue;
|
|
25939
26541
|
seenPaths.add(page.mountPath);
|
|
25940
|
-
entries.push({ path: page.mountPath });
|
|
26542
|
+
entries.push({ override: page.sitemap, path: page.mountPath });
|
|
26543
|
+
}
|
|
26544
|
+
const wildcardOverrides = new Map;
|
|
26545
|
+
for (const page of discoveredPages) {
|
|
26546
|
+
if (page.emitTopLevel)
|
|
26547
|
+
continue;
|
|
26548
|
+
wildcardOverrides.set(page.mountPath, page.sitemap);
|
|
25941
26549
|
}
|
|
26550
|
+
const analyzerJobs = [];
|
|
25942
26551
|
if (pipelineConfig.angularDirectory) {
|
|
25943
|
-
|
|
25944
|
-
|
|
25945
|
-
|
|
25946
|
-
|
|
25947
|
-
|
|
25948
|
-
|
|
25949
|
-
|
|
26552
|
+
analyzerJobs.push(runAnalyzer("Angular", () => analyzeAngularSpaRoutes(pipelineConfig.angularDirectory)));
|
|
26553
|
+
}
|
|
26554
|
+
if (pipelineConfig.reactDirectory) {
|
|
26555
|
+
analyzerJobs.push(runAnalyzer("React", () => analyzeReactSpaRoutes(pipelineConfig.reactDirectory)));
|
|
26556
|
+
}
|
|
26557
|
+
if (pipelineConfig.svelteDirectory) {
|
|
26558
|
+
analyzerJobs.push(runAnalyzer("Svelte", () => analyzeSvelteSpaRoutes(pipelineConfig.svelteDirectory)));
|
|
25950
26559
|
}
|
|
26560
|
+
if (pipelineConfig.vueDirectory) {
|
|
26561
|
+
analyzerJobs.push(runAnalyzer("Vue", () => analyzeVueSpaRoutes(pipelineConfig.vueDirectory)));
|
|
26562
|
+
}
|
|
26563
|
+
const allHosts = (await Promise.all(analyzerJobs)).flat();
|
|
26564
|
+
const spaEntries = collectFrameworkSpaEntries(allHosts, wildcardOverrides, exclude, seenPaths);
|
|
26565
|
+
entries.push(...spaEntries);
|
|
25951
26566
|
const dynamicRoutes = config.routes ? await config.routes() : [];
|
|
25952
26567
|
for (const path of dynamicRoutes) {
|
|
25953
26568
|
if (seenPaths.has(path))
|
|
@@ -25964,6 +26579,21 @@ var DEFAULT_PRIORITY = 0.8, escapeXml = (str) => str.replace(/&/g, "&").repl
|
|
|
25964
26579
|
var init_generateSitemap = __esm(() => {
|
|
25965
26580
|
init_devRouteRegistrationCallsite();
|
|
25966
26581
|
init_staticAnalyzeSpaRoutes();
|
|
26582
|
+
init_staticAnalyzeSpaRoutes2();
|
|
26583
|
+
init_staticAnalyzeSpaRoutes3();
|
|
26584
|
+
init_staticAnalyzeSpaRoutes4();
|
|
26585
|
+
SITEMAP_BLOCK_PATTERN = /\bsitemap\s*:\s*\{([^{}]*)\}/;
|
|
26586
|
+
SITEMAP_STRING_FIELD_PATTERN = /\b(changefreq|lastmod)\s*:\s*['"]([^'"]+)['"]/g;
|
|
26587
|
+
SITEMAP_NUMBER_FIELD_PATTERN = /\bpriority\s*:\s*([+-]?\d+(?:\.\d+)?)/g;
|
|
26588
|
+
VALID_CHANGEFREQ = new Set([
|
|
26589
|
+
"always",
|
|
26590
|
+
"hourly",
|
|
26591
|
+
"daily",
|
|
26592
|
+
"weekly",
|
|
26593
|
+
"monthly",
|
|
26594
|
+
"yearly",
|
|
26595
|
+
"never"
|
|
26596
|
+
]);
|
|
25967
26597
|
});
|
|
25968
26598
|
|
|
25969
26599
|
// src/core/prerender.ts
|
|
@@ -25977,7 +26607,7 @@ __export(exports_prerender, {
|
|
|
25977
26607
|
PRERENDER_BYPASS_HEADER: () => PRERENDER_BYPASS_HEADER
|
|
25978
26608
|
});
|
|
25979
26609
|
import { mkdirSync as mkdirSync16, readFileSync as readFileSync23 } from "fs";
|
|
25980
|
-
import { join as
|
|
26610
|
+
import { join as join39 } from "path";
|
|
25981
26611
|
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
26612
|
const metaPath = htmlPath.replace(/\.html$/, ".meta");
|
|
25983
26613
|
await Bun.write(metaPath, String(Date.now()));
|
|
@@ -26043,7 +26673,7 @@ var SERVER_OUTPUT_LIMIT = 4000, STARTUP_POLL_INTERVAL_MS = 100, DEFAULT_STARTUP_
|
|
|
26043
26673
|
return false;
|
|
26044
26674
|
const html = await res.text();
|
|
26045
26675
|
const fileName = routeToFilename(route);
|
|
26046
|
-
const filePath =
|
|
26676
|
+
const filePath = join39(prerenderDir, fileName);
|
|
26047
26677
|
await Bun.write(filePath, html);
|
|
26048
26678
|
await writeTimestamp(filePath);
|
|
26049
26679
|
return true;
|
|
@@ -26069,13 +26699,13 @@ var SERVER_OUTPUT_LIMIT = 4000, STARTUP_POLL_INTERVAL_MS = 100, DEFAULT_STARTUP_
|
|
|
26069
26699
|
}
|
|
26070
26700
|
const html = await res.text();
|
|
26071
26701
|
const fileName = routeToFilename(route);
|
|
26072
|
-
const filePath =
|
|
26702
|
+
const filePath = join39(prerenderDir, fileName);
|
|
26073
26703
|
await Bun.write(filePath, html);
|
|
26074
26704
|
await writeTimestamp(filePath);
|
|
26075
26705
|
result.routes.set(route, filePath);
|
|
26076
26706
|
log2?.(` Pre-rendered ${route} \u2192 ${fileName} (${html.length} bytes)`);
|
|
26077
26707
|
}, prerender = async (port, outDir, staticConfig, log2) => {
|
|
26078
|
-
const prerenderDir =
|
|
26708
|
+
const prerenderDir = join39(outDir, "_prerendered");
|
|
26079
26709
|
mkdirSync16(prerenderDir, { recursive: true });
|
|
26080
26710
|
const baseUrl = `http://localhost:${port}`;
|
|
26081
26711
|
let routes;
|
|
@@ -26175,14 +26805,14 @@ __export(exports_serverEntryWatcher, {
|
|
|
26175
26805
|
startServerEntryWatcher: () => startServerEntryWatcher,
|
|
26176
26806
|
isAtomicWriteTemp: () => isAtomicWriteTemp
|
|
26177
26807
|
});
|
|
26178
|
-
import { existsSync as
|
|
26808
|
+
import { existsSync as existsSync37, statSync as statSync8, watch as watch2 } from "fs";
|
|
26179
26809
|
import { createRequire as createRequire2 } from "module";
|
|
26180
|
-
import { dirname as dirname26, join as
|
|
26810
|
+
import { dirname as dirname26, join as join42, resolve as resolve46 } from "path";
|
|
26181
26811
|
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
26812
|
if (globalThis.__absoluteEntryWatcherStarted)
|
|
26183
26813
|
return;
|
|
26184
26814
|
const main = Bun.main;
|
|
26185
|
-
if (!main || !
|
|
26815
|
+
if (!main || !existsSync37(main))
|
|
26186
26816
|
return;
|
|
26187
26817
|
globalThis.__absoluteEntryWatcherStarted = true;
|
|
26188
26818
|
const entryPath = resolve46(main);
|
|
@@ -26280,7 +26910,7 @@ var ATOMIC_RECOVERY_WINDOW_MS = 1000, RELOAD_DEBOUNCE_MS = 80, ATOMIC_WRITE_TEMP
|
|
|
26280
26910
|
continue;
|
|
26281
26911
|
let st2;
|
|
26282
26912
|
try {
|
|
26283
|
-
st2 = statSync8(
|
|
26913
|
+
st2 = statSync8(join42(dir, entry.name));
|
|
26284
26914
|
} catch {
|
|
26285
26915
|
continue;
|
|
26286
26916
|
}
|
|
@@ -26835,8 +27465,8 @@ var handleHTMXPageRequest = async (pagePath) => {
|
|
|
26835
27465
|
};
|
|
26836
27466
|
// src/core/prepare.ts
|
|
26837
27467
|
init_loadConfig();
|
|
26838
|
-
import { existsSync as
|
|
26839
|
-
import { basename as basename14, join as
|
|
27468
|
+
import { existsSync as existsSync35, readdirSync as readdirSync4, readFileSync as readFileSync24 } from "fs";
|
|
27469
|
+
import { basename as basename14, join as join40, relative as relative17, resolve as resolve45 } from "path";
|
|
26840
27470
|
import { Elysia as Elysia5 } from "elysia";
|
|
26841
27471
|
|
|
26842
27472
|
// src/core/loadIslandRegistry.ts
|
|
@@ -27235,7 +27865,7 @@ var patchManifestIndexes = (manifest, devIndexDir, SRC_URL_PREFIX2) => {
|
|
|
27235
27865
|
if (!fileName)
|
|
27236
27866
|
continue;
|
|
27237
27867
|
const srcPath = resolve45(devIndexDir, fileName);
|
|
27238
|
-
if (!
|
|
27868
|
+
if (!existsSync35(srcPath))
|
|
27239
27869
|
continue;
|
|
27240
27870
|
const rel = relative17(process.cwd(), srcPath).replace(/\\/g, "/");
|
|
27241
27871
|
manifest[key] = `${SRC_URL_PREFIX2}${rel}`;
|
|
@@ -27334,7 +27964,10 @@ var prepareDev = async (config, buildDir) => {
|
|
|
27334
27964
|
prefix: "",
|
|
27335
27965
|
staticLimit: MAX_STATIC_ROUTE_COUNT
|
|
27336
27966
|
})).use(hmrPlugin).use(createSitemapPlugin(buildDir, config.sitemap, {
|
|
27337
|
-
angularDirectory: config.angularDirectory
|
|
27967
|
+
angularDirectory: config.angularDirectory,
|
|
27968
|
+
reactDirectory: config.reactDirectory,
|
|
27969
|
+
svelteDirectory: config.svelteDirectory,
|
|
27970
|
+
vueDirectory: config.vueDirectory
|
|
27338
27971
|
})).use(createBuildErrorRecoveryPlugin()).use(createNotFoundPlugin());
|
|
27339
27972
|
recordStep("assemble dev runtime", stepStartedAt);
|
|
27340
27973
|
logStartupTimingBlock("AbsoluteJS prepareDev timing", startupSteps);
|
|
@@ -27345,7 +27978,7 @@ var prepareDev = async (config, buildDir) => {
|
|
|
27345
27978
|
};
|
|
27346
27979
|
var loadPrerenderMap = (prerenderDir) => {
|
|
27347
27980
|
const map = new Map;
|
|
27348
|
-
if (!
|
|
27981
|
+
if (!existsSync35(prerenderDir))
|
|
27349
27982
|
return map;
|
|
27350
27983
|
let entries;
|
|
27351
27984
|
try {
|
|
@@ -27358,7 +27991,7 @@ var loadPrerenderMap = (prerenderDir) => {
|
|
|
27358
27991
|
continue;
|
|
27359
27992
|
const name = basename14(entry, ".html");
|
|
27360
27993
|
const route = name === "index" ? "/" : `/${name}`;
|
|
27361
|
-
map.set(route,
|
|
27994
|
+
map.set(route, join40(prerenderDir, entry));
|
|
27362
27995
|
}
|
|
27363
27996
|
return map;
|
|
27364
27997
|
};
|
|
@@ -27424,8 +28057,8 @@ var prepare = async (configOrPath) => {
|
|
|
27424
28057
|
setCurrentPageIslandMetadata(await loadPageIslandMetadata(config));
|
|
27425
28058
|
recordStep("load production manifest and island metadata", stepStartedAt);
|
|
27426
28059
|
stepStartedAt = performance.now();
|
|
27427
|
-
const conventionsPath =
|
|
27428
|
-
if (
|
|
28060
|
+
const conventionsPath = join40(buildDir, "conventions.json");
|
|
28061
|
+
if (existsSync35(conventionsPath)) {
|
|
27429
28062
|
const conventions2 = JSON.parse(readFileSync24(conventionsPath, "utf-8"));
|
|
27430
28063
|
setConventions(conventions2);
|
|
27431
28064
|
}
|
|
@@ -27440,7 +28073,7 @@ var prepare = async (configOrPath) => {
|
|
|
27440
28073
|
});
|
|
27441
28074
|
recordStep("create static plugin", stepStartedAt);
|
|
27442
28075
|
stepStartedAt = performance.now();
|
|
27443
|
-
const prerenderDir =
|
|
28076
|
+
const prerenderDir = join40(buildDir, "_prerendered");
|
|
27444
28077
|
const prerenderMap = loadPrerenderMap(prerenderDir);
|
|
27445
28078
|
recordStep("load prerender map", stepStartedAt);
|
|
27446
28079
|
if (prerenderMap.size > 0) {
|
|
@@ -27472,7 +28105,10 @@ var prepare = async (configOrPath) => {
|
|
|
27472
28105
|
stepStartedAt = performance.now();
|
|
27473
28106
|
const { imageOptimizer: imageOptimizer3 } = await Promise.resolve().then(() => (init_imageOptimizer(), exports_imageOptimizer));
|
|
27474
28107
|
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
|
|
28108
|
+
angularDirectory: config.angularDirectory,
|
|
28109
|
+
reactDirectory: config.reactDirectory,
|
|
28110
|
+
svelteDirectory: config.svelteDirectory,
|
|
28111
|
+
vueDirectory: config.vueDirectory
|
|
27476
28112
|
})).use(createNotFoundPlugin());
|
|
27477
28113
|
recordStep("assemble production runtime", stepStartedAt);
|
|
27478
28114
|
logStartupTimingBlock("AbsoluteJS prepare timing", startupSteps);
|
|
@@ -27481,7 +28117,10 @@ var prepare = async (configOrPath) => {
|
|
|
27481
28117
|
stepStartedAt = performance.now();
|
|
27482
28118
|
const { imageOptimizer: imageOptimizer2 } = await Promise.resolve().then(() => (init_imageOptimizer(), exports_imageOptimizer));
|
|
27483
28119
|
const absolutejs = new Elysia5({ name: "absolutejs-runtime" }).use(imageOptimizer2(config.images, buildDir)).use(staticFiles).use(createSitemapPlugin(buildDir, config.sitemap, {
|
|
27484
|
-
angularDirectory: config.angularDirectory
|
|
28120
|
+
angularDirectory: config.angularDirectory,
|
|
28121
|
+
reactDirectory: config.reactDirectory,
|
|
28122
|
+
svelteDirectory: config.svelteDirectory,
|
|
28123
|
+
vueDirectory: config.vueDirectory
|
|
27485
28124
|
})).use(createNotFoundPlugin());
|
|
27486
28125
|
recordStep("assemble production runtime", stepStartedAt);
|
|
27487
28126
|
logStartupTimingBlock("AbsoluteJS prepare timing", startupSteps);
|
|
@@ -27502,15 +28141,15 @@ import { argv } from "process";
|
|
|
27502
28141
|
var {env: env4 } = globalThis.Bun;
|
|
27503
28142
|
|
|
27504
28143
|
// src/dev/devCert.ts
|
|
27505
|
-
import { existsSync as
|
|
27506
|
-
import { join as
|
|
27507
|
-
var CERT_DIR =
|
|
27508
|
-
var CERT_PATH =
|
|
27509
|
-
var KEY_PATH =
|
|
28144
|
+
import { existsSync as existsSync36, mkdirSync as mkdirSync17, readFileSync as readFileSync25, rmSync as rmSync4 } from "fs";
|
|
28145
|
+
import { join as join41 } from "path";
|
|
28146
|
+
var CERT_DIR = join41(process.cwd(), ".absolutejs");
|
|
28147
|
+
var CERT_PATH = join41(CERT_DIR, "cert.pem");
|
|
28148
|
+
var KEY_PATH = join41(CERT_DIR, "key.pem");
|
|
27510
28149
|
var CERT_VALIDITY_DAYS = 365;
|
|
27511
28150
|
var devLog = (msg) => console.log(`\x1B[2m${new Date().toLocaleTimeString()}\x1B[0m \x1B[36m[dev]\x1B[0m ${msg}`);
|
|
27512
28151
|
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 = () =>
|
|
28152
|
+
var certFilesExist = () => existsSync36(CERT_PATH) && existsSync36(KEY_PATH);
|
|
27514
28153
|
var isCertExpired = () => {
|
|
27515
28154
|
try {
|
|
27516
28155
|
const certPem = readFileSync25(CERT_PATH, "utf-8");
|
|
@@ -27885,7 +28524,7 @@ var generateHeadElement = ({
|
|
|
27885
28524
|
};
|
|
27886
28525
|
// src/utils/defineEnv.ts
|
|
27887
28526
|
var {env: bunEnv } = globalThis.Bun;
|
|
27888
|
-
import { existsSync as
|
|
28527
|
+
import { existsSync as existsSync38, readFileSync as readFileSync26 } from "fs";
|
|
27889
28528
|
import { resolve as resolve47 } from "path";
|
|
27890
28529
|
|
|
27891
28530
|
// node_modules/@sinclair/typebox/build/esm/type/guard/value.mjs
|
|
@@ -33922,7 +34561,7 @@ ${lines.join(`
|
|
|
33922
34561
|
var checkEnvFileSecurity = (properties) => {
|
|
33923
34562
|
const cwd2 = process.cwd();
|
|
33924
34563
|
const envPath = resolve47(cwd2, ".env");
|
|
33925
|
-
if (!
|
|
34564
|
+
if (!existsSync38(envPath))
|
|
33926
34565
|
return;
|
|
33927
34566
|
const sensitiveKeys = Object.keys(properties).filter(isSensitive);
|
|
33928
34567
|
if (sensitiveKeys.length === 0)
|
|
@@ -33932,7 +34571,7 @@ var checkEnvFileSecurity = (properties) => {
|
|
|
33932
34571
|
if (presentKeys.length === 0)
|
|
33933
34572
|
return;
|
|
33934
34573
|
const gitignorePath = resolve47(cwd2, ".gitignore");
|
|
33935
|
-
if (
|
|
34574
|
+
if (existsSync38(gitignorePath)) {
|
|
33936
34575
|
const gitignore = readFileSync26(gitignorePath, "utf-8");
|
|
33937
34576
|
if (gitignore.split(`
|
|
33938
34577
|
`).some((line) => line.trim() === ".env"))
|
|
@@ -34174,5 +34813,5 @@ export {
|
|
|
34174
34813
|
ANGULAR_INIT_TIMEOUT_MS
|
|
34175
34814
|
};
|
|
34176
34815
|
|
|
34177
|
-
//# debugId=
|
|
34816
|
+
//# debugId=59AB0936D112E70F64756E2164756E21
|
|
34178
34817
|
//# sourceMappingURL=index.js.map
|