@angular/build 22.2.2 → 22.3.0-next.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (101) hide show
  1. package/builders.json +5 -0
  2. package/package.json +19 -18
  3. package/src/builders/application/chunk-optimizer.js +2 -1
  4. package/src/builders/application/chunk-optimizer.js.map +1 -1
  5. package/src/builders/application/options.js +1 -2
  6. package/src/builders/application/options.js.map +1 -1
  7. package/src/builders/dev-server/options.js +1 -1
  8. package/src/builders/dev-server/options.js.map +1 -1
  9. package/src/builders/dev-server/vite/server.js +1 -1
  10. package/src/builders/dev-server/vite/server.js.map +1 -1
  11. package/src/builders/library/builder.d.ts +19 -0
  12. package/src/builders/library/builder.js +285 -0
  13. package/src/builders/library/builder.js.map +1 -0
  14. package/src/builders/library/index.d.ts +13 -0
  15. package/src/builders/library/index.js +17 -0
  16. package/src/builders/library/index.js.map +1 -0
  17. package/src/builders/library/options.d.ts +11 -0
  18. package/src/builders/library/options.js +107 -0
  19. package/src/builders/library/options.js.map +1 -0
  20. package/src/builders/library/pipeline/assets.d.ts +18 -0
  21. package/src/builders/library/pipeline/assets.js +67 -0
  22. package/src/builders/library/pipeline/assets.js.map +1 -0
  23. package/src/builders/library/pipeline/build-action.d.ts +56 -0
  24. package/src/builders/library/pipeline/build-action.js +170 -0
  25. package/src/builders/library/pipeline/build-action.js.map +1 -0
  26. package/src/builders/library/pipeline/bundler.d.ts +44 -0
  27. package/src/builders/library/pipeline/bundler.js +336 -0
  28. package/src/builders/library/pipeline/bundler.js.map +1 -0
  29. package/src/builders/library/pipeline/compilation.d.ts +39 -0
  30. package/src/builders/library/pipeline/compilation.js +197 -0
  31. package/src/builders/library/pipeline/compilation.js.map +1 -0
  32. package/src/builders/library/pipeline/entry-points.d.ts +34 -0
  33. package/src/builders/library/pipeline/entry-points.js +194 -0
  34. package/src/builders/library/pipeline/entry-points.js.map +1 -0
  35. package/src/builders/library/pipeline/package-manifests.d.ts +17 -0
  36. package/src/builders/library/pipeline/package-manifests.js +119 -0
  37. package/src/builders/library/pipeline/package-manifests.js.map +1 -0
  38. package/src/builders/library/pipeline/stylesheet-bundler.d.ts +19 -0
  39. package/src/builders/library/pipeline/stylesheet-bundler.js +39 -0
  40. package/src/builders/library/pipeline/stylesheet-bundler.js.map +1 -0
  41. package/src/builders/library/pipeline/types.d.ts +54 -0
  42. package/src/builders/library/pipeline/utils.d.ts +69 -0
  43. package/src/builders/library/pipeline/utils.js +73 -0
  44. package/src/builders/library/pipeline/utils.js.map +1 -0
  45. package/src/builders/library/schema.d.ts +149 -0
  46. package/src/builders/library/schema.js +26 -0
  47. package/src/builders/library/schema.js.map +1 -0
  48. package/src/builders/library/schema.json +168 -0
  49. package/src/builders/library/types.d.ts +125 -0
  50. package/src/builders/library/types.js +10 -0
  51. package/src/builders/library/types.js.map +1 -0
  52. package/src/builders/ng-packagr/builder.js +2 -2
  53. package/src/builders/ng-packagr/builder.js.map +1 -1
  54. package/src/builders/unit-test/builder.js +25 -3
  55. package/src/builders/unit-test/builder.js.map +1 -1
  56. package/src/builders/unit-test/options.d.ts +1 -0
  57. package/src/builders/unit-test/options.js +3 -3
  58. package/src/builders/unit-test/options.js.map +1 -1
  59. package/src/builders/unit-test/runners/api.d.ts +1 -1
  60. package/src/builders/unit-test/runners/karma/executor.js +1 -1
  61. package/src/builders/unit-test/runners/karma/executor.js.map +1 -1
  62. package/src/builders/unit-test/runners/vitest/build-options.d.ts +8 -2
  63. package/src/builders/unit-test/runners/vitest/build-options.js +21 -45
  64. package/src/builders/unit-test/runners/vitest/build-options.js.map +1 -1
  65. package/src/builders/unit-test/runners/vitest/index.js +2 -2
  66. package/src/builders/unit-test/runners/vitest/index.js.map +1 -1
  67. package/src/builders/unit-test/schema.d.ts +6 -0
  68. package/src/builders/unit-test/schema.js.map +1 -1
  69. package/src/builders/unit-test/schema.json +8 -0
  70. package/src/tools/angular/compilation/angular-compilation.d.ts +2 -1
  71. package/src/tools/angular/compilation/angular-compilation.js.map +1 -1
  72. package/src/tools/angular/compilation/aot-compilation.d.ts +1 -1
  73. package/src/tools/angular/compilation/aot-compilation.js +20 -11
  74. package/src/tools/angular/compilation/aot-compilation.js.map +1 -1
  75. package/src/tools/angular/compilation/compiler-options.d.ts +4 -1
  76. package/src/tools/angular/compilation/compiler-options.js +24 -7
  77. package/src/tools/angular/compilation/compiler-options.js.map +1 -1
  78. package/src/tools/angular/compilation/jit-compilation.d.ts +1 -1
  79. package/src/tools/angular/compilation/jit-compilation.js +2 -2
  80. package/src/tools/angular/compilation/jit-compilation.js.map +1 -1
  81. package/src/tools/angular/compilation/parallel-compilation.d.ts +1 -1
  82. package/src/tools/angular/compilation/parallel-compilation.js +2 -1
  83. package/src/tools/angular/compilation/parallel-compilation.js.map +1 -1
  84. package/src/tools/angular/compilation/parallel-worker.d.ts +1 -0
  85. package/src/tools/angular/compilation/parallel-worker.js +2 -1
  86. package/src/tools/angular/compilation/parallel-worker.js.map +1 -1
  87. package/src/tools/angular/compilation/typescript-compilation.d.ts +1 -1
  88. package/src/tools/angular/compilation/typescript-compilation.js +2 -2
  89. package/src/tools/angular/compilation/typescript-compilation.js.map +1 -1
  90. package/src/tools/esbuild/stylesheets/stylesheet-cache-key.d.ts +1 -0
  91. package/src/tools/esbuild/stylesheets/stylesheet-cache-key.js +2 -0
  92. package/src/tools/esbuild/stylesheets/stylesheet-cache-key.js.map +1 -1
  93. package/src/utils/load-rolldown.d.ts +27 -0
  94. package/src/utils/load-rolldown.js +79 -0
  95. package/src/utils/load-rolldown.js.map +1 -0
  96. package/src/utils/normalize-cache.d.ts +14 -1
  97. package/src/utils/normalize-cache.js +18 -4
  98. package/src/utils/normalize-cache.js.map +1 -1
  99. package/src/utils/resolve-assets.js +1 -1
  100. package/src/utils/resolve-assets.js.map +1 -1
  101. package/src/utils/version.js +1 -1
