@angular/build 19.0.0-next.11 → 19.0.0-next.12
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 +4 -4
- package/src/builders/application/execute-build.js +14 -6
- package/src/builders/application/setup-bundling.d.ts +3 -1
- package/src/builders/application/setup-bundling.js +33 -6
- package/src/tools/esbuild/angular/compiler-plugin.d.ts +2 -4
- package/src/tools/esbuild/angular/compiler-plugin.js +1 -5
- package/src/tools/esbuild/application-code-bundle.d.ts +5 -4
- package/src/tools/esbuild/application-code-bundle.js +15 -15
- package/src/tools/esbuild/bundler-execution-result.d.ts +5 -2
- package/src/tools/esbuild/bundler-execution-result.js +5 -1
- package/src/tools/esbuild/compiler-plugin-options.d.ts +1 -4
- package/src/tools/esbuild/compiler-plugin-options.js +14 -40
- package/src/tools/vite/middlewares/assets-middleware.js +1 -1
- package/src/utils/index-file/html-rewriting-stream.d.ts +5 -1
- package/src/utils/normalize-cache.js +1 -1
- package/src/utils/server-rendering/manifest.d.ts +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@angular/build",
|
|
3
|
-
"version": "19.0.0-next.
|
|
3
|
+
"version": "19.0.0-next.12",
|
|
4
4
|
"description": "Official build system for Angular",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Angular CLI",
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"builders": "builders.json",
|
|
24
24
|
"dependencies": {
|
|
25
25
|
"@ampproject/remapping": "2.3.0",
|
|
26
|
-
"@angular-devkit/architect": "0.1900.0-next.
|
|
26
|
+
"@angular-devkit/architect": "0.1900.0-next.12",
|
|
27
27
|
"@babel/core": "7.25.8",
|
|
28
28
|
"@babel/helper-annotate-as-pure": "7.25.7",
|
|
29
29
|
"@babel/helper-split-export-declaration": "7.24.7",
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
"picomatch": "4.0.2",
|
|
44
44
|
"piscina": "4.7.0",
|
|
45
45
|
"rollup": "4.24.0",
|
|
46
|
-
"sass": "1.
|
|
46
|
+
"sass": "1.80.3",
|
|
47
47
|
"semver": "7.6.3",
|
|
48
48
|
"vite": "5.4.9",
|
|
49
49
|
"watchpack": "2.4.2"
|
|
@@ -57,7 +57,7 @@
|
|
|
57
57
|
"@angular/localize": "^19.0.0-next.9",
|
|
58
58
|
"@angular/platform-server": "^19.0.0-next.9",
|
|
59
59
|
"@angular/service-worker": "^19.0.0-next.9",
|
|
60
|
-
"@angular/ssr": "^19.0.0-next.
|
|
60
|
+
"@angular/ssr": "^19.0.0-next.12",
|
|
61
61
|
"less": "^4.2.0",
|
|
62
62
|
"postcss": "^8.4.0",
|
|
63
63
|
"tailwindcss": "^2.0.0 || ^3.0.0",
|
|
@@ -41,17 +41,25 @@ async function executeBuild(options, context, rebuildState) {
|
|
|
41
41
|
await (0, i18n_1.loadActiveTranslations)(context, i18nOptions);
|
|
42
42
|
}
|
|
43
43
|
// Reuse rebuild state or create new bundle contexts for code and global stylesheets
|
|
44
|
-
let bundlerContexts
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
if (
|
|
48
|
-
bundlerContexts =
|
|
44
|
+
let bundlerContexts;
|
|
45
|
+
let componentStyleBundler;
|
|
46
|
+
let codeBundleCache;
|
|
47
|
+
if (rebuildState) {
|
|
48
|
+
bundlerContexts = rebuildState.rebuildContexts;
|
|
49
|
+
componentStyleBundler = rebuildState.componentStyleBundler;
|
|
50
|
+
codeBundleCache = rebuildState.codeBundleCache;
|
|
51
|
+
}
|
|
52
|
+
else {
|
|
53
|
+
const target = (0, utils_1.transformSupportedBrowsersToTargets)(browsers);
|
|
54
|
+
codeBundleCache = new source_file_cache_1.SourceFileCache(cacheOptions.enabled ? cacheOptions.path : undefined);
|
|
55
|
+
componentStyleBundler = (0, setup_bundling_1.createComponentStyleBundler)(options, target);
|
|
56
|
+
bundlerContexts = (0, setup_bundling_1.setupBundlerContexts)(options, target, codeBundleCache, componentStyleBundler);
|
|
49
57
|
}
|
|
50
58
|
let bundlingResult = await bundler_context_1.BundlerContext.bundleAll(bundlerContexts, rebuildState?.fileChanges.all);
|
|
51
59
|
if (options.optimizationOptions.scripts && environment_options_1.shouldOptimizeChunks) {
|
|
52
60
|
bundlingResult = await (0, profiling_1.profileAsync)('OPTIMIZE_CHUNKS', () => (0, chunk_optimizer_1.optimizeChunks)(bundlingResult, options.sourcemapOptions.scripts ? !options.sourcemapOptions.hidden || 'hidden' : false));
|
|
53
61
|
}
|
|
54
|
-
const executionResult = new bundler_execution_result_1.ExecutionResult(bundlerContexts, codeBundleCache);
|
|
62
|
+
const executionResult = new bundler_execution_result_1.ExecutionResult(bundlerContexts, componentStyleBundler, codeBundleCache);
|
|
55
63
|
executionResult.addWarnings(bundlingResult.warnings);
|
|
56
64
|
// Return if the bundling has errors
|
|
57
65
|
if (bundlingResult.errors) {
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
* Use of this source code is governed by an MIT-style license that can be
|
|
6
6
|
* found in the LICENSE file at https://angular.dev/license
|
|
7
7
|
*/
|
|
8
|
+
import { ComponentStylesheetBundler } from '../../tools/esbuild/angular/component-stylesheets';
|
|
8
9
|
import { SourceFileCache } from '../../tools/esbuild/angular/source-file-cache';
|
|
9
10
|
import { BundlerContext } from '../../tools/esbuild/bundler-context';
|
|
10
11
|
import { NormalizedApplicationBuildOptions } from './options';
|
|
@@ -16,4 +17,5 @@ import { NormalizedApplicationBuildOptions } from './options';
|
|
|
16
17
|
* @param codeBundleCache An instance of the TypeScript source file cache.
|
|
17
18
|
* @returns An array of BundlerContext objects.
|
|
18
19
|
*/
|
|
19
|
-
export declare function setupBundlerContexts(options: NormalizedApplicationBuildOptions,
|
|
20
|
+
export declare function setupBundlerContexts(options: NormalizedApplicationBuildOptions, target: string[], codeBundleCache: SourceFileCache, stylesheetBundler: ComponentStylesheetBundler): BundlerContext[];
|
|
21
|
+
export declare function createComponentStyleBundler(options: NormalizedApplicationBuildOptions, target: string[]): ComponentStylesheetBundler;
|
|
@@ -8,6 +8,8 @@
|
|
|
8
8
|
*/
|
|
9
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
10
|
exports.setupBundlerContexts = setupBundlerContexts;
|
|
11
|
+
exports.createComponentStyleBundler = createComponentStyleBundler;
|
|
12
|
+
const component_stylesheets_1 = require("../../tools/esbuild/angular/component-stylesheets");
|
|
11
13
|
const application_code_bundle_1 = require("../../tools/esbuild/application-code-bundle");
|
|
12
14
|
const bundler_context_1 = require("../../tools/esbuild/bundler-context");
|
|
13
15
|
const global_scripts_1 = require("../../tools/esbuild/global-scripts");
|
|
@@ -21,14 +23,13 @@ const utils_1 = require("../../tools/esbuild/utils");
|
|
|
21
23
|
* @param codeBundleCache An instance of the TypeScript source file cache.
|
|
22
24
|
* @returns An array of BundlerContext objects.
|
|
23
25
|
*/
|
|
24
|
-
function setupBundlerContexts(options,
|
|
26
|
+
function setupBundlerContexts(options, target, codeBundleCache, stylesheetBundler) {
|
|
25
27
|
const { outputMode, serverEntryPoint, appShellOptions, prerenderOptions, ssrOptions, workspaceRoot, watch = false, } = options;
|
|
26
|
-
const target = (0, utils_1.transformSupportedBrowsersToTargets)(browsers);
|
|
27
28
|
const bundlerContexts = [];
|
|
28
29
|
// Browser application code
|
|
29
|
-
bundlerContexts.push(new bundler_context_1.BundlerContext(workspaceRoot, watch, (0, application_code_bundle_1.createBrowserCodeBundleOptions)(options, target, codeBundleCache)));
|
|
30
|
+
bundlerContexts.push(new bundler_context_1.BundlerContext(workspaceRoot, watch, (0, application_code_bundle_1.createBrowserCodeBundleOptions)(options, target, codeBundleCache, stylesheetBundler)));
|
|
30
31
|
// Browser polyfills code
|
|
31
|
-
const browserPolyfillBundleOptions = (0, application_code_bundle_1.createBrowserPolyfillBundleOptions)(options, target, codeBundleCache);
|
|
32
|
+
const browserPolyfillBundleOptions = (0, application_code_bundle_1.createBrowserPolyfillBundleOptions)(options, target, codeBundleCache, stylesheetBundler);
|
|
32
33
|
if (browserPolyfillBundleOptions) {
|
|
33
34
|
bundlerContexts.push(new bundler_context_1.BundlerContext(workspaceRoot, watch, browserPolyfillBundleOptions));
|
|
34
35
|
}
|
|
@@ -53,10 +54,10 @@ function setupBundlerContexts(options, browsers, codeBundleCache) {
|
|
|
53
54
|
// Skip server build when none of the features are enabled.
|
|
54
55
|
if (serverEntryPoint && (outputMode || prerenderOptions || appShellOptions || ssrOptions)) {
|
|
55
56
|
const nodeTargets = [...target, ...(0, utils_1.getSupportedNodeTargets)()];
|
|
56
|
-
bundlerContexts.push(new bundler_context_1.BundlerContext(workspaceRoot, watch, (0, application_code_bundle_1.createServerMainCodeBundleOptions)(options, nodeTargets, codeBundleCache)));
|
|
57
|
+
bundlerContexts.push(new bundler_context_1.BundlerContext(workspaceRoot, watch, (0, application_code_bundle_1.createServerMainCodeBundleOptions)(options, nodeTargets, codeBundleCache, stylesheetBundler)));
|
|
57
58
|
if (outputMode && ssrOptions?.entry) {
|
|
58
59
|
// New behavior introduced: 'server.ts' is now bundled separately from 'main.server.ts'.
|
|
59
|
-
bundlerContexts.push(new bundler_context_1.BundlerContext(workspaceRoot, watch, (0, application_code_bundle_1.createSsrEntryCodeBundleOptions)(options, nodeTargets, codeBundleCache)));
|
|
60
|
+
bundlerContexts.push(new bundler_context_1.BundlerContext(workspaceRoot, watch, (0, application_code_bundle_1.createSsrEntryCodeBundleOptions)(options, nodeTargets, codeBundleCache, stylesheetBundler)));
|
|
60
61
|
}
|
|
61
62
|
// Server polyfills code
|
|
62
63
|
const serverPolyfillBundleOptions = (0, application_code_bundle_1.createServerPolyfillBundleOptions)(options, nodeTargets, codeBundleCache);
|
|
@@ -66,3 +67,29 @@ function setupBundlerContexts(options, browsers, codeBundleCache) {
|
|
|
66
67
|
}
|
|
67
68
|
return bundlerContexts;
|
|
68
69
|
}
|
|
70
|
+
function createComponentStyleBundler(options, target) {
|
|
71
|
+
const { workspaceRoot, optimizationOptions, sourcemapOptions, outputNames, externalDependencies, preserveSymlinks, stylePreprocessorOptions, inlineStyleLanguage, cacheOptions, tailwindConfiguration, postcssConfiguration, publicPath, } = options;
|
|
72
|
+
const incremental = !!options.watch;
|
|
73
|
+
return new component_stylesheets_1.ComponentStylesheetBundler({
|
|
74
|
+
workspaceRoot,
|
|
75
|
+
inlineFonts: !!optimizationOptions.fonts.inline,
|
|
76
|
+
optimization: !!optimizationOptions.styles.minify,
|
|
77
|
+
sourcemap:
|
|
78
|
+
// Hidden component stylesheet sourcemaps are inaccessible which is effectively
|
|
79
|
+
// the same as being disabled. Disabling has the advantage of avoiding the overhead
|
|
80
|
+
// of sourcemap processing.
|
|
81
|
+
sourcemapOptions.styles && !sourcemapOptions.hidden ? 'linked' : false,
|
|
82
|
+
outputNames,
|
|
83
|
+
includePaths: stylePreprocessorOptions?.includePaths,
|
|
84
|
+
// string[] | undefined' is not assignable to type '(Version | DeprecationOrId)[] | undefined'.
|
|
85
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
86
|
+
sass: stylePreprocessorOptions?.sass,
|
|
87
|
+
externalDependencies,
|
|
88
|
+
target,
|
|
89
|
+
preserveSymlinks,
|
|
90
|
+
tailwindConfiguration,
|
|
91
|
+
postcssConfiguration,
|
|
92
|
+
cacheOptions,
|
|
93
|
+
publicPath,
|
|
94
|
+
}, inlineStyleLanguage, incremental);
|
|
95
|
+
}
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
*/
|
|
8
8
|
import type { Plugin } from 'esbuild';
|
|
9
9
|
import { LoadResultCache } from '../load-result-cache';
|
|
10
|
-
import {
|
|
10
|
+
import { ComponentStylesheetBundler } from './component-stylesheets';
|
|
11
11
|
import { SourceFileCache } from './source-file-cache';
|
|
12
12
|
export interface CompilerPluginOptions {
|
|
13
13
|
sourcemap: boolean | 'external';
|
|
@@ -24,6 +24,4 @@ export interface CompilerPluginOptions {
|
|
|
24
24
|
externalRuntimeStyles?: boolean;
|
|
25
25
|
instrumentForCoverage?: (request: string) => boolean;
|
|
26
26
|
}
|
|
27
|
-
export declare function createCompilerPlugin(pluginOptions: CompilerPluginOptions,
|
|
28
|
-
inlineStyleLanguage: string;
|
|
29
|
-
}): Plugin;
|
|
27
|
+
export declare function createCompilerPlugin(pluginOptions: CompilerPluginOptions, stylesheetBundler: ComponentStylesheetBundler): Plugin;
|
|
@@ -43,11 +43,10 @@ const javascript_transformer_1 = require("../javascript-transformer");
|
|
|
43
43
|
const load_result_cache_1 = require("../load-result-cache");
|
|
44
44
|
const profiling_1 = require("../profiling");
|
|
45
45
|
const compilation_state_1 = require("./compilation-state");
|
|
46
|
-
const component_stylesheets_1 = require("./component-stylesheets");
|
|
47
46
|
const file_reference_tracker_1 = require("./file-reference-tracker");
|
|
48
47
|
const jit_plugin_callbacks_1 = require("./jit-plugin-callbacks");
|
|
49
48
|
// eslint-disable-next-line max-lines-per-function
|
|
50
|
-
function createCompilerPlugin(pluginOptions,
|
|
49
|
+
function createCompilerPlugin(pluginOptions, stylesheetBundler) {
|
|
51
50
|
return {
|
|
52
51
|
name: 'angular-compiler',
|
|
53
52
|
// eslint-disable-next-line max-lines-per-function
|
|
@@ -101,8 +100,6 @@ function createCompilerPlugin(pluginOptions, styleOptions) {
|
|
|
101
100
|
let shouldTsIgnoreJs = true;
|
|
102
101
|
// Determines if transpilation should be handle by TypeScript or esbuild
|
|
103
102
|
let useTypeScriptTranspilation = true;
|
|
104
|
-
// Track incremental component stylesheet builds
|
|
105
|
-
const stylesheetBundler = new component_stylesheets_1.ComponentStylesheetBundler(styleOptions, styleOptions.inlineStyleLanguage, pluginOptions.incremental);
|
|
106
103
|
let sharedTSCompilationState;
|
|
107
104
|
// To fully invalidate files, track resource referenced files and their referencing source
|
|
108
105
|
const referencedFileTracker = new file_reference_tracker_1.FileReferenceTracker();
|
|
@@ -398,7 +395,6 @@ function createCompilerPlugin(pluginOptions, styleOptions) {
|
|
|
398
395
|
});
|
|
399
396
|
build.onDispose(() => {
|
|
400
397
|
sharedTSCompilationState?.dispose();
|
|
401
|
-
void stylesheetBundler.dispose();
|
|
402
398
|
void compilation.close?.();
|
|
403
399
|
void cacheStore?.close();
|
|
404
400
|
});
|
|
@@ -7,10 +7,11 @@
|
|
|
7
7
|
*/
|
|
8
8
|
import type { BuildOptions } from 'esbuild';
|
|
9
9
|
import type { NormalizedApplicationBuildOptions } from '../../builders/application/options';
|
|
10
|
+
import { ComponentStylesheetBundler } from './angular/component-stylesheets';
|
|
10
11
|
import { SourceFileCache } from './angular/source-file-cache';
|
|
11
12
|
import { BundlerOptionsFactory } from './bundler-context';
|
|
12
|
-
export declare function createBrowserCodeBundleOptions(options: NormalizedApplicationBuildOptions, target: string[], sourceFileCache
|
|
13
|
-
export declare function createBrowserPolyfillBundleOptions(options: NormalizedApplicationBuildOptions, target: string[], sourceFileCache
|
|
13
|
+
export declare function createBrowserCodeBundleOptions(options: NormalizedApplicationBuildOptions, target: string[], sourceFileCache: SourceFileCache, stylesheetBundler: ComponentStylesheetBundler): BuildOptions;
|
|
14
|
+
export declare function createBrowserPolyfillBundleOptions(options: NormalizedApplicationBuildOptions, target: string[], sourceFileCache: SourceFileCache, stylesheetBundler: ComponentStylesheetBundler): BuildOptions | BundlerOptionsFactory | undefined;
|
|
14
15
|
export declare function createServerPolyfillBundleOptions(options: NormalizedApplicationBuildOptions, target: string[], sourceFileCache?: SourceFileCache): BundlerOptionsFactory | undefined;
|
|
15
|
-
export declare function createServerMainCodeBundleOptions(options: NormalizedApplicationBuildOptions, target: string[], sourceFileCache: SourceFileCache): BuildOptions;
|
|
16
|
-
export declare function createSsrEntryCodeBundleOptions(options: NormalizedApplicationBuildOptions, target: string[], sourceFileCache: SourceFileCache): BuildOptions;
|
|
16
|
+
export declare function createServerMainCodeBundleOptions(options: NormalizedApplicationBuildOptions, target: string[], sourceFileCache: SourceFileCache, stylesheetBundler: ComponentStylesheetBundler): BuildOptions;
|
|
17
|
+
export declare function createSsrEntryCodeBundleOptions(options: NormalizedApplicationBuildOptions, target: string[], sourceFileCache: SourceFileCache, stylesheetBundler: ComponentStylesheetBundler): BuildOptions;
|
|
@@ -32,9 +32,9 @@ const sourcemap_ignorelist_plugin_1 = require("./sourcemap-ignorelist-plugin");
|
|
|
32
32
|
const utils_1 = require("./utils");
|
|
33
33
|
const virtual_module_plugin_1 = require("./virtual-module-plugin");
|
|
34
34
|
const wasm_plugin_1 = require("./wasm-plugin");
|
|
35
|
-
function createBrowserCodeBundleOptions(options, target, sourceFileCache) {
|
|
35
|
+
function createBrowserCodeBundleOptions(options, target, sourceFileCache, stylesheetBundler) {
|
|
36
36
|
const { entryPoints, outputNames, polyfills } = options;
|
|
37
|
-
const
|
|
37
|
+
const pluginOptions = (0, compiler_plugin_options_1.createCompilerPluginOptions)(options, sourceFileCache);
|
|
38
38
|
const zoneless = (0, utils_1.isZonelessApp)(polyfills);
|
|
39
39
|
const buildOptions = {
|
|
40
40
|
...getEsBuildCommonOptions(options),
|
|
@@ -55,8 +55,8 @@ function createBrowserCodeBundleOptions(options, target, sourceFileCache) {
|
|
|
55
55
|
(0, compiler_plugin_1.createCompilerPlugin)(
|
|
56
56
|
// JS/TS options
|
|
57
57
|
pluginOptions,
|
|
58
|
-
// Component stylesheet
|
|
59
|
-
|
|
58
|
+
// Component stylesheet bundler
|
|
59
|
+
stylesheetBundler),
|
|
60
60
|
],
|
|
61
61
|
};
|
|
62
62
|
if (options.plugins) {
|
|
@@ -77,7 +77,7 @@ function createBrowserCodeBundleOptions(options, target, sourceFileCache) {
|
|
|
77
77
|
}
|
|
78
78
|
return buildOptions;
|
|
79
79
|
}
|
|
80
|
-
function createBrowserPolyfillBundleOptions(options, target, sourceFileCache) {
|
|
80
|
+
function createBrowserPolyfillBundleOptions(options, target, sourceFileCache, stylesheetBundler) {
|
|
81
81
|
const namespace = 'angular:polyfills';
|
|
82
82
|
const polyfillBundleOptions = getEsBuildCommonPolyfillsOptions(options, namespace, true, sourceFileCache);
|
|
83
83
|
if (!polyfillBundleOptions) {
|
|
@@ -102,12 +102,12 @@ function createBrowserPolyfillBundleOptions(options, target, sourceFileCache) {
|
|
|
102
102
|
// Only add the Angular TypeScript compiler if TypeScript files are provided in the polyfills
|
|
103
103
|
if (hasTypeScriptEntries) {
|
|
104
104
|
buildOptions.plugins ??= [];
|
|
105
|
-
const
|
|
105
|
+
const pluginOptions = (0, compiler_plugin_options_1.createCompilerPluginOptions)(options, sourceFileCache);
|
|
106
106
|
buildOptions.plugins.push((0, compiler_plugin_1.createCompilerPlugin)(
|
|
107
107
|
// JS/TS options
|
|
108
108
|
{ ...pluginOptions, noopTypeScriptCompilation: true },
|
|
109
109
|
// Component stylesheet options are unused for polyfills but required by the plugin
|
|
110
|
-
|
|
110
|
+
stylesheetBundler));
|
|
111
111
|
}
|
|
112
112
|
// Use an options factory to allow fully incremental bundling when no TypeScript files are present.
|
|
113
113
|
// The TypeScript compilation is not currently integrated into the bundler invalidation so
|
|
@@ -163,10 +163,10 @@ function createServerPolyfillBundleOptions(options, target, sourceFileCache) {
|
|
|
163
163
|
buildOptions.plugins.push((0, server_bundle_metadata_plugin_1.createServerBundleMetadata)());
|
|
164
164
|
return () => buildOptions;
|
|
165
165
|
}
|
|
166
|
-
function createServerMainCodeBundleOptions(options, target, sourceFileCache) {
|
|
166
|
+
function createServerMainCodeBundleOptions(options, target, sourceFileCache, stylesheetBundler) {
|
|
167
167
|
const { serverEntryPoint: mainServerEntryPoint, workspaceRoot, outputMode, externalPackages, ssrOptions, polyfills, } = options;
|
|
168
168
|
(0, node_assert_1.default)(mainServerEntryPoint, 'createServerCodeBundleOptions should not be called without a defined serverEntryPoint.');
|
|
169
|
-
const
|
|
169
|
+
const pluginOptions = (0, compiler_plugin_options_1.createCompilerPluginOptions)(options, sourceFileCache);
|
|
170
170
|
const mainServerNamespace = 'angular:main-server';
|
|
171
171
|
const mainServerInjectPolyfillsNamespace = 'angular:main-server-inject-polyfills';
|
|
172
172
|
const mainServerInjectManifestNamespace = 'angular:main-server-inject-manifest';
|
|
@@ -193,8 +193,8 @@ function createServerMainCodeBundleOptions(options, target, sourceFileCache) {
|
|
|
193
193
|
(0, compiler_plugin_1.createCompilerPlugin)(
|
|
194
194
|
// JS/TS options
|
|
195
195
|
{ ...pluginOptions, noopTypeScriptCompilation: true },
|
|
196
|
-
// Component stylesheet
|
|
197
|
-
|
|
196
|
+
// Component stylesheet bundler
|
|
197
|
+
stylesheetBundler),
|
|
198
198
|
],
|
|
199
199
|
};
|
|
200
200
|
buildOptions.plugins ??= [];
|
|
@@ -265,11 +265,11 @@ function createServerMainCodeBundleOptions(options, target, sourceFileCache) {
|
|
|
265
265
|
}
|
|
266
266
|
return buildOptions;
|
|
267
267
|
}
|
|
268
|
-
function createSsrEntryCodeBundleOptions(options, target, sourceFileCache) {
|
|
268
|
+
function createSsrEntryCodeBundleOptions(options, target, sourceFileCache, stylesheetBundler) {
|
|
269
269
|
const { workspaceRoot, ssrOptions, externalPackages } = options;
|
|
270
270
|
const serverEntryPoint = ssrOptions?.entry;
|
|
271
271
|
(0, node_assert_1.default)(serverEntryPoint, 'createSsrEntryCodeBundleOptions should not be called without a defined serverEntryPoint.');
|
|
272
|
-
const
|
|
272
|
+
const pluginOptions = (0, compiler_plugin_options_1.createCompilerPluginOptions)(options, sourceFileCache);
|
|
273
273
|
const ssrEntryNamespace = 'angular:ssr-entry';
|
|
274
274
|
const ssrInjectManifestNamespace = 'angular:ssr-entry-inject-manifest';
|
|
275
275
|
const ssrInjectRequireNamespace = 'angular:ssr-entry-inject-require';
|
|
@@ -291,8 +291,8 @@ function createSsrEntryCodeBundleOptions(options, target, sourceFileCache) {
|
|
|
291
291
|
(0, compiler_plugin_1.createCompilerPlugin)(
|
|
292
292
|
// JS/TS options
|
|
293
293
|
{ ...pluginOptions, noopTypeScriptCompilation: true },
|
|
294
|
-
// Component stylesheet
|
|
295
|
-
|
|
294
|
+
// Component stylesheet bundler
|
|
295
|
+
stylesheetBundler),
|
|
296
296
|
],
|
|
297
297
|
inject,
|
|
298
298
|
};
|
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
*/
|
|
8
8
|
import type { Message, PartialMessage } from 'esbuild';
|
|
9
9
|
import type { ChangedFiles } from '../../tools/esbuild/watcher';
|
|
10
|
+
import type { ComponentStylesheetBundler } from './angular/component-stylesheets';
|
|
10
11
|
import type { SourceFileCache } from './angular/source-file-cache';
|
|
11
12
|
import type { BuildOutputFile, BuildOutputFileType, BundlerContext } from './bundler-context';
|
|
12
13
|
export interface BuildOutputAsset {
|
|
@@ -15,6 +16,7 @@ export interface BuildOutputAsset {
|
|
|
15
16
|
}
|
|
16
17
|
export interface RebuildState {
|
|
17
18
|
rebuildContexts: BundlerContext[];
|
|
19
|
+
componentStyleBundler: ComponentStylesheetBundler;
|
|
18
20
|
codeBundleCache?: SourceFileCache;
|
|
19
21
|
fileChanges: ChangedFiles;
|
|
20
22
|
previousOutputHashes: Map<string, string>;
|
|
@@ -32,6 +34,7 @@ export type PrerenderedRoutesRecord = Record<string, {
|
|
|
32
34
|
*/
|
|
33
35
|
export declare class ExecutionResult {
|
|
34
36
|
private rebuildContexts;
|
|
37
|
+
private componentStyleBundler;
|
|
35
38
|
private codeBundleCache?;
|
|
36
39
|
outputFiles: BuildOutputFile[];
|
|
37
40
|
assetFiles: BuildOutputAsset[];
|
|
@@ -43,7 +46,7 @@ export declare class ExecutionResult {
|
|
|
43
46
|
extraWatchFiles: string[];
|
|
44
47
|
htmlIndexPath?: string;
|
|
45
48
|
htmlBaseHref?: string;
|
|
46
|
-
constructor(rebuildContexts: BundlerContext[], codeBundleCache?: SourceFileCache | undefined);
|
|
49
|
+
constructor(rebuildContexts: BundlerContext[], componentStyleBundler: ComponentStylesheetBundler, codeBundleCache?: SourceFileCache | undefined);
|
|
47
50
|
addOutputFile(path: string, content: string | Uint8Array, type: BuildOutputFileType): void;
|
|
48
51
|
addAssets(assets: BuildOutputAsset[]): void;
|
|
49
52
|
addLog(value: string): void;
|
|
@@ -67,7 +70,7 @@ export declare class ExecutionResult {
|
|
|
67
70
|
success: boolean;
|
|
68
71
|
outputFiles: BuildOutputFile[];
|
|
69
72
|
assetFiles: BuildOutputAsset[];
|
|
70
|
-
errors: (
|
|
73
|
+
errors: (PartialMessage | Message)[];
|
|
71
74
|
externalMetadata: ExternalResultMetadata | undefined;
|
|
72
75
|
};
|
|
73
76
|
get watchFiles(): string[];
|
|
@@ -15,6 +15,7 @@ const utils_1 = require("./utils");
|
|
|
15
15
|
*/
|
|
16
16
|
class ExecutionResult {
|
|
17
17
|
rebuildContexts;
|
|
18
|
+
componentStyleBundler;
|
|
18
19
|
codeBundleCache;
|
|
19
20
|
outputFiles = [];
|
|
20
21
|
assetFiles = [];
|
|
@@ -26,8 +27,9 @@ class ExecutionResult {
|
|
|
26
27
|
extraWatchFiles = [];
|
|
27
28
|
htmlIndexPath;
|
|
28
29
|
htmlBaseHref;
|
|
29
|
-
constructor(rebuildContexts, codeBundleCache) {
|
|
30
|
+
constructor(rebuildContexts, componentStyleBundler, codeBundleCache) {
|
|
30
31
|
this.rebuildContexts = rebuildContexts;
|
|
32
|
+
this.componentStyleBundler = componentStyleBundler;
|
|
31
33
|
this.codeBundleCache = codeBundleCache;
|
|
32
34
|
}
|
|
33
35
|
addOutputFile(path, content, type) {
|
|
@@ -117,6 +119,7 @@ class ExecutionResult {
|
|
|
117
119
|
return {
|
|
118
120
|
rebuildContexts: this.rebuildContexts,
|
|
119
121
|
codeBundleCache: this.codeBundleCache,
|
|
122
|
+
componentStyleBundler: this.componentStyleBundler,
|
|
120
123
|
fileChanges,
|
|
121
124
|
previousOutputHashes: new Map(this.outputFiles.map((file) => [file.path, file.hash])),
|
|
122
125
|
};
|
|
@@ -133,6 +136,7 @@ class ExecutionResult {
|
|
|
133
136
|
}
|
|
134
137
|
async dispose() {
|
|
135
138
|
await Promise.allSettled(this.rebuildContexts.map((context) => context.dispose()));
|
|
139
|
+
await this.componentStyleBundler.dispose();
|
|
136
140
|
}
|
|
137
141
|
}
|
|
138
142
|
exports.ExecutionResult = ExecutionResult;
|
|
@@ -9,8 +9,5 @@ import { NormalizedApplicationBuildOptions } from '../../builders/application/op
|
|
|
9
9
|
import type { createCompilerPlugin } from './angular/compiler-plugin';
|
|
10
10
|
import type { SourceFileCache } from './angular/source-file-cache';
|
|
11
11
|
type CreateCompilerPluginParameters = Parameters<typeof createCompilerPlugin>;
|
|
12
|
-
export declare function createCompilerPluginOptions(options: NormalizedApplicationBuildOptions,
|
|
13
|
-
pluginOptions: CreateCompilerPluginParameters[0];
|
|
14
|
-
styleOptions: CreateCompilerPluginParameters[1];
|
|
15
|
-
};
|
|
12
|
+
export declare function createCompilerPluginOptions(options: NormalizedApplicationBuildOptions, sourceFileCache?: SourceFileCache): CreateCompilerPluginParameters[0];
|
|
16
13
|
export {};
|
|
@@ -8,46 +8,20 @@
|
|
|
8
8
|
*/
|
|
9
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
10
|
exports.createCompilerPluginOptions = createCompilerPluginOptions;
|
|
11
|
-
function createCompilerPluginOptions(options,
|
|
12
|
-
const {
|
|
11
|
+
function createCompilerPluginOptions(options, sourceFileCache) {
|
|
12
|
+
const { sourcemapOptions, tsconfig, fileReplacements, advancedOptimizations, jit, externalRuntimeStyles, instrumentForCoverage, } = options;
|
|
13
|
+
const incremental = !!options.watch;
|
|
13
14
|
return {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
externalRuntimeStyles,
|
|
26
|
-
instrumentForCoverage,
|
|
27
|
-
},
|
|
28
|
-
// Component stylesheet options
|
|
29
|
-
styleOptions: {
|
|
30
|
-
workspaceRoot,
|
|
31
|
-
inlineFonts: !!optimizationOptions.fonts.inline,
|
|
32
|
-
optimization: !!optimizationOptions.styles.minify,
|
|
33
|
-
sourcemap:
|
|
34
|
-
// Hidden component stylesheet sourcemaps are inaccessible which is effectively
|
|
35
|
-
// the same as being disabled. Disabling has the advantage of avoiding the overhead
|
|
36
|
-
// of sourcemap processing.
|
|
37
|
-
sourcemapOptions.styles && !sourcemapOptions.hidden ? 'linked' : false,
|
|
38
|
-
outputNames,
|
|
39
|
-
includePaths: stylePreprocessorOptions?.includePaths,
|
|
40
|
-
// string[] | undefined' is not assignable to type '(Version | DeprecationOrId)[] | undefined'.
|
|
41
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
42
|
-
sass: stylePreprocessorOptions?.sass,
|
|
43
|
-
externalDependencies,
|
|
44
|
-
target,
|
|
45
|
-
inlineStyleLanguage,
|
|
46
|
-
preserveSymlinks,
|
|
47
|
-
tailwindConfiguration,
|
|
48
|
-
postcssConfiguration,
|
|
49
|
-
cacheOptions,
|
|
50
|
-
publicPath,
|
|
51
|
-
},
|
|
15
|
+
sourcemap: !!sourcemapOptions.scripts && (sourcemapOptions.hidden ? 'external' : true),
|
|
16
|
+
thirdPartySourcemaps: sourcemapOptions.vendor,
|
|
17
|
+
tsconfig,
|
|
18
|
+
jit,
|
|
19
|
+
advancedOptimizations,
|
|
20
|
+
fileReplacements,
|
|
21
|
+
sourceFileCache,
|
|
22
|
+
loadResultCache: sourceFileCache?.loadResultCache,
|
|
23
|
+
incremental,
|
|
24
|
+
externalRuntimeStyles,
|
|
25
|
+
instrumentForCoverage,
|
|
52
26
|
};
|
|
53
27
|
}
|
|
@@ -75,7 +75,7 @@ function createAngularAssetsMiddleware(server, assets, outputFiles, usedComponen
|
|
|
75
75
|
// Shim the stylesheet if a component ID is provided
|
|
76
76
|
if (componentId.length > 0) {
|
|
77
77
|
// Validate component ID
|
|
78
|
-
if (/^[_.\-\p{Letter}\d]+-c\d
|
|
78
|
+
if (/^[_.\-\p{Letter}\d]+-c\d+$/u.test(componentId)) {
|
|
79
79
|
(0, load_esm_1.loadEsmModule)('@angular/compiler')
|
|
80
80
|
.then((compilerModule) => {
|
|
81
81
|
const encapsulatedData = compilerModule.encapsulateStyle(new TextDecoder().decode(data), componentId);
|
|
@@ -5,7 +5,11 @@
|
|
|
5
5
|
* Use of this source code is governed by an MIT-style license that can be
|
|
6
6
|
* found in the LICENSE file at https://angular.dev/license
|
|
7
7
|
*/
|
|
8
|
+
import type { RewritingStream } from 'parse5-html-rewriting-stream';
|
|
9
|
+
export type StartTag = Parameters<RewritingStream['emitStartTag']>[0];
|
|
10
|
+
export type EndTag = Parameters<RewritingStream['emitEndTag']>[0];
|
|
11
|
+
export type { RewritingStream };
|
|
8
12
|
export declare function htmlRewritingStream(content: string): Promise<{
|
|
9
|
-
rewriter:
|
|
13
|
+
rewriter: RewritingStream;
|
|
10
14
|
transformedContent: () => Promise<string>;
|
|
11
15
|
}>;
|
|
@@ -10,7 +10,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
10
10
|
exports.normalizeCacheOptions = normalizeCacheOptions;
|
|
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 = '19.0.0-next.
|
|
13
|
+
const VERSION = '19.0.0-next.12';
|
|
14
14
|
function hasCacheMetadata(value) {
|
|
15
15
|
return (!!value &&
|
|
16
16
|
typeof value === 'object' &&
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
*/
|
|
8
8
|
import { NormalizedApplicationBuildOptions } from '../../builders/application/options';
|
|
9
9
|
import type { BuildOutputFile } from '../../tools/esbuild/bundler-context';
|
|
10
|
-
import { PrerenderedRoutesRecord } from '../../tools/esbuild/bundler-execution-result';
|
|
10
|
+
import type { PrerenderedRoutesRecord } from '../../tools/esbuild/bundler-execution-result';
|
|
11
11
|
export declare const SERVER_APP_MANIFEST_FILENAME = "angular-app-manifest.mjs";
|
|
12
12
|
export declare const SERVER_APP_ENGINE_MANIFEST_FILENAME = "angular-app-engine-manifest.mjs";
|
|
13
13
|
/**
|