@angular-devkit/core 17.2.0-next.0 → 17.2.0-rc.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/node/host.js +6 -6
- package/package.json +2 -2
- package/src/virtual-fs/host/index.d.ts +2 -1
- package/src/virtual-fs/host/index.js +15 -1
- package/src/virtual-fs/host/interface.d.ts +1 -1
- package/src/virtual-fs/host/interface.js +8 -0
- package/src/virtual-fs/host/memory.js +6 -5
- package/src/virtual-fs/host/test.d.ts +35 -37
- package/src/virtual-fs/host/test.js +102 -106
package/node/host.js
CHANGED
|
@@ -86,21 +86,21 @@ class NodeJsAsyncHost {
|
|
|
86
86
|
obs.next({
|
|
87
87
|
path: (0, src_1.normalize)(path),
|
|
88
88
|
time: new Date(),
|
|
89
|
-
type:
|
|
89
|
+
type: src_1.virtualFs.HostWatchEventType.Changed,
|
|
90
90
|
});
|
|
91
91
|
})
|
|
92
92
|
.on('add', (path) => {
|
|
93
93
|
obs.next({
|
|
94
94
|
path: (0, src_1.normalize)(path),
|
|
95
95
|
time: new Date(),
|
|
96
|
-
type:
|
|
96
|
+
type: src_1.virtualFs.HostWatchEventType.Created,
|
|
97
97
|
});
|
|
98
98
|
})
|
|
99
99
|
.on('unlink', (path) => {
|
|
100
100
|
obs.next({
|
|
101
101
|
path: (0, src_1.normalize)(path),
|
|
102
102
|
time: new Date(),
|
|
103
|
-
type:
|
|
103
|
+
type: src_1.virtualFs.HostWatchEventType.Deleted,
|
|
104
104
|
});
|
|
105
105
|
});
|
|
106
106
|
return () => {
|
|
@@ -186,21 +186,21 @@ class NodeJsSyncHost {
|
|
|
186
186
|
obs.next({
|
|
187
187
|
path: (0, src_1.normalize)(path),
|
|
188
188
|
time: new Date(),
|
|
189
|
-
type:
|
|
189
|
+
type: src_1.virtualFs.HostWatchEventType.Changed,
|
|
190
190
|
});
|
|
191
191
|
})
|
|
192
192
|
.on('add', (path) => {
|
|
193
193
|
obs.next({
|
|
194
194
|
path: (0, src_1.normalize)(path),
|
|
195
195
|
time: new Date(),
|
|
196
|
-
type:
|
|
196
|
+
type: src_1.virtualFs.HostWatchEventType.Created,
|
|
197
197
|
});
|
|
198
198
|
})
|
|
199
199
|
.on('unlink', (path) => {
|
|
200
200
|
obs.next({
|
|
201
201
|
path: (0, src_1.normalize)(path),
|
|
202
202
|
time: new Date(),
|
|
203
|
-
type:
|
|
203
|
+
type: src_1.virtualFs.HostWatchEventType.Deleted,
|
|
204
204
|
});
|
|
205
205
|
});
|
|
206
206
|
return () => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@angular-devkit/core",
|
|
3
|
-
"version": "17.2.0-
|
|
3
|
+
"version": "17.2.0-rc.0",
|
|
4
4
|
"description": "Angular DevKit - Core Utility Library",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"typings": "src/index.d.ts",
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"ajv-formats": "2.1.1",
|
|
34
34
|
"ajv": "8.12.0",
|
|
35
35
|
"jsonc-parser": "3.2.1",
|
|
36
|
-
"picomatch": "
|
|
36
|
+
"picomatch": "4.0.1",
|
|
37
37
|
"rxjs": "7.8.1",
|
|
38
38
|
"source-map": "0.7.4"
|
|
39
39
|
},
|
|
@@ -5,6 +5,7 @@
|
|
|
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
|
+
import * as test from './test';
|
|
8
9
|
export * from './alias';
|
|
9
10
|
export * from './buffer';
|
|
10
11
|
export * from './create';
|
|
@@ -17,4 +18,4 @@ export * from './safe';
|
|
|
17
18
|
export * from './scoped';
|
|
18
19
|
export * from './sync';
|
|
19
20
|
export * from './resolver';
|
|
20
|
-
export
|
|
21
|
+
export { test };
|
|
@@ -17,10 +17,25 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi
|
|
|
17
17
|
if (k2 === undefined) k2 = k;
|
|
18
18
|
o[k2] = m[k];
|
|
19
19
|
}));
|
|
20
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
21
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
22
|
+
}) : function(o, v) {
|
|
23
|
+
o["default"] = v;
|
|
24
|
+
});
|
|
25
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
26
|
+
if (mod && mod.__esModule) return mod;
|
|
27
|
+
var result = {};
|
|
28
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
29
|
+
__setModuleDefault(result, mod);
|
|
30
|
+
return result;
|
|
31
|
+
};
|
|
20
32
|
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
21
33
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
22
34
|
};
|
|
23
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.test = void 0;
|
|
37
|
+
const test = __importStar(require("./test"));
|
|
38
|
+
exports.test = test;
|
|
24
39
|
__exportStar(require("./alias"), exports);
|
|
25
40
|
__exportStar(require("./buffer"), exports);
|
|
26
41
|
__exportStar(require("./create"), exports);
|
|
@@ -33,4 +48,3 @@ __exportStar(require("./safe"), exports);
|
|
|
33
48
|
__exportStar(require("./scoped"), exports);
|
|
34
49
|
__exportStar(require("./sync"), exports);
|
|
35
50
|
__exportStar(require("./resolver"), exports);
|
|
36
|
-
__exportStar(require("./test"), exports);
|
|
@@ -7,3 +7,11 @@
|
|
|
7
7
|
* found in the LICENSE file at https://angular.io/license
|
|
8
8
|
*/
|
|
9
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.HostWatchEventType = void 0;
|
|
11
|
+
var HostWatchEventType;
|
|
12
|
+
(function (HostWatchEventType) {
|
|
13
|
+
HostWatchEventType[HostWatchEventType["Changed"] = 0] = "Changed";
|
|
14
|
+
HostWatchEventType[HostWatchEventType["Created"] = 1] = "Created";
|
|
15
|
+
HostWatchEventType[HostWatchEventType["Deleted"] = 2] = "Deleted";
|
|
16
|
+
HostWatchEventType[HostWatchEventType["Renamed"] = 3] = "Renamed";
|
|
17
|
+
})(HostWatchEventType || (exports.HostWatchEventType = HostWatchEventType = {}));
|
|
@@ -11,6 +11,7 @@ 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");
|
|
14
|
+
const interface_1 = require("./interface");
|
|
14
15
|
class SimpleMemoryHost {
|
|
15
16
|
_cache = new Map();
|
|
16
17
|
_watchers = new Map();
|
|
@@ -71,7 +72,7 @@ class SimpleMemoryHost {
|
|
|
71
72
|
maybeWatcher.forEach((watcher) => {
|
|
72
73
|
const [options, subject] = watcher;
|
|
73
74
|
subject.next({ path, time, type });
|
|
74
|
-
if (!options.persistent && type ==
|
|
75
|
+
if (!options.persistent && type == interface_1.HostWatchEventType.Deleted) {
|
|
75
76
|
subject.complete();
|
|
76
77
|
this._watchers.delete(currentPath);
|
|
77
78
|
}
|
|
@@ -88,7 +89,7 @@ class SimpleMemoryHost {
|
|
|
88
89
|
return;
|
|
89
90
|
}
|
|
90
91
|
subject.next({ path, time, type });
|
|
91
|
-
if (!options.persistent && type ==
|
|
92
|
+
if (!options.persistent && type == interface_1.HostWatchEventType.Deleted) {
|
|
92
93
|
subject.complete();
|
|
93
94
|
this._watchers.delete(currentPath);
|
|
94
95
|
}
|
|
@@ -127,7 +128,7 @@ class SimpleMemoryHost {
|
|
|
127
128
|
// Create the stats.
|
|
128
129
|
const stats = this._newFileStats(content, old);
|
|
129
130
|
this._cache.set(path, stats);
|
|
130
|
-
this._updateWatchers(path, old ?
|
|
131
|
+
this._updateWatchers(path, old ? interface_1.HostWatchEventType.Changed : interface_1.HostWatchEventType.Created);
|
|
131
132
|
}
|
|
132
133
|
_read(path) {
|
|
133
134
|
path = this._toAbsolute(path);
|
|
@@ -157,7 +158,7 @@ class SimpleMemoryHost {
|
|
|
157
158
|
else {
|
|
158
159
|
this._cache.delete(path);
|
|
159
160
|
}
|
|
160
|
-
this._updateWatchers(path,
|
|
161
|
+
this._updateWatchers(path, interface_1.HostWatchEventType.Deleted);
|
|
161
162
|
}
|
|
162
163
|
_rename(from, to) {
|
|
163
164
|
from = this._toAbsolute(from);
|
|
@@ -204,7 +205,7 @@ class SimpleMemoryHost {
|
|
|
204
205
|
this._cache.set(to, content);
|
|
205
206
|
}
|
|
206
207
|
}
|
|
207
|
-
this._updateWatchers(from,
|
|
208
|
+
this._updateWatchers(from, interface_1.HostWatchEventType.Renamed);
|
|
208
209
|
}
|
|
209
210
|
_list(path) {
|
|
210
211
|
path = this._toAbsolute(path);
|
|
@@ -10,41 +10,39 @@ import { Path, PathFragment } from '../path';
|
|
|
10
10
|
import { FileBuffer, HostWatchEvent, HostWatchOptions, Stats } from './interface';
|
|
11
11
|
import { SimpleMemoryHost, SimpleMemoryHostStats } from './memory';
|
|
12
12
|
import { SyncDelegateHost } from './sync';
|
|
13
|
-
export
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
$isFile(path: string): boolean;
|
|
49
|
-
}
|
|
13
|
+
export type TestLogRecord = {
|
|
14
|
+
kind: 'write' | 'read' | 'delete' | 'list' | 'exists' | 'isDirectory' | 'isFile' | 'stat' | 'watch';
|
|
15
|
+
path: Path;
|
|
16
|
+
} | {
|
|
17
|
+
kind: 'rename';
|
|
18
|
+
from: Path;
|
|
19
|
+
to: Path;
|
|
20
|
+
};
|
|
21
|
+
export declare class TestHost extends SimpleMemoryHost {
|
|
22
|
+
protected _records: TestLogRecord[];
|
|
23
|
+
protected _sync: SyncDelegateHost<{}> | null;
|
|
24
|
+
constructor(map?: {
|
|
25
|
+
[path: string]: string;
|
|
26
|
+
});
|
|
27
|
+
get records(): TestLogRecord[];
|
|
28
|
+
clearRecords(): void;
|
|
29
|
+
get files(): Path[];
|
|
30
|
+
get sync(): SyncDelegateHost<{}>;
|
|
31
|
+
clone(): TestHost;
|
|
32
|
+
protected _write(path: Path, content: FileBuffer): void;
|
|
33
|
+
protected _read(path: Path): ArrayBuffer;
|
|
34
|
+
protected _delete(path: Path): void;
|
|
35
|
+
protected _rename(from: Path, to: Path): void;
|
|
36
|
+
protected _list(path: Path): PathFragment[];
|
|
37
|
+
protected _exists(path: Path): boolean;
|
|
38
|
+
protected _isDirectory(path: Path): boolean;
|
|
39
|
+
protected _isFile(path: Path): boolean;
|
|
40
|
+
protected _stat(path: Path): Stats<SimpleMemoryHostStats> | null;
|
|
41
|
+
protected _watch(path: Path, options?: HostWatchOptions): Observable<HostWatchEvent>;
|
|
42
|
+
$write(path: string, content: string): void;
|
|
43
|
+
$read(path: string): string;
|
|
44
|
+
$list(path: string): PathFragment[];
|
|
45
|
+
$exists(path: string): boolean;
|
|
46
|
+
$isDirectory(path: string): boolean;
|
|
47
|
+
$isFile(path: string): boolean;
|
|
50
48
|
}
|
|
@@ -7,116 +7,112 @@
|
|
|
7
7
|
* found in the LICENSE file at https://angular.io/license
|
|
8
8
|
*/
|
|
9
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
-
exports.
|
|
10
|
+
exports.TestHost = void 0;
|
|
11
11
|
const path_1 = require("../path");
|
|
12
12
|
const buffer_1 = require("./buffer");
|
|
13
13
|
const memory_1 = require("./memory");
|
|
14
14
|
const sync_1 = require("./sync");
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
super();
|
|
23
|
-
for (const filePath of Object.getOwnPropertyNames(map)) {
|
|
24
|
-
this._write((0, path_1.normalize)(filePath), (0, buffer_1.stringToFileBuffer)(map[filePath]));
|
|
25
|
-
}
|
|
15
|
+
class TestHost extends memory_1.SimpleMemoryHost {
|
|
16
|
+
_records = [];
|
|
17
|
+
_sync = null;
|
|
18
|
+
constructor(map = {}) {
|
|
19
|
+
super();
|
|
20
|
+
for (const filePath of Object.getOwnPropertyNames(map)) {
|
|
21
|
+
this._write((0, path_1.normalize)(filePath), (0, buffer_1.stringToFileBuffer)(map[filePath]));
|
|
26
22
|
}
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
return this._sync;
|
|
55
|
-
}
|
|
56
|
-
clone() {
|
|
57
|
-
const newHost = new TestHost();
|
|
58
|
-
newHost._cache = new Map(this._cache);
|
|
59
|
-
return newHost;
|
|
60
|
-
}
|
|
61
|
-
// Override parents functions to keep a record of all operators that were done.
|
|
62
|
-
_write(path, content) {
|
|
63
|
-
this._records.push({ kind: 'write', path });
|
|
64
|
-
return super._write(path, content);
|
|
65
|
-
}
|
|
66
|
-
_read(path) {
|
|
67
|
-
this._records.push({ kind: 'read', path });
|
|
68
|
-
return super._read(path);
|
|
69
|
-
}
|
|
70
|
-
_delete(path) {
|
|
71
|
-
this._records.push({ kind: 'delete', path });
|
|
72
|
-
return super._delete(path);
|
|
73
|
-
}
|
|
74
|
-
_rename(from, to) {
|
|
75
|
-
this._records.push({ kind: 'rename', from, to });
|
|
76
|
-
return super._rename(from, to);
|
|
77
|
-
}
|
|
78
|
-
_list(path) {
|
|
79
|
-
this._records.push({ kind: 'list', path });
|
|
80
|
-
return super._list(path);
|
|
81
|
-
}
|
|
82
|
-
_exists(path) {
|
|
83
|
-
this._records.push({ kind: 'exists', path });
|
|
84
|
-
return super._exists(path);
|
|
85
|
-
}
|
|
86
|
-
_isDirectory(path) {
|
|
87
|
-
this._records.push({ kind: 'isDirectory', path });
|
|
88
|
-
return super._isDirectory(path);
|
|
89
|
-
}
|
|
90
|
-
_isFile(path) {
|
|
91
|
-
this._records.push({ kind: 'isFile', path });
|
|
92
|
-
return super._isFile(path);
|
|
93
|
-
}
|
|
94
|
-
_stat(path) {
|
|
95
|
-
this._records.push({ kind: 'stat', path });
|
|
96
|
-
return super._stat(path);
|
|
97
|
-
}
|
|
98
|
-
_watch(path, options) {
|
|
99
|
-
this._records.push({ kind: 'watch', path });
|
|
100
|
-
return super._watch(path, options);
|
|
101
|
-
}
|
|
102
|
-
$write(path, content) {
|
|
103
|
-
return super._write((0, path_1.normalize)(path), (0, buffer_1.stringToFileBuffer)(content));
|
|
104
|
-
}
|
|
105
|
-
$read(path) {
|
|
106
|
-
return (0, buffer_1.fileBufferToString)(super._read((0, path_1.normalize)(path)));
|
|
107
|
-
}
|
|
108
|
-
$list(path) {
|
|
109
|
-
return super._list((0, path_1.normalize)(path));
|
|
110
|
-
}
|
|
111
|
-
$exists(path) {
|
|
112
|
-
return super._exists((0, path_1.normalize)(path));
|
|
113
|
-
}
|
|
114
|
-
$isDirectory(path) {
|
|
115
|
-
return super._isDirectory((0, path_1.normalize)(path));
|
|
116
|
-
}
|
|
117
|
-
$isFile(path) {
|
|
118
|
-
return super._isFile((0, path_1.normalize)(path));
|
|
23
|
+
}
|
|
24
|
+
get records() {
|
|
25
|
+
return [...this._records];
|
|
26
|
+
}
|
|
27
|
+
clearRecords() {
|
|
28
|
+
this._records = [];
|
|
29
|
+
}
|
|
30
|
+
get files() {
|
|
31
|
+
const sync = this.sync;
|
|
32
|
+
function _visit(p) {
|
|
33
|
+
return sync
|
|
34
|
+
.list(p)
|
|
35
|
+
.map((fragment) => (0, path_1.join)(p, fragment))
|
|
36
|
+
.reduce((files, path) => {
|
|
37
|
+
if (sync.isDirectory(path)) {
|
|
38
|
+
return files.concat(_visit(path));
|
|
39
|
+
}
|
|
40
|
+
else {
|
|
41
|
+
return files.concat(path);
|
|
42
|
+
}
|
|
43
|
+
}, []);
|
|
44
|
+
}
|
|
45
|
+
return _visit((0, path_1.normalize)('/'));
|
|
46
|
+
}
|
|
47
|
+
get sync() {
|
|
48
|
+
if (!this._sync) {
|
|
49
|
+
this._sync = new sync_1.SyncDelegateHost(this);
|
|
119
50
|
}
|
|
51
|
+
return this._sync;
|
|
52
|
+
}
|
|
53
|
+
clone() {
|
|
54
|
+
const newHost = new TestHost();
|
|
55
|
+
newHost._cache = new Map(this._cache);
|
|
56
|
+
return newHost;
|
|
57
|
+
}
|
|
58
|
+
// Override parents functions to keep a record of all operators that were done.
|
|
59
|
+
_write(path, content) {
|
|
60
|
+
this._records.push({ kind: 'write', path });
|
|
61
|
+
return super._write(path, content);
|
|
62
|
+
}
|
|
63
|
+
_read(path) {
|
|
64
|
+
this._records.push({ kind: 'read', path });
|
|
65
|
+
return super._read(path);
|
|
66
|
+
}
|
|
67
|
+
_delete(path) {
|
|
68
|
+
this._records.push({ kind: 'delete', path });
|
|
69
|
+
return super._delete(path);
|
|
70
|
+
}
|
|
71
|
+
_rename(from, to) {
|
|
72
|
+
this._records.push({ kind: 'rename', from, to });
|
|
73
|
+
return super._rename(from, to);
|
|
74
|
+
}
|
|
75
|
+
_list(path) {
|
|
76
|
+
this._records.push({ kind: 'list', path });
|
|
77
|
+
return super._list(path);
|
|
78
|
+
}
|
|
79
|
+
_exists(path) {
|
|
80
|
+
this._records.push({ kind: 'exists', path });
|
|
81
|
+
return super._exists(path);
|
|
82
|
+
}
|
|
83
|
+
_isDirectory(path) {
|
|
84
|
+
this._records.push({ kind: 'isDirectory', path });
|
|
85
|
+
return super._isDirectory(path);
|
|
86
|
+
}
|
|
87
|
+
_isFile(path) {
|
|
88
|
+
this._records.push({ kind: 'isFile', path });
|
|
89
|
+
return super._isFile(path);
|
|
90
|
+
}
|
|
91
|
+
_stat(path) {
|
|
92
|
+
this._records.push({ kind: 'stat', path });
|
|
93
|
+
return super._stat(path);
|
|
94
|
+
}
|
|
95
|
+
_watch(path, options) {
|
|
96
|
+
this._records.push({ kind: 'watch', path });
|
|
97
|
+
return super._watch(path, options);
|
|
98
|
+
}
|
|
99
|
+
$write(path, content) {
|
|
100
|
+
return super._write((0, path_1.normalize)(path), (0, buffer_1.stringToFileBuffer)(content));
|
|
101
|
+
}
|
|
102
|
+
$read(path) {
|
|
103
|
+
return (0, buffer_1.fileBufferToString)(super._read((0, path_1.normalize)(path)));
|
|
104
|
+
}
|
|
105
|
+
$list(path) {
|
|
106
|
+
return super._list((0, path_1.normalize)(path));
|
|
107
|
+
}
|
|
108
|
+
$exists(path) {
|
|
109
|
+
return super._exists((0, path_1.normalize)(path));
|
|
110
|
+
}
|
|
111
|
+
$isDirectory(path) {
|
|
112
|
+
return super._isDirectory((0, path_1.normalize)(path));
|
|
113
|
+
}
|
|
114
|
+
$isFile(path) {
|
|
115
|
+
return super._isFile((0, path_1.normalize)(path));
|
|
120
116
|
}
|
|
121
|
-
|
|
122
|
-
|
|
117
|
+
}
|
|
118
|
+
exports.TestHost = TestHost;
|