@angular/build 22.2.2 → 22.3.0-next.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/builders.json +5 -0
- package/package.json +19 -18
- package/src/builders/application/chunk-optimizer.js +2 -1
- package/src/builders/application/chunk-optimizer.js.map +1 -1
- package/src/builders/application/options.js +1 -2
- package/src/builders/application/options.js.map +1 -1
- package/src/builders/dev-server/options.js +1 -1
- package/src/builders/dev-server/options.js.map +1 -1
- package/src/builders/dev-server/vite/server.js +1 -1
- package/src/builders/dev-server/vite/server.js.map +1 -1
- package/src/builders/library/builder.d.ts +19 -0
- package/src/builders/library/builder.js +285 -0
- package/src/builders/library/builder.js.map +1 -0
- package/src/builders/library/index.d.ts +13 -0
- package/src/builders/library/index.js +17 -0
- package/src/builders/library/index.js.map +1 -0
- package/src/builders/library/options.d.ts +11 -0
- package/src/builders/library/options.js +107 -0
- package/src/builders/library/options.js.map +1 -0
- package/src/builders/library/pipeline/assets.d.ts +18 -0
- package/src/builders/library/pipeline/assets.js +67 -0
- package/src/builders/library/pipeline/assets.js.map +1 -0
- package/src/builders/library/pipeline/build-action.d.ts +56 -0
- package/src/builders/library/pipeline/build-action.js +170 -0
- package/src/builders/library/pipeline/build-action.js.map +1 -0
- package/src/builders/library/pipeline/bundler.d.ts +44 -0
- package/src/builders/library/pipeline/bundler.js +336 -0
- package/src/builders/library/pipeline/bundler.js.map +1 -0
- package/src/builders/library/pipeline/compilation.d.ts +39 -0
- package/src/builders/library/pipeline/compilation.js +197 -0
- package/src/builders/library/pipeline/compilation.js.map +1 -0
- package/src/builders/library/pipeline/entry-points.d.ts +34 -0
- package/src/builders/library/pipeline/entry-points.js +194 -0
- package/src/builders/library/pipeline/entry-points.js.map +1 -0
- package/src/builders/library/pipeline/package-manifests.d.ts +17 -0
- package/src/builders/library/pipeline/package-manifests.js +119 -0
- package/src/builders/library/pipeline/package-manifests.js.map +1 -0
- package/src/builders/library/pipeline/stylesheet-bundler.d.ts +19 -0
- package/src/builders/library/pipeline/stylesheet-bundler.js +39 -0
- package/src/builders/library/pipeline/stylesheet-bundler.js.map +1 -0
- package/src/builders/library/pipeline/types.d.ts +54 -0
- package/src/builders/library/pipeline/utils.d.ts +69 -0
- package/src/builders/library/pipeline/utils.js +73 -0
- package/src/builders/library/pipeline/utils.js.map +1 -0
- package/src/builders/library/schema.d.ts +149 -0
- package/src/builders/library/schema.js +26 -0
- package/src/builders/library/schema.js.map +1 -0
- package/src/builders/library/schema.json +168 -0
- package/src/builders/library/types.d.ts +125 -0
- package/src/builders/library/types.js +10 -0
- package/src/builders/library/types.js.map +1 -0
- package/src/builders/ng-packagr/builder.js +2 -2
- package/src/builders/ng-packagr/builder.js.map +1 -1
- package/src/builders/unit-test/builder.js +25 -3
- package/src/builders/unit-test/builder.js.map +1 -1
- package/src/builders/unit-test/options.d.ts +1 -0
- package/src/builders/unit-test/options.js +3 -3
- package/src/builders/unit-test/options.js.map +1 -1
- package/src/builders/unit-test/runners/api.d.ts +1 -1
- package/src/builders/unit-test/runners/karma/executor.js +1 -1
- package/src/builders/unit-test/runners/karma/executor.js.map +1 -1
- package/src/builders/unit-test/runners/vitest/build-options.d.ts +8 -2
- package/src/builders/unit-test/runners/vitest/build-options.js +21 -45
- package/src/builders/unit-test/runners/vitest/build-options.js.map +1 -1
- package/src/builders/unit-test/runners/vitest/index.js +2 -2
- package/src/builders/unit-test/runners/vitest/index.js.map +1 -1
- package/src/builders/unit-test/schema.d.ts +6 -0
- package/src/builders/unit-test/schema.js.map +1 -1
- package/src/builders/unit-test/schema.json +8 -0
- package/src/tools/angular/compilation/angular-compilation.d.ts +2 -1
- package/src/tools/angular/compilation/angular-compilation.js.map +1 -1
- package/src/tools/angular/compilation/aot-compilation.d.ts +1 -1
- package/src/tools/angular/compilation/aot-compilation.js +20 -11
- package/src/tools/angular/compilation/aot-compilation.js.map +1 -1
- package/src/tools/angular/compilation/compiler-options.d.ts +4 -1
- package/src/tools/angular/compilation/compiler-options.js +24 -7
- package/src/tools/angular/compilation/compiler-options.js.map +1 -1
- package/src/tools/angular/compilation/jit-compilation.d.ts +1 -1
- package/src/tools/angular/compilation/jit-compilation.js +2 -2
- package/src/tools/angular/compilation/jit-compilation.js.map +1 -1
- package/src/tools/angular/compilation/parallel-compilation.d.ts +1 -1
- package/src/tools/angular/compilation/parallel-compilation.js +2 -1
- package/src/tools/angular/compilation/parallel-compilation.js.map +1 -1
- package/src/tools/angular/compilation/parallel-worker.d.ts +1 -0
- package/src/tools/angular/compilation/parallel-worker.js +2 -1
- package/src/tools/angular/compilation/parallel-worker.js.map +1 -1
- package/src/tools/angular/compilation/typescript-compilation.d.ts +1 -1
- package/src/tools/angular/compilation/typescript-compilation.js +2 -2
- package/src/tools/angular/compilation/typescript-compilation.js.map +1 -1
- package/src/tools/esbuild/stylesheets/stylesheet-cache-key.d.ts +1 -0
- package/src/tools/esbuild/stylesheets/stylesheet-cache-key.js +2 -0
- package/src/tools/esbuild/stylesheets/stylesheet-cache-key.js.map +1 -1
- package/src/utils/load-rolldown.d.ts +27 -0
- package/src/utils/load-rolldown.js +79 -0
- package/src/utils/load-rolldown.js.map +1 -0
- package/src/utils/normalize-cache.d.ts +14 -1
- package/src/utils/normalize-cache.js +18 -4
- package/src/utils/normalize-cache.js.map +1 -1
- package/src/utils/resolve-assets.js +1 -1
- package/src/utils/resolve-assets.js.map +1 -1
- package/src/utils/version.js +1 -1
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @license
|
|
4
|
+
* Copyright Google LLC All Rights Reserved.
|
|
5
|
+
*
|
|
6
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
7
|
+
* found in the LICENSE file at https://angular.dev/license
|
|
8
|
+
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.execute = exports.executeLibraryBuilder = void 0;
|
|
11
|
+
const architect_1 = require("@angular-devkit/architect");
|
|
12
|
+
const builder_1 = require("./builder");
|
|
13
|
+
Object.defineProperty(exports, "executeLibraryBuilder", { enumerable: true, get: function () { return builder_1.executeLibraryBuilder; } });
|
|
14
|
+
Object.defineProperty(exports, "execute", { enumerable: true, get: function () { return builder_1.executeLibraryBuilder; } });
|
|
15
|
+
const builder = (0, architect_1.createBuilder)(builder_1.executeLibraryBuilder);
|
|
16
|
+
exports.default = builder;
|
|
17
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;AAEH,yDAAmE;AACnE,uCAAkD;AAGb,sGAH5B,+BAAqB,OAG4B;AAA2B,wFAH5E,+BAAqB,OAG8D;AAE5F,MAAM,OAAO,GAAmC,IAAA,yBAAa,EAAC,+BAAqB,CAAC,CAAC;AAErF,kBAAe,OAAO,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright Google LLC All Rights Reserved.
|
|
4
|
+
*
|
|
5
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
6
|
+
* found in the LICENSE file at https://angular.dev/license
|
|
7
|
+
*/
|
|
8
|
+
import type { BuilderContext } from '@angular-devkit/architect';
|
|
9
|
+
import type { Schema as LibraryBuilderOptions } from './schema';
|
|
10
|
+
import type { NormalizedLibraryOptions } from './types';
|
|
11
|
+
export declare function normalizeLibraryOptions(context: BuilderContext, projectName: string, options: LibraryBuilderOptions): Promise<NormalizedLibraryOptions>;
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @license
|
|
4
|
+
* Copyright Google LLC All Rights Reserved.
|
|
5
|
+
*
|
|
6
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
7
|
+
* found in the LICENSE file at https://angular.dev/license
|
|
8
|
+
*/
|
|
9
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
10
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
11
|
+
};
|
|
12
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
exports.normalizeLibraryOptions = normalizeLibraryOptions;
|
|
14
|
+
const promises_1 = __importDefault(require("node:fs/promises"));
|
|
15
|
+
const node_path_1 = __importDefault(require("node:path"));
|
|
16
|
+
const utils_1 = require("../../utils");
|
|
17
|
+
const color_1 = require("../../utils/color");
|
|
18
|
+
const error_1 = require("../../utils/error");
|
|
19
|
+
const normalize_cache_1 = require("../../utils/normalize-cache");
|
|
20
|
+
const postcss_configuration_1 = require("../../utils/postcss-configuration");
|
|
21
|
+
const project_metadata_1 = require("../../utils/project-metadata");
|
|
22
|
+
const entry_points_1 = require("./pipeline/entry-points");
|
|
23
|
+
async function normalizeLibraryOptions(context, projectName, options) {
|
|
24
|
+
const { workspaceRoot } = context;
|
|
25
|
+
const projectMetadata = await context.getProjectMetadata(projectName);
|
|
26
|
+
const { projectRoot, projectSourceRoot } = (0, project_metadata_1.getProjectRootPaths)(workspaceRoot, projectMetadata);
|
|
27
|
+
const { tsConfig, assets: rawAssets, stylePreprocessorOptions, inlineStyleLanguage = 'css', compilationMode = 'partial', declarationMap = false, allowedNonPeerDependencies: rawAllowedNonPeerDependencies = [], keepLifecycleScripts = false, watch = false, poll, preserveSymlinks = process.execArgv.includes('--preserve-symlinks'), deleteOutputPath = true, progress = true, clearScreen, } = options;
|
|
28
|
+
const resolvedTsConfigPath = node_path_1.default.resolve(workspaceRoot, tsConfig);
|
|
29
|
+
const packageJsonPath = node_path_1.default.join(projectRoot, 'package.json');
|
|
30
|
+
let packageJson;
|
|
31
|
+
try {
|
|
32
|
+
const packageJsonContent = await promises_1.default.readFile(packageJsonPath, 'utf8');
|
|
33
|
+
packageJson = JSON.parse(packageJsonContent);
|
|
34
|
+
}
|
|
35
|
+
catch (error) {
|
|
36
|
+
(0, error_1.assertIsError)(error);
|
|
37
|
+
throw new Error(`Failed to read 'package.json' at '${packageJsonPath}': ${error.message}`, {
|
|
38
|
+
cause: error,
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
const { name: packageName } = packageJson;
|
|
42
|
+
if (!packageName) {
|
|
43
|
+
throw new Error(`The package.json at '${packageJsonPath}' must contain a 'name'.`);
|
|
44
|
+
}
|
|
45
|
+
const entryPoints = (0, entry_points_1.normalizeEntryPoints)(packageJson.exports, projectRoot, packageJsonPath, packageName);
|
|
46
|
+
const allowedNonPeerDependencies = [/^tslib$/];
|
|
47
|
+
for (const pattern of rawAllowedNonPeerDependencies) {
|
|
48
|
+
try {
|
|
49
|
+
allowedNonPeerDependencies.push(new RegExp(pattern));
|
|
50
|
+
}
|
|
51
|
+
catch (error) {
|
|
52
|
+
(0, error_1.assertIsError)(error);
|
|
53
|
+
throw new Error(`Invalid regular expression '${pattern}' in 'allowedNonPeerDependencies' for project '${projectName}': ${error.message}`, { cause: error });
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
const defaultAssets = [
|
|
57
|
+
{ glob: 'LICENSE*', input: projectRoot, output: '.' },
|
|
58
|
+
{ glob: 'README.md', input: projectRoot, output: '.' },
|
|
59
|
+
];
|
|
60
|
+
for (const entryPoint of entryPoints.values()) {
|
|
61
|
+
if (entryPoint.isPrimary) {
|
|
62
|
+
continue;
|
|
63
|
+
}
|
|
64
|
+
defaultAssets.push({
|
|
65
|
+
glob: 'README.md',
|
|
66
|
+
input: node_path_1.default.dirname(entryPoint.entryFilePath),
|
|
67
|
+
output: entryPoint.name,
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
const assets = (0, utils_1.normalizeAssetPatterns)([...defaultAssets, ...(rawAssets ?? [])], workspaceRoot, projectRoot, projectSourceRoot);
|
|
71
|
+
const cacheOptions = (0, normalize_cache_1.normalizeCacheOptions)(projectMetadata, workspaceRoot, projectName, context.builder.builderName);
|
|
72
|
+
const styleIncludePaths = (stylePreprocessorOptions?.includePaths ?? []).map((p) => node_path_1.default.resolve(workspaceRoot, p));
|
|
73
|
+
const searchDirectories = await (0, postcss_configuration_1.generateSearchDirectories)([projectRoot, workspaceRoot]);
|
|
74
|
+
const postcssConfiguration = await (0, postcss_configuration_1.loadPostcssConfiguration)(searchDirectories);
|
|
75
|
+
const tailwindConfiguration = postcssConfiguration
|
|
76
|
+
? undefined
|
|
77
|
+
: await (0, postcss_configuration_1.getTailwindConfig)(searchDirectories, workspaceRoot, context.logger);
|
|
78
|
+
return {
|
|
79
|
+
workspaceRoot,
|
|
80
|
+
projectRoot,
|
|
81
|
+
packageName,
|
|
82
|
+
packageJson,
|
|
83
|
+
outputPath: node_path_1.default.resolve(workspaceRoot, options.outputPath ?? node_path_1.default.join('dist', projectName)),
|
|
84
|
+
deleteOutputPath,
|
|
85
|
+
packageJsonPath,
|
|
86
|
+
tsConfigPath: resolvedTsConfigPath,
|
|
87
|
+
entryPoints,
|
|
88
|
+
inlineStyleLanguage,
|
|
89
|
+
styleIncludePaths,
|
|
90
|
+
sass: stylePreprocessorOptions?.sass,
|
|
91
|
+
assets,
|
|
92
|
+
compilationMode,
|
|
93
|
+
declarationMap,
|
|
94
|
+
allowedNonPeerDependencies,
|
|
95
|
+
keepLifecycleScripts,
|
|
96
|
+
watch,
|
|
97
|
+
poll,
|
|
98
|
+
preserveSymlinks,
|
|
99
|
+
progress,
|
|
100
|
+
clearScreen,
|
|
101
|
+
cacheOptions,
|
|
102
|
+
colors: (0, color_1.supportColor)(),
|
|
103
|
+
postcssConfiguration,
|
|
104
|
+
tailwindConfiguration,
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
//# sourceMappingURL=options.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"options.js","sourceRoot":"","sources":["options.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;;;AAoBH,0DAqIC;AAtJD,gEAAkC;AAClC,0DAA6B;AAE7B,uCAAqD;AACrD,6CAAiD;AACjD,6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,MAAM;QACN,eAAe;QACf,cAAc;QACd,0BAA0B;QAC1B,oBAAoB;QACpB,KAAK;QACL,IAAI;QACJ,gBAAgB;QAChB,QAAQ;QACR,WAAW;QACX,YAAY;QACZ,MAAM,EAAE,IAAA,oBAAY,GAAE;QACtB,oBAAoB;QACpB,qBAAqB;KACtB,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright Google LLC All Rights Reserved.
|
|
4
|
+
*
|
|
5
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
6
|
+
* found in the LICENSE file at https://angular.dev/license
|
|
7
|
+
*/
|
|
8
|
+
import type { NormalizedLibraryOptions } from '../types';
|
|
9
|
+
import { type DiskOutputFile } from './utils';
|
|
10
|
+
/**
|
|
11
|
+
* Resolves and collects configured library assets to be emitted to disk.
|
|
12
|
+
*
|
|
13
|
+
* @param assets The normalized asset patterns.
|
|
14
|
+
* @param workspaceRoot The workspace root directory path.
|
|
15
|
+
* @param modifiedFiles Optional set of modified file paths for incremental copying in watch mode.
|
|
16
|
+
* @returns An array of disk file emission descriptors.
|
|
17
|
+
*/
|
|
18
|
+
export declare function collectAssetsToEmit(assets: NormalizedLibraryOptions['assets'], workspaceRoot: string, modifiedFiles?: ReadonlySet<string>): Promise<DiskOutputFile[]>;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @license
|
|
4
|
+
* Copyright Google LLC All Rights Reserved.
|
|
5
|
+
*
|
|
6
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
7
|
+
* found in the LICENSE file at https://angular.dev/license
|
|
8
|
+
*/
|
|
9
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
10
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
11
|
+
};
|
|
12
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
exports.collectAssetsToEmit = collectAssetsToEmit;
|
|
14
|
+
const node_fs_1 = require("node:fs");
|
|
15
|
+
const node_path_1 = __importDefault(require("node:path"));
|
|
16
|
+
const picomatch_1 = __importDefault(require("picomatch"));
|
|
17
|
+
const path_1 = require("../../../utils/path");
|
|
18
|
+
const resolve_assets_1 = require("../../../utils/resolve-assets");
|
|
19
|
+
const utils_1 = require("./utils");
|
|
20
|
+
/**
|
|
21
|
+
* Resolves and collects configured library assets to be emitted to disk.
|
|
22
|
+
*
|
|
23
|
+
* @param assets The normalized asset patterns.
|
|
24
|
+
* @param workspaceRoot The workspace root directory path.
|
|
25
|
+
* @param modifiedFiles Optional set of modified file paths for incremental copying in watch mode.
|
|
26
|
+
* @returns An array of disk file emission descriptors.
|
|
27
|
+
*/
|
|
28
|
+
async function collectAssetsToEmit(assets, workspaceRoot, modifiedFiles) {
|
|
29
|
+
if (assets.length === 0 || modifiedFiles?.size === 0) {
|
|
30
|
+
return [];
|
|
31
|
+
}
|
|
32
|
+
if (modifiedFiles) {
|
|
33
|
+
const matchers = createAssetMatchers(assets, workspaceRoot);
|
|
34
|
+
const filesToEmit = [];
|
|
35
|
+
for (const file of modifiedFiles) {
|
|
36
|
+
const resolvedFile = node_path_1.default.isAbsolute(file) ? file : node_path_1.default.resolve(workspaceRoot, file);
|
|
37
|
+
const posixFile = (0, path_1.toPosixPath)(resolvedFile);
|
|
38
|
+
for (const { asset, posixInputPrefix, isMatch } of matchers) {
|
|
39
|
+
if (!posixFile.startsWith(posixInputPrefix)) {
|
|
40
|
+
continue;
|
|
41
|
+
}
|
|
42
|
+
const relative = posixFile.slice(posixInputPrefix.length);
|
|
43
|
+
if (!isMatch(relative)) {
|
|
44
|
+
continue;
|
|
45
|
+
}
|
|
46
|
+
if ((0, node_fs_1.statSync)(resolvedFile, { throwIfNoEntry: false })?.isFile()) {
|
|
47
|
+
filesToEmit.push((0, utils_1.createDiskOutputFile)(resolvedFile, node_path_1.default.join(asset.output, relative)));
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
return filesToEmit;
|
|
52
|
+
}
|
|
53
|
+
const resolvedAssets = await (0, resolve_assets_1.resolveAssets)(assets, workspaceRoot);
|
|
54
|
+
return resolvedAssets.map(({ source, destination }) => (0, utils_1.createDiskOutputFile)(source, destination));
|
|
55
|
+
}
|
|
56
|
+
function createAssetMatchers(assets, workspaceRoot) {
|
|
57
|
+
return assets.map((asset) => {
|
|
58
|
+
const absInput = node_path_1.default.resolve(workspaceRoot, asset.input);
|
|
59
|
+
const posixInput = (0, path_1.toPosixPath)(absInput).replace(/\/+$/, '');
|
|
60
|
+
const isMatch = (0, picomatch_1.default)(asset.glob, {
|
|
61
|
+
dot: true,
|
|
62
|
+
ignore: [...resolve_assets_1.DEFAULT_ASSET_IGNORE, ...(asset.ignore ?? [])],
|
|
63
|
+
});
|
|
64
|
+
return { asset, posixInputPrefix: `${posixInput}/`, isMatch };
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
//# sourceMappingURL=assets.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"assets.js","sourceRoot":"","sources":["assets.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;;;AAkBH,kDAuCC;AAvDD,qCAAmC;AACnC,0DAA6B;AAC7B,0DAAkC;AAClC,8CAAkD;AAClD,kEAAoF;AAEpF,mCAAoE;AAEpE;;;;;;;GAOG;AACI,KAAK,UAAU,mBAAmB,CACvC,MAA0C,EAC1C,aAAqB,EACrB,aAAmC;IAEnC,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC,IAAI,aAAa,EAAE,IAAI,KAAK,CAAC,EAAE,CAAC;QACrD,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,IAAI,aAAa,EAAE,CAAC;QAClB,MAAM,QAAQ,GAAG,mBAAmB,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC;QAC5D,MAAM,WAAW,GAAqB,EAAE,CAAC;QAEzC,KAAK,MAAM,IA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,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE;QAC1B,MAAM,QAAQ,GAAG,mBAAI,CAAC,OAAO,CAAC,aAAa,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC;QAC1D,MAAM,UAAU,GAAG,IAAA,kBAAW,EAAC,QAAQ,CAAC,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;QAC7D,MAAM,OAAO,GAAG,IAAA,mBAAS,EAAC,KAAK,CAAC,IAAI,EAAE;YACpC,GAAG,EAAE,IAAI;YACT,MAAM,EAAE,CAAC,GAAG,qCAAoB,EAAE,GAAG,CAAC,KAAK,CAAC,MAAM,IAAI,EAAE,CAAC,CAAC;SAC3D,CAAC,CAAC;QAEH,OAAO,EAAE,KAAK,EAAE,gBAAgB,EAAE,GAAG,UAAU,GAAG,EAAE,OAAO,EAAE,CAAC;IAChE,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright Google LLC All Rights Reserved.
|
|
4
|
+
*
|
|
5
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
6
|
+
* found in the LICENSE file at https://angular.dev/license
|
|
7
|
+
*/
|
|
8
|
+
import type { BuilderContext } from '@angular-devkit/architect';
|
|
9
|
+
import type { ComponentStylesheetBundler } from '../../../tools/esbuild/angular/component-stylesheets';
|
|
10
|
+
import type { NormalizedLibraryOptions, SingleBuildState } from '../types';
|
|
11
|
+
import type { DiskOutputFile } from './utils';
|
|
12
|
+
/**
|
|
13
|
+
* Creates a fresh {@link SingleBuildState} instance.
|
|
14
|
+
*/
|
|
15
|
+
export declare function createSingleBuildState(): SingleBuildState;
|
|
16
|
+
/**
|
|
17
|
+
* Context required to execute a single library build iteration.
|
|
18
|
+
*/
|
|
19
|
+
export interface BuildActionContext {
|
|
20
|
+
/** Normalized options for the library build. */
|
|
21
|
+
options: NormalizedLibraryOptions;
|
|
22
|
+
/** The Architect builder context. */
|
|
23
|
+
context: BuilderContext;
|
|
24
|
+
/** Bundler instance used to process component stylesheets. */
|
|
25
|
+
stylesheetBundler: ComponentStylesheetBundler;
|
|
26
|
+
/** Whether the builder is running in watch mode. */
|
|
27
|
+
isWatchMode: boolean;
|
|
28
|
+
/**
|
|
29
|
+
* Set of file paths tracked for compilation and configuration
|
|
30
|
+
* (including `tsconfig.json`, `package.json`, entry points, and referenced source,
|
|
31
|
+
* template, and stylesheet files). Updated during compilation and used to determine
|
|
32
|
+
* whether file changes require recompiling entry points, excluding asset files so
|
|
33
|
+
* asset-only changes do not trigger code compilation.
|
|
34
|
+
*/
|
|
35
|
+
watchedCompilationFiles: Set<string>;
|
|
36
|
+
/** State preserved across incremental builds in watch mode. */
|
|
37
|
+
buildState: SingleBuildState;
|
|
38
|
+
/** Set of file paths modified since the last build iteration. */
|
|
39
|
+
modifiedFiles?: Set<string>;
|
|
40
|
+
/**
|
|
41
|
+
* Asset files to emit to disk for the current build iteration.
|
|
42
|
+
* Pre-collected in the watch loop to avoid redundant asset matching, or resolved and
|
|
43
|
+
* populated by `buildAction` when omitted (such as during the initial build) so the
|
|
44
|
+
* caller can register their source paths with the file watcher.
|
|
45
|
+
*/
|
|
46
|
+
assetsToEmit?: DiskOutputFile[];
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Executes a single iteration of the library build pipeline, including
|
|
50
|
+
* single-program Angular compilation, parallel typechecking, 2-instance Rolldown bundling,
|
|
51
|
+
* manifest generation, and asset copying.
|
|
52
|
+
*
|
|
53
|
+
* @param actionContext The build action state and configuration.
|
|
54
|
+
*/
|
|
55
|
+
export declare function buildAction(actionContext: BuildActionContext): Promise<void>;
|
|
56
|
+
export declare function hasModifiedWatchedFile(modifiedFiles: ReadonlySet<string>, watchedCompilationFiles: ReadonlySet<string>, posixPackageJsonPath: string): boolean;
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @license
|
|
4
|
+
* Copyright Google LLC All Rights Reserved.
|
|
5
|
+
*
|
|
6
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
7
|
+
* found in the LICENSE file at https://angular.dev/license
|
|
8
|
+
*/
|
|
9
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
10
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
11
|
+
};
|
|
12
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
exports.createSingleBuildState = createSingleBuildState;
|
|
14
|
+
exports.buildAction = buildAction;
|
|
15
|
+
exports.hasModifiedWatchedFile = hasModifiedWatchedFile;
|
|
16
|
+
const promises_1 = require("node:fs/promises");
|
|
17
|
+
const node_path_1 = __importDefault(require("node:path"));
|
|
18
|
+
const utils_1 = require("../../../tools/esbuild/utils");
|
|
19
|
+
const path_1 = require("../../../utils/path");
|
|
20
|
+
const assets_1 = require("./assets");
|
|
21
|
+
const bundler_1 = require("./bundler");
|
|
22
|
+
const compilation_1 = require("./compilation");
|
|
23
|
+
const package_manifests_1 = require("./package-manifests");
|
|
24
|
+
/**
|
|
25
|
+
* Creates a fresh {@link SingleBuildState} instance.
|
|
26
|
+
*/
|
|
27
|
+
function createSingleBuildState() {
|
|
28
|
+
return {
|
|
29
|
+
previousBundleResults: new Map(),
|
|
30
|
+
pendingChangedEsmFiles: new Set(),
|
|
31
|
+
pendingChangedDtsFiles: new Set(),
|
|
32
|
+
directoryExists: new Set(),
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Executes a single iteration of the library build pipeline, including
|
|
37
|
+
* single-program Angular compilation, parallel typechecking, 2-instance Rolldown bundling,
|
|
38
|
+
* manifest generation, and asset copying.
|
|
39
|
+
*
|
|
40
|
+
* @param actionContext The build action state and configuration.
|
|
41
|
+
*/
|
|
42
|
+
async function buildAction(actionContext) {
|
|
43
|
+
const { options, context, stylesheetBundler, isWatchMode, watchedCompilationFiles, buildState, modifiedFiles, } = actionContext;
|
|
44
|
+
const posixPackageJsonPath = (0, path_1.toPosixPath)(options.packageJsonPath);
|
|
45
|
+
const { pendingChangedEsmFiles, pendingChangedDtsFiles, directoryExists } = buildState;
|
|
46
|
+
if (!modifiedFiles || modifiedFiles.has(posixPackageJsonPath)) {
|
|
47
|
+
buildState.hasEmittedManifests = false;
|
|
48
|
+
}
|
|
49
|
+
const shouldCompileEntryPoints = !modifiedFiles ||
|
|
50
|
+
!buildState.singleProgramCache ||
|
|
51
|
+
buildState.hasCompilationError ||
|
|
52
|
+
buildState.hasEntryPointsChanges ||
|
|
53
|
+
pendingChangedEsmFiles.size > 0 ||
|
|
54
|
+
pendingChangedDtsFiles.size > 0 ||
|
|
55
|
+
hasModifiedWatchedFile(modifiedFiles, watchedCompilationFiles, posixPackageJsonPath);
|
|
56
|
+
const shouldGenerateManifests = !buildState.hasEmittedManifests;
|
|
57
|
+
if (shouldGenerateManifests) {
|
|
58
|
+
verifyAllowedDependencies(options);
|
|
59
|
+
}
|
|
60
|
+
const filesToEmit = [];
|
|
61
|
+
if (shouldCompileEntryPoints) {
|
|
62
|
+
buildState.hasCompilationError = true;
|
|
63
|
+
buildState.hasEntryPointsChanges = false;
|
|
64
|
+
const { esmFiles, dtsFiles, changedEsmFiles, changedDtsFiles, referencedFiles, cache, diagnosePromise, } = await (0, compilation_1.compileLibrary)(options.entryPoints.values(), options, stylesheetBundler, buildState.singleProgramCache, modifiedFiles);
|
|
65
|
+
buildState.singleProgramCache = cache;
|
|
66
|
+
for (const file of referencedFiles) {
|
|
67
|
+
watchedCompilationFiles.add(file);
|
|
68
|
+
}
|
|
69
|
+
for (const file of changedEsmFiles) {
|
|
70
|
+
pendingChangedEsmFiles.add(file);
|
|
71
|
+
}
|
|
72
|
+
for (const file of changedDtsFiles) {
|
|
73
|
+
pendingChangedDtsFiles.add(file);
|
|
74
|
+
}
|
|
75
|
+
const itemsToBundle = [];
|
|
76
|
+
for (const entryPoint of options.entryPoints.values()) {
|
|
77
|
+
const previousBundleResult = buildState.previousBundleResults.get(entryPoint.name);
|
|
78
|
+
const hasEsmChanges = !previousBundleResult ||
|
|
79
|
+
hasEntryPointChanges(previousBundleResult.esmModuleIds, pendingChangedEsmFiles);
|
|
80
|
+
const hasDtsChanges = !previousBundleResult ||
|
|
81
|
+
hasEntryPointChanges(previousBundleResult.dtsModuleIds, pendingChangedDtsFiles);
|
|
82
|
+
if (hasEsmChanges || hasDtsChanges) {
|
|
83
|
+
context.logger.info(`Compiling ${entryPoint.displayName}...`);
|
|
84
|
+
itemsToBundle.push({
|
|
85
|
+
entryPoint,
|
|
86
|
+
hasEsmChanges,
|
|
87
|
+
hasDtsChanges,
|
|
88
|
+
previousBundleResult,
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
let bundleOutput;
|
|
93
|
+
let warnings;
|
|
94
|
+
try {
|
|
95
|
+
[bundleOutput, warnings] = await Promise.all([
|
|
96
|
+
(0, bundler_1.bundleEntryPoints)(itemsToBundle, esmFiles, dtsFiles, options),
|
|
97
|
+
diagnosePromise,
|
|
98
|
+
]);
|
|
99
|
+
}
|
|
100
|
+
catch (error) {
|
|
101
|
+
// Prioritize TypeScript/Angular diagnostic errors over secondary bundler failures.
|
|
102
|
+
await diagnosePromise;
|
|
103
|
+
throw error;
|
|
104
|
+
}
|
|
105
|
+
buildState.hasCompilationError = false;
|
|
106
|
+
pendingChangedEsmFiles.clear();
|
|
107
|
+
pendingChangedDtsFiles.clear();
|
|
108
|
+
for (const warning of [...warnings, ...bundleOutput.warnings]) {
|
|
109
|
+
context.logger.warn(warning);
|
|
110
|
+
}
|
|
111
|
+
filesToEmit.push(...bundleOutput.filesToEmit);
|
|
112
|
+
for (const [name, bundleResult] of bundleOutput.bundleResults) {
|
|
113
|
+
buildState.previousBundleResults.set(name, bundleResult);
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
if (shouldGenerateManifests) {
|
|
117
|
+
filesToEmit.push(...(0, package_manifests_1.generatePackageManifests)(options, isWatchMode));
|
|
118
|
+
}
|
|
119
|
+
const resolvedAssetsToEmit = (actionContext.assetsToEmit ??= await (0, assets_1.collectAssetsToEmit)(options.assets, options.workspaceRoot, buildState.hasEmittedAssets ? modifiedFiles : undefined));
|
|
120
|
+
filesToEmit.push(...resolvedAssetsToEmit);
|
|
121
|
+
await (0, utils_1.emitFilesToDisk)(filesToEmit, async (file) => {
|
|
122
|
+
const fullFilePath = node_path_1.default.join(options.outputPath, file.path);
|
|
123
|
+
const fileBasePath = node_path_1.default.dirname(fullFilePath);
|
|
124
|
+
if (fileBasePath && !directoryExists.has(fileBasePath)) {
|
|
125
|
+
await (0, promises_1.mkdir)(fileBasePath, { recursive: true });
|
|
126
|
+
directoryExists.add(fileBasePath);
|
|
127
|
+
}
|
|
128
|
+
if (file.type === 'memory') {
|
|
129
|
+
await (0, promises_1.writeFile)(fullFilePath, file.contents);
|
|
130
|
+
}
|
|
131
|
+
else {
|
|
132
|
+
await (0, promises_1.copyFile)(file.source, fullFilePath, promises_1.constants.COPYFILE_FICLONE);
|
|
133
|
+
}
|
|
134
|
+
});
|
|
135
|
+
buildState.hasEmittedManifests = true;
|
|
136
|
+
buildState.hasEmittedAssets = true;
|
|
137
|
+
}
|
|
138
|
+
function hasModifiedWatchedFile(modifiedFiles, watchedCompilationFiles, posixPackageJsonPath) {
|
|
139
|
+
for (const file of modifiedFiles) {
|
|
140
|
+
if (file !== posixPackageJsonPath && watchedCompilationFiles.has(file)) {
|
|
141
|
+
return true;
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
return false;
|
|
145
|
+
}
|
|
146
|
+
function hasEntryPointChanges(moduleIds, changedFiles) {
|
|
147
|
+
if (changedFiles.size === 0) {
|
|
148
|
+
return false;
|
|
149
|
+
}
|
|
150
|
+
for (const file of changedFiles) {
|
|
151
|
+
if (moduleIds.has(file)) {
|
|
152
|
+
return true;
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
return false;
|
|
156
|
+
}
|
|
157
|
+
function verifyAllowedDependencies(options) {
|
|
158
|
+
const { packageJson, allowedNonPeerDependencies } = options;
|
|
159
|
+
const dependencies = {
|
|
160
|
+
...(packageJson.dependencies ?? {}),
|
|
161
|
+
...(packageJson.optionalDependencies ?? {}),
|
|
162
|
+
};
|
|
163
|
+
for (const dep of Object.keys(dependencies)) {
|
|
164
|
+
if (!allowedNonPeerDependencies.some((regex) => regex.test(dep))) {
|
|
165
|
+
throw new Error(`Dependency '${dep}' must be explicitly allowed using the 'allowedNonPeerDependencies' option, ` +
|
|
166
|
+
`or moved to 'peerDependencies' in 'package.json'.`);
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
//# sourceMappingURL=build-action.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"build-action.js","sourceRoot":"","sources":["build-action.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;;;AAkBH,wDAOC;AAiDD,kCA+IC;AAED,wDAYC;AApOD,+CAAyE;AACzE,0DAA6B;AAE7B,wDAA+D;AAC/D,8CAAkD;AAElD,qCAA+C;AAC/C,uCAA0E;AAC1E,+CAA+C;AAC/C,2DAA+D;AAG/D;;GAEG;AACH,SAAgB,sBAAsB;IACpC,OAAO;QACL,qBAAqB,EAAE,IAAI,GAAG,EAAE;QAChC,sBAAsB,EAAE,IAAI,GAAG,EAAE;QACjC,sBAAsB,EAAE,IAAI,GAAG,EAAE;QACjC,eAAe,EAAE,IAAI,GAAG,EAAE;KAC3B,CAAC;AACJ,CAAC;AA0CD;;;;;;GAMG;AACI,KAAK,UAAU,WAAW,CAAC,aAAiC;IACjE,MAAM,EACJ,OAAO,EACP,OAAO,EACP,iBAAiB,EACjB,WAAW,EACX,uBAAuB,EACvB,UAAU,EACV,aAAa,GACd,GAAG,aAAa,CAAC;IAElB,MAAM,oBAAoB,GAAG,IAAA,kBAAW,EAAC,OAAO,CAAC,eAAe,CAAC,CAAC;IAClE,MAAM,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BAA0B,EAAE,GAAG,OAAO,CAAC;IAC5D,MAAM,YAAY,GAAG;QACnB,GAAG,CAAC,WAAW,CAAC,YAAY,IAAI,EAAE,CAAC;QACnC,GAAG,CAAC,WAAW,CAAC,oBAAoB,IAAI,EAAE,CAAC;KAC5C,CAAC;IAEF,KAAK,MAAM,GAAG,IAAI,MAAM,CAAC,IAAI,CAAC,YAAY,CAAC,EAAE,CAAC;QAC5C,IAAI,CAAC,0BAA0B,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC;YACjE,MAAM,IAAI,KAAK,CACb,eAAe,GAAG,8EAA8E;gBAC9F,mDAAmD,CACtD,CAAC;QACJ,CAAC;IACH,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright Google LLC All Rights Reserved.
|
|
4
|
+
*
|
|
5
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
6
|
+
* found in the LICENSE file at https://angular.dev/license
|
|
7
|
+
*/
|
|
8
|
+
import type { BundleResult, NormalizedEntryPoint, NormalizedLibraryOptions } from '../types';
|
|
9
|
+
import { type MemoryOutputFile } from './utils';
|
|
10
|
+
/**
|
|
11
|
+
* Output of the entry point bundling process.
|
|
12
|
+
*/
|
|
13
|
+
export interface BundleEntryPointsOutput {
|
|
14
|
+
/** In-memory files produced by bundling to be written to disk. */
|
|
15
|
+
filesToEmit: MemoryOutputFile[];
|
|
16
|
+
/** Map of entry point names to their bundle results containing bundled module IDs. */
|
|
17
|
+
bundleResults: Map<string, BundleResult>;
|
|
18
|
+
/** Warning messages emitted during bundling. */
|
|
19
|
+
warnings: string[];
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Input state for an individual entry point to be bundled.
|
|
23
|
+
*/
|
|
24
|
+
export interface BundleEntryPointInput {
|
|
25
|
+
/** The normalized entry point to bundle. */
|
|
26
|
+
entryPoint: NormalizedEntryPoint;
|
|
27
|
+
/** Whether the entry point has changed ESM files requiring rebundling. */
|
|
28
|
+
hasEsmChanges: boolean;
|
|
29
|
+
/** Whether the entry point has changed TypeScript declaration files requiring rebundling. */
|
|
30
|
+
hasDtsChanges: boolean;
|
|
31
|
+
/** The previous bundle result from a prior build iteration, if available. */
|
|
32
|
+
previousBundleResult?: BundleResult;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Bundles the compiled in-memory JavaScript and declaration files for all dirty entry points
|
|
36
|
+
* using at most 2 Rolldown instances total (1 for all .mjs bundles, 1 for all .d.ts bundles).
|
|
37
|
+
*
|
|
38
|
+
* @param items The collection of entry point inputs with change statuses.
|
|
39
|
+
* @param esmFiles Map of virtual ESM output file paths to their content.
|
|
40
|
+
* @param dtsFiles Map of virtual TypeScript declaration file paths to their content.
|
|
41
|
+
* @param options The normalized library builder options.
|
|
42
|
+
* @returns A promise resolving to the bundled output files and bundle cache results.
|
|
43
|
+
*/
|
|
44
|
+
export declare function bundleEntryPoints(items: readonly BundleEntryPointInput[], esmFiles: ReadonlyMap<string, string>, dtsFiles: ReadonlyMap<string, string>, options: NormalizedLibraryOptions): Promise<BundleEntryPointsOutput>;
|