@angular/build 22.2.0 → 22.3.0-next.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/builders.json +5 -0
- package/package.json +19 -18
- package/src/builders/karma/schema.d.ts +4 -4
- package/src/builders/karma/schema.json +2 -2
- package/src/builders/library/builder.d.ts +19 -0
- package/src/builders/library/builder.js +279 -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 +116 -0
- package/src/builders/library/options.js.map +1 -0
- package/src/builders/library/pipeline/assets.d.ts +29 -0
- package/src/builders/library/pipeline/assets.js +106 -0
- package/src/builders/library/pipeline/assets.js.map +1 -0
- package/src/builders/library/pipeline/build-action.d.ts +35 -0
- package/src/builders/library/pipeline/build-action.js +169 -0
- package/src/builders/library/pipeline/build-action.js.map +1 -0
- package/src/builders/library/pipeline/bundler.d.ts +42 -0
- package/src/builders/library/pipeline/bundler.js +278 -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/unit-test/builder.js +24 -2
- 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 +2 -1
- 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 +26 -45
- package/src/builders/unit-test/runners/vitest/build-options.js.map +1 -1
- package/src/builders/unit-test/runners/vitest/executor.js +6 -1
- package/src/builders/unit-test/runners/vitest/executor.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 +10 -3
- package/src/builders/unit-test/schema.js.map +1 -1
- package/src/builders/unit-test/schema.json +10 -2
- 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/angular/linker/oxc-linker.js +28 -4
- package/src/tools/angular/linker/oxc-linker.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/tools/i18n/i18n-inliner-worker.js +45 -31
- package/src/tools/i18n/i18n-inliner-worker.js.map +1 -1
- package/src/tools/i18n/i18n-inliner.js +33 -7
- package/src/tools/i18n/i18n-inliner.js.map +1 -1
- package/src/tools/javascript-transformer/javascript-transformer-worker.js +3 -2
- package/src/tools/javascript-transformer/javascript-transformer-worker.js.map +1 -1
- package/src/tools/vite/middlewares/assets-middleware.js +1 -1
- package/src/tools/vite/middlewares/assets-middleware.js.map +1 -1
- package/src/tools/vite/middlewares/ssr-middleware.d.ts +2 -2
- package/src/tools/vite/middlewares/ssr-middleware.js +5 -3
- package/src/tools/vite/middlewares/ssr-middleware.js.map +1 -1
- package/src/tools/vite/plugins/setup-middlewares-plugin.js +2 -2
- package/src/tools/vite/plugins/setup-middlewares-plugin.js.map +1 -1
- package/src/utils/index-file/auto-csp.js +4 -2
- package/src/utils/index-file/auto-csp.js.map +1 -1
- package/src/utils/normalize-cache.js +7 -2
- package/src/utils/normalize-cache.js.map +1 -1
- package/src/utils/resolve-assets.d.ts +4 -0
- package/src/utils/resolve-assets.js +7 -3
- package/src/utils/resolve-assets.js.map +1 -1
- package/src/utils/version.js +1 -1
- package/src/utils/watcher.d.ts +7 -0
- package/src/utils/watcher.js +162 -15
- package/src/utils/watcher.js.map +1 -1
package/builders.json
CHANGED
|
@@ -20,6 +20,11 @@
|
|
|
20
20
|
"schema": "./src/builders/karma/schema.json",
|
|
21
21
|
"description": "Run Karma unit tests."
|
|
22
22
|
},
|
|
23
|
+
"library": {
|
|
24
|
+
"implementation": "./src/builders/library/index",
|
|
25
|
+
"schema": "./src/builders/library/schema.json",
|
|
26
|
+
"description": "Build an Angular library package conforming to the Angular Package Format (APF)."
|
|
27
|
+
},
|
|
23
28
|
"ng-packagr": {
|
|
24
29
|
"implementation": "./src/builders/ng-packagr/index",
|
|
25
30
|
"schema": "./src/builders/ng-packagr/schema.json",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@angular/build",
|
|
3
|
-
"version": "22.
|
|
3
|
+
"version": "22.3.0-next.0",
|
|
4
4
|
"description": "Official build system for Angular",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Angular CLI",
|
|
@@ -23,8 +23,8 @@
|
|
|
23
23
|
"builders": "builders.json",
|
|
24
24
|
"dependencies": {
|
|
25
25
|
"@ampproject/remapping": "2.3.0",
|
|
26
|
-
"@angular-devkit/architect": "0.
|
|
27
|
-
"@babel/core": "8.0.
|
|
26
|
+
"@angular-devkit/architect": "0.2203.0-next.0",
|
|
27
|
+
"@babel/core": "8.0.6",
|
|
28
28
|
"@inquirer/confirm": "6.3.2",
|
|
29
29
|
"@parcel/watcher": "2.6.0",
|
|
30
30
|
"@vitejs/plugin-basic-ssl": "2.3.0",
|
|
@@ -35,37 +35,38 @@
|
|
|
35
35
|
"https-proxy-agent": "9.1.0",
|
|
36
36
|
"jsonc-parser": "3.3.1",
|
|
37
37
|
"listr2": "11.1.0",
|
|
38
|
-
"magic-string": "1.4.
|
|
38
|
+
"magic-string": "1.4.2",
|
|
39
39
|
"mrmime": "2.0.1",
|
|
40
|
-
"oxc-parser": "0.
|
|
40
|
+
"oxc-parser": "0.152.0",
|
|
41
41
|
"parse5-html-rewriting-stream": "8.0.1",
|
|
42
42
|
"picomatch": "4.0.7",
|
|
43
43
|
"piscina": "5.3.2",
|
|
44
|
-
"rolldown": "1.2.
|
|
45
|
-
"
|
|
46
|
-
"sass
|
|
44
|
+
"rolldown": "1.2.11",
|
|
45
|
+
"rolldown-plugin-dts": "0.28.6",
|
|
46
|
+
"sass": "1.105.1",
|
|
47
|
+
"sass-embedded": "1.105.1",
|
|
47
48
|
"semver": "7.8.5",
|
|
48
49
|
"source-map-support": "0.5.21",
|
|
49
50
|
"tinyglobby": "0.2.17",
|
|
50
|
-
"vite": "8.3.
|
|
51
|
+
"vite": "8.3.1",
|
|
51
52
|
"xxhash-wasm": "1.1.0"
|
|
52
53
|
},
|
|
53
54
|
"optionalDependencies": {
|
|
54
55
|
"lmdb": "3.5.6"
|
|
55
56
|
},
|
|
56
57
|
"peerDependencies": {
|
|
57
|
-
"@angular/compiler": "^22.0.0",
|
|
58
|
-
"@angular/compiler-cli": "^22.0.0",
|
|
59
|
-
"@angular/core": "^22.0.0",
|
|
60
|
-
"@angular/localize": "^22.0.0",
|
|
61
|
-
"@angular/platform-browser": "^22.0.0",
|
|
62
|
-
"@angular/platform-server": "^22.0.0",
|
|
63
|
-
"@angular/service-worker": "^22.0.0",
|
|
64
|
-
"@angular/ssr": "^22.
|
|
58
|
+
"@angular/compiler": "^22.0.0 || ^22.3.0-next.0",
|
|
59
|
+
"@angular/compiler-cli": "^22.0.0 || ^22.3.0-next.0",
|
|
60
|
+
"@angular/core": "^22.0.0 || ^22.3.0-next.0",
|
|
61
|
+
"@angular/localize": "^22.0.0 || ^22.3.0-next.0",
|
|
62
|
+
"@angular/platform-browser": "^22.0.0 || ^22.3.0-next.0",
|
|
63
|
+
"@angular/platform-server": "^22.0.0 || ^22.3.0-next.0",
|
|
64
|
+
"@angular/service-worker": "^22.0.0 || ^22.3.0-next.0",
|
|
65
|
+
"@angular/ssr": "^22.3.0-next.0",
|
|
65
66
|
"istanbul-lib-instrument": "^6.0.0",
|
|
66
67
|
"karma": "^6.4.0",
|
|
67
68
|
"less": "^4.2.0",
|
|
68
|
-
"ng-packagr": "^22.0.0",
|
|
69
|
+
"ng-packagr": "^22.0.0 || ^22.3.0-next.0",
|
|
69
70
|
"postcss": "^8.4.0",
|
|
70
71
|
"rollup": "^4.0.0",
|
|
71
72
|
"tailwindcss": "^2.0.0 || ^3.0.0 || ^4.0.0",
|
|
@@ -32,7 +32,7 @@ export type Schema = {
|
|
|
32
32
|
[key: string]: string;
|
|
33
33
|
};
|
|
34
34
|
/**
|
|
35
|
-
* Globs of files to exclude, relative to the project root.
|
|
35
|
+
* Globs of files to exclude, relative to the project source root.
|
|
36
36
|
*/
|
|
37
37
|
exclude?: string[];
|
|
38
38
|
/**
|
|
@@ -45,11 +45,11 @@ export type Schema = {
|
|
|
45
45
|
*/
|
|
46
46
|
fileReplacements?: FileReplacement[];
|
|
47
47
|
/**
|
|
48
|
-
* Globs of files to include, relative to project root.
|
|
48
|
+
* Globs of files to include, relative to the project source root.
|
|
49
49
|
* There are 2 special cases:
|
|
50
|
-
* - when a path to directory is provided, all spec files ending ".spec.@(ts|tsx)" will be
|
|
50
|
+
* - when a path to a directory is provided, all spec files ending ".spec.@(ts|tsx)" will be
|
|
51
51
|
* included
|
|
52
|
-
* - when a path to a file is provided, and a matching spec file exists it will be included
|
|
52
|
+
* - when a path to a file is provided, and a matching spec file exists, it will be included
|
|
53
53
|
* instead.
|
|
54
54
|
*/
|
|
55
55
|
include?: string[];
|
|
@@ -182,7 +182,7 @@
|
|
|
182
182
|
"type": "string"
|
|
183
183
|
},
|
|
184
184
|
"default": ["**/*.spec.ts"],
|
|
185
|
-
"description": "Globs of files to include, relative to project root. \nThere are 2 special cases:\n - when a path to directory is provided, all spec files ending \".spec.@(ts|tsx)\" will be included\n - when a path to a file is provided, and a matching spec file exists it will be included instead."
|
|
185
|
+
"description": "Globs of files to include, relative to the project source root. \nThere are 2 special cases:\n - when a path to a directory is provided, all spec files ending \".spec.@(ts|tsx)\" will be included\n - when a path to a file is provided, and a matching spec file exists, it will be included instead."
|
|
186
186
|
},
|
|
187
187
|
"exclude": {
|
|
188
188
|
"type": "array",
|
|
@@ -190,7 +190,7 @@
|
|
|
190
190
|
"type": "string"
|
|
191
191
|
},
|
|
192
192
|
"default": [],
|
|
193
|
-
"description": "Globs of files to exclude, relative to the project root."
|
|
193
|
+
"description": "Globs of files to exclude, relative to the project source root."
|
|
194
194
|
},
|
|
195
195
|
"sourceMap": {
|
|
196
196
|
"description": "Output source maps for scripts and styles. For more information, see https://angular.dev/reference/configs/workspace-config#source-map-configuration.",
|
|
@@ -0,0 +1,19 @@
|
|
|
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, BuilderOutput } from '@angular-devkit/architect';
|
|
9
|
+
import type { Schema as LibraryBuilderOptions } from './schema';
|
|
10
|
+
/**
|
|
11
|
+
* Executes the library builder to compile, bundle, and package an Angular library into the Angular Package Format (APF).
|
|
12
|
+
*
|
|
13
|
+
* @param options The raw builder schema options.
|
|
14
|
+
* @param context The architect builder execution context.
|
|
15
|
+
* @returns An async iterator yielding builder output results.
|
|
16
|
+
*/
|
|
17
|
+
export declare function executeLibraryBuilder(options: LibraryBuilderOptions, context: BuilderContext & {
|
|
18
|
+
signal?: AbortSignal;
|
|
19
|
+
}): AsyncIterableIterator<BuilderOutput>;
|
|
@@ -0,0 +1,279 @@
|
|
|
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 __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
12
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
13
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
14
|
+
}
|
|
15
|
+
Object.defineProperty(o, k2, desc);
|
|
16
|
+
}) : (function(o, m, k, k2) {
|
|
17
|
+
if (k2 === undefined) k2 = k;
|
|
18
|
+
o[k2] = m[k];
|
|
19
|
+
}));
|
|
20
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
21
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
22
|
+
}) : function(o, v) {
|
|
23
|
+
o["default"] = v;
|
|
24
|
+
});
|
|
25
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
26
|
+
var ownKeys = function(o) {
|
|
27
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
28
|
+
var ar = [];
|
|
29
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
30
|
+
return ar;
|
|
31
|
+
};
|
|
32
|
+
return ownKeys(o);
|
|
33
|
+
};
|
|
34
|
+
return function (mod) {
|
|
35
|
+
if (mod && mod.__esModule) return mod;
|
|
36
|
+
var result = {};
|
|
37
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
38
|
+
__setModuleDefault(result, mod);
|
|
39
|
+
return result;
|
|
40
|
+
};
|
|
41
|
+
})();
|
|
42
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
43
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
44
|
+
};
|
|
45
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
46
|
+
exports.executeLibraryBuilder = executeLibraryBuilder;
|
|
47
|
+
const promises_1 = __importDefault(require("node:fs/promises"));
|
|
48
|
+
const sass_language_1 = require("../../tools/esbuild/stylesheets/sass-language");
|
|
49
|
+
const target_1 = require("../../tools/esbuild/target");
|
|
50
|
+
const utils_1 = require("../../tools/esbuild/utils");
|
|
51
|
+
const delete_output_dir_1 = require("../../utils/delete-output-dir");
|
|
52
|
+
const error_1 = require("../../utils/error");
|
|
53
|
+
const hash_1 = require("../../utils/hash");
|
|
54
|
+
const path_1 = require("../../utils/path");
|
|
55
|
+
const profiling_1 = require("../../utils/profiling");
|
|
56
|
+
const purge_cache_1 = require("../../utils/purge-cache");
|
|
57
|
+
const supported_browsers_1 = require("../../utils/supported-browsers");
|
|
58
|
+
const version_1 = require("../../utils/version");
|
|
59
|
+
const options_1 = require("./options");
|
|
60
|
+
const entry_points_1 = require("./pipeline/entry-points");
|
|
61
|
+
/**
|
|
62
|
+
* Executes the library builder to compile, bundle, and package an Angular library into the Angular Package Format (APF).
|
|
63
|
+
*
|
|
64
|
+
* @param options The raw builder schema options.
|
|
65
|
+
* @param context The architect builder execution context.
|
|
66
|
+
* @returns An async iterator yielding builder output results.
|
|
67
|
+
*/
|
|
68
|
+
async function* executeLibraryBuilder(options, context) {
|
|
69
|
+
(0, version_1.assertCompatibleAngularVersion)(context.workspaceRoot);
|
|
70
|
+
await (0, hash_1.initializeHash)();
|
|
71
|
+
// Purge old build disk cache
|
|
72
|
+
await (0, purge_cache_1.purgeStaleBuildCache)(context);
|
|
73
|
+
const projectName = context.target?.project;
|
|
74
|
+
if (!projectName) {
|
|
75
|
+
yield { success: false, error: 'The library builder requires a target.' };
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
const normalizedOptions = await (0, options_1.normalizeLibraryOptions)(context, projectName, options);
|
|
79
|
+
const { workspaceRoot, projectRoot, outputPath, deleteOutputPath, packageJsonPath, tsConfigPath, watch: isWatchMode, poll, cacheOptions, preserveSymlinks, progress, } = normalizedOptions;
|
|
80
|
+
let signal = context.signal;
|
|
81
|
+
if (!signal) {
|
|
82
|
+
const controller = new AbortController();
|
|
83
|
+
signal = controller.signal;
|
|
84
|
+
context.addTeardown?.(() => controller.abort('builder-teardown'));
|
|
85
|
+
}
|
|
86
|
+
const { logger } = context;
|
|
87
|
+
const withProgress = progress ? utils_1.withSpinner : utils_1.withNoProgress;
|
|
88
|
+
// Clean output directory
|
|
89
|
+
if (deleteOutputPath) {
|
|
90
|
+
await (0, delete_output_dir_1.deleteOutputDir)(workspaceRoot, outputPath);
|
|
91
|
+
}
|
|
92
|
+
// Dynamically lazy-loaded to prevent importing dependencies at the top level.
|
|
93
|
+
const [{ buildAction, createSingleBuildState, hasModifiedWatchedFile }, { createComponentStylesheetBundlerForLibrary },] = await Promise.all([
|
|
94
|
+
Promise.resolve().then(() => __importStar(require('./pipeline/build-action'))),
|
|
95
|
+
Promise.resolve().then(() => __importStar(require('./pipeline/stylesheet-bundler'))),
|
|
96
|
+
]);
|
|
97
|
+
let stylesheetBundler;
|
|
98
|
+
let watcher;
|
|
99
|
+
const buildState = createSingleBuildState();
|
|
100
|
+
try {
|
|
101
|
+
const browsers = (0, supported_browsers_1.getSupportedBrowsers)(projectRoot, logger);
|
|
102
|
+
const target = (0, target_1.transformSupportedBrowsersToTargets)(browsers);
|
|
103
|
+
stylesheetBundler = createComponentStylesheetBundlerForLibrary(normalizedOptions, isWatchMode, target);
|
|
104
|
+
// Track all referenced files for watch mode
|
|
105
|
+
const allWatchedFiles = new Set([
|
|
106
|
+
(0, path_1.toPosixPath)(tsConfigPath),
|
|
107
|
+
(0, path_1.toPosixPath)(packageJsonPath),
|
|
108
|
+
]);
|
|
109
|
+
for (const entryPoint of normalizedOptions.entryPoints.values()) {
|
|
110
|
+
allWatchedFiles.add((0, path_1.toPosixPath)(entryPoint.entryFilePath));
|
|
111
|
+
}
|
|
112
|
+
if (isWatchMode) {
|
|
113
|
+
if (progress) {
|
|
114
|
+
logger.info('Watch mode enabled. Watching for file changes...');
|
|
115
|
+
}
|
|
116
|
+
const { setupWatcher } = await Promise.resolve().then(() => __importStar(require('../../utils/watcher')));
|
|
117
|
+
watcher = await setupWatcher({
|
|
118
|
+
workspaceRoot,
|
|
119
|
+
projectRoot,
|
|
120
|
+
outputPath,
|
|
121
|
+
cacheOptions,
|
|
122
|
+
poll,
|
|
123
|
+
preserveSymlinks,
|
|
124
|
+
signal,
|
|
125
|
+
watchFiles: allWatchedFiles,
|
|
126
|
+
});
|
|
127
|
+
context.addTeardown?.(() => void watcher?.close());
|
|
128
|
+
}
|
|
129
|
+
// Execute initial build
|
|
130
|
+
const initialResult = await executeBuild('Building...', {
|
|
131
|
+
options: normalizedOptions,
|
|
132
|
+
stylesheetBundler,
|
|
133
|
+
allWatchedFiles,
|
|
134
|
+
isWatchMode,
|
|
135
|
+
context,
|
|
136
|
+
buildState,
|
|
137
|
+
}, withProgress, watcher, buildAction);
|
|
138
|
+
yield initialResult;
|
|
139
|
+
if (!isWatchMode || !watcher) {
|
|
140
|
+
return;
|
|
141
|
+
}
|
|
142
|
+
yield* runWatchLoop(watcher, normalizedOptions, stylesheetBundler, allWatchedFiles, context, withProgress, buildState, buildAction, hasModifiedWatchedFile, signal);
|
|
143
|
+
}
|
|
144
|
+
finally {
|
|
145
|
+
(0, profiling_1.logCumulativeDurations)();
|
|
146
|
+
(0, sass_language_1.shutdownSassWorkerPool)();
|
|
147
|
+
await Promise.allSettled([
|
|
148
|
+
watcher?.close(),
|
|
149
|
+
stylesheetBundler?.dispose(),
|
|
150
|
+
buildState.singleProgramCache?.compilationInstance.close?.(),
|
|
151
|
+
]);
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
async function executeBuild(message, actionContext, withProgress, watcher, buildAction) {
|
|
155
|
+
const startTime = process.hrtime.bigint();
|
|
156
|
+
const { context, allWatchedFiles, isWatchMode } = actionContext;
|
|
157
|
+
try {
|
|
158
|
+
await withProgress(message, () => buildAction(actionContext));
|
|
159
|
+
logBuildResult(context.logger, startTime, true);
|
|
160
|
+
if (isWatchMode) {
|
|
161
|
+
(0, profiling_1.logCumulativeDurations)();
|
|
162
|
+
}
|
|
163
|
+
return { success: true };
|
|
164
|
+
}
|
|
165
|
+
catch (error) {
|
|
166
|
+
(0, error_1.assertIsError)(error);
|
|
167
|
+
logBuildResult(context.logger, startTime, false);
|
|
168
|
+
return { success: false, error: error.message };
|
|
169
|
+
}
|
|
170
|
+
finally {
|
|
171
|
+
watcher?.add(Array.from(allWatchedFiles));
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
/**
|
|
175
|
+
* Runs the watch loop, rebuilding the library as watched files are modified.
|
|
176
|
+
*/
|
|
177
|
+
async function* runWatchLoop(watcher, options, stylesheetBundler, allWatchedFiles, context, withProgress, buildState, buildAction, hasModifiedWatchedFile, signal) {
|
|
178
|
+
const { checkAssetChanges } = await Promise.resolve().then(() => __importStar(require('./pipeline/assets')));
|
|
179
|
+
const { workspaceRoot, packageJsonPath, assets, clearScreen } = options;
|
|
180
|
+
const posixPackageJsonPath = (0, path_1.toPosixPath)(packageJsonPath);
|
|
181
|
+
for await (const changes of watcher) {
|
|
182
|
+
if (signal?.aborted) {
|
|
183
|
+
break;
|
|
184
|
+
}
|
|
185
|
+
if (clearScreen) {
|
|
186
|
+
// eslint-disable-next-line no-console
|
|
187
|
+
console.clear();
|
|
188
|
+
}
|
|
189
|
+
const changedFiles = new Set();
|
|
190
|
+
let hasStyleChanges = false;
|
|
191
|
+
let hasSassChanges = false;
|
|
192
|
+
for (const file of changes.all) {
|
|
193
|
+
const posixFile = (0, path_1.toPosixPath)(file);
|
|
194
|
+
changedFiles.add(posixFile);
|
|
195
|
+
if (/\.(?:scss|sass)$/i.test(posixFile)) {
|
|
196
|
+
hasStyleChanges = true;
|
|
197
|
+
hasSassChanges = true;
|
|
198
|
+
}
|
|
199
|
+
else if (/\.(?:less|css)$/i.test(posixFile)) {
|
|
200
|
+
hasStyleChanges = true;
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
if (hasStyleChanges) {
|
|
204
|
+
if (hasSassChanges) {
|
|
205
|
+
(0, sass_language_1.resetSassWorkerPoolCaches)();
|
|
206
|
+
}
|
|
207
|
+
const invalidatedStyles = stylesheetBundler.invalidate(changedFiles);
|
|
208
|
+
if (invalidatedStyles) {
|
|
209
|
+
for (const styleFile of invalidatedStyles) {
|
|
210
|
+
changedFiles.add((0, path_1.toPosixPath)(styleFile));
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
// Check if package.json was modified
|
|
215
|
+
let hasPackageJsonChanges = false;
|
|
216
|
+
if (changedFiles.has(posixPackageJsonPath)) {
|
|
217
|
+
try {
|
|
218
|
+
const packageJson = await loadPackageJson(packageJsonPath);
|
|
219
|
+
options.packageJson = packageJson;
|
|
220
|
+
if (!packageJson.name) {
|
|
221
|
+
throw new Error(`The package.json at '${packageJsonPath}' must contain a 'name'.`);
|
|
222
|
+
}
|
|
223
|
+
options.packageName = packageJson.name;
|
|
224
|
+
(0, entry_points_1.updateWatchedEntryPoints)(packageJson, options, buildState, allWatchedFiles, packageJsonPath);
|
|
225
|
+
hasPackageJsonChanges = true;
|
|
226
|
+
}
|
|
227
|
+
catch (error) {
|
|
228
|
+
(0, error_1.assertIsError)(error);
|
|
229
|
+
await buildState.singleProgramCache?.compilationInstance.update?.(changedFiles);
|
|
230
|
+
buildState.hasEmittedManifests = false;
|
|
231
|
+
yield {
|
|
232
|
+
success: false,
|
|
233
|
+
error: `Failed to reload 'package.json': ${error.message}`,
|
|
234
|
+
};
|
|
235
|
+
continue;
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
const hasSourceChanges = !buildState.singleProgramCache ||
|
|
239
|
+
buildState.hasCompilationError ||
|
|
240
|
+
buildState.hasEntryPointsChanges ||
|
|
241
|
+
hasModifiedWatchedFile(changedFiles, allWatchedFiles, posixPackageJsonPath);
|
|
242
|
+
if (!hasSourceChanges &&
|
|
243
|
+
!hasPackageJsonChanges &&
|
|
244
|
+
!checkAssetChanges(assets, workspaceRoot, changedFiles)) {
|
|
245
|
+
continue;
|
|
246
|
+
}
|
|
247
|
+
yield await executeBuild('Changes detected. Rebuilding...', {
|
|
248
|
+
options,
|
|
249
|
+
stylesheetBundler,
|
|
250
|
+
allWatchedFiles,
|
|
251
|
+
isWatchMode: true,
|
|
252
|
+
context,
|
|
253
|
+
buildState,
|
|
254
|
+
modifiedFiles: changedFiles,
|
|
255
|
+
}, withProgress, watcher, buildAction);
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
/**
|
|
259
|
+
* Loads and parses a JSON file from disk.
|
|
260
|
+
*/
|
|
261
|
+
async function loadPackageJson(packageJsonPath) {
|
|
262
|
+
const content = await promises_1.default.readFile(packageJsonPath, 'utf-8');
|
|
263
|
+
return JSON.parse(content);
|
|
264
|
+
}
|
|
265
|
+
/**
|
|
266
|
+
* Logs the build completion time and status.
|
|
267
|
+
*/
|
|
268
|
+
function logBuildResult(logger, startTime, success) {
|
|
269
|
+
const durationMs = Number(process.hrtime.bigint() - startTime) / 1_000_000;
|
|
270
|
+
const durationSec = (durationMs / 1000).toFixed(2);
|
|
271
|
+
if (success) {
|
|
272
|
+
logger.info(`Build at: ${new Date().toISOString()} - Time: ${durationMs.toFixed(0)}ms`);
|
|
273
|
+
logger.info(`Built Angular library in ${durationSec}s.`);
|
|
274
|
+
}
|
|
275
|
+
else {
|
|
276
|
+
logger.error(`Build failed after ${durationSec}s.`);
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
//# sourceMappingURL=builder.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"builder.js","sourceRoot":"","sources":["builder.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiCH,sDA+IC;AA5KD,gEA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,OAAO,EACP,WAAW,CACZ,CAAC;IACJ,CAAC;AACH,CAAC;AAED;;GAEG;AACH,KAAK,UAAU,eAAe,CAAC,eAAuB;IACpD,MAAM,OAAO,GAAG,MAAM,kBAAE,CAAC,QAAQ,CAAC,eAAe,EAAE,OAAO,CAAC,CAAC;IAE5D,OAAO,IAAI,CAAC,KAAK,CAAC,OAAO,CAAoB,CAAC;AAChD,CAAC;AAED;;GAEG;AACH,SAAS,cAAc,CAAC,MAAyB,EAAE,SAAiB,EAAE,OAAgB;IACpF,MAAM,UAAU,GAAG,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,GAAG,SAAS,CAAC,GAAG,SAAS,CAAC;IAC3E,MAAM,WAAW,GAAG,CAAC,UAAU,GAAG,IAAI,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;IAEnD,IAAI,OAAO,EAAE,CAAC;QACZ,MAAM,CAAC,IAAI,CAAC,aAAa,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,YAAY,UAAU,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;QACxF,MAAM,CAAC,IAAI,CAAC,4BAA4B,WAAW,IAAI,CAAC,CAAC;IAC3D,CAAC;SAAM,CAAC;QACN,MAAM,CAAC,KAAK,CAAC,sBAAsB,WAAW,IAAI,CAAC,CAAC;IACtD,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
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 { Builder } from '@angular-devkit/architect';
|
|
9
|
+
import { executeLibraryBuilder } from './builder';
|
|
10
|
+
import type { Schema as LibraryBuilderOptions } from './schema';
|
|
11
|
+
export { type LibraryBuilderOptions, executeLibraryBuilder, executeLibraryBuilder as execute };
|
|
12
|
+
declare const builder: Builder<LibraryBuilderOptions>;
|
|
13
|
+
export default builder;
|
|
@@ -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,116 @@
|
|
|
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 path_1 = require("../../utils/path");
|
|
21
|
+
const postcss_configuration_1 = require("../../utils/postcss-configuration");
|
|
22
|
+
const project_metadata_1 = require("../../utils/project-metadata");
|
|
23
|
+
const entry_points_1 = require("./pipeline/entry-points");
|
|
24
|
+
async function normalizeLibraryOptions(context, projectName, options) {
|
|
25
|
+
const { workspaceRoot } = context;
|
|
26
|
+
const projectMetadata = await context.getProjectMetadata(projectName);
|
|
27
|
+
const { projectRoot, projectSourceRoot } = (0, project_metadata_1.getProjectRootPaths)(workspaceRoot, projectMetadata);
|
|
28
|
+
const outputPath = options.outputPath ?? node_path_1.default.join(workspaceRoot, 'dist', projectName);
|
|
29
|
+
const resolvedOutputPath = node_path_1.default.resolve(workspaceRoot, outputPath);
|
|
30
|
+
if (resolvedOutputPath === projectRoot ||
|
|
31
|
+
(0, path_1.isSubDirectory)(resolvedOutputPath, projectRoot) ||
|
|
32
|
+
(0, path_1.isSubDirectory)(projectRoot, resolvedOutputPath)) {
|
|
33
|
+
throw new Error(`The 'outputPath' (${resolvedOutputPath}) cannot be the project root, ` +
|
|
34
|
+
`contain the project root, or be located within the project root.`);
|
|
35
|
+
}
|
|
36
|
+
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;
|
|
37
|
+
const resolvedTsConfigPath = node_path_1.default.resolve(workspaceRoot, tsConfig);
|
|
38
|
+
const packageJsonPath = node_path_1.default.join(projectRoot, 'package.json');
|
|
39
|
+
let packageJson;
|
|
40
|
+
try {
|
|
41
|
+
const packageJsonContent = await promises_1.default.readFile(packageJsonPath, 'utf8');
|
|
42
|
+
packageJson = JSON.parse(packageJsonContent);
|
|
43
|
+
}
|
|
44
|
+
catch (error) {
|
|
45
|
+
(0, error_1.assertIsError)(error);
|
|
46
|
+
throw new Error(`Failed to read 'package.json' at '${packageJsonPath}': ${error.message}`, {
|
|
47
|
+
cause: error,
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
const { name: packageName } = packageJson;
|
|
51
|
+
if (!packageName) {
|
|
52
|
+
throw new Error(`The package.json at '${packageJsonPath}' must contain a 'name'.`);
|
|
53
|
+
}
|
|
54
|
+
const entryPoints = (0, entry_points_1.normalizeEntryPoints)(packageJson.exports, projectRoot, packageJsonPath, packageName);
|
|
55
|
+
const allowedNonPeerDependencies = [/^tslib$/];
|
|
56
|
+
for (const pattern of rawAllowedNonPeerDependencies) {
|
|
57
|
+
try {
|
|
58
|
+
allowedNonPeerDependencies.push(new RegExp(pattern));
|
|
59
|
+
}
|
|
60
|
+
catch (error) {
|
|
61
|
+
(0, error_1.assertIsError)(error);
|
|
62
|
+
throw new Error(`Invalid regular expression '${pattern}' in 'allowedNonPeerDependencies' for project '${projectName}': ${error.message}`, { cause: error });
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
const defaultAssets = [
|
|
66
|
+
{ glob: 'LICENSE*', input: projectRoot, output: '.' },
|
|
67
|
+
{ glob: 'README.md', input: projectRoot, output: '.' },
|
|
68
|
+
];
|
|
69
|
+
for (const entryPoint of entryPoints.values()) {
|
|
70
|
+
if (entryPoint.isPrimary) {
|
|
71
|
+
continue;
|
|
72
|
+
}
|
|
73
|
+
defaultAssets.push({
|
|
74
|
+
glob: 'README.md',
|
|
75
|
+
input: node_path_1.default.dirname(entryPoint.entryFilePath),
|
|
76
|
+
output: entryPoint.name,
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
const assets = (0, utils_1.normalizeAssetPatterns)([...defaultAssets, ...(rawAssets ?? [])], workspaceRoot, projectRoot, projectSourceRoot);
|
|
80
|
+
const cacheOptions = (0, normalize_cache_1.normalizeCacheOptions)(projectMetadata, workspaceRoot);
|
|
81
|
+
const styleIncludePaths = (stylePreprocessorOptions?.includePaths ?? []).map((p) => node_path_1.default.resolve(workspaceRoot, p));
|
|
82
|
+
const searchDirectories = await (0, postcss_configuration_1.generateSearchDirectories)([projectRoot, workspaceRoot]);
|
|
83
|
+
const postcssConfiguration = await (0, postcss_configuration_1.loadPostcssConfiguration)(searchDirectories);
|
|
84
|
+
const tailwindConfiguration = postcssConfiguration
|
|
85
|
+
? undefined
|
|
86
|
+
: await (0, postcss_configuration_1.getTailwindConfig)(searchDirectories, workspaceRoot, context.logger);
|
|
87
|
+
return {
|
|
88
|
+
workspaceRoot,
|
|
89
|
+
projectRoot,
|
|
90
|
+
packageName,
|
|
91
|
+
packageJson,
|
|
92
|
+
outputPath: resolvedOutputPath,
|
|
93
|
+
deleteOutputPath,
|
|
94
|
+
packageJsonPath,
|
|
95
|
+
tsConfigPath: resolvedTsConfigPath,
|
|
96
|
+
entryPoints,
|
|
97
|
+
inlineStyleLanguage,
|
|
98
|
+
styleIncludePaths,
|
|
99
|
+
sass: stylePreprocessorOptions?.sass,
|
|
100
|
+
assets,
|
|
101
|
+
compilationMode,
|
|
102
|
+
declarationMap,
|
|
103
|
+
allowedNonPeerDependencies,
|
|
104
|
+
keepLifecycleScripts,
|
|
105
|
+
watch,
|
|
106
|
+
poll,
|
|
107
|
+
preserveSymlinks,
|
|
108
|
+
progress,
|
|
109
|
+
clearScreen,
|
|
110
|
+
cacheOptions,
|
|
111
|
+
colors: (0, color_1.supportColor)(),
|
|
112
|
+
postcssConfiguration,
|
|
113
|
+
tailwindConfiguration,
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
//# sourceMappingURL=options.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"options.js","sourceRoot":"","sources":["options.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;;;AAqBH,0DA6IC;AA/JD,gEAAkC;AAClC,0DAA6B;AAE7B,uCAAqD;AACrD,6CAAiD;AACjD,6CAAkD;AAClD,iEAAoE;AACpE,2CAAkD;AAClD,6EAI2C;AAC3C,mEAAmE;AACnE,0DAA+D;AAIxD,KAAK,UAAU,uBAAuB,CAC3C,OAAuB,EACvB,WAAmB,EACnB,OAA8B;IAE9B,MAAM,EAAE,aAAa,EAAE,GAAG,OAAO,CAAC;IAClC,MAAM,eAAe,GAAG,MAAM,OAAO,CAAC,kBAAkB,CAAC,WAAW,CAAC,CAAC;IACtE,MAAM,EAAE,WAAW,EAAE,iBAAiB,EAAE,GAAG,IAAA,sCAAmB,EAAC,aAAa,EAAE,eAAe,CAAC,CAAC;IAE/F,MAAM,UAAU,GAAG,OAAO,CAAC,UAAU,IAAI,mBAAI,CAAC,IAAI,CAAC,aAAa,EAAE,MAAM,EAAE,WAA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oB;QACpB,qBAAqB;KACtB,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
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
|
+
* and registers their source paths with the watch set.
|
|
13
|
+
*
|
|
14
|
+
* @param assets The normalized asset patterns.
|
|
15
|
+
* @param workspaceRoot The workspace root directory path.
|
|
16
|
+
* @param allWatchedFiles Set collecting all watched file paths for watch mode.
|
|
17
|
+
* @param modifiedFiles Optional set of modified file paths for incremental copying in watch mode.
|
|
18
|
+
* @returns An array of disk file emission descriptors.
|
|
19
|
+
*/
|
|
20
|
+
export declare function collectAssetsToEmit(assets: NormalizedLibraryOptions['assets'], workspaceRoot: string, allWatchedFiles: Set<string>, modifiedFiles?: ReadonlySet<string>): Promise<DiskOutputFile[]>;
|
|
21
|
+
/**
|
|
22
|
+
* Checks whether any configured library assets were modified.
|
|
23
|
+
*
|
|
24
|
+
* @param assets The normalized asset patterns.
|
|
25
|
+
* @param workspaceRoot The workspace root directory path.
|
|
26
|
+
* @param changedFiles Set of changed file paths.
|
|
27
|
+
* @returns True if any asset file was modified.
|
|
28
|
+
*/
|
|
29
|
+
export declare function checkAssetChanges(assets: NormalizedLibraryOptions['assets'], workspaceRoot: string, changedFiles: ReadonlySet<string>): boolean;
|