@ngrs/build 0.0.0-stage → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +20 -2
- package/bin/ngrs-build.mjs +604 -0
- package/bin/ngrs.mjs +207 -0
- package/builders.json +34 -0
- package/package.json +88 -4
- package/schemas/application.schema.json +316 -0
- package/schemas/dev-server.schema.json +108 -0
- package/schemas/extract-i18n.schema.json +35 -0
- package/schemas/unit-test.schema.json +118 -0
- package/schematics/collection.json +10 -0
- package/schematics/ng-add/index.cjs +231 -0
- package/schematics/ng-add/schema.json +14 -0
- package/src/architect-compat.cjs +54 -0
- package/src/architect-compat.mjs +151 -0
- package/src/budgets.mjs +212 -0
- package/src/builders/application/index.cjs +13 -0
- package/src/builders/application/index.mjs +994 -0
- package/src/builders/dev-server/index.cjs +15 -0
- package/src/builders/dev-server/index.mjs +1088 -0
- package/src/builders/extract-i18n/index.cjs +13 -0
- package/src/builders/extract-i18n/index.mjs +60 -0
- package/src/builders/unit-test/index.cjs +13 -0
- package/src/builders/unit-test/index.mjs +346 -0
- package/src/index-html.mjs +126 -0
- package/src/index.cjs +29 -0
- package/src/index.d.ts +158 -0
- package/src/index.mjs +71 -0
- package/src/ng-add.mjs +92 -0
- package/src/proxy.mjs +136 -0
- package/src/stats-table.mjs +403 -0
- package/src/workspace.d.ts +213 -0
- package/src/workspace.mjs +850 -0
|
@@ -0,0 +1,403 @@
|
|
|
1
|
+
import path from 'node:path';
|
|
2
|
+
import { WriteStream } from 'node:tty';
|
|
3
|
+
import { stripVTControlCharacters } from 'node:util';
|
|
4
|
+
import { brotliCompress } from 'node:zlib';
|
|
5
|
+
import { formatSize } from './budgets.mjs';
|
|
6
|
+
|
|
7
|
+
const SPINNER_FRAMES = ['⠋', '⠙', '⠹', '⠸', '⠼', '⠴', '⠦', '⠧', '⠇', '⠏'];
|
|
8
|
+
|
|
9
|
+
export const ansiColors = {
|
|
10
|
+
bold: (s) => `\x1b[1m${s}\x1b[22m`,
|
|
11
|
+
dim: (s) => `\x1b[2m${s}\x1b[22m`,
|
|
12
|
+
green: (s) => `\x1b[32m${s}\x1b[39m`,
|
|
13
|
+
yellow: (s) => `\x1b[33m${s}\x1b[39m`,
|
|
14
|
+
cyan: (s) => `\x1b[36m${s}\x1b[39m`,
|
|
15
|
+
magenta: (s) => `\x1b[35m${s}\x1b[39m`,
|
|
16
|
+
redBright: (s) => `\x1b[91m${s}\x1b[39m`,
|
|
17
|
+
yellowBright: (s) => `\x1b[93m${s}\x1b[39m`,
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* 1:1 with `@angular/build/src/utils/color.ts` `supportColor`.
|
|
22
|
+
*/
|
|
23
|
+
export function supportColor(stream = process.stdout) {
|
|
24
|
+
if (process.env.FORCE_COLOR !== undefined) {
|
|
25
|
+
return process.env.FORCE_COLOR !== '0' && process.env.FORCE_COLOR !== 'false';
|
|
26
|
+
}
|
|
27
|
+
if (process.env.NO_COLOR !== undefined) {
|
|
28
|
+
return false;
|
|
29
|
+
}
|
|
30
|
+
if (stream instanceof WriteStream) {
|
|
31
|
+
return stream.hasColors();
|
|
32
|
+
}
|
|
33
|
+
try {
|
|
34
|
+
return WriteStream.prototype.hasColors();
|
|
35
|
+
} catch {
|
|
36
|
+
return false;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export function resolveColorsOption(explicitColors, stream = process.stdout) {
|
|
41
|
+
if (typeof explicitColors === 'boolean') {
|
|
42
|
+
return explicitColors;
|
|
43
|
+
}
|
|
44
|
+
return supportColor(stream);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export function isInteractiveLogger(logger) {
|
|
48
|
+
// Silent mock loggers in programmatic tests typically omit `createChild`.
|
|
49
|
+
return Boolean(logger && typeof logger.createChild === 'function');
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* 1:1 with `@angular/build/src/tools/esbuild/utils.ts` `withSpinner` / `withNoProgress`.
|
|
54
|
+
* Uses an unref'd Braille TTY spinner (`clearOutput: true`) on interactive terminals and
|
|
55
|
+
* listr2's `❯` / `✔` SimpleRenderer format on non-TTY streams when `progress` is enabled.
|
|
56
|
+
*/
|
|
57
|
+
export async function withProgress(text, enabled, colors, logger, action) {
|
|
58
|
+
if (!enabled || !isInteractiveLogger(logger)) {
|
|
59
|
+
return action();
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
const y = (s) => (colors ? ansiColors.yellow(s) : s);
|
|
63
|
+
const g = (s) => (colors ? ansiColors.green(s) : s);
|
|
64
|
+
const r = (s) => (colors ? ansiColors.redBright(s) : s);
|
|
65
|
+
|
|
66
|
+
if (process.stdout.isTTY) {
|
|
67
|
+
let frameIdx = 0;
|
|
68
|
+
const renderFrame = () => {
|
|
69
|
+
const frame = SPINNER_FRAMES[frameIdx % SPINNER_FRAMES.length];
|
|
70
|
+
frameIdx += 1;
|
|
71
|
+
process.stdout.write(`\r\x1b[2K${y(frame)} ${text}`);
|
|
72
|
+
};
|
|
73
|
+
renderFrame();
|
|
74
|
+
const timer = setInterval(renderFrame, 80);
|
|
75
|
+
timer.unref?.();
|
|
76
|
+
try {
|
|
77
|
+
return await action();
|
|
78
|
+
} finally {
|
|
79
|
+
clearInterval(timer);
|
|
80
|
+
process.stdout.write('\r\x1b[2K');
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
process.stdout.write(`${y('❯')} ${text}\n`);
|
|
85
|
+
try {
|
|
86
|
+
const res = await action();
|
|
87
|
+
process.stdout.write(`${g('✔')} ${text}\n`);
|
|
88
|
+
return res;
|
|
89
|
+
} catch (err) {
|
|
90
|
+
process.stdout.write(`${r('✖')} ${text}\n`);
|
|
91
|
+
throw err;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* 1:1 with `@angular/build/src/tools/esbuild/utils.ts` `getEntryPointName`.
|
|
97
|
+
*/
|
|
98
|
+
export function getEntryPointName(entryPoint) {
|
|
99
|
+
return path
|
|
100
|
+
.basename(entryPoint)
|
|
101
|
+
.replace(/(.*:)/, '')
|
|
102
|
+
.replace(/\.[cm]?[jt]sx?$/, '')
|
|
103
|
+
.replace(/[\\/.]/g, '-');
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* 1:1 with `@angular/build/src/tools/esbuild/utils.ts` `calculateEstimatedTransferSizes`.
|
|
108
|
+
* Uses async `node:zlib.brotliCompress` for JS/CSS files >= 1024 bytes.
|
|
109
|
+
*
|
|
110
|
+
* @param {Array<{ path: string, contents: Buffer | Uint8Array | string }>} outputFiles
|
|
111
|
+
* @returns {Promise<Map<string, number>>}
|
|
112
|
+
*/
|
|
113
|
+
export async function calculateEstimatedTransferSizes(outputFiles) {
|
|
114
|
+
const sizes = new Map();
|
|
115
|
+
if (!outputFiles || outputFiles.length === 0) {
|
|
116
|
+
return sizes;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
return new Promise((resolve, reject) => {
|
|
120
|
+
let completeCount = 0;
|
|
121
|
+
for (const outputFile of outputFiles) {
|
|
122
|
+
if (!/\.(?:css|m?js)$/.test(outputFile.path)) {
|
|
123
|
+
completeCount += 1;
|
|
124
|
+
continue;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
const buf =
|
|
128
|
+
typeof outputFile.contents === 'string'
|
|
129
|
+
? Buffer.from(outputFile.contents, 'utf8')
|
|
130
|
+
: outputFile.contents;
|
|
131
|
+
|
|
132
|
+
if (buf.byteLength < 1024) {
|
|
133
|
+
sizes.set(outputFile.path, buf.byteLength);
|
|
134
|
+
completeCount += 1;
|
|
135
|
+
continue;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
brotliCompress(buf, (error, result) => {
|
|
139
|
+
if (error) {
|
|
140
|
+
reject(error);
|
|
141
|
+
return;
|
|
142
|
+
}
|
|
143
|
+
sizes.set(outputFile.path, result.byteLength);
|
|
144
|
+
completeCount += 1;
|
|
145
|
+
if (completeCount >= outputFiles.length) {
|
|
146
|
+
resolve(sizes);
|
|
147
|
+
}
|
|
148
|
+
});
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
if (completeCount >= outputFiles.length) {
|
|
152
|
+
resolve(sizes);
|
|
153
|
+
}
|
|
154
|
+
});
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
function generateBuildStatsData(
|
|
158
|
+
data,
|
|
159
|
+
colors,
|
|
160
|
+
showTotalSize,
|
|
161
|
+
showEstimatedTransferSize,
|
|
162
|
+
budgetFailures,
|
|
163
|
+
verbose,
|
|
164
|
+
) {
|
|
165
|
+
if (data.length === 0) {
|
|
166
|
+
return [];
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
const g = (x) => (colors ? ansiColors.green(x) : x);
|
|
170
|
+
const c = (x) => (colors ? ansiColors.cyan(x) : x);
|
|
171
|
+
const r = (x) => (colors ? ansiColors.redBright(x) : x);
|
|
172
|
+
const y = (x) => (colors ? ansiColors.yellowBright(x) : x);
|
|
173
|
+
const bold = (x) => (colors ? ansiColors.bold(x) : x);
|
|
174
|
+
const dim = (x) => (colors ? ansiColors.dim(x) : x);
|
|
175
|
+
|
|
176
|
+
const budgets = new Map();
|
|
177
|
+
if (budgetFailures) {
|
|
178
|
+
for (const { label, severity } of budgetFailures) {
|
|
179
|
+
if (label && (!budgets.has(label) || budgets.get(label) === 'warning')) {
|
|
180
|
+
budgets.set(label, severity);
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
const getSizeColor = (name, file, defaultColor = c) => {
|
|
186
|
+
const severity = budgets.get(name) || (file && budgets.get(file));
|
|
187
|
+
switch (severity) {
|
|
188
|
+
case 'warning':
|
|
189
|
+
return y;
|
|
190
|
+
case 'error':
|
|
191
|
+
return r;
|
|
192
|
+
default:
|
|
193
|
+
return defaultColor;
|
|
194
|
+
}
|
|
195
|
+
};
|
|
196
|
+
|
|
197
|
+
const changedEntryChunksStats = [];
|
|
198
|
+
const changedLazyChunksStats = [];
|
|
199
|
+
|
|
200
|
+
let initialTotalRawSize = 0;
|
|
201
|
+
let changedLazyChunksCount = 0;
|
|
202
|
+
let initialTotalEstimatedTransferSize;
|
|
203
|
+
const maxLazyChunksWithoutBudgetFailures = 15;
|
|
204
|
+
|
|
205
|
+
const sorted = [...data].sort((a, b) => {
|
|
206
|
+
if (a.stats[2] > b.stats[2]) return -1;
|
|
207
|
+
if (a.stats[2] < b.stats[2]) return 1;
|
|
208
|
+
return 0;
|
|
209
|
+
});
|
|
210
|
+
|
|
211
|
+
for (const { initial, stats } of sorted) {
|
|
212
|
+
const [files, names, rawSize, estimatedTransferSize] = stats;
|
|
213
|
+
if (
|
|
214
|
+
!initial &&
|
|
215
|
+
!verbose &&
|
|
216
|
+
changedLazyChunksStats.length >= maxLazyChunksWithoutBudgetFailures &&
|
|
217
|
+
!budgets.has(names) &&
|
|
218
|
+
!budgets.has(files)
|
|
219
|
+
) {
|
|
220
|
+
changedLazyChunksCount += 1;
|
|
221
|
+
continue;
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
const getRawSizeColor = getSizeColor(names, files);
|
|
225
|
+
let row;
|
|
226
|
+
if (showEstimatedTransferSize) {
|
|
227
|
+
row = [
|
|
228
|
+
g(files),
|
|
229
|
+
dim(names),
|
|
230
|
+
getRawSizeColor(typeof rawSize === 'number' ? formatSize(rawSize) : rawSize),
|
|
231
|
+
c(
|
|
232
|
+
typeof estimatedTransferSize === 'number'
|
|
233
|
+
? formatSize(estimatedTransferSize)
|
|
234
|
+
: estimatedTransferSize,
|
|
235
|
+
),
|
|
236
|
+
];
|
|
237
|
+
} else {
|
|
238
|
+
row = [
|
|
239
|
+
g(files),
|
|
240
|
+
dim(names),
|
|
241
|
+
getRawSizeColor(typeof rawSize === 'number' ? formatSize(rawSize) : rawSize),
|
|
242
|
+
'',
|
|
243
|
+
];
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
if (initial) {
|
|
247
|
+
changedEntryChunksStats.push(row);
|
|
248
|
+
if (typeof rawSize === 'number') {
|
|
249
|
+
initialTotalRawSize += rawSize;
|
|
250
|
+
}
|
|
251
|
+
if (showEstimatedTransferSize && typeof estimatedTransferSize === 'number') {
|
|
252
|
+
if (initialTotalEstimatedTransferSize === undefined) {
|
|
253
|
+
initialTotalEstimatedTransferSize = 0;
|
|
254
|
+
}
|
|
255
|
+
initialTotalEstimatedTransferSize += estimatedTransferSize;
|
|
256
|
+
}
|
|
257
|
+
} else {
|
|
258
|
+
changedLazyChunksStats.push(row);
|
|
259
|
+
changedLazyChunksCount += 1;
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
const bundleInfo = [];
|
|
264
|
+
const baseTitles = ['Names', 'Raw size'];
|
|
265
|
+
if (showEstimatedTransferSize) {
|
|
266
|
+
baseTitles.push('Estimated transfer size');
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
if (changedEntryChunksStats.length) {
|
|
270
|
+
bundleInfo.push(['Initial chunk files', ...baseTitles].map(bold), ...changedEntryChunksStats);
|
|
271
|
+
|
|
272
|
+
if (showTotalSize) {
|
|
273
|
+
const initialSizeTotalColor = getSizeColor('bundle initial', undefined, (x) => x);
|
|
274
|
+
const totalSizeElements = [
|
|
275
|
+
' ',
|
|
276
|
+
'Initial total',
|
|
277
|
+
initialSizeTotalColor(formatSize(initialTotalRawSize)),
|
|
278
|
+
];
|
|
279
|
+
if (showEstimatedTransferSize) {
|
|
280
|
+
totalSizeElements.push(
|
|
281
|
+
typeof initialTotalEstimatedTransferSize === 'number'
|
|
282
|
+
? formatSize(initialTotalEstimatedTransferSize)
|
|
283
|
+
: '-',
|
|
284
|
+
);
|
|
285
|
+
}
|
|
286
|
+
bundleInfo.push([], totalSizeElements.map(bold));
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
if (changedEntryChunksStats.length && changedLazyChunksStats.length) {
|
|
291
|
+
bundleInfo.push([]);
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
if (changedLazyChunksStats.length) {
|
|
295
|
+
bundleInfo.push(['Lazy chunk files', ...baseTitles].map(bold), ...changedLazyChunksStats);
|
|
296
|
+
|
|
297
|
+
if (changedLazyChunksCount > changedLazyChunksStats.length) {
|
|
298
|
+
bundleInfo.push([
|
|
299
|
+
dim(
|
|
300
|
+
`...and ${changedLazyChunksCount - changedLazyChunksStats.length} more lazy chunks files. ` +
|
|
301
|
+
'Use "--verbose" to show all the files.',
|
|
302
|
+
),
|
|
303
|
+
]);
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
return bundleInfo;
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
function generateTableText(bundleInfo, colors) {
|
|
311
|
+
const skipText = (value) => value.includes('...and ');
|
|
312
|
+
const longest = [];
|
|
313
|
+
for (const item of bundleInfo) {
|
|
314
|
+
for (let i = 0; i < item.length; i++) {
|
|
315
|
+
if (item[i] === undefined) {
|
|
316
|
+
continue;
|
|
317
|
+
}
|
|
318
|
+
const currentItem = item[i].toString();
|
|
319
|
+
if (skipText(currentItem)) {
|
|
320
|
+
continue;
|
|
321
|
+
}
|
|
322
|
+
const currentLongest = (longest[i] ??= 0);
|
|
323
|
+
const currentItemLength = stripVTControlCharacters(currentItem).length;
|
|
324
|
+
if (currentLongest < currentItemLength) {
|
|
325
|
+
longest[i] = currentItemLength;
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
const separator = colors ? ansiColors.dim(' | ') : ' | ';
|
|
331
|
+
const outputTable = [];
|
|
332
|
+
for (const rawItem of bundleInfo) {
|
|
333
|
+
const item = [...rawItem];
|
|
334
|
+
for (let i = 0; i < longest.length; i++) {
|
|
335
|
+
if (item[i] === undefined) {
|
|
336
|
+
continue;
|
|
337
|
+
}
|
|
338
|
+
const currentItem = item[i].toString();
|
|
339
|
+
if (skipText(currentItem)) {
|
|
340
|
+
continue;
|
|
341
|
+
}
|
|
342
|
+
const currentItemLength = stripVTControlCharacters(currentItem).length;
|
|
343
|
+
const stringPad = ' '.repeat(longest[i] - currentItemLength);
|
|
344
|
+
item[i] = i >= 2 ? stringPad + currentItem : currentItem + stringPad;
|
|
345
|
+
}
|
|
346
|
+
outputTable.push(item.join(separator));
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
return outputTable.join('\n');
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
/**
|
|
353
|
+
* 1:1 with `@angular/build/src/utils/stats-table.ts` `generateEsbuildBuildStatsTable`.
|
|
354
|
+
*/
|
|
355
|
+
export function generateEsbuildBuildStatsTable(
|
|
356
|
+
[browserStats, serverStats],
|
|
357
|
+
colors,
|
|
358
|
+
showTotalSize,
|
|
359
|
+
showEstimatedTransferSize,
|
|
360
|
+
budgetFailures,
|
|
361
|
+
verbose,
|
|
362
|
+
) {
|
|
363
|
+
const bundleInfo = generateBuildStatsData(
|
|
364
|
+
browserStats,
|
|
365
|
+
colors,
|
|
366
|
+
showTotalSize,
|
|
367
|
+
showEstimatedTransferSize,
|
|
368
|
+
budgetFailures,
|
|
369
|
+
verbose,
|
|
370
|
+
);
|
|
371
|
+
|
|
372
|
+
if (serverStats?.length) {
|
|
373
|
+
const m = (x) => (colors ? ansiColors.magenta(x) : x);
|
|
374
|
+
if (browserStats.length) {
|
|
375
|
+
bundleInfo.unshift([m('Browser bundles')]);
|
|
376
|
+
bundleInfo.push([], []);
|
|
377
|
+
}
|
|
378
|
+
bundleInfo.push(
|
|
379
|
+
[m('Server bundles')],
|
|
380
|
+
...generateBuildStatsData(serverStats, colors, false, false, undefined, verbose),
|
|
381
|
+
);
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
return generateTableText(bundleInfo, colors);
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
/**
|
|
388
|
+
* Formats warning or error messages in Angular CLI / esbuild format (`▲ [WARNING]` / `✘ [ERROR]`).
|
|
389
|
+
*/
|
|
390
|
+
export function formatBuildMessage(text, kind, colors) {
|
|
391
|
+
const clean = String(text).trim();
|
|
392
|
+
const isError = kind === 'error';
|
|
393
|
+
const badge = isError ? '✘ [ERROR]' : '▲ [WARNING]';
|
|
394
|
+
const colorBadge = colors
|
|
395
|
+
? isError
|
|
396
|
+
? ansiColors.redBright(ansiColors.bold(badge))
|
|
397
|
+
: ansiColors.yellowBright(ansiColors.bold(badge))
|
|
398
|
+
: badge;
|
|
399
|
+
const lines = clean.split('\n');
|
|
400
|
+
const headline = colors ? ansiColors.bold(lines[0]) : lines[0];
|
|
401
|
+
const rest = lines.slice(1).map((l) => ` ${l}`);
|
|
402
|
+
return [`${colorBadge} ${headline}`, ...rest].join('\n') + '\n';
|
|
403
|
+
}
|
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
export interface TargetSpec {
|
|
2
|
+
project: string;
|
|
3
|
+
target: string;
|
|
4
|
+
configuration?: string;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export interface AssetPatternObject {
|
|
8
|
+
glob: string;
|
|
9
|
+
input: string;
|
|
10
|
+
output?: string;
|
|
11
|
+
ignore?: string[];
|
|
12
|
+
flatten?: boolean;
|
|
13
|
+
followSymlinks?: boolean;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export type AssetPattern = string | AssetPatternObject;
|
|
17
|
+
|
|
18
|
+
export interface NormalizedAssetPattern extends AssetPatternObject {
|
|
19
|
+
output: string;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export interface GlobalEntryObject {
|
|
23
|
+
input: string;
|
|
24
|
+
bundleName?: string;
|
|
25
|
+
inject?: boolean;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export type GlobalEntry = string | GlobalEntryObject;
|
|
29
|
+
|
|
30
|
+
export interface NormalizedGlobalBundle {
|
|
31
|
+
name: string;
|
|
32
|
+
files: string[];
|
|
33
|
+
initial: boolean;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export interface FileReplacementEntry {
|
|
37
|
+
replace: string;
|
|
38
|
+
with: string;
|
|
39
|
+
replaceWith?: string;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export interface BudgetEntry {
|
|
43
|
+
type: 'all' | 'allScript' | 'any' | 'anyScript' | 'anyComponentStyle' | 'bundle' | 'initial';
|
|
44
|
+
name?: string;
|
|
45
|
+
baseline?: string;
|
|
46
|
+
maximumWarning?: string;
|
|
47
|
+
maximumError?: string;
|
|
48
|
+
minimumWarning?: string;
|
|
49
|
+
minimumError?: string;
|
|
50
|
+
warning?: string;
|
|
51
|
+
error?: string;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export interface NormalizedOptimizationOptions {
|
|
55
|
+
scripts: boolean;
|
|
56
|
+
styles: {
|
|
57
|
+
minify: boolean;
|
|
58
|
+
inlineCritical: boolean;
|
|
59
|
+
removeSpecialComments: boolean;
|
|
60
|
+
};
|
|
61
|
+
fonts: {
|
|
62
|
+
inline: boolean;
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export interface NormalizedSourceMapOptions {
|
|
67
|
+
scripts: boolean;
|
|
68
|
+
styles: boolean;
|
|
69
|
+
hidden: boolean;
|
|
70
|
+
vendor: boolean;
|
|
71
|
+
sourcesContent: boolean;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
export interface NormalizedOutputOptions {
|
|
75
|
+
base: string;
|
|
76
|
+
browser: string;
|
|
77
|
+
server: string;
|
|
78
|
+
media: string;
|
|
79
|
+
browserDir: string;
|
|
80
|
+
serverDir: string;
|
|
81
|
+
clean: boolean;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
export interface NormalizedIndexHtmlOptions {
|
|
85
|
+
input: string;
|
|
86
|
+
output: string;
|
|
87
|
+
preloadInitial: boolean;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
export interface NormalizedApplicationOptions {
|
|
91
|
+
projectName: string;
|
|
92
|
+
workspaceRoot: string;
|
|
93
|
+
projectRoot: string;
|
|
94
|
+
projectSourceRoot: string;
|
|
95
|
+
tsconfigPath: string;
|
|
96
|
+
browserEntry: string;
|
|
97
|
+
serverEntry?: string;
|
|
98
|
+
polyfills: string[];
|
|
99
|
+
outputOptions: NormalizedOutputOptions;
|
|
100
|
+
outputHashing: 'none' | 'all' | 'media' | 'bundles';
|
|
101
|
+
indexHtmlOptions: NormalizedIndexHtmlOptions | null;
|
|
102
|
+
assets: NormalizedAssetPattern[];
|
|
103
|
+
globalStyles: NormalizedGlobalBundle[];
|
|
104
|
+
globalScripts: NormalizedGlobalBundle[];
|
|
105
|
+
inlineStyleLanguage: 'css' | 'less' | 'sass' | 'scss';
|
|
106
|
+
stylePreprocessorOptions: {
|
|
107
|
+
includePaths: string[];
|
|
108
|
+
sass?: Record<string, unknown>;
|
|
109
|
+
};
|
|
110
|
+
fileReplacements: Array<{ replace: string; with: string }>;
|
|
111
|
+
optimization: NormalizedOptimizationOptions;
|
|
112
|
+
sourceMap: NormalizedSourceMapOptions;
|
|
113
|
+
aot: boolean;
|
|
114
|
+
baseHref?: string;
|
|
115
|
+
deployUrl?: string;
|
|
116
|
+
define?: Record<string, string>;
|
|
117
|
+
externalDependencies: string[];
|
|
118
|
+
conditions?: string[];
|
|
119
|
+
budgets: BudgetEntry[];
|
|
120
|
+
namedChunks: boolean;
|
|
121
|
+
subresourceIntegrity: boolean;
|
|
122
|
+
crossOrigin: 'none' | 'anonymous' | 'use-credentials';
|
|
123
|
+
preserveSymlinks: boolean;
|
|
124
|
+
extractLicenses: boolean;
|
|
125
|
+
statsJson: boolean;
|
|
126
|
+
watch: boolean;
|
|
127
|
+
poll?: number;
|
|
128
|
+
verbose: boolean;
|
|
129
|
+
progress: boolean;
|
|
130
|
+
clearScreen: boolean;
|
|
131
|
+
ssr: boolean | Record<string, unknown>;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
export interface NormalizedDevServerOptions {
|
|
135
|
+
projectName: string;
|
|
136
|
+
workspaceRoot: string;
|
|
137
|
+
projectRoot: string;
|
|
138
|
+
buildTarget: TargetSpec;
|
|
139
|
+
buildTargetOptions: Record<string, unknown>;
|
|
140
|
+
port: number;
|
|
141
|
+
strictPort: boolean;
|
|
142
|
+
host: string;
|
|
143
|
+
open: boolean;
|
|
144
|
+
ssl: boolean;
|
|
145
|
+
sslKey?: string;
|
|
146
|
+
sslCert?: string;
|
|
147
|
+
proxyConfig?: string;
|
|
148
|
+
hmr: boolean;
|
|
149
|
+
liveReload: boolean;
|
|
150
|
+
headers?: Record<string, string>;
|
|
151
|
+
allowedHosts: string[] | boolean;
|
|
152
|
+
servePath?: string;
|
|
153
|
+
define?: Record<string, string>;
|
|
154
|
+
prebundle: boolean | { exclude: string[] };
|
|
155
|
+
watch: boolean;
|
|
156
|
+
poll?: number;
|
|
157
|
+
verbose: boolean;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
export declare function isSubDirectory(parentDir: string, candidatePath: string): boolean;
|
|
161
|
+
export declare function toPosixPath(p: string): string;
|
|
162
|
+
export declare function findWorkspaceFile(startDir?: string): string | null;
|
|
163
|
+
export declare function loadWorkspace(startDirOrFile?: string): Promise<{
|
|
164
|
+
workspaceFile: string;
|
|
165
|
+
workspaceRoot: string;
|
|
166
|
+
workspace: Record<string, any>;
|
|
167
|
+
}>;
|
|
168
|
+
export declare function resolveProjectName(
|
|
169
|
+
workspace: Record<string, any>,
|
|
170
|
+
requestedProject?: string,
|
|
171
|
+
): string;
|
|
172
|
+
export declare function parseTargetString(
|
|
173
|
+
specifier: string,
|
|
174
|
+
defaultProject?: string,
|
|
175
|
+
defaultTarget?: string,
|
|
176
|
+
): TargetSpec;
|
|
177
|
+
export declare function resolveTargetOptions(
|
|
178
|
+
workspace: Record<string, any>,
|
|
179
|
+
targetSpec: TargetSpec,
|
|
180
|
+
fallbackConfiguration?: string,
|
|
181
|
+
): Record<string, any>;
|
|
182
|
+
export declare function normalizeOptimization(
|
|
183
|
+
optimization?: boolean | Record<string, any>,
|
|
184
|
+
): NormalizedOptimizationOptions;
|
|
185
|
+
export declare function normalizeSourceMaps(
|
|
186
|
+
sourceMap?: boolean | Record<string, any>,
|
|
187
|
+
): NormalizedSourceMapOptions;
|
|
188
|
+
export declare function normalizeGlobalEntries(
|
|
189
|
+
rawEntries: GlobalEntry[] | undefined,
|
|
190
|
+
defaultName: string,
|
|
191
|
+
): NormalizedGlobalBundle[];
|
|
192
|
+
export declare function normalizeAssetPatterns(
|
|
193
|
+
assetPatterns: AssetPattern[],
|
|
194
|
+
workspaceRoot: string,
|
|
195
|
+
projectRoot: string,
|
|
196
|
+
projectSourceRoot?: string,
|
|
197
|
+
): NormalizedAssetPattern[];
|
|
198
|
+
export declare function resolveAssets(
|
|
199
|
+
entries: NormalizedAssetPattern[],
|
|
200
|
+
workspaceRoot: string,
|
|
201
|
+
): Promise<Array<{ source: string; destination: string }>>;
|
|
202
|
+
export declare function normalizeApplicationOptions(
|
|
203
|
+
rawOptions: Record<string, any>,
|
|
204
|
+
projectMetadata: Record<string, any>,
|
|
205
|
+
workspaceRoot: string,
|
|
206
|
+
projectName: string,
|
|
207
|
+
): NormalizedApplicationOptions;
|
|
208
|
+
export declare function normalizeDevServerOptions(
|
|
209
|
+
rawServeOptions: Record<string, any>,
|
|
210
|
+
workspace: Record<string, any>,
|
|
211
|
+
projectName: string,
|
|
212
|
+
workspaceRoot: string,
|
|
213
|
+
): NormalizedDevServerOptions;
|