Skip to content

refactor(@angular/build): add typed helper for worker pool execution in i18n inliner - #33985

Merged
clydin merged 3 commits into
angular:mainfrom
clydin:refactor/i18n-inliner-worker-task-helper
Sep 2, 2026
Merged

refactor(@angular/build): add typed helper for worker pool execution in i18n inliner#33985
clydin merged 3 commits into
angular:mainfrom
clydin:refactor/i18n-inliner-worker-task-helper

Conversation

@clydin

@clydin clydin commented Sep 1, 2026

Copy link
Copy Markdown
Member

Add a strongly-typed private helper method #runWorkerTask to I18nInliner to encapsulate worker pool execution.

The helper maps worker task names ('inlineFileBatch' and 'inlineCode') to their exact request and result types exported from the worker module. This eliminates manual type assertions and untyped return values while centralizing worker pool task dispatch.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request improves type safety and readability in the i18n inliner tool by exporting worker-related interfaces and introducing a typed #runWorkerTask helper method in I18nInliner. The reviewer suggested adding an explicit type assertion to the return value of #runWorkerTask to prevent potential compilation errors under strict TypeScript configurations, as the underlying worker pool run method returns Promise<unknown>.

Comment thread packages/angular/build/src/tools/esbuild/i18n-inliner.ts
@clydin
clydin force-pushed the refactor/i18n-inliner-worker-task-helper branch from a88038f to 7ecc61b Compare September 1, 2026 16:02
@clydin clydin added target: minor This PR is targeted for the next minor release action: review The PR is still awaiting reviews from at least one requested reviewer labels Sep 1, 2026
…in i18n inliner

Add a strongly-typed private helper method #runWorkerTask to I18nInliner to encapsulate worker pool execution.

The helper maps worker task names ('inlineFileBatch' and 'inlineCode') to their exact request and result types exported from the worker module. This eliminates manual type assertions and untyped return values while centralizing worker pool task dispatch.
… inliner

Remove workerData from the i18n inliner worker pool initialization and pass missingTranslation per task in the request payload.

This decouples the worker pool from inliner-specific options, allowing worker threads to be safely shared without hardcoding the missingTranslation handling behavior at pool creation time.
@clydin
clydin force-pushed the refactor/i18n-inliner-worker-task-helper branch from 7ecc61b to e9baeb7 Compare September 1, 2026 22:08
…iner task execution

Specify the worker target file directly in each task run option via #runWorkerTask rather than hardcoding a default filename during WorkerPool instantiation.

To prepare for ESM transition and avoid reliance on ambient require, createRequire is used to resolve the inliner worker script path. Explicitly specifying the worker file per task enables the inliner to run against general-purpose or shared worker pools that do not have a preconfigured default script.
@alan-agius4 alan-agius4 added action: merge The PR is ready for merge by the caretaker and removed action: review The PR is still awaiting reviews from at least one requested reviewer labels Sep 2, 2026
@clydin
clydin merged commit c35b43c into angular:main Sep 2, 2026
40 checks passed
@clydin

clydin commented Sep 2, 2026

Copy link
Copy Markdown
Member Author

This PR was merged into the repository. The changes were merged into the following branches:

@clydin
clydin deleted the refactor/i18n-inliner-worker-task-helper branch September 2, 2026 11:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

action: merge The PR is ready for merge by the caretaker area: @angular/build target: minor This PR is targeted for the next minor release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants