Skip to content

fix(@angular-devkit/schematics): fix generate mangling files contai… #11978

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

Merged
merged 1 commit into from
Sep 6, 2018
Merged

fix(@angular-devkit/schematics): fix generate mangling files contai… #11978

merged 1 commit into from
Sep 6, 2018

Conversation

sebastianhaeni
Copy link
Contributor

@sebastianhaeni sebastianhaeni commented Aug 22, 2018

…ning wide characters

Executing a command like ng generate component my-component can sometimes lead to mangled Angular module files when inserting the component into declaration and adding the import.
This happens if the file contains characters that are wider than one byte e.g. a copyright sign or an umlaut. Today it is expected to be able to use two byte long characters in code.

The UpdateBuffer class operates using Buffer objects which use byte arrays internally. Using text node positions provided by the TypeScript library, these will not match up.
This change looks up the textual position inside the Buffer and uses the correct index.

Closes #7732
Closes #7851
Closes #7950
Closes #9560
Closes #10030
Closes #10095

…ning wide characters

Executing a command like `ng generate component my-component` can sometimes lead to
mangled Angular module files when inserting the component into `declaration` and
adding the import. This happens if the file contains characters that are wider than
one byte e.g. a copyright sign or an umlaut. Today it is expected to be able to use
two byte long characters in code.

The `UpdateBuffer` class operates using Buffer objects which use byte arrays internally.
Using text node positions provided by the TypeScript library, these will not match up.
This change looks up the textual position inside the Buffer and uses the correct index.

Closes #7851, #7950
@sebastianhaeni
Copy link
Contributor Author

Is there any feedback to this PR?

@clydin clydin added the target: patch This PR is targeted for the next patch release label Sep 6, 2018
@alexeagle alexeagle merged commit 8caeb47 into angular:master Sep 6, 2018
@KaiserKatze
Copy link

Wonderful!

@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 12, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.