@absolutejs/absolute 0.19.0-beta.952 → 0.19.0-beta.954
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/index.js +362 -61
- package/dist/index.js.map +6 -5
- package/dist/src/angular/staticAnalyzeSpaRoutes.d.ts +26 -0
- package/dist/src/utils/generateSitemap.d.ts +7 -2
- package/dist/types/angular.d.ts +9 -0
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
var __require = import.meta.require;
|
|
3
3
|
|
|
4
|
-
// .angular-partial-tmp-
|
|
4
|
+
// .angular-partial-tmp-zygZRD/src/core/streamingSlotRegistrar.ts
|
|
5
5
|
var STREAMING_SLOT_REGISTRAR_KEY = Symbol.for("absolutejs.streamingSlotRegistrar");
|
|
6
6
|
var STREAMING_SLOT_WARNING_STORAGE_KEY = Symbol.for("absolutejs.streamingSlotWarningController");
|
|
7
7
|
var STREAMING_SLOT_COLLECTION_STORAGE_KEY = Symbol.for("absolutejs.streamingSlotCollectionController");
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
var __require = import.meta.require;
|
|
3
3
|
|
|
4
|
-
// .angular-partial-tmp-
|
|
4
|
+
// .angular-partial-tmp-zygZRD/src/core/streamingSlotRegistrar.ts
|
|
5
5
|
var STREAMING_SLOT_REGISTRAR_KEY = Symbol.for("absolutejs.streamingSlotRegistrar");
|
|
6
6
|
var STREAMING_SLOT_WARNING_STORAGE_KEY = Symbol.for("absolutejs.streamingSlotWarningController");
|
|
7
7
|
var STREAMING_SLOT_COLLECTION_STORAGE_KEY = Symbol.for("absolutejs.streamingSlotCollectionController");
|
|
@@ -48,7 +48,7 @@ var warnMissingStreamingSlotCollector = (primitiveName) => {
|
|
|
48
48
|
getWarningController()?.maybeWarn(primitiveName);
|
|
49
49
|
};
|
|
50
50
|
|
|
51
|
-
// .angular-partial-tmp-
|
|
51
|
+
// .angular-partial-tmp-zygZRD/src/core/streamingSlotRegistry.ts
|
|
52
52
|
var STREAMING_SLOT_STORAGE_KEY = Symbol.for("absolutejs.streamingSlotAsyncLocalStorage");
|
|
53
53
|
var isObjectRecord2 = (value) => Boolean(value) && typeof value === "object";
|
|
54
54
|
var isAsyncLocalStorage = (value) => isObjectRecord2(value) && ("getStore" in value) && typeof value.getStore === "function" && ("run" in value) && typeof value.run === "function";
|
package/dist/index.js
CHANGED
|
@@ -25598,6 +25598,231 @@ var init_imageOptimizer = __esm(() => {
|
|
|
25598
25598
|
avifInProgress = new Set;
|
|
25599
25599
|
});
|
|
25600
25600
|
|
|
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
|
+
return null;
|
|
25630
|
+
const name = property.name;
|
|
25631
|
+
if (ts8.isIdentifier(name) || ts8.isStringLiteral(name))
|
|
25632
|
+
return name.text;
|
|
25633
|
+
return null;
|
|
25634
|
+
}, findRoutesArrayDeclaration = (sf, identifierName) => {
|
|
25635
|
+
let found = null;
|
|
25636
|
+
const visit = (node) => {
|
|
25637
|
+
if (found)
|
|
25638
|
+
return;
|
|
25639
|
+
if (ts8.isVariableDeclaration(node) && ts8.isIdentifier(node.name) && node.name.text === identifierName && node.initializer && ts8.isArrayLiteralExpression(node.initializer)) {
|
|
25640
|
+
found = node.initializer;
|
|
25641
|
+
return;
|
|
25642
|
+
}
|
|
25643
|
+
ts8.forEachChild(node, visit);
|
|
25644
|
+
};
|
|
25645
|
+
ts8.forEachChild(sf, visit);
|
|
25646
|
+
return found;
|
|
25647
|
+
}, extractSitemapData = (dataLiteral) => {
|
|
25648
|
+
for (const prop of dataLiteral.properties) {
|
|
25649
|
+
const key = readPropertyKey(prop);
|
|
25650
|
+
if (key !== "sitemap")
|
|
25651
|
+
continue;
|
|
25652
|
+
if (!ts8.isPropertyAssignment(prop))
|
|
25653
|
+
continue;
|
|
25654
|
+
const value = readStringLiteral(prop.initializer);
|
|
25655
|
+
if (value === "exclude")
|
|
25656
|
+
return true;
|
|
25657
|
+
}
|
|
25658
|
+
return false;
|
|
25659
|
+
}, joinSegments = (parent, child) => {
|
|
25660
|
+
if (!child)
|
|
25661
|
+
return parent;
|
|
25662
|
+
if (!parent)
|
|
25663
|
+
return child;
|
|
25664
|
+
return `${parent.replace(/\/+$/, "")}/${child.replace(/^\/+/, "")}`;
|
|
25665
|
+
}, extractRoutePaths = (arr, parentPath, parentExcluded, out) => {
|
|
25666
|
+
for (const element of arr.elements) {
|
|
25667
|
+
if (!ts8.isObjectLiteralExpression(element))
|
|
25668
|
+
continue;
|
|
25669
|
+
let pathSegment = null;
|
|
25670
|
+
let redirected = false;
|
|
25671
|
+
let sitemapExcluded = parentExcluded;
|
|
25672
|
+
let childrenLiteral = null;
|
|
25673
|
+
for (const property of element.properties) {
|
|
25674
|
+
const key = readPropertyKey(property);
|
|
25675
|
+
if (!key)
|
|
25676
|
+
continue;
|
|
25677
|
+
if (!ts8.isPropertyAssignment(property))
|
|
25678
|
+
continue;
|
|
25679
|
+
if (key === "path") {
|
|
25680
|
+
pathSegment = readStringLiteral(property.initializer);
|
|
25681
|
+
} else if (key === "redirectTo") {
|
|
25682
|
+
redirected = true;
|
|
25683
|
+
} else if (key === "data" && ts8.isObjectLiteralExpression(property.initializer)) {
|
|
25684
|
+
if (extractSitemapData(property.initializer))
|
|
25685
|
+
sitemapExcluded = true;
|
|
25686
|
+
} else if (key === "children" && ts8.isArrayLiteralExpression(property.initializer)) {
|
|
25687
|
+
childrenLiteral = property.initializer;
|
|
25688
|
+
}
|
|
25689
|
+
}
|
|
25690
|
+
if (pathSegment === null)
|
|
25691
|
+
continue;
|
|
25692
|
+
const joined = joinSegments(parentPath, pathSegment);
|
|
25693
|
+
if (childrenLiteral) {
|
|
25694
|
+
extractRoutePaths(childrenLiteral, joined, sitemapExcluded, out);
|
|
25695
|
+
continue;
|
|
25696
|
+
}
|
|
25697
|
+
if (redirected)
|
|
25698
|
+
continue;
|
|
25699
|
+
if (joined === "")
|
|
25700
|
+
continue;
|
|
25701
|
+
out.push({
|
|
25702
|
+
dynamic: pathHasDynamic(joined),
|
|
25703
|
+
path: joined,
|
|
25704
|
+
redirected,
|
|
25705
|
+
sitemapExcluded
|
|
25706
|
+
});
|
|
25707
|
+
}
|
|
25708
|
+
}, findProvideRouterFirstArg = (sf) => {
|
|
25709
|
+
let found = null;
|
|
25710
|
+
const visit = (node) => {
|
|
25711
|
+
if (found)
|
|
25712
|
+
return;
|
|
25713
|
+
if (ts8.isCallExpression(node) && ts8.isIdentifier(node.expression) && node.expression.text === "provideRouter") {
|
|
25714
|
+
found = node.arguments[0] ?? null;
|
|
25715
|
+
return;
|
|
25716
|
+
}
|
|
25717
|
+
ts8.forEachChild(node, visit);
|
|
25718
|
+
};
|
|
25719
|
+
ts8.forEachChild(sf, visit);
|
|
25720
|
+
return found;
|
|
25721
|
+
}, findAppBaseHrefValue = (sf) => {
|
|
25722
|
+
let found = null;
|
|
25723
|
+
const visit = (node) => {
|
|
25724
|
+
if (found)
|
|
25725
|
+
return;
|
|
25726
|
+
if (ts8.isObjectLiteralExpression(node)) {
|
|
25727
|
+
let isAppBaseHref = false;
|
|
25728
|
+
let value = null;
|
|
25729
|
+
for (const property of node.properties) {
|
|
25730
|
+
const key = readPropertyKey(property);
|
|
25731
|
+
if (!key)
|
|
25732
|
+
continue;
|
|
25733
|
+
if (!ts8.isPropertyAssignment(property))
|
|
25734
|
+
continue;
|
|
25735
|
+
if (key === "provide" && ts8.isIdentifier(property.initializer) && property.initializer.text === "APP_BASE_HREF") {
|
|
25736
|
+
isAppBaseHref = true;
|
|
25737
|
+
} else if (key === "useValue") {
|
|
25738
|
+
value = readStringLiteral(property.initializer);
|
|
25739
|
+
}
|
|
25740
|
+
}
|
|
25741
|
+
if (isAppBaseHref && value !== null) {
|
|
25742
|
+
found = value;
|
|
25743
|
+
return;
|
|
25744
|
+
}
|
|
25745
|
+
}
|
|
25746
|
+
ts8.forEachChild(node, visit);
|
|
25747
|
+
};
|
|
25748
|
+
ts8.forEachChild(sf, visit);
|
|
25749
|
+
return found;
|
|
25750
|
+
}, analyzeFile = async (filePath) => {
|
|
25751
|
+
let source;
|
|
25752
|
+
try {
|
|
25753
|
+
source = await fs2.readFile(filePath, "utf-8");
|
|
25754
|
+
} catch {
|
|
25755
|
+
return null;
|
|
25756
|
+
}
|
|
25757
|
+
if (!source.includes("APP_BASE_HREF") || !source.includes("provideRouter")) {
|
|
25758
|
+
return null;
|
|
25759
|
+
}
|
|
25760
|
+
const sf = ts8.createSourceFile(filePath, source, ts8.ScriptTarget.Latest, true, ts8.ScriptKind.TS);
|
|
25761
|
+
if (!importsSymbolFrom(sf, "APP_BASE_HREF", "@angular/common"))
|
|
25762
|
+
return null;
|
|
25763
|
+
if (!importsSymbolFrom(sf, "provideRouter", "@angular/router"))
|
|
25764
|
+
return null;
|
|
25765
|
+
const baseHref = findAppBaseHrefValue(sf);
|
|
25766
|
+
if (!baseHref)
|
|
25767
|
+
return null;
|
|
25768
|
+
const firstArg = findProvideRouterFirstArg(sf);
|
|
25769
|
+
if (!firstArg)
|
|
25770
|
+
return null;
|
|
25771
|
+
let routesArray = null;
|
|
25772
|
+
if (ts8.isIdentifier(firstArg)) {
|
|
25773
|
+
routesArray = findRoutesArrayDeclaration(sf, firstArg.text);
|
|
25774
|
+
} else if (ts8.isArrayLiteralExpression(firstArg)) {
|
|
25775
|
+
routesArray = firstArg;
|
|
25776
|
+
}
|
|
25777
|
+
if (!routesArray)
|
|
25778
|
+
return null;
|
|
25779
|
+
const routes = [];
|
|
25780
|
+
extractRoutePaths(routesArray, "", false, routes);
|
|
25781
|
+
return {
|
|
25782
|
+
baseHref,
|
|
25783
|
+
routes,
|
|
25784
|
+
sourceFile: filePath
|
|
25785
|
+
};
|
|
25786
|
+
}, walkTsFiles = async (dir, out) => {
|
|
25787
|
+
let items;
|
|
25788
|
+
try {
|
|
25789
|
+
items = await fs2.readdir(dir, { withFileTypes: true });
|
|
25790
|
+
} catch {
|
|
25791
|
+
return;
|
|
25792
|
+
}
|
|
25793
|
+
for (const item of items) {
|
|
25794
|
+
if (item.name === "node_modules")
|
|
25795
|
+
continue;
|
|
25796
|
+
if (item.name.startsWith("."))
|
|
25797
|
+
continue;
|
|
25798
|
+
const full = join35(dir, item.name);
|
|
25799
|
+
if (item.isDirectory()) {
|
|
25800
|
+
await walkTsFiles(full, out);
|
|
25801
|
+
} else if (item.isFile() && item.name.endsWith(".ts") && !item.name.endsWith(".d.ts")) {
|
|
25802
|
+
out.push(full);
|
|
25803
|
+
}
|
|
25804
|
+
}
|
|
25805
|
+
}, analyzeAngularSpaRoutes = async (angularDirectory) => {
|
|
25806
|
+
if (!existsSync31(angularDirectory))
|
|
25807
|
+
return [];
|
|
25808
|
+
const tsFiles = [];
|
|
25809
|
+
await walkTsFiles(angularDirectory, tsFiles);
|
|
25810
|
+
const pages = [];
|
|
25811
|
+
await Promise.all(tsFiles.map(async (file5) => {
|
|
25812
|
+
try {
|
|
25813
|
+
const page = await analyzeFile(file5);
|
|
25814
|
+
if (page)
|
|
25815
|
+
pages.push(page);
|
|
25816
|
+
} catch (err) {
|
|
25817
|
+
console.warn(`[sitemap] Angular SPA analysis failed for ${file5}:`, err);
|
|
25818
|
+
}
|
|
25819
|
+
}));
|
|
25820
|
+
return pages;
|
|
25821
|
+
};
|
|
25822
|
+
var init_staticAnalyzeSpaRoutes = __esm(() => {
|
|
25823
|
+
DYNAMIC_SEGMENT_PATTERN = /^[:*]/;
|
|
25824
|
+
});
|
|
25825
|
+
|
|
25601
25826
|
// src/utils/generateSitemap.ts
|
|
25602
25827
|
var exports_generateSitemap = {};
|
|
25603
25828
|
__export(exports_generateSitemap, {
|
|
@@ -25612,63 +25837,133 @@ var DEFAULT_PRIORITY = 0.8, escapeXml = (str) => str.replace(/&/g, "&").repl
|
|
|
25612
25837
|
return true;
|
|
25613
25838
|
}
|
|
25614
25839
|
return false;
|
|
25615
|
-
}, discoverPageRoutes = (routes, exclude) => {
|
|
25840
|
+
}, stripTrailingWildcard = (path) => path.replace(/\/\*+$/, ""), isWildcardPagePath = (path) => path.endsWith("/*") || path.endsWith("*"), discoverPageRoutes = (routes, exclude) => {
|
|
25616
25841
|
const seen = new Set;
|
|
25617
|
-
|
|
25842
|
+
const out = [];
|
|
25843
|
+
for (const route of routes) {
|
|
25618
25844
|
if (route.method !== "GET")
|
|
25619
|
-
|
|
25620
|
-
if (route.path.includes("
|
|
25621
|
-
|
|
25622
|
-
|
|
25623
|
-
|
|
25624
|
-
|
|
25625
|
-
return false;
|
|
25845
|
+
continue;
|
|
25846
|
+
if (route.path.includes(":"))
|
|
25847
|
+
continue;
|
|
25848
|
+
const mountPath = stripTrailingWildcard(route.path);
|
|
25849
|
+
if (mountPath.includes("*"))
|
|
25850
|
+
continue;
|
|
25626
25851
|
if (!isPageHandler(route.handler))
|
|
25627
|
-
|
|
25628
|
-
seen.
|
|
25629
|
-
|
|
25630
|
-
|
|
25631
|
-
|
|
25852
|
+
continue;
|
|
25853
|
+
if (seen.has(mountPath))
|
|
25854
|
+
continue;
|
|
25855
|
+
if (isExcluded(mountPath, exclude))
|
|
25856
|
+
continue;
|
|
25857
|
+
seen.add(mountPath);
|
|
25858
|
+
out.push({
|
|
25859
|
+
emitTopLevel: !isWildcardPagePath(route.path),
|
|
25860
|
+
mountPath,
|
|
25861
|
+
rawPath: route.path
|
|
25862
|
+
});
|
|
25863
|
+
}
|
|
25864
|
+
return out;
|
|
25865
|
+
}, joinMountAndSubPath = (mount, sub) => {
|
|
25866
|
+
const trimmedMount = mount.replace(/\/+$/, "");
|
|
25867
|
+
const trimmedSub = sub.replace(/^\/+/, "");
|
|
25868
|
+
if (!trimmedSub)
|
|
25869
|
+
return trimmedMount || "/";
|
|
25870
|
+
if (!trimmedMount)
|
|
25871
|
+
return `/${trimmedSub}`;
|
|
25872
|
+
return `${trimmedMount}/${trimmedSub}`;
|
|
25873
|
+
}, normalizeMountFromBaseHref = (baseHref) => {
|
|
25874
|
+
const stripped = baseHref.replace(/\/+$/, "");
|
|
25875
|
+
return stripped === "" ? "/" : stripped;
|
|
25876
|
+
}, buildSitemapXml = (entries, baseUrl, config) => {
|
|
25632
25877
|
const normalizedBase = baseUrl.replace(/\/$/, "");
|
|
25633
|
-
const
|
|
25634
|
-
for (const
|
|
25635
|
-
const override = config.overrides?.[path];
|
|
25878
|
+
const xml = [];
|
|
25879
|
+
for (const entry of entries) {
|
|
25880
|
+
const override = config.overrides?.[entry.path];
|
|
25636
25881
|
const changefreq = override?.changefreq ?? config.defaultChangefreq ?? "weekly";
|
|
25637
25882
|
const priority = override?.priority ?? config.defaultPriority ?? DEFAULT_PRIORITY;
|
|
25638
25883
|
const lastmod = override?.lastmod;
|
|
25639
|
-
const url = escapeXml(`${normalizedBase}${path}`);
|
|
25640
|
-
let
|
|
25884
|
+
const url = escapeXml(`${normalizedBase}${entry.path}`);
|
|
25885
|
+
let block = ` <url>
|
|
25641
25886
|
<loc>${url}</loc>`;
|
|
25642
25887
|
if (lastmod)
|
|
25643
|
-
|
|
25888
|
+
block += `
|
|
25644
25889
|
<lastmod>${lastmod}</lastmod>`;
|
|
25645
|
-
|
|
25890
|
+
block += `
|
|
25646
25891
|
<changefreq>${changefreq}</changefreq>`;
|
|
25647
|
-
|
|
25892
|
+
block += `
|
|
25648
25893
|
<priority>${priority}</priority>`;
|
|
25649
|
-
|
|
25894
|
+
block += `
|
|
25650
25895
|
</url>`;
|
|
25651
|
-
|
|
25896
|
+
xml.push(block);
|
|
25652
25897
|
}
|
|
25653
25898
|
return [
|
|
25654
25899
|
'<?xml version="1.0" encoding="UTF-8"?>',
|
|
25655
25900
|
'<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">',
|
|
25656
|
-
...
|
|
25901
|
+
...xml,
|
|
25657
25902
|
"</urlset>"
|
|
25658
25903
|
].join(`
|
|
25659
25904
|
`);
|
|
25660
|
-
},
|
|
25905
|
+
}, collectAngularSpaEntries = async (pages, discovered, exclude, seenPaths) => {
|
|
25906
|
+
const wildcardMounts = new Set(discovered.filter((page) => !page.emitTopLevel).map((page) => page.mountPath));
|
|
25907
|
+
const out = [];
|
|
25908
|
+
for (const page of pages) {
|
|
25909
|
+
const mount = normalizeMountFromBaseHref(page.baseHref);
|
|
25910
|
+
if (!wildcardMounts.has(mount))
|
|
25911
|
+
continue;
|
|
25912
|
+
for (const route of page.routes) {
|
|
25913
|
+
if (route.dynamic)
|
|
25914
|
+
continue;
|
|
25915
|
+
if (route.redirected)
|
|
25916
|
+
continue;
|
|
25917
|
+
if (route.sitemapExcluded)
|
|
25918
|
+
continue;
|
|
25919
|
+
const fullPath = joinMountAndSubPath(mount, route.path);
|
|
25920
|
+
if (seenPaths.has(fullPath))
|
|
25921
|
+
continue;
|
|
25922
|
+
if (isExcluded(fullPath, exclude))
|
|
25923
|
+
continue;
|
|
25924
|
+
seenPaths.add(fullPath);
|
|
25925
|
+
out.push({ path: fullPath });
|
|
25926
|
+
}
|
|
25927
|
+
}
|
|
25928
|
+
return out;
|
|
25929
|
+
}, generateSitemap = async (routes, serverUrl, outDir, config = {}, pipelineConfig = {}) => {
|
|
25661
25930
|
const exclude = config.exclude ?? [];
|
|
25662
|
-
const
|
|
25931
|
+
const discoveredPages = discoverPageRoutes(routes, exclude);
|
|
25932
|
+
const seenPaths = new Set;
|
|
25933
|
+
const entries = [];
|
|
25934
|
+
for (const page of discoveredPages) {
|
|
25935
|
+
if (!page.emitTopLevel)
|
|
25936
|
+
continue;
|
|
25937
|
+
if (seenPaths.has(page.mountPath))
|
|
25938
|
+
continue;
|
|
25939
|
+
seenPaths.add(page.mountPath);
|
|
25940
|
+
entries.push({ path: page.mountPath });
|
|
25941
|
+
}
|
|
25942
|
+
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
|
+
}
|
|
25950
|
+
}
|
|
25663
25951
|
const dynamicRoutes = config.routes ? await config.routes() : [];
|
|
25664
|
-
const
|
|
25665
|
-
|
|
25952
|
+
for (const path of dynamicRoutes) {
|
|
25953
|
+
if (seenPaths.has(path))
|
|
25954
|
+
continue;
|
|
25955
|
+
if (isExcluded(path, exclude))
|
|
25956
|
+
continue;
|
|
25957
|
+
seenPaths.add(path);
|
|
25958
|
+
entries.push({ path });
|
|
25959
|
+
}
|
|
25666
25960
|
const baseUrl = config.baseUrl ?? serverUrl;
|
|
25667
|
-
const xml = buildSitemapXml(
|
|
25961
|
+
const xml = buildSitemapXml(entries, baseUrl, config);
|
|
25668
25962
|
await write4(`${outDir}/sitemap.xml`, xml);
|
|
25669
25963
|
};
|
|
25670
25964
|
var init_generateSitemap = __esm(() => {
|
|
25671
25965
|
init_devRouteRegistrationCallsite();
|
|
25966
|
+
init_staticAnalyzeSpaRoutes();
|
|
25672
25967
|
});
|
|
25673
25968
|
|
|
25674
25969
|
// src/core/prerender.ts
|
|
@@ -25682,7 +25977,7 @@ __export(exports_prerender, {
|
|
|
25682
25977
|
PRERENDER_BYPASS_HEADER: () => PRERENDER_BYPASS_HEADER
|
|
25683
25978
|
});
|
|
25684
25979
|
import { mkdirSync as mkdirSync16, readFileSync as readFileSync23 } from "fs";
|
|
25685
|
-
import { join as
|
|
25980
|
+
import { join as join36 } from "path";
|
|
25686
25981
|
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) => {
|
|
25687
25982
|
const metaPath = htmlPath.replace(/\.html$/, ".meta");
|
|
25688
25983
|
await Bun.write(metaPath, String(Date.now()));
|
|
@@ -25748,7 +26043,7 @@ var SERVER_OUTPUT_LIMIT = 4000, STARTUP_POLL_INTERVAL_MS = 100, DEFAULT_STARTUP_
|
|
|
25748
26043
|
return false;
|
|
25749
26044
|
const html = await res.text();
|
|
25750
26045
|
const fileName = routeToFilename(route);
|
|
25751
|
-
const filePath =
|
|
26046
|
+
const filePath = join36(prerenderDir, fileName);
|
|
25752
26047
|
await Bun.write(filePath, html);
|
|
25753
26048
|
await writeTimestamp(filePath);
|
|
25754
26049
|
return true;
|
|
@@ -25774,13 +26069,13 @@ var SERVER_OUTPUT_LIMIT = 4000, STARTUP_POLL_INTERVAL_MS = 100, DEFAULT_STARTUP_
|
|
|
25774
26069
|
}
|
|
25775
26070
|
const html = await res.text();
|
|
25776
26071
|
const fileName = routeToFilename(route);
|
|
25777
|
-
const filePath =
|
|
26072
|
+
const filePath = join36(prerenderDir, fileName);
|
|
25778
26073
|
await Bun.write(filePath, html);
|
|
25779
26074
|
await writeTimestamp(filePath);
|
|
25780
26075
|
result.routes.set(route, filePath);
|
|
25781
26076
|
log2?.(` Pre-rendered ${route} \u2192 ${fileName} (${html.length} bytes)`);
|
|
25782
26077
|
}, prerender = async (port, outDir, staticConfig, log2) => {
|
|
25783
|
-
const prerenderDir =
|
|
26078
|
+
const prerenderDir = join36(outDir, "_prerendered");
|
|
25784
26079
|
mkdirSync16(prerenderDir, { recursive: true });
|
|
25785
26080
|
const baseUrl = `http://localhost:${port}`;
|
|
25786
26081
|
let routes;
|
|
@@ -25880,14 +26175,14 @@ __export(exports_serverEntryWatcher, {
|
|
|
25880
26175
|
startServerEntryWatcher: () => startServerEntryWatcher,
|
|
25881
26176
|
isAtomicWriteTemp: () => isAtomicWriteTemp
|
|
25882
26177
|
});
|
|
25883
|
-
import { existsSync as
|
|
26178
|
+
import { existsSync as existsSync34, statSync as statSync8, watch as watch2 } from "fs";
|
|
25884
26179
|
import { createRequire as createRequire2 } from "module";
|
|
25885
|
-
import { dirname as dirname26, join as
|
|
26180
|
+
import { dirname as dirname26, join as join39, resolve as resolve46 } from "path";
|
|
25886
26181
|
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 = () => {
|
|
25887
26182
|
if (globalThis.__absoluteEntryWatcherStarted)
|
|
25888
26183
|
return;
|
|
25889
26184
|
const main = Bun.main;
|
|
25890
|
-
if (!main || !
|
|
26185
|
+
if (!main || !existsSync34(main))
|
|
25891
26186
|
return;
|
|
25892
26187
|
globalThis.__absoluteEntryWatcherStarted = true;
|
|
25893
26188
|
const entryPath = resolve46(main);
|
|
@@ -25985,7 +26280,7 @@ var ATOMIC_RECOVERY_WINDOW_MS = 1000, RELOAD_DEBOUNCE_MS = 80, ATOMIC_WRITE_TEMP
|
|
|
25985
26280
|
continue;
|
|
25986
26281
|
let st2;
|
|
25987
26282
|
try {
|
|
25988
|
-
st2 = statSync8(
|
|
26283
|
+
st2 = statSync8(join39(dir, entry.name));
|
|
25989
26284
|
} catch {
|
|
25990
26285
|
continue;
|
|
25991
26286
|
}
|
|
@@ -26540,8 +26835,8 @@ var handleHTMXPageRequest = async (pagePath) => {
|
|
|
26540
26835
|
};
|
|
26541
26836
|
// src/core/prepare.ts
|
|
26542
26837
|
init_loadConfig();
|
|
26543
|
-
import { existsSync as
|
|
26544
|
-
import { basename as basename14, join as
|
|
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";
|
|
26545
26840
|
import { Elysia as Elysia5 } from "elysia";
|
|
26546
26841
|
|
|
26547
26842
|
// src/core/loadIslandRegistry.ts
|
|
@@ -26940,7 +27235,7 @@ var patchManifestIndexes = (manifest, devIndexDir, SRC_URL_PREFIX2) => {
|
|
|
26940
27235
|
if (!fileName)
|
|
26941
27236
|
continue;
|
|
26942
27237
|
const srcPath = resolve45(devIndexDir, fileName);
|
|
26943
|
-
if (!
|
|
27238
|
+
if (!existsSync32(srcPath))
|
|
26944
27239
|
continue;
|
|
26945
27240
|
const rel = relative17(process.cwd(), srcPath).replace(/\\/g, "/");
|
|
26946
27241
|
manifest[key] = `${SRC_URL_PREFIX2}${rel}`;
|
|
@@ -27038,7 +27333,9 @@ var prepareDev = async (config, buildDir) => {
|
|
|
27038
27333
|
maxAge: null,
|
|
27039
27334
|
prefix: "",
|
|
27040
27335
|
staticLimit: MAX_STATIC_ROUTE_COUNT
|
|
27041
|
-
})).use(hmrPlugin).use(createSitemapPlugin(buildDir, config.sitemap
|
|
27336
|
+
})).use(hmrPlugin).use(createSitemapPlugin(buildDir, config.sitemap, {
|
|
27337
|
+
angularDirectory: config.angularDirectory
|
|
27338
|
+
})).use(createBuildErrorRecoveryPlugin()).use(createNotFoundPlugin());
|
|
27042
27339
|
recordStep("assemble dev runtime", stepStartedAt);
|
|
27043
27340
|
logStartupTimingBlock("AbsoluteJS prepareDev timing", startupSteps);
|
|
27044
27341
|
return {
|
|
@@ -27048,7 +27345,7 @@ var prepareDev = async (config, buildDir) => {
|
|
|
27048
27345
|
};
|
|
27049
27346
|
var loadPrerenderMap = (prerenderDir) => {
|
|
27050
27347
|
const map = new Map;
|
|
27051
|
-
if (!
|
|
27348
|
+
if (!existsSync32(prerenderDir))
|
|
27052
27349
|
return map;
|
|
27053
27350
|
let entries;
|
|
27054
27351
|
try {
|
|
@@ -27061,15 +27358,15 @@ var loadPrerenderMap = (prerenderDir) => {
|
|
|
27061
27358
|
continue;
|
|
27062
27359
|
const name = basename14(entry, ".html");
|
|
27063
27360
|
const route = name === "index" ? "/" : `/${name}`;
|
|
27064
|
-
map.set(route,
|
|
27361
|
+
map.set(route, join37(prerenderDir, entry));
|
|
27065
27362
|
}
|
|
27066
27363
|
return map;
|
|
27067
27364
|
};
|
|
27068
|
-
var createSitemapPlugin = (buildDir, sitemapConfig) => new Elysia5({ name: "absolutejs-sitemap" }).onStart((started) => {
|
|
27365
|
+
var createSitemapPlugin = (buildDir, sitemapConfig, pipelineConfig) => new Elysia5({ name: "absolutejs-sitemap" }).onStart((started) => {
|
|
27069
27366
|
const { server } = started;
|
|
27070
27367
|
if (!server)
|
|
27071
27368
|
return;
|
|
27072
|
-
Promise.resolve().then(() => (init_generateSitemap(), exports_generateSitemap)).then(({ generateSitemap: generateSitemap2 }) => generateSitemap2(started.routes, server.url.origin, buildDir, sitemapConfig)).catch((err) => console.error("[sitemap] Generation failed:", err));
|
|
27369
|
+
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));
|
|
27073
27370
|
});
|
|
27074
27371
|
var createNotFoundPlugin = () => new Elysia5({ name: "absolutejs-not-found" }).onError({ as: "global" }, async ({ code }) => {
|
|
27075
27372
|
if (code !== "NOT_FOUND")
|
|
@@ -27127,8 +27424,8 @@ var prepare = async (configOrPath) => {
|
|
|
27127
27424
|
setCurrentPageIslandMetadata(await loadPageIslandMetadata(config));
|
|
27128
27425
|
recordStep("load production manifest and island metadata", stepStartedAt);
|
|
27129
27426
|
stepStartedAt = performance.now();
|
|
27130
|
-
const conventionsPath =
|
|
27131
|
-
if (
|
|
27427
|
+
const conventionsPath = join37(buildDir, "conventions.json");
|
|
27428
|
+
if (existsSync32(conventionsPath)) {
|
|
27132
27429
|
const conventions2 = JSON.parse(readFileSync24(conventionsPath, "utf-8"));
|
|
27133
27430
|
setConventions(conventions2);
|
|
27134
27431
|
}
|
|
@@ -27143,7 +27440,7 @@ var prepare = async (configOrPath) => {
|
|
|
27143
27440
|
});
|
|
27144
27441
|
recordStep("create static plugin", stepStartedAt);
|
|
27145
27442
|
stepStartedAt = performance.now();
|
|
27146
|
-
const prerenderDir =
|
|
27443
|
+
const prerenderDir = join37(buildDir, "_prerendered");
|
|
27147
27444
|
const prerenderMap = loadPrerenderMap(prerenderDir);
|
|
27148
27445
|
recordStep("load prerender map", stepStartedAt);
|
|
27149
27446
|
if (prerenderMap.size > 0) {
|
|
@@ -27174,14 +27471,18 @@ var prepare = async (configOrPath) => {
|
|
|
27174
27471
|
});
|
|
27175
27472
|
stepStartedAt = performance.now();
|
|
27176
27473
|
const { imageOptimizer: imageOptimizer3 } = await Promise.resolve().then(() => (init_imageOptimizer(), exports_imageOptimizer));
|
|
27177
|
-
const absolutejs2 = new Elysia5({ name: "absolutejs-runtime" }).use(imageOptimizer3(config.images, buildDir)).use(prerenderPlugin).use(staticFiles).use(createSitemapPlugin(buildDir, config.sitemap
|
|
27474
|
+
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
|
|
27476
|
+
})).use(createNotFoundPlugin());
|
|
27178
27477
|
recordStep("assemble production runtime", stepStartedAt);
|
|
27179
27478
|
logStartupTimingBlock("AbsoluteJS prepare timing", startupSteps);
|
|
27180
27479
|
return { absolutejs: absolutejs2, manifest };
|
|
27181
27480
|
}
|
|
27182
27481
|
stepStartedAt = performance.now();
|
|
27183
27482
|
const { imageOptimizer: imageOptimizer2 } = await Promise.resolve().then(() => (init_imageOptimizer(), exports_imageOptimizer));
|
|
27184
|
-
const absolutejs = new Elysia5({ name: "absolutejs-runtime" }).use(imageOptimizer2(config.images, buildDir)).use(staticFiles).use(createSitemapPlugin(buildDir, config.sitemap
|
|
27483
|
+
const absolutejs = new Elysia5({ name: "absolutejs-runtime" }).use(imageOptimizer2(config.images, buildDir)).use(staticFiles).use(createSitemapPlugin(buildDir, config.sitemap, {
|
|
27484
|
+
angularDirectory: config.angularDirectory
|
|
27485
|
+
})).use(createNotFoundPlugin());
|
|
27185
27486
|
recordStep("assemble production runtime", stepStartedAt);
|
|
27186
27487
|
logStartupTimingBlock("AbsoluteJS prepare timing", startupSteps);
|
|
27187
27488
|
return { absolutejs, manifest };
|
|
@@ -27201,15 +27502,15 @@ import { argv } from "process";
|
|
|
27201
27502
|
var {env: env4 } = globalThis.Bun;
|
|
27202
27503
|
|
|
27203
27504
|
// src/dev/devCert.ts
|
|
27204
|
-
import { existsSync as
|
|
27205
|
-
import { join as
|
|
27206
|
-
var CERT_DIR =
|
|
27207
|
-
var CERT_PATH =
|
|
27208
|
-
var KEY_PATH =
|
|
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");
|
|
27209
27510
|
var CERT_VALIDITY_DAYS = 365;
|
|
27210
27511
|
var devLog = (msg) => console.log(`\x1B[2m${new Date().toLocaleTimeString()}\x1B[0m \x1B[36m[dev]\x1B[0m ${msg}`);
|
|
27211
27512
|
var devWarn = (msg) => console.log(`\x1B[2m${new Date().toLocaleTimeString()}\x1B[0m \x1B[33m[dev]\x1B[0m \x1B[33m${msg}\x1B[0m`);
|
|
27212
|
-
var certFilesExist = () =>
|
|
27513
|
+
var certFilesExist = () => existsSync33(CERT_PATH) && existsSync33(KEY_PATH);
|
|
27213
27514
|
var isCertExpired = () => {
|
|
27214
27515
|
try {
|
|
27215
27516
|
const certPem = readFileSync25(CERT_PATH, "utf-8");
|
|
@@ -27584,7 +27885,7 @@ var generateHeadElement = ({
|
|
|
27584
27885
|
};
|
|
27585
27886
|
// src/utils/defineEnv.ts
|
|
27586
27887
|
var {env: bunEnv } = globalThis.Bun;
|
|
27587
|
-
import { existsSync as
|
|
27888
|
+
import { existsSync as existsSync35, readFileSync as readFileSync26 } from "fs";
|
|
27588
27889
|
import { resolve as resolve47 } from "path";
|
|
27589
27890
|
|
|
27590
27891
|
// node_modules/@sinclair/typebox/build/esm/type/guard/value.mjs
|
|
@@ -33621,7 +33922,7 @@ ${lines.join(`
|
|
|
33621
33922
|
var checkEnvFileSecurity = (properties) => {
|
|
33622
33923
|
const cwd2 = process.cwd();
|
|
33623
33924
|
const envPath = resolve47(cwd2, ".env");
|
|
33624
|
-
if (!
|
|
33925
|
+
if (!existsSync35(envPath))
|
|
33625
33926
|
return;
|
|
33626
33927
|
const sensitiveKeys = Object.keys(properties).filter(isSensitive);
|
|
33627
33928
|
if (sensitiveKeys.length === 0)
|
|
@@ -33631,7 +33932,7 @@ var checkEnvFileSecurity = (properties) => {
|
|
|
33631
33932
|
if (presentKeys.length === 0)
|
|
33632
33933
|
return;
|
|
33633
33934
|
const gitignorePath = resolve47(cwd2, ".gitignore");
|
|
33634
|
-
if (
|
|
33935
|
+
if (existsSync35(gitignorePath)) {
|
|
33635
33936
|
const gitignore = readFileSync26(gitignorePath, "utf-8");
|
|
33636
33937
|
if (gitignore.split(`
|
|
33637
33938
|
`).some((line) => line.trim() === ".env"))
|
|
@@ -33873,5 +34174,5 @@ export {
|
|
|
33873
34174
|
ANGULAR_INIT_TIMEOUT_MS
|
|
33874
34175
|
};
|
|
33875
34176
|
|
|
33876
|
-
//# debugId=
|
|
34177
|
+
//# debugId=CBA359F82BDAEEE464756E2164756E21
|
|
33877
34178
|
//# sourceMappingURL=index.js.map
|