@angular-devkit/core 15.0.1 → 15.1.0-next.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.d.ts +1 -1
- package/node/host.js +18 -42
- package/package.json +2 -2
package/node/host.d.ts
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* found in the LICENSE file at https://angular.io/license
|
|
7
7
|
*/
|
|
8
8
|
/// <reference types="node" />
|
|
9
|
-
import { Stats } from 'fs';
|
|
9
|
+
import { Stats } from 'node:fs';
|
|
10
10
|
import { Observable } from 'rxjs';
|
|
11
11
|
import { Path, PathFragment, virtualFs } from '../src';
|
|
12
12
|
/**
|
package/node/host.js
CHANGED
|
@@ -6,39 +6,16 @@
|
|
|
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
|
|
8
8
|
*/
|
|
9
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
12
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
13
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
14
|
-
}
|
|
15
|
-
Object.defineProperty(o, k2, desc);
|
|
16
|
-
}) : (function(o, m, k, k2) {
|
|
17
|
-
if (k2 === undefined) k2 = k;
|
|
18
|
-
o[k2] = m[k];
|
|
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
|
-
};
|
|
32
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
33
10
|
exports.NodeJsSyncHost = exports.NodeJsAsyncHost = void 0;
|
|
34
|
-
const
|
|
35
|
-
const
|
|
11
|
+
const node_fs_1 = require("node:fs");
|
|
12
|
+
const node_path_1 = require("node:path");
|
|
36
13
|
const rxjs_1 = require("rxjs");
|
|
37
14
|
const operators_1 = require("rxjs/operators");
|
|
38
15
|
const src_1 = require("../src");
|
|
39
16
|
async function exists(path) {
|
|
40
17
|
try {
|
|
41
|
-
await
|
|
18
|
+
await node_fs_1.promises.access(path, node_fs_1.constants.F_OK);
|
|
42
19
|
return true;
|
|
43
20
|
}
|
|
44
21
|
catch {
|
|
@@ -52,7 +29,6 @@ let FSWatcher;
|
|
|
52
29
|
function loadFSWatcher() {
|
|
53
30
|
if (!FSWatcher) {
|
|
54
31
|
try {
|
|
55
|
-
// eslint-disable-next-line import/no-extraneous-dependencies
|
|
56
32
|
FSWatcher = require('chokidar').FSWatcher;
|
|
57
33
|
}
|
|
58
34
|
catch (e) {
|
|
@@ -73,19 +49,19 @@ class NodeJsAsyncHost {
|
|
|
73
49
|
return { synchronous: false };
|
|
74
50
|
}
|
|
75
51
|
write(path, content) {
|
|
76
|
-
return (0, rxjs_1.from)(
|
|
52
|
+
return (0, rxjs_1.from)(node_fs_1.promises.mkdir((0, src_1.getSystemPath)((0, src_1.dirname)(path)), { recursive: true })).pipe((0, operators_1.mergeMap)(() => node_fs_1.promises.writeFile((0, src_1.getSystemPath)(path), new Uint8Array(content))));
|
|
77
53
|
}
|
|
78
54
|
read(path) {
|
|
79
|
-
return (0, rxjs_1.from)(
|
|
55
|
+
return (0, rxjs_1.from)(node_fs_1.promises.readFile((0, src_1.getSystemPath)(path))).pipe((0, operators_1.map)((buffer) => new Uint8Array(buffer).buffer));
|
|
80
56
|
}
|
|
81
57
|
delete(path) {
|
|
82
|
-
return (0, rxjs_1.from)(
|
|
58
|
+
return (0, rxjs_1.from)(node_fs_1.promises.rm((0, src_1.getSystemPath)(path), { force: true, recursive: true, maxRetries: 3 }));
|
|
83
59
|
}
|
|
84
60
|
rename(from, to) {
|
|
85
|
-
return (0, rxjs_1.from)(
|
|
61
|
+
return (0, rxjs_1.from)(node_fs_1.promises.rename((0, src_1.getSystemPath)(from), (0, src_1.getSystemPath)(to)));
|
|
86
62
|
}
|
|
87
63
|
list(path) {
|
|
88
|
-
return (0, rxjs_1.from)(
|
|
64
|
+
return (0, rxjs_1.from)(node_fs_1.promises.readdir((0, src_1.getSystemPath)(path))).pipe((0, operators_1.map)((names) => names.map((name) => (0, src_1.fragment)(name))));
|
|
89
65
|
}
|
|
90
66
|
exists(path) {
|
|
91
67
|
return (0, rxjs_1.from)(exists((0, src_1.getSystemPath)(path)));
|
|
@@ -98,7 +74,7 @@ class NodeJsAsyncHost {
|
|
|
98
74
|
}
|
|
99
75
|
// Some hosts may not support stat.
|
|
100
76
|
stat(path) {
|
|
101
|
-
return (0, rxjs_1.from)(
|
|
77
|
+
return (0, rxjs_1.from)(node_fs_1.promises.stat((0, src_1.getSystemPath)(path)));
|
|
102
78
|
}
|
|
103
79
|
// Some hosts may not support watching.
|
|
104
80
|
watch(path, _options) {
|
|
@@ -142,44 +118,44 @@ class NodeJsSyncHost {
|
|
|
142
118
|
}
|
|
143
119
|
write(path, content) {
|
|
144
120
|
return new rxjs_1.Observable((obs) => {
|
|
145
|
-
(0,
|
|
146
|
-
(0,
|
|
121
|
+
(0, node_fs_1.mkdirSync)((0, src_1.getSystemPath)((0, src_1.dirname)(path)), { recursive: true });
|
|
122
|
+
(0, node_fs_1.writeFileSync)((0, src_1.getSystemPath)(path), new Uint8Array(content));
|
|
147
123
|
obs.next();
|
|
148
124
|
obs.complete();
|
|
149
125
|
});
|
|
150
126
|
}
|
|
151
127
|
read(path) {
|
|
152
128
|
return new rxjs_1.Observable((obs) => {
|
|
153
|
-
const buffer = (0,
|
|
129
|
+
const buffer = (0, node_fs_1.readFileSync)((0, src_1.getSystemPath)(path));
|
|
154
130
|
obs.next(new Uint8Array(buffer).buffer);
|
|
155
131
|
obs.complete();
|
|
156
132
|
});
|
|
157
133
|
}
|
|
158
134
|
delete(path) {
|
|
159
135
|
return new rxjs_1.Observable((obs) => {
|
|
160
|
-
|
|
136
|
+
(0, node_fs_1.rmSync)((0, src_1.getSystemPath)(path), { force: true, recursive: true, maxRetries: 3 });
|
|
161
137
|
obs.complete();
|
|
162
138
|
});
|
|
163
139
|
}
|
|
164
140
|
rename(from, to) {
|
|
165
141
|
return new rxjs_1.Observable((obs) => {
|
|
166
142
|
const toSystemPath = (0, src_1.getSystemPath)(to);
|
|
167
|
-
(0,
|
|
168
|
-
(0,
|
|
143
|
+
(0, node_fs_1.mkdirSync)((0, node_path_1.dirname)(toSystemPath), { recursive: true });
|
|
144
|
+
(0, node_fs_1.renameSync)((0, src_1.getSystemPath)(from), toSystemPath);
|
|
169
145
|
obs.next();
|
|
170
146
|
obs.complete();
|
|
171
147
|
});
|
|
172
148
|
}
|
|
173
149
|
list(path) {
|
|
174
150
|
return new rxjs_1.Observable((obs) => {
|
|
175
|
-
const names = (0,
|
|
151
|
+
const names = (0, node_fs_1.readdirSync)((0, src_1.getSystemPath)(path));
|
|
176
152
|
obs.next(names.map((name) => (0, src_1.fragment)(name)));
|
|
177
153
|
obs.complete();
|
|
178
154
|
});
|
|
179
155
|
}
|
|
180
156
|
exists(path) {
|
|
181
157
|
return new rxjs_1.Observable((obs) => {
|
|
182
|
-
obs.next((0,
|
|
158
|
+
obs.next((0, node_fs_1.existsSync)((0, src_1.getSystemPath)(path)));
|
|
183
159
|
obs.complete();
|
|
184
160
|
});
|
|
185
161
|
}
|
|
@@ -194,7 +170,7 @@ class NodeJsSyncHost {
|
|
|
194
170
|
// Some hosts may not support stat.
|
|
195
171
|
stat(path) {
|
|
196
172
|
return new rxjs_1.Observable((obs) => {
|
|
197
|
-
obs.next((0,
|
|
173
|
+
obs.next((0, node_fs_1.statSync)((0, src_1.getSystemPath)(path)));
|
|
198
174
|
obs.complete();
|
|
199
175
|
});
|
|
200
176
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@angular-devkit/core",
|
|
3
|
-
"version": "15.0.
|
|
3
|
+
"version": "15.1.0-next.0",
|
|
4
4
|
"description": "Angular DevKit - Core Utility Library",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"typings": "src/index.d.ts",
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
],
|
|
15
15
|
"dependencies": {
|
|
16
16
|
"ajv-formats": "2.1.1",
|
|
17
|
-
"ajv": "8.11.
|
|
17
|
+
"ajv": "8.11.2",
|
|
18
18
|
"jsonc-parser": "3.2.0",
|
|
19
19
|
"rxjs": "6.6.7",
|
|
20
20
|
"source-map": "0.7.4"
|