@angular-devkit/schematics 12.0.0-rc.0 → 12.0.0
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/README.md +81 -61
- package/collection-schema.json +2 -7
- package/package.json +3 -3
- package/src/_golden-api.d.ts +1 -1
- package/src/_golden-api.js +1 -1
- package/src/engine/engine.d.ts +2 -2
- package/src/engine/engine.js +35 -22
- package/src/engine/index.d.ts +1 -1
- package/src/engine/index.js +7 -7
- package/src/engine/interface.d.ts +2 -2
- package/src/engine/interface.js +7 -0
- package/src/engine/schematic.d.ts +1 -1
- package/src/engine/schematic.js +13 -8
- package/src/exception/exception.d.ts +1 -1
- package/src/exception/exception.js +15 -7
- package/src/formats/format-validator.d.ts +1 -1
- package/src/formats/format-validator.js +4 -6
- package/src/formats/html-selector.d.ts +1 -1
- package/src/formats/html-selector.js +19 -12
- package/src/formats/index.d.ts +1 -1
- package/src/formats/index.js +3 -6
- package/src/formats/path.d.ts +1 -1
- package/src/formats/path.js +1 -1
- package/src/index.d.ts +3 -3
- package/src/index.js +20 -14
- package/src/rules/base.d.ts +7 -0
- package/src/rules/base.js +10 -10
- package/src/rules/call.d.ts +1 -1
- package/src/rules/call.js +7 -7
- package/src/rules/move.d.ts +7 -0
- package/src/rules/move.js +5 -5
- package/src/rules/random.d.ts +1 -1
- package/src/rules/random.js +17 -5
- package/src/rules/rename.d.ts +7 -0
- package/src/rules/rename.js +4 -4
- package/src/rules/schematic.d.ts +7 -0
- package/src/rules/schematic.js +5 -5
- package/src/rules/template.d.ts +1 -1
- package/src/rules/template.js +15 -9
- package/src/rules/url.d.ts +7 -0
- package/src/rules/url.js +3 -3
- package/src/sink/dryrun.d.ts +2 -2
- package/src/sink/dryrun.js +8 -8
- package/src/sink/host.d.ts +2 -2
- package/src/sink/host.js +8 -1
- package/src/sink/sink.d.ts +2 -2
- package/src/sink/sink.js +41 -29
- package/src/tree/action.d.ts +2 -2
- package/src/tree/action.js +24 -13
- package/src/tree/delegate.d.ts +2 -2
- package/src/tree/delegate.js +46 -13
- package/src/tree/empty.d.ts +1 -1
- package/src/tree/empty.js +6 -4
- package/src/tree/entry.d.ts +2 -2
- package/src/tree/entry.js +19 -4
- package/src/tree/host-tree.d.ts +2 -2
- package/src/tree/host-tree.js +18 -20
- package/src/tree/interface.d.ts +2 -2
- package/src/tree/interface.js +12 -3
- package/src/tree/null.d.ts +2 -2
- package/src/tree/null.js +22 -12
- package/src/tree/recorder.d.ts +7 -0
- package/src/tree/recorder.js +9 -7
- package/src/tree/scoped.d.ts +2 -2
- package/src/tree/scoped.js +31 -14
- package/src/tree/static.d.ts +7 -0
- package/src/tree/static.js +3 -3
- package/src/utility/linked-list.d.ts +1 -1
- package/src/utility/linked-list.js +4 -2
- package/src/utility/update-buffer.d.ts +2 -2
- package/src/utility/update-buffer.js +11 -11
- package/src/workflow/base.d.ts +1 -1
- package/src/workflow/base.js +16 -12
- package/src/workflow/index.d.ts +1 -1
- package/src/workflow/index.js +7 -7
- package/src/workflow/interface.d.ts +1 -1
- package/src/workflow/interface.js +7 -0
- package/tasks/index.d.ts +1 -1
- package/tasks/index.js +3 -3
- package/tasks/node/index.d.ts +1 -1
- package/tasks/node/index.js +11 -4
- package/tasks/package-manager/executor.d.ts +1 -1
- package/tasks/package-manager/executor.js +9 -7
- package/tasks/package-manager/install-task.d.ts +1 -1
- package/tasks/package-manager/install-task.js +7 -0
- package/tasks/package-manager/link-task.d.ts +1 -1
- package/tasks/package-manager/link-task.js +7 -0
- package/tasks/package-manager/options.d.ts +2 -1
- package/tasks/package-manager/options.js +3 -3
- package/tasks/repo-init/executor.d.ts +7 -0
- package/tasks/repo-init/executor.js +6 -11
- package/tasks/repo-init/init-task.d.ts +1 -1
- package/tasks/repo-init/init-task.js +7 -0
- package/tasks/repo-init/options.d.ts +1 -1
- package/tasks/repo-init/options.js +3 -3
- package/tasks/run-schematic/executor.d.ts +1 -1
- package/tasks/run-schematic/executor.js +7 -0
- package/tasks/run-schematic/options.d.ts +1 -1
- package/tasks/run-schematic/options.js +3 -3
- package/tasks/run-schematic/task.d.ts +1 -1
- package/tasks/run-schematic/task.js +7 -0
- package/tasks/tslint-fix/executor.d.ts +7 -0
- package/tasks/tslint-fix/executor.js +23 -19
- package/tasks/tslint-fix/options.d.ts +1 -1
- package/tasks/tslint-fix/options.js +7 -0
- package/tasks/tslint-fix/task.d.ts +1 -1
- package/tasks/tslint-fix/task.js +7 -0
- package/tasks/tslint-fix/test/custom-rule.d.ts +1 -1
- package/tasks/tslint-fix/test/custom-rule.js +8 -1
- package/tasks/tslint-fix/test/rules/customRuleRule.js +5 -5
- package/tasks/tslint-fix/test/run-task.d.ts +1 -1
- package/tasks/tslint-fix/test/run-task.js +8 -1
- package/testing/index.d.ts +1 -1
- package/testing/index.js +7 -7
- package/testing/schematic-test-runner.d.ts +1 -1
- package/testing/schematic-test-runner.js +21 -13
- package/tools/description.d.ts +1 -1
- package/tools/description.js +7 -0
- package/tools/export-ref.d.ts +7 -0
- package/tools/export-ref.js +12 -6
- package/tools/fallback-engine-host.d.ts +2 -3
- package/tools/fallback-engine-host.js +9 -12
- package/tools/file-system-engine-host-base.d.ts +2 -2
- package/tools/file-system-engine-host-base.js +23 -16
- package/tools/file-system-engine-host.d.ts +7 -0
- package/tools/file-system-engine-host.js +4 -4
- package/tools/file-system-utility.d.ts +1 -1
- package/tools/file-system-utility.js +6 -6
- package/tools/index.d.ts +1 -1
- package/tools/index.js +7 -7
- package/tools/node-module-engine-host.d.ts +1 -1
- package/tools/node-module-engine-host.js +5 -4
- package/tools/node-modules-test-engine-host.d.ts +1 -1
- package/tools/node-modules-test-engine-host.js +13 -2
- package/tools/schema-option-transform.d.ts +1 -1
- package/tools/schema-option-transform.js +4 -6
- package/tools/workflow/node-workflow.d.ts +2 -1
- package/tools/workflow/node-workflow.js +5 -4
package/src/tree/host-tree.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.FilterHostTree = exports.HostCreateTree = exports.HostTree = exports.HostDirEntry = void 0;
|
|
4
2
|
/**
|
|
5
3
|
* @license
|
|
6
|
-
* Copyright Google
|
|
4
|
+
* Copyright Google LLC All Rights Reserved.
|
|
7
5
|
*
|
|
8
6
|
* Use of this source code is governed by an MIT-style license that can be
|
|
9
7
|
* found in the LICENSE file at https://angular.io/license
|
|
10
8
|
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.FilterHostTree = exports.HostCreateTree = exports.HostTree = exports.HostDirEntry = void 0;
|
|
11
11
|
const core_1 = require("@angular-devkit/core");
|
|
12
12
|
const rxjs_1 = require("rxjs");
|
|
13
13
|
const operators_1 = require("rxjs/operators");
|
|
@@ -26,12 +26,14 @@ class HostDirEntry {
|
|
|
26
26
|
this._tree = _tree;
|
|
27
27
|
}
|
|
28
28
|
get subdirs() {
|
|
29
|
-
return this._host
|
|
30
|
-
.
|
|
29
|
+
return this._host
|
|
30
|
+
.list(this.path)
|
|
31
|
+
.filter((fragment) => this._host.isDirectory(core_1.join(this.path, fragment)));
|
|
31
32
|
}
|
|
32
33
|
get subfiles() {
|
|
33
|
-
return this._host
|
|
34
|
-
.
|
|
34
|
+
return this._host
|
|
35
|
+
.list(this.path)
|
|
36
|
+
.filter((fragment) => this._host.isFile(core_1.join(this.path, fragment)));
|
|
35
37
|
}
|
|
36
38
|
dir(name) {
|
|
37
39
|
return this._tree.getDir(core_1.join(this.path, name));
|
|
@@ -41,7 +43,7 @@ class HostDirEntry {
|
|
|
41
43
|
}
|
|
42
44
|
visit(visitor) {
|
|
43
45
|
try {
|
|
44
|
-
this.getSubfilesRecursively().forEach(file => visitor(file.path, file));
|
|
46
|
+
this.getSubfilesRecursively().forEach((file) => visitor(file.path, file));
|
|
45
47
|
}
|
|
46
48
|
catch (e) {
|
|
47
49
|
if (e !== interface_1.FileVisitorCancelToken) {
|
|
@@ -51,10 +53,7 @@ class HostDirEntry {
|
|
|
51
53
|
}
|
|
52
54
|
getSubfilesRecursively() {
|
|
53
55
|
function _recurse(entry) {
|
|
54
|
-
return entry.subdirs.reduce((files, subdir) => [
|
|
55
|
-
...files,
|
|
56
|
-
..._recurse(entry.dir(subdir)),
|
|
57
|
-
], entry.subfiles.map(subfile => entry.file(subfile)));
|
|
56
|
+
return entry.subdirs.reduce((files, subdir) => [...files, ..._recurse(entry.dir(subdir))], entry.subfiles.map((subfile) => entry.file(subfile)));
|
|
58
57
|
}
|
|
59
58
|
return _recurse(this);
|
|
60
59
|
}
|
|
@@ -128,7 +127,7 @@ class HostTree {
|
|
|
128
127
|
const creationConflictAllowed = (strategy & interface_1.MergeStrategy.AllowCreationConflict) == interface_1.MergeStrategy.AllowCreationConflict;
|
|
129
128
|
const overwriteConflictAllowed = (strategy & interface_1.MergeStrategy.AllowOverwriteConflict) == interface_1.MergeStrategy.AllowOverwriteConflict;
|
|
130
129
|
const deleteConflictAllowed = (strategy & interface_1.MergeStrategy.AllowDeleteConflict) == interface_1.MergeStrategy.AllowDeleteConflict;
|
|
131
|
-
other.actions.forEach(action => {
|
|
130
|
+
other.actions.forEach((action) => {
|
|
132
131
|
switch (action.kind) {
|
|
133
132
|
case 'c': {
|
|
134
133
|
const { path, content } = action;
|
|
@@ -347,7 +346,7 @@ class HostCreateTree extends HostTree {
|
|
|
347
346
|
constructor(host) {
|
|
348
347
|
super();
|
|
349
348
|
const tempHost = new HostTree(host);
|
|
350
|
-
tempHost.visit(path => {
|
|
349
|
+
tempHost.visit((path) => {
|
|
351
350
|
const content = tempHost.read(path);
|
|
352
351
|
if (content) {
|
|
353
352
|
this.create(path, content);
|
|
@@ -361,21 +360,20 @@ class FilterHostTree extends HostTree {
|
|
|
361
360
|
const newBackend = new core_1.virtualFs.SimpleMemoryHost();
|
|
362
361
|
// cast to allow access
|
|
363
362
|
const originalBackend = tree._backend;
|
|
364
|
-
const recurse = base => {
|
|
365
|
-
return originalBackend.list(base)
|
|
366
|
-
.pipe(operators_1.mergeMap(x => x), operators_1.map(path => core_1.join(base, path)), operators_1.concatMap(path => {
|
|
363
|
+
const recurse = (base) => {
|
|
364
|
+
return originalBackend.list(base).pipe(operators_1.mergeMap((x) => x), operators_1.map((path) => core_1.join(base, path)), operators_1.concatMap((path) => {
|
|
367
365
|
let isDirectory = false;
|
|
368
|
-
originalBackend.isDirectory(path).subscribe(val => isDirectory = val);
|
|
366
|
+
originalBackend.isDirectory(path).subscribe((val) => (isDirectory = val));
|
|
369
367
|
if (isDirectory) {
|
|
370
368
|
return recurse(path);
|
|
371
369
|
}
|
|
372
370
|
let isFile = false;
|
|
373
|
-
originalBackend.isFile(path).subscribe(val => isFile = val);
|
|
371
|
+
originalBackend.isFile(path).subscribe((val) => (isFile = val));
|
|
374
372
|
if (!isFile || !filter(path)) {
|
|
375
373
|
return rxjs_1.EMPTY;
|
|
376
374
|
}
|
|
377
375
|
let content = null;
|
|
378
|
-
originalBackend.read(path).subscribe(val => content = val);
|
|
376
|
+
originalBackend.read(path).subscribe((val) => (content = val));
|
|
379
377
|
if (!content) {
|
|
380
378
|
return rxjs_1.EMPTY;
|
|
381
379
|
}
|
package/src/tree/interface.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
1
|
/**
|
|
3
2
|
* @license
|
|
4
|
-
* Copyright Google
|
|
3
|
+
* Copyright Google LLC All Rights Reserved.
|
|
5
4
|
*
|
|
6
5
|
* Use of this source code is governed by an MIT-style license that can be
|
|
7
6
|
* found in the LICENSE file at https://angular.io/license
|
|
8
7
|
*/
|
|
8
|
+
/// <reference types="node" />
|
|
9
9
|
import { Path, PathFragment } from '@angular-devkit/core';
|
|
10
10
|
import { Action } from './action';
|
|
11
11
|
export declare enum MergeStrategy {
|
package/src/tree/interface.js
CHANGED
|
@@ -1,4 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @license
|
|
4
|
+
* Copyright Google LLC All Rights Reserved.
|
|
5
|
+
*
|
|
6
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
7
|
+
* found in the LICENSE file at https://angular.io/license
|
|
8
|
+
*/
|
|
2
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
10
|
exports.TreeSymbol = exports.FileVisitorCancelToken = exports.MergeStrategy = void 0;
|
|
4
11
|
var MergeStrategy;
|
|
@@ -16,11 +23,12 @@ var MergeStrategy;
|
|
|
16
23
|
// Overwrite everything with the latest change.
|
|
17
24
|
MergeStrategy[MergeStrategy["Overwrite"] = 14] = "Overwrite";
|
|
18
25
|
})(MergeStrategy = exports.MergeStrategy || (exports.MergeStrategy = {}));
|
|
26
|
+
// eslint-disable-next-line @typescript-eslint/no-inferrable-types
|
|
19
27
|
exports.FileVisitorCancelToken = Symbol();
|
|
20
28
|
exports.TreeSymbol = (function () {
|
|
21
|
-
const globalSymbol = (typeof window == 'object' && window.window === window && window.Symbol)
|
|
22
|
-
|
|
23
|
-
|
|
29
|
+
const globalSymbol = (typeof window == 'object' && window.window === window && window.Symbol) ||
|
|
30
|
+
(typeof self == 'object' && self.self === self && self.Symbol) ||
|
|
31
|
+
(typeof global == 'object' && global.global === global && global.Symbol);
|
|
24
32
|
if (!globalSymbol) {
|
|
25
33
|
return Symbol('schematic-tree');
|
|
26
34
|
}
|
|
@@ -29,6 +37,7 @@ exports.TreeSymbol = (function () {
|
|
|
29
37
|
}
|
|
30
38
|
return globalSymbol.schematicTree;
|
|
31
39
|
})();
|
|
40
|
+
// eslint-disable-next-line @typescript-eslint/no-namespace
|
|
32
41
|
var Tree;
|
|
33
42
|
(function (Tree) {
|
|
34
43
|
function isTree(maybeTree) {
|
package/src/tree/null.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
1
|
/**
|
|
3
2
|
* @license
|
|
4
|
-
* Copyright Google
|
|
3
|
+
* Copyright Google LLC All Rights Reserved.
|
|
5
4
|
*
|
|
6
5
|
* Use of this source code is governed by an MIT-style license that can be
|
|
7
6
|
* found in the LICENSE file at https://angular.io/license
|
|
8
7
|
*/
|
|
8
|
+
/// <reference types="node" />
|
|
9
9
|
import { BaseException, Path, PathFragment } from '@angular-devkit/core';
|
|
10
10
|
import { Action } from './action';
|
|
11
11
|
import { DirEntry, MergeStrategy, Tree, UpdateRecorder } from './interface';
|
package/src/tree/null.js
CHANGED
|
@@ -1,19 +1,21 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.NullTree = exports.NullTreeDirEntry = exports.CannotCreateFileException = void 0;
|
|
4
2
|
/**
|
|
5
3
|
* @license
|
|
6
|
-
* Copyright Google
|
|
4
|
+
* Copyright Google LLC All Rights Reserved.
|
|
7
5
|
*
|
|
8
6
|
* Use of this source code is governed by an MIT-style license that can be
|
|
9
7
|
* found in the LICENSE file at https://angular.io/license
|
|
10
8
|
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.NullTree = exports.NullTreeDirEntry = exports.CannotCreateFileException = void 0;
|
|
11
11
|
const core_1 = require("@angular-devkit/core");
|
|
12
12
|
const exception_1 = require("../exception/exception");
|
|
13
13
|
const interface_1 = require("./interface");
|
|
14
14
|
const recorder_1 = require("./recorder");
|
|
15
15
|
class CannotCreateFileException extends core_1.BaseException {
|
|
16
|
-
constructor(path) {
|
|
16
|
+
constructor(path) {
|
|
17
|
+
super(`Cannot create file "${path}".`);
|
|
18
|
+
}
|
|
17
19
|
}
|
|
18
20
|
exports.CannotCreateFileException = CannotCreateFileException;
|
|
19
21
|
class NullTreeDirEntry {
|
|
@@ -28,7 +30,9 @@ class NullTreeDirEntry {
|
|
|
28
30
|
dir(name) {
|
|
29
31
|
return new NullTreeDirEntry(core_1.join(this.path, name));
|
|
30
32
|
}
|
|
31
|
-
file(_name) {
|
|
33
|
+
file(_name) {
|
|
34
|
+
return null;
|
|
35
|
+
}
|
|
32
36
|
visit() { }
|
|
33
37
|
}
|
|
34
38
|
exports.NullTreeDirEntry = NullTreeDirEntry;
|
|
@@ -44,19 +48,25 @@ class NullTree {
|
|
|
44
48
|
}
|
|
45
49
|
merge(_other, _strategy) { }
|
|
46
50
|
// Simple readonly file system operations.
|
|
47
|
-
exists(_path) {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
+
exists(_path) {
|
|
52
|
+
return false;
|
|
53
|
+
}
|
|
54
|
+
read(_path) {
|
|
55
|
+
return null;
|
|
56
|
+
}
|
|
57
|
+
get(_path) {
|
|
58
|
+
return null;
|
|
59
|
+
}
|
|
60
|
+
getDir(path) {
|
|
61
|
+
return new NullTreeDirEntry(core_1.normalize('/' + path));
|
|
62
|
+
}
|
|
51
63
|
visit() { }
|
|
52
64
|
// Change content of host files.
|
|
53
65
|
beginUpdate(path) {
|
|
54
66
|
throw new exception_1.FileDoesNotExistException(path);
|
|
55
67
|
}
|
|
56
68
|
commitUpdate(record) {
|
|
57
|
-
throw new exception_1.FileDoesNotExistException(record instanceof recorder_1.UpdateRecorderBase
|
|
58
|
-
? record.path
|
|
59
|
-
: '<unknown>');
|
|
69
|
+
throw new exception_1.FileDoesNotExistException(record instanceof recorder_1.UpdateRecorderBase ? record.path : '<unknown>');
|
|
60
70
|
}
|
|
61
71
|
// Change structure of the host.
|
|
62
72
|
copy(path, _to) {
|
package/src/tree/recorder.d.ts
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright Google LLC All Rights Reserved.
|
|
4
|
+
*
|
|
5
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
6
|
+
* found in the LICENSE file at https://angular.io/license
|
|
7
|
+
*/
|
|
1
8
|
/// <reference types="node" />
|
|
2
9
|
import { UpdateBuffer } from '../utility/update-buffer';
|
|
3
10
|
import { FileEntry, UpdateRecorder } from './interface';
|
package/src/tree/recorder.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.UpdateRecorderBom = exports.UpdateRecorderBase = void 0;
|
|
4
2
|
/**
|
|
5
3
|
* @license
|
|
6
|
-
* Copyright Google
|
|
4
|
+
* Copyright Google LLC All Rights Reserved.
|
|
7
5
|
*
|
|
8
6
|
* Use of this source code is governed by an MIT-style license that can be
|
|
9
7
|
* found in the LICENSE file at https://angular.io/license
|
|
10
8
|
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.UpdateRecorderBom = exports.UpdateRecorderBase = void 0;
|
|
11
11
|
const exception_1 = require("../exception/exception");
|
|
12
12
|
const update_buffer_1 = require("../utility/update-buffer");
|
|
13
13
|
class UpdateRecorderBase {
|
|
@@ -21,18 +21,20 @@ class UpdateRecorderBase {
|
|
|
21
21
|
const c1 = entry.content.byteLength > 1 && entry.content.readUInt8(1);
|
|
22
22
|
const c2 = entry.content.byteLength > 2 && entry.content.readUInt8(2);
|
|
23
23
|
// Check if we're BOM.
|
|
24
|
-
if (c0 ==
|
|
24
|
+
if (c0 == 0xef && c1 == 0xbb && c2 == 0xbf) {
|
|
25
25
|
return new UpdateRecorderBom(entry);
|
|
26
26
|
}
|
|
27
|
-
else if (c0 ===
|
|
27
|
+
else if (c0 === 0xff && c1 == 0xfe) {
|
|
28
28
|
return new UpdateRecorderBom(entry);
|
|
29
29
|
}
|
|
30
|
-
else if (c0 ===
|
|
30
|
+
else if (c0 === 0xfe && c1 == 0xff) {
|
|
31
31
|
return new UpdateRecorderBom(entry);
|
|
32
32
|
}
|
|
33
33
|
return new UpdateRecorderBase(entry);
|
|
34
34
|
}
|
|
35
|
-
get path() {
|
|
35
|
+
get path() {
|
|
36
|
+
return this._path;
|
|
37
|
+
}
|
|
36
38
|
// These just record changes.
|
|
37
39
|
insertLeft(index, content) {
|
|
38
40
|
this._content.insertLeft(index, typeof content == 'string' ? Buffer.from(content) : content);
|
package/src/tree/scoped.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
1
|
/**
|
|
3
2
|
* @license
|
|
4
|
-
* Copyright Google
|
|
3
|
+
* Copyright Google LLC All Rights Reserved.
|
|
5
4
|
*
|
|
6
5
|
* Use of this source code is governed by an MIT-style license that can be
|
|
7
6
|
* found in the LICENSE file at https://angular.io/license
|
|
8
7
|
*/
|
|
8
|
+
/// <reference types="node" />
|
|
9
9
|
import { Path, PathFragment } from '@angular-devkit/core';
|
|
10
10
|
import { Action } from './action';
|
|
11
11
|
import { DirEntry, FileEntry, FileVisitor, MergeStrategy, Tree, UpdateRecorder } from './interface';
|
package/src/tree/scoped.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ScopedTree = void 0;
|
|
4
2
|
/**
|
|
5
3
|
* @license
|
|
6
|
-
* Copyright Google
|
|
4
|
+
* Copyright Google LLC All Rights Reserved.
|
|
7
5
|
*
|
|
8
6
|
* Use of this source code is governed by an MIT-style license that can be
|
|
9
7
|
* found in the LICENSE file at https://angular.io/license
|
|
10
8
|
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.ScopedTree = void 0;
|
|
11
11
|
const core_1 = require("@angular-devkit/core");
|
|
12
12
|
const delegate_1 = require("./delegate");
|
|
13
13
|
const interface_1 = require("./interface");
|
|
@@ -19,7 +19,9 @@ class ScopedFileEntry {
|
|
|
19
19
|
get path() {
|
|
20
20
|
return core_1.join(core_1.NormalizedRoot, core_1.relative(this.scope, this._base.path));
|
|
21
21
|
}
|
|
22
|
-
get content() {
|
|
22
|
+
get content() {
|
|
23
|
+
return this._base.content;
|
|
24
|
+
}
|
|
23
25
|
}
|
|
24
26
|
class ScopedDirEntry {
|
|
25
27
|
constructor(_base, scope) {
|
|
@@ -61,20 +63,29 @@ class ScopedTree {
|
|
|
61
63
|
const normalizedScope = core_1.normalize('/' + scope);
|
|
62
64
|
this._root = new ScopedDirEntry(this._base.getDir(normalizedScope), normalizedScope);
|
|
63
65
|
}
|
|
64
|
-
get root() {
|
|
65
|
-
|
|
66
|
+
get root() {
|
|
67
|
+
return this._root;
|
|
68
|
+
}
|
|
69
|
+
branch() {
|
|
70
|
+
return new ScopedTree(this._base.branch(), this._root.scope);
|
|
71
|
+
}
|
|
66
72
|
merge(other, strategy) {
|
|
73
|
+
// eslint-disable-next-line @typescript-eslint/no-this-alias
|
|
67
74
|
const self = this;
|
|
68
|
-
const delegate = new class extends delegate_1.DelegateTree {
|
|
75
|
+
const delegate = new (class extends delegate_1.DelegateTree {
|
|
69
76
|
get actions() {
|
|
70
|
-
return other.actions.map(action => self._fullPathAction(action));
|
|
77
|
+
return other.actions.map((action) => self._fullPathAction(action));
|
|
71
78
|
}
|
|
72
|
-
}(other);
|
|
79
|
+
})(other);
|
|
73
80
|
this._base.merge(delegate, strategy);
|
|
74
81
|
}
|
|
75
82
|
// Readonly.
|
|
76
|
-
read(path) {
|
|
77
|
-
|
|
83
|
+
read(path) {
|
|
84
|
+
return this._base.read(this._fullPath(path));
|
|
85
|
+
}
|
|
86
|
+
exists(path) {
|
|
87
|
+
return this._base.exists(this._fullPath(path));
|
|
88
|
+
}
|
|
78
89
|
get(path) {
|
|
79
90
|
const entry = this._base.get(this._fullPath(path));
|
|
80
91
|
return entry && new ScopedFileEntry(entry, this._root.scope);
|
|
@@ -83,7 +94,9 @@ class ScopedTree {
|
|
|
83
94
|
const entry = this._base.getDir(this._fullPath(path));
|
|
84
95
|
return entry && new ScopedDirEntry(entry, this._root.scope);
|
|
85
96
|
}
|
|
86
|
-
visit(visitor) {
|
|
97
|
+
visit(visitor) {
|
|
98
|
+
return this._root.visit(visitor);
|
|
99
|
+
}
|
|
87
100
|
// Change content of host files.
|
|
88
101
|
overwrite(path, content) {
|
|
89
102
|
return this._base.overwrite(this._fullPath(path), content);
|
|
@@ -91,12 +104,16 @@ class ScopedTree {
|
|
|
91
104
|
beginUpdate(path) {
|
|
92
105
|
return this._base.beginUpdate(this._fullPath(path));
|
|
93
106
|
}
|
|
94
|
-
commitUpdate(record) {
|
|
107
|
+
commitUpdate(record) {
|
|
108
|
+
return this._base.commitUpdate(record);
|
|
109
|
+
}
|
|
95
110
|
// Structural methods.
|
|
96
111
|
create(path, content) {
|
|
97
112
|
return this._base.create(this._fullPath(path), content);
|
|
98
113
|
}
|
|
99
|
-
delete(path) {
|
|
114
|
+
delete(path) {
|
|
115
|
+
return this._base.delete(this._fullPath(path));
|
|
116
|
+
}
|
|
100
117
|
rename(from, to) {
|
|
101
118
|
return this._base.rename(this._fullPath(from), this._fullPath(to));
|
|
102
119
|
}
|
package/src/tree/static.d.ts
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright Google LLC All Rights Reserved.
|
|
4
|
+
*
|
|
5
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
6
|
+
* found in the LICENSE file at https://angular.io/license
|
|
7
|
+
*/
|
|
1
8
|
import { HostTree } from './host-tree';
|
|
2
9
|
import { FilePredicate, MergeStrategy, Tree } from './interface';
|
|
3
10
|
export declare function empty(): HostTree;
|
package/src/tree/static.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.partition = exports.merge = exports.branch = exports.empty = void 0;
|
|
4
2
|
/**
|
|
5
3
|
* @license
|
|
6
|
-
* Copyright Google
|
|
4
|
+
* Copyright Google LLC All Rights Reserved.
|
|
7
5
|
*
|
|
8
6
|
* Use of this source code is governed by an MIT-style license that can be
|
|
9
7
|
* found in the LICENSE file at https://angular.io/license
|
|
10
8
|
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.partition = exports.merge = exports.branch = exports.empty = void 0;
|
|
11
11
|
const exception_1 = require("../exception/exception");
|
|
12
12
|
const host_tree_1 = require("./host-tree");
|
|
13
13
|
const interface_1 = require("./interface");
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/**
|
|
3
3
|
* @license
|
|
4
|
-
* Copyright Google
|
|
4
|
+
* Copyright Google LLC All Rights Reserved.
|
|
5
5
|
*
|
|
6
6
|
* Use of this source code is governed by an MIT-style license that can be
|
|
7
7
|
* found in the LICENSE file at https://angular.io/license
|
|
@@ -20,7 +20,9 @@ class LinkedList {
|
|
|
20
20
|
}
|
|
21
21
|
return c;
|
|
22
22
|
}
|
|
23
|
-
get head() {
|
|
23
|
+
get head() {
|
|
24
|
+
return this._head;
|
|
25
|
+
}
|
|
24
26
|
get length() {
|
|
25
27
|
let c = this._head;
|
|
26
28
|
let i = 0;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
1
|
/**
|
|
3
2
|
* @license
|
|
4
|
-
* Copyright Google
|
|
3
|
+
* Copyright Google LLC All Rights Reserved.
|
|
5
4
|
*
|
|
6
5
|
* Use of this source code is governed by an MIT-style license that can be
|
|
7
6
|
* found in the LICENSE file at https://angular.io/license
|
|
8
7
|
*/
|
|
8
|
+
/// <reference types="node" />
|
|
9
9
|
import { BaseException } from '@angular-devkit/core';
|
|
10
10
|
import { LinkedList } from './linked-list';
|
|
11
11
|
export declare class IndexOutOfBoundException extends BaseException {
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.UpdateBuffer = exports.Chunk = exports.ContentCannotBeRemovedException = exports.IndexOutOfBoundException = void 0;
|
|
4
2
|
/**
|
|
5
3
|
* @license
|
|
6
|
-
* Copyright Google
|
|
4
|
+
* Copyright Google LLC All Rights Reserved.
|
|
7
5
|
*
|
|
8
6
|
* Use of this source code is governed by an MIT-style license that can be
|
|
9
7
|
* found in the LICENSE file at https://angular.io/license
|
|
10
8
|
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.UpdateBuffer = exports.Chunk = exports.ContentCannotBeRemovedException = exports.IndexOutOfBoundException = void 0;
|
|
11
11
|
const core_1 = require("@angular-devkit/core");
|
|
12
12
|
const linked_list_1 = require("./linked-list");
|
|
13
13
|
class IndexOutOfBoundException extends core_1.BaseException {
|
|
@@ -42,14 +42,14 @@ class Chunk {
|
|
|
42
42
|
this._content = originalContent.slice(start, end);
|
|
43
43
|
}
|
|
44
44
|
get length() {
|
|
45
|
-
return (this._left ? this._left.length : 0)
|
|
46
|
-
|
|
47
|
-
|
|
45
|
+
return ((this._left ? this._left.length : 0) +
|
|
46
|
+
(this._content ? this._content.length : 0) +
|
|
47
|
+
(this._right ? this._right.length : 0));
|
|
48
48
|
}
|
|
49
49
|
toString(encoding = 'utf-8') {
|
|
50
|
-
return (this._left ? this._left.toString(encoding) : '')
|
|
51
|
-
|
|
52
|
-
|
|
50
|
+
return ((this._left ? this._left.toString(encoding) : '') +
|
|
51
|
+
(this._content ? this._content.toString(encoding) : '') +
|
|
52
|
+
(this._right ? this._right.toString(encoding) : ''));
|
|
53
53
|
}
|
|
54
54
|
slice(start) {
|
|
55
55
|
if (start < this.start || start > this.end) {
|
|
@@ -179,7 +179,7 @@ class UpdateBuffer {
|
|
|
179
179
|
const index = start >= this._originalContent.length ? start : this._getTextPosition(start);
|
|
180
180
|
this._assertIndex(index);
|
|
181
181
|
// Find the chunk by going through the list.
|
|
182
|
-
const h = this._linkedList.find(chunk => index <= chunk.end);
|
|
182
|
+
const h = this._linkedList.find((chunk) => index <= chunk.end);
|
|
183
183
|
if (!h) {
|
|
184
184
|
throw Error('Chunk cannot be found.');
|
|
185
185
|
}
|
|
@@ -208,7 +208,7 @@ class UpdateBuffer {
|
|
|
208
208
|
generate() {
|
|
209
209
|
const result = Buffer.allocUnsafe(this.length);
|
|
210
210
|
let i = 0;
|
|
211
|
-
this._linkedList.forEach(chunk => {
|
|
211
|
+
this._linkedList.forEach((chunk) => {
|
|
212
212
|
chunk.copy(result, i);
|
|
213
213
|
i += chunk.length;
|
|
214
214
|
});
|
package/src/workflow/base.d.ts
CHANGED
package/src/workflow/base.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.BaseWorkflow = void 0;
|
|
4
2
|
/**
|
|
5
3
|
* @license
|
|
6
|
-
* Copyright Google
|
|
4
|
+
* Copyright Google LLC All Rights Reserved.
|
|
7
5
|
*
|
|
8
6
|
* Use of this source code is governed by an MIT-style license that can be
|
|
9
7
|
* found in the LICENSE file at https://angular.io/license
|
|
10
8
|
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.BaseWorkflow = void 0;
|
|
11
11
|
const core_1 = require("@angular-devkit/core");
|
|
12
12
|
const rxjs_1 = require("rxjs");
|
|
13
13
|
const operators_1 = require("rxjs/operators");
|
|
@@ -71,9 +71,9 @@ class BaseWorkflow {
|
|
|
71
71
|
_createSinks() {
|
|
72
72
|
let error = false;
|
|
73
73
|
const dryRunSink = new dryrun_1.DryRunSink(this._host, this._force);
|
|
74
|
-
const dryRunSubscriber = dryRunSink.reporter.subscribe(event => {
|
|
74
|
+
const dryRunSubscriber = dryRunSink.reporter.subscribe((event) => {
|
|
75
75
|
this._reporter.next(event);
|
|
76
|
-
error = error ||
|
|
76
|
+
error = error || event.kind == 'error';
|
|
77
77
|
});
|
|
78
78
|
// We need two sinks if we want to output what will happen, and actually do the work.
|
|
79
79
|
return [
|
|
@@ -100,8 +100,7 @@ class BaseWorkflow {
|
|
|
100
100
|
/** Create the collection and the schematic. */
|
|
101
101
|
const collection = this._engine.createCollection(options.collection);
|
|
102
102
|
// Only allow private schematics if called from the same collection.
|
|
103
|
-
const allowPrivate = options.allowPrivate
|
|
104
|
-
|| (parentContext && parentContext.collection === options.collection);
|
|
103
|
+
const allowPrivate = options.allowPrivate || (parentContext && parentContext.collection === options.collection);
|
|
105
104
|
const schematic = collection.createSchematic(options.schematic, allowPrivate);
|
|
106
105
|
const sinks = this._createSinks();
|
|
107
106
|
this._lifeCycle.next({ kind: 'workflow-start' });
|
|
@@ -112,23 +111,28 @@ class BaseWorkflow {
|
|
|
112
111
|
parentContext,
|
|
113
112
|
};
|
|
114
113
|
this._context.push(context);
|
|
115
|
-
return schematic
|
|
114
|
+
return schematic
|
|
115
|
+
.call(options.options, rxjs_1.of(new host_tree_1.HostTree(this._host)), { logger: context.logger })
|
|
116
|
+
.pipe(operators_1.concatMap((tree) => {
|
|
116
117
|
// Process all sinks.
|
|
117
|
-
return rxjs_1.concat(rxjs_1.from(sinks).pipe(operators_1.concatMap(sink => sink.commit(tree)), operators_1.ignoreElements()), rxjs_1.of(tree));
|
|
118
|
+
return rxjs_1.concat(rxjs_1.from(sinks).pipe(operators_1.concatMap((sink) => sink.commit(tree)), operators_1.ignoreElements()), rxjs_1.of(tree));
|
|
118
119
|
}), operators_1.concatMap(() => {
|
|
119
120
|
if (this._dryRun) {
|
|
120
121
|
return rxjs_1.EMPTY;
|
|
121
122
|
}
|
|
122
123
|
this._lifeCycle.next({ kind: 'post-tasks-start' });
|
|
123
|
-
return this._engine
|
|
124
|
+
return this._engine
|
|
125
|
+
.executePostTasks()
|
|
124
126
|
.pipe(operators_1.tap({ complete: () => this._lifeCycle.next({ kind: 'post-tasks-end' }) }), operators_1.defaultIfEmpty(), operators_1.last());
|
|
125
|
-
}), operators_1.tap({
|
|
127
|
+
}), operators_1.tap({
|
|
128
|
+
complete: () => {
|
|
126
129
|
this._lifeCycle.next({ kind: 'workflow-end' });
|
|
127
130
|
this._context.pop();
|
|
128
131
|
if (this._context.length == 0) {
|
|
129
132
|
this._lifeCycle.next({ kind: 'end' });
|
|
130
133
|
}
|
|
131
|
-
}
|
|
134
|
+
},
|
|
135
|
+
}));
|
|
132
136
|
}
|
|
133
137
|
}
|
|
134
138
|
exports.BaseWorkflow = BaseWorkflow;
|
package/src/workflow/index.d.ts
CHANGED
package/src/workflow/index.js
CHANGED
|
@@ -1,4 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @license
|
|
4
|
+
* Copyright Google LLC All Rights Reserved.
|
|
5
|
+
*
|
|
6
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
7
|
+
* found in the LICENSE file at https://angular.io/license
|
|
8
|
+
*/
|
|
2
9
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
10
|
if (k2 === undefined) k2 = k;
|
|
4
11
|
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
@@ -10,12 +17,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
10
17
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
11
18
|
};
|
|
12
19
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
-
/**
|
|
14
|
-
* @license
|
|
15
|
-
* Copyright Google Inc. All Rights Reserved.
|
|
16
|
-
*
|
|
17
|
-
* Use of this source code is governed by an MIT-style license that can be
|
|
18
|
-
* found in the LICENSE file at https://angular.io/license
|
|
19
|
-
*/
|
|
20
20
|
__exportStar(require("./base"), exports);
|
|
21
21
|
__exportStar(require("./interface"), exports);
|