@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/rules/template.js
CHANGED
|
@@ -1,28 +1,34 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.applyTemplates = exports.template = exports.renameTemplateFiles = exports.pathTemplate = exports.applyPathTemplate = exports.contentTemplate = exports.applyContentTemplate = exports.InvalidPipeException = exports.UnknownPipeException = exports.OptionIsNotDefinedException = exports.TEMPLATE_FILENAME_RE = 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.applyTemplates = exports.template = exports.renameTemplateFiles = exports.pathTemplate = exports.applyPathTemplate = exports.contentTemplate = exports.applyContentTemplate = exports.InvalidPipeException = exports.UnknownPipeException = exports.OptionIsNotDefinedException = exports.TEMPLATE_FILENAME_RE = void 0;
|
|
11
11
|
const core_1 = require("@angular-devkit/core");
|
|
12
12
|
const util_1 = require("util");
|
|
13
13
|
const base_1 = require("./base");
|
|
14
14
|
const rename_1 = require("./rename");
|
|
15
15
|
exports.TEMPLATE_FILENAME_RE = /\.template$/;
|
|
16
16
|
class OptionIsNotDefinedException extends core_1.BaseException {
|
|
17
|
-
constructor(name) {
|
|
17
|
+
constructor(name) {
|
|
18
|
+
super(`Option "${name}" is not defined.`);
|
|
19
|
+
}
|
|
18
20
|
}
|
|
19
21
|
exports.OptionIsNotDefinedException = OptionIsNotDefinedException;
|
|
20
22
|
class UnknownPipeException extends core_1.BaseException {
|
|
21
|
-
constructor(name) {
|
|
23
|
+
constructor(name) {
|
|
24
|
+
super(`Pipe "${name}" is not defined.`);
|
|
25
|
+
}
|
|
22
26
|
}
|
|
23
27
|
exports.UnknownPipeException = UnknownPipeException;
|
|
24
28
|
class InvalidPipeException extends core_1.BaseException {
|
|
25
|
-
constructor(name) {
|
|
29
|
+
constructor(name) {
|
|
30
|
+
super(`Pipe "${name}" is invalid.`);
|
|
31
|
+
}
|
|
26
32
|
}
|
|
27
33
|
exports.InvalidPipeException = InvalidPipeException;
|
|
28
34
|
const decoder = new util_1.TextDecoder('utf-8', { fatal: true });
|
|
@@ -116,7 +122,7 @@ exports.pathTemplate = pathTemplate;
|
|
|
116
122
|
* Remove every `.template` suffix from file names.
|
|
117
123
|
*/
|
|
118
124
|
function renameTemplateFiles() {
|
|
119
|
-
return rename_1.rename(path => !!path.match(exports.TEMPLATE_FILENAME_RE), path => path.replace(exports.TEMPLATE_FILENAME_RE, ''));
|
|
125
|
+
return rename_1.rename((path) => !!path.match(exports.TEMPLATE_FILENAME_RE), (path) => path.replace(exports.TEMPLATE_FILENAME_RE, ''));
|
|
120
126
|
}
|
|
121
127
|
exports.renameTemplateFiles = renameTemplateFiles;
|
|
122
128
|
function template(options) {
|
|
@@ -130,11 +136,11 @@ function template(options) {
|
|
|
130
136
|
}
|
|
131
137
|
exports.template = template;
|
|
132
138
|
function applyTemplates(options) {
|
|
133
|
-
return base_1.forEach(base_1.when(path => path.endsWith('.template'), base_1.composeFileOperators([
|
|
139
|
+
return base_1.forEach(base_1.when((path) => path.endsWith('.template'), base_1.composeFileOperators([
|
|
134
140
|
applyContentTemplate(options),
|
|
135
141
|
// See above for this weird cast.
|
|
136
142
|
applyPathTemplate(options),
|
|
137
|
-
entry => {
|
|
143
|
+
(entry) => {
|
|
138
144
|
return {
|
|
139
145
|
content: entry.content,
|
|
140
146
|
path: entry.path.replace(exports.TEMPLATE_FILENAME_RE, ''),
|
package/src/rules/url.d.ts
CHANGED
|
@@ -1,2 +1,9 @@
|
|
|
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 { Source } from '../engine/interface';
|
|
2
9
|
export declare function url(urlString: string): Source;
|
package/src/rules/url.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.url = 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.url = void 0;
|
|
11
11
|
const url_1 = require("url");
|
|
12
12
|
function url(urlString) {
|
|
13
13
|
const url = url_1.parse(urlString);
|
package/src/sink/dryrun.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 { virtualFs } from '@angular-devkit/core';
|
|
10
10
|
import { Observable, Subject } from 'rxjs';
|
|
11
11
|
import { HostSink } from './host';
|
package/src/sink/dryrun.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.DryRunSink = 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.DryRunSink = void 0;
|
|
11
11
|
const core_1 = require("@angular-devkit/core");
|
|
12
12
|
const node_1 = require("@angular-devkit/core/node");
|
|
13
13
|
const rxjs_1 = require("rxjs");
|
|
@@ -29,21 +29,21 @@ class DryRunSink extends host_1.HostSink {
|
|
|
29
29
|
this._fileDoesNotExistExceptionSet.add(path);
|
|
30
30
|
}
|
|
31
31
|
_done() {
|
|
32
|
-
this._fileAlreadyExistExceptionSet.forEach(path => {
|
|
32
|
+
this._fileAlreadyExistExceptionSet.forEach((path) => {
|
|
33
33
|
this._subject.next({
|
|
34
34
|
kind: 'error',
|
|
35
35
|
description: 'alreadyExist',
|
|
36
36
|
path,
|
|
37
37
|
});
|
|
38
38
|
});
|
|
39
|
-
this._fileDoesNotExistExceptionSet.forEach(path => {
|
|
39
|
+
this._fileDoesNotExistExceptionSet.forEach((path) => {
|
|
40
40
|
this._subject.next({
|
|
41
41
|
kind: 'error',
|
|
42
42
|
description: 'doesNotExist',
|
|
43
43
|
path,
|
|
44
44
|
});
|
|
45
45
|
});
|
|
46
|
-
this._filesToDelete.forEach(path => {
|
|
46
|
+
this._filesToDelete.forEach((path) => {
|
|
47
47
|
// Check if this is a renaming.
|
|
48
48
|
for (const [from] of this._filesToRename) {
|
|
49
49
|
if (from == path) {
|
|
@@ -64,8 +64,8 @@ class DryRunSink extends host_1.HostSink {
|
|
|
64
64
|
return;
|
|
65
65
|
}
|
|
66
66
|
}
|
|
67
|
-
if (this._fileAlreadyExistExceptionSet.has(path)
|
|
68
|
-
|
|
67
|
+
if (this._fileAlreadyExistExceptionSet.has(path) ||
|
|
68
|
+
this._fileDoesNotExistExceptionSet.has(path)) {
|
|
69
69
|
return;
|
|
70
70
|
}
|
|
71
71
|
this._subject.next({ kind: 'create', path, content: content.generate() });
|
package/src/sink/host.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, virtualFs } from '@angular-devkit/core';
|
|
10
10
|
import { Observable } from 'rxjs';
|
|
11
11
|
import { CreateFileAction } from '../tree/action';
|
package/src/sink/host.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.HostSink = void 0;
|
|
4
11
|
const rxjs_1 = require("rxjs");
|
|
@@ -56,7 +63,7 @@ class HostSink extends sink_1.SimpleSinkBase {
|
|
|
56
63
|
}
|
|
57
64
|
_done() {
|
|
58
65
|
// Really commit everything to the actual filesystem.
|
|
59
|
-
return rxjs_1.concat(rxjs_1.from([...this._filesToDelete.values()]).pipe(operators_1.concatMap(path => this._host.delete(path))), rxjs_1.from([...this._filesToRename.entries()]).pipe(operators_1.concatMap(([_, [path, to]]) => this._host.rename(path, to))), rxjs_1.from([...this._filesToCreate.entries()]).pipe(operators_1.concatMap(([path, buffer]) => {
|
|
66
|
+
return rxjs_1.concat(rxjs_1.from([...this._filesToDelete.values()]).pipe(operators_1.concatMap((path) => this._host.delete(path))), rxjs_1.from([...this._filesToRename.entries()]).pipe(operators_1.concatMap(([_, [path, to]]) => this._host.rename(path, to))), rxjs_1.from([...this._filesToCreate.entries()]).pipe(operators_1.concatMap(([path, buffer]) => {
|
|
60
67
|
return this._host.write(path, buffer.generate());
|
|
61
68
|
})), rxjs_1.from([...this._filesToUpdate.entries()]).pipe(operators_1.concatMap(([path, buffer]) => {
|
|
62
69
|
return this._host.write(path, buffer.generate());
|
package/src/sink/sink.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 { Observable } from 'rxjs';
|
|
10
10
|
import { Action, CreateFileAction, DeleteFileAction, OverwriteFileAction, RenameFileAction } from '../tree/action';
|
|
11
11
|
import { Tree } from '../tree/interface';
|
package/src/sink/sink.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.SimpleSinkBase = 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.SimpleSinkBase = void 0;
|
|
11
11
|
const rxjs_1 = require("rxjs");
|
|
12
12
|
const operators_1 = require("rxjs/operators");
|
|
13
13
|
const exception_1 = require("../exception/exception");
|
|
@@ -27,41 +27,53 @@ class SimpleSinkBase {
|
|
|
27
27
|
throw new exception_1.FileDoesNotExistException(path);
|
|
28
28
|
}
|
|
29
29
|
_validateOverwriteAction(action) {
|
|
30
|
-
return this._validateFileExists(action.path)
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
30
|
+
return this._validateFileExists(action.path).pipe(operators_1.map((b) => {
|
|
31
|
+
if (!b) {
|
|
32
|
+
this._fileDoesNotExistException(action.path);
|
|
33
|
+
}
|
|
34
|
+
}));
|
|
34
35
|
}
|
|
35
36
|
_validateCreateAction(action) {
|
|
36
|
-
return this._validateFileExists(action.path)
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
37
|
+
return this._validateFileExists(action.path).pipe(operators_1.map((b) => {
|
|
38
|
+
if (b) {
|
|
39
|
+
this._fileAlreadyExistException(action.path);
|
|
40
|
+
}
|
|
41
|
+
}));
|
|
40
42
|
}
|
|
41
43
|
_validateRenameAction(action) {
|
|
42
|
-
return this._validateFileExists(action.path).pipe(operators_1.map(b => {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
}
|
|
44
|
+
return this._validateFileExists(action.path).pipe(operators_1.map((b) => {
|
|
45
|
+
if (!b) {
|
|
46
|
+
this._fileDoesNotExistException(action.path);
|
|
47
|
+
}
|
|
48
|
+
}), operators_1.mergeMap(() => this._validateFileExists(action.to)), operators_1.map((b) => {
|
|
49
|
+
if (b) {
|
|
50
|
+
this._fileAlreadyExistException(action.to);
|
|
51
|
+
}
|
|
52
|
+
}));
|
|
47
53
|
}
|
|
48
54
|
_validateDeleteAction(action) {
|
|
49
|
-
return this._validateFileExists(action.path)
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
55
|
+
return this._validateFileExists(action.path).pipe(operators_1.map((b) => {
|
|
56
|
+
if (!b) {
|
|
57
|
+
this._fileDoesNotExistException(action.path);
|
|
58
|
+
}
|
|
59
|
+
}));
|
|
53
60
|
}
|
|
54
61
|
validateSingleAction(action) {
|
|
55
62
|
switch (action.kind) {
|
|
56
|
-
case 'o':
|
|
57
|
-
|
|
58
|
-
case '
|
|
59
|
-
|
|
60
|
-
|
|
63
|
+
case 'o':
|
|
64
|
+
return this._validateOverwriteAction(action);
|
|
65
|
+
case 'c':
|
|
66
|
+
return this._validateCreateAction(action);
|
|
67
|
+
case 'r':
|
|
68
|
+
return this._validateRenameAction(action);
|
|
69
|
+
case 'd':
|
|
70
|
+
return this._validateDeleteAction(action);
|
|
71
|
+
default:
|
|
72
|
+
throw new action_1.UnknownActionException(action);
|
|
61
73
|
}
|
|
62
74
|
}
|
|
63
75
|
commitSingleAction(action) {
|
|
64
|
-
return rxjs_1.concat(this.validateSingleAction(action), new rxjs_1.Observable(observer => {
|
|
76
|
+
return rxjs_1.concat(this.validateSingleAction(action), new rxjs_1.Observable((observer) => {
|
|
65
77
|
let committed = null;
|
|
66
78
|
switch (action.kind) {
|
|
67
79
|
case 'o':
|
|
@@ -87,15 +99,15 @@ class SimpleSinkBase {
|
|
|
87
99
|
}
|
|
88
100
|
commit(tree) {
|
|
89
101
|
const actions = rxjs_1.from(tree.actions);
|
|
90
|
-
return rxjs_1.concat(
|
|
102
|
+
return rxjs_1.concat(this.preCommit() || rxjs_1.of(null), rxjs_1.defer(() => actions).pipe(operators_1.concatMap((action) => {
|
|
91
103
|
const maybeAction = this.preCommitAction(action);
|
|
92
104
|
if (rxjs_1.isObservable(maybeAction) || isPromiseLike(maybeAction)) {
|
|
93
105
|
return maybeAction;
|
|
94
106
|
}
|
|
95
107
|
return rxjs_1.of(maybeAction || action);
|
|
96
|
-
}), operators_1.concatMap(action => {
|
|
108
|
+
}), operators_1.concatMap((action) => {
|
|
97
109
|
return rxjs_1.concat(this.commitSingleAction(action).pipe(operators_1.ignoreElements()), rxjs_1.of(action));
|
|
98
|
-
}), operators_1.concatMap(action => this.postCommitAction(action) || rxjs_1.of(null))), rxjs_1.defer(() => this._done()), rxjs_1.defer(() => this.postCommit() || rxjs_1.of(null))).pipe(operators_1.ignoreElements());
|
|
110
|
+
}), operators_1.concatMap((action) => this.postCommitAction(action) || rxjs_1.of(null))), rxjs_1.defer(() => this._done()), rxjs_1.defer(() => this.postCommit() || rxjs_1.of(null))).pipe(operators_1.ignoreElements());
|
|
99
111
|
}
|
|
100
112
|
}
|
|
101
113
|
exports.SimpleSinkBase = SimpleSinkBase;
|
package/src/tree/action.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 } from '@angular-devkit/core';
|
|
10
10
|
export declare class UnknownActionException extends BaseException {
|
|
11
11
|
constructor(action: Action);
|
package/src/tree/action.js
CHANGED
|
@@ -1,16 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isAction = exports.isContentAction = exports.ActionList = exports.UnknownActionException = 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.isAction = exports.isContentAction = exports.ActionList = exports.UnknownActionException = void 0;
|
|
11
11
|
const core_1 = require("@angular-devkit/core");
|
|
12
12
|
class UnknownActionException extends core_1.BaseException {
|
|
13
|
-
constructor(action) {
|
|
13
|
+
constructor(action) {
|
|
14
|
+
super(`Unknown action: "${action.kind}".`);
|
|
15
|
+
}
|
|
14
16
|
}
|
|
15
17
|
exports.UnknownActionException = UnknownActionException;
|
|
16
18
|
let _id = 1;
|
|
@@ -87,7 +89,7 @@ class ActionList {
|
|
|
87
89
|
}
|
|
88
90
|
}
|
|
89
91
|
this._actions = [];
|
|
90
|
-
toDelete.forEach(x => {
|
|
92
|
+
toDelete.forEach((x) => {
|
|
91
93
|
this.delete(x);
|
|
92
94
|
});
|
|
93
95
|
toRename.forEach((to, from) => {
|
|
@@ -100,8 +102,12 @@ class ActionList {
|
|
|
100
102
|
this.overwrite(path, content);
|
|
101
103
|
});
|
|
102
104
|
}
|
|
103
|
-
push(action) {
|
|
104
|
-
|
|
105
|
+
push(action) {
|
|
106
|
+
this._actions.push(action);
|
|
107
|
+
}
|
|
108
|
+
get(i) {
|
|
109
|
+
return this._actions[i];
|
|
110
|
+
}
|
|
105
111
|
has(action) {
|
|
106
112
|
for (let i = 0; i < this._actions.length; i++) {
|
|
107
113
|
const a = this._actions[i];
|
|
@@ -120,8 +126,12 @@ class ActionList {
|
|
|
120
126
|
forEach(fn, thisArg) {
|
|
121
127
|
this._actions.forEach(fn, thisArg);
|
|
122
128
|
}
|
|
123
|
-
get length() {
|
|
124
|
-
|
|
129
|
+
get length() {
|
|
130
|
+
return this._actions.length;
|
|
131
|
+
}
|
|
132
|
+
[Symbol.iterator]() {
|
|
133
|
+
return this._actions[Symbol.iterator]();
|
|
134
|
+
}
|
|
125
135
|
}
|
|
126
136
|
exports.ActionList = ActionList;
|
|
127
137
|
function isContentAction(action) {
|
|
@@ -131,11 +141,12 @@ exports.isContentAction = isContentAction;
|
|
|
131
141
|
/**
|
|
132
142
|
* @deprecated since version 11.0. not used anymore can be removed in future version.
|
|
133
143
|
*/
|
|
144
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
134
145
|
function isAction(action) {
|
|
135
146
|
const kind = action && action.kind;
|
|
136
|
-
return action !== null
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
147
|
+
return (action !== null &&
|
|
148
|
+
typeof action.id == 'number' &&
|
|
149
|
+
typeof action.path == 'string' &&
|
|
150
|
+
(kind == 'c' || kind == 'o' || kind == 'r' || kind == 'd'));
|
|
140
151
|
}
|
|
141
152
|
exports.isAction = isAction;
|
package/src/tree/delegate.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 { Action } from './action';
|
|
10
10
|
import { DirEntry, FileEntry, FileVisitor, MergeStrategy, Tree, UpdateRecorder } from './interface';
|
|
11
11
|
export declare class DelegateTree implements Tree {
|
package/src/tree/delegate.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.DelegateTree = void 0;
|
|
4
11
|
const interface_1 = require("./interface");
|
|
@@ -6,31 +13,57 @@ class DelegateTree {
|
|
|
6
13
|
constructor(_other) {
|
|
7
14
|
this._other = _other;
|
|
8
15
|
}
|
|
9
|
-
branch() {
|
|
10
|
-
|
|
11
|
-
|
|
16
|
+
branch() {
|
|
17
|
+
return this._other.branch();
|
|
18
|
+
}
|
|
19
|
+
merge(other, strategy) {
|
|
20
|
+
this._other.merge(other, strategy);
|
|
21
|
+
}
|
|
22
|
+
get root() {
|
|
23
|
+
return this._other.root;
|
|
24
|
+
}
|
|
12
25
|
// Readonly.
|
|
13
|
-
read(path) {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
26
|
+
read(path) {
|
|
27
|
+
return this._other.read(path);
|
|
28
|
+
}
|
|
29
|
+
exists(path) {
|
|
30
|
+
return this._other.exists(path);
|
|
31
|
+
}
|
|
32
|
+
get(path) {
|
|
33
|
+
return this._other.get(path);
|
|
34
|
+
}
|
|
35
|
+
getDir(path) {
|
|
36
|
+
return this._other.getDir(path);
|
|
37
|
+
}
|
|
38
|
+
visit(visitor) {
|
|
39
|
+
return this._other.visit(visitor);
|
|
40
|
+
}
|
|
18
41
|
// Change content of host files.
|
|
19
42
|
overwrite(path, content) {
|
|
20
43
|
return this._other.overwrite(path, content);
|
|
21
44
|
}
|
|
22
|
-
beginUpdate(path) {
|
|
23
|
-
|
|
45
|
+
beginUpdate(path) {
|
|
46
|
+
return this._other.beginUpdate(path);
|
|
47
|
+
}
|
|
48
|
+
commitUpdate(record) {
|
|
49
|
+
return this._other.commitUpdate(record);
|
|
50
|
+
}
|
|
24
51
|
// Structural methods.
|
|
25
52
|
create(path, content) {
|
|
26
53
|
return this._other.create(path, content);
|
|
27
54
|
}
|
|
28
|
-
delete(path) {
|
|
29
|
-
|
|
55
|
+
delete(path) {
|
|
56
|
+
return this._other.delete(path);
|
|
57
|
+
}
|
|
58
|
+
rename(from, to) {
|
|
59
|
+
return this._other.rename(from, to);
|
|
60
|
+
}
|
|
30
61
|
apply(action, strategy) {
|
|
31
62
|
return this._other.apply(action, strategy);
|
|
32
63
|
}
|
|
33
|
-
get actions() {
|
|
64
|
+
get actions() {
|
|
65
|
+
return this._other.actions;
|
|
66
|
+
}
|
|
34
67
|
[interface_1.TreeSymbol]() {
|
|
35
68
|
return this;
|
|
36
69
|
}
|
package/src/tree/empty.d.ts
CHANGED
package/src/tree/empty.js
CHANGED
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.EmptyTree = 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.EmptyTree = void 0;
|
|
11
11
|
const host_tree_1 = require("./host-tree");
|
|
12
12
|
class EmptyTree extends host_tree_1.HostTree {
|
|
13
|
-
constructor() {
|
|
13
|
+
constructor() {
|
|
14
|
+
super();
|
|
15
|
+
}
|
|
14
16
|
}
|
|
15
17
|
exports.EmptyTree = EmptyTree;
|
package/src/tree/entry.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 } from '@angular-devkit/core';
|
|
10
10
|
import { FileEntry } from './interface';
|
|
11
11
|
export declare class SimpleFileEntry implements FileEntry {
|
package/src/tree/entry.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.LazyFileEntry = exports.SimpleFileEntry = void 0;
|
|
4
11
|
class SimpleFileEntry {
|
|
@@ -6,8 +13,12 @@ class SimpleFileEntry {
|
|
|
6
13
|
this._path = _path;
|
|
7
14
|
this._content = _content;
|
|
8
15
|
}
|
|
9
|
-
get path() {
|
|
10
|
-
|
|
16
|
+
get path() {
|
|
17
|
+
return this._path;
|
|
18
|
+
}
|
|
19
|
+
get content() {
|
|
20
|
+
return this._content;
|
|
21
|
+
}
|
|
11
22
|
}
|
|
12
23
|
exports.SimpleFileEntry = SimpleFileEntry;
|
|
13
24
|
class LazyFileEntry {
|
|
@@ -16,7 +27,11 @@ class LazyFileEntry {
|
|
|
16
27
|
this._load = _load;
|
|
17
28
|
this._content = null;
|
|
18
29
|
}
|
|
19
|
-
get path() {
|
|
20
|
-
|
|
30
|
+
get path() {
|
|
31
|
+
return this._path;
|
|
32
|
+
}
|
|
33
|
+
get content() {
|
|
34
|
+
return this._content || (this._content = this._load(this._path));
|
|
35
|
+
}
|
|
21
36
|
}
|
|
22
37
|
exports.LazyFileEntry = LazyFileEntry;
|
package/src/tree/host-tree.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, virtualFs } from '@angular-devkit/core';
|
|
10
10
|
import { Action } from './action';
|
|
11
11
|
import { DirEntry, FileEntry, FilePredicate, FileVisitor, MergeStrategy, Tree, UpdateRecorder } from './interface';
|