@@ -0,0 +1,194 @@
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.getEntryPointBundleName = getEntryPointBundleName;
14
+ exports.normalizeEntryPoints = normalizeEntryPoints;
15
+ exports.haveEntryPointsChanged = haveEntryPointsChanged;
16
+ exports.updateWatchedEntryPoints = updateWatchedEntryPoints;
17
+ const node_path_1 = __importDefault(require("node:path"));
18
+ const path_1 = require("../../../utils/path");
19
+ /**
20
+ * Computes the base bundle file name for an entry point.
21
+ *
22
+ * @param packageName The package name from package.json.
23
+ * @param entryPointName The entry point subpath name (defaults to '.').
24
+ * @returns The sanitized bundle base name.
25
+ */
26
+ function getEntryPointBundleName(packageName, entryPointName = '.') {
27
+ const isPrimary = !entryPointName || entryPointName === '.';
28
+ const pkgName = packageName[0] === '@' ? packageName.slice(1) : packageName;
29
+ const epName = isPrimary ? pkgName : `${pkgName}-${entryPointName}`;
30
+ return epName.replaceAll('/', '-').toLowerCase();
31
+ }
32
+ /**
33
+ * Normalizes a single entry point specification.
34
+ *
35
+ * @param key The entry point key from package.json exports (e.g. '.' or './testing').
36
+ * @param posixKey Normalized POSIX key without trailing slashes.
37
+ * @param isPrimary Whether this is the primary entry point.
38
+ * @param targetPath The relative file path string from exports.
39
+ * @param projectRoot The library project root directory.
40
+ * @param packageName The root package name (e.g. `@my/lib`).
41
+ * @returns The normalized entry point descriptor.
42
+ */
43
+ function normalizeEntryPoint(key, posixKey, isPrimary, targetPath, projectRoot, packageName) {
44
+ const name = isPrimary
45
+ ? '.'
46
+ : posixKey[0] === '.' && posixKey[1] === '/'
47
+ ? posixKey.slice(2)
48
+ : posixKey;
49
+ if (name !== '.' && (node_path_1.default.posix.isAbsolute(name) || name.includes('..'))) {
50
+ throw new Error(`Invalid entry point key '${key}'. Entry point keys must be relative subpaths without '..' (e.g. './testing').`);
51
+ }
52
+ const subpath = isPrimary ? '.' : `./${name}`;
53
+ const displayName = (isPrimary ? packageName : `${packageName}/${name}`).toLowerCase();
54
+ const bundleName = getEntryPointBundleName(packageName, name);
55
+ const entryFilePath = node_path_1.default.resolve(projectRoot, targetPath);
56
+ if (!/(?<!\.d)\.(?:ts|mts)$/.test(entryFilePath)) {
57
+ throw new Error(`Entry point '${key}' file path must be a TypeScript file ('.ts' or '.mts'): '${entryFilePath}'.`);
58
+ }
59
+ return {
60
+ subpath,
61
+ name,
62
+ displayName,
63
+ bundleName,
64
+ entryFilePath,
65
+ isPrimary,
66
+ };
67
+ }
68
+ /**
69
+ * Resolves the target TypeScript entry file path from an export value,
70
+ * which may be a string, an array of fallback alternatives, or a condition object.
71
+ *
72
+ * @param value The raw export value for an entry point subpath.
73
+ * @returns The resolved target string path, or undefined if none found.
74
+ */
75
+ function resolveTarget(value) {
76
+ if (typeof value === 'string') {
77
+ return value;
78
+ }
79
+ if (Array.isArray(value)) {
80
+ for (const item of value) {
81
+ const target = resolveTarget(item);
82
+ if (target) {
83
+ return target;
84
+ }
85
+ }
86
+ return undefined;
87
+ }
88
+ if (typeof value === 'object' && value !== null) {
89
+ return resolveTarget(value['default']);
90
+ }
91
+ return undefined;
92
+ }
93
+ /**
94
+ * Normalizes all entry points from the library's `package.json` `exports` field.
95
+ *
96
+ * @param rawExports The `exports` field from `package.json`.
97
+ * @param projectRoot The library project root directory.
98
+ * @param packageJsonPath Path to `package.json` for error reporting.
99
+ * @param packageName The root package name (e.g. `@my/lib`).
100
+ * @returns A Map of normalized entry points keyed by name.
101
+ */
102
+ function normalizeEntryPoints(rawExports, projectRoot, packageJsonPath, packageName) {
103
+ if (!rawExports || (typeof rawExports !== 'string' && typeof rawExports !== 'object')) {
104
+ throw new Error(`The 'package.json' at '${packageJsonPath}' must contain an 'exports' field defining the primary entry point ('.').`);
105
+ }
106
+ let exportsRecord;
107
+ if (typeof rawExports === 'string' || Array.isArray(rawExports)) {
108
+ exportsRecord = { '.': rawExports };
109
+ }
110
+ else {
111
+ // If an object has no keys starting with '.', Node.js treats the entire object as the '.' entry point.
112
+ const hasSubpathKeys = Object.keys(rawExports).some((k) => k.startsWith('.'));
113
+ exportsRecord = hasSubpathKeys ? rawExports : { '.': rawExports };
114
+ }
115
+ const entryPoints = new Map();
116
+ const usedBundleNames = new Map();
117
+ let hasPrimary = false;
118
+ for (const [key, value] of Object.entries(exportsRecord)) {
119
+ const target = resolveTarget(value);
120
+ const posixKey = (0, path_1.toPosixPath)(key).replace(/\/+$/, '');
121
+ const isPrimary = posixKey === '.' || posixKey === '';
122
+ if (!target) {
123
+ if (isPrimary) {
124
+ throw new Error(`The primary entry point '.' in '${packageJsonPath}' must specify a string path ` +
125
+ `or a 'default' condition pointing to a TypeScript file.`);
126
+ }
127
+ // Non-JS/TS conditional export (e.g., sass/style-only subpath); preserve in package.json without compiling.
128
+ continue;
129
+ }
130
+ if (!isPrimary && !/\.m?ts$/.test(target)) {
131
+ // Static asset, stylesheet, or package.json export; preserve in package.json without compiling.
132
+ continue;
133
+ }
134
+ const entryPoint = normalizeEntryPoint(key, posixKey, isPrimary, target, projectRoot, packageName);
135
+ const existingKey = usedBundleNames.get(entryPoint.bundleName);
136
+ if (existingKey) {
137
+ throw new Error(`Duplicate entry point detected: '${key}' resolves to the same bundle name ('${entryPoint.bundleName}') ` +
138
+ `as existing entry point '${existingKey}'. ` +
139
+ `Entry points must be unique and cannot differ only by case, slashes, or hyphens.`);
140
+ }
141
+ usedBundleNames.set(entryPoint.bundleName, key);
142
+ entryPoints.set(entryPoint.name, entryPoint);
143
+ if (entryPoint.isPrimary) {
144
+ hasPrimary = true;
145
+ }
146
+ }
147
+ if (!hasPrimary) {
148
+ throw new Error(`The 'exports' field in '${packageJsonPath}' must contain a primary entry point with key '.'.`);
149
+ }
150
+ return entryPoints;
151
+ }
152
+ /**
153
+ * Determines whether two sets of normalized entry points differ in keys, paths, or subpaths.
154
+ */
155
+ function haveEntryPointsChanged(oldEntryPoints, newEntryPoints) {
156
+ if (oldEntryPoints.size !== newEntryPoints.size) {
157
+ return true;
158
+ }
159
+ for (const [name, oldEp] of oldEntryPoints) {
160
+ const newEp = newEntryPoints.get(name);
161
+ if (!newEp ||
162
+ newEp.entryFilePath !== oldEp.entryFilePath ||
163
+ newEp.subpath !== oldEp.subpath ||
164
+ newEp.bundleName !== oldEp.bundleName ||
165
+ newEp.displayName !== oldEp.displayName) {
166
+ return true;
167
+ }
168
+ }
169
+ return false;
170
+ }
171
+ /**
172
+ * Updates watched files, entry points in options, and cached bundle results when package.json entry points change.
173
+ */
174
+ function updateWatchedEntryPoints(packageJson, options, buildState, watchedCompilationFiles, packageJsonPath) {
175
+ const newEntryPoints = normalizeEntryPoints(packageJson.exports, options.projectRoot, packageJsonPath, options.packageName);
176
+ if (haveEntryPointsChanged(options.entryPoints, newEntryPoints)) {
177
+ for (const entryPoint of newEntryPoints.values()) {
178
+ watchedCompilationFiles.add((0, path_1.toPosixPath)(entryPoint.entryFilePath));
179
+ }
180
+ for (const name of buildState.previousBundleResults.keys()) {
181
+ const oldEp = options.entryPoints.get(name);
182
+ const newEp = newEntryPoints.get(name);
183
+ if (!newEp ||
184
+ !oldEp ||
185
+ newEp.entryFilePath !== oldEp.entryFilePath ||
186
+ newEp.bundleName !== oldEp.bundleName) {
187
+ buildState.previousBundleResults.delete(name);
188
+ }
189
+ }
190
+ options.entryPoints = newEntryPoints;
191
+ buildState.hasEntryPointsChanges = true;
192
+ }
193
+ }
194
+ //# sourceMappingURL=entry-points.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"entry-points.js","sourceRoot":"","sources":["entry-points.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;;;AAkBH,0DAMC;AA6FD,oDAiFC;AAKD,wDAsBC;AAKD,4DAmCC;AAvQD,0DAA6B;AAC7B,8CAAkD;AAQlD;;;;;;GAMG;AACH,SAAgB,uBAAuB,CAAC,WAAmB,EAAE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BAAqB,GAAG,IAAI,CAAC;IAC1C,CAAC;AACH,CAAC"}
@@ -0,0 +1,17 @@
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 MemoryOutputFile } from './utils';
10
+ /**
11
+ * Generates the APF package.json and secondary entry point package.json manifests.
12
+ *
13
+ * @param options The normalized library options.
14
+ * @param isWatchMode Whether the builder is running in watch mode.
15
+ * @returns An array of memory output files containing generated package manifests and .npmignore.
16
+ */
17
+ export declare function generatePackageManifests(options: NormalizedLibraryOptions, isWatchMode: boolean): MemoryOutputFile[];
@@ -0,0 +1,119 @@
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.generatePackageManifests = generatePackageManifests;
14
+ const node_path_1 = __importDefault(require("node:path"));
15
+ const utils_1 = require("./utils");
16
+ /**
17
+ * Generates the APF package.json and secondary entry point package.json manifests.
18
+ *
19
+ * @param options The normalized library options.
20
+ * @param isWatchMode Whether the builder is running in watch mode.
21
+ * @returns An array of memory output files containing generated package manifests and .npmignore.
22
+ */
23
+ function generatePackageManifests(options, isWatchMode) {
24
+ const { packageJson: rawPackageJson, keepLifecycleScripts, compilationMode } = options;
25
+ const { devDependencies: _devDependencies, scripts, name, version, exports: userExports, workspaces: _workspaces, ...restPackageJson } = rawPackageJson;
26
+ const exportsMap = {
27
+ ...(typeof userExports === 'object' && userExports !== null && !Array.isArray(userExports)
28
+ ? userExports
29
+ : {}),
30
+ './package.json': { default: './package.json' },
31
+ };
32
+ const primaryEntryPoint = options.entryPoints.get('.');
33
+ if (!primaryEntryPoint) {
34
+ throw new Error(`Primary entry point '.' was not found in entryPoints.`);
35
+ }
36
+ const primaryName = primaryEntryPoint.bundleName;
37
+ // Configure primary entry point
38
+ const primaryFesm = `./${utils_1.FESM_OUTPUT_DIR}/${primaryName}.mjs`;
39
+ const primaryDts = `./${utils_1.TYPES_OUTPUT_DIR}/${primaryName}.d.ts`;
40
+ exportsMap['.'] = createExportConditions(exportsMap['.'], primaryDts, primaryFesm);
41
+ const distPackageJson = {
42
+ ...restPackageJson,
43
+ name,
44
+ type: 'module',
45
+ sideEffects: rawPackageJson.sideEffects ?? false,
46
+ main: primaryFesm,
47
+ module: primaryFesm,
48
+ typings: primaryDts,
49
+ types: primaryDts,
50
+ exports: exportsMap,
51
+ // Needed because of Webpack's 5 `cachemanagedpaths`
52
+ // https://github.com/angular/angular-cli/issues/20962
53
+ version: isWatchMode ? `0.0.0-watch+${Date.now()}` : version,
54
+ };
55
+ // Retain scripts if keepLifecycleScripts is set
56
+ if (keepLifecycleScripts && scripts) {
57
+ distPackageJson.scripts = scripts;
58
+ }
59
+ // Prevent accidental publishing of non-partial compilation packages (APF requirement)
60
+ if (compilationMode !== 'partial') {
61
+ distPackageJson.scripts = {
62
+ ...distPackageJson.scripts,
63
+ prepublishOnly: 'node --eval "' +
64
+ "console.error('ERROR: Trying to publish a package that has been compiled in full compilation mode. " +
65
+ 'This is not allowed by the Angular Package Format. ' +
66
+ "Please rebuild with compilationMode set to \\'partial\\' before publishing.'); " +
67
+ 'process.exit(1)"',
68
+ };
69
+ }
70
+ // Configure secondary entry points
71
+ const nestedPackageJsonDirs = [];
72
+ const filesToEmit = [];
73
+ for (const entryPoint of options.entryPoints.values()) {
74
+ if (entryPoint.isPrimary) {
75
+ continue;
76
+ }
77
+ const { subpath, name: epSubpathName, bundleName: epName } = entryPoint;
78
+ const epFesm = `./${utils_1.FESM_OUTPUT_DIR}/${epName}.mjs`;
79
+ const epDts = `./${utils_1.TYPES_OUTPUT_DIR}/${epName}.d.ts`;
80
+ exportsMap[subpath] = createExportConditions(exportsMap[subpath], epDts, epFesm);
81
+ // Emit secondary package.json for legacy resolution tools
82
+ nestedPackageJsonDirs.push(epSubpathName);
83
+ const relFesm = node_path_1.default.posix.relative(epSubpathName, epFesm);
84
+ const relDts = node_path_1.default.posix.relative(epSubpathName, epDts);
85
+ const secondaryModule = relFesm[0] === '.' ? relFesm : `./${relFesm}`;
86
+ const secondaryTypings = relDts[0] === '.' ? relDts : `./${relDts}`;
87
+ const secondaryPackageJson = {
88
+ module: secondaryModule,
89
+ typings: secondaryTypings,
90
+ types: secondaryTypings,
91
+ };
92
+ filesToEmit.push((0, utils_1.createMemoryOutputFile)(node_path_1.default.posix.join(epSubpathName, 'package.json'), secondaryPackageJson));
93
+ }
94
+ // Write .npmignore to prevent publishing nested secondary package.json files
95
+ if (nestedPackageJsonDirs.length > 0) {
96
+ const entryPointsJsonPaths = nestedPackageJsonDirs.map((d) => `/${d}/package.json`);
97
+ filesToEmit.push((0, utils_1.createMemoryOutputFile)('.npmignore', `# Nested package.json's are only needed for development.\n${entryPointsJsonPaths.join('\n')}`));
98
+ }
99
+ // create root package.json
100
+ filesToEmit.push((0, utils_1.createMemoryOutputFile)('package.json', distPackageJson));
101
+ return filesToEmit;
102
+ }
103
+ /**
104
+ * Creates or updates export conditions for an entry point, preserving custom user-defined conditions.
105
+ */
106
+ function createExportConditions(existingConditions, dtsPath, fesmPath) {
107
+ const existing = typeof existingConditions === 'object' &&
108
+ existingConditions !== null &&
109
+ !Array.isArray(existingConditions)
110
+ ? existingConditions
111
+ : {};
112
+ const { types: _types, default: _default, ...otherConditions } = existing;
113
+ return {
114
+ types: dtsPath,
115
+ ...otherConditions,
116
+ default: fesmPath,
117
+ };
118
+ }
119
+ //# sourceMappingURL=package-manifests.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"package-manifests.js","sourceRoot":"","sources":["package-manifests.ts"],"names":[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AEG;AACH,SAAS,sBAAsB,CAC7B,kBAA2B,EAC3B,OAAe,EACf,QAAgB;IAEhB,MAAM,QAAQ,GACZ,OAAO,kBAAkB,KAAK,QAAQ;QACtC,kBAAkB,KAAK,IAAI;QAC3B,CAAC,KAAK,CAAC,OAAO,CAAC,kBAAkB,CAAC;QAChC,CAAC,CAAE,kBAA8C;QACjD,CAAC,CAAC,EAAE,CAAC;IAET,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,GAAG,eAAe,EAAE,GAAG,QAAQ,CAAC;IAE1E,OAAO;QACL,KAAK,EAAE,OAAO;QACd,GAAG,eAAe;QAClB,OAAO,EAAE,QAAQ;KAClB,CAAC;AACJ,CAAC"}
@@ -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 { ComponentStylesheetBundler } from '../../../tools/esbuild/angular/component-stylesheets';
9
+ import type { NormalizedLibraryOptions } from '../types';
10
+ export type LibraryStylesheetBundlerOptions = Pick<NormalizedLibraryOptions, 'workspaceRoot' | 'preserveSymlinks' | 'styleIncludePaths' | 'sass' | 'cacheOptions' | 'inlineStyleLanguage' | 'postcssConfiguration' | 'tailwindConfiguration'>;
11
+ /**
12
+ * Creates a stylesheet bundler instance configured for library compilation.
13
+ *
14
+ * @param options The normalized library builder options.
15
+ * @param incremental Whether incremental watch mode is enabled.
16
+ * @param target The esbuild target environments derived from browserslist.
17
+ * @returns A new ComponentStylesheetBundler instance.
18
+ */
19
+ export declare function createComponentStylesheetBundlerForLibrary(options: LibraryStylesheetBundlerOptions, incremental: boolean, target: string[]): ComponentStylesheetBundler;
@@ -0,0 +1,39 @@
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.createComponentStylesheetBundlerForLibrary = createComponentStylesheetBundlerForLibrary;
11
+ const component_stylesheets_1 = require("../../../tools/esbuild/angular/component-stylesheets");
12
+ /**
13
+ * Creates a stylesheet bundler instance configured for library compilation.
14
+ *
15
+ * @param options The normalized library builder options.
16
+ * @param incremental Whether incremental watch mode is enabled.
17
+ * @param target The esbuild target environments derived from browserslist.
18
+ * @returns A new ComponentStylesheetBundler instance.
19
+ */
20
+ function createComponentStylesheetBundlerForLibrary(options, incremental, target) {
21
+ const { workspaceRoot, preserveSymlinks, styleIncludePaths, sass, cacheOptions, inlineStyleLanguage, postcssConfiguration, tailwindConfiguration, } = options;
22
+ const bundleOptions = {
23
+ workspaceRoot,
24
+ optimization: true,
25
+ inlineFonts: false,
26
+ dataurl: true,
27
+ target,
28
+ preserveSymlinks,
29
+ sourcemap: false,
30
+ outputNames: { bundles: '[name]', media: 'media/[name]' },
31
+ includePaths: styleIncludePaths,
32
+ sass,
33
+ cacheOptions,
34
+ postcssConfiguration,
35
+ tailwindConfiguration,
36
+ };
37
+ return new component_stylesheets_1.ComponentStylesheetBundler(bundleOptions, inlineStyleLanguage, incremental);
38
+ }
39
+ //# sourceMappingURL=stylesheet-bundler.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stylesheet-bundler.js","sourceRoot":"","sources":["stylesheet-bundler.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;AA0BH,gGAiCC;AAzDD,gGAAkG;AAgBlG;;;;;;;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"}
@@ -0,0 +1,54 @@
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
+
9
+ declare module 'rolldown-plugin-dts' {
10
+ import type { Plugin } from 'rolldown';
11
+ import type { IsolatedDeclarationsOptions } from 'rolldown/experimental';
12
+
13
+ interface Logger {
14
+ info: (...args: unknown[]) => void;
15
+ warn: (...args: unknown[]) => void;
16
+ error: (...args: unknown[]) => void;
17
+ }
18
+ interface GeneralOptions {
19
+ generator?: 'tsc' | 'oxc' | 'tsgo';
20
+ entry?: string | string[];
21
+ cwd?: string;
22
+ dtsInput?: boolean;
23
+ emitDtsOnly?: boolean;
24
+ tsconfig?: string | boolean;
25
+ tsconfigRaw?: unknown;
26
+ compilerOptions?: unknown;
27
+ sourcemap?: boolean;
28
+ resolver?: 'oxc' | 'tsc';
29
+ cjsDefault?: boolean;
30
+ sideEffects?: boolean;
31
+ logger?: Logger;
32
+ }
33
+
34
+ interface TscOptions {
35
+ build?: boolean;
36
+ incremental?: boolean;
37
+ parallel?: boolean;
38
+ eager?: boolean;
39
+ newContext?: boolean;
40
+ emitJs?: boolean;
41
+ }
42
+
43
+ interface Options extends GeneralOptions, TscOptions {
44
+ oxc?: Omit<IsolatedDeclarationsOptions, 'sourcemap'>;
45
+ tsgo?: TsgoOptions;
46
+ customLanguages?: unknown[];
47
+ }
48
+
49
+ interface TsgoOptions {
50
+ path?: string;
51
+ }
52
+
53
+ export declare function dts(options?: Options): Plugin[];
54
+ }
@@ -0,0 +1,69 @@
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
+ /**
9
+ * The output directory name for ES module format output files.
10
+ */
11
+ export declare const FESM_OUTPUT_DIR = "fesm2022";
12
+ /**
13
+ * The output directory name for TypeScript declaration files output.
14
+ */
15
+ export declare const TYPES_OUTPUT_DIR = "types";
16
+ /**
17
+ * Represents an in-memory file to be emitted to disk.
18
+ */
19
+ export interface MemoryOutputFile {
20
+ type: 'memory';
21
+ /** The destination path where the file should be written. */
22
+ path: string;
23
+ /** The contents of the file as either a string or byte array. */
24
+ contents: string | Uint8Array;
25
+ }
26
+ /**
27
+ * Represents an existing file on disk to be copied to a destination path.
28
+ */
29
+ export interface DiskOutputFile {
30
+ type: 'disk';
31
+ /** The path to the source file on disk. */
32
+ source: string;
33
+ /** The destination path where the file should be copied. */
34
+ path: string;
35
+ }
36
+ /**
37
+ * Represents a file to be emitted to disk, either from memory or copied from disk.
38
+ */
39
+ export type OutputFile = MemoryOutputFile | DiskOutputFile;
40
+ /**
41
+ * Creates an output file descriptor for an existing file on disk.
42
+ *
43
+ * @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.
46
+ */
47
+ export declare function createDiskOutputFile(source: string, path: string): DiskOutputFile;
48
+ /**
49
+ * Creates an output file descriptor for an in-memory file.
50
+ *
51
+ * @param path The destination path where the file should be written.
52
+ * @param contents The contents of the file as either a string, byte array, or JSON object.
53
+ * @returns A {@link MemoryOutputFile} descriptor.
54
+ */
55
+ export declare function createMemoryOutputFile(path: string, contents: string | Uint8Array | Record<string, unknown>): MemoryOutputFile;
56
+ /**
57
+ * Determines whether a file path represents a TypeScript declaration file (`.d.ts`, `.d.mts`, or `.d.cts`).
58
+ *
59
+ * @param path The file path to check.
60
+ * @returns True if the path ends with `.d.ts`, `.d.mts`, or `.d.cts`.
61
+ */
62
+ export declare function isDeclarationFile(path: string): boolean;
63
+ /**
64
+ * Determines whether a file path represents a declaration source map file (`.d.ts.map`, `.d.mts.map`, or `.d.cts.map`).
65
+ *
66
+ * @param path The file path to check.
67
+ * @returns True if the path ends with `.d.ts.map`, `.d.mts.map`, or `.d.cts.map`.
68
+ */
69
+ export declare function isDeclarationSourceMapFile(path: string): boolean;
@@ -0,0 +1,73 @@
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.TYPES_OUTPUT_DIR = exports.FESM_OUTPUT_DIR = void 0;
11
+ exports.createDiskOutputFile = createDiskOutputFile;
12
+ exports.createMemoryOutputFile = createMemoryOutputFile;
13
+ exports.isDeclarationFile = isDeclarationFile;
14
+ exports.isDeclarationSourceMapFile = isDeclarationSourceMapFile;
15
+ const IS_DTS_FILE_REGEXP = /\.d\.[cm]?ts$/i;
16
+ const IS_DTS_MAP_FILE_REGEXP = /\.d\.[cm]?ts\.map$/i;
17
+ /**
18
+ * The output directory name for ES module format output files.
19
+ */
20
+ exports.FESM_OUTPUT_DIR = 'fesm2022';
21
+ /**
22
+ * The output directory name for TypeScript declaration files output.
23
+ */
24
+ exports.TYPES_OUTPUT_DIR = 'types';
25
+ /**
26
+ * Creates an output file descriptor for an existing file on disk.
27
+ *
28
+ * @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.
31
+ */
32
+ function createDiskOutputFile(source, path) {
33
+ return {
34
+ type: 'disk',
35
+ source,
36
+ path,
37
+ };
38
+ }
39
+ /**
40
+ * Creates an output file descriptor for an in-memory file.
41
+ *
42
+ * @param path The destination path where the file should be written.
43
+ * @param contents The contents of the file as either a string, byte array, or JSON object.
44
+ * @returns A {@link MemoryOutputFile} descriptor.
45
+ */
46
+ function createMemoryOutputFile(path, contents) {
47
+ return {
48
+ type: 'memory',
49
+ path,
50
+ contents: typeof contents === 'string' || contents instanceof Uint8Array
51
+ ? contents
52
+ : JSON.stringify(contents, null, 2) + '\n',
53
+ };
54
+ }
55
+ /**
56
+ * Determines whether a file path represents a TypeScript declaration file (`.d.ts`, `.d.mts`, or `.d.cts`).
57
+ *
58
+ * @param path The file path to check.
59
+ * @returns True if the path ends with `.d.ts`, `.d.mts`, or `.d.cts`.
60
+ */
61
+ function isDeclarationFile(path) {
62
+ return IS_DTS_FILE_REGEXP.test(path);
63
+ }
64
+ /**
65
+ * Determines whether a file path represents a declaration source map file (`.d.ts.map`, `.d.mts.map`, or `.d.cts.map`).
66
+ *
67
+ * @param path The file path to check.
68
+ * @returns True if the path ends with `.d.ts.map`, `.d.mts.map`, or `.d.cts.map`.
69
+ */
70
+ function isDeclarationSourceMapFile(path) {
71
+ return IS_DTS_MAP_FILE_REGEXP.test(path);
72
+ }
73
+ //# sourceMappingURL=utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.js","sourceRoot":"","sources":["utils.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;AAqDH,oDAMC;AASD,wDAYC;AAQD,8CAEC;AAQD,gEAEC;AAlGD,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,IAAI,EAAE,MAAM;QACZ,MAAM;QACN,IAAI;KACL,CAAC;AACJ,CAAC;AAED;;;;;;GAMG;AACH,SAAgB,sBAAsB,CACpC,IAAY,EACZ,QAAuD;IAEvD,OAAO;QACL,IAAI,EAAE,QAAQ;QACd,IAAI;QACJ,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"}