Skip to content

Commit 1cefbc6

Browse files
clydinvikerman
authored andcommitted
refactor(@angular-devkit/build-angular): process bundle code quality improvements
1 parent 592a512 commit 1cefbc6

File tree

3 files changed

+292
-195
lines changed

3 files changed

+292
-195
lines changed

packages/angular_devkit/build_angular/src/browser/action-executor.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,18 @@ export class ActionExecutor<Input extends { size: number }, Output> {
1414

1515
private smallThreshold = 32 * 1024;
1616

17-
constructor(actionFile: string, private readonly actionName: string) {
17+
constructor(actionFile: string, private readonly actionName: string, setupOptions?: unknown) {
1818
// larger files are processed in a separate process to limit memory usage in the main process
1919
this.largeWorker = new JestWorker(actionFile, {
2020
exposedMethods: [actionName],
21+
setupArgs: setupOptions === undefined ? undefined : [setupOptions],
2122
});
2223

2324
// small files are processed in a limited number of threads to improve speed
2425
// The limited number also prevents a large increase in memory usage for an otherwise short operation
2526
this.smallWorker = new JestWorker(actionFile, {
2627
exposedMethods: [actionName],
28+
setupArgs: setupOptions === undefined ? undefined : [setupOptions],
2729
numWorkers: os.cpus().length < 2 ? 1 : 2,
2830
// Will automatically fallback to processes if not supported
2931
enableWorkerThreads: true,

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -543,13 +543,11 @@ export function buildWebpackBrowser(
543543
processRuntimeAction = {
544544
...action,
545545
cacheKeys,
546-
cachePath: cacheDownlevelPath || undefined,
547546
};
548547
} else {
549548
processActions.push({
550549
...action,
551550
cacheKeys,
552-
cachePath: cacheDownlevelPath || undefined,
553551
});
554552
}
555553
}
@@ -593,6 +591,7 @@ export function buildWebpackBrowser(
593591
? workerFile
594592
: require.resolve('../utils/process-bundle-bootstrap'),
595593
'process',
594+
{ cachePath: cacheDownlevelPath },
596595
);
597596

598597
try {

0 commit comments

Comments
 (0)