3 Commits

Author SHA1 Message Date
Alan Agius
576119f2ca 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 #14551
2019-05-30 10:21:49 -07:00
Charles Lyding
01e242487b fix(@schematics/angular): avoid tslint overhead for lazy module migration
By using a pure schematic based implementation the overhead of running tslint can be removed.  This also has the benefit of allowing direct control over the files loaded and to modify files only within the schematic tree context.
For a hello world application, there was a ~20% performance improvement for the CLI migration from 7.0 to 8.0 as well as a ~10% reduction in memory usage.
2019-05-07 15:47:37 -06:00
Craig Spence
77f99b535d feat(@schematics/angular): add lazy module path fixer 2019-04-16 09:38:55 -07:00