@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
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compilation.js","sourceRoot":"","sources":["compilation.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;
|
|
1
|
+
{"version":3,"file":"compilation.js","sourceRoot":"","sources":["compilation.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;AA0BH,wCAkLC;AA1MD,qCAA8D;AAC9D,qCAAqC;AACrC,oEAG4C;AAE5C,4EAAqE;AACrE,8CAAkD;AAGlD,mCAAwE;AAExE,MAAM,kBAAkB,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,Q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;QAC3C,MAAM,WAAW,GAAG,MAAM,mBAAmB,CAAC,aAAa,EAAE,CAAC;QAC9D,IAAI,WAAW,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC;YAC/B,MAAM,CAAC,IAAI,CAAC,GAAG,WAAW,CAAC,MAAM,CAAC,CAAC;QACrC,CAAC;QACD,IAAI,WAAW,CAAC,QAAQ,EAAE,MAAM,EAAE,CAAC;YACjC,QAAQ,CAAC,IAAI,CAAC,GAAG,WAAW,CAAC,QAAQ,CAAC,CAAC;QACzC,CAAC;IACH,CAAC;IAED,QAAQ,CAAC,IAAI,CAAC,GAAG,kBAAkB,CAAC,CAAC;IAErC,IAAI,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACtB,eAAe,CAAC,SAAS,CAAC,MAAM,IAAA,wBAAc,EAAC,MAAM,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC;IAC5F,CAAC;IAED,IAAI,QAAQ,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACxB,eAAe,CAAC,WAAW,CAAC,MAAM,IAAA,wBAAc,EAAC,QAAQ,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC;IAClG,CAAC;AACH,CAAC"}
|
|
@@ -5,7 +5,9 @@
|
|
|
5
5
|
* Use of this source code is governed by an MIT-style license that can be
|
|
6
6
|
* found in the LICENSE file at https://angular.dev/license
|
|
7
7
|
*/
|
|
8
|
-
import type {
|
|
8
|
+
import type { BuilderState } from '../builder-state';
|
|
9
|
+
import type { NormalizedEntryPoint, NormalizedLibraryOptions, PackageJsonData } from '../types';
|
|
10
|
+
import type { BundleEntryPointInput } from './bundler';
|
|
9
11
|
/**
|
|
10
12
|
* Computes the base bundle file name for an entry point.
|
|
11
13
|
*
|
|
@@ -18,17 +20,35 @@ export declare function getEntryPointBundleName(packageName: string, entryPointN
|
|
|
18
20
|
* Normalizes all entry points from the library's `package.json` `exports` field.
|
|
19
21
|
*
|
|
20
22
|
* @param rawExports The `exports` field from `package.json`.
|
|
21
|
-
* @param projectRoot The library project root directory.
|
|
22
|
-
* @param packageJsonPath
|
|
23
|
+
* @param projectRoot The library project root POSIX directory path.
|
|
24
|
+
* @param packageJsonPath POSIX path to `package.json` for error reporting.
|
|
23
25
|
* @param packageName The root package name (e.g. `@my/lib`).
|
|
24
|
-
* @returns A Map of normalized entry points keyed by name.
|
|
26
|
+
* @returns A Map of normalized entry points keyed by name with POSIX entry file paths.
|
|
25
27
|
*/
|
|
26
28
|
export declare function normalizeEntryPoints(rawExports: unknown, projectRoot: string, packageJsonPath: string, packageName: string): Map<string, NormalizedEntryPoint>;
|
|
27
29
|
/**
|
|
28
|
-
* Determines whether two sets of normalized entry points differ in keys, paths,
|
|
30
|
+
* Determines whether two sets of normalized entry points differ in keys, POSIX entry paths,
|
|
31
|
+
* subpaths, bundle names, or display names.
|
|
32
|
+
*
|
|
33
|
+
* @param oldEntryPoints The previous map of normalized entry points.
|
|
34
|
+
* @param newEntryPoints The new map of normalized entry points.
|
|
35
|
+
* @returns `true` if any entry point was added, removed, or modified; otherwise `false`.
|
|
29
36
|
*/
|
|
30
37
|
export declare function haveEntryPointsChanged(oldEntryPoints: ReadonlyMap<string, NormalizedEntryPoint>, newEntryPoints: ReadonlyMap<string, NormalizedEntryPoint>): boolean;
|
|
31
38
|
/**
|
|
32
39
|
* Updates watched files, entry points in options, and cached bundle results when package.json entry points change.
|
|
40
|
+
*
|
|
41
|
+
* @param packageJson The reloaded `package.json` data.
|
|
42
|
+
* @param options The normalized library builder options.
|
|
43
|
+
* @param buildState The state preserved across incremental builds.
|
|
44
|
+
*/
|
|
45
|
+
export declare function updateWatchedEntryPoints(packageJson: PackageJsonData, options: NormalizedLibraryOptions, buildState: BuilderState): void;
|
|
46
|
+
/**
|
|
47
|
+
* Determines which entry points have modified JavaScript or declaration files
|
|
48
|
+
* and collects them for bundling.
|
|
49
|
+
*
|
|
50
|
+
* @param options The normalized library builder options.
|
|
51
|
+
* @param buildState The state preserved across incremental builds.
|
|
52
|
+
* @returns The list of entry points that require bundling in the current build iteration.
|
|
33
53
|
*/
|
|
34
|
-
export declare function
|
|
54
|
+
export declare function collectEntryPointsToBundle(options: NormalizedLibraryOptions, buildState: BuilderState): BundleEntryPointInput[];
|
|
@@ -14,6 +14,7 @@ exports.getEntryPointBundleName = getEntryPointBundleName;
|
|
|
14
14
|
exports.normalizeEntryPoints = normalizeEntryPoints;
|
|
15
15
|
exports.haveEntryPointsChanged = haveEntryPointsChanged;
|
|
16
16
|
exports.updateWatchedEntryPoints = updateWatchedEntryPoints;
|
|
17
|
+
exports.collectEntryPointsToBundle = collectEntryPointsToBundle;
|
|
17
18
|
const node_path_1 = __importDefault(require("node:path"));
|
|
18
19
|
const path_1 = require("../../../utils/path");
|
|
19
20
|
/**
|
|
@@ -24,7 +25,7 @@ const path_1 = require("../../../utils/path");
|
|
|
24
25
|
* @returns The sanitized bundle base name.
|
|
25
26
|
*/
|
|
26
27
|
function getEntryPointBundleName(packageName, entryPointName = '.') {
|
|
27
|
-
const isPrimary =
|
|
28
|
+
const isPrimary = entryPointName === '.';
|
|
28
29
|
const pkgName = packageName[0] === '@' ? packageName.slice(1) : packageName;
|
|
29
30
|
const epName = isPrimary ? pkgName : `${pkgName}-${entryPointName}`;
|
|
30
31
|
return epName.replaceAll('/', '-').toLowerCase();
|
|
@@ -36,23 +37,19 @@ function getEntryPointBundleName(packageName, entryPointName = '.') {
|
|
|
36
37
|
* @param posixKey Normalized POSIX key without trailing slashes.
|
|
37
38
|
* @param isPrimary Whether this is the primary entry point.
|
|
38
39
|
* @param targetPath The relative file path string from exports.
|
|
39
|
-
* @param projectRoot The library project root directory.
|
|
40
|
+
* @param projectRoot The library project root POSIX directory path.
|
|
40
41
|
* @param packageName The root package name (e.g. `@my/lib`).
|
|
41
|
-
* @returns The normalized entry point descriptor.
|
|
42
|
+
* @returns The normalized entry point descriptor with POSIX paths.
|
|
42
43
|
*/
|
|
43
44
|
function normalizeEntryPoint(key, posixKey, isPrimary, targetPath, projectRoot, packageName) {
|
|
44
|
-
const name = isPrimary
|
|
45
|
-
? '.'
|
|
46
|
-
: posixKey[0] === '.' && posixKey[1] === '/'
|
|
47
|
-
? posixKey.slice(2)
|
|
48
|
-
: posixKey;
|
|
45
|
+
const name = isPrimary ? '.' : posixKey.startsWith('./') ? posixKey.slice(2) : posixKey;
|
|
49
46
|
if (name !== '.' && (node_path_1.default.posix.isAbsolute(name) || name.includes('..'))) {
|
|
50
47
|
throw new Error(`Invalid entry point key '${key}'. Entry point keys must be relative subpaths without '..' (e.g. './testing').`);
|
|
51
48
|
}
|
|
52
49
|
const subpath = isPrimary ? '.' : `./${name}`;
|
|
53
50
|
const displayName = (isPrimary ? packageName : `${packageName}/${name}`).toLowerCase();
|
|
54
51
|
const bundleName = getEntryPointBundleName(packageName, name);
|
|
55
|
-
const entryFilePath = node_path_1.default.resolve(projectRoot, targetPath);
|
|
52
|
+
const entryFilePath = (0, path_1.toPosixPath)(node_path_1.default.resolve(projectRoot, targetPath));
|
|
56
53
|
if (!/(?<!\.d)\.(?:ts|mts)$/.test(entryFilePath)) {
|
|
57
54
|
throw new Error(`Entry point '${key}' file path must be a TypeScript file ('.ts' or '.mts'): '${entryFilePath}'.`);
|
|
58
55
|
}
|
|
@@ -94,10 +91,10 @@ function resolveTarget(value) {
|
|
|
94
91
|
* Normalizes all entry points from the library's `package.json` `exports` field.
|
|
95
92
|
*
|
|
96
93
|
* @param rawExports The `exports` field from `package.json`.
|
|
97
|
-
* @param projectRoot The library project root directory.
|
|
98
|
-
* @param packageJsonPath
|
|
94
|
+
* @param projectRoot The library project root POSIX directory path.
|
|
95
|
+
* @param packageJsonPath POSIX path to `package.json` for error reporting.
|
|
99
96
|
* @param packageName The root package name (e.g. `@my/lib`).
|
|
100
|
-
* @returns A Map of normalized entry points keyed by name.
|
|
97
|
+
* @returns A Map of normalized entry points keyed by name with POSIX entry file paths.
|
|
101
98
|
*/
|
|
102
99
|
function normalizeEntryPoints(rawExports, projectRoot, packageJsonPath, packageName) {
|
|
103
100
|
if (!rawExports || (typeof rawExports !== 'string' && typeof rawExports !== 'object')) {
|
|
@@ -140,9 +137,7 @@ function normalizeEntryPoints(rawExports, projectRoot, packageJsonPath, packageN
|
|
|
140
137
|
}
|
|
141
138
|
usedBundleNames.set(entryPoint.bundleName, key);
|
|
142
139
|
entryPoints.set(entryPoint.name, entryPoint);
|
|
143
|
-
|
|
144
|
-
hasPrimary = true;
|
|
145
|
-
}
|
|
140
|
+
hasPrimary ||= isPrimary;
|
|
146
141
|
}
|
|
147
142
|
if (!hasPrimary) {
|
|
148
143
|
throw new Error(`The 'exports' field in '${packageJsonPath}' must contain a primary entry point with key '.'.`);
|
|
@@ -150,7 +145,12 @@ function normalizeEntryPoints(rawExports, projectRoot, packageJsonPath, packageN
|
|
|
150
145
|
return entryPoints;
|
|
151
146
|
}
|
|
152
147
|
/**
|
|
153
|
-
* Determines whether two sets of normalized entry points differ in keys, paths,
|
|
148
|
+
* Determines whether two sets of normalized entry points differ in keys, POSIX entry paths,
|
|
149
|
+
* subpaths, bundle names, or display names.
|
|
150
|
+
*
|
|
151
|
+
* @param oldEntryPoints The previous map of normalized entry points.
|
|
152
|
+
* @param newEntryPoints The new map of normalized entry points.
|
|
153
|
+
* @returns `true` if any entry point was added, removed, or modified; otherwise `false`.
|
|
154
154
|
*/
|
|
155
155
|
function haveEntryPointsChanged(oldEntryPoints, newEntryPoints) {
|
|
156
156
|
if (oldEntryPoints.size !== newEntryPoints.size) {
|
|
@@ -170,25 +170,86 @@ function haveEntryPointsChanged(oldEntryPoints, newEntryPoints) {
|
|
|
170
170
|
}
|
|
171
171
|
/**
|
|
172
172
|
* Updates watched files, entry points in options, and cached bundle results when package.json entry points change.
|
|
173
|
+
*
|
|
174
|
+
* @param packageJson The reloaded `package.json` data.
|
|
175
|
+
* @param options The normalized library builder options.
|
|
176
|
+
* @param buildState The state preserved across incremental builds.
|
|
173
177
|
*/
|
|
174
|
-
function updateWatchedEntryPoints(packageJson, options, buildState
|
|
175
|
-
const
|
|
178
|
+
function updateWatchedEntryPoints(packageJson, options, buildState) {
|
|
179
|
+
const { packageJsonPath } = options;
|
|
180
|
+
if (!packageJson.name) {
|
|
181
|
+
throw new Error(`The package.json at '${packageJsonPath}' must contain a 'name'.`);
|
|
182
|
+
}
|
|
183
|
+
const newEntryPoints = normalizeEntryPoints(packageJson.exports, options.projectRoot, packageJsonPath, packageJson.name);
|
|
184
|
+
const { watchedCompilationFiles, previousBundleResults } = buildState;
|
|
176
185
|
if (haveEntryPointsChanged(options.entryPoints, newEntryPoints)) {
|
|
186
|
+
for (const oldEntryPoint of options.entryPoints.values()) {
|
|
187
|
+
watchedCompilationFiles.delete(oldEntryPoint.entryFilePath);
|
|
188
|
+
}
|
|
177
189
|
for (const entryPoint of newEntryPoints.values()) {
|
|
178
|
-
|
|
190
|
+
watchedCompilationFiles.add(entryPoint.entryFilePath);
|
|
179
191
|
}
|
|
180
|
-
for (const name of
|
|
192
|
+
for (const name of previousBundleResults.keys()) {
|
|
181
193
|
const oldEp = options.entryPoints.get(name);
|
|
182
194
|
const newEp = newEntryPoints.get(name);
|
|
183
195
|
if (!newEp ||
|
|
184
196
|
!oldEp ||
|
|
185
197
|
newEp.entryFilePath !== oldEp.entryFilePath ||
|
|
186
198
|
newEp.bundleName !== oldEp.bundleName) {
|
|
187
|
-
|
|
199
|
+
previousBundleResults.delete(name);
|
|
188
200
|
}
|
|
189
201
|
}
|
|
190
202
|
options.entryPoints = newEntryPoints;
|
|
191
203
|
buildState.hasEntryPointsChanges = true;
|
|
192
204
|
}
|
|
205
|
+
options.packageJson = packageJson;
|
|
206
|
+
options.packageName = packageJson.name;
|
|
207
|
+
}
|
|
208
|
+
/**
|
|
209
|
+
* Determines which entry points have modified JavaScript or declaration files
|
|
210
|
+
* and collects them for bundling.
|
|
211
|
+
*
|
|
212
|
+
* @param options The normalized library builder options.
|
|
213
|
+
* @param buildState The state preserved across incremental builds.
|
|
214
|
+
* @returns The list of entry points that require bundling in the current build iteration.
|
|
215
|
+
*/
|
|
216
|
+
function collectEntryPointsToBundle(options, buildState) {
|
|
217
|
+
const { pendingChangedEsmFiles, pendingChangedDtsFiles, previousBundleResults, executionResult } = buildState;
|
|
218
|
+
const itemsToBundle = [];
|
|
219
|
+
for (const entryPoint of options.entryPoints.values()) {
|
|
220
|
+
const previousBundleResult = previousBundleResults.get(entryPoint.name);
|
|
221
|
+
const hasEsmChanges = !previousBundleResult ||
|
|
222
|
+
hasEntryPointChanges(previousBundleResult.esmModuleIds, pendingChangedEsmFiles);
|
|
223
|
+
const hasDtsChanges = !previousBundleResult ||
|
|
224
|
+
hasEntryPointChanges(previousBundleResult.dtsModuleIds, pendingChangedDtsFiles);
|
|
225
|
+
if (hasEsmChanges || hasDtsChanges) {
|
|
226
|
+
executionResult.addLog(`Compiling ${entryPoint.displayName}...`);
|
|
227
|
+
itemsToBundle.push({
|
|
228
|
+
entryPoint,
|
|
229
|
+
hasEsmChanges,
|
|
230
|
+
hasDtsChanges,
|
|
231
|
+
previousBundleResult,
|
|
232
|
+
});
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
return itemsToBundle;
|
|
236
|
+
}
|
|
237
|
+
/**
|
|
238
|
+
* Checks whether any file in `changedFiles` belongs to the given entry point's `moduleIds`.
|
|
239
|
+
*
|
|
240
|
+
* @param moduleIds Set of virtual POSIX module IDs referenced by the entry point's previous bundle.
|
|
241
|
+
* @param changedFiles Set of POSIX file paths that changed during compilation.
|
|
242
|
+
* @returns `true` if at least one changed file is part of `moduleIds`; otherwise `false`.
|
|
243
|
+
*/
|
|
244
|
+
function hasEntryPointChanges(moduleIds, changedFiles) {
|
|
245
|
+
if (changedFiles.size === 0) {
|
|
246
|
+
return false;
|
|
247
|
+
}
|
|
248
|
+
for (const file of changedFiles) {
|
|
249
|
+
if (moduleIds.has(file)) {
|
|
250
|
+
return true;
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
return false;
|
|
193
254
|
}
|
|
194
255
|
//# sourceMappingURL=entry-points.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"entry-points.js","sourceRoot":"","sources":["entry-points.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;;;
|
|
1
|
+
{"version":3,"file":"entry-points.js","sourceRoot":"","sources":["entry-points.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;;;AAeH,0DAMC;AAyFD,oDA8EC;AAUD,wDAsBC;AASD,4DA+CC;AAUD,gEA6BC;AAzTD,0DAA6B;AAC7B,8CAAkD;AAKlD;;;;;;GAMG;AACH,SAAgB,uBAAuB,CAAC,WAAmB,EAAE,cAAc,GAAG,GAAG;IAC/E,MAAM,SAAS,GAAG,cAAc,KAAK,GAAG,CAAC;IACzC,MAAM,OAAO,GAAG,WAAW,CAAC,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC;IAC5E,MAAM,MAAM,GAAG,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,IAAI,cAAc,EAAE,CAAC;IAEpE,OAAO,MAAM,CAAC,UAAU,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,WAAW,EAAE,CAAC;AACnD,CAAC;AAED;;;;;;;;;;GAUG;AACH,SAAS,mBAAmB,CAC1B,GAAW,EACX,QAAgB,EAChB,SAAkB,EAClB,UAAkB,EAClB,WAAmB,EACnB,WAAmB;IAEnB,MAAM,IAAI,GAAG,SAAS,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,QAAQ,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC;IAExF,IAAI,IA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GACjB,CAAC,oBAAoB;YACrB,oBAAoB,CAAC,oBAAoB,CAAC,YAAY,EAAE,sBAAsB,CAAC,CAAC;QAClF,MAAM,aAAa,GACjB,CAAC,oBAAoB;YACrB,oBAAoB,CAAC,oBAAoB,CAAC,YAAY,EAAE,sBAAsB,CAAC,CAAC;QAElF,IAAI,aAAa,IAAI,aAAa,EAAE,CAAC;YACnC,eAAe,CAAC,MAAM,CAAC,aAAa,UAAU,CAAC,WAAW,KAAK,CAAC,CAAC;YACjE,aAAa,CAAC,IAAI,CAAC;gBACjB,UAAU;gBACV,aAAa;gBACb,aAAa;gBACb,oBAAoB;aACrB,CAAC,CAAC;QACL,CAAC;IACH,CAAC;IAED,OAAO,aAAa,CAAC;AACvB,CAAC;AAED;;;;;;GAMG;AACH,SAAS,oBAAoB,CAC3B,SAA8B,EAC9B,YAAiC;IAEjC,IAAI,YAAY,CAAC,IAAI,KAAK,CAAC,EAAE,CAAC;QAC5B,OAAO,KAAK,CAAC;IACf,CAAC;IAED,KAAK,MAAM,IAAI,IAAI,YAAY,EAAE,CAAC;QAChC,IAAI,SAAS,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC;YACxB,OAAO,IAAI,CAAC;QACd,CAAC;IACH,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC"}
|
|
@@ -12,6 +12,7 @@ import { type MemoryOutputFile } from './utils';
|
|
|
12
12
|
*
|
|
13
13
|
* @param options The normalized library options.
|
|
14
14
|
* @param isWatchMode Whether the builder is running in watch mode.
|
|
15
|
+
* @param hasTslibImport Whether any output chunk imports 'tslib'.
|
|
15
16
|
* @returns An array of memory output files containing generated package manifests and .npmignore.
|
|
16
17
|
*/
|
|
17
|
-
export declare function generatePackageManifests(options: NormalizedLibraryOptions, isWatchMode: boolean): MemoryOutputFile[]
|
|
18
|
+
export declare function generatePackageManifests(options: NormalizedLibraryOptions, isWatchMode: boolean, hasTslibImport?: boolean): Promise<MemoryOutputFile[]>;
|
|
@@ -11,6 +11,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
11
11
|
};
|
|
12
12
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
13
|
exports.generatePackageManifests = generatePackageManifests;
|
|
14
|
+
const node_module_1 = require("node:module");
|
|
14
15
|
const node_path_1 = __importDefault(require("node:path"));
|
|
15
16
|
const utils_1 = require("./utils");
|
|
16
17
|
/**
|
|
@@ -18,9 +19,10 @@ const utils_1 = require("./utils");
|
|
|
18
19
|
*
|
|
19
20
|
* @param options The normalized library options.
|
|
20
21
|
* @param isWatchMode Whether the builder is running in watch mode.
|
|
22
|
+
* @param hasTslibImport Whether any output chunk imports 'tslib'.
|
|
21
23
|
* @returns An array of memory output files containing generated package manifests and .npmignore.
|
|
22
24
|
*/
|
|
23
|
-
function generatePackageManifests(options, isWatchMode) {
|
|
25
|
+
async function generatePackageManifests(options, isWatchMode, hasTslibImport = false) {
|
|
24
26
|
const { packageJson: rawPackageJson, keepLifecycleScripts, compilationMode } = options;
|
|
25
27
|
const { devDependencies: _devDependencies, scripts, name, version, exports: userExports, workspaces: _workspaces, ...restPackageJson } = rawPackageJson;
|
|
26
28
|
const exportsMap = {
|
|
@@ -52,6 +54,12 @@ function generatePackageManifests(options, isWatchMode) {
|
|
|
52
54
|
// https://github.com/angular/angular-cli/issues/20962
|
|
53
55
|
version: isWatchMode ? `0.0.0-watch+${Date.now()}` : version,
|
|
54
56
|
};
|
|
57
|
+
if (hasTslibImport && !rawPackageJson.dependencies?.['tslib']) {
|
|
58
|
+
distPackageJson.dependencies = {
|
|
59
|
+
...rawPackageJson.dependencies,
|
|
60
|
+
tslib: await getAngularTslibRange(options.workspaceRoot),
|
|
61
|
+
};
|
|
62
|
+
}
|
|
55
63
|
// Retain scripts if keepLifecycleScripts is set
|
|
56
64
|
if (keepLifecycleScripts && scripts) {
|
|
57
65
|
distPackageJson.scripts = scripts;
|
|
@@ -102,6 +110,11 @@ function generatePackageManifests(options, isWatchMode) {
|
|
|
102
110
|
}
|
|
103
111
|
/**
|
|
104
112
|
* Creates or updates export conditions for an entry point, preserving custom user-defined conditions.
|
|
113
|
+
*
|
|
114
|
+
* @param existingConditions Existing export conditions from the user's `package.json`.
|
|
115
|
+
* @param dtsPath Relative POSIX path to the bundled `.d.ts` file.
|
|
116
|
+
* @param fesmPath Relative POSIX path to the bundled FESM `.mjs` file.
|
|
117
|
+
* @returns The merged export conditions object.
|
|
105
118
|
*/
|
|
106
119
|
function createExportConditions(existingConditions, dtsPath, fesmPath) {
|
|
107
120
|
const existing = typeof existingConditions === 'object' &&
|
|
@@ -116,4 +129,40 @@ function createExportConditions(existingConditions, dtsPath, fesmPath) {
|
|
|
116
129
|
default: fesmPath,
|
|
117
130
|
};
|
|
118
131
|
}
|
|
132
|
+
/**
|
|
133
|
+
* Cached tslib range used by the Angular compiler.
|
|
134
|
+
*/
|
|
135
|
+
let cachedTslibRange;
|
|
136
|
+
/**
|
|
137
|
+
* Get the tslib range used by the Angular compiler.
|
|
138
|
+
* @param workspaceRoot path to the workspace root.
|
|
139
|
+
* @returns tslib range
|
|
140
|
+
*/
|
|
141
|
+
async function getAngularTslibRange(workspaceRoot) {
|
|
142
|
+
if (cachedTslibRange) {
|
|
143
|
+
return cachedTslibRange;
|
|
144
|
+
}
|
|
145
|
+
const workspaceRequire = (0, node_module_1.createRequire)(node_path_1.default.join(workspaceRoot, 'package.json'));
|
|
146
|
+
// Try resolving via @angular/compiler dependencies
|
|
147
|
+
try {
|
|
148
|
+
const angularCompilerPkg = await (0, utils_1.loadPackageJson)(workspaceRequire.resolve('@angular/compiler/package.json'));
|
|
149
|
+
cachedTslibRange = angularCompilerPkg.dependencies?.['tslib'];
|
|
150
|
+
}
|
|
151
|
+
catch { }
|
|
152
|
+
// Fallback: Try resolving tslib directly
|
|
153
|
+
if (!cachedTslibRange) {
|
|
154
|
+
try {
|
|
155
|
+
const tslibPkg = await (0, utils_1.loadPackageJson)(workspaceRequire.resolve('tslib/package.json'));
|
|
156
|
+
if (tslibPkg.version) {
|
|
157
|
+
cachedTslibRange = `^${tslibPkg.version}`;
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
catch { }
|
|
161
|
+
}
|
|
162
|
+
// Fail fast if still unresolved
|
|
163
|
+
if (!cachedTslibRange) {
|
|
164
|
+
throw new Error('Unable to resolve tslib range.');
|
|
165
|
+
}
|
|
166
|
+
return cachedTslibRange;
|
|
167
|
+
}
|
|
119
168
|
//# sourceMappingURL=package-manifests.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"package-manifests.js","sourceRoot":"","sources":["package-manifests.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;;;
|
|
1
|
+
{"version":3,"file":"package-manifests.js","sourceRoot":"","sources":["package-manifests.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;;;AAqBH,4DA+HC;AAlJD,6CAA4C;AAC5C,0DAA6B;AAE7B,mCAMiB;AAEjB;;;;;;;GAOG;AACI,KAAK,UAAU,wBAAwB,CAC5C,OAAiC,EACjC,WAAoB,EACpB,cAAc,GAAG,KAAK;IAEtB,MAAM,EAAE,WAAW,EAAE,cAAc,EAAE,oBAAoB,EAAE,eAAe,EAAE,GAAG,OAAO,CAAC;IAEvF,MAAM,EACJ,eAAe,EAAE,gBAAgB,EACjC,OAAO,EACP,IAAI,EACJ,OAAO,EACP,OAAO,EAAE,WAAW,EACpB,UAAU,EAAE,WAAW,EACvB,GAAG,eAAe,EACnB,GAAG,cAAc,CAAC;IAEnB,MAAM,UAAU,GAA4B;QAC1C,GAAG,CAAC,OAAO,WAAW,KAAK,QAAQ,IAAI,WAAW,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,WAAW,CAAC;YACxF,CAAC,CAAC,WAAW;YACb,CAAC,CAAC,EAAE,CAAC;QACP,gBAAgB,EAAE,EAAE,OAAO,EAAE,gBAAgB,EAAE;KAChD,CAAC;IAEF,MAAM,iBAAiB,GAAG,OAAO,CAAC,WA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AC;AAED;;GAEG;AACH,IAAI,gBAAoC,CAAC;AAEzC;;;;GAIG;AACH,KAAK,UAAU,oBAAoB,CAAC,aAAqB;IACvD,IAAI,gBAAgB,EAAE,CAAC;QACrB,OAAO,gBAAgB,CAAC;IAC1B,CAAC;IAED,MAAM,gBAAgB,GAAG,IAAA,2BAAa,EAAC,mBAAI,CAAC,IAAI,CAAC,aAAa,EAAE,cAAc,CAAC,CAAC,CAAC;IAEjF,mDAAmD;IACnD,IAAI,CAAC;QACH,MAAM,kBAAkB,GAAG,MAAM,IAAA,uBAAe,EAC9C,gBAAgB,CAAC,OAAO,CAAC,gCAAgC,CAAC,CAC3D,CAAC;QACF,gBAAgB,GAAG,kBAAkB,CAAC,YAAY,EAAE,CAAC,OAAO,CAAC,CAAC;IAChE,CAAC;IAAC,MAAM,CAAC,CAAA,CAAC;IAEV,yCAAyC;IACzC,IAAI,CAAC,gBAAgB,EAAE,CAAC;QACtB,IAAI,CAAC;YACH,MAAM,QAAQ,GAAG,MAAM,IAAA,uBAAe,EAAC,gBAAgB,CAAC,OAAO,CAAC,oBAAoB,CAAC,CAAC,CAAC;YACvF,IAAI,QAAQ,CAAC,OAAO,EAAE,CAAC;gBACrB,gBAAgB,GAAG,IAAI,QAAQ,CAAC,OAAO,EAAE,CAAC;YAC5C,CAAC;QACH,CAAC;QAAC,MAAM,CAAC,CAAA,CAAC;IACZ,CAAC;IAED,gCAAgC;IAChC,IAAI,CAAC,gBAAgB,EAAE,CAAC;QACtB,MAAM,IAAI,KAAK,CAAC,gCAAgC,CAAC,CAAC;IACpD,CAAC;IAED,OAAO,gBAAgB,CAAC;AAC1B,CAAC"}
|
|
@@ -7,11 +7,14 @@
|
|
|
7
7
|
*/
|
|
8
8
|
import { ComponentStylesheetBundler } from '../../../tools/esbuild/angular/component-stylesheets';
|
|
9
9
|
import type { NormalizedLibraryOptions } from '../types';
|
|
10
|
+
/**
|
|
11
|
+
* Subset of normalized library options required to configure the component stylesheet bundler.
|
|
12
|
+
*/
|
|
10
13
|
export type LibraryStylesheetBundlerOptions = Pick<NormalizedLibraryOptions, 'workspaceRoot' | 'preserveSymlinks' | 'styleIncludePaths' | 'sass' | 'cacheOptions' | 'inlineStyleLanguage' | 'postcssConfiguration' | 'tailwindConfiguration'>;
|
|
11
14
|
/**
|
|
12
15
|
* Creates a stylesheet bundler instance configured for library compilation.
|
|
13
16
|
*
|
|
14
|
-
* @param options The normalized library builder options.
|
|
17
|
+
* @param options The normalized library builder options with POSIX paths.
|
|
15
18
|
* @param incremental Whether incremental watch mode is enabled.
|
|
16
19
|
* @param target The esbuild target environments derived from browserslist.
|
|
17
20
|
* @returns A new ComponentStylesheetBundler instance.
|
|
@@ -12,7 +12,7 @@ const component_stylesheets_1 = require("../../../tools/esbuild/angular/componen
|
|
|
12
12
|
/**
|
|
13
13
|
* Creates a stylesheet bundler instance configured for library compilation.
|
|
14
14
|
*
|
|
15
|
-
* @param options The normalized library builder options.
|
|
15
|
+
* @param options The normalized library builder options with POSIX paths.
|
|
16
16
|
* @param incremental Whether incremental watch mode is enabled.
|
|
17
17
|
* @param target The esbuild target environments derived from browserslist.
|
|
18
18
|
* @returns A new ComponentStylesheetBundler instance.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stylesheet-bundler.js","sourceRoot":"","sources":["stylesheet-bundler.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;
|
|
1
|
+
{"version":3,"file":"stylesheet-bundler.js","sourceRoot":"","sources":["stylesheet-bundler.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;AA6BH,gGAiCC;AA5DD,gGAAkG;AAmBlG;;;;;;;GAOG;AACH,SAAgB,0CAA0C,CACxD,OAAwC,EACxC,WAAoB,EACpB,MAAgB;IAEhB,MAAM,EACJ,aAAa,EACb,gBAAgB,EAChB,iBAAiB,EACjB,IAAI,EACJ,YAAY,EACZ,mBAAmB,EACnB,oBAAoB,EACpB,qBAAqB,GACtB,GAAG,OAAO,CAAC;IAEZ,MAAM,aAAa,GAA4B;QAC7C,aAAa;QACb,YAAY,EAAE,IAAI;QAClB,WAAW,EAAE,KAAK;QAClB,OAAO,EAAE,IAAI;QACb,MAAM;QACN,gBAAgB;QAChB,SAAS,EAAE,KAAK;QAChB,WAAW,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,cAAc,EAAE;QACzD,YAAY,EAAE,iBAAiB;QAC/B,IAAI;QACJ,YAAY;QACZ,oBAAoB;QACpB,qBAAqB;KACtB,CAAC;IAEF,OAAO,IAAI,kDAA0B,CAAC,aAAa,EAAE,mBAAmB,EAAE,WAAW,CAAC,CAAC;AACzF,CAAC"}
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
* Use of this source code is governed by an MIT-style license that can be
|
|
6
6
|
* found in the LICENSE file at https://angular.dev/license
|
|
7
7
|
*/
|
|
8
|
+
import type { PackageJsonData } from '../types';
|
|
8
9
|
/**
|
|
9
10
|
* The output directory name for ES module format output files.
|
|
10
11
|
*/
|
|
@@ -17,8 +18,8 @@ export declare const TYPES_OUTPUT_DIR = "types";
|
|
|
17
18
|
* Represents an in-memory file to be emitted to disk.
|
|
18
19
|
*/
|
|
19
20
|
export interface MemoryOutputFile {
|
|
20
|
-
|
|
21
|
-
/** The destination path where the file should be written. */
|
|
21
|
+
origin: 'memory';
|
|
22
|
+
/** The relative POSIX destination path where the file should be written. */
|
|
22
23
|
path: string;
|
|
23
24
|
/** The contents of the file as either a string or byte array. */
|
|
24
25
|
contents: string | Uint8Array;
|
|
@@ -27,10 +28,10 @@ export interface MemoryOutputFile {
|
|
|
27
28
|
* Represents an existing file on disk to be copied to a destination path.
|
|
28
29
|
*/
|
|
29
30
|
export interface DiskOutputFile {
|
|
30
|
-
|
|
31
|
-
/** The path to the source file on disk. */
|
|
31
|
+
origin: 'disk';
|
|
32
|
+
/** The POSIX path to the source file on disk. */
|
|
32
33
|
source: string;
|
|
33
|
-
/** The destination path where the file should be copied. */
|
|
34
|
+
/** The relative POSIX destination path where the file should be copied. */
|
|
34
35
|
path: string;
|
|
35
36
|
}
|
|
36
37
|
/**
|
|
@@ -38,19 +39,19 @@ export interface DiskOutputFile {
|
|
|
38
39
|
*/
|
|
39
40
|
export type OutputFile = MemoryOutputFile | DiskOutputFile;
|
|
40
41
|
/**
|
|
41
|
-
* Creates an output file descriptor for an existing file on disk.
|
|
42
|
+
* Creates an output file descriptor for an existing file on disk with POSIX paths.
|
|
42
43
|
*
|
|
43
44
|
* @param source The path to the source file on disk.
|
|
44
|
-
* @param path The destination path where the file should be copied.
|
|
45
|
-
* @returns A {@link DiskOutputFile} descriptor
|
|
45
|
+
* @param path The relative destination path where the file should be copied.
|
|
46
|
+
* @returns A {@link DiskOutputFile} descriptor with POSIX `source` and `path`.
|
|
46
47
|
*/
|
|
47
48
|
export declare function createDiskOutputFile(source: string, path: string): DiskOutputFile;
|
|
48
49
|
/**
|
|
49
|
-
* Creates an output file descriptor for an in-memory file.
|
|
50
|
+
* Creates an output file descriptor for an in-memory file with a POSIX destination path.
|
|
50
51
|
*
|
|
51
|
-
* @param path The destination path where the file should be written.
|
|
52
|
+
* @param path The relative destination path where the file should be written.
|
|
52
53
|
* @param contents The contents of the file as either a string, byte array, or JSON object.
|
|
53
|
-
* @returns A {@link MemoryOutputFile} descriptor
|
|
54
|
+
* @returns A {@link MemoryOutputFile} descriptor with a POSIX `path`.
|
|
54
55
|
*/
|
|
55
56
|
export declare function createMemoryOutputFile(path: string, contents: string | Uint8Array | Record<string, unknown>): MemoryOutputFile;
|
|
56
57
|
/**
|
|
@@ -67,3 +68,10 @@ export declare function isDeclarationFile(path: string): boolean;
|
|
|
67
68
|
* @returns True if the path ends with `.d.ts.map`, `.d.mts.map`, or `.d.cts.map`.
|
|
68
69
|
*/
|
|
69
70
|
export declare function isDeclarationSourceMapFile(path: string): boolean;
|
|
71
|
+
/**
|
|
72
|
+
* Loads and parses a package.json file from disk.
|
|
73
|
+
*
|
|
74
|
+
* @param packageJsonPath The path to the package.json file.
|
|
75
|
+
* @returns The parsed package.json data.
|
|
76
|
+
*/
|
|
77
|
+
export declare function loadPackageJson(packageJsonPath: string): Promise<PackageJsonData>;
|
|
@@ -6,12 +6,18 @@
|
|
|
6
6
|
* Use of this source code is governed by an MIT-style license that can be
|
|
7
7
|
* found in the LICENSE file at https://angular.dev/license
|
|
8
8
|
*/
|
|
9
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
10
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
11
|
+
};
|
|
9
12
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
13
|
exports.TYPES_OUTPUT_DIR = exports.FESM_OUTPUT_DIR = void 0;
|
|
11
14
|
exports.createDiskOutputFile = createDiskOutputFile;
|
|
12
15
|
exports.createMemoryOutputFile = createMemoryOutputFile;
|
|
13
16
|
exports.isDeclarationFile = isDeclarationFile;
|
|
14
17
|
exports.isDeclarationSourceMapFile = isDeclarationSourceMapFile;
|
|
18
|
+
exports.loadPackageJson = loadPackageJson;
|
|
19
|
+
const promises_1 = __importDefault(require("node:fs/promises"));
|
|
20
|
+
const path_1 = require("../../../utils/path");
|
|
15
21
|
const IS_DTS_FILE_REGEXP = /\.d\.[cm]?ts$/i;
|
|
16
22
|
const IS_DTS_MAP_FILE_REGEXP = /\.d\.[cm]?ts\.map$/i;
|
|
17
23
|
/**
|
|
@@ -23,30 +29,30 @@ exports.FESM_OUTPUT_DIR = 'fesm2022';
|
|
|
23
29
|
*/
|
|
24
30
|
exports.TYPES_OUTPUT_DIR = 'types';
|
|
25
31
|
/**
|
|
26
|
-
* Creates an output file descriptor for an existing file on disk.
|
|
32
|
+
* Creates an output file descriptor for an existing file on disk with POSIX paths.
|
|
27
33
|
*
|
|
28
34
|
* @param source The path to the source file on disk.
|
|
29
|
-
* @param path The destination path where the file should be copied.
|
|
30
|
-
* @returns A {@link DiskOutputFile} descriptor
|
|
35
|
+
* @param path The relative destination path where the file should be copied.
|
|
36
|
+
* @returns A {@link DiskOutputFile} descriptor with POSIX `source` and `path`.
|
|
31
37
|
*/
|
|
32
38
|
function createDiskOutputFile(source, path) {
|
|
33
39
|
return {
|
|
34
|
-
|
|
35
|
-
source,
|
|
36
|
-
path,
|
|
40
|
+
origin: 'disk',
|
|
41
|
+
source: (0, path_1.toPosixPath)(source),
|
|
42
|
+
path: (0, path_1.toPosixPath)(path),
|
|
37
43
|
};
|
|
38
44
|
}
|
|
39
45
|
/**
|
|
40
|
-
* Creates an output file descriptor for an in-memory file.
|
|
46
|
+
* Creates an output file descriptor for an in-memory file with a POSIX destination path.
|
|
41
47
|
*
|
|
42
|
-
* @param path The destination path where the file should be written.
|
|
48
|
+
* @param path The relative destination path where the file should be written.
|
|
43
49
|
* @param contents The contents of the file as either a string, byte array, or JSON object.
|
|
44
|
-
* @returns A {@link MemoryOutputFile} descriptor
|
|
50
|
+
* @returns A {@link MemoryOutputFile} descriptor with a POSIX `path`.
|
|
45
51
|
*/
|
|
46
52
|
function createMemoryOutputFile(path, contents) {
|
|
47
53
|
return {
|
|
48
|
-
|
|
49
|
-
path,
|
|
54
|
+
origin: 'memory',
|
|
55
|
+
path: (0, path_1.toPosixPath)(path),
|
|
50
56
|
contents: typeof contents === 'string' || contents instanceof Uint8Array
|
|
51
57
|
? contents
|
|
52
58
|
: JSON.stringify(contents, null, 2) + '\n',
|
|
@@ -70,4 +76,14 @@ function isDeclarationFile(path) {
|
|
|
70
76
|
function isDeclarationSourceMapFile(path) {
|
|
71
77
|
return IS_DTS_MAP_FILE_REGEXP.test(path);
|
|
72
78
|
}
|
|
79
|
+
/**
|
|
80
|
+
* Loads and parses a package.json file from disk.
|
|
81
|
+
*
|
|
82
|
+
* @param packageJsonPath The path to the package.json file.
|
|
83
|
+
* @returns The parsed package.json data.
|
|
84
|
+
*/
|
|
85
|
+
async function loadPackageJson(packageJsonPath) {
|
|
86
|
+
const content = await promises_1.default.readFile(packageJsonPath, 'utf-8');
|
|
87
|
+
return JSON.parse(content);
|
|
88
|
+
}
|
|
73
89
|
//# sourceMappingURL=utils.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["utils.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["utils.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;;;;AAyDH,oDAMC;AASD,wDAYC;AAQD,8CAEC;AAQD,gEAEC;AAQD,0CAIC;AAlHD,gEAAkC;AAClC,8CAAkD;AAGlD,MAAM,kBAAkB,GAAG,gBAAgB,CAAC;AAC5C,MAAM,sBAAsB,GAAG,qBAAqB,CAAC;AAErD;;GAEG;AACU,QAAA,eAAe,GAAG,UAAU,CAAC;AAE1C;;GAEG;AACU,QAAA,gBAAgB,GAAG,OAAO,CAAC;AAiCxC;;;;;;GAMG;AACH,SAAgB,oBAAoB,CAAC,MAAc,EAAE,IAAY;IAC/D,OAAO;QACL,MAAM,EAAE,MAAM;QACd,MAAM,EAAE,IAAA,kBAAW,EAAC,MAAM,CAAC;QAC3B,IAAI,EAAE,IAAA,kBAAW,EAAC,IAAI,CAAC;KACxB,CAAC;AACJ,CAAC;AAED;;;;;;GAMG;AACH,SAAgB,sBAAsB,CACpC,IAAY,EACZ,QAAuD;IAEvD,OAAO;QACL,MAAM,EAAE,QAAQ;QAChB,IAAI,EAAE,IAAA,kBAAW,EAAC,IAAI,CAAC;QACvB,QAAQ,EACN,OAAO,QAAQ,KAAK,QAAQ,IAAI,QAAQ,YAAY,UAAU;YAC5D,CAAC,CAAC,QAAQ;YACV,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC,GAAG,IAAI;KAC/C,CAAC;AACJ,CAAC;AAED;;;;;GAKG;AACH,SAAgB,iBAAiB,CAAC,IAAY;IAC5C,OAAO,kBAAkB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACvC,CAAC;AAED;;;;;GAKG;AACH,SAAgB,0BAA0B,CAAC,IAAY;IACrD,OAAO,sBAAsB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC3C,CAAC;AAED;;;;;GAKG;AACI,KAAK,UAAU,eAAe,CAAC,eAAuB;IAC3D,MAAM,OAAO,GAAG,MAAM,kBAAE,CAAC,QAAQ,CAAC,eAAe,EAAE,OAAO,CAAC,CAAC;IAE5D,OAAO,IAAI,CAAC,KAAK,CAAC,OAAO,CAAoB,CAAC;AAChD,CAAC"}
|
|
@@ -71,14 +71,12 @@
|
|
|
71
71
|
},
|
|
72
72
|
"declarationMap": {
|
|
73
73
|
"type": "boolean",
|
|
74
|
-
"description": "Generates a sourcemap for each corresponding '.d.ts' file."
|
|
75
|
-
"default": false
|
|
74
|
+
"description": "Generates a sourcemap for each corresponding '.d.ts' file."
|
|
76
75
|
},
|
|
77
76
|
"compilationMode": {
|
|
78
77
|
"type": "string",
|
|
79
78
|
"description": "Angular compilation mode. Use 'partial' when publishing to npm (APF requirement). Use 'full' only during development or for private, internal monorepo packages that are never published.",
|
|
80
|
-
"enum": ["partial", "full"]
|
|
81
|
-
"default": "partial"
|
|
79
|
+
"enum": ["partial", "full"]
|
|
82
80
|
},
|
|
83
81
|
"allowedNonPeerDependencies": {
|
|
84
82
|
"description": "A list of package names allowed in the 'dependencies' and 'optionalDependencies' sections of package.json. Values can be regular expression patterns.",
|