Please sign in to comment.
fix(core): TypeScript related migrations should cater for BOM (#30719)
fix(@schematics/angular): TypeScript related migrations should cater for BOM In the CLI `UpdateRecorder` methods such as `insertLeft`, `remove` etc.. accepts positions which are not offset by a BOM. This is because when a file has a BOM a different recorder will be used https://github.com/angular/angular-cli/blob/master/packages/angular_devkit/schematics/src/tree/recorder.ts#L72 which caters for an addition offset/delta. The main reason for this is that when a developer is writing a schematic they shouldn't need to compute the offset based if a file has a BOM or not and is handled out of the box. Example ```ts recorder.insertLeft(5, 'true'); ``` However this is unfortunate in the case if a ts SourceFile is used and one uses `getWidth` and `getStart` method they will already be offset by 1, which at the end it results in a double offset and hence the problem. Fixes #30713 PR Close #30719
- Loading branch information...
Showing with 86 additions and 4 deletions.
- +4 −1 packages/core/schematics/migrations/injectable-pipe/index.ts
- +4 −1 packages/core/schematics/migrations/move-document/index.ts
- +4 −1 packages/core/schematics/migrations/static-queries/index.ts
- +4 −1 packages/core/schematics/migrations/template-var-assignment/index.ts
- +14 −0 packages/core/schematics/test/injectable_pipe_migration_spec.ts
- +13 −0 packages/core/schematics/test/move_document_migration_spec.ts
- +23 −0 packages/core/schematics/test/static_queries_migration_template_spec.ts
- +20 −0 packages/core/schematics/test/static_queries_migration_usage_spec.ts