@angular/build 22.2.2 → 22.3.0-next.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/builders.json +5 -0
- package/package.json +19 -18
- package/src/builders/application/chunk-optimizer.js +2 -1
- package/src/builders/application/chunk-optimizer.js.map +1 -1
- package/src/builders/application/options.js +1 -2
- package/src/builders/application/options.js.map +1 -1
- package/src/builders/dev-server/options.js +1 -1
- package/src/builders/dev-server/options.js.map +1 -1
- package/src/builders/dev-server/vite/server.js +1 -1
- package/src/builders/dev-server/vite/server.js.map +1 -1
- package/src/builders/library/builder.d.ts +19 -0
- package/src/builders/library/builder.js +285 -0
- package/src/builders/library/builder.js.map +1 -0
- package/src/builders/library/index.d.ts +13 -0
- package/src/builders/library/index.js +17 -0
- package/src/builders/library/index.js.map +1 -0
- package/src/builders/library/options.d.ts +11 -0
- package/src/builders/library/options.js +107 -0
- package/src/builders/library/options.js.map +1 -0
- package/src/builders/library/pipeline/assets.d.ts +18 -0
- package/src/builders/library/pipeline/assets.js +67 -0
- package/src/builders/library/pipeline/assets.js.map +1 -0
- package/src/builders/library/pipeline/build-action.d.ts +56 -0
- package/src/builders/library/pipeline/build-action.js +170 -0
- package/src/builders/library/pipeline/build-action.js.map +1 -0
- package/src/builders/library/pipeline/bundler.d.ts +44 -0
- package/src/builders/library/pipeline/bundler.js +336 -0
- package/src/builders/library/pipeline/bundler.js.map +1 -0
- package/src/builders/library/pipeline/compilation.d.ts +39 -0
- package/src/builders/library/pipeline/compilation.js +197 -0
- package/src/builders/library/pipeline/compilation.js.map +1 -0
- package/src/builders/library/pipeline/entry-points.d.ts +34 -0
- package/src/builders/library/pipeline/entry-points.js +194 -0
- package/src/builders/library/pipeline/entry-points.js.map +1 -0
- package/src/builders/library/pipeline/package-manifests.d.ts +17 -0
- package/src/builders/library/pipeline/package-manifests.js +119 -0
- package/src/builders/library/pipeline/package-manifests.js.map +1 -0
- package/src/builders/library/pipeline/stylesheet-bundler.d.ts +19 -0
- package/src/builders/library/pipeline/stylesheet-bundler.js +39 -0
- package/src/builders/library/pipeline/stylesheet-bundler.js.map +1 -0
- package/src/builders/library/pipeline/types.d.ts +54 -0
- package/src/builders/library/pipeline/utils.d.ts +69 -0
- package/src/builders/library/pipeline/utils.js +73 -0
- package/src/builders/library/pipeline/utils.js.map +1 -0
- package/src/builders/library/schema.d.ts +149 -0
- package/src/builders/library/schema.js +26 -0
- package/src/builders/library/schema.js.map +1 -0
- package/src/builders/library/schema.json +168 -0
- package/src/builders/library/types.d.ts +125 -0
- package/src/builders/library/types.js +10 -0
- package/src/builders/library/types.js.map +1 -0
- package/src/builders/ng-packagr/builder.js +2 -2
- package/src/builders/ng-packagr/builder.js.map +1 -1
- package/src/builders/unit-test/builder.js +25 -3
- package/src/builders/unit-test/builder.js.map +1 -1
- package/src/builders/unit-test/options.d.ts +1 -0
- package/src/builders/unit-test/options.js +3 -3
- package/src/builders/unit-test/options.js.map +1 -1
- package/src/builders/unit-test/runners/api.d.ts +1 -1
- package/src/builders/unit-test/runners/karma/executor.js +1 -1
- package/src/builders/unit-test/runners/karma/executor.js.map +1 -1
- package/src/builders/unit-test/runners/vitest/build-options.d.ts +8 -2
- package/src/builders/unit-test/runners/vitest/build-options.js +21 -45
- package/src/builders/unit-test/runners/vitest/build-options.js.map +1 -1
- package/src/builders/unit-test/runners/vitest/index.js +2 -2
- package/src/builders/unit-test/runners/vitest/index.js.map +1 -1
- package/src/builders/unit-test/schema.d.ts +6 -0
- package/src/builders/unit-test/schema.js.map +1 -1
- package/src/builders/unit-test/schema.json +8 -0
- package/src/tools/angular/compilation/angular-compilation.d.ts +2 -1
- package/src/tools/angular/compilation/angular-compilation.js.map +1 -1
- package/src/tools/angular/compilation/aot-compilation.d.ts +1 -1
- package/src/tools/angular/compilation/aot-compilation.js +20 -11
- package/src/tools/angular/compilation/aot-compilation.js.map +1 -1
- package/src/tools/angular/compilation/compiler-options.d.ts +4 -1
- package/src/tools/angular/compilation/compiler-options.js +24 -7
- package/src/tools/angular/compilation/compiler-options.js.map +1 -1
- package/src/tools/angular/compilation/jit-compilation.d.ts +1 -1
- package/src/tools/angular/compilation/jit-compilation.js +2 -2
- package/src/tools/angular/compilation/jit-compilation.js.map +1 -1
- package/src/tools/angular/compilation/parallel-compilation.d.ts +1 -1
- package/src/tools/angular/compilation/parallel-compilation.js +2 -1
- package/src/tools/angular/compilation/parallel-compilation.js.map +1 -1
- package/src/tools/angular/compilation/parallel-worker.d.ts +1 -0
- package/src/tools/angular/compilation/parallel-worker.js +2 -1
- package/src/tools/angular/compilation/parallel-worker.js.map +1 -1
- package/src/tools/angular/compilation/typescript-compilation.d.ts +1 -1
- package/src/tools/angular/compilation/typescript-compilation.js +2 -2
- package/src/tools/angular/compilation/typescript-compilation.js.map +1 -1
- package/src/tools/esbuild/stylesheets/stylesheet-cache-key.d.ts +1 -0
- package/src/tools/esbuild/stylesheets/stylesheet-cache-key.js +2 -0
- package/src/tools/esbuild/stylesheets/stylesheet-cache-key.js.map +1 -1
- package/src/utils/load-rolldown.d.ts +27 -0
- package/src/utils/load-rolldown.js +79 -0
- package/src/utils/load-rolldown.js.map +1 -0
- package/src/utils/normalize-cache.d.ts +14 -1
- package/src/utils/normalize-cache.js +18 -4
- package/src/utils/normalize-cache.js.map +1 -1
- package/src/utils/resolve-assets.js +1 -1
- package/src/utils/resolve-assets.js.map +1 -1
- package/src/utils/version.js +1 -1
|
@@ -0,0 +1,336 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @license
|
|
4
|
+
* Copyright Google LLC All Rights Reserved.
|
|
5
|
+
*
|
|
6
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
7
|
+
* found in the LICENSE file at https://angular.dev/license
|
|
8
|
+
*/
|
|
9
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
12
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
13
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
14
|
+
}
|
|
15
|
+
Object.defineProperty(o, k2, desc);
|
|
16
|
+
}) : (function(o, m, k, k2) {
|
|
17
|
+
if (k2 === undefined) k2 = k;
|
|
18
|
+
o[k2] = m[k];
|
|
19
|
+
}));
|
|
20
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
21
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
22
|
+
}) : function(o, v) {
|
|
23
|
+
o["default"] = v;
|
|
24
|
+
});
|
|
25
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
26
|
+
var ownKeys = function(o) {
|
|
27
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
28
|
+
var ar = [];
|
|
29
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
30
|
+
return ar;
|
|
31
|
+
};
|
|
32
|
+
return ownKeys(o);
|
|
33
|
+
};
|
|
34
|
+
return function (mod) {
|
|
35
|
+
if (mod && mod.__esModule) return mod;
|
|
36
|
+
var result = {};
|
|
37
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
38
|
+
__setModuleDefault(result, mod);
|
|
39
|
+
return result;
|
|
40
|
+
};
|
|
41
|
+
})();
|
|
42
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
43
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
44
|
+
};
|
|
45
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
46
|
+
exports.bundleEntryPoints = bundleEntryPoints;
|
|
47
|
+
const node_assert_1 = __importDefault(require("node:assert"));
|
|
48
|
+
const node_path_1 = __importDefault(require("node:path"));
|
|
49
|
+
const load_rolldown_1 = require("../../../utils/load-rolldown");
|
|
50
|
+
const path_1 = require("../../../utils/path");
|
|
51
|
+
const utils_1 = require("./utils");
|
|
52
|
+
const ESM_EXTENSIONS = ['.js', '.mjs', '/index.js', '/index.mjs'];
|
|
53
|
+
const DTS_EXTENSIONS = ['.d.ts', '.d.mts', '/index.d.ts', '/index.d.mts'];
|
|
54
|
+
/**
|
|
55
|
+
* Bundles the compiled in-memory JavaScript and declaration files for all dirty entry points
|
|
56
|
+
* using at most 2 Rolldown instances total (1 for all .mjs bundles, 1 for all .d.ts bundles).
|
|
57
|
+
*
|
|
58
|
+
* @param items The collection of entry point inputs with change statuses.
|
|
59
|
+
* @param esmFiles Map of virtual ESM output file paths to their content.
|
|
60
|
+
* @param dtsFiles Map of virtual TypeScript declaration file paths to their content.
|
|
61
|
+
* @param options The normalized library builder options.
|
|
62
|
+
* @returns A promise resolving to the bundled output files and bundle cache results.
|
|
63
|
+
*/
|
|
64
|
+
async function bundleEntryPoints(items, esmFiles, dtsFiles, options) {
|
|
65
|
+
const bundleResults = new Map();
|
|
66
|
+
if (items.length === 0) {
|
|
67
|
+
return { filesToEmit: [], bundleResults, warnings: [] };
|
|
68
|
+
}
|
|
69
|
+
const esmEntryPoints = [];
|
|
70
|
+
const dtsEntryPoints = [];
|
|
71
|
+
for (const item of items) {
|
|
72
|
+
if (item.hasEsmChanges || !item.previousBundleResult) {
|
|
73
|
+
esmEntryPoints.push(item.entryPoint);
|
|
74
|
+
}
|
|
75
|
+
if (item.hasDtsChanges || !item.previousBundleResult) {
|
|
76
|
+
dtsEntryPoints.push(item.entryPoint);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
const [esmOutput, dtsOutput] = await Promise.all([
|
|
80
|
+
bundleAllEsm(esmEntryPoints, esmFiles, options),
|
|
81
|
+
bundleAllDts(dtsEntryPoints, dtsFiles, options),
|
|
82
|
+
]);
|
|
83
|
+
for (const { entryPoint, previousBundleResult } of items) {
|
|
84
|
+
const { bundleName, name } = entryPoint;
|
|
85
|
+
bundleResults.set(name, {
|
|
86
|
+
esmModuleIds: esmOutput.moduleIdsByBundle.get(bundleName) ??
|
|
87
|
+
previousBundleResult?.esmModuleIds ??
|
|
88
|
+
new Set(),
|
|
89
|
+
dtsModuleIds: dtsOutput.moduleIdsByBundle.get(bundleName) ??
|
|
90
|
+
previousBundleResult?.dtsModuleIds ??
|
|
91
|
+
new Set(),
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
return {
|
|
95
|
+
filesToEmit: [...esmOutput.filesToEmit, ...dtsOutput.filesToEmit],
|
|
96
|
+
bundleResults,
|
|
97
|
+
warnings: [...esmOutput.warnings, ...dtsOutput.warnings],
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Generates the Rolldown input mapping object from the specified entry points.
|
|
102
|
+
*
|
|
103
|
+
* @param entryPoints The entry points to include in the bundle input map.
|
|
104
|
+
* @param dtsMode Whether the input map is for declaration files (.d.ts) rather than ESM files (.js).
|
|
105
|
+
* @returns A record mapping bundle names to virtual entry file paths.
|
|
106
|
+
*/
|
|
107
|
+
function resolveEntryInputMap(entryPoints, dtsMode) {
|
|
108
|
+
const input = {};
|
|
109
|
+
for (const { bundleName, entryFilePath } of entryPoints) {
|
|
110
|
+
const posixPath = (0, path_1.toPosixPath)(entryFilePath);
|
|
111
|
+
input[bundleName] = dtsMode
|
|
112
|
+
? posixPath.replace(/\.([cm]?ts)$/, '.d.$1')
|
|
113
|
+
: posixPath.replace(/\.([cm]?)ts$/, '.$1js');
|
|
114
|
+
}
|
|
115
|
+
return input;
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Creates a Rolldown plugin that loads modules from an in-memory file map
|
|
119
|
+
* and prevents illegal cross-entry-point sibling imports.
|
|
120
|
+
*
|
|
121
|
+
* @param files Map of virtual file paths to their content.
|
|
122
|
+
* @param extensions Candidate extensions to probe when resolving extensionless module specifiers.
|
|
123
|
+
* @param includeMap Whether source map files should also be loaded from the memory map.
|
|
124
|
+
* @returns A Rolldown plugin instance.
|
|
125
|
+
*/
|
|
126
|
+
function createMemoryFileLoaderPlugin(files, extensions, includeMap) {
|
|
127
|
+
return {
|
|
128
|
+
name: 'memory-file-loader',
|
|
129
|
+
resolveId: {
|
|
130
|
+
order: 'pre',
|
|
131
|
+
handler(id, importer) {
|
|
132
|
+
if (id[0] === '\0') {
|
|
133
|
+
return undefined;
|
|
134
|
+
}
|
|
135
|
+
if (!importer) {
|
|
136
|
+
return files.has(id) ? { id, external: false } : undefined;
|
|
137
|
+
}
|
|
138
|
+
if (id[0] !== '.' && !node_path_1.default.isAbsolute(id)) {
|
|
139
|
+
return { id, external: true };
|
|
140
|
+
}
|
|
141
|
+
const posixId = (0, path_1.toPosixPath)(id);
|
|
142
|
+
const importerPosix = (0, path_1.toPosixPath)(importer);
|
|
143
|
+
const resolved = posixId[0] === '.'
|
|
144
|
+
? node_path_1.default.posix.join(node_path_1.default.posix.dirname(importerPosix), posixId)
|
|
145
|
+
: posixId;
|
|
146
|
+
let resolvedCandidate;
|
|
147
|
+
if (files.has(resolved)) {
|
|
148
|
+
resolvedCandidate = resolved;
|
|
149
|
+
}
|
|
150
|
+
else {
|
|
151
|
+
const base = resolved.replace(/\.[cm]?js$/, '');
|
|
152
|
+
for (const ext of extensions) {
|
|
153
|
+
const candidate = base + ext;
|
|
154
|
+
if (files.has(candidate)) {
|
|
155
|
+
resolvedCandidate = candidate;
|
|
156
|
+
break;
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
if (resolvedCandidate) {
|
|
161
|
+
return { id: resolvedCandidate, external: false };
|
|
162
|
+
}
|
|
163
|
+
return undefined;
|
|
164
|
+
},
|
|
165
|
+
},
|
|
166
|
+
load(id) {
|
|
167
|
+
const code = files.get(id);
|
|
168
|
+
if (code === undefined) {
|
|
169
|
+
return null;
|
|
170
|
+
}
|
|
171
|
+
return {
|
|
172
|
+
code,
|
|
173
|
+
map: includeMap ? files.get(`${id}.map`) : undefined,
|
|
174
|
+
};
|
|
175
|
+
},
|
|
176
|
+
};
|
|
177
|
+
}
|
|
178
|
+
/**
|
|
179
|
+
* Processes Rolldown output assets and chunks, extracting emitted files and computing
|
|
180
|
+
* the transitive set of module IDs belonging to each entry point bundle.
|
|
181
|
+
*
|
|
182
|
+
* @param output The array of output chunks and assets from Rolldown.
|
|
183
|
+
* @param dir The destination output directory prefix.
|
|
184
|
+
* @returns The processed multi-bundle output.
|
|
185
|
+
*/
|
|
186
|
+
function processRolldownOutput(output, dir) {
|
|
187
|
+
const filesToEmit = [];
|
|
188
|
+
const moduleIdsByBundle = new Map();
|
|
189
|
+
const chunksByFileName = new Map();
|
|
190
|
+
const entryChunks = [];
|
|
191
|
+
for (const item of output) {
|
|
192
|
+
filesToEmit.push((0, utils_1.createMemoryOutputFile)(node_path_1.default.posix.join(dir, item.fileName), item.type === 'chunk' ? item.code : item.source));
|
|
193
|
+
if (item.type === 'chunk') {
|
|
194
|
+
chunksByFileName.set(item.fileName, item);
|
|
195
|
+
if (item.isEntry) {
|
|
196
|
+
entryChunks.push(item);
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
for (const entryChunk of entryChunks) {
|
|
201
|
+
const modSet = new Set();
|
|
202
|
+
moduleIdsByBundle.set(entryChunk.name, modSet);
|
|
203
|
+
const visited = new Set();
|
|
204
|
+
const queue = [entryChunk];
|
|
205
|
+
while (queue.length) {
|
|
206
|
+
const chunk = queue.pop();
|
|
207
|
+
if (!chunk) {
|
|
208
|
+
break;
|
|
209
|
+
}
|
|
210
|
+
if (visited.has(chunk)) {
|
|
211
|
+
continue;
|
|
212
|
+
}
|
|
213
|
+
visited.add(chunk);
|
|
214
|
+
for (const modId of chunk.moduleIds) {
|
|
215
|
+
if (modId[0] !== '\0') {
|
|
216
|
+
modSet.add((0, path_1.toPosixPath)(modId));
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
for (const depFile of [...chunk.imports, ...chunk.dynamicImports]) {
|
|
220
|
+
const depChunk = chunksByFileName.get(depFile);
|
|
221
|
+
if (depChunk && !visited.has(depChunk)) {
|
|
222
|
+
queue.push(depChunk);
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
return { filesToEmit, moduleIdsByBundle };
|
|
228
|
+
}
|
|
229
|
+
/**
|
|
230
|
+
* Executes a Rolldown bundle build across all provided entry inputs.
|
|
231
|
+
*
|
|
232
|
+
* @param input Map of bundle names to virtual entry file paths.
|
|
233
|
+
* @param plugins Rolldown plugins to use during bundling.
|
|
234
|
+
* @param extension Output file extension ('mjs' or 'd.ts').
|
|
235
|
+
* @param options The normalized library options.
|
|
236
|
+
* @returns A promise resolving to the multi-bundle output.
|
|
237
|
+
*/
|
|
238
|
+
async function executeMultiBundle(input, plugins, extension, options) {
|
|
239
|
+
const { workspaceRoot, preserveSymlinks, declarationMap, outputPath } = options;
|
|
240
|
+
const isDts = extension === 'd.ts';
|
|
241
|
+
let sourcemap;
|
|
242
|
+
let dir;
|
|
243
|
+
if (isDts) {
|
|
244
|
+
dir = utils_1.TYPES_OUTPUT_DIR;
|
|
245
|
+
sourcemap = declarationMap;
|
|
246
|
+
}
|
|
247
|
+
else {
|
|
248
|
+
dir = utils_1.FESM_OUTPUT_DIR;
|
|
249
|
+
// FESM (.mjs) sourcemaps are always enabled.
|
|
250
|
+
sourcemap = true;
|
|
251
|
+
}
|
|
252
|
+
const warnings = [];
|
|
253
|
+
const { rolldown } = await (0, load_rolldown_1.loadRolldown)();
|
|
254
|
+
const bundle = await rolldown({
|
|
255
|
+
context: 'this',
|
|
256
|
+
input,
|
|
257
|
+
cwd: workspaceRoot,
|
|
258
|
+
plugins,
|
|
259
|
+
treeshake: false,
|
|
260
|
+
resolve: { symlinks: !preserveSymlinks },
|
|
261
|
+
checks: { circularDependency: false },
|
|
262
|
+
onLog(level, log) {
|
|
263
|
+
if (level === 'warn') {
|
|
264
|
+
warnings.push(log.message);
|
|
265
|
+
}
|
|
266
|
+
},
|
|
267
|
+
experimental: {
|
|
268
|
+
attachDebugInfo: 'none',
|
|
269
|
+
},
|
|
270
|
+
});
|
|
271
|
+
try {
|
|
272
|
+
const { output } = await bundle.generate({
|
|
273
|
+
format: 'es',
|
|
274
|
+
dir: node_path_1.default.join(outputPath, dir),
|
|
275
|
+
entryFileNames: `[name].${extension}`,
|
|
276
|
+
chunkFileNames: `[name]-[hash].${extension}`,
|
|
277
|
+
sourcemap,
|
|
278
|
+
hoistTransitiveImports: false,
|
|
279
|
+
comments: { jsdoc: isDts, legal: true, annotation: true },
|
|
280
|
+
});
|
|
281
|
+
return {
|
|
282
|
+
...processRolldownOutput(output, dir),
|
|
283
|
+
warnings,
|
|
284
|
+
};
|
|
285
|
+
}
|
|
286
|
+
finally {
|
|
287
|
+
await bundle.close();
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
/**
|
|
291
|
+
* Bundles JavaScript ESM output files for all provided entry points.
|
|
292
|
+
*
|
|
293
|
+
* @param entryPoints The entry points to bundle.
|
|
294
|
+
* @param esmFiles Map of virtual ESM output file paths to contents.
|
|
295
|
+
* @param options The normalized library options.
|
|
296
|
+
* @returns A promise resolving to the multi-bundle output.
|
|
297
|
+
*/
|
|
298
|
+
async function bundleAllEsm(entryPoints, esmFiles, options) {
|
|
299
|
+
if (entryPoints.length === 0) {
|
|
300
|
+
return { filesToEmit: [], moduleIdsByBundle: new Map(), warnings: [] };
|
|
301
|
+
}
|
|
302
|
+
return executeMultiBundle(resolveEntryInputMap(entryPoints, false), [createMemoryFileLoaderPlugin(esmFiles, ESM_EXTENSIONS, true)], 'mjs', options);
|
|
303
|
+
}
|
|
304
|
+
/**
|
|
305
|
+
* Bundles TypeScript declaration (.d.ts) output files for all provided entry points.
|
|
306
|
+
*
|
|
307
|
+
* @param entryPoints The entry points to bundle.
|
|
308
|
+
* @param dtsFiles Map of virtual declaration output file paths to contents.
|
|
309
|
+
* @param options The normalized library options.
|
|
310
|
+
* @returns A promise resolving to the multi-bundle output.
|
|
311
|
+
*/
|
|
312
|
+
async function bundleAllDts(entryPoints, dtsFiles, options) {
|
|
313
|
+
if (entryPoints.length === 0) {
|
|
314
|
+
return { filesToEmit: [], moduleIdsByBundle: new Map(), warnings: [] };
|
|
315
|
+
}
|
|
316
|
+
// Ensure Rolldown's native binding is initialized via `loadRolldown()` before evaluating
|
|
317
|
+
// `rolldown-plugin-dts`, which has top-level imports of `rolldown/experimental`.
|
|
318
|
+
await (0, load_rolldown_1.loadRolldown)();
|
|
319
|
+
const { dts } = await Promise.resolve().then(() => __importStar(require('rolldown-plugin-dts')));
|
|
320
|
+
const dtsSourcemap = options.declarationMap;
|
|
321
|
+
// Filter out `rolldown-plugin-dts:resolver` because all `.d.ts` files are already emitted
|
|
322
|
+
// in-memory by the Angular/TypeScript compilation and resolved via `createMemoryFileLoaderPlugin`.
|
|
323
|
+
// The default `rolldown-plugin-dts:resolver` plugin performs filesystem resolution (`oxc-resolver`)
|
|
324
|
+
// and calls `this.load()` on on-disk `.ts` source files, which is unnecessary and causes a
|
|
325
|
+
// significant performance regression across multi-entry builds.
|
|
326
|
+
const rawDtsPlugins = dts({
|
|
327
|
+
dtsInput: true,
|
|
328
|
+
tsconfig: false,
|
|
329
|
+
sourcemap: dtsSourcemap,
|
|
330
|
+
generator: 'oxc',
|
|
331
|
+
});
|
|
332
|
+
const dtsPlugins = rawDtsPlugins.filter((plugin) => plugin.name !== 'rolldown-plugin-dts:resolver');
|
|
333
|
+
(0, node_assert_1.default)(dtsPlugins.length < rawDtsPlugins.length, 'Expected "rolldown-plugin-dts:resolver" plugin to be present in rolldown-plugin-dts.');
|
|
334
|
+
return executeMultiBundle(resolveEntryInputMap(entryPoints, true), [createMemoryFileLoaderPlugin(dtsFiles, DTS_EXTENSIONS, dtsSourcemap), ...dtsPlugins], 'd.ts', options);
|
|
335
|
+
}
|
|
336
|
+
//# sourceMappingURL=bundler.js.map
|
|
@@ -0,0 +1 @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B,WAA4C,EAC5C,QAAqC,EACrC,OAAiC;IAEjC,IAAI,WAAW,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC7B,OAAO,EAAE,WAAW,EAAE,EAAE,EAAE,iBAAiB,EAAE,IAAI,GAAG,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC;IACzE,CAAC;IAED,yFAAyF;IACzF,iFAAiF;IACjF,MAAM,IAAA,4BAAY,GAAE,CAAC;IACrB,MAAM,EAAE,GAAG,EAAE,GAAG,wDAAa,qBAAqB,GAAC,CAAC;IAEpD,MAAM,YAAY,GAAG,OAAO,CAAC,cAAc,CAAC;IAC5C,0FAA0F;IAC1F,mGAAmG;IACnG,oGAAoG;IACpG,2FAA2F;IAC3F,gEAAgE;IAChE,MAAM,aAAa,GAAG,GAAG,CAAC;QACxB,QAAQ,EAAE,IAAI;QACd,QAAQ,EAAE,KAAK;QACf,SAAS,EAAE,YAAY;QACvB,SAAS,EAAE,KAAK;KACjB,CAAC,CAAC;IAEH,MAAM,UAAU,GAAG,aAAa,CAAC,MAAM,CACrC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI,KAAK,8BAA8B,CAC3D,CAAC;IAEF,IAAA,qBAAM,EACJ,UAAU,CAAC,MAAM,GAAG,aAAa,CAAC,MAAM,EACxC,sFAAsF,CACvF,CAAC;IAEF,OAAO,kBAAkB,CACvB,oBAAoB,CAAC,WAAW,EAAE,IAAI,CAAC,EACvC,CAAC,4BAA4B,CAAC,QAAQ,EAAE,cAAc,EAAE,YAAY,CAAC,EAAE,GAAG,UAAU,CAAC,EACrF,MAAM,EACN,OAAO,CACR,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,39 @@
|
|
|
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 { ComponentStylesheetBundler } from '../../../tools/esbuild/angular/component-stylesheets';
|
|
9
|
+
import type { NormalizedEntryPoint, NormalizedLibraryOptions, SingleProgramCache } from '../types';
|
|
10
|
+
/**
|
|
11
|
+
* Output of the unified library compilation step.
|
|
12
|
+
*/
|
|
13
|
+
export interface LibraryCompilationOutput {
|
|
14
|
+
/** Read-only map of emitted JavaScript files. */
|
|
15
|
+
readonly esmFiles: ReadonlyMap<string, string>;
|
|
16
|
+
/** Read-only map of emitted TypeScript declaration files. */
|
|
17
|
+
readonly dtsFiles: ReadonlyMap<string, string>;
|
|
18
|
+
/** Set of JavaScript file paths that were modified or newly emitted in this iteration. */
|
|
19
|
+
readonly changedEsmFiles: ReadonlySet<string>;
|
|
20
|
+
/** Set of declaration file paths that were modified or newly emitted in this iteration. */
|
|
21
|
+
readonly changedDtsFiles: ReadonlySet<string>;
|
|
22
|
+
/** Set of all source and dependency file paths referenced during compilation. */
|
|
23
|
+
readonly referencedFiles: ReadonlySet<string>;
|
|
24
|
+
/** Cached compilation state for subsequent incremental builds. */
|
|
25
|
+
readonly cache: SingleProgramCache;
|
|
26
|
+
/** Promise that resolves to formatted compilation warnings or rejects on diagnostic errors. */
|
|
27
|
+
readonly diagnosePromise: Promise<string[]>;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Compiles all library entry points in a single TypeScript and Angular compilation pass.
|
|
31
|
+
*
|
|
32
|
+
* @param entryPoints The collection of normalized library entry points to compile.
|
|
33
|
+
* @param options The normalized library builder options.
|
|
34
|
+
* @param stylesheetBundler The component stylesheet bundler instance.
|
|
35
|
+
* @param cached Optional cached compilation state from a previous build iteration.
|
|
36
|
+
* @param modifiedFiles Optional set of modified file paths for incremental compilation.
|
|
37
|
+
* @returns A promise resolving to the compilation output containing emitted files and diagnostics.
|
|
38
|
+
*/
|
|
39
|
+
export declare function compileLibrary(entryPoints: Iterable<NormalizedEntryPoint>, options: NormalizedLibraryOptions, stylesheetBundler: ComponentStylesheetBundler, cached?: SingleProgramCache, modifiedFiles?: Set<string>): Promise<LibraryCompilationOutput>;
|
|
@@ -0,0 +1,197 @@
|
|
|
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.compileLibrary = compileLibrary;
|
|
11
|
+
const esbuild_1 = require("esbuild");
|
|
12
|
+
const node_fs_1 = require("node:fs");
|
|
13
|
+
const compilation_1 = require("../../../tools/angular/compilation");
|
|
14
|
+
const environment_options_1 = require("../../../utils/environment-options");
|
|
15
|
+
const path_1 = require("../../../utils/path");
|
|
16
|
+
const utils_1 = require("./utils");
|
|
17
|
+
const EMITTED_EXTENSIONS = ['.js', '.mjs', '.cjs', '.d.ts', '.d.mts', '.d.cts'];
|
|
18
|
+
/**
|
|
19
|
+
* Compiles all library entry points in a single TypeScript and Angular compilation pass.
|
|
20
|
+
*
|
|
21
|
+
* @param entryPoints The collection of normalized library entry points to compile.
|
|
22
|
+
* @param options The normalized library builder options.
|
|
23
|
+
* @param stylesheetBundler The component stylesheet bundler instance.
|
|
24
|
+
* @param cached Optional cached compilation state from a previous build iteration.
|
|
25
|
+
* @param modifiedFiles Optional set of modified file paths for incremental compilation.
|
|
26
|
+
* @returns A promise resolving to the compilation output containing emitted files and diagnostics.
|
|
27
|
+
*/
|
|
28
|
+
async function compileLibrary(entryPoints, options, stylesheetBundler, cached, modifiedFiles) {
|
|
29
|
+
const { tsConfigPath, compilationMode, preserveSymlinks, colors, declarationMap } = options;
|
|
30
|
+
const entryPathsMap = {};
|
|
31
|
+
const rootFiles = [];
|
|
32
|
+
for (const ep of entryPoints) {
|
|
33
|
+
entryPathsMap[ep.displayName] = [ep.entryFilePath];
|
|
34
|
+
rootFiles.push(ep.entryFilePath);
|
|
35
|
+
}
|
|
36
|
+
const compilationInstance = cached?.compilationInstance ?? (await (0, compilation_1.createAngularCompilation)('aot', false));
|
|
37
|
+
try {
|
|
38
|
+
let effectiveModifiedFiles = modifiedFiles;
|
|
39
|
+
if (cached?.failedFiles?.size) {
|
|
40
|
+
stylesheetBundler.invalidate(cached.failedFiles);
|
|
41
|
+
effectiveModifiedFiles = new Set(modifiedFiles);
|
|
42
|
+
for (const file of cached.failedFiles) {
|
|
43
|
+
effectiveModifiedFiles.add(file);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
if (effectiveModifiedFiles && effectiveModifiedFiles.size > 0) {
|
|
47
|
+
await compilationInstance.update?.(effectiveModifiedFiles);
|
|
48
|
+
}
|
|
49
|
+
const allReferencedFiles = new Set();
|
|
50
|
+
const stylesheetWarnings = [];
|
|
51
|
+
const stylesheetErrors = [];
|
|
52
|
+
const failedFiles = new Set();
|
|
53
|
+
const hostOptions = {
|
|
54
|
+
modifiedFiles: effectiveModifiedFiles,
|
|
55
|
+
async transformStylesheet(data, containingFile, stylesheetFile) {
|
|
56
|
+
const result = stylesheetFile
|
|
57
|
+
? await stylesheetBundler.bundleFile(stylesheetFile)
|
|
58
|
+
: await stylesheetBundler.bundleInline(data, containingFile);
|
|
59
|
+
result.referencedFiles?.forEach((f) => allReferencedFiles.add((0, path_1.toPosixPath)(f)));
|
|
60
|
+
if (result.warnings.length > 0) {
|
|
61
|
+
stylesheetWarnings.push(...result.warnings);
|
|
62
|
+
}
|
|
63
|
+
if (result.errors?.length) {
|
|
64
|
+
stylesheetErrors.push(...result.errors);
|
|
65
|
+
failedFiles.add((0, path_1.toPosixPath)(containingFile));
|
|
66
|
+
if (stylesheetFile) {
|
|
67
|
+
failedFiles.add((0, path_1.toPosixPath)(stylesheetFile));
|
|
68
|
+
}
|
|
69
|
+
return '';
|
|
70
|
+
}
|
|
71
|
+
return result.contents;
|
|
72
|
+
},
|
|
73
|
+
processWebWorker: () => '',
|
|
74
|
+
};
|
|
75
|
+
const { referencedFiles } = await compilationInstance.initialize(tsConfigPath, hostOptions, {
|
|
76
|
+
sourcemap: true,
|
|
77
|
+
preserveSymlinks,
|
|
78
|
+
rootFiles,
|
|
79
|
+
declarationMap,
|
|
80
|
+
compilationMode,
|
|
81
|
+
paths: entryPathsMap,
|
|
82
|
+
}, 'library');
|
|
83
|
+
const emittedFiles = stylesheetErrors.length === 0 ? await compilationInstance.emitAffectedFiles() : [];
|
|
84
|
+
const diagnosePromise = runDiagnosticsAndFormat(compilationInstance, stylesheetErrors, stylesheetWarnings, colors);
|
|
85
|
+
// Prevent unhandled promise rejection if an error occurs before diagnosePromise is awaited.
|
|
86
|
+
diagnosePromise.catch(() => { });
|
|
87
|
+
const esmFiles = cached?.esmFiles ?? new Map();
|
|
88
|
+
const dtsFiles = cached?.dtsFiles ?? new Map();
|
|
89
|
+
const changedEsmFiles = new Set();
|
|
90
|
+
const changedDtsFiles = new Set();
|
|
91
|
+
for (const ref of referencedFiles) {
|
|
92
|
+
allReferencedFiles.add((0, path_1.toPosixPath)(ref));
|
|
93
|
+
}
|
|
94
|
+
if (effectiveModifiedFiles) {
|
|
95
|
+
for (const modifiedFile of effectiveModifiedFiles) {
|
|
96
|
+
const posixModified = (0, path_1.toPosixPath)(modifiedFile);
|
|
97
|
+
if (allReferencedFiles.has(posixModified)) {
|
|
98
|
+
continue;
|
|
99
|
+
}
|
|
100
|
+
const basePathWithoutExt = posixModified.replace(/(?:\.d\.[cm]?ts|\.[cm]?[jt]sx?)$/i, '');
|
|
101
|
+
if (basePathWithoutExt === posixModified || (0, node_fs_1.existsSync)(posixModified)) {
|
|
102
|
+
continue;
|
|
103
|
+
}
|
|
104
|
+
for (const ext of EMITTED_EXTENSIONS) {
|
|
105
|
+
const outputPath = `${basePathWithoutExt}${ext}`;
|
|
106
|
+
const mapPath = `${outputPath}.map`;
|
|
107
|
+
if (esmFiles.delete(outputPath)) {
|
|
108
|
+
changedEsmFiles.add(outputPath);
|
|
109
|
+
}
|
|
110
|
+
if (dtsFiles.delete(outputPath)) {
|
|
111
|
+
changedDtsFiles.add(outputPath);
|
|
112
|
+
}
|
|
113
|
+
esmFiles.delete(mapPath);
|
|
114
|
+
dtsFiles.delete(mapPath);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
for (const { filename, contents } of emittedFiles) {
|
|
119
|
+
const normalized = (0, path_1.toPosixPath)(filename);
|
|
120
|
+
if (normalized.endsWith('.map')) {
|
|
121
|
+
const isDtsMap = (0, utils_1.isDeclarationSourceMapFile)(normalized);
|
|
122
|
+
const targetMap = isDtsMap ? dtsFiles : esmFiles;
|
|
123
|
+
if (targetMap.get(normalized) !== contents) {
|
|
124
|
+
targetMap.set(normalized, contents);
|
|
125
|
+
(isDtsMap ? changedDtsFiles : changedEsmFiles).add(normalized.slice(0, -4));
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
else if ((0, utils_1.isDeclarationFile)(normalized)) {
|
|
129
|
+
if (dtsFiles.get(normalized) !== contents) {
|
|
130
|
+
changedDtsFiles.add(normalized);
|
|
131
|
+
dtsFiles.set(normalized, contents);
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
else if (esmFiles.get(normalized) !== contents) {
|
|
135
|
+
changedEsmFiles.add(normalized);
|
|
136
|
+
esmFiles.set(normalized, contents);
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
return {
|
|
140
|
+
esmFiles,
|
|
141
|
+
dtsFiles,
|
|
142
|
+
changedEsmFiles,
|
|
143
|
+
changedDtsFiles,
|
|
144
|
+
referencedFiles: allReferencedFiles,
|
|
145
|
+
cache: {
|
|
146
|
+
compilationInstance,
|
|
147
|
+
esmFiles,
|
|
148
|
+
dtsFiles,
|
|
149
|
+
failedFiles: failedFiles.size > 0 ? failedFiles : undefined,
|
|
150
|
+
},
|
|
151
|
+
diagnosePromise,
|
|
152
|
+
};
|
|
153
|
+
}
|
|
154
|
+
catch (error) {
|
|
155
|
+
if (!cached) {
|
|
156
|
+
await compilationInstance.close?.();
|
|
157
|
+
}
|
|
158
|
+
throw error;
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* Validates stylesheet bundling results and runs TypeScript/Angular diagnostics.
|
|
163
|
+
*
|
|
164
|
+
* @param compilationInstance The active Angular compilation instance.
|
|
165
|
+
* @param stylesheetErrors List of stylesheet bundling errors.
|
|
166
|
+
* @param stylesheetWarnings List of stylesheet bundling warnings.
|
|
167
|
+
* @param colors Whether diagnostic messages should be formatted with ANSI colors.
|
|
168
|
+
* @returns A promise resolving to formatted warning messages.
|
|
169
|
+
* @throws If stylesheet bundling errors or compilation errors occur.
|
|
170
|
+
*/
|
|
171
|
+
async function runDiagnosticsAndFormat(compilationInstance, stylesheetErrors, stylesheetWarnings, colors) {
|
|
172
|
+
if (stylesheetErrors.length > 0) {
|
|
173
|
+
const formatted = await (0, esbuild_1.formatMessages)(stylesheetErrors, { kind: 'error', color: colors });
|
|
174
|
+
throw new Error(`Failed to bundle stylesheet:\n${formatted.join('\n')}`);
|
|
175
|
+
}
|
|
176
|
+
const warningsOut = [];
|
|
177
|
+
if (environment_options_1.useTypeChecking) {
|
|
178
|
+
const { errors, warnings } = await compilationInstance.diagnoseFiles();
|
|
179
|
+
if (errors?.length) {
|
|
180
|
+
const errorMessages = await (0, esbuild_1.formatMessages)(errors, { kind: 'error', color: colors });
|
|
181
|
+
throw new Error(`Compilation failed with errors:\n${errorMessages.join('\n')}`);
|
|
182
|
+
}
|
|
183
|
+
if (warnings?.length) {
|
|
184
|
+
const formatted = await (0, esbuild_1.formatMessages)(warnings, { kind: 'warning', color: colors });
|
|
185
|
+
warningsOut.push(...formatted);
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
if (stylesheetWarnings.length > 0) {
|
|
189
|
+
const formattedStyleWarnings = await (0, esbuild_1.formatMessages)(stylesheetWarnings, {
|
|
190
|
+
kind: 'warning',
|
|
191
|
+
color: colors,
|
|
192
|
+
});
|
|
193
|
+
warningsOut.push(...formattedStyleWarnings);
|
|
194
|
+
}
|
|
195
|
+
return warningsOut;
|
|
196
|
+
}
|
|
197
|
+
//# sourceMappingURL=compilation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compilation.js","sourceRoot":"","sources":["compilation.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;AAoDH,wCA2KC;AA7ND,qCAA8D;AAC9D,qCAAqC;AACrC,oEAG4C;AAE5C,4EAAqE;AACrE,8CAAkD;AAElD,mCAAwE;AAExE,MAAM,kBAAkB,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,QAAQ,CAAC,CAAC;AA4BhF;;;;;;;;;GASG;AACI,KAAK,UAAU,cAAc,CAClC,WAA2C,EAC3C,OAAiC,EACjC,iBAA6C,EAC7C,MAA2B,EAC3B,aAA2B;IAE3B,MAAM,EAAE,YAAY,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,EAAE,cAAc,EAAE,GAAG,OAAO,CAAC;IAE5F,MAAM,aAAa,GAA6B,EAAE,CAAC;IACnD,MAAM,SAAS,GAAa,EAAE,CAAC;IAC/B,KAAK,MAAM,EAAE,IAAI,WAAW,EAAE,CAAC;QAC7B,aAAa,CAAC,EAAE,CAAC,WAAW,CAAC,GAAG,CAAC,EAAE,CAAC,aAAa,CAAC,CAAC;QACnD,SAAS,CAAC,IAAI,CAAC,EAAE,CAAC,aAAa,CAAC,CAAC;IACnC,CAAC;IAED,MAAM,mBAAmB,GACvB,MAAM,EAAE,mBAAmB,IAAI,CAAC,MAAM,IAAA,sCAAwB,EAAC,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC;IAEhF,IAAI,CAAC;QACH,IAAI,sBAAsB,GAAG,aAAa,CAAC;QAC3C,IAAI,MAAM,EAAE,WAAW,EAAE,IAAI,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C,CAAC;YACrF,WAAW,CAAC,IAAI,CAAC,GAAG,SAAS,CAAC,CAAC;QACjC,CAAC;IACH,CAAC;IAED,IAAI,kBAAkB,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAClC,MAAM,sBAAsB,GAAG,MAAM,IAAA,wBAAc,EAAC,kBAAkB,EAAE;YACtE,IAAI,EAAE,SAAS;YACf,KAAK,EAAE,MAAM;SACd,CAAC,CAAC;QACH,WAAW,CAAC,IAAI,CAAC,GAAG,sBAAsB,CAAC,CAAC;IAC9C,CAAC;IAED,OAAO,WAAW,CAAC;AACrB,CAAC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
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 { NormalizedEntryPoint, NormalizedLibraryOptions, PackageJsonData, SingleBuildState } from '../types';
|
|
9
|
+
/**
|
|
10
|
+
* Computes the base bundle file name for an entry point.
|
|
11
|
+
*
|
|
12
|
+
* @param packageName The package name from package.json.
|
|
13
|
+
* @param entryPointName The entry point subpath name (defaults to '.').
|
|
14
|
+
* @returns The sanitized bundle base name.
|
|
15
|
+
*/
|
|
16
|
+
export declare function getEntryPointBundleName(packageName: string, entryPointName?: string): string;
|
|
17
|
+
/**
|
|
18
|
+
* Normalizes all entry points from the library's `package.json` `exports` field.
|
|
19
|
+
*
|
|
20
|
+
* @param rawExports The `exports` field from `package.json`.
|
|
21
|
+
* @param projectRoot The library project root directory.
|
|
22
|
+
* @param packageJsonPath Path to `package.json` for error reporting.
|
|
23
|
+
* @param packageName The root package name (e.g. `@my/lib`).
|
|
24
|
+
* @returns A Map of normalized entry points keyed by name.
|
|
25
|
+
*/
|
|
26
|
+
export declare function normalizeEntryPoints(rawExports: unknown, projectRoot: string, packageJsonPath: string, packageName: string): Map<string, NormalizedEntryPoint>;
|
|
27
|
+
/**
|
|
28
|
+
* Determines whether two sets of normalized entry points differ in keys, paths, or subpaths.
|
|
29
|
+
*/
|
|
30
|
+
export declare function haveEntryPointsChanged(oldEntryPoints: ReadonlyMap<string, NormalizedEntryPoint>, newEntryPoints: ReadonlyMap<string, NormalizedEntryPoint>): boolean;
|
|
31
|
+
/**
|
|
32
|
+
* Updates watched files, entry points in options, and cached bundle results when package.json entry points change.
|
|
33
|
+
*/
|
|
34
|
+
export declare function updateWatchedEntryPoints(packageJson: PackageJsonData, options: NormalizedLibraryOptions, buildState: SingleBuildState, watchedCompilationFiles: Set<string>, packageJsonPath: string): void;
|