@angular/build 18.0.0-next.4 → 18.0.0-rc.0
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 -6
- 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-execution-result.d.ts +1 -0
- package/src/tools/esbuild/bundler-execution-result.js +2 -1
- package/src/tools/esbuild/stylesheets/stylesheet-plugin-factory.js +27 -6
- package/src/utils/normalize-cache.js +1 -1
- package/src/utils/version.js +7 -1
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.0",
|
|
4
4
|
"description": "Official build system for Angular",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Angular CLI",
|
|
@@ -23,26 +23,28 @@
|
|
|
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.0",
|
|
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
|
+
"ansi-colors": "4.1.3",
|
|
31
32
|
"browserslist": "^4.23.0",
|
|
32
33
|
"critters": "0.0.22",
|
|
33
34
|
"esbuild": "0.20.2",
|
|
34
35
|
"fast-glob": "3.3.2",
|
|
35
36
|
"https-proxy-agent": "7.0.4",
|
|
36
|
-
"inquirer": "9.2.
|
|
37
|
+
"inquirer": "9.2.20",
|
|
37
38
|
"magic-string": "0.30.10",
|
|
38
39
|
"mrmime": "2.0.0",
|
|
39
40
|
"ora": "5.4.1",
|
|
41
|
+
"picomatch": "4.0.2",
|
|
40
42
|
"piscina": "4.4.0",
|
|
41
43
|
"parse5-html-rewriting-stream": "7.0.0",
|
|
42
44
|
"postcss": "8.4.38",
|
|
43
45
|
"sass": "1.75.0",
|
|
44
46
|
"semver": "7.6.0",
|
|
45
|
-
"undici": "6.
|
|
47
|
+
"undici": "6.15.0",
|
|
46
48
|
"vite": "5.2.10",
|
|
47
49
|
"watchpack": "2.4.1"
|
|
48
50
|
},
|
|
@@ -52,6 +54,7 @@
|
|
|
52
54
|
"@angular/platform-server": "^18.0.0 || ^18.0.0-next.0",
|
|
53
55
|
"@angular/service-worker": "^18.0.0 || ^18.0.0-next.0",
|
|
54
56
|
"less": "^4.2.0",
|
|
57
|
+
"postcss": "^8.4.0",
|
|
55
58
|
"tailwindcss": "^2.0.0 || ^3.0.0",
|
|
56
59
|
"typescript": ">=5.4 <5.5"
|
|
57
60
|
},
|
|
@@ -68,6 +71,9 @@
|
|
|
68
71
|
"less": {
|
|
69
72
|
"optional": true
|
|
70
73
|
},
|
|
74
|
+
"postcss": {
|
|
75
|
+
"optional": true
|
|
76
|
+
},
|
|
71
77
|
"tailwindcss": {
|
|
72
78
|
"optional": true
|
|
73
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");
|
|
@@ -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]);
|
|
@@ -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];
|
|
@@ -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.0';
|
|
14
14
|
function hasCacheMetadata(value) {
|
|
15
15
|
return (!!value &&
|
|
16
16
|
typeof value === 'object' &&
|
package/src/utils/version.js
CHANGED
|
@@ -47,7 +47,13 @@ function assertCompatibleAngularVersion(projectRoot) {
|
|
|
47
47
|
// repository with the generated development @angular/core npm package which is versioned "0.0.0".
|
|
48
48
|
return;
|
|
49
49
|
}
|
|
50
|
-
|
|
50
|
+
let supportedAngularSemver;
|
|
51
|
+
try {
|
|
52
|
+
supportedAngularSemver = projectRequire('@angular/build/package.json')['peerDependencies']['@angular/compiler-cli'];
|
|
53
|
+
}
|
|
54
|
+
catch {
|
|
55
|
+
supportedAngularSemver = projectRequire('@angular-devkit/build-angular/package.json')['peerDependencies']['@angular/compiler-cli'];
|
|
56
|
+
}
|
|
51
57
|
const angularVersion = new semver_1.SemVer(angularPkgJson['version']);
|
|
52
58
|
if (!(0, semver_1.satisfies)(angularVersion, supportedAngularSemver, { includePrerelease: true })) {
|
|
53
59
|
console.error(`This version of CLI is only compatible with Angular versions ${supportedAngularSemver},\n` +
|