@angular-devkit/schematics 13.0.0-next.9 → 13.0.0-rc.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@angular-devkit/schematics",
3
- "version": "13.0.0-next.9",
3
+ "version": "13.0.0-rc.3",
4
4
  "description": "Angular Schematics - Library",
5
5
  "main": "src/index.js",
6
6
  "typings": "src/index.d.ts",
@@ -18,7 +18,7 @@
18
18
  "schematics"
19
19
  ],
20
20
  "dependencies": {
21
- "@angular-devkit/core": "13.0.0-next.9",
21
+ "@angular-devkit/core": "13.0.0-rc.3",
22
22
  "jsonc-parser": "3.0.0",
23
23
  "magic-string": "0.25.7",
24
24
  "ora": "5.4.1",
@@ -30,7 +30,7 @@
30
30
  },
31
31
  "engines": {
32
32
  "node": "^12.20.0 || ^14.15.0 || >=16.10.0",
33
- "npm": "^6.11.0 || ^7.5.6",
33
+ "npm": "^6.11.0 || ^7.5.6 || >=8.0.0",
34
34
  "yarn": ">= 1.13.0"
35
35
  },
36
36
  "author": "Angular Authors",
@@ -36,7 +36,7 @@ export declare class Chunk {
36
36
  next: Chunk | null;
37
37
  constructor(start: number, end: number, originalContent: Buffer);
38
38
  get length(): number;
39
- toString(encoding?: string): string;
39
+ toString(encoding?: BufferEncoding): string;
40
40
  slice(start: number): Chunk;
41
41
  append(buffer: Buffer, essential: boolean): void;
42
42
  prepend(buffer: Buffer, essential: boolean): void;
@@ -95,7 +95,7 @@ export declare class UpdateBuffer extends UpdateBufferBase {
95
95
  protected _getTextPosition(index: number): number;
96
96
  get length(): number;
97
97
  get original(): Buffer;
98
- toString(encoding?: string): string;
98
+ toString(encoding?: BufferEncoding): string;
99
99
  generate(): Buffer;
100
100
  insertLeft(index: number, content: Buffer, assert?: boolean): void;
101
101
  insertRight(index: number, content: Buffer, assert?: boolean): void;
@@ -209,8 +209,16 @@ class UpdateBuffer extends UpdateBufferBase {
209
209
  }
210
210
  }
211
211
  _slice(start) {
212
- // If start is longer than the content, use start, otherwise determine exact position in string.
213
- const index = start >= this._originalContent.length ? start : this._getTextPosition(start);
212
+ let index;
213
+ if (start >= this._originalContent.length) {
214
+ index = start;
215
+ }
216
+ else if (start < 0) {
217
+ index = this._originalContent.length + start;
218
+ }
219
+ else {
220
+ index = this._getTextPosition(start);
221
+ }
214
222
  this._assertIndex(index);
215
223
  // Find the chunk by going through the list.
216
224
  const h = this._linkedList.find((chunk) => index <= chunk.end);
@@ -255,6 +263,9 @@ class UpdateBuffer extends UpdateBufferBase {
255
263
  this._slice(index)[1].prepend(content, assert);
256
264
  }
257
265
  remove(index, length) {
266
+ if (length === 0) {
267
+ return;
268
+ }
258
269
  const end = index + length;
259
270
  const first = this._slice(index)[1];
260
271
  const last = this._slice(end)[1];