@angular/build 18.0.0-next.5 → 18.0.0-rc.1
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/package.json +12 -8
- package/src/builders/application/execute-build.js +4 -0
- package/src/builders/dev-server/options.d.ts +1 -1
- package/src/builders/dev-server/options.js +18 -2
- package/src/builders/dev-server/schema.json +1 -0
- package/src/builders/extract-i18n/schema.d.ts +1 -1
- package/src/builders/extract-i18n/schema.json +1 -2
- package/src/private.d.ts +3 -0
- package/src/private.js +7 -1
- package/src/tools/esbuild/bundler-context.d.ts +1 -0
- package/src/tools/esbuild/bundler-context.js +14 -5
- package/src/tools/esbuild/bundler-execution-result.d.ts +1 -0
- package/src/tools/esbuild/bundler-execution-result.js +2 -1
- package/src/tools/esbuild/index-html-generator.js +12 -1
- package/src/tools/esbuild/stylesheets/stylesheet-plugin-factory.js +27 -6
- package/src/tools/sass/worker.js +3 -3
- package/src/utils/normalize-cache.js +1 -1
- package/src/utils/server-rendering/render-page.js +8 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@angular/build",
|
|
3
|
-
"version": "18.0.0-
|
|
3
|
+
"version": "18.0.0-rc.1",
|
|
4
4
|
"description": "Official build system for Angular",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Angular CLI",
|
|
@@ -23,10 +23,10 @@
|
|
|
23
23
|
"builders": "builders.json",
|
|
24
24
|
"dependencies": {
|
|
25
25
|
"@ampproject/remapping": "2.3.0",
|
|
26
|
-
"@angular-devkit/architect": "0.1800.0-
|
|
27
|
-
"@babel/core": "7.24.
|
|
26
|
+
"@angular-devkit/architect": "0.1800.0-rc.1",
|
|
27
|
+
"@babel/core": "7.24.5",
|
|
28
28
|
"@babel/helper-annotate-as-pure": "7.22.5",
|
|
29
|
-
"@babel/helper-split-export-declaration": "7.
|
|
29
|
+
"@babel/helper-split-export-declaration": "7.24.5",
|
|
30
30
|
"@vitejs/plugin-basic-ssl": "1.1.0",
|
|
31
31
|
"ansi-colors": "4.1.3",
|
|
32
32
|
"browserslist": "^4.23.0",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"esbuild": "0.20.2",
|
|
35
35
|
"fast-glob": "3.3.2",
|
|
36
36
|
"https-proxy-agent": "7.0.4",
|
|
37
|
-
"inquirer": "9.2.
|
|
37
|
+
"inquirer": "9.2.20",
|
|
38
38
|
"magic-string": "0.30.10",
|
|
39
39
|
"mrmime": "2.0.0",
|
|
40
40
|
"ora": "5.4.1",
|
|
@@ -42,10 +42,10 @@
|
|
|
42
42
|
"piscina": "4.4.0",
|
|
43
43
|
"parse5-html-rewriting-stream": "7.0.0",
|
|
44
44
|
"postcss": "8.4.38",
|
|
45
|
-
"sass": "1.
|
|
45
|
+
"sass": "1.76.0",
|
|
46
46
|
"semver": "7.6.0",
|
|
47
|
-
"undici": "6.
|
|
48
|
-
"vite": "5.2.
|
|
47
|
+
"undici": "6.15.0",
|
|
48
|
+
"vite": "5.2.11",
|
|
49
49
|
"watchpack": "2.4.1"
|
|
50
50
|
},
|
|
51
51
|
"peerDependencies": {
|
|
@@ -54,6 +54,7 @@
|
|
|
54
54
|
"@angular/platform-server": "^18.0.0 || ^18.0.0-next.0",
|
|
55
55
|
"@angular/service-worker": "^18.0.0 || ^18.0.0-next.0",
|
|
56
56
|
"less": "^4.2.0",
|
|
57
|
+
"postcss": "^8.4.0",
|
|
57
58
|
"tailwindcss": "^2.0.0 || ^3.0.0",
|
|
58
59
|
"typescript": ">=5.4 <5.5"
|
|
59
60
|
},
|
|
@@ -70,6 +71,9 @@
|
|
|
70
71
|
"less": {
|
|
71
72
|
"optional": true
|
|
72
73
|
},
|
|
74
|
+
"postcss": {
|
|
75
|
+
"optional": true
|
|
76
|
+
},
|
|
73
77
|
"tailwindcss": {
|
|
74
78
|
"optional": true
|
|
75
79
|
}
|
|
@@ -92,6 +92,10 @@ async function executeBuild(options, context, rebuildState) {
|
|
|
92
92
|
if (options.extractLicenses) {
|
|
93
93
|
executionResult.addOutputFile('3rdpartylicenses.txt', await (0, license_extractor_1.extractLicenses)(metafile, workspaceRoot), bundler_context_1.BuildOutputFileType.Root);
|
|
94
94
|
}
|
|
95
|
+
// Watch input index HTML file if configured
|
|
96
|
+
if (options.indexHtmlOptions) {
|
|
97
|
+
executionResult.extraWatchFiles.push(options.indexHtmlOptions.input);
|
|
98
|
+
}
|
|
95
99
|
// Perform i18n translation inlining if enabled
|
|
96
100
|
if (i18nOptions.shouldInline) {
|
|
97
101
|
const result = await (0, i18n_1.inlineI18n)(options, executionResult, initialFiles);
|
|
@@ -39,5 +39,5 @@ export declare function normalizeOptions(context: BuilderContext, projectName: s
|
|
|
39
39
|
ssl: boolean | undefined;
|
|
40
40
|
sslCert: string | undefined;
|
|
41
41
|
sslKey: string | undefined;
|
|
42
|
-
prebundle: import("./schema").PrebundleUnion;
|
|
42
|
+
prebundle: import("./schema").PrebundleUnion | undefined;
|
|
43
43
|
}>;
|
|
@@ -13,6 +13,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
13
13
|
exports.normalizeOptions = void 0;
|
|
14
14
|
const architect_1 = require("@angular-devkit/architect");
|
|
15
15
|
const node_path_1 = __importDefault(require("node:path"));
|
|
16
|
+
const utils_1 = require("../../utils");
|
|
16
17
|
const normalize_cache_1 = require("../../utils/normalize-cache");
|
|
17
18
|
/**
|
|
18
19
|
* Normalize the user provided options by creating full paths for all path based options
|
|
@@ -25,13 +26,28 @@ const normalize_cache_1 = require("../../utils/normalize-cache");
|
|
|
25
26
|
* @returns An object containing normalized options required to perform the build.
|
|
26
27
|
*/
|
|
27
28
|
async function normalizeOptions(context, projectName, options) {
|
|
28
|
-
const workspaceRoot = context
|
|
29
|
+
const { workspaceRoot, logger } = context;
|
|
29
30
|
const projectMetadata = await context.getProjectMetadata(projectName);
|
|
30
31
|
const projectRoot = node_path_1.default.join(workspaceRoot, projectMetadata.root ?? '');
|
|
31
32
|
const cacheOptions = (0, normalize_cache_1.normalizeCacheOptions)(projectMetadata, workspaceRoot);
|
|
32
33
|
// Target specifier defaults to the current project's build target using a development configuration
|
|
33
34
|
const buildTargetSpecifier = options.buildTarget ?? `::development`;
|
|
34
35
|
const buildTarget = (0, architect_1.targetFromTargetString)(buildTargetSpecifier, projectName, 'build');
|
|
36
|
+
// Get the application builder options.
|
|
37
|
+
const browserBuilderName = await context.getBuilderNameForTarget(buildTarget);
|
|
38
|
+
const rawBuildOptions = await context.getTargetOptions(buildTarget);
|
|
39
|
+
const buildOptions = (await context.validateOptions(rawBuildOptions, browserBuilderName));
|
|
40
|
+
const optimization = (0, utils_1.normalizeOptimization)(buildOptions.optimization);
|
|
41
|
+
if (options.prebundle) {
|
|
42
|
+
if (!cacheOptions.enabled) {
|
|
43
|
+
// Warn if the initial options provided by the user enable prebundling but caching is disabled
|
|
44
|
+
logger.warn('Prebundling has been configured but will not be used because caching has been disabled.');
|
|
45
|
+
}
|
|
46
|
+
else if (optimization.scripts) {
|
|
47
|
+
// Warn if the initial options provided by the user enable prebundling but script optimization is enabled.
|
|
48
|
+
logger.warn('Prebundling has been configured but will not be used because scripts optimization is enabled.');
|
|
49
|
+
}
|
|
50
|
+
}
|
|
35
51
|
// Initial options to keep
|
|
36
52
|
const { host, port, poll, open, verbose, watch, liveReload, hmr, headers, proxyConfig, servePath, ssl, sslCert, sslKey, prebundle, } = options;
|
|
37
53
|
// Return all the normalized options
|
|
@@ -55,7 +71,7 @@ async function normalizeOptions(context, projectName, options) {
|
|
|
55
71
|
sslCert,
|
|
56
72
|
sslKey,
|
|
57
73
|
// Prebundling defaults to true but requires caching to function
|
|
58
|
-
prebundle: cacheOptions.enabled &&
|
|
74
|
+
prebundle: cacheOptions.enabled && !optimization.scripts && prebundle,
|
|
59
75
|
};
|
|
60
76
|
}
|
|
61
77
|
exports.normalizeOptions = normalizeOptions;
|
|
@@ -7,7 +7,7 @@ export interface Schema {
|
|
|
7
7
|
* `project:target[:configuration]`. You can also pass in more than one configuration name
|
|
8
8
|
* as a comma-separated list. Example: `project:target:production,staging`.
|
|
9
9
|
*/
|
|
10
|
-
buildTarget
|
|
10
|
+
buildTarget?: string;
|
|
11
11
|
/**
|
|
12
12
|
* Output format for the generated file.
|
|
13
13
|
*/
|
package/src/private.d.ts
CHANGED
|
@@ -19,6 +19,9 @@ export { ExternalResultMetadata } from './tools/esbuild/bundler-execution-result
|
|
|
19
19
|
export { emitFilesToDisk } from './tools/esbuild/utils';
|
|
20
20
|
export { transformSupportedBrowsersToTargets } from './tools/esbuild/utils';
|
|
21
21
|
export { SassWorkerImplementation } from './tools/sass/sass-service';
|
|
22
|
+
export { SourceFileCache } from './tools/esbuild/angular/source-file-cache';
|
|
23
|
+
export { createJitResourceTransformer } from './tools/esbuild/angular/jit-resource-transformer';
|
|
24
|
+
export { JavaScriptTransformer } from './tools/esbuild/javascript-transformer';
|
|
22
25
|
export * from './utils/bundle-calculator';
|
|
23
26
|
export { checkPort } from './utils/check-port';
|
|
24
27
|
export { deleteOutputDir } from './utils/delete-output-dir';
|
package/src/private.js
CHANGED
|
@@ -21,7 +21,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
21
21
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
22
22
|
};
|
|
23
23
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
24
|
-
exports.assertCompatibleAngularVersion = exports.getSupportedBrowsers = exports.generateBuildStatsTable = exports.augmentAppWithServiceWorker = exports.purgeStaleBuildCache = exports.createTranslationLoader = exports.loadProxyConfiguration = exports.InlineCriticalCssProcessor = exports.IndexHtmlGenerator = exports.loadTranslations = exports.createI18nOptions = exports.deleteOutputDir = exports.checkPort = exports.SassWorkerImplementation = exports.transformSupportedBrowsersToTargets = exports.emitFilesToDisk = exports.serveWithVite = exports.buildApplicationInternal = void 0;
|
|
24
|
+
exports.assertCompatibleAngularVersion = exports.getSupportedBrowsers = exports.generateBuildStatsTable = exports.augmentAppWithServiceWorker = exports.purgeStaleBuildCache = exports.createTranslationLoader = exports.loadProxyConfiguration = exports.InlineCriticalCssProcessor = exports.IndexHtmlGenerator = exports.loadTranslations = exports.createI18nOptions = exports.deleteOutputDir = exports.checkPort = exports.JavaScriptTransformer = exports.createJitResourceTransformer = exports.SourceFileCache = exports.SassWorkerImplementation = exports.transformSupportedBrowsersToTargets = exports.emitFilesToDisk = exports.serveWithVite = exports.buildApplicationInternal = void 0;
|
|
25
25
|
/**
|
|
26
26
|
* @fileoverview
|
|
27
27
|
* Private exports intended only for use with the @angular-devkit/build-angular package.
|
|
@@ -41,6 +41,12 @@ var utils_2 = require("./tools/esbuild/utils");
|
|
|
41
41
|
Object.defineProperty(exports, "transformSupportedBrowsersToTargets", { enumerable: true, get: function () { return utils_2.transformSupportedBrowsersToTargets; } });
|
|
42
42
|
var sass_service_1 = require("./tools/sass/sass-service");
|
|
43
43
|
Object.defineProperty(exports, "SassWorkerImplementation", { enumerable: true, get: function () { return sass_service_1.SassWorkerImplementation; } });
|
|
44
|
+
var source_file_cache_1 = require("./tools/esbuild/angular/source-file-cache");
|
|
45
|
+
Object.defineProperty(exports, "SourceFileCache", { enumerable: true, get: function () { return source_file_cache_1.SourceFileCache; } });
|
|
46
|
+
var jit_resource_transformer_1 = require("./tools/esbuild/angular/jit-resource-transformer");
|
|
47
|
+
Object.defineProperty(exports, "createJitResourceTransformer", { enumerable: true, get: function () { return jit_resource_transformer_1.createJitResourceTransformer; } });
|
|
48
|
+
var javascript_transformer_1 = require("./tools/esbuild/javascript-transformer");
|
|
49
|
+
Object.defineProperty(exports, "JavaScriptTransformer", { enumerable: true, get: function () { return javascript_transformer_1.JavaScriptTransformer; } });
|
|
44
50
|
// Utilities
|
|
45
51
|
__exportStar(require("./utils/bundle-calculator"), exports);
|
|
46
52
|
var check_port_1 = require("./utils/check-port");
|
|
@@ -233,6 +233,7 @@ class BundlerContext {
|
|
|
233
233
|
type,
|
|
234
234
|
entrypoint: true,
|
|
235
235
|
serverFile: this.#platformIsServer,
|
|
236
|
+
depth: 0,
|
|
236
237
|
};
|
|
237
238
|
if (!this.initialFilter || this.initialFilter(record)) {
|
|
238
239
|
initialFiles.set(relativeFilePath, record);
|
|
@@ -241,10 +242,17 @@ class BundlerContext {
|
|
|
241
242
|
}
|
|
242
243
|
}
|
|
243
244
|
// Analyze for transitive initial files
|
|
244
|
-
const
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
245
|
+
const entriesToAnalyze = [...initialFiles];
|
|
246
|
+
let currentEntry;
|
|
247
|
+
while ((currentEntry = entriesToAnalyze.pop())) {
|
|
248
|
+
const [entryPath, entryRecord] = currentEntry;
|
|
249
|
+
for (const initialImport of result.metafile.outputs[entryPath].imports) {
|
|
250
|
+
const existingRecord = initialFiles.get(initialImport.path);
|
|
251
|
+
if (existingRecord) {
|
|
252
|
+
// Store the smallest value depth
|
|
253
|
+
if (existingRecord.depth > entryRecord.depth + 1) {
|
|
254
|
+
existingRecord.depth = entryRecord.depth + 1;
|
|
255
|
+
}
|
|
248
256
|
continue;
|
|
249
257
|
}
|
|
250
258
|
if (initialImport.kind === 'import-statement' || initialImport.kind === 'import-rule') {
|
|
@@ -253,12 +261,13 @@ class BundlerContext {
|
|
|
253
261
|
entrypoint: false,
|
|
254
262
|
external: initialImport.external,
|
|
255
263
|
serverFile: this.#platformIsServer,
|
|
264
|
+
depth: entryRecord.depth + 1,
|
|
256
265
|
};
|
|
257
266
|
if (!this.initialFilter || this.initialFilter(record)) {
|
|
258
267
|
initialFiles.set(initialImport.path, record);
|
|
259
268
|
}
|
|
260
269
|
if (!initialImport.external) {
|
|
261
|
-
|
|
270
|
+
entriesToAnalyze.push([initialImport.path, record]);
|
|
262
271
|
}
|
|
263
272
|
}
|
|
264
273
|
}
|
|
@@ -37,6 +37,7 @@ export declare class ExecutionResult {
|
|
|
37
37
|
warnings: (Message | PartialMessage)[];
|
|
38
38
|
logs: string[];
|
|
39
39
|
externalMetadata?: ExternalResultMetadata;
|
|
40
|
+
extraWatchFiles: string[];
|
|
40
41
|
constructor(rebuildContexts: BundlerContext[], codeBundleCache?: SourceFileCache | undefined);
|
|
41
42
|
addOutputFile(path: string, content: string, type: BuildOutputFileType): void;
|
|
42
43
|
addAssets(assets: BuildOutputAsset[]): void;
|
|
@@ -23,6 +23,7 @@ class ExecutionResult {
|
|
|
23
23
|
warnings = [];
|
|
24
24
|
logs = [];
|
|
25
25
|
externalMetadata;
|
|
26
|
+
extraWatchFiles = [];
|
|
26
27
|
constructor(rebuildContexts, codeBundleCache) {
|
|
27
28
|
this.rebuildContexts = rebuildContexts;
|
|
28
29
|
this.codeBundleCache = codeBundleCache;
|
|
@@ -103,7 +104,7 @@ class ExecutionResult {
|
|
|
103
104
|
// Load result caches internally normalize file dependencies
|
|
104
105
|
files.push(...this.codeBundleCache.loadResultCache.watchFiles);
|
|
105
106
|
}
|
|
106
|
-
return files;
|
|
107
|
+
return files.concat(this.extraWatchFiles);
|
|
107
108
|
}
|
|
108
109
|
createRebuildState(fileChanges) {
|
|
109
110
|
this.codeBundleCache?.invalidate([...fileChanges.modified, ...fileChanges.removed]);
|
|
@@ -15,6 +15,11 @@ const node_assert_1 = __importDefault(require("node:assert"));
|
|
|
15
15
|
const node_path_1 = __importDefault(require("node:path"));
|
|
16
16
|
const index_html_generator_1 = require("../../utils/index-file/index-html-generator");
|
|
17
17
|
const bundler_context_1 = require("./bundler-context");
|
|
18
|
+
/**
|
|
19
|
+
* The maximum number of module preload link elements that should be added for
|
|
20
|
+
* initial scripts.
|
|
21
|
+
*/
|
|
22
|
+
const MODULE_PRELOAD_MAX = 3;
|
|
18
23
|
async function generateIndexHtml(initialFiles, outputFiles, buildOptions, lang) {
|
|
19
24
|
// Analyze metafile for initial link-based hints.
|
|
20
25
|
// Skip if the internal externalPackages option is enabled since this option requires
|
|
@@ -23,12 +28,18 @@ async function generateIndexHtml(initialFiles, outputFiles, buildOptions, lang)
|
|
|
23
28
|
const { indexHtmlOptions, externalPackages, optimizationOptions, crossOrigin, subresourceIntegrity, baseHref, } = buildOptions;
|
|
24
29
|
(0, node_assert_1.default)(indexHtmlOptions, 'indexHtmlOptions cannot be undefined.');
|
|
25
30
|
if (!externalPackages && indexHtmlOptions.preloadInitial) {
|
|
31
|
+
let modulePreloadCount = 0;
|
|
26
32
|
for (const [key, value] of initialFiles) {
|
|
27
33
|
if (value.entrypoint || value.serverFile) {
|
|
28
34
|
// Entry points are already referenced in the HTML
|
|
29
35
|
continue;
|
|
30
36
|
}
|
|
31
|
-
|
|
37
|
+
// Only add shallow preloads
|
|
38
|
+
if (value.depth > 1) {
|
|
39
|
+
continue;
|
|
40
|
+
}
|
|
41
|
+
if (value.type === 'script' && modulePreloadCount < MODULE_PRELOAD_MAX) {
|
|
42
|
+
modulePreloadCount++;
|
|
32
43
|
hints.push({ url: key, mode: 'modulepreload' });
|
|
33
44
|
}
|
|
34
45
|
else if (value.type === 'style') {
|
|
@@ -61,7 +61,7 @@ const TAILWIND_KEYWORDS = [
|
|
|
61
61
|
/**
|
|
62
62
|
* Cached postcss instances that can be re-used between various StylesheetPluginFactory instances.
|
|
63
63
|
*/
|
|
64
|
-
const
|
|
64
|
+
const postcssProcessors = new Map();
|
|
65
65
|
class StylesheetPluginFactory {
|
|
66
66
|
options;
|
|
67
67
|
cache;
|
|
@@ -88,7 +88,7 @@ class StylesheetPluginFactory {
|
|
|
88
88
|
}
|
|
89
89
|
if (options.postcssConfiguration) {
|
|
90
90
|
const postCssInstanceKey = JSON.stringify(options.postcssConfiguration);
|
|
91
|
-
this.postcssProcessor =
|
|
91
|
+
this.postcssProcessor = postcssProcessors.get(postCssInstanceKey)?.deref();
|
|
92
92
|
if (!this.postcssProcessor) {
|
|
93
93
|
postcss ??= (await Promise.resolve().then(() => __importStar(require('postcss')))).default;
|
|
94
94
|
this.postcssProcessor = postcss();
|
|
@@ -99,18 +99,18 @@ class StylesheetPluginFactory {
|
|
|
99
99
|
}
|
|
100
100
|
this.postcssProcessor.use(plugin(pluginOptions));
|
|
101
101
|
}
|
|
102
|
-
|
|
102
|
+
postcssProcessors.set(postCssInstanceKey, new WeakRef(this.postcssProcessor));
|
|
103
103
|
}
|
|
104
104
|
}
|
|
105
105
|
else if (options.tailwindConfiguration) {
|
|
106
106
|
const { package: tailwindPackage, file: config } = options.tailwindConfiguration;
|
|
107
107
|
const postCssInstanceKey = tailwindPackage + ':' + config;
|
|
108
|
-
this.postcssProcessor =
|
|
108
|
+
this.postcssProcessor = postcssProcessors.get(postCssInstanceKey)?.deref();
|
|
109
109
|
if (!this.postcssProcessor) {
|
|
110
110
|
postcss ??= (await Promise.resolve().then(() => __importStar(require('postcss')))).default;
|
|
111
111
|
const tailwind = await Promise.resolve(`${tailwindPackage}`).then(s => __importStar(require(s)));
|
|
112
112
|
this.postcssProcessor = postcss().use(tailwind.default({ config }));
|
|
113
|
-
|
|
113
|
+
postcssProcessors.set(postCssInstanceKey, new WeakRef(this.postcssProcessor));
|
|
114
114
|
}
|
|
115
115
|
}
|
|
116
116
|
return this.postcssProcessor;
|
|
@@ -119,7 +119,28 @@ class StylesheetPluginFactory {
|
|
|
119
119
|
name: 'angular-' + language.name,
|
|
120
120
|
async setup(build) {
|
|
121
121
|
// Setup postcss if needed
|
|
122
|
-
|
|
122
|
+
let postcssProcessor;
|
|
123
|
+
build.onStart(async () => {
|
|
124
|
+
try {
|
|
125
|
+
postcssProcessor = await setupPostcss();
|
|
126
|
+
}
|
|
127
|
+
catch {
|
|
128
|
+
return {
|
|
129
|
+
errors: [
|
|
130
|
+
{
|
|
131
|
+
text: 'Unable to load the "postcss" stylesheet processor.',
|
|
132
|
+
location: null,
|
|
133
|
+
notes: [
|
|
134
|
+
{
|
|
135
|
+
text: 'Ensure that the "postcss" Node.js package is installed within the project. ' +
|
|
136
|
+
"If not present, installation via the project's package manager should resolve the error.",
|
|
137
|
+
},
|
|
138
|
+
],
|
|
139
|
+
},
|
|
140
|
+
],
|
|
141
|
+
};
|
|
142
|
+
}
|
|
143
|
+
});
|
|
123
144
|
// Add a load callback to support inline Component styles
|
|
124
145
|
build.onLoad({ filter: language.componentFilter, namespace: 'angular:styles/component' }, (0, load_result_cache_1.createCachedLoad)(cache, (args) => {
|
|
125
146
|
const data = options.inlineComponentData?.[args.path];
|
package/src/tools/sass/worker.js
CHANGED
|
@@ -38,14 +38,14 @@ node_worker_threads_1.parentPort.on('message', (message) => {
|
|
|
38
38
|
// functions combined with the shared memory `importSignal` and the Node.js
|
|
39
39
|
// `receiveMessageOnPort` function are used to ensure synchronous behavior.
|
|
40
40
|
const proxyImporter = {
|
|
41
|
-
findFileUrl: (url,
|
|
41
|
+
findFileUrl: (url, { fromImport, containingUrl }) => {
|
|
42
42
|
Atomics.store(importerSignal, 0, 0);
|
|
43
43
|
workerImporterPort.postMessage({
|
|
44
44
|
id,
|
|
45
45
|
url,
|
|
46
46
|
options: {
|
|
47
|
-
|
|
48
|
-
containingUrl:
|
|
47
|
+
fromImport,
|
|
48
|
+
containingUrl: containingUrl ? (0, node_url_1.fileURLToPath)(containingUrl) : null,
|
|
49
49
|
},
|
|
50
50
|
});
|
|
51
51
|
Atomics.wait(importerSignal, 0, 0);
|
|
@@ -10,7 +10,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
10
10
|
exports.normalizeCacheOptions = void 0;
|
|
11
11
|
const node_path_1 = require("node:path");
|
|
12
12
|
/** Version placeholder is replaced during the build process with actual package version */
|
|
13
|
-
const VERSION = '18.0.0-
|
|
13
|
+
const VERSION = '18.0.0-rc.1';
|
|
14
14
|
function hasCacheMetadata(value) {
|
|
15
15
|
return (!!value &&
|
|
16
16
|
typeof value === 'object' &&
|
|
@@ -68,22 +68,27 @@ async function renderPage({ route, serverContext, document, inlineCriticalCss, o
|
|
|
68
68
|
},
|
|
69
69
|
},
|
|
70
70
|
];
|
|
71
|
-
let html;
|
|
72
71
|
(0, node_assert_1.default)(bootstrapAppFnOrModule, 'The file "./main.server.mjs" does not have a default export for an AppServerModule or a bootstrapping function.');
|
|
72
|
+
let renderAppPromise;
|
|
73
73
|
if (isBootstrapFn(bootstrapAppFnOrModule)) {
|
|
74
|
-
|
|
74
|
+
renderAppPromise = renderApplication(bootstrapAppFnOrModule, {
|
|
75
75
|
document,
|
|
76
76
|
url: route,
|
|
77
77
|
platformProviders,
|
|
78
78
|
});
|
|
79
79
|
}
|
|
80
80
|
else {
|
|
81
|
-
|
|
81
|
+
renderAppPromise = renderModule(bootstrapAppFnOrModule, {
|
|
82
82
|
document,
|
|
83
83
|
url: route,
|
|
84
84
|
extraProviders: platformProviders,
|
|
85
85
|
});
|
|
86
86
|
}
|
|
87
|
+
// The below should really handled by the framework!!!.
|
|
88
|
+
// See: https://github.com/angular/angular/issues/51549
|
|
89
|
+
let timer;
|
|
90
|
+
const renderingTimeout = new Promise((_, reject) => (timer = setTimeout(() => reject(new Error(`Page ${new URL(route, 'resolve://').pathname} did not render in 30 seconds.`)), 30_000)));
|
|
91
|
+
const html = await Promise.race([renderAppPromise, renderingTimeout]).finally(() => clearTimeout(timer));
|
|
87
92
|
if (inlineCriticalCss) {
|
|
88
93
|
const { InlineCriticalCssProcessor } = await Promise.resolve().then(() => __importStar(require('../../utils/index-file/inline-critical-css')));
|
|
89
94
|
const inlineCriticalCssProcessor = new InlineCriticalCssProcessor({
|