avancement planning

This commit is contained in:
2026-05-26 11:58:39 +02:00
parent 619a2b240a
commit 150b97cd2e
4892 changed files with 99214 additions and 429382 deletions
+2 -1
View File
@@ -19,10 +19,11 @@ export declare const SERVER_APP_ENGINE_MANIFEST_FILENAME = "angular-app-engine-m
*
* @param i18nOptions - The internationalization options for the application build. This
* includes settings for inlining locales and determining the output structure.
* @param allowedHosts - A list of hosts that are allowed to access the server-side application.
* @param baseHref - The base HREF for the application. This is used to set the base URL
* for all relative URLs in the application.
*/
export declare function generateAngularServerAppEngineManifest(i18nOptions: NormalizedApplicationBuildOptions['i18nOptions'], baseHref: string | undefined): string;
export declare function generateAngularServerAppEngineManifest(i18nOptions: NormalizedApplicationBuildOptions['i18nOptions'], allowedHosts: string[], baseHref: string | undefined): string;
/**
* Generates the server manifest for the standard Node.js environment.
*
+3 -1
View File
@@ -45,10 +45,11 @@ function escapeUnsafeChars(str) {
*
* @param i18nOptions - The internationalization options for the application build. This
* includes settings for inlining locales and determining the output structure.
* @param allowedHosts - A list of hosts that are allowed to access the server-side application.
* @param baseHref - The base HREF for the application. This is used to set the base URL
* for all relative URLs in the application.
*/
function generateAngularServerAppEngineManifest(i18nOptions, baseHref) {
function generateAngularServerAppEngineManifest(i18nOptions, allowedHosts, baseHref) {
const entryPoints = {};
const supportedLocales = {};
if (i18nOptions.shouldInline && !i18nOptions.flatOutput) {
@@ -71,6 +72,7 @@ function generateAngularServerAppEngineManifest(i18nOptions, baseHref) {
const manifestContent = `
export default {
basePath: '${basePath}',
allowedHosts: ${JSON.stringify(allowedHosts, undefined, 2)},
supportedLocales: ${JSON.stringify(supportedLocales, undefined, 2)},
entryPoints: {
${Object.entries(entryPoints)
+15 -16
View File
@@ -51,7 +51,7 @@ async function prerenderPages(workspaceRoot, baseHref, appShellOptions, prerende
serverBundlesSourceMaps.clear();
const assetsReversed = {};
for (const { source, destination } of assets) {
assetsReversed[addLeadingSlash((0, path_1.toPosixPath)(destination))] = source;
assetsReversed[(0, url_1.addLeadingSlash)((0, path_1.toPosixPath)(destination))] = source;
}
// Get routes to prerender
const { errors: extractionErrors, serializedRouteTree: serializableRouteTreeNode, appShellRoute, } = await getAllRoutes(workspaceRoot, baseHref, outputFilesForWorker, assetsReversed, appShellOptions, prerenderOptions, sourcemap, outputMode).catch((err) => {
@@ -126,17 +126,21 @@ async function renderPages(baseHref, sourcemap, serializableRouteTreeNode, maxTh
hasSsrEntry: !!outputFilesForWorker['server.mjs'],
},
execArgv: workerExecArgv,
env: {
...process.env,
'NG_ALLOWED_HOSTS': 'localhost',
},
});
try {
const renderingPromises = [];
const appShellRouteWithLeadingSlash = appShellRoute && addLeadingSlash(appShellRoute);
const appShellRouteWithLeadingSlash = appShellRoute && (0, url_1.addLeadingSlash)(appShellRoute);
const baseHrefPathnameWithLeadingSlash = new URL(baseHref, 'http://localhost').pathname;
for (const { route, redirectTo } of serializableRouteTreeNode) {
// Remove the base href from the file output path.
const routeWithoutBaseHref = addTrailingSlash(route).startsWith(baseHrefPathnameWithLeadingSlash)
? addLeadingSlash(route.slice(baseHrefPathnameWithLeadingSlash.length))
const routeWithoutBaseHref = (0, url_1.addTrailingSlash)(route).startsWith(baseHrefPathnameWithLeadingSlash)
? (0, url_1.addLeadingSlash)(route.slice(baseHrefPathnameWithLeadingSlash.length))
: route;
const outPath = node_path_1.posix.join(removeLeadingSlash(routeWithoutBaseHref), 'index.html');
const outPath = (0, url_1.stripLeadingSlash)(node_path_1.posix.join(routeWithoutBaseHref, 'index.html'));
if (typeof redirectTo === 'string') {
output[outPath] = { content: (0, utils_2.generateRedirectStaticPage)(redirectTo), appShellRoute: false };
continue;
@@ -172,7 +176,7 @@ async function getAllRoutes(workspaceRoot, baseHref, outputFilesForWorker, asset
const routes = [];
let appShellRoute;
if (appShellOptions) {
appShellRoute = (0, url_1.urlJoin)(baseHref, appShellOptions.route);
appShellRoute = (0, url_1.joinUrlParts)(baseHref, appShellOptions.route);
routes.push({
renderMode: models_1.RouteRenderMode.Prerender,
route: appShellRoute,
@@ -183,7 +187,7 @@ async function getAllRoutes(workspaceRoot, baseHref, outputFilesForWorker, asset
for (const route of routesFromFile) {
routes.push({
renderMode: models_1.RouteRenderMode.Prerender,
route: (0, url_1.urlJoin)(baseHref, route.trim()),
route: (0, url_1.joinUrlParts)(baseHref, route.trim()),
});
}
}
@@ -205,6 +209,10 @@ async function getAllRoutes(workspaceRoot, baseHref, outputFilesForWorker, asset
hasSsrEntry: !!outputFilesForWorker['server.mjs'],
},
execArgv: workerExecArgv,
env: {
...process.env,
'NG_ALLOWED_HOSTS': 'localhost',
},
});
try {
const { serializedRouteTree, appShellRoute, errors } = await renderWorker.run({});
@@ -233,12 +241,3 @@ async function getAllRoutes(workspaceRoot, baseHref, outputFilesForWorker, asset
void renderWorker.destroy();
}
}
function addLeadingSlash(value) {
return value[0] === '/' ? value : '/' + value;
}
function addTrailingSlash(url) {
return url[url.length - 1] === '/' ? url : `${url}/`;
}
function removeLeadingSlash(value) {
return value[0] === '/' ? value.slice(1) : value;
}