Skip to content

Commit a2bd940

Browse files
clydinalan-agius4
authored andcommitted
fix(@angular-devkit/build-angular): add verbose logging for differential loading and i18n
When the verbose option is enabled during a build, additional logs are generated for the differential loading and i18n localization processing. These logs can be used to trace which files were queued for processing and when the files were processed.
1 parent a2f130c commit a2bd940

File tree

1 file changed

+48
-1
lines changed
  • packages/angular_devkit/build_angular/src/browser

1 file changed

+48
-1
lines changed

packages/angular_devkit/build_angular/src/browser/index.ts

Lines changed: 48 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -414,6 +414,13 @@ export function buildWebpackBrowser(
414414
const processActions: typeof actions = [];
415415
let processRuntimeAction: ProcessBundleOptions | undefined;
416416
for (const action of actions) {
417+
if (options.verbose) {
418+
context.logger.info(
419+
`[${new Date().toISOString()}] Differential loading file queued: ${
420+
action.filename
421+
}`,
422+
);
423+
}
417424
// If SRI is enabled always process the runtime bundle
418425
// Lazy route integrity values are stored in the runtime bundle
419426
if (action.integrityAlgorithm && action.runtime) {
@@ -434,6 +441,22 @@ export function buildWebpackBrowser(
434441
for await (const result of differentialLoadingExecutor.processAll(
435442
processActions,
436443
)) {
444+
if (options.verbose) {
445+
if (result.original) {
446+
context.logger.info(
447+
`[${new Date().toISOString()}] Differential loading file processed: ${
448+
result.original.filename
449+
}`,
450+
);
451+
}
452+
if (result.downlevel) {
453+
context.logger.info(
454+
`[${new Date().toISOString()}] Differential loading file processed: ${
455+
result.downlevel.filename
456+
}`,
457+
);
458+
}
459+
}
437460
processResults.push(result);
438461
}
439462
} finally {
@@ -452,13 +475,26 @@ export function buildWebpackBrowser(
452475
);
453476
}
454477

478+
if (options.verbose) {
479+
context.logger.info(
480+
`[${new Date().toISOString()}] Differential loading processing complete.`,
481+
);
482+
}
483+
455484
spinner.succeed('ES5 bundle generation complete.');
456485

457486
if (i18n.shouldInline) {
458487
spinner.start('Generating localized bundles...');
459488
const inlineActions: InlineOptions[] = [];
460489
for (const result of processResults) {
461490
if (result.original) {
491+
if (options.verbose) {
492+
context.logger.info(
493+
`[${new Date().toISOString()}] i18n localize file queued: ${
494+
result.original.filename
495+
}`,
496+
);
497+
}
462498
inlineActions.push({
463499
filename: path.basename(result.original.filename),
464500
// Memory mode is always enabled for i18n
@@ -472,6 +508,13 @@ export function buildWebpackBrowser(
472508
});
473509
}
474510
if (result.downlevel) {
511+
if (options.verbose) {
512+
context.logger.info(
513+
`[${new Date().toISOString()}] i18n localize file queued: ${
514+
result.downlevel.filename
515+
}`,
516+
);
517+
}
475518
inlineActions.push({
476519
filename: path.basename(result.downlevel.filename),
477520
// Memory mode is always enabled for i18n
@@ -492,10 +535,14 @@ export function buildWebpackBrowser(
492535
options.subresourceIntegrity ? 'sha384' : undefined,
493536
);
494537
try {
538+
let localizedCount = 0;
495539
for await (const result of i18nExecutor.inlineAll(inlineActions)) {
540+
localizedCount++;
496541
if (options.verbose) {
497542
context.logger.info(
498-
`Localized "${result.file}" [${result.count} translation(s)].`,
543+
`[${new Date().toISOString()}] (${localizedCount}/${
544+
inlineActions.length
545+
}) Localized "${result.file}" [${result.count} translation(s)].`,
499546
);
500547
}
501548
for (const diagnostic of result.diagnostics) {

0 commit comments

Comments
 (0)