Skip to content

Only rewrite FormatJS descriptors in app code - #19

Open
aklkv wants to merge 2 commits into
mainmatter:mainfrom
aklkv:fix/scope-js-transforms
Open

aklkv wants to merge 2 commits into
mainmatter:mainfrom
aklkv:fix/scope-js-transforms

Conversation

@aklkv

@aklkv aklkv commented Oct 20, 2026

Copy link
Copy Markdown
Contributor

Part of splitting up #16.

Under Vite, ember-intl's own source goes through the app's Babel pass, and its internal intl.formatMessage(descriptor, values) was being rewritten to intl.t('[sha512:contenthash:base64:6]', values). The replacer now only fires on an object literal with defaultMessage or id, and neither transform touches node_modules.

Also fixes calls without values printing as intl.t('key', ).

aklkv added 2 commits October 21, 2026 00:29
The replacer assigned arguments[1] and arguments[2] by index, so a call
with no values printed as intl.t('key', ). The fixtures didn't catch it
because babel-plugin-tester runs the output through prettier, which
drops the trailing comma, so the new tests read babel's own output.
Under Embroider + Vite, ember-intl's own source goes through the app's
babel pass. Its internal intl.formatMessage(descriptor, values) was
rewritten to intl.t('[sha512:contenthash:base64:6]', values), with the
raw id pattern as the key.

The replacer now fires only when the first argument is an object
literal with defaultMessage or id. Neither transform touches files under
node_modules any more, apart from an app old Embroider stages there,
since libraries ship already compiled.
@aklkv
aklkv force-pushed the fix/scope-js-transforms branch from db97109 to db20cb7 Compare October 21, 2026 07:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant