@angular-devkit/core 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 +36 -34
- package/node/_golden-api.d.ts +1 -1
- package/node/_golden-api.js +1 -1
- package/node/cli-logger.d.ts +7 -0
- package/node/cli-logger.js +4 -6
- package/node/experimental/index.d.ts +2 -2
- package/node/experimental/index.js +3 -3
- package/node/experimental/jobs/index.d.ts +1 -1
- package/node/experimental/jobs/index.js +7 -7
- package/node/experimental/jobs/job-registry.d.ts +1 -1
- package/node/experimental/jobs/job-registry.js +4 -4
- package/node/fs.d.ts +7 -0
- package/node/fs.js +3 -3
- package/node/host.d.ts +2 -2
- package/node/host.js +31 -33
- package/node/index.d.ts +2 -2
- package/node/index.js +1 -1
- package/node/testing/index.d.ts +2 -2
- package/node/testing/index.js +8 -5
- package/package.json +3 -3
- package/src/_golden-api.d.ts +1 -1
- package/src/_golden-api.js +1 -1
- package/src/analytics/api.d.ts +1 -1
- package/src/analytics/api.js +7 -0
- package/src/analytics/forwarder.d.ts +1 -1
- package/src/analytics/forwarder.js +7 -0
- package/src/analytics/index.d.ts +1 -1
- package/src/analytics/index.js +7 -7
- package/src/analytics/logging.d.ts +1 -1
- package/src/analytics/logging.js +7 -0
- package/src/analytics/multi.d.ts +1 -1
- package/src/analytics/multi.js +6 -6
- package/src/analytics/noop.d.ts +1 -1
- package/src/analytics/noop.js +10 -1
- package/src/exception/exception.d.ts +1 -1
- package/src/exception/exception.js +25 -9
- package/src/exception/index.d.ts +1 -1
- package/src/exception/index.js +1 -1
- package/src/experimental/jobs/README.md +133 -112
- package/src/experimental/jobs/api.d.ts +1 -1
- package/src/experimental/jobs/api.js +8 -3
- package/src/experimental/jobs/architecture.md +43 -38
- package/src/experimental/jobs/create-job-handler.d.ts +1 -2
- package/src/experimental/jobs/create-job-handler.js +17 -14
- package/src/experimental/jobs/dispatcher.d.ts +1 -2
- package/src/experimental/jobs/dispatcher.js +7 -0
- package/src/experimental/jobs/exception.d.ts +1 -1
- package/src/experimental/jobs/exception.js +3 -3
- package/src/experimental/jobs/fallback-registry.d.ts +1 -1
- package/src/experimental/jobs/fallback-registry.js +4 -4
- package/src/experimental/jobs/index.d.ts +1 -1
- package/src/experimental/jobs/index.js +7 -7
- package/src/experimental/jobs/simple-registry.d.ts +1 -1
- package/src/experimental/jobs/simple-registry.js +6 -4
- package/src/experimental/jobs/simple-scheduler.d.ts +1 -1
- package/src/experimental/jobs/simple-scheduler.js +38 -29
- package/src/experimental/jobs/strategy.d.ts +7 -0
- package/src/experimental/jobs/strategy.js +10 -9
- package/src/experimental.d.ts +2 -2
- package/src/experimental.js +3 -3
- package/src/index.d.ts +2 -2
- package/src/index.js +7 -7
- package/src/json/index.d.ts +2 -2
- package/src/json/index.js +9 -9
- package/src/json/interface.d.ts +1 -1
- package/src/json/interface.js +7 -0
- package/src/json/parser.d.ts +1 -1
- package/src/json/parser.js +39 -22
- package/src/json/schema/index.d.ts +2 -2
- package/src/json/schema/index.js +9 -9
- package/src/json/schema/interface.d.ts +1 -1
- package/src/json/schema/interface.js +7 -0
- package/src/json/schema/pointer.d.ts +1 -1
- package/src/json/schema/pointer.js +17 -5
- package/src/json/schema/registry.d.ts +1 -1
- package/src/json/schema/registry.js +28 -47
- package/src/json/schema/schema.d.ts +1 -1
- package/src/json/schema/schema.js +3 -3
- package/src/json/schema/transforms.d.ts +1 -1
- package/src/json/schema/transforms.js +14 -13
- package/src/json/schema/utility.d.ts +7 -0
- package/src/json/schema/utility.js +7 -7
- package/src/json/schema/visitor.d.ts +1 -1
- package/src/json/schema/visitor.js +8 -7
- package/src/logger/indent.d.ts +7 -0
- package/src/logger/indent.js +5 -5
- package/src/logger/index.d.ts +1 -1
- package/src/logger/index.js +7 -7
- package/src/logger/level.d.ts +1 -1
- package/src/logger/level.js +7 -0
- package/src/logger/logger.d.ts +1 -1
- package/src/logger/logger.js +13 -6
- package/src/logger/null-logger.d.ts +7 -0
- package/src/logger/null-logger.js +3 -3
- package/src/logger/transform-logger.d.ts +1 -1
- package/src/logger/transform-logger.js +7 -0
- package/src/utils/array.d.ts +1 -1
- package/src/utils/array.js +2 -2
- package/src/utils/index.d.ts +1 -1
- package/src/utils/index.js +7 -7
- package/src/utils/lang.d.ts +1 -1
- package/src/utils/lang.js +3 -3
- package/src/utils/literals.d.ts +1 -1
- package/src/utils/literals.js +15 -8
- package/src/utils/object.d.ts +1 -1
- package/src/utils/object.js +3 -3
- package/src/utils/partially-ordered-set.d.ts +2 -2
- package/src/utils/partially-ordered-set.js +12 -8
- package/src/utils/priority-queue.d.ts +1 -1
- package/src/utils/priority-queue.js +2 -2
- package/src/utils/strings.d.ts +7 -0
- package/src/utils/strings.js +12 -9
- package/src/utils/template.d.ts +1 -1
- package/src/utils/template.js +24 -30
- package/src/virtual-fs/host/alias.d.ts +1 -1
- package/src/virtual-fs/host/alias.js +7 -5
- package/src/virtual-fs/host/buffer.d.ts +1 -1
- package/src/virtual-fs/host/buffer.js +7 -0
- package/src/virtual-fs/host/create.d.ts +7 -0
- package/src/virtual-fs/host/create.js +3 -3
- package/src/virtual-fs/host/empty.d.ts +1 -1
- package/src/virtual-fs/host/empty.js +3 -3
- package/src/virtual-fs/host/index.d.ts +1 -1
- package/src/virtual-fs/host/index.js +1 -1
- package/src/virtual-fs/host/interface.d.ts +1 -1
- package/src/virtual-fs/host/interface.js +7 -0
- package/src/virtual-fs/host/memory.d.ts +1 -1
- package/src/virtual-fs/host/memory.js +32 -20
- package/src/virtual-fs/host/pattern.d.ts +1 -1
- package/src/virtual-fs/host/pattern.js +17 -8
- package/src/virtual-fs/host/record.d.ts +1 -1
- package/src/virtual-fs/host/record.js +45 -28
- package/src/virtual-fs/host/resolver.d.ts +1 -1
- package/src/virtual-fs/host/resolver.js +10 -1
- package/src/virtual-fs/host/safe.d.ts +1 -1
- package/src/virtual-fs/host/safe.js +3 -3
- package/src/virtual-fs/host/scoped.d.ts +1 -1
- package/src/virtual-fs/host/scoped.js +3 -3
- package/src/virtual-fs/host/sync.d.ts +1 -1
- package/src/virtual-fs/host/sync.js +12 -3
- package/src/virtual-fs/host/test.d.ts +1 -1
- package/src/virtual-fs/host/test.js +11 -2
- package/src/virtual-fs/index.d.ts +2 -2
- package/src/virtual-fs/index.js +8 -8
- package/src/virtual-fs/path.d.ts +1 -1
- package/src/virtual-fs/path.js +17 -8
- package/src/workspace/core.d.ts +7 -0
- package/src/workspace/core.js +3 -3
- package/src/workspace/definitions.d.ts +1 -1
- package/src/workspace/definitions.js +7 -0
- package/src/workspace/host.d.ts +1 -1
- package/src/workspace/host.js +3 -3
- package/src/workspace/index.d.ts +1 -1
- package/src/workspace/index.js +7 -7
- package/src/workspace/json/metadata.d.ts +1 -1
- package/src/workspace/json/metadata.js +8 -1
- package/src/workspace/json/reader.d.ts +7 -0
- package/src/workspace/json/reader.js +4 -4
- package/src/workspace/json/utilities.d.ts +1 -1
- package/src/workspace/json/utilities.js +12 -5
- package/src/workspace/json/writer.d.ts +7 -0
- package/src/workspace/json/writer.js +4 -4
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.SimpleMemoryHost = 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.SimpleMemoryHost = void 0;
|
|
11
11
|
const rxjs_1 = require("rxjs");
|
|
12
12
|
const exception_1 = require("../../exception");
|
|
13
13
|
const path_1 = require("../path");
|
|
@@ -19,9 +19,15 @@ class SimpleMemoryHost {
|
|
|
19
19
|
}
|
|
20
20
|
_newDirStats() {
|
|
21
21
|
return {
|
|
22
|
-
inspect() {
|
|
23
|
-
|
|
24
|
-
|
|
22
|
+
inspect() {
|
|
23
|
+
return '<Directory>';
|
|
24
|
+
},
|
|
25
|
+
isFile() {
|
|
26
|
+
return false;
|
|
27
|
+
},
|
|
28
|
+
isDirectory() {
|
|
29
|
+
return true;
|
|
30
|
+
},
|
|
25
31
|
size: 0,
|
|
26
32
|
atime: new Date(),
|
|
27
33
|
ctime: new Date(),
|
|
@@ -32,9 +38,15 @@ class SimpleMemoryHost {
|
|
|
32
38
|
}
|
|
33
39
|
_newFileStats(content, oldStats) {
|
|
34
40
|
return {
|
|
35
|
-
inspect() {
|
|
36
|
-
|
|
37
|
-
|
|
41
|
+
inspect() {
|
|
42
|
+
return `<File size(${content.byteLength})>`;
|
|
43
|
+
},
|
|
44
|
+
isFile() {
|
|
45
|
+
return true;
|
|
46
|
+
},
|
|
47
|
+
isDirectory() {
|
|
48
|
+
return false;
|
|
49
|
+
},
|
|
38
50
|
size: content.byteLength,
|
|
39
51
|
atime: oldStats ? oldStats.atime : new Date(),
|
|
40
52
|
ctime: new Date(),
|
|
@@ -56,7 +68,7 @@ class SimpleMemoryHost {
|
|
|
56
68
|
}
|
|
57
69
|
const maybeWatcher = this._watchers.get(currentPath);
|
|
58
70
|
if (maybeWatcher) {
|
|
59
|
-
maybeWatcher.forEach(watcher => {
|
|
71
|
+
maybeWatcher.forEach((watcher) => {
|
|
60
72
|
const [options, subject] = watcher;
|
|
61
73
|
subject.next({ path, time, type });
|
|
62
74
|
if (!options.persistent && type == 2 /* Deleted */) {
|
|
@@ -70,7 +82,7 @@ class SimpleMemoryHost {
|
|
|
70
82
|
parent = path_1.dirname(currentPath);
|
|
71
83
|
const maybeWatcher = this._watchers.get(currentPath);
|
|
72
84
|
if (maybeWatcher) {
|
|
73
|
-
maybeWatcher.forEach(watcher => {
|
|
85
|
+
maybeWatcher.forEach((watcher) => {
|
|
74
86
|
const [options, subject] = watcher;
|
|
75
87
|
if (!options.recursive) {
|
|
76
88
|
return;
|
|
@@ -249,60 +261,60 @@ class SimpleMemoryHost {
|
|
|
249
261
|
return subject.asObservable();
|
|
250
262
|
}
|
|
251
263
|
write(path, content) {
|
|
252
|
-
return new rxjs_1.Observable(obs => {
|
|
264
|
+
return new rxjs_1.Observable((obs) => {
|
|
253
265
|
this._write(path, content);
|
|
254
266
|
obs.next();
|
|
255
267
|
obs.complete();
|
|
256
268
|
});
|
|
257
269
|
}
|
|
258
270
|
read(path) {
|
|
259
|
-
return new rxjs_1.Observable(obs => {
|
|
271
|
+
return new rxjs_1.Observable((obs) => {
|
|
260
272
|
const content = this._read(path);
|
|
261
273
|
obs.next(content);
|
|
262
274
|
obs.complete();
|
|
263
275
|
});
|
|
264
276
|
}
|
|
265
277
|
delete(path) {
|
|
266
|
-
return new rxjs_1.Observable(obs => {
|
|
278
|
+
return new rxjs_1.Observable((obs) => {
|
|
267
279
|
this._delete(path);
|
|
268
280
|
obs.next();
|
|
269
281
|
obs.complete();
|
|
270
282
|
});
|
|
271
283
|
}
|
|
272
284
|
rename(from, to) {
|
|
273
|
-
return new rxjs_1.Observable(obs => {
|
|
285
|
+
return new rxjs_1.Observable((obs) => {
|
|
274
286
|
this._rename(from, to);
|
|
275
287
|
obs.next();
|
|
276
288
|
obs.complete();
|
|
277
289
|
});
|
|
278
290
|
}
|
|
279
291
|
list(path) {
|
|
280
|
-
return new rxjs_1.Observable(obs => {
|
|
292
|
+
return new rxjs_1.Observable((obs) => {
|
|
281
293
|
obs.next(this._list(path));
|
|
282
294
|
obs.complete();
|
|
283
295
|
});
|
|
284
296
|
}
|
|
285
297
|
exists(path) {
|
|
286
|
-
return new rxjs_1.Observable(obs => {
|
|
298
|
+
return new rxjs_1.Observable((obs) => {
|
|
287
299
|
obs.next(this._exists(path));
|
|
288
300
|
obs.complete();
|
|
289
301
|
});
|
|
290
302
|
}
|
|
291
303
|
isDirectory(path) {
|
|
292
|
-
return new rxjs_1.Observable(obs => {
|
|
304
|
+
return new rxjs_1.Observable((obs) => {
|
|
293
305
|
obs.next(this._isDirectory(path));
|
|
294
306
|
obs.complete();
|
|
295
307
|
});
|
|
296
308
|
}
|
|
297
309
|
isFile(path) {
|
|
298
|
-
return new rxjs_1.Observable(obs => {
|
|
310
|
+
return new rxjs_1.Observable((obs) => {
|
|
299
311
|
obs.next(this._isFile(path));
|
|
300
312
|
obs.complete();
|
|
301
313
|
});
|
|
302
314
|
}
|
|
303
315
|
// Some hosts may not support stat.
|
|
304
316
|
stat(path) {
|
|
305
|
-
return new rxjs_1.Observable(obs => {
|
|
317
|
+
return new rxjs_1.Observable((obs) => {
|
|
306
318
|
obs.next(this._stat(path));
|
|
307
319
|
obs.complete();
|
|
308
320
|
});
|
|
@@ -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.PatternMatchingHost = void 0;
|
|
4
11
|
const resolver_1 = require("./resolver");
|
|
@@ -11,17 +18,19 @@ class PatternMatchingHost extends resolver_1.ResolverHost {
|
|
|
11
18
|
}
|
|
12
19
|
addPattern(pattern, replacementFn) {
|
|
13
20
|
// Simple GLOB pattern replacement.
|
|
14
|
-
const reString = '^('
|
|
15
|
-
|
|
16
|
-
.map(ex => '('
|
|
17
|
-
|
|
21
|
+
const reString = '^(' +
|
|
22
|
+
(Array.isArray(pattern) ? pattern : [pattern])
|
|
23
|
+
.map((ex) => '(' +
|
|
24
|
+
ex
|
|
25
|
+
.split(/[\/\\]/g)
|
|
26
|
+
.map((f) => f
|
|
18
27
|
.replace(/[\-\[\]{}()+?.^$|]/g, '\\$&')
|
|
19
28
|
.replace(/^\*\*/g, '(.+?)?')
|
|
20
29
|
.replace(/\*/g, '[^/\\\\]*'))
|
|
21
|
-
.join('[
|
|
22
|
-
|
|
23
|
-
.join('|')
|
|
24
|
-
|
|
30
|
+
.join('[/\\\\]') +
|
|
31
|
+
')')
|
|
32
|
+
.join('|') +
|
|
33
|
+
')($|/|\\\\)';
|
|
25
34
|
this._patterns.set(new RegExp(reString), replacementFn);
|
|
26
35
|
}
|
|
27
36
|
_resolve(path) {
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.CordHost = 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.CordHost = void 0;
|
|
11
11
|
const rxjs_1 = require("rxjs");
|
|
12
12
|
const operators_1 = require("rxjs/operators");
|
|
13
13
|
const exception_1 = require("../../exception");
|
|
@@ -32,7 +32,9 @@ class CordHost extends memory_1.SimpleMemoryHost {
|
|
|
32
32
|
this._filesToDelete = new Set();
|
|
33
33
|
this._filesToOverwrite = new Set();
|
|
34
34
|
}
|
|
35
|
-
get backend() {
|
|
35
|
+
get backend() {
|
|
36
|
+
return this._back;
|
|
37
|
+
}
|
|
36
38
|
get capabilities() {
|
|
37
39
|
// Our own host is always Synchronous, but the backend might not be.
|
|
38
40
|
return {
|
|
@@ -64,12 +66,14 @@ class CordHost extends memory_1.SimpleMemoryHost {
|
|
|
64
66
|
*/
|
|
65
67
|
commit(host, force = false) {
|
|
66
68
|
// Really commit everything to the actual host.
|
|
67
|
-
return rxjs_1.from(this.records()).pipe(operators_1.concatMap(record => {
|
|
69
|
+
return rxjs_1.from(this.records()).pipe(operators_1.concatMap((record) => {
|
|
68
70
|
switch (record.kind) {
|
|
69
|
-
case 'delete':
|
|
70
|
-
|
|
71
|
+
case 'delete':
|
|
72
|
+
return host.delete(record.path);
|
|
73
|
+
case 'rename':
|
|
74
|
+
return host.rename(record.from, record.to);
|
|
71
75
|
case 'create':
|
|
72
|
-
return host.exists(record.path).pipe(operators_1.switchMap(exists => {
|
|
76
|
+
return host.exists(record.path).pipe(operators_1.switchMap((exists) => {
|
|
73
77
|
if (exists && !force) {
|
|
74
78
|
return rxjs_1.throwError(new exception_1.FileAlreadyExistException(record.path));
|
|
75
79
|
}
|
|
@@ -78,7 +82,7 @@ class CordHost extends memory_1.SimpleMemoryHost {
|
|
|
78
82
|
}
|
|
79
83
|
}));
|
|
80
84
|
case 'overwrite':
|
|
81
|
-
return host.exists(record.path).pipe(operators_1.switchMap(exists => {
|
|
85
|
+
return host.exists(record.path).pipe(operators_1.switchMap((exists) => {
|
|
82
86
|
if (!exists && !force) {
|
|
83
87
|
return rxjs_1.throwError(new exception_1.FileDoesNotExistException(record.path));
|
|
84
88
|
}
|
|
@@ -91,17 +95,24 @@ class CordHost extends memory_1.SimpleMemoryHost {
|
|
|
91
95
|
}
|
|
92
96
|
records() {
|
|
93
97
|
return [
|
|
94
|
-
...[...this._filesToDelete.values()].map(path => ({
|
|
95
|
-
kind: 'delete',
|
|
98
|
+
...[...this._filesToDelete.values()].map((path) => ({
|
|
99
|
+
kind: 'delete',
|
|
100
|
+
path,
|
|
96
101
|
})),
|
|
97
102
|
...[...this._filesToRename.entries()].map(([from, to]) => ({
|
|
98
|
-
kind: 'rename',
|
|
103
|
+
kind: 'rename',
|
|
104
|
+
from,
|
|
105
|
+
to,
|
|
99
106
|
})),
|
|
100
|
-
...[...this._filesToCreate.values()].map(path => ({
|
|
101
|
-
kind: 'create',
|
|
107
|
+
...[...this._filesToCreate.values()].map((path) => ({
|
|
108
|
+
kind: 'create',
|
|
109
|
+
path,
|
|
110
|
+
content: this._read(path),
|
|
102
111
|
})),
|
|
103
|
-
...[...this._filesToOverwrite.values()].map(path => ({
|
|
104
|
-
kind: 'overwrite',
|
|
112
|
+
...[...this._filesToOverwrite.values()].map((path) => ({
|
|
113
|
+
kind: 'overwrite',
|
|
114
|
+
path,
|
|
115
|
+
content: this._read(path),
|
|
105
116
|
})),
|
|
106
117
|
];
|
|
107
118
|
}
|
|
@@ -126,12 +137,12 @@ class CordHost extends memory_1.SimpleMemoryHost {
|
|
|
126
137
|
return super.write(path, content);
|
|
127
138
|
}
|
|
128
139
|
overwrite(path, content) {
|
|
129
|
-
return this.isDirectory(path).pipe(operators_1.switchMap(isDir => {
|
|
140
|
+
return this.isDirectory(path).pipe(operators_1.switchMap((isDir) => {
|
|
130
141
|
if (isDir) {
|
|
131
142
|
return rxjs_1.throwError(new exception_1.PathIsDirectoryException(path));
|
|
132
143
|
}
|
|
133
144
|
return this.exists(path);
|
|
134
|
-
}), operators_1.switchMap(exists => {
|
|
145
|
+
}), operators_1.switchMap((exists) => {
|
|
135
146
|
if (!exists) {
|
|
136
147
|
return rxjs_1.throwError(new exception_1.FileDoesNotExistException(path));
|
|
137
148
|
}
|
|
@@ -142,7 +153,7 @@ class CordHost extends memory_1.SimpleMemoryHost {
|
|
|
142
153
|
}));
|
|
143
154
|
}
|
|
144
155
|
write(path, content) {
|
|
145
|
-
return this.exists(path).pipe(operators_1.switchMap(exists => {
|
|
156
|
+
return this.exists(path).pipe(operators_1.switchMap((exists) => {
|
|
146
157
|
if (exists) {
|
|
147
158
|
// It exists, but might be being renamed or deleted. In that case we want to create it.
|
|
148
159
|
if (this.willRename(path) || this.willDelete(path)) {
|
|
@@ -186,7 +197,7 @@ class CordHost extends memory_1.SimpleMemoryHost {
|
|
|
186
197
|
return super.delete(path);
|
|
187
198
|
}
|
|
188
199
|
else {
|
|
189
|
-
return this._back.exists(path).pipe(operators_1.switchMap(exists => {
|
|
200
|
+
return this._back.exists(path).pipe(operators_1.switchMap((exists) => {
|
|
190
201
|
if (exists) {
|
|
191
202
|
this._filesToDelete.add(path);
|
|
192
203
|
return rxjs_1.of();
|
|
@@ -218,7 +229,7 @@ class CordHost extends memory_1.SimpleMemoryHost {
|
|
|
218
229
|
this._filesToOverwrite.delete(from);
|
|
219
230
|
// Recursively call this function. This is so we don't repeat the bottom logic. This
|
|
220
231
|
// if will be by-passed because we just deleted the `from` path from files to overwrite.
|
|
221
|
-
return rxjs_1.concat(this.rename(from, to), new rxjs_1.Observable(x => {
|
|
232
|
+
return rxjs_1.concat(this.rename(from, to), new rxjs_1.Observable((x) => {
|
|
222
233
|
this._filesToOverwrite.add(to);
|
|
223
234
|
x.complete();
|
|
224
235
|
}));
|
|
@@ -228,7 +239,7 @@ class CordHost extends memory_1.SimpleMemoryHost {
|
|
|
228
239
|
this._filesToDelete.add(from);
|
|
229
240
|
this._filesToOverwrite.add(to);
|
|
230
241
|
// We need to delete the original and write the new one.
|
|
231
|
-
return this.read(from).pipe(operators_1.map(content => this._write(to, content)));
|
|
242
|
+
return this.read(from).pipe(operators_1.map((content) => this._write(to, content)));
|
|
232
243
|
}
|
|
233
244
|
const maybeTo1 = this._filesToRenameRevert.get(from);
|
|
234
245
|
if (maybeTo1) {
|
|
@@ -246,20 +257,22 @@ class CordHost extends memory_1.SimpleMemoryHost {
|
|
|
246
257
|
}
|
|
247
258
|
else {
|
|
248
259
|
// Create a file with the same content.
|
|
249
|
-
return this._back.read(from).pipe(operators_1.switchMap(content => super.write(to, content)));
|
|
260
|
+
return this._back.read(from).pipe(operators_1.switchMap((content) => super.write(to, content)));
|
|
250
261
|
}
|
|
251
262
|
}));
|
|
252
263
|
}
|
|
253
264
|
list(path) {
|
|
254
265
|
return rxjs_1.concat(super.list(path), this._back.list(path)).pipe(operators_1.reduce((list, curr) => {
|
|
255
|
-
curr.forEach(elem => list.add(elem));
|
|
266
|
+
curr.forEach((elem) => list.add(elem));
|
|
256
267
|
return list;
|
|
257
|
-
}, new Set()), operators_1.map(set => [...set]));
|
|
268
|
+
}, new Set()), operators_1.map((set) => [...set]));
|
|
258
269
|
}
|
|
259
270
|
exists(path) {
|
|
260
271
|
return this._exists(path)
|
|
261
272
|
? rxjs_1.of(true)
|
|
262
|
-
:
|
|
273
|
+
: this.willDelete(path) || this.willRename(path)
|
|
274
|
+
? rxjs_1.of(false)
|
|
275
|
+
: this._back.exists(path);
|
|
263
276
|
}
|
|
264
277
|
isDirectory(path) {
|
|
265
278
|
return this._exists(path) ? super.isDirectory(path) : this._back.isDirectory(path);
|
|
@@ -267,12 +280,16 @@ class CordHost extends memory_1.SimpleMemoryHost {
|
|
|
267
280
|
isFile(path) {
|
|
268
281
|
return this._exists(path)
|
|
269
282
|
? super.isFile(path)
|
|
270
|
-
:
|
|
283
|
+
: this.willDelete(path) || this.willRename(path)
|
|
284
|
+
? rxjs_1.of(false)
|
|
285
|
+
: this._back.isFile(path);
|
|
271
286
|
}
|
|
272
287
|
stat(path) {
|
|
273
288
|
return this._exists(path)
|
|
274
289
|
? super.stat(path)
|
|
275
|
-
:
|
|
290
|
+
: this.willDelete(path) || this.willRename(path)
|
|
291
|
+
? rxjs_1.of(null)
|
|
292
|
+
: this._back.stat(path);
|
|
276
293
|
}
|
|
277
294
|
watch(path, options) {
|
|
278
295
|
// Watching not supported.
|
|
@@ -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.ResolverHost = void 0;
|
|
4
11
|
/**
|
|
@@ -9,7 +16,9 @@ class ResolverHost {
|
|
|
9
16
|
constructor(_delegate) {
|
|
10
17
|
this._delegate = _delegate;
|
|
11
18
|
}
|
|
12
|
-
get capabilities() {
|
|
19
|
+
get capabilities() {
|
|
20
|
+
return this._delegate.capabilities;
|
|
21
|
+
}
|
|
13
22
|
write(path, content) {
|
|
14
23
|
return this._delegate.write(this._resolve(path), content);
|
|
15
24
|
}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.SafeReadonlyHost = 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.SafeReadonlyHost = void 0;
|
|
11
11
|
const rxjs_1 = require("rxjs");
|
|
12
12
|
const operators_1 = require("rxjs/operators");
|
|
13
13
|
/**
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ScopedHost = 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.ScopedHost = void 0;
|
|
11
11
|
const path_1 = require("../path");
|
|
12
12
|
const resolver_1 = require("./resolver");
|
|
13
13
|
class ScopedHost extends resolver_1.ResolverHost {
|
|
@@ -1,9 +1,18 @@
|
|
|
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.SyncDelegateHost = exports.SynchronousDelegateExpectedException = void 0;
|
|
4
11
|
const exception_1 = require("../../exception");
|
|
5
12
|
class SynchronousDelegateExpectedException extends exception_1.BaseException {
|
|
6
|
-
constructor() {
|
|
13
|
+
constructor() {
|
|
14
|
+
super(`Expected a synchronous delegate but got an asynchronous one.`);
|
|
15
|
+
}
|
|
7
16
|
}
|
|
8
17
|
exports.SynchronousDelegateExpectedException = SynchronousDelegateExpectedException;
|
|
9
18
|
/**
|
|
@@ -22,7 +31,7 @@ class SyncDelegateHost {
|
|
|
22
31
|
let errorResult = undefined;
|
|
23
32
|
// Perf note: this is not using an observer object to avoid a performance penalty in RxJS.
|
|
24
33
|
// See https://github.com/ReactiveX/rxjs/pull/5646 for details.
|
|
25
|
-
observable.subscribe((x) => result = x, (err) => errorResult = err, () => completed = true);
|
|
34
|
+
observable.subscribe((x) => (result = x), (err) => (errorResult = err), () => (completed = true));
|
|
26
35
|
if (errorResult !== undefined) {
|
|
27
36
|
throw errorResult;
|
|
28
37
|
}
|
|
@@ -32,7 +41,7 @@ class SyncDelegateHost {
|
|
|
32
41
|
// The non-null operation is to work around `void` type. We don't allow to return undefined
|
|
33
42
|
// but ResultT could be void, which is undefined in JavaScript, so this doesn't change the
|
|
34
43
|
// behaviour.
|
|
35
|
-
//
|
|
44
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
36
45
|
return result;
|
|
37
46
|
}
|
|
38
47
|
get capabilities() {
|
|
@@ -1,10 +1,18 @@
|
|
|
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.test = void 0;
|
|
4
11
|
const path_1 = require("../path");
|
|
5
12
|
const buffer_1 = require("./buffer");
|
|
6
13
|
const memory_1 = require("./memory");
|
|
7
14
|
const sync_1 = require("./sync");
|
|
15
|
+
// eslint-disable-next-line @typescript-eslint/no-namespace
|
|
8
16
|
var test;
|
|
9
17
|
(function (test) {
|
|
10
18
|
class TestHost extends memory_1.SimpleMemoryHost {
|
|
@@ -25,8 +33,9 @@ var test;
|
|
|
25
33
|
get files() {
|
|
26
34
|
const sync = this.sync;
|
|
27
35
|
function _visit(p) {
|
|
28
|
-
return sync
|
|
29
|
-
.
|
|
36
|
+
return sync
|
|
37
|
+
.list(p)
|
|
38
|
+
.map((fragment) => path_1.join(p, fragment))
|
|
30
39
|
.reduce((files, path) => {
|
|
31
40
|
if (sync.isDirectory(path)) {
|
|
32
41
|
return files.concat(_visit(path));
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @license
|
|
3
|
-
* Copyright Google
|
|
3
|
+
* Copyright Google LLC All Rights Reserved.
|
|
4
4
|
*
|
|
5
5
|
* Use of this source code is governed by an MIT-style license that can be
|
|
6
6
|
* found in the LICENSE file at https://angular.io/license
|
|
7
7
|
*/
|
|
8
|
-
export * from './path';
|
|
9
8
|
import * as virtualFs from './host/index';
|
|
9
|
+
export * from './path';
|
|
10
10
|
export { virtualFs };
|
package/src/virtual-fs/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]; } });
|
|
@@ -11,13 +18,6 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
11
18
|
};
|
|
12
19
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
20
|
exports.virtualFs = void 0;
|
|
14
|
-
/**
|
|
15
|
-
* @license
|
|
16
|
-
* Copyright Google Inc. All Rights Reserved.
|
|
17
|
-
*
|
|
18
|
-
* Use of this source code is governed by an MIT-style license that can be
|
|
19
|
-
* found in the LICENSE file at https://angular.io/license
|
|
20
|
-
*/
|
|
21
|
-
__exportStar(require("./path"), exports);
|
|
22
21
|
const virtualFs = require("./host/index");
|
|
23
22
|
exports.virtualFs = virtualFs;
|
|
23
|
+
__exportStar(require("./path"), exports);
|
package/src/virtual-fs/path.d.ts
CHANGED
package/src/virtual-fs/path.js
CHANGED
|
@@ -1,24 +1,30 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getSystemPath = exports.asPosixPath = exports.asWindowsPath = exports.path = exports.noCacheNormalize = exports.normalize = exports.resetNormalizeCache = exports.fragment = exports.resolve = exports.relative = exports.isAbsolute = exports.join = exports.dirname = exports.basename = exports.extname = exports.split = exports.NormalizedRoot = exports.NormalizedSep = exports.PathCannotBeFragmentException = exports.PathMustBeAbsoluteException = exports.InvalidPathException = 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.getSystemPath = exports.asPosixPath = exports.asWindowsPath = exports.path = exports.noCacheNormalize = exports.normalize = exports.resetNormalizeCache = exports.fragment = exports.resolve = exports.relative = exports.isAbsolute = exports.join = exports.dirname = exports.basename = exports.extname = exports.split = exports.NormalizedRoot = exports.NormalizedSep = exports.PathCannotBeFragmentException = exports.PathMustBeAbsoluteException = exports.InvalidPathException = void 0;
|
|
11
11
|
const exception_1 = require("../exception");
|
|
12
12
|
class InvalidPathException extends exception_1.BaseException {
|
|
13
|
-
constructor(path) {
|
|
13
|
+
constructor(path) {
|
|
14
|
+
super(`Path ${JSON.stringify(path)} is invalid.`);
|
|
15
|
+
}
|
|
14
16
|
}
|
|
15
17
|
exports.InvalidPathException = InvalidPathException;
|
|
16
18
|
class PathMustBeAbsoluteException extends exception_1.BaseException {
|
|
17
|
-
constructor(path) {
|
|
19
|
+
constructor(path) {
|
|
20
|
+
super(`Path ${JSON.stringify(path)} must be absolute.`);
|
|
21
|
+
}
|
|
18
22
|
}
|
|
19
23
|
exports.PathMustBeAbsoluteException = PathMustBeAbsoluteException;
|
|
20
24
|
class PathCannotBeFragmentException extends exception_1.BaseException {
|
|
21
|
-
constructor(path) {
|
|
25
|
+
constructor(path) {
|
|
26
|
+
super(`Path ${JSON.stringify(path)} cannot be made a fragment.`);
|
|
27
|
+
}
|
|
22
28
|
}
|
|
23
29
|
exports.PathCannotBeFragmentException = PathCannotBeFragmentException;
|
|
24
30
|
/**
|
|
@@ -38,7 +44,7 @@ exports.NormalizedRoot = exports.NormalizedSep;
|
|
|
38
44
|
* @returns {Path[]} An array of path fragments.
|
|
39
45
|
*/
|
|
40
46
|
function split(path) {
|
|
41
|
-
const fragments = path.split(exports.NormalizedSep).map(x => fragment(x));
|
|
47
|
+
const fragments = path.split(exports.NormalizedSep).map((x) => fragment(x));
|
|
42
48
|
if (fragments[fragments.length - 1].length === 0) {
|
|
43
49
|
fragments.pop();
|
|
44
50
|
}
|
|
@@ -130,7 +136,10 @@ function relative(from, to) {
|
|
|
130
136
|
p = splitTo.join(exports.NormalizedSep);
|
|
131
137
|
}
|
|
132
138
|
else {
|
|
133
|
-
p = splitFrom
|
|
139
|
+
p = splitFrom
|
|
140
|
+
.map(() => '..')
|
|
141
|
+
.concat(splitTo)
|
|
142
|
+
.join(exports.NormalizedSep);
|
|
134
143
|
}
|
|
135
144
|
}
|
|
136
145
|
return normalize(p);
|