New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(localize): do not expose NodeJS typings in $localize runtime code #38700
fix(localize): do not expose NodeJS typings in $localize runtime code #38700
Conversation
A recent change to `@angular/localize` brought in the `AbsoluteFsPath` type from the `@angular/compiler-cli`. But this brought along with it a reference to NodeJS typings - specifically the `FileSystem` interface refers to the `Buffer` type from NodeJS. This affects compilation of `@angular/localize` code that will be run in the browser - for example projects that reference `loadTranslations()`. The compilation breaks if the NodeJS typings are not included in the build. Clearly it is not desirable to have these typings included when the project is not targeting NodeJS. This commit replaces references to the NodeJS `Buffer` type with `Uint8Array`, which is available across all platforms and is actually the super-class of `Buffer`. Fixes angular#38692
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks for the fix @petebacondarwin 👍
Quick question: I believe there is a chance that similar situation may happen in the future (with Buffer
or other types). I was thinking if we can somehow test (as a part of a separate PR) that everything works as expected without NodeJS typings available?
I was wondering if we could remove NodeJS typings from the |
@petebacondarwin FYI presubmit went well, plz add the "merge" label if PR is ready to go and no additional changes are needed/planned. Thank you. |
…#38700) A recent change to `@angular/localize` brought in the `AbsoluteFsPath` type from the `@angular/compiler-cli`. But this brought along with it a reference to NodeJS typings - specifically the `FileSystem` interface refers to the `Buffer` type from NodeJS. This affects compilation of `@angular/localize` code that will be run in the browser - for example projects that reference `loadTranslations()`. The compilation breaks if the NodeJS typings are not included in the build. Clearly it is not desirable to have these typings included when the project is not targeting NodeJS. This commit replaces references to the NodeJS `Buffer` type with `Uint8Array`, which is available across all platforms and is actually the super-class of `Buffer`. Fixes #38692 PR Close #38700
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
A recent change to
@angular/localize
brought in theAbsoluteFsPath
typefrom the
@angular/compiler-cli
. But this brought along with it a referenceto NodeJS typings - specifically the
FileSystem
interface refers to theBuffer
type from NodeJS.This affects compilation of
@angular/localize
code that will be run inthe browser - for example projects that reference
loadTranslations()
.The compilation breaks if the NodeJS typings are not included in the build.
Clearly it is not desirable to have these typings included when the project
is not targeting NodeJS.
This commit replaces references to the NodeJS
Buffer
type withUint8Array
,which is available across all platforms and is actually the super-class of
Buffer
.Fixes #38692