@angular/build 22.3.0-next.0 → 22.3.0-next.2
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 +13 -13
- package/src/builders/application/build-action.js +2 -2
- package/src/builders/application/build-action.js.map +1 -1
- package/src/builders/application/chunk-optimizer.js +2 -1
- package/src/builders/application/chunk-optimizer.js.map +1 -1
- package/src/builders/application/index.js +8 -31
- package/src/builders/application/index.js.map +1 -1
- package/src/builders/application/options.d.ts +1 -3
- package/src/builders/application/options.js +2 -3
- package/src/builders/application/options.js.map +1 -1
- package/src/builders/application/results.d.ts +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/dev-server/vite/utils.js +1 -1
- package/src/builders/dev-server/vite/utils.js.map +1 -1
- package/src/builders/extract-i18n/application-extraction.js +2 -1
- package/src/builders/extract-i18n/application-extraction.js.map +1 -1
- package/src/builders/karma/assets-middleware.js +1 -1
- package/src/builders/karma/assets-middleware.js.map +1 -1
- package/src/builders/library/builder-state.d.ts +115 -0
- package/src/builders/library/builder-state.js +282 -0
- package/src/builders/library/builder-state.js.map +1 -0
- package/src/builders/library/builder.js +110 -92
- package/src/builders/library/builder.js.map +1 -1
- package/src/builders/library/execution-result.d.ts +35 -0
- package/src/builders/library/execution-result.js +67 -0
- package/src/builders/library/execution-result.js.map +1 -0
- package/src/builders/library/index.d.ts +1 -1
- package/src/builders/library/index.js.map +1 -1
- package/src/builders/library/options.d.ts +9 -0
- package/src/builders/library/options.js +29 -23
- package/src/builders/library/options.js.map +1 -1
- package/src/builders/library/pipeline/assets.d.ts +5 -16
- package/src/builders/library/pipeline/assets.js +16 -59
- package/src/builders/library/pipeline/assets.js.map +1 -1
- package/src/builders/library/pipeline/build-action.d.ts +21 -13
- package/src/builders/library/pipeline/build-action.js +76 -124
- package/src/builders/library/pipeline/build-action.js.map +1 -1
- package/src/builders/library/pipeline/bundler.d.ts +5 -3
- package/src/builders/library/pipeline/bundler.js +123 -43
- package/src/builders/library/pipeline/bundler.js.map +1 -1
- package/src/builders/library/pipeline/compilation.d.ts +7 -26
- package/src/builders/library/pipeline/compilation.js +59 -69
- package/src/builders/library/pipeline/compilation.js.map +1 -1
- package/src/builders/library/pipeline/entry-points.d.ts +26 -6
- package/src/builders/library/pipeline/entry-points.js +82 -21
- package/src/builders/library/pipeline/entry-points.js.map +1 -1
- package/src/builders/library/pipeline/package-manifests.d.ts +2 -1
- package/src/builders/library/pipeline/package-manifests.js +50 -1
- package/src/builders/library/pipeline/package-manifests.js.map +1 -1
- package/src/builders/library/pipeline/stylesheet-bundler.d.ts +4 -1
- package/src/builders/library/pipeline/stylesheet-bundler.js +1 -1
- package/src/builders/library/pipeline/stylesheet-bundler.js.map +1 -1
- package/src/builders/library/pipeline/utils.d.ts +19 -11
- package/src/builders/library/pipeline/utils.js +27 -11
- package/src/builders/library/pipeline/utils.js.map +1 -1
- package/src/builders/library/schema.json +2 -4
- package/src/builders/library/types.d.ts +62 -22
- 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 +1 -1
- package/src/builders/unit-test/builder.js.map +1 -1
- package/src/builders/unit-test/options.js +1 -2
- package/src/builders/unit-test/options.js.map +1 -1
- package/src/builders/unit-test/runners/vitest/executor.js +0 -5
- package/src/builders/unit-test/runners/vitest/executor.js.map +1 -1
- package/src/builders/unit-test/runners/vitest/plugins.js +13 -1
- package/src/builders/unit-test/runners/vitest/plugins.js.map +1 -1
- package/src/builders/unit-test/test-discovery.js +4 -2
- package/src/builders/unit-test/test-discovery.js.map +1 -1
- package/src/private.d.ts +1 -1
- package/src/private.js +3 -3
- package/src/private.js.map +1 -1
- package/src/tools/angular/angular-host.d.ts +1 -1
- package/src/tools/angular/angular-host.js +5 -2
- package/src/tools/angular/angular-host.js.map +1 -1
- package/src/tools/angular/compilation/angular-compilation.d.ts +1 -0
- package/src/tools/angular/compilation/angular-compilation.js.map +1 -1
- package/src/tools/angular/compilation/aot-compilation.js +325 -80
- package/src/tools/angular/compilation/aot-compilation.js.map +1 -1
- package/src/tools/angular/compilation/compiler-options.js +4 -1
- package/src/tools/angular/compilation/compiler-options.js.map +1 -1
- package/src/tools/angular/compilation/jit-compilation.js +5 -4
- package/src/tools/angular/compilation/jit-compilation.js.map +1 -1
- package/src/tools/angular/compilation/parallel-worker.js +1 -0
- package/src/tools/angular/compilation/parallel-worker.js.map +1 -1
- package/src/tools/angular/compilation/typescript-compilation.d.ts +2 -0
- package/src/tools/angular/compilation/typescript-compilation.js +44 -5
- package/src/tools/angular/compilation/typescript-compilation.js.map +1 -1
- package/src/tools/esbuild/bundler-context.js +5 -1
- package/src/tools/esbuild/bundler-context.js.map +1 -1
- package/src/tools/esbuild/persistent-load-result-cache.js +2 -4
- package/src/tools/esbuild/persistent-load-result-cache.js.map +1 -1
- package/src/tools/esbuild/utils.d.ts +1 -2
- package/src/tools/esbuild/utils.js +0 -13
- package/src/tools/esbuild/utils.js.map +1 -1
- package/src/tools/sass/rebasing-importer.d.ts +1 -1
- package/src/tools/sass/rebasing-importer.js +6 -3
- package/src/tools/sass/rebasing-importer.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/utils/concurrency.d.ts +4 -0
- package/src/utils/concurrency.js +5 -0
- package/src/utils/concurrency.js.map +1 -1
- package/src/utils/delete-output-dir.js +3 -2
- package/src/utils/delete-output-dir.js.map +1 -1
- package/src/utils/disk-files.d.ts +30 -0
- package/src/utils/disk-files.js +68 -0
- package/src/utils/disk-files.js.map +1 -0
- package/src/utils/index-file/nonce.d.ts +2 -1
- package/src/utils/index-file/nonce.js +22 -4
- package/src/utils/index-file/nonce.js.map +1 -1
- package/src/utils/load-proxy-config.js +12 -10
- package/src/utils/load-proxy-config.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-asset-patterns.d.ts +18 -3
- package/src/utils/normalize-asset-patterns.js +34 -67
- package/src/utils/normalize-asset-patterns.js.map +1 -1
- 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/postcss-configuration.d.ts +2 -2
- package/src/utils/postcss-configuration.js +3 -3
- package/src/utils/postcss-configuration.js.map +1 -1
- package/src/utils/resolve-assets.js +28 -9
- package/src/utils/resolve-assets.js.map +1 -1
- package/src/utils/server-rendering/esm-in-memory-loader/loader-hooks.d.ts +1 -1
- package/src/utils/server-rendering/esm-in-memory-loader/loader-hooks.js +3 -3
- package/src/utils/server-rendering/esm-in-memory-loader/loader-hooks.js.map +1 -1
- package/src/utils/server-rendering/esm-in-memory-loader/register-hooks.js +3 -2
- package/src/utils/server-rendering/esm-in-memory-loader/register-hooks.js.map +1 -1
- package/src/utils/test-files.js +5 -57
- package/src/utils/test-files.js.map +1 -1
- package/src/utils/watcher.d.ts +53 -0
- package/src/utils/watcher.js +404 -76
- package/src/utils/watcher.js.map +1 -1
- package/src/builders/library/pipeline/types.d.ts +0 -54
|
@@ -39,12 +39,8 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
39
39
|
return result;
|
|
40
40
|
};
|
|
41
41
|
})();
|
|
42
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
43
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
44
|
-
};
|
|
45
42
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
46
43
|
exports.executeLibraryBuilder = executeLibraryBuilder;
|
|
47
|
-
const promises_1 = __importDefault(require("node:fs/promises"));
|
|
48
44
|
const sass_language_1 = require("../../tools/esbuild/stylesheets/sass-language");
|
|
49
45
|
const target_1 = require("../../tools/esbuild/target");
|
|
50
46
|
const utils_1 = require("../../tools/esbuild/utils");
|
|
@@ -56,8 +52,10 @@ const profiling_1 = require("../../utils/profiling");
|
|
|
56
52
|
const purge_cache_1 = require("../../utils/purge-cache");
|
|
57
53
|
const supported_browsers_1 = require("../../utils/supported-browsers");
|
|
58
54
|
const version_1 = require("../../utils/version");
|
|
55
|
+
const builder_state_1 = require("./builder-state");
|
|
59
56
|
const options_1 = require("./options");
|
|
60
57
|
const entry_points_1 = require("./pipeline/entry-points");
|
|
58
|
+
const utils_2 = require("./pipeline/utils");
|
|
61
59
|
/**
|
|
62
60
|
* Executes the library builder to compile, bundle, and package an Angular library into the Angular Package Format (APF).
|
|
63
61
|
*
|
|
@@ -67,16 +65,18 @@ const entry_points_1 = require("./pipeline/entry-points");
|
|
|
67
65
|
*/
|
|
68
66
|
async function* executeLibraryBuilder(options, context) {
|
|
69
67
|
(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
68
|
const projectName = context.target?.project;
|
|
74
69
|
if (!projectName) {
|
|
75
70
|
yield { success: false, error: 'The library builder requires a target.' };
|
|
76
71
|
return;
|
|
77
72
|
}
|
|
78
|
-
const normalizedOptions = await
|
|
79
|
-
|
|
73
|
+
const [normalizedOptions] = await Promise.all([
|
|
74
|
+
(0, options_1.normalizeLibraryOptions)(context, projectName, options),
|
|
75
|
+
(0, hash_1.initializeHash)(),
|
|
76
|
+
// Purge old build disk cache
|
|
77
|
+
(0, purge_cache_1.purgeStaleBuildCache)(context),
|
|
78
|
+
]);
|
|
79
|
+
const { workspaceRoot, projectRoot, outputPath, deleteOutputPath, watch: isWatchMode, poll, cacheOptions, preserveSymlinks, progress, } = normalizedOptions;
|
|
80
80
|
let signal = context.signal;
|
|
81
81
|
if (!signal) {
|
|
82
82
|
const controller = new AbortController();
|
|
@@ -90,29 +90,18 @@ async function* executeLibraryBuilder(options, context) {
|
|
|
90
90
|
await (0, delete_output_dir_1.deleteOutputDir)(workspaceRoot, outputPath);
|
|
91
91
|
}
|
|
92
92
|
// Dynamically lazy-loaded to prevent importing dependencies at the top level.
|
|
93
|
-
const [{ buildAction
|
|
93
|
+
const [{ buildAction }, { createComponentStylesheetBundlerForLibrary }] = await Promise.all([
|
|
94
94
|
Promise.resolve().then(() => __importStar(require('./pipeline/build-action'))),
|
|
95
95
|
Promise.resolve().then(() => __importStar(require('./pipeline/stylesheet-bundler'))),
|
|
96
96
|
]);
|
|
97
97
|
let stylesheetBundler;
|
|
98
98
|
let watcher;
|
|
99
|
-
const buildState =
|
|
99
|
+
const buildState = new builder_state_1.BuilderState(normalizedOptions);
|
|
100
100
|
try {
|
|
101
101
|
const browsers = (0, supported_browsers_1.getSupportedBrowsers)(projectRoot, logger);
|
|
102
102
|
const target = (0, target_1.transformSupportedBrowsersToTargets)(browsers);
|
|
103
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
104
|
if (isWatchMode) {
|
|
113
|
-
if (progress) {
|
|
114
|
-
logger.info('Watch mode enabled. Watching for file changes...');
|
|
115
|
-
}
|
|
116
105
|
const { setupWatcher } = await Promise.resolve().then(() => __importStar(require('../../utils/watcher')));
|
|
117
106
|
watcher = await setupWatcher({
|
|
118
107
|
workspaceRoot,
|
|
@@ -122,7 +111,10 @@ async function* executeLibraryBuilder(options, context) {
|
|
|
122
111
|
poll,
|
|
123
112
|
preserveSymlinks,
|
|
124
113
|
signal,
|
|
125
|
-
watchFiles:
|
|
114
|
+
watchFiles: [
|
|
115
|
+
...buildState.watchedCompilationFiles,
|
|
116
|
+
...normalizedOptions.assets.map((asset) => asset.input),
|
|
117
|
+
],
|
|
126
118
|
});
|
|
127
119
|
context.addTeardown?.(() => void watcher?.close());
|
|
128
120
|
}
|
|
@@ -130,16 +122,17 @@ async function* executeLibraryBuilder(options, context) {
|
|
|
130
122
|
const initialResult = await executeBuild('Building...', {
|
|
131
123
|
options: normalizedOptions,
|
|
132
124
|
stylesheetBundler,
|
|
133
|
-
allWatchedFiles,
|
|
134
125
|
isWatchMode,
|
|
135
|
-
context,
|
|
136
126
|
buildState,
|
|
137
|
-
}, withProgress, watcher, buildAction);
|
|
127
|
+
}, logger, withProgress, watcher, buildAction);
|
|
128
|
+
if (isWatchMode && progress) {
|
|
129
|
+
logger.info('Watch mode enabled. Watching for file changes...');
|
|
130
|
+
}
|
|
138
131
|
yield initialResult;
|
|
139
132
|
if (!isWatchMode || !watcher) {
|
|
140
133
|
return;
|
|
141
134
|
}
|
|
142
|
-
yield* runWatchLoop(watcher, normalizedOptions, stylesheetBundler,
|
|
135
|
+
yield* runWatchLoop(watcher, normalizedOptions, stylesheetBundler, logger, withProgress, buildState, buildAction, signal);
|
|
143
136
|
}
|
|
144
137
|
finally {
|
|
145
138
|
(0, profiling_1.logCumulativeDurations)();
|
|
@@ -147,87 +140,96 @@ async function* executeLibraryBuilder(options, context) {
|
|
|
147
140
|
await Promise.allSettled([
|
|
148
141
|
watcher?.close(),
|
|
149
142
|
stylesheetBundler?.dispose(),
|
|
150
|
-
buildState.
|
|
143
|
+
buildState.dispose(),
|
|
151
144
|
]);
|
|
152
145
|
}
|
|
153
146
|
}
|
|
154
|
-
|
|
147
|
+
/**
|
|
148
|
+
* Executes a single build iteration with progress reporting, logs any resulting
|
|
149
|
+
* messages, and registers newly discovered files with the watcher.
|
|
150
|
+
*
|
|
151
|
+
* @param message Progress spinner message to display while building.
|
|
152
|
+
* @param actionContext The build action context and state.
|
|
153
|
+
* @param logger The Architect logger API.
|
|
154
|
+
* @param withProgress Progress wrapper function (`withSpinner` or `withNoProgress`).
|
|
155
|
+
* @param watcher Optional file watcher for watch mode.
|
|
156
|
+
* @param buildAction The library build action function to execute.
|
|
157
|
+
* @returns A promise resolving to the Architect `BuilderOutput`.
|
|
158
|
+
*/
|
|
159
|
+
async function executeBuild(message, actionContext, logger, withProgress, watcher, buildAction) {
|
|
155
160
|
const startTime = process.hrtime.bigint();
|
|
156
|
-
const {
|
|
161
|
+
const { buildState, isWatchMode, options } = actionContext;
|
|
157
162
|
try {
|
|
158
|
-
await withProgress(message, () => buildAction(actionContext));
|
|
159
|
-
|
|
160
|
-
|
|
163
|
+
const result = await withProgress(message, () => buildAction(actionContext));
|
|
164
|
+
logMessages(logger, result);
|
|
165
|
+
const { output } = result;
|
|
166
|
+
logBuildResult(logger, startTime, output.success, options.outputPath);
|
|
167
|
+
if (output.success && isWatchMode) {
|
|
161
168
|
(0, profiling_1.logCumulativeDurations)();
|
|
162
169
|
}
|
|
163
|
-
return
|
|
170
|
+
return output;
|
|
164
171
|
}
|
|
165
172
|
catch (error) {
|
|
166
173
|
(0, error_1.assertIsError)(error);
|
|
167
|
-
logBuildResult(
|
|
174
|
+
logBuildResult(logger, startTime, false);
|
|
168
175
|
return { success: false, error: error.message };
|
|
169
176
|
}
|
|
170
177
|
finally {
|
|
171
|
-
watcher
|
|
178
|
+
if (watcher) {
|
|
179
|
+
watcher.add(Array.from(buildState.watchedCompilationFiles));
|
|
180
|
+
const { assetsToEmit } = actionContext;
|
|
181
|
+
if (assetsToEmit?.length) {
|
|
182
|
+
watcher.add(assetsToEmit.map((asset) => asset.source));
|
|
183
|
+
}
|
|
184
|
+
}
|
|
172
185
|
}
|
|
173
186
|
}
|
|
174
187
|
/**
|
|
175
188
|
* Runs the watch loop, rebuilding the library as watched files are modified.
|
|
189
|
+
*
|
|
190
|
+
* @param watcher The file watcher instance.
|
|
191
|
+
* @param options The normalized library builder options with POSIX paths.
|
|
192
|
+
* @param stylesheetBundler The component stylesheet bundler instance.
|
|
193
|
+
* @param logger The Architect logger API.
|
|
194
|
+
* @param withProgress Progress wrapper function (`withSpinner` or `withNoProgress`).
|
|
195
|
+
* @param buildState The state preserved across incremental builds.
|
|
196
|
+
* @param buildAction The library build action function to execute.
|
|
197
|
+
* @param signal Abort signal to terminate the watch loop.
|
|
198
|
+
* @returns An async iterator yielding builder output results.
|
|
176
199
|
*/
|
|
177
|
-
async function* runWatchLoop(watcher, options, stylesheetBundler,
|
|
178
|
-
const {
|
|
200
|
+
async function* runWatchLoop(watcher, options, stylesheetBundler, logger, withProgress, buildState, buildAction, signal) {
|
|
201
|
+
const { collectAssetsToEmit } = await Promise.resolve().then(() => __importStar(require('./pipeline/assets')));
|
|
179
202
|
const { workspaceRoot, packageJsonPath, assets, clearScreen } = options;
|
|
180
|
-
const posixPackageJsonPath = (0, path_1.toPosixPath)(packageJsonPath);
|
|
181
203
|
for await (const changes of watcher) {
|
|
182
|
-
if (signal
|
|
204
|
+
if (signal.aborted) {
|
|
183
205
|
break;
|
|
184
206
|
}
|
|
185
207
|
if (clearScreen) {
|
|
186
208
|
// eslint-disable-next-line no-console
|
|
187
209
|
console.clear();
|
|
188
210
|
}
|
|
189
|
-
const
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
for (const
|
|
193
|
-
const posixFile = (0, path_1.toPosixPath)(file);
|
|
194
|
-
changedFiles.add(posixFile);
|
|
211
|
+
const rawChangedFiles = changes.all.map(path_1.toPosixPath);
|
|
212
|
+
stylesheetBundler.invalidate(rawChangedFiles);
|
|
213
|
+
const changedFiles = buildState.getAffectedFiles(rawChangedFiles);
|
|
214
|
+
for (const posixFile of changedFiles) {
|
|
195
215
|
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
216
|
(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
|
-
}
|
|
217
|
+
break;
|
|
212
218
|
}
|
|
213
219
|
}
|
|
214
220
|
// Check if package.json was modified
|
|
215
|
-
|
|
216
|
-
|
|
221
|
+
if (changedFiles.has(packageJsonPath)) {
|
|
222
|
+
buildState.hasEmittedManifests = false;
|
|
217
223
|
try {
|
|
218
|
-
const packageJson = await loadPackageJson(packageJsonPath);
|
|
219
|
-
|
|
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;
|
|
224
|
+
const packageJson = await (0, utils_2.loadPackageJson)(packageJsonPath);
|
|
225
|
+
(0, entry_points_1.updateWatchedEntryPoints)(packageJson, options, buildState);
|
|
226
226
|
}
|
|
227
227
|
catch (error) {
|
|
228
228
|
(0, error_1.assertIsError)(error);
|
|
229
229
|
await buildState.singleProgramCache?.compilationInstance.update?.(changedFiles);
|
|
230
|
-
buildState.
|
|
230
|
+
if (buildState.shouldCompileEntryPoints(packageJsonPath, changedFiles)) {
|
|
231
|
+
buildState.hasCompilationError = true;
|
|
232
|
+
}
|
|
231
233
|
yield {
|
|
232
234
|
success: false,
|
|
233
235
|
error: `Failed to reload 'package.json': ${error.message}`,
|
|
@@ -235,45 +237,61 @@ async function* runWatchLoop(watcher, options, stylesheetBundler, allWatchedFile
|
|
|
235
237
|
continue;
|
|
236
238
|
}
|
|
237
239
|
}
|
|
238
|
-
const hasSourceChanges =
|
|
239
|
-
|
|
240
|
-
buildState.
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
!checkAssetChanges(assets, workspaceRoot, changedFiles)) {
|
|
240
|
+
const hasSourceChanges = buildState.shouldCompileEntryPoints(packageJsonPath, changedFiles);
|
|
241
|
+
if (!hasSourceChanges) {
|
|
242
|
+
await buildState.singleProgramCache?.compilationInstance.update?.(changedFiles);
|
|
243
|
+
}
|
|
244
|
+
const assetsToEmit = await collectAssetsToEmit(assets, workspaceRoot, buildState.hasEmittedAssets ? changedFiles : undefined);
|
|
245
|
+
if (!hasSourceChanges && buildState.hasEmittedManifests && assetsToEmit.length === 0) {
|
|
245
246
|
continue;
|
|
246
247
|
}
|
|
247
248
|
yield await executeBuild('Changes detected. Rebuilding...', {
|
|
248
249
|
options,
|
|
249
250
|
stylesheetBundler,
|
|
250
|
-
allWatchedFiles,
|
|
251
251
|
isWatchMode: true,
|
|
252
|
-
context,
|
|
253
252
|
buildState,
|
|
254
253
|
modifiedFiles: changedFiles,
|
|
255
|
-
|
|
254
|
+
assetsToEmit,
|
|
255
|
+
}, logger, withProgress, watcher, buildAction);
|
|
256
256
|
}
|
|
257
257
|
}
|
|
258
258
|
/**
|
|
259
|
-
*
|
|
259
|
+
* Logs informational, warning, and error messages produced during a build iteration.
|
|
260
|
+
*
|
|
261
|
+
* @param logger The Architect logger API.
|
|
262
|
+
* @param result The build execution result containing logs, warnings, and errors.
|
|
260
263
|
*/
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
+
function logMessages(logger, { logs, warnings, errors }) {
|
|
265
|
+
if (logs.length) {
|
|
266
|
+
logger.info(logs.join('\n'));
|
|
267
|
+
}
|
|
268
|
+
if (warnings.length) {
|
|
269
|
+
logger.warn(warnings.join('\n'));
|
|
270
|
+
}
|
|
271
|
+
if (errors.length) {
|
|
272
|
+
logger.error(errors.join('\n'));
|
|
273
|
+
}
|
|
264
274
|
}
|
|
265
275
|
/**
|
|
266
276
|
* Logs the build completion time and status.
|
|
277
|
+
*
|
|
278
|
+
* @param logger The Architect logger API.
|
|
279
|
+
* @param startTime High-resolution timestamp recorded when the build iteration started.
|
|
280
|
+
* @param success Whether the build iteration succeeded without errors.
|
|
281
|
+
* @param outputPath Optional POSIX output directory path to log on successful builds.
|
|
267
282
|
*/
|
|
268
|
-
function logBuildResult(logger, startTime, success) {
|
|
269
|
-
const
|
|
270
|
-
const
|
|
283
|
+
function logBuildResult(logger, startTime, success, outputPath) {
|
|
284
|
+
const buildTime = Number(process.hrtime.bigint() - startTime) / 10 ** 9;
|
|
285
|
+
const message = `Library bundle generation ${success ? 'complete' : 'failed'}.` +
|
|
286
|
+
` [${buildTime.toFixed(3)} seconds] - ${new Date().toISOString()}`;
|
|
271
287
|
if (success) {
|
|
272
|
-
logger.info(
|
|
273
|
-
|
|
288
|
+
logger.info(message);
|
|
289
|
+
if (outputPath) {
|
|
290
|
+
logger.info(`Output location: ${outputPath}\n`);
|
|
291
|
+
}
|
|
274
292
|
}
|
|
275
293
|
else {
|
|
276
|
-
logger.error(
|
|
294
|
+
logger.error(message);
|
|
277
295
|
}
|
|
278
296
|
}
|
|
279
297
|
//# sourceMappingURL=builder.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"builder.js","sourceRoot":"","sources":["builder.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG
|
|
1
|
+
{"version":3,"file":"builder.js","sourceRoot":"","sources":["builder.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoCH,sDAmIC;AAlKD,iFAGuD;AACvD,uDAAiF;AACjF,qDAAwE;AACxE,qEAAgE;AAChE,6CAA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AAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;IAClC,CAAC;AACH,CAAC;AAED;;;;;;;GAOG;AACH,SAAS,cAAc,CACrB,MAAyB,EACzB,SAAiB,EACjB,OAAgB,EAChB,UAAmB;IAEnB,MAAM,SAAS,GAAG,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,GAAG,SAAS,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;IACxE,MAAM,OAAO,GACX,6BAA6B,OAAO,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,QAAQ,GAAG;QAC/D,KAAK,SAAS,CAAC,OAAO,CAAC,CAAC,CAAC,eAAe,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,EAAE,CAAC;IAErE,IAAI,OAAO,EAAE,CAAC;QACZ,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QACrB,IAAI,UAAU,EAAE,CAAC;YACf,MAAM,CAAC,IAAI,CAAC,oBAAoB,UAAU,IAAI,CAAC,CAAC;QAClD,CAAC;IACH,CAAC;SAAM,CAAC;QACN,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;IACxB,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
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 { BuilderOutput } from '@angular-devkit/architect';
|
|
9
|
+
/**
|
|
10
|
+
* Encapsulates the diagnostic messages (`errors`, `warnings`, and `logs`) and
|
|
11
|
+
* builder output status for a single library build iteration.
|
|
12
|
+
*/
|
|
13
|
+
export declare class ExecutionResult {
|
|
14
|
+
#private;
|
|
15
|
+
/** Formatted error messages produced during the build iteration. */
|
|
16
|
+
get errors(): readonly string[];
|
|
17
|
+
/** Formatted warning messages produced during the build iteration. */
|
|
18
|
+
get warnings(): readonly string[];
|
|
19
|
+
/** Informational log messages produced during the build iteration. */
|
|
20
|
+
get logs(): readonly string[];
|
|
21
|
+
/** Whether any errors have been recorded in the build iteration. */
|
|
22
|
+
get hasErrors(): boolean;
|
|
23
|
+
/** Architect builder output status for the build iteration. */
|
|
24
|
+
get output(): BuilderOutput;
|
|
25
|
+
/** Records an informational log message. */
|
|
26
|
+
addLog(value: string): void;
|
|
27
|
+
/** Records a formatted error message. */
|
|
28
|
+
addError(error: string): void;
|
|
29
|
+
/** Records multiple formatted error messages. */
|
|
30
|
+
addErrors(errors: Iterable<string>): void;
|
|
31
|
+
/** Records a formatted warning message. */
|
|
32
|
+
addWarning(warning: string): void;
|
|
33
|
+
/** Records multiple formatted warning messages. */
|
|
34
|
+
addWarnings(warnings: Iterable<string>): void;
|
|
35
|
+
}
|
|
@@ -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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.ExecutionResult = void 0;
|
|
11
|
+
/**
|
|
12
|
+
* Encapsulates the diagnostic messages (`errors`, `warnings`, and `logs`) and
|
|
13
|
+
* builder output status for a single library build iteration.
|
|
14
|
+
*/
|
|
15
|
+
class ExecutionResult {
|
|
16
|
+
#errors = [];
|
|
17
|
+
#warnings = [];
|
|
18
|
+
#logs = [];
|
|
19
|
+
/** Formatted error messages produced during the build iteration. */
|
|
20
|
+
get errors() {
|
|
21
|
+
return this.#errors;
|
|
22
|
+
}
|
|
23
|
+
/** Formatted warning messages produced during the build iteration. */
|
|
24
|
+
get warnings() {
|
|
25
|
+
return this.#warnings;
|
|
26
|
+
}
|
|
27
|
+
/** Informational log messages produced during the build iteration. */
|
|
28
|
+
get logs() {
|
|
29
|
+
return this.#logs;
|
|
30
|
+
}
|
|
31
|
+
/** Whether any errors have been recorded in the build iteration. */
|
|
32
|
+
get hasErrors() {
|
|
33
|
+
return this.#errors.length > 0;
|
|
34
|
+
}
|
|
35
|
+
/** Architect builder output status for the build iteration. */
|
|
36
|
+
get output() {
|
|
37
|
+
return {
|
|
38
|
+
success: !this.hasErrors,
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
/** Records an informational log message. */
|
|
42
|
+
addLog(value) {
|
|
43
|
+
this.#logs.push(value);
|
|
44
|
+
}
|
|
45
|
+
/** Records a formatted error message. */
|
|
46
|
+
addError(error) {
|
|
47
|
+
this.#errors.push(error);
|
|
48
|
+
}
|
|
49
|
+
/** Records multiple formatted error messages. */
|
|
50
|
+
addErrors(errors) {
|
|
51
|
+
for (const error of errors) {
|
|
52
|
+
this.#errors.push(error);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
/** Records a formatted warning message. */
|
|
56
|
+
addWarning(warning) {
|
|
57
|
+
this.#warnings.push(warning);
|
|
58
|
+
}
|
|
59
|
+
/** Records multiple formatted warning messages. */
|
|
60
|
+
addWarnings(warnings) {
|
|
61
|
+
for (const warning of warnings) {
|
|
62
|
+
this.#warnings.push(warning);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
exports.ExecutionResult = ExecutionResult;
|
|
67
|
+
//# sourceMappingURL=execution-result.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"execution-result.js","sourceRoot":"","sources":["execution-result.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;AAIH;;;GAGG;AACH,MAAa,eAAe;IACjB,OAAO,GAAa,EAAE,CAAC;IACvB,SAAS,GAAa,EAAE,CAAC;IACzB,KAAK,GAAa,EAAE,CAAC;IAE9B,oEAAoE;IACpE,IAAI,MAAM;QACR,OAAO,IAAI,CAAC,OAAO,CAAC;IACtB,CAAC;IAED,sEAAsE;IACtE,IAAI,QAAQ;QACV,OAAO,IAAI,CAAC,SAAS,CAAC;IACxB,CAAC;IAED,sEAAsE;IACtE,IAAI,IAAI;QACN,OAAO,IAAI,CAAC,KAAK,CAAC;IACpB,CAAC;IAED,oEAAoE;IACpE,IAAI,SAAS;QACX,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC;IACjC,CAAC;IAED,+DAA+D;IAC/D,IAAI,MAAM;QACR,OAAO;YACL,OAAO,EAAE,CAAC,IAAI,CAAC,SAAS;SACzB,CAAC;IACJ,CAAC;IAED,4CAA4C;IAC5C,MAAM,CAAC,KAAa;QAClB,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IACzB,CAAC;IAED,yCAAyC;IACzC,QAAQ,CAAC,KAAa;QACpB,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAC3B,CAAC;IAED,iDAAiD;IACjD,SAAS,CAAC,MAAwB;QAChC,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE,CAAC;YAC3B,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAC3B,CAAC;IACH,CAAC;IAED,2CAA2C;IAC3C,UAAU,CAAC,OAAe;QACxB,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAC/B,CAAC;IAED,mDAAmD;IACnD,WAAW,CAAC,QAA0B;QACpC,KAAK,MAAM,OAAO,IAAI,QAAQ,EAAE,CAAC;YAC/B,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QAC/B,CAAC;IACH,CAAC;CACF;AA5DD,0CA4DC"}
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* Use of this source code is governed by an MIT-style license that can be
|
|
6
6
|
* found in the LICENSE file at https://angular.dev/license
|
|
7
7
|
*/
|
|
8
|
-
import { Builder } from '@angular-devkit/architect';
|
|
8
|
+
import { type Builder } from '@angular-devkit/architect';
|
|
9
9
|
import { executeLibraryBuilder } from './builder';
|
|
10
10
|
import type { Schema as LibraryBuilderOptions } from './schema';
|
|
11
11
|
export { type LibraryBuilderOptions, executeLibraryBuilder, executeLibraryBuilder as execute };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;AAEH,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;AAEH,yDAAwE;AACxE,uCAAkD;AAGb,sGAH5B,+BAAqB,OAG4B;AAA2B,wFAH5E,+BAAqB,OAG8D;AAE5F,MAAM,OAAO,GAAmC,IAAA,yBAAa,EAAC,+BAAqB,CAAC,CAAC;AAErF,kBAAe,OAAO,CAAC"}
|
|
@@ -8,4 +8,13 @@
|
|
|
8
8
|
import type { BuilderContext } from '@angular-devkit/architect';
|
|
9
9
|
import type { Schema as LibraryBuilderOptions } from './schema';
|
|
10
10
|
import type { NormalizedLibraryOptions } from './types';
|
|
11
|
+
/**
|
|
12
|
+
* Normalizes raw library builder options into {@link NormalizedLibraryOptions} with all
|
|
13
|
+
* file and directory paths normalized to POSIX format.
|
|
14
|
+
*
|
|
15
|
+
* @param context The Architect builder context.
|
|
16
|
+
* @param projectName The name of the library project.
|
|
17
|
+
* @param options The raw library builder schema options.
|
|
18
|
+
* @returns A promise resolving to the normalized library options.
|
|
19
|
+
*/
|
|
11
20
|
export declare function normalizeLibraryOptions(context: BuilderContext, projectName: string, options: LibraryBuilderOptions): Promise<NormalizedLibraryOptions>;
|
|
@@ -11,35 +11,37 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
11
11
|
};
|
|
12
12
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
13
|
exports.normalizeLibraryOptions = normalizeLibraryOptions;
|
|
14
|
-
const promises_1 = __importDefault(require("node:fs/promises"));
|
|
15
14
|
const node_path_1 = __importDefault(require("node:path"));
|
|
16
|
-
const utils_1 = require("../../utils");
|
|
17
15
|
const color_1 = require("../../utils/color");
|
|
18
16
|
const error_1 = require("../../utils/error");
|
|
17
|
+
const normalize_asset_patterns_1 = require("../../utils/normalize-asset-patterns");
|
|
19
18
|
const normalize_cache_1 = require("../../utils/normalize-cache");
|
|
20
19
|
const path_1 = require("../../utils/path");
|
|
21
20
|
const postcss_configuration_1 = require("../../utils/postcss-configuration");
|
|
22
21
|
const project_metadata_1 = require("../../utils/project-metadata");
|
|
23
22
|
const entry_points_1 = require("./pipeline/entry-points");
|
|
23
|
+
const utils_1 = require("./pipeline/utils");
|
|
24
|
+
/**
|
|
25
|
+
* Normalizes raw library builder options into {@link NormalizedLibraryOptions} with all
|
|
26
|
+
* file and directory paths normalized to POSIX format.
|
|
27
|
+
*
|
|
28
|
+
* @param context The Architect builder context.
|
|
29
|
+
* @param projectName The name of the library project.
|
|
30
|
+
* @param options The raw library builder schema options.
|
|
31
|
+
* @returns A promise resolving to the normalized library options.
|
|
32
|
+
*/
|
|
24
33
|
async function normalizeLibraryOptions(context, projectName, options) {
|
|
25
|
-
const
|
|
34
|
+
const workspaceRoot = (0, path_1.toPosixPath)(context.workspaceRoot);
|
|
26
35
|
const projectMetadata = await context.getProjectMetadata(projectName);
|
|
27
|
-
const
|
|
28
|
-
const
|
|
29
|
-
const
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
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');
|
|
36
|
+
const projectRootPaths = (0, project_metadata_1.getProjectRootPaths)(workspaceRoot, projectMetadata);
|
|
37
|
+
const projectRoot = (0, path_1.toPosixPath)(projectRootPaths.projectRoot);
|
|
38
|
+
const projectSourceRoot = (0, path_1.toPosixPath)(projectRootPaths.projectSourceRoot);
|
|
39
|
+
const { tsConfig, assets: rawAssets, stylePreprocessorOptions, inlineStyleLanguage = 'css', compilationMode, declarationMap, allowedNonPeerDependencies: rawAllowedNonPeerDependencies = [], keepLifecycleScripts = false, watch = false, poll, preserveSymlinks = process.execArgv.includes('--preserve-symlinks'), deleteOutputPath = true, progress = true, clearScreen, } = options;
|
|
40
|
+
const resolvedTsConfigPath = (0, path_1.toPosixPath)(node_path_1.default.resolve(workspaceRoot, tsConfig));
|
|
41
|
+
const packageJsonPath = node_path_1.default.posix.join(projectRoot, 'package.json');
|
|
39
42
|
let packageJson;
|
|
40
43
|
try {
|
|
41
|
-
|
|
42
|
-
packageJson = JSON.parse(packageJsonContent);
|
|
44
|
+
packageJson = await (0, utils_1.loadPackageJson)(packageJsonPath);
|
|
43
45
|
}
|
|
44
46
|
catch (error) {
|
|
45
47
|
(0, error_1.assertIsError)(error);
|
|
@@ -72,24 +74,28 @@ async function normalizeLibraryOptions(context, projectName, options) {
|
|
|
72
74
|
}
|
|
73
75
|
defaultAssets.push({
|
|
74
76
|
glob: 'README.md',
|
|
75
|
-
input: node_path_1.default.dirname(entryPoint.entryFilePath),
|
|
77
|
+
input: node_path_1.default.posix.dirname(entryPoint.entryFilePath),
|
|
76
78
|
output: entryPoint.name,
|
|
77
79
|
});
|
|
78
80
|
}
|
|
79
|
-
const assets = (0,
|
|
80
|
-
|
|
81
|
-
|
|
81
|
+
const assets = (0, normalize_asset_patterns_1.normalizeAssetPatterns)([...defaultAssets, ...(rawAssets ?? [])], workspaceRoot, projectRoot, projectSourceRoot).map((asset) => ({
|
|
82
|
+
...asset,
|
|
83
|
+
input: (0, path_1.toPosixPath)(node_path_1.default.resolve(workspaceRoot, asset.input)),
|
|
84
|
+
output: (0, path_1.toPosixPath)(asset.output),
|
|
85
|
+
}));
|
|
86
|
+
const cacheOptions = (0, normalize_cache_1.normalizeCacheOptions)(projectMetadata, workspaceRoot, projectName, context.builder.builderName);
|
|
87
|
+
const styleIncludePaths = (stylePreprocessorOptions?.includePaths ?? []).map((p) => (0, path_1.toPosixPath)(node_path_1.default.resolve(workspaceRoot, p)));
|
|
82
88
|
const searchDirectories = await (0, postcss_configuration_1.generateSearchDirectories)([projectRoot, workspaceRoot]);
|
|
83
89
|
const postcssConfiguration = await (0, postcss_configuration_1.loadPostcssConfiguration)(searchDirectories);
|
|
84
90
|
const tailwindConfiguration = postcssConfiguration
|
|
85
91
|
? undefined
|
|
86
|
-
:
|
|
92
|
+
: (0, postcss_configuration_1.getTailwindConfig)(searchDirectories, workspaceRoot, context.logger);
|
|
87
93
|
return {
|
|
88
94
|
workspaceRoot,
|
|
89
95
|
projectRoot,
|
|
90
96
|
packageName,
|
|
91
97
|
packageJson,
|
|
92
|
-
outputPath:
|
|
98
|
+
outputPath: (0, path_1.toPosixPath)(node_path_1.default.resolve(workspaceRoot, options.outputPath ?? node_path_1.default.posix.join('dist', projectName))),
|
|
93
99
|
deleteOutputPath,
|
|
94
100
|
packageJsonPath,
|
|
95
101
|
tsConfigPath: resolvedTsConfigPath,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"options.js","sourceRoot":"","sources":["options.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;;;
|
|
1
|
+
{"version":3,"file":"options.js","sourceRoot":"","sources":["options.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;;;AA8BH,0DA4IC;AAvKD,0DAA6B;AAE7B,6CAAiD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