@atlaspack/fs 2.15.26 → 2.15.27
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/CHANGELOG.md +12 -0
- package/dist/MemoryFS.js +804 -0
- package/dist/NodeFS.browser.js +10 -0
- package/dist/NodeFS.js +251 -0
- package/dist/NodeVCSAwareFS.js +193 -0
- package/dist/OverlayFS.js +350 -0
- package/dist/find.js +68 -0
- package/dist/index.js +47 -0
- package/package.json +7 -8
- package/tsconfig.json +28 -2
- package/tsconfig.tsbuildinfo +1 -0
|
@@ -0,0 +1,350 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.OverlayFS = void 0;
|
|
7
|
+
const build_cache_1 = require("@atlaspack/build-cache");
|
|
8
|
+
const workers_1 = __importDefault(require("@atlaspack/workers"));
|
|
9
|
+
const package_json_1 = __importDefault(require("../package.json"));
|
|
10
|
+
const find_1 = require("./find");
|
|
11
|
+
const MemoryFS_1 = require("./MemoryFS");
|
|
12
|
+
const nullthrows_1 = __importDefault(require("nullthrows"));
|
|
13
|
+
const path_1 = __importDefault(require("path"));
|
|
14
|
+
class OverlayFS {
|
|
15
|
+
constructor(workerFarmOrFS, readable) {
|
|
16
|
+
this.deleted = new Set();
|
|
17
|
+
if (workerFarmOrFS instanceof workers_1.default) {
|
|
18
|
+
this.writable = new MemoryFS_1.MemoryFS(workerFarmOrFS);
|
|
19
|
+
}
|
|
20
|
+
else {
|
|
21
|
+
this.writable = workerFarmOrFS;
|
|
22
|
+
}
|
|
23
|
+
this.readable = readable;
|
|
24
|
+
this._cwd = readable.cwd();
|
|
25
|
+
}
|
|
26
|
+
static deserialize(opts) {
|
|
27
|
+
let fs = new OverlayFS(opts.writable, opts.readable);
|
|
28
|
+
if (opts.deleted != null)
|
|
29
|
+
fs.deleted = opts.deleted;
|
|
30
|
+
return fs;
|
|
31
|
+
}
|
|
32
|
+
serialize() {
|
|
33
|
+
return {
|
|
34
|
+
$$raw: false,
|
|
35
|
+
writable: this.writable,
|
|
36
|
+
readable: this.readable,
|
|
37
|
+
deleted: this.deleted,
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
_deletedThrows(filePath) {
|
|
41
|
+
filePath = this._normalizePath(filePath);
|
|
42
|
+
if (this.deleted.has(filePath)) {
|
|
43
|
+
throw new FSError('ENOENT', filePath, 'does not exist');
|
|
44
|
+
}
|
|
45
|
+
return filePath;
|
|
46
|
+
}
|
|
47
|
+
_checkExists(filePath) {
|
|
48
|
+
filePath = this._deletedThrows(filePath);
|
|
49
|
+
if (!this.existsSync(filePath)) {
|
|
50
|
+
throw new FSError('ENOENT', filePath, 'does not exist');
|
|
51
|
+
}
|
|
52
|
+
return filePath;
|
|
53
|
+
}
|
|
54
|
+
_isSymlink(filePath) {
|
|
55
|
+
filePath = this._normalizePath(filePath);
|
|
56
|
+
// Check the parts of the path to see if any are symlinks.
|
|
57
|
+
let { root, dir, base } = path_1.default.parse(filePath);
|
|
58
|
+
let segments = dir.slice(root.length).split(path_1.default.sep).concat(base);
|
|
59
|
+
while (segments.length) {
|
|
60
|
+
filePath = path_1.default.join(root, ...segments);
|
|
61
|
+
let name = segments.pop();
|
|
62
|
+
if (this.deleted.has(filePath)) {
|
|
63
|
+
return false;
|
|
64
|
+
}
|
|
65
|
+
else if (this.writable instanceof MemoryFS_1.MemoryFS &&
|
|
66
|
+
this.writable.symlinks.has(filePath)) {
|
|
67
|
+
return true;
|
|
68
|
+
}
|
|
69
|
+
else {
|
|
70
|
+
// HACK: Atlaspack fs does not provide `lstatSync`,
|
|
71
|
+
// so we use `readdirSync` to check if the path is a symlink.
|
|
72
|
+
let parent = path_1.default.resolve(filePath, '..');
|
|
73
|
+
if (parent === filePath) {
|
|
74
|
+
return false;
|
|
75
|
+
}
|
|
76
|
+
try {
|
|
77
|
+
for (let dirent of this.readdirSync(parent, { withFileTypes: true })) {
|
|
78
|
+
if (typeof dirent === 'string') {
|
|
79
|
+
break; // {withFileTypes: true} not supported
|
|
80
|
+
}
|
|
81
|
+
else if (dirent.name === name) {
|
|
82
|
+
if (dirent.isSymbolicLink()) {
|
|
83
|
+
return true;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
catch (e) {
|
|
89
|
+
if (e.code === 'ENOENT') {
|
|
90
|
+
return false;
|
|
91
|
+
}
|
|
92
|
+
throw e;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
return false;
|
|
97
|
+
}
|
|
98
|
+
async _copyPathForWrite(filePath) {
|
|
99
|
+
filePath = await this._normalizePath(filePath);
|
|
100
|
+
let dirPath = path_1.default.dirname(filePath);
|
|
101
|
+
if (this.existsSync(dirPath) && !this.writable.existsSync(dirPath)) {
|
|
102
|
+
await this.writable.mkdirp(dirPath);
|
|
103
|
+
}
|
|
104
|
+
return filePath;
|
|
105
|
+
}
|
|
106
|
+
_normalizePath(filePath) {
|
|
107
|
+
return path_1.default.resolve(this.cwd(), filePath);
|
|
108
|
+
}
|
|
109
|
+
// eslint-disable-next-line require-await
|
|
110
|
+
async readFile(filePath, encoding) {
|
|
111
|
+
return this.readFileSync(filePath, encoding);
|
|
112
|
+
}
|
|
113
|
+
async writeFile(filePath, contents, options) {
|
|
114
|
+
filePath = await this._copyPathForWrite(filePath);
|
|
115
|
+
await this.writable.writeFile(filePath, contents, options);
|
|
116
|
+
this.deleted.delete(filePath);
|
|
117
|
+
}
|
|
118
|
+
async copyFile(source, destination) {
|
|
119
|
+
source = this._normalizePath(source);
|
|
120
|
+
destination = await this._copyPathForWrite(destination);
|
|
121
|
+
if (await this.writable.exists(source)) {
|
|
122
|
+
await this.writable.writeFile(destination, await this.writable.readFile(source));
|
|
123
|
+
}
|
|
124
|
+
else {
|
|
125
|
+
await this.writable.writeFile(destination, await this.readable.readFile(source));
|
|
126
|
+
}
|
|
127
|
+
this.deleted.delete(destination);
|
|
128
|
+
}
|
|
129
|
+
// eslint-disable-next-line require-await
|
|
130
|
+
async stat(filePath) {
|
|
131
|
+
return this.statSync(filePath);
|
|
132
|
+
}
|
|
133
|
+
async symlink(target, filePath) {
|
|
134
|
+
target = this._normalizePath(target);
|
|
135
|
+
filePath = this._normalizePath(filePath);
|
|
136
|
+
await this.writable.symlink(target, filePath);
|
|
137
|
+
this.deleted.delete(filePath);
|
|
138
|
+
}
|
|
139
|
+
async unlink(filePath) {
|
|
140
|
+
filePath = this._normalizePath(filePath);
|
|
141
|
+
let toDelete = [filePath];
|
|
142
|
+
if (this.writable instanceof MemoryFS_1.MemoryFS && this._isSymlink(filePath)) {
|
|
143
|
+
this.writable.symlinks.delete(filePath);
|
|
144
|
+
}
|
|
145
|
+
else if (this.statSync(filePath).isDirectory()) {
|
|
146
|
+
let stack = [filePath];
|
|
147
|
+
// Recursively add every descendant path to deleted.
|
|
148
|
+
while (stack.length) {
|
|
149
|
+
let root = (0, nullthrows_1.default)(stack.pop());
|
|
150
|
+
for (let ent of this.readdirSync(root, { withFileTypes: true })) {
|
|
151
|
+
if (typeof ent === 'string') {
|
|
152
|
+
let childPath = path_1.default.join(root, ent);
|
|
153
|
+
toDelete.push(childPath);
|
|
154
|
+
if (this.statSync(childPath).isDirectory()) {
|
|
155
|
+
stack.push(childPath);
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
else {
|
|
159
|
+
let childPath = path_1.default.join(root, ent.name);
|
|
160
|
+
toDelete.push(childPath);
|
|
161
|
+
if (ent.isDirectory()) {
|
|
162
|
+
stack.push(childPath);
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
try {
|
|
169
|
+
await this.writable.unlink(filePath);
|
|
170
|
+
}
|
|
171
|
+
catch (e) {
|
|
172
|
+
if (e.code === 'ENOENT' && !this.readable.existsSync(filePath)) {
|
|
173
|
+
throw e;
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
for (let pathToDelete of toDelete) {
|
|
177
|
+
this.deleted.add(pathToDelete);
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
async mkdirp(dir) {
|
|
181
|
+
dir = this._normalizePath(dir);
|
|
182
|
+
await this.writable.mkdirp(dir);
|
|
183
|
+
if (this.deleted != null) {
|
|
184
|
+
let root = path_1.default.parse(dir).root;
|
|
185
|
+
while (dir !== root) {
|
|
186
|
+
this.deleted.delete(dir);
|
|
187
|
+
dir = path_1.default.dirname(dir);
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
async rimraf(filePath) {
|
|
192
|
+
try {
|
|
193
|
+
await this.unlink(filePath);
|
|
194
|
+
}
|
|
195
|
+
catch (e) {
|
|
196
|
+
// noop
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
// eslint-disable-next-line require-await
|
|
200
|
+
async ncp(source, destination) {
|
|
201
|
+
// TODO: Implement this correctly.
|
|
202
|
+
return this.writable.ncp(source, destination);
|
|
203
|
+
}
|
|
204
|
+
createReadStream(filePath, opts) {
|
|
205
|
+
filePath = this._deletedThrows(filePath);
|
|
206
|
+
if (this.writable.existsSync(filePath)) {
|
|
207
|
+
return this.writable.createReadStream(filePath, opts);
|
|
208
|
+
}
|
|
209
|
+
return this.readable.createReadStream(filePath, opts);
|
|
210
|
+
}
|
|
211
|
+
createWriteStream(path, opts) {
|
|
212
|
+
path = this._normalizePath(path);
|
|
213
|
+
this.deleted.delete(path);
|
|
214
|
+
return this.writable.createWriteStream(path, opts);
|
|
215
|
+
}
|
|
216
|
+
cwd() {
|
|
217
|
+
return this._cwd;
|
|
218
|
+
}
|
|
219
|
+
chdir(path) {
|
|
220
|
+
this._cwd = this._checkExists(path);
|
|
221
|
+
}
|
|
222
|
+
// eslint-disable-next-line require-await
|
|
223
|
+
async realpath(filePath) {
|
|
224
|
+
return this.realpathSync(filePath);
|
|
225
|
+
}
|
|
226
|
+
readFileSync(filePath, encoding) {
|
|
227
|
+
filePath = this.realpathSync(filePath);
|
|
228
|
+
try {
|
|
229
|
+
// @ts-expect-error TS2345
|
|
230
|
+
return this.writable.readFileSync(filePath, encoding);
|
|
231
|
+
}
|
|
232
|
+
catch (err) {
|
|
233
|
+
// @ts-expect-error TS2345
|
|
234
|
+
return this.readable.readFileSync(filePath, encoding);
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
statSync(filePath) {
|
|
238
|
+
filePath = this._normalizePath(filePath);
|
|
239
|
+
try {
|
|
240
|
+
return this.writable.statSync(filePath);
|
|
241
|
+
}
|
|
242
|
+
catch (e) {
|
|
243
|
+
if (e.code === 'ENOENT' && this.existsSync(filePath)) {
|
|
244
|
+
return this.readable.statSync(filePath);
|
|
245
|
+
}
|
|
246
|
+
throw e;
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
realpathSync(filePath) {
|
|
250
|
+
filePath = this._deletedThrows(filePath);
|
|
251
|
+
filePath = this._deletedThrows(this.writable.realpathSync(filePath));
|
|
252
|
+
if (!this.writable.existsSync(filePath)) {
|
|
253
|
+
return this.readable.realpathSync(filePath);
|
|
254
|
+
}
|
|
255
|
+
return filePath;
|
|
256
|
+
}
|
|
257
|
+
// eslint-disable-next-line require-await
|
|
258
|
+
async exists(filePath) {
|
|
259
|
+
return this.existsSync(filePath);
|
|
260
|
+
}
|
|
261
|
+
existsSync(filePath) {
|
|
262
|
+
filePath = this._normalizePath(filePath);
|
|
263
|
+
if (this.deleted.has(filePath))
|
|
264
|
+
return false;
|
|
265
|
+
try {
|
|
266
|
+
filePath = this.realpathSync(filePath);
|
|
267
|
+
}
|
|
268
|
+
catch (err) {
|
|
269
|
+
if (err.code !== 'ENOENT')
|
|
270
|
+
throw err;
|
|
271
|
+
}
|
|
272
|
+
if (this.deleted.has(filePath))
|
|
273
|
+
return false;
|
|
274
|
+
return (this.writable.existsSync(filePath) || this.readable.existsSync(filePath));
|
|
275
|
+
}
|
|
276
|
+
// eslint-disable-next-line require-await
|
|
277
|
+
async readdir(path, opts) {
|
|
278
|
+
return this.readdirSync(path, opts);
|
|
279
|
+
}
|
|
280
|
+
readdirSync(dir, opts) {
|
|
281
|
+
dir = this.realpathSync(dir);
|
|
282
|
+
// Read from both filesystems and merge the results
|
|
283
|
+
let entries = new Map();
|
|
284
|
+
try {
|
|
285
|
+
// @ts-expect-error TS2769
|
|
286
|
+
for (let entry of this.writable.readdirSync(dir, opts)) {
|
|
287
|
+
let filePath = path_1.default.join(dir, entry.name ?? entry);
|
|
288
|
+
if (this.deleted.has(filePath))
|
|
289
|
+
continue;
|
|
290
|
+
entries.set(filePath, entry);
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
catch {
|
|
294
|
+
// noop
|
|
295
|
+
}
|
|
296
|
+
try {
|
|
297
|
+
// @ts-expect-error TS2769
|
|
298
|
+
for (let entry of this.readable.readdirSync(dir, opts)) {
|
|
299
|
+
let filePath = path_1.default.join(dir, entry.name ?? entry);
|
|
300
|
+
if (this.deleted.has(filePath))
|
|
301
|
+
continue;
|
|
302
|
+
if (entries.has(filePath))
|
|
303
|
+
continue;
|
|
304
|
+
entries.set(filePath, entry);
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
catch {
|
|
308
|
+
// noop
|
|
309
|
+
}
|
|
310
|
+
return Array.from(entries.values());
|
|
311
|
+
}
|
|
312
|
+
async watch(dir, fn, opts) {
|
|
313
|
+
let writableSubscription = await this.writable.watch(dir, fn, opts);
|
|
314
|
+
let readableSubscription = await this.readable.watch(dir, fn, opts);
|
|
315
|
+
return {
|
|
316
|
+
unsubscribe: async () => {
|
|
317
|
+
await writableSubscription.unsubscribe();
|
|
318
|
+
await readableSubscription.unsubscribe();
|
|
319
|
+
},
|
|
320
|
+
};
|
|
321
|
+
}
|
|
322
|
+
async getEventsSince(dir, snapshot, opts) {
|
|
323
|
+
let writableEvents = await this.writable.getEventsSince(dir, snapshot, opts);
|
|
324
|
+
let readableEvents = await this.readable.getEventsSince(dir, snapshot, opts);
|
|
325
|
+
return [...writableEvents, ...readableEvents];
|
|
326
|
+
}
|
|
327
|
+
async writeSnapshot(dir, snapshot, opts) {
|
|
328
|
+
await this.writable.writeSnapshot(dir, snapshot, opts);
|
|
329
|
+
}
|
|
330
|
+
findAncestorFile(fileNames, fromDir, root) {
|
|
331
|
+
return (0, find_1.findAncestorFile)(this, fileNames, fromDir, root);
|
|
332
|
+
}
|
|
333
|
+
findNodeModule(moduleName, fromDir) {
|
|
334
|
+
return (0, find_1.findNodeModule)(this, moduleName, fromDir);
|
|
335
|
+
}
|
|
336
|
+
findFirstFile(filePaths) {
|
|
337
|
+
return (0, find_1.findFirstFile)(this, filePaths);
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
exports.OverlayFS = OverlayFS;
|
|
341
|
+
class FSError extends Error {
|
|
342
|
+
constructor(code, path, message) {
|
|
343
|
+
super(`${code}: ${path} ${message}`);
|
|
344
|
+
this.name = 'FSError';
|
|
345
|
+
this.code = code;
|
|
346
|
+
this.path = path;
|
|
347
|
+
Error.captureStackTrace?.(this, this.constructor);
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
(0, build_cache_1.registerSerializableClass)(`${package_json_1.default.version}:OverlayFS`, OverlayFS);
|
package/dist/find.js
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.findNodeModule = findNodeModule;
|
|
7
|
+
exports.findAncestorFile = findAncestorFile;
|
|
8
|
+
exports.findFirstFile = findFirstFile;
|
|
9
|
+
const path_1 = __importDefault(require("path"));
|
|
10
|
+
function findNodeModule(fs, moduleName, dir) {
|
|
11
|
+
let { root } = path_1.default.parse(dir);
|
|
12
|
+
while (dir !== root) {
|
|
13
|
+
// Skip node_modules directories
|
|
14
|
+
if (path_1.default.basename(dir) === 'node_modules') {
|
|
15
|
+
dir = path_1.default.dirname(dir);
|
|
16
|
+
}
|
|
17
|
+
try {
|
|
18
|
+
let moduleDir = path_1.default.join(dir, 'node_modules', moduleName);
|
|
19
|
+
let stats = fs.statSync(moduleDir);
|
|
20
|
+
if (stats.isDirectory()) {
|
|
21
|
+
return moduleDir;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
catch (err) {
|
|
25
|
+
// ignore
|
|
26
|
+
}
|
|
27
|
+
// Move up a directory
|
|
28
|
+
dir = path_1.default.dirname(dir);
|
|
29
|
+
}
|
|
30
|
+
return null;
|
|
31
|
+
}
|
|
32
|
+
function findAncestorFile(fs, fileNames, dir, root) {
|
|
33
|
+
let { root: pathRoot } = path_1.default.parse(dir);
|
|
34
|
+
// eslint-disable-next-line no-constant-condition
|
|
35
|
+
while (true) {
|
|
36
|
+
if (path_1.default.basename(dir) === 'node_modules') {
|
|
37
|
+
return null;
|
|
38
|
+
}
|
|
39
|
+
for (const fileName of fileNames) {
|
|
40
|
+
let filePath = path_1.default.join(dir, fileName);
|
|
41
|
+
try {
|
|
42
|
+
if (fs.statSync(filePath).isFile()) {
|
|
43
|
+
return filePath;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
catch (err) {
|
|
47
|
+
// ignore
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
if (dir === root || dir === pathRoot) {
|
|
51
|
+
break;
|
|
52
|
+
}
|
|
53
|
+
dir = path_1.default.dirname(dir);
|
|
54
|
+
}
|
|
55
|
+
return null;
|
|
56
|
+
}
|
|
57
|
+
function findFirstFile(fs, filePaths) {
|
|
58
|
+
for (let filePath of filePaths) {
|
|
59
|
+
try {
|
|
60
|
+
if (fs.statSync(filePath).isFile()) {
|
|
61
|
+
return filePath;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
catch (err) {
|
|
65
|
+
// ignore
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
17
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
18
|
+
};
|
|
19
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
|
+
exports.ncp = ncp;
|
|
21
|
+
const path_1 = __importDefault(require("path"));
|
|
22
|
+
const stream_1 = __importDefault(require("stream"));
|
|
23
|
+
const util_1 = require("util");
|
|
24
|
+
__exportStar(require("./NodeFS"), exports);
|
|
25
|
+
__exportStar(require("./MemoryFS"), exports);
|
|
26
|
+
__exportStar(require("./OverlayFS"), exports);
|
|
27
|
+
__exportStar(require("./NodeVCSAwareFS"), exports);
|
|
28
|
+
const pipeline = (0, util_1.promisify)(stream_1.default.pipeline);
|
|
29
|
+
// Recursively copies a directory from the sourceFS to the destinationFS
|
|
30
|
+
async function ncp(sourceFS, source, destinationFS, destination, filter) {
|
|
31
|
+
await destinationFS.mkdirp(destination);
|
|
32
|
+
let files = await sourceFS.readdir(source);
|
|
33
|
+
for (let file of files) {
|
|
34
|
+
if (filter && !filter(file)) {
|
|
35
|
+
continue;
|
|
36
|
+
}
|
|
37
|
+
let sourcePath = path_1.default.join(source, file);
|
|
38
|
+
let destPath = path_1.default.join(destination, file);
|
|
39
|
+
let stats = await sourceFS.stat(sourcePath);
|
|
40
|
+
if (stats.isFile()) {
|
|
41
|
+
await pipeline(sourceFS.createReadStream(sourcePath), destinationFS.createWriteStream(destPath));
|
|
42
|
+
}
|
|
43
|
+
else if (stats.isDirectory()) {
|
|
44
|
+
await ncp(sourceFS, sourcePath, destinationFS, destPath, filter);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaspack/fs",
|
|
3
|
-
"version": "2.15.
|
|
3
|
+
"version": "2.15.27",
|
|
4
4
|
"description": "Blazing fast, zero configuration web application bundler",
|
|
5
5
|
"license": "(MIT OR Apache-2.0)",
|
|
6
6
|
"publishConfig": {
|
|
@@ -46,18 +46,17 @@
|
|
|
46
46
|
}
|
|
47
47
|
},
|
|
48
48
|
"scripts": {
|
|
49
|
-
"check-ts": "tsc --emitDeclarationOnly --rootDir src",
|
|
50
49
|
"build:lib": "gulp build --gulpfile ../../../gulpfile.js --cwd ."
|
|
51
50
|
},
|
|
52
51
|
"dependencies": {
|
|
53
52
|
"@atlaspack/build-cache": "2.13.6",
|
|
54
|
-
"@atlaspack/feature-flags": "2.25.
|
|
55
|
-
"@atlaspack/logger": "2.14.
|
|
56
|
-
"@atlaspack/rust": "3.8.
|
|
57
|
-
"@atlaspack/types-internal": "2.20.
|
|
53
|
+
"@atlaspack/feature-flags": "2.25.2",
|
|
54
|
+
"@atlaspack/logger": "2.14.24",
|
|
55
|
+
"@atlaspack/rust": "3.8.2",
|
|
56
|
+
"@atlaspack/types-internal": "2.20.2",
|
|
58
57
|
"@parcel/watcher": "^2.0.7",
|
|
59
|
-
"@atlaspack/workers": "2.14.
|
|
60
|
-
"@atlaspack/watcher-watchman-js": "2.14.
|
|
58
|
+
"@atlaspack/workers": "2.14.32",
|
|
59
|
+
"@atlaspack/watcher-watchman-js": "2.14.32",
|
|
61
60
|
"graceful-fs": "^4.2.4",
|
|
62
61
|
"ncp": "^2.0.0",
|
|
63
62
|
"nullthrows": "^1.1.1",
|
package/tsconfig.json
CHANGED
|
@@ -1,4 +1,30 @@
|
|
|
1
1
|
{
|
|
2
|
-
"extends": "../../../tsconfig.json",
|
|
3
|
-
"include": ["src"]
|
|
2
|
+
"extends": "../../../tsconfig.base.json",
|
|
3
|
+
"include": ["./src/", "./package.json"],
|
|
4
|
+
"compilerOptions": {
|
|
5
|
+
"composite": true
|
|
6
|
+
},
|
|
7
|
+
"references": [
|
|
8
|
+
{
|
|
9
|
+
"path": "../../utils/atlaspack-watcher-watchman-js/tsconfig.json"
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
"path": "../build-cache/tsconfig.json"
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
"path": "../feature-flags/tsconfig.json"
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
"path": "../logger/tsconfig.json"
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
"path": "../rust/tsconfig.json"
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
"path": "../types-internal/tsconfig.json"
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
"path": "../workers/tsconfig.json"
|
|
28
|
+
}
|
|
29
|
+
]
|
|
4
30
|
}
|