@atlaspack/fs 2.12.1-dev.3478 → 2.12.1-dev.3520
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/lib/browser.js +169 -168
- package/lib/browser.js.map +1 -1
- package/lib/index.js +341 -340
- package/lib/index.js.map +1 -1
- package/package.json +11 -13
- package/src/MemoryFS.js +7 -2
- package/src/NodeFS.js +1 -1
- package/src/NodeVCSAwareFS.js +79 -0
- package/src/OverlayFS.js +1 -1
- package/test/OverlayFS.test.js +1 -1
package/lib/browser.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
var $
|
|
2
|
-
var $
|
|
3
|
-
var $
|
|
4
|
-
var $
|
|
5
|
-
var $
|
|
6
|
-
var $
|
|
7
|
-
var $
|
|
8
|
-
var $
|
|
1
|
+
var $8sOVI$path = require("path");
|
|
2
|
+
var $8sOVI$stream = require("stream");
|
|
3
|
+
var $8sOVI$util = require("util");
|
|
4
|
+
var $8sOVI$buffer = require("buffer");
|
|
5
|
+
var $8sOVI$atlaspackbuildcache = require("@atlaspack/build-cache");
|
|
6
|
+
var $8sOVI$atlaspackutils = require("@atlaspack/utils");
|
|
7
|
+
var $8sOVI$atlaspackworkers = require("@atlaspack/workers");
|
|
8
|
+
var $8sOVI$events = require("events");
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
function $parcel$interopDefault(a) {
|
|
@@ -33,77 +33,77 @@ function $parcel$export(e, n, v, s) {
|
|
|
33
33
|
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
-
$parcel$export(module.exports, "ncp", () => $
|
|
36
|
+
$parcel$export(module.exports, "ncp", () => $42d1854b7a928fd5$export$d3a8044e3fef7335);
|
|
37
37
|
|
|
38
38
|
|
|
39
39
|
|
|
40
|
-
var $
|
|
40
|
+
var $87241760c4ff27c3$exports = {};
|
|
41
41
|
|
|
42
|
-
$parcel$export($
|
|
42
|
+
$parcel$export($87241760c4ff27c3$exports, "NodeFS", () => $87241760c4ff27c3$export$c4e0ef2ab73c21e7);
|
|
43
43
|
// $FlowFixMe[prop-missing] handled by the throwing constructor
|
|
44
|
-
class $
|
|
44
|
+
class $87241760c4ff27c3$export$c4e0ef2ab73c21e7 {
|
|
45
45
|
constructor(){
|
|
46
46
|
throw new Error("NodeFS isn't available in the browser");
|
|
47
47
|
}
|
|
48
48
|
}
|
|
49
49
|
|
|
50
50
|
|
|
51
|
-
var $
|
|
51
|
+
var $a44e20ab74dfaf6b$exports = {};
|
|
52
52
|
|
|
53
|
-
$parcel$export($
|
|
54
|
-
$parcel$export($
|
|
55
|
-
$parcel$export($
|
|
56
|
-
$parcel$export($
|
|
53
|
+
$parcel$export($a44e20ab74dfaf6b$exports, "MemoryFS", () => $a44e20ab74dfaf6b$export$3048eb7ec07c2c4e);
|
|
54
|
+
$parcel$export($a44e20ab74dfaf6b$exports, "FSError", () => $a44e20ab74dfaf6b$export$d414276624ebf134);
|
|
55
|
+
$parcel$export($a44e20ab74dfaf6b$exports, "makeShared", () => $a44e20ab74dfaf6b$export$df9eb3e75aa27a22);
|
|
56
|
+
$parcel$export($a44e20ab74dfaf6b$exports, "File", () => $a44e20ab74dfaf6b$export$b6afa8811b7e644e);
|
|
57
57
|
|
|
58
58
|
|
|
59
59
|
|
|
60
60
|
|
|
61
|
-
var $
|
|
62
|
-
$
|
|
61
|
+
var $867c50d101d36a7d$exports = {};
|
|
62
|
+
$867c50d101d36a7d$exports = JSON.parse("{\"name\":\"@atlaspack/fs\",\"version\":\"2.12.1-dev.3520+8a5346e28\",\"description\":\"Blazing fast, zero configuration web application bundler\",\"license\":\"(MIT OR Apache-2.0)\",\"publishConfig\":{\"access\":\"public\"},\"repository\":{\"type\":\"git\",\"url\":\"https://github.com/atlassian-labs/atlaspack.git\"},\"main\":\"lib/index.js\",\"source\":\"src/index.js\",\"types\":\"index.d.ts\",\"engines\":{\"node\":\">= 16.0.0\"},\"targets\":{\"types\":false,\"main\":{\"includeNodeModules\":{\"@atlaspack/build-cache\":false,\"@atlaspack/feature-flags\":false,\"@atlaspack/rust\":false,\"@atlaspack/types-internal\":false,\"@atlaspack/utils\":false,\"@atlaspack/watcher-watchman-js\":false,\"@parcel/watcher\":false,\"@atlaspack/workers\":false}},\"browser\":{\"includeNodeModules\":{\"@atlaspack/build-cache\":false,\"@atlaspack/feature-flags\":false,\"@atlaspack/rust\":false,\"@atlaspack/types-internal\":false,\"@atlaspack/utils\":false,\"@atlaspack/watcher-watchman-js\":false,\"@parcel/watcher\":false,\"@atlaspack/workers\":false}}},\"scripts\":{\"build-ts\":\"mkdir -p lib && flow-to-ts src/types.js > lib/types.d.ts\",\"check-ts\":\"tsc --noEmit index.d.ts\"},\"dependencies\":{\"@atlaspack/build-cache\":\"2.12.1-dev.3520+8a5346e28\",\"@atlaspack/feature-flags\":\"2.12.1-dev.3520+8a5346e28\",\"@atlaspack/rust\":\"2.12.1-dev.3520+8a5346e28\",\"@atlaspack/types-internal\":\"2.12.1-dev.3520+8a5346e28\",\"@atlaspack/utils\":\"2.12.1-dev.3520+8a5346e28\",\"@atlaspack/workers\":\"2.12.1-dev.3520+8a5346e28\",\"@parcel/watcher\":\"^2.0.7\"},\"devDependencies\":{\"@atlaspack/watcher-watchman-js\":\"2.12.1-dev.3520+8a5346e28\",\"graceful-fs\":\"^4.2.4\",\"ncp\":\"^2.0.0\",\"nullthrows\":\"^1.1.1\",\"utility-types\":\"^3.10.0\"},\"browser\":{\"@atlaspack/fs\":\"./lib/browser.js\",\"./src/NodeFS.js\":\"./src/NodeFS.browser.js\"},\"gitHead\":\"8a5346e28c1bb3b9cd40f1c4e77c66dd6666f1e4\"}");
|
|
63
63
|
|
|
64
64
|
|
|
65
65
|
|
|
66
|
-
var $
|
|
66
|
+
var $7b68cc90d1a072a1$exports = {};
|
|
67
67
|
'use strict';
|
|
68
|
-
function $
|
|
68
|
+
function $7b68cc90d1a072a1$var$nullthrows(x, message) {
|
|
69
69
|
if (x != null) return x;
|
|
70
70
|
var error = new Error(message !== undefined ? message : 'Got unexpected ' + x);
|
|
71
71
|
error.framesToPop = 1; // Skip nullthrows's own stack frame.
|
|
72
72
|
throw error;
|
|
73
73
|
}
|
|
74
|
-
$
|
|
75
|
-
$
|
|
76
|
-
Object.defineProperty($
|
|
74
|
+
$7b68cc90d1a072a1$exports = $7b68cc90d1a072a1$var$nullthrows;
|
|
75
|
+
$7b68cc90d1a072a1$exports.default = $7b68cc90d1a072a1$var$nullthrows;
|
|
76
|
+
Object.defineProperty($7b68cc90d1a072a1$exports, '__esModule', {
|
|
77
77
|
value: true
|
|
78
78
|
});
|
|
79
79
|
|
|
80
80
|
|
|
81
81
|
|
|
82
82
|
|
|
83
|
-
function $
|
|
84
|
-
let { root: root } = (0, ($parcel$interopDefault($
|
|
83
|
+
function $daab8b558e6f5694$export$4c6d088a7d7f9947(fs, moduleName, dir) {
|
|
84
|
+
let { root: root } = (0, ($parcel$interopDefault($8sOVI$path))).parse(dir);
|
|
85
85
|
while(dir !== root){
|
|
86
86
|
// Skip node_modules directories
|
|
87
|
-
if ((0, ($parcel$interopDefault($
|
|
87
|
+
if ((0, ($parcel$interopDefault($8sOVI$path))).basename(dir) === 'node_modules') dir = (0, ($parcel$interopDefault($8sOVI$path))).dirname(dir);
|
|
88
88
|
try {
|
|
89
|
-
let moduleDir = (0, ($parcel$interopDefault($
|
|
89
|
+
let moduleDir = (0, ($parcel$interopDefault($8sOVI$path))).join(dir, 'node_modules', moduleName);
|
|
90
90
|
let stats = fs.statSync(moduleDir);
|
|
91
91
|
if (stats.isDirectory()) return moduleDir;
|
|
92
92
|
} catch (err) {
|
|
93
93
|
// ignore
|
|
94
94
|
}
|
|
95
95
|
// Move up a directory
|
|
96
|
-
dir = (0, ($parcel$interopDefault($
|
|
96
|
+
dir = (0, ($parcel$interopDefault($8sOVI$path))).dirname(dir);
|
|
97
97
|
}
|
|
98
98
|
return null;
|
|
99
99
|
}
|
|
100
|
-
function $
|
|
101
|
-
let { root: pathRoot } = (0, ($parcel$interopDefault($
|
|
100
|
+
function $daab8b558e6f5694$export$d51a93c758976388(fs, fileNames, dir, root) {
|
|
101
|
+
let { root: pathRoot } = (0, ($parcel$interopDefault($8sOVI$path))).parse(dir);
|
|
102
102
|
// eslint-disable-next-line no-constant-condition
|
|
103
103
|
while(true){
|
|
104
|
-
if ((0, ($parcel$interopDefault($
|
|
104
|
+
if ((0, ($parcel$interopDefault($8sOVI$path))).basename(dir) === 'node_modules') return null;
|
|
105
105
|
for (const fileName of fileNames){
|
|
106
|
-
let filePath = (0, ($parcel$interopDefault($
|
|
106
|
+
let filePath = (0, ($parcel$interopDefault($8sOVI$path))).join(dir, fileName);
|
|
107
107
|
try {
|
|
108
108
|
if (fs.statSync(filePath).isFile()) return filePath;
|
|
109
109
|
} catch (err) {
|
|
@@ -111,11 +111,11 @@ function $b1261e905f7ec91b$export$d51a93c758976388(fs, fileNames, dir, root) {
|
|
|
111
111
|
}
|
|
112
112
|
}
|
|
113
113
|
if (dir === root || dir === pathRoot) break;
|
|
114
|
-
dir = (0, ($parcel$interopDefault($
|
|
114
|
+
dir = (0, ($parcel$interopDefault($8sOVI$path))).dirname(dir);
|
|
115
115
|
}
|
|
116
116
|
return null;
|
|
117
117
|
}
|
|
118
|
-
function $
|
|
118
|
+
function $daab8b558e6f5694$export$64df6e3182fd5b2d(fs, filePaths) {
|
|
119
119
|
for (let filePath of filePaths)try {
|
|
120
120
|
if (fs.statSync(filePath).isFile()) return filePath;
|
|
121
121
|
} catch (err) {
|
|
@@ -125,46 +125,46 @@ function $b1261e905f7ec91b$export$64df6e3182fd5b2d(fs, filePaths) {
|
|
|
125
125
|
|
|
126
126
|
|
|
127
127
|
|
|
128
|
-
var $
|
|
129
|
-
const $
|
|
130
|
-
let $
|
|
131
|
-
class $
|
|
128
|
+
var $a44e20ab74dfaf6b$require$Buffer = $8sOVI$buffer.Buffer;
|
|
129
|
+
const $a44e20ab74dfaf6b$var$instances = new Map();
|
|
130
|
+
let $a44e20ab74dfaf6b$var$id = 0;
|
|
131
|
+
class $a44e20ab74dfaf6b$export$3048eb7ec07c2c4e {
|
|
132
132
|
_numWorkerInstances = 0;
|
|
133
133
|
_workerRegisterResolves = [];
|
|
134
|
-
_emitter = new (0, ($parcel$interopDefault($
|
|
134
|
+
_emitter = new (0, ($parcel$interopDefault($8sOVI$events)))();
|
|
135
135
|
constructor(workerFarm){
|
|
136
136
|
this.farm = workerFarm;
|
|
137
|
-
this._cwd = (0, ($parcel$interopDefault($
|
|
137
|
+
this._cwd = (0, ($parcel$interopDefault($8sOVI$path))).resolve((0, ($parcel$interopDefault($8sOVI$path))).sep);
|
|
138
138
|
this.dirs = new Map([
|
|
139
139
|
[
|
|
140
140
|
this._cwd,
|
|
141
|
-
new $
|
|
141
|
+
new $a44e20ab74dfaf6b$var$Directory()
|
|
142
142
|
]
|
|
143
143
|
]);
|
|
144
144
|
this.files = new Map();
|
|
145
145
|
this.symlinks = new Map();
|
|
146
146
|
this.watchers = new Map();
|
|
147
147
|
this.events = [];
|
|
148
|
-
this.id = $
|
|
148
|
+
this.id = $a44e20ab74dfaf6b$var$id++;
|
|
149
149
|
this._workerHandles = [];
|
|
150
150
|
this._eventQueue = [];
|
|
151
|
-
$
|
|
151
|
+
$a44e20ab74dfaf6b$var$instances.set(this.id, this);
|
|
152
152
|
this._emitter.on('allWorkersRegistered', ()=>{
|
|
153
153
|
for (let resolve of this._workerRegisterResolves)resolve();
|
|
154
154
|
this._workerRegisterResolves = [];
|
|
155
155
|
});
|
|
156
156
|
}
|
|
157
157
|
static deserialize(opts) {
|
|
158
|
-
let existing = $
|
|
158
|
+
let existing = $a44e20ab74dfaf6b$var$instances.get(opts.id);
|
|
159
159
|
if (existing != null) {
|
|
160
160
|
// Correct the count of worker instances since serialization assumes a new instance is created
|
|
161
|
-
(0, ($parcel$interopDefault($
|
|
161
|
+
(0, ($parcel$interopDefault($8sOVI$atlaspackworkers))).getWorkerApi().runHandle(opts.handle, [
|
|
162
162
|
'decrementWorkerInstance',
|
|
163
163
|
[]
|
|
164
164
|
]);
|
|
165
165
|
return existing;
|
|
166
166
|
}
|
|
167
|
-
let fs = new $
|
|
167
|
+
let fs = new $a44e20ab74dfaf6b$var$WorkerFS(opts.id, (0, (/*@__PURE__*/$parcel$interopDefault($7b68cc90d1a072a1$exports)))(opts.handle));
|
|
168
168
|
fs.dirs = opts.dirs;
|
|
169
169
|
fs.files = opts.files;
|
|
170
170
|
fs.symlinks = opts.symlinks;
|
|
@@ -197,15 +197,15 @@ class $fd981db2f03c0168$export$3048eb7ec07c2c4e {
|
|
|
197
197
|
this._cwd = dir;
|
|
198
198
|
}
|
|
199
199
|
_normalizePath(filePath, realpath = true) {
|
|
200
|
-
filePath = (0, ($parcel$interopDefault($
|
|
201
|
-
if (!filePath.startsWith(this.cwd())) filePath = (0, ($parcel$interopDefault($
|
|
200
|
+
filePath = (0, ($parcel$interopDefault($8sOVI$path))).normalize(filePath);
|
|
201
|
+
if (!filePath.startsWith(this.cwd())) filePath = (0, ($parcel$interopDefault($8sOVI$path))).resolve(this.cwd(), filePath);
|
|
202
202
|
// get realpath by following symlinks
|
|
203
203
|
if (realpath) {
|
|
204
|
-
let { root: root, dir: dir, base: base } = (0, ($parcel$interopDefault($
|
|
205
|
-
let parts = dir.slice(root.length).split((0, ($parcel$interopDefault($
|
|
204
|
+
let { root: root, dir: dir, base: base } = (0, ($parcel$interopDefault($8sOVI$path))).parse(filePath);
|
|
205
|
+
let parts = dir.slice(root.length).split((0, ($parcel$interopDefault($8sOVI$path))).sep).concat(base);
|
|
206
206
|
let res = root;
|
|
207
207
|
for (let part of parts){
|
|
208
|
-
res = (0, ($parcel$interopDefault($
|
|
208
|
+
res = (0, ($parcel$interopDefault($8sOVI$path))).join(res, part);
|
|
209
209
|
let symlink = this.symlinks.get(res);
|
|
210
210
|
if (symlink) res = symlink;
|
|
211
211
|
}
|
|
@@ -215,16 +215,16 @@ class $fd981db2f03c0168$export$3048eb7ec07c2c4e {
|
|
|
215
215
|
}
|
|
216
216
|
async writeFile(filePath, contents, options) {
|
|
217
217
|
filePath = this._normalizePath(filePath);
|
|
218
|
-
if (this.dirs.has(filePath)) throw new $
|
|
219
|
-
let dir = (0, ($parcel$interopDefault($
|
|
220
|
-
if (!this.dirs.has(dir)) throw new $
|
|
221
|
-
let buffer = $
|
|
218
|
+
if (this.dirs.has(filePath)) throw new $a44e20ab74dfaf6b$export$d414276624ebf134('EISDIR', filePath, 'is a directory');
|
|
219
|
+
let dir = (0, ($parcel$interopDefault($8sOVI$path))).dirname(filePath);
|
|
220
|
+
if (!this.dirs.has(dir)) throw new $a44e20ab74dfaf6b$export$d414276624ebf134('ENOENT', dir, 'does not exist');
|
|
221
|
+
let buffer = $a44e20ab74dfaf6b$export$df9eb3e75aa27a22(contents);
|
|
222
222
|
let file = this.files.get(filePath);
|
|
223
223
|
let mode = options && options.mode || 438;
|
|
224
224
|
if (file) {
|
|
225
225
|
file.write(buffer, mode);
|
|
226
226
|
this.files.set(filePath, file);
|
|
227
|
-
} else this.files.set(filePath, new $
|
|
227
|
+
} else this.files.set(filePath, new $a44e20ab74dfaf6b$export$b6afa8811b7e644e(buffer, mode));
|
|
228
228
|
await this._sendWorkerEvent({
|
|
229
229
|
type: 'writeFile',
|
|
230
230
|
path: filePath,
|
|
@@ -242,7 +242,7 @@ class $fd981db2f03c0168$export$3048eb7ec07c2c4e {
|
|
|
242
242
|
readFileSync(filePath, encoding) {
|
|
243
243
|
filePath = this._normalizePath(filePath);
|
|
244
244
|
let file = this.files.get(filePath);
|
|
245
|
-
if (file == null) throw new $
|
|
245
|
+
if (file == null) throw new $a44e20ab74dfaf6b$export$d414276624ebf134('ENOENT', filePath, 'does not exist');
|
|
246
246
|
let buffer = file.read();
|
|
247
247
|
if (encoding) return buffer.toString(encoding);
|
|
248
248
|
return buffer;
|
|
@@ -256,7 +256,7 @@ class $fd981db2f03c0168$export$3048eb7ec07c2c4e {
|
|
|
256
256
|
let dir = this.dirs.get(filePath);
|
|
257
257
|
if (dir) return dir.stat();
|
|
258
258
|
let file = this.files.get(filePath);
|
|
259
|
-
if (file == null) throw new $
|
|
259
|
+
if (file == null) throw new $a44e20ab74dfaf6b$export$d414276624ebf134('ENOENT', filePath, 'does not exist');
|
|
260
260
|
return file.stat();
|
|
261
261
|
}
|
|
262
262
|
// eslint-disable-next-line require-await
|
|
@@ -265,26 +265,26 @@ class $fd981db2f03c0168$export$3048eb7ec07c2c4e {
|
|
|
265
265
|
}
|
|
266
266
|
readdirSync(dir, opts) {
|
|
267
267
|
dir = this._normalizePath(dir);
|
|
268
|
-
if (!this.dirs.has(dir)) throw new $
|
|
269
|
-
if (!dir.endsWith((0, ($parcel$interopDefault($
|
|
268
|
+
if (!this.dirs.has(dir)) throw new $a44e20ab74dfaf6b$export$d414276624ebf134('ENOENT', dir, 'does not exist');
|
|
269
|
+
if (!dir.endsWith((0, ($parcel$interopDefault($8sOVI$path))).sep)) dir += (0, ($parcel$interopDefault($8sOVI$path))).sep;
|
|
270
270
|
let res = [];
|
|
271
271
|
for (let [filePath, entry] of this.dirs){
|
|
272
272
|
if (filePath === dir) continue;
|
|
273
|
-
if (filePath.startsWith(dir) && filePath.indexOf((0, ($parcel$interopDefault($
|
|
273
|
+
if (filePath.startsWith(dir) && filePath.indexOf((0, ($parcel$interopDefault($8sOVI$path))).sep, dir.length) === -1) {
|
|
274
274
|
let name = filePath.slice(dir.length);
|
|
275
|
-
if (opts?.withFileTypes) res.push(new $
|
|
275
|
+
if (opts?.withFileTypes) res.push(new $a44e20ab74dfaf6b$var$Dirent(name, entry));
|
|
276
276
|
else res.push(name);
|
|
277
277
|
}
|
|
278
278
|
}
|
|
279
|
-
for (let [filePath, entry] of this.files)if (filePath.startsWith(dir) && filePath.indexOf((0, ($parcel$interopDefault($
|
|
279
|
+
for (let [filePath, entry] of this.files)if (filePath.startsWith(dir) && filePath.indexOf((0, ($parcel$interopDefault($8sOVI$path))).sep, dir.length) === -1) {
|
|
280
280
|
let name = filePath.slice(dir.length);
|
|
281
|
-
if (opts?.withFileTypes) res.push(new $
|
|
281
|
+
if (opts?.withFileTypes) res.push(new $a44e20ab74dfaf6b$var$Dirent(name, entry));
|
|
282
282
|
else res.push(name);
|
|
283
283
|
}
|
|
284
|
-
for (let [from] of this.symlinks)if (from.startsWith(dir) && from.indexOf((0, ($parcel$interopDefault($
|
|
284
|
+
for (let [from] of this.symlinks)if (from.startsWith(dir) && from.indexOf((0, ($parcel$interopDefault($8sOVI$path))).sep, dir.length) === -1) {
|
|
285
285
|
let name = from.slice(dir.length);
|
|
286
|
-
if (opts?.withFileTypes) res.push(new $
|
|
287
|
-
mode: $
|
|
286
|
+
if (opts?.withFileTypes) res.push(new $a44e20ab74dfaf6b$var$Dirent(name, {
|
|
287
|
+
mode: $a44e20ab74dfaf6b$var$S_IFLNK
|
|
288
288
|
}));
|
|
289
289
|
else res.push(name);
|
|
290
290
|
}
|
|
@@ -296,7 +296,7 @@ class $fd981db2f03c0168$export$3048eb7ec07c2c4e {
|
|
|
296
296
|
}
|
|
297
297
|
async unlink(filePath) {
|
|
298
298
|
filePath = this._normalizePath(filePath);
|
|
299
|
-
if (!this.files.has(filePath) && !this.dirs.has(filePath)) throw new $
|
|
299
|
+
if (!this.files.has(filePath) && !this.dirs.has(filePath)) throw new $a44e20ab74dfaf6b$export$d414276624ebf134('ENOENT', filePath, 'does not exist');
|
|
300
300
|
this.files.delete(filePath);
|
|
301
301
|
this.dirs.delete(filePath);
|
|
302
302
|
this.watchers.delete(filePath);
|
|
@@ -313,11 +313,11 @@ class $fd981db2f03c0168$export$3048eb7ec07c2c4e {
|
|
|
313
313
|
async mkdirp(dir) {
|
|
314
314
|
dir = this._normalizePath(dir);
|
|
315
315
|
if (this.dirs.has(dir)) return Promise.resolve();
|
|
316
|
-
if (this.files.has(dir)) throw new $
|
|
317
|
-
let root = (0, ($parcel$interopDefault($
|
|
316
|
+
if (this.files.has(dir)) throw new $a44e20ab74dfaf6b$export$d414276624ebf134('ENOENT', dir, 'is not a directory');
|
|
317
|
+
let root = (0, ($parcel$interopDefault($8sOVI$path))).parse(dir).root;
|
|
318
318
|
while(dir !== root){
|
|
319
319
|
if (this.dirs.has(dir)) break;
|
|
320
|
-
this.dirs.set(dir, new $
|
|
320
|
+
this.dirs.set(dir, new $a44e20ab74dfaf6b$var$Directory());
|
|
321
321
|
await this._sendWorkerEvent({
|
|
322
322
|
type: 'mkdir',
|
|
323
323
|
path: dir
|
|
@@ -326,14 +326,14 @@ class $fd981db2f03c0168$export$3048eb7ec07c2c4e {
|
|
|
326
326
|
type: 'create',
|
|
327
327
|
path: dir
|
|
328
328
|
});
|
|
329
|
-
dir = (0, ($parcel$interopDefault($
|
|
329
|
+
dir = (0, ($parcel$interopDefault($8sOVI$path))).dirname(dir);
|
|
330
330
|
}
|
|
331
331
|
return Promise.resolve();
|
|
332
332
|
}
|
|
333
333
|
async rimraf(filePath) {
|
|
334
334
|
filePath = this._normalizePath(filePath);
|
|
335
335
|
if (this.dirs.has(filePath)) {
|
|
336
|
-
let dir = filePath + (0, ($parcel$interopDefault($
|
|
336
|
+
let dir = filePath + (0, ($parcel$interopDefault($8sOVI$path))).sep;
|
|
337
337
|
for (let filePath of this.files.keys())if (filePath.startsWith(dir)) {
|
|
338
338
|
this.files.delete(filePath);
|
|
339
339
|
await this._sendWorkerEvent({
|
|
@@ -390,7 +390,7 @@ class $fd981db2f03c0168$export$3048eb7ec07c2c4e {
|
|
|
390
390
|
source = this._normalizePath(source);
|
|
391
391
|
if (this.dirs.has(source)) {
|
|
392
392
|
if (!this.dirs.has(destination)) {
|
|
393
|
-
this.dirs.set(destination, new $
|
|
393
|
+
this.dirs.set(destination, new $a44e20ab74dfaf6b$var$Directory());
|
|
394
394
|
await this._sendWorkerEvent({
|
|
395
395
|
type: 'mkdir',
|
|
396
396
|
path: destination
|
|
@@ -400,11 +400,11 @@ class $fd981db2f03c0168$export$3048eb7ec07c2c4e {
|
|
|
400
400
|
path: destination
|
|
401
401
|
});
|
|
402
402
|
}
|
|
403
|
-
let dir = source + (0, ($parcel$interopDefault($
|
|
403
|
+
let dir = source + (0, ($parcel$interopDefault($8sOVI$path))).sep;
|
|
404
404
|
for (let dirPath of this.dirs.keys())if (dirPath.startsWith(dir)) {
|
|
405
|
-
let destName = (0, ($parcel$interopDefault($
|
|
405
|
+
let destName = (0, ($parcel$interopDefault($8sOVI$path))).join(destination, dirPath.slice(dir.length));
|
|
406
406
|
if (!this.dirs.has(destName)) {
|
|
407
|
-
this.dirs.set(destName, new $
|
|
407
|
+
this.dirs.set(destName, new $a44e20ab74dfaf6b$var$Directory());
|
|
408
408
|
await this._sendWorkerEvent({
|
|
409
409
|
type: 'mkdir',
|
|
410
410
|
path: destination
|
|
@@ -416,7 +416,7 @@ class $fd981db2f03c0168$export$3048eb7ec07c2c4e {
|
|
|
416
416
|
}
|
|
417
417
|
}
|
|
418
418
|
for (let [filePath, file] of this.files)if (filePath.startsWith(dir)) {
|
|
419
|
-
let destName = (0, ($parcel$interopDefault($
|
|
419
|
+
let destName = (0, ($parcel$interopDefault($8sOVI$path))).join(destination, filePath.slice(dir.length));
|
|
420
420
|
let exists = this.files.has(destName);
|
|
421
421
|
this.files.set(destName, file);
|
|
422
422
|
await this._sendWorkerEvent({
|
|
@@ -432,10 +432,10 @@ class $fd981db2f03c0168$export$3048eb7ec07c2c4e {
|
|
|
432
432
|
} else await this.copyFile(source, destination);
|
|
433
433
|
}
|
|
434
434
|
createReadStream(filePath) {
|
|
435
|
-
return new $
|
|
435
|
+
return new $a44e20ab74dfaf6b$var$ReadStream(this, filePath);
|
|
436
436
|
}
|
|
437
437
|
createWriteStream(filePath, options) {
|
|
438
|
-
return new $
|
|
438
|
+
return new $a44e20ab74dfaf6b$var$WriteStream(this, filePath, options);
|
|
439
439
|
}
|
|
440
440
|
realpathSync(filePath) {
|
|
441
441
|
return this._normalizePath(filePath);
|
|
@@ -472,7 +472,7 @@ class $fd981db2f03c0168$export$3048eb7ec07c2c4e {
|
|
|
472
472
|
let events = this._eventQueue;
|
|
473
473
|
this._eventQueue = [];
|
|
474
474
|
for (let [dir, watchers] of this.watchers){
|
|
475
|
-
if (!dir.endsWith((0, ($parcel$interopDefault($
|
|
475
|
+
if (!dir.endsWith((0, ($parcel$interopDefault($8sOVI$path))).sep)) dir += (0, ($parcel$interopDefault($8sOVI$path))).sep;
|
|
476
476
|
if (event.path.startsWith(dir)) for (let watcher of watchers)watcher.trigger(events);
|
|
477
477
|
}
|
|
478
478
|
}, 50);
|
|
@@ -490,7 +490,7 @@ class $fd981db2f03c0168$export$3048eb7ec07c2c4e {
|
|
|
490
490
|
}
|
|
491
491
|
watch(dir, fn, opts) {
|
|
492
492
|
dir = this._normalizePath(dir);
|
|
493
|
-
let watcher = new $
|
|
493
|
+
let watcher = new $a44e20ab74dfaf6b$var$Watcher(fn, opts);
|
|
494
494
|
let watchers = this.watchers.get(dir);
|
|
495
495
|
if (!watchers) {
|
|
496
496
|
watchers = new Set();
|
|
@@ -499,7 +499,7 @@ class $fd981db2f03c0168$export$3048eb7ec07c2c4e {
|
|
|
499
499
|
watchers.add(watcher);
|
|
500
500
|
return Promise.resolve({
|
|
501
501
|
unsubscribe: ()=>{
|
|
502
|
-
watchers = (0, (/*@__PURE__*/$parcel$interopDefault($
|
|
502
|
+
watchers = (0, (/*@__PURE__*/$parcel$interopDefault($7b68cc90d1a072a1$exports)))(watchers);
|
|
503
503
|
watchers.delete(watcher);
|
|
504
504
|
if (watchers.size === 0) this.watchers.delete(dir);
|
|
505
505
|
return Promise.resolve();
|
|
@@ -511,34 +511,35 @@ class $fd981db2f03c0168$export$3048eb7ec07c2c4e {
|
|
|
511
511
|
let len = Number(contents);
|
|
512
512
|
let events = this.events.slice(len);
|
|
513
513
|
let ignore = opts.ignore;
|
|
514
|
-
if (ignore) events = events.filter((event)=>!ignore.some((i)=>event.path.startsWith(i + (0, ($parcel$interopDefault($
|
|
514
|
+
if (ignore) events = events.filter((event)=>!ignore.some((i)=>event.path.startsWith(i + (0, ($parcel$interopDefault($8sOVI$path))).sep)));
|
|
515
515
|
return events;
|
|
516
516
|
}
|
|
517
517
|
async writeSnapshot(dir, snapshot) {
|
|
518
|
+
await this.mkdirp((0, ($parcel$interopDefault($8sOVI$path))).dirname(snapshot));
|
|
518
519
|
await this.writeFile(snapshot, '' + this.events.length);
|
|
519
520
|
}
|
|
520
521
|
findAncestorFile(fileNames, fromDir, root) {
|
|
521
|
-
return (0, $
|
|
522
|
+
return (0, $daab8b558e6f5694$export$d51a93c758976388)(this, fileNames, fromDir, root);
|
|
522
523
|
}
|
|
523
524
|
findNodeModule(moduleName, fromDir) {
|
|
524
|
-
return (0, $
|
|
525
|
+
return (0, $daab8b558e6f5694$export$4c6d088a7d7f9947)(this, moduleName, fromDir);
|
|
525
526
|
}
|
|
526
527
|
findFirstFile(filePaths) {
|
|
527
|
-
return (0, $
|
|
528
|
+
return (0, $daab8b558e6f5694$export$64df6e3182fd5b2d)(this, filePaths);
|
|
528
529
|
}
|
|
529
530
|
}
|
|
530
|
-
class $
|
|
531
|
+
class $a44e20ab74dfaf6b$var$Watcher {
|
|
531
532
|
constructor(fn, options){
|
|
532
533
|
this.fn = fn;
|
|
533
534
|
this.options = options;
|
|
534
535
|
}
|
|
535
536
|
trigger(events) {
|
|
536
537
|
let ignore = this.options.ignore;
|
|
537
|
-
if (ignore) events = events.filter((event)=>!ignore.some((i)=>event.path.startsWith(i + (0, ($parcel$interopDefault($
|
|
538
|
+
if (ignore) events = events.filter((event)=>!ignore.some((i)=>event.path.startsWith(i + (0, ($parcel$interopDefault($8sOVI$path))).sep)));
|
|
538
539
|
if (events.length > 0) this.fn(null, events);
|
|
539
540
|
}
|
|
540
541
|
}
|
|
541
|
-
class $
|
|
542
|
+
class $a44e20ab74dfaf6b$export$d414276624ebf134 extends Error {
|
|
542
543
|
constructor(code, path, message){
|
|
543
544
|
super(`${code}: ${path} ${message}`);
|
|
544
545
|
this.name = 'FSError';
|
|
@@ -547,7 +548,7 @@ class $fd981db2f03c0168$export$d414276624ebf134 extends Error {
|
|
|
547
548
|
Error.captureStackTrace?.(this, this.constructor);
|
|
548
549
|
}
|
|
549
550
|
}
|
|
550
|
-
class $
|
|
551
|
+
class $a44e20ab74dfaf6b$var$ReadStream extends (0, $8sOVI$stream.Readable) {
|
|
551
552
|
constructor(fs, filePath){
|
|
552
553
|
super();
|
|
553
554
|
this.fs = fs;
|
|
@@ -567,7 +568,7 @@ class $fd981db2f03c0168$var$ReadStream extends (0, $f8tya$stream.Readable) {
|
|
|
567
568
|
});
|
|
568
569
|
}
|
|
569
570
|
}
|
|
570
|
-
class $
|
|
571
|
+
class $a44e20ab74dfaf6b$var$WriteStream extends (0, $8sOVI$stream.Writable) {
|
|
571
572
|
constructor(fs, filePath, options){
|
|
572
573
|
super({
|
|
573
574
|
emitClose: true,
|
|
@@ -576,11 +577,11 @@ class $fd981db2f03c0168$var$WriteStream extends (0, $f8tya$stream.Writable) {
|
|
|
576
577
|
this.fs = fs;
|
|
577
578
|
this.filePath = filePath;
|
|
578
579
|
this.options = options;
|
|
579
|
-
this.buffer = $
|
|
580
|
+
this.buffer = $a44e20ab74dfaf6b$require$Buffer.alloc(0);
|
|
580
581
|
}
|
|
581
582
|
_write(chunk, encoding, callback) {
|
|
582
|
-
let c = typeof chunk === 'string' ? $
|
|
583
|
-
this.buffer = $
|
|
583
|
+
let c = typeof chunk === 'string' ? $a44e20ab74dfaf6b$require$Buffer.from(chunk, encoding) : chunk;
|
|
584
|
+
this.buffer = $a44e20ab74dfaf6b$require$Buffer.concat([
|
|
584
585
|
this.buffer,
|
|
585
586
|
c
|
|
586
587
|
]);
|
|
@@ -590,11 +591,11 @@ class $fd981db2f03c0168$var$WriteStream extends (0, $f8tya$stream.Writable) {
|
|
|
590
591
|
this.fs.writeFile(this.filePath, this.buffer, this.options).then(callback).catch(callback);
|
|
591
592
|
}
|
|
592
593
|
}
|
|
593
|
-
const $
|
|
594
|
-
const $
|
|
595
|
-
const $
|
|
596
|
-
const $
|
|
597
|
-
class $
|
|
594
|
+
const $a44e20ab74dfaf6b$var$S_IFREG = 32768;
|
|
595
|
+
const $a44e20ab74dfaf6b$var$S_IFDIR = 16384;
|
|
596
|
+
const $a44e20ab74dfaf6b$var$S_IFLNK = 40960;
|
|
597
|
+
const $a44e20ab74dfaf6b$var$S_IFMT = 61440;
|
|
598
|
+
class $a44e20ab74dfaf6b$var$Entry {
|
|
598
599
|
constructor(mode){
|
|
599
600
|
this.mode = mode;
|
|
600
601
|
let now = Date.now();
|
|
@@ -618,10 +619,10 @@ class $fd981db2f03c0168$var$Entry {
|
|
|
618
619
|
return 0;
|
|
619
620
|
}
|
|
620
621
|
stat() {
|
|
621
|
-
return new $
|
|
622
|
+
return new $a44e20ab74dfaf6b$var$Stat(this);
|
|
622
623
|
}
|
|
623
624
|
}
|
|
624
|
-
class $
|
|
625
|
+
class $a44e20ab74dfaf6b$var$Stat {
|
|
625
626
|
dev = 0;
|
|
626
627
|
ino = 0;
|
|
627
628
|
nlink = 0;
|
|
@@ -643,10 +644,10 @@ class $fd981db2f03c0168$var$Stat {
|
|
|
643
644
|
this.birthtime = new Date(entry.birthtime);
|
|
644
645
|
}
|
|
645
646
|
isFile() {
|
|
646
|
-
return Boolean(this.mode & $
|
|
647
|
+
return Boolean(this.mode & $a44e20ab74dfaf6b$var$S_IFREG);
|
|
647
648
|
}
|
|
648
649
|
isDirectory() {
|
|
649
|
-
return Boolean(this.mode & $
|
|
650
|
+
return Boolean(this.mode & $a44e20ab74dfaf6b$var$S_IFDIR);
|
|
650
651
|
}
|
|
651
652
|
isBlockDevice() {
|
|
652
653
|
return false;
|
|
@@ -664,17 +665,17 @@ class $fd981db2f03c0168$var$Stat {
|
|
|
664
665
|
return false;
|
|
665
666
|
}
|
|
666
667
|
}
|
|
667
|
-
class $
|
|
668
|
+
class $a44e20ab74dfaf6b$var$Dirent {
|
|
668
669
|
#mode;
|
|
669
670
|
constructor(name, entry){
|
|
670
671
|
this.name = name;
|
|
671
672
|
this.#mode = entry.mode;
|
|
672
673
|
}
|
|
673
674
|
isFile() {
|
|
674
|
-
return (this.#mode & $
|
|
675
|
+
return (this.#mode & $a44e20ab74dfaf6b$var$S_IFMT) === $a44e20ab74dfaf6b$var$S_IFREG;
|
|
675
676
|
}
|
|
676
677
|
isDirectory() {
|
|
677
|
-
return (this.#mode & $
|
|
678
|
+
return (this.#mode & $a44e20ab74dfaf6b$var$S_IFMT) === $a44e20ab74dfaf6b$var$S_IFDIR;
|
|
678
679
|
}
|
|
679
680
|
isBlockDevice() {
|
|
680
681
|
return false;
|
|
@@ -683,7 +684,7 @@ class $fd981db2f03c0168$var$Dirent {
|
|
|
683
684
|
return false;
|
|
684
685
|
}
|
|
685
686
|
isSymbolicLink() {
|
|
686
|
-
return (this.#mode & $
|
|
687
|
+
return (this.#mode & $a44e20ab74dfaf6b$var$S_IFMT) === $a44e20ab74dfaf6b$var$S_IFLNK;
|
|
687
688
|
}
|
|
688
689
|
isFIFO() {
|
|
689
690
|
return false;
|
|
@@ -692,55 +693,55 @@ class $fd981db2f03c0168$var$Dirent {
|
|
|
692
693
|
return false;
|
|
693
694
|
}
|
|
694
695
|
}
|
|
695
|
-
class $
|
|
696
|
+
class $a44e20ab74dfaf6b$export$b6afa8811b7e644e extends $a44e20ab74dfaf6b$var$Entry {
|
|
696
697
|
constructor(buffer, mode){
|
|
697
|
-
super($
|
|
698
|
+
super($a44e20ab74dfaf6b$var$S_IFREG | mode);
|
|
698
699
|
this.buffer = buffer;
|
|
699
700
|
}
|
|
700
701
|
read() {
|
|
701
702
|
super.access();
|
|
702
|
-
return $
|
|
703
|
+
return $a44e20ab74dfaf6b$require$Buffer.from(this.buffer);
|
|
703
704
|
}
|
|
704
705
|
write(buffer, mode) {
|
|
705
|
-
super.modify($
|
|
706
|
+
super.modify($a44e20ab74dfaf6b$var$S_IFREG | mode);
|
|
706
707
|
this.buffer = buffer;
|
|
707
708
|
}
|
|
708
709
|
getSize() {
|
|
709
710
|
return this.buffer.byteLength;
|
|
710
711
|
}
|
|
711
712
|
}
|
|
712
|
-
class $
|
|
713
|
+
class $a44e20ab74dfaf6b$var$Directory extends $a44e20ab74dfaf6b$var$Entry {
|
|
713
714
|
constructor(){
|
|
714
|
-
super($
|
|
715
|
+
super($a44e20ab74dfaf6b$var$S_IFDIR);
|
|
715
716
|
}
|
|
716
717
|
}
|
|
717
|
-
function $
|
|
718
|
-
if (typeof contents !== 'string' && contents.buffer instanceof (0, $
|
|
718
|
+
function $a44e20ab74dfaf6b$export$df9eb3e75aa27a22(contents) {
|
|
719
|
+
if (typeof contents !== 'string' && contents.buffer instanceof (0, $8sOVI$atlaspackutils.SharedBuffer)) return contents;
|
|
719
720
|
let contentsBuffer = contents;
|
|
720
721
|
// For the polyfilled buffer module, it's faster to always convert once so that the subsequent
|
|
721
722
|
// operations are fast (.byteLength and using .set instead of .write)
|
|
722
|
-
contentsBuffer = contentsBuffer instanceof $
|
|
723
|
-
let length = $
|
|
724
|
-
let shared = new (0, $
|
|
725
|
-
let buffer = $
|
|
723
|
+
contentsBuffer = contentsBuffer instanceof $a44e20ab74dfaf6b$require$Buffer ? contentsBuffer : $a44e20ab74dfaf6b$require$Buffer.from(contentsBuffer);
|
|
724
|
+
let length = $a44e20ab74dfaf6b$require$Buffer.byteLength(contentsBuffer);
|
|
725
|
+
let shared = new (0, $8sOVI$atlaspackutils.SharedBuffer)(length);
|
|
726
|
+
let buffer = $a44e20ab74dfaf6b$require$Buffer.from(shared);
|
|
726
727
|
if (length > 0) {
|
|
727
728
|
if (typeof contentsBuffer === 'string') buffer.write(contentsBuffer);
|
|
728
729
|
else buffer.set(contentsBuffer);
|
|
729
730
|
}
|
|
730
731
|
return buffer;
|
|
731
732
|
}
|
|
732
|
-
class $
|
|
733
|
+
class $a44e20ab74dfaf6b$var$WorkerFS extends $a44e20ab74dfaf6b$export$3048eb7ec07c2c4e {
|
|
733
734
|
constructor(id, handle){
|
|
734
735
|
// TODO Make this not a subclass
|
|
735
736
|
// $FlowFixMe
|
|
736
737
|
super();
|
|
737
738
|
this.id = id;
|
|
738
|
-
this.handleFn = (methodName, args)=>(0, ($parcel$interopDefault($
|
|
739
|
+
this.handleFn = (methodName, args)=>(0, ($parcel$interopDefault($8sOVI$atlaspackworkers))).getWorkerApi().runHandle(handle, [
|
|
739
740
|
methodName,
|
|
740
741
|
args
|
|
741
742
|
]);
|
|
742
743
|
this.handleFn('_registerWorker', [
|
|
743
|
-
(0, ($parcel$interopDefault($
|
|
744
|
+
(0, ($parcel$interopDefault($8sOVI$atlaspackworkers))).getWorkerApi().createReverseHandle((event)=>{
|
|
744
745
|
switch(event.type){
|
|
745
746
|
case 'writeFile':
|
|
746
747
|
this.files.set(event.path, event.entry);
|
|
@@ -751,7 +752,7 @@ class $fd981db2f03c0168$var$WorkerFS extends $fd981db2f03c0168$export$3048eb7ec0
|
|
|
751
752
|
this.symlinks.delete(event.path);
|
|
752
753
|
break;
|
|
753
754
|
case 'mkdir':
|
|
754
|
-
this.dirs.set(event.path, new $
|
|
755
|
+
this.dirs.set(event.path, new $a44e20ab74dfaf6b$var$Directory());
|
|
755
756
|
break;
|
|
756
757
|
case 'symlink':
|
|
757
758
|
this.symlinks.set(event.path, event.target);
|
|
@@ -761,7 +762,7 @@ class $fd981db2f03c0168$var$WorkerFS extends $fd981db2f03c0168$export$3048eb7ec0
|
|
|
761
762
|
]);
|
|
762
763
|
}
|
|
763
764
|
static deserialize(opts) {
|
|
764
|
-
return (0, (/*@__PURE__*/$parcel$interopDefault($
|
|
765
|
+
return (0, (/*@__PURE__*/$parcel$interopDefault($7b68cc90d1a072a1$exports)))($a44e20ab74dfaf6b$var$instances.get(opts.id));
|
|
765
766
|
}
|
|
766
767
|
serialize() {
|
|
767
768
|
// $FlowFixMe
|
|
@@ -771,7 +772,7 @@ class $fd981db2f03c0168$var$WorkerFS extends $fd981db2f03c0168$export$3048eb7ec0
|
|
|
771
772
|
}
|
|
772
773
|
writeFile(filePath, contents, options) {
|
|
773
774
|
super.writeFile(filePath, contents, options);
|
|
774
|
-
let buffer = $
|
|
775
|
+
let buffer = $a44e20ab74dfaf6b$export$df9eb3e75aa27a22(contents);
|
|
775
776
|
return this.handleFn('writeFile', [
|
|
776
777
|
filePath,
|
|
777
778
|
buffer,
|
|
@@ -811,16 +812,16 @@ class $fd981db2f03c0168$var$WorkerFS extends $fd981db2f03c0168$export$3048eb7ec0
|
|
|
811
812
|
]);
|
|
812
813
|
}
|
|
813
814
|
}
|
|
814
|
-
(0, $
|
|
815
|
-
(0, $
|
|
816
|
-
(0, $
|
|
817
|
-
(0, $
|
|
818
|
-
(0, $
|
|
815
|
+
(0, $8sOVI$atlaspackbuildcache.registerSerializableClass)(`${(0, (/*@__PURE__*/$parcel$interopDefault($867c50d101d36a7d$exports))).version}:MemoryFS`, $a44e20ab74dfaf6b$export$3048eb7ec07c2c4e);
|
|
816
|
+
(0, $8sOVI$atlaspackbuildcache.registerSerializableClass)(`${(0, (/*@__PURE__*/$parcel$interopDefault($867c50d101d36a7d$exports))).version}:WorkerFS`, $a44e20ab74dfaf6b$var$WorkerFS);
|
|
817
|
+
(0, $8sOVI$atlaspackbuildcache.registerSerializableClass)(`${(0, (/*@__PURE__*/$parcel$interopDefault($867c50d101d36a7d$exports))).version}:Stat`, $a44e20ab74dfaf6b$var$Stat);
|
|
818
|
+
(0, $8sOVI$atlaspackbuildcache.registerSerializableClass)(`${(0, (/*@__PURE__*/$parcel$interopDefault($867c50d101d36a7d$exports))).version}:File`, $a44e20ab74dfaf6b$export$b6afa8811b7e644e);
|
|
819
|
+
(0, $8sOVI$atlaspackbuildcache.registerSerializableClass)(`${(0, (/*@__PURE__*/$parcel$interopDefault($867c50d101d36a7d$exports))).version}:Directory`, $a44e20ab74dfaf6b$var$Directory);
|
|
819
820
|
|
|
820
821
|
|
|
821
|
-
var $
|
|
822
|
+
var $7d25660af2107580$exports = {};
|
|
822
823
|
|
|
823
|
-
$parcel$export($
|
|
824
|
+
$parcel$export($7d25660af2107580$exports, "OverlayFS", () => $7d25660af2107580$export$5963299e2424ca1c);
|
|
824
825
|
|
|
825
826
|
|
|
826
827
|
|
|
@@ -828,16 +829,16 @@ $parcel$export($68f42b77897ad65b$exports, "OverlayFS", () => $68f42b77897ad65b$e
|
|
|
828
829
|
|
|
829
830
|
|
|
830
831
|
|
|
831
|
-
class $
|
|
832
|
+
class $7d25660af2107580$export$5963299e2424ca1c {
|
|
832
833
|
deleted = new Set();
|
|
833
834
|
constructor(workerFarmOrFS, readable){
|
|
834
|
-
if (workerFarmOrFS instanceof (0, ($parcel$interopDefault($
|
|
835
|
+
if (workerFarmOrFS instanceof (0, ($parcel$interopDefault($8sOVI$atlaspackworkers)))) this.writable = new (0, $a44e20ab74dfaf6b$export$3048eb7ec07c2c4e)(workerFarmOrFS);
|
|
835
836
|
else this.writable = workerFarmOrFS;
|
|
836
837
|
this.readable = readable;
|
|
837
838
|
this._cwd = readable.cwd();
|
|
838
839
|
}
|
|
839
840
|
static deserialize(opts) {
|
|
840
|
-
let fs = new $
|
|
841
|
+
let fs = new $7d25660af2107580$export$5963299e2424ca1c(opts.writable, opts.readable);
|
|
841
842
|
if (opts.deleted != null) fs.deleted = opts.deleted;
|
|
842
843
|
return fs;
|
|
843
844
|
}
|
|
@@ -851,28 +852,28 @@ class $68f42b77897ad65b$export$5963299e2424ca1c {
|
|
|
851
852
|
}
|
|
852
853
|
_deletedThrows(filePath) {
|
|
853
854
|
filePath = this._normalizePath(filePath);
|
|
854
|
-
if (this.deleted.has(filePath)) throw new $
|
|
855
|
+
if (this.deleted.has(filePath)) throw new $7d25660af2107580$var$FSError('ENOENT', filePath, 'does not exist');
|
|
855
856
|
return filePath;
|
|
856
857
|
}
|
|
857
858
|
_checkExists(filePath) {
|
|
858
859
|
filePath = this._deletedThrows(filePath);
|
|
859
|
-
if (!this.existsSync(filePath)) throw new $
|
|
860
|
+
if (!this.existsSync(filePath)) throw new $7d25660af2107580$var$FSError('ENOENT', filePath, 'does not exist');
|
|
860
861
|
return filePath;
|
|
861
862
|
}
|
|
862
863
|
_isSymlink(filePath) {
|
|
863
864
|
filePath = this._normalizePath(filePath);
|
|
864
865
|
// Check the parts of the path to see if any are symlinks.
|
|
865
|
-
let { root: root, dir: dir, base: base } = (0, ($parcel$interopDefault($
|
|
866
|
-
let segments = dir.slice(root.length).split((0, ($parcel$interopDefault($
|
|
866
|
+
let { root: root, dir: dir, base: base } = (0, ($parcel$interopDefault($8sOVI$path))).parse(filePath);
|
|
867
|
+
let segments = dir.slice(root.length).split((0, ($parcel$interopDefault($8sOVI$path))).sep).concat(base);
|
|
867
868
|
while(segments.length){
|
|
868
|
-
filePath = (0, ($parcel$interopDefault($
|
|
869
|
+
filePath = (0, ($parcel$interopDefault($8sOVI$path))).join(root, ...segments);
|
|
869
870
|
let name = segments.pop();
|
|
870
871
|
if (this.deleted.has(filePath)) return false;
|
|
871
|
-
else if (this.writable instanceof (0, $
|
|
872
|
+
else if (this.writable instanceof (0, $a44e20ab74dfaf6b$export$3048eb7ec07c2c4e) && this.writable.symlinks.has(filePath)) return true;
|
|
872
873
|
else {
|
|
873
874
|
// HACK: Atlaspack fs does not provide `lstatSync`,
|
|
874
875
|
// so we use `readdirSync` to check if the path is a symlink.
|
|
875
|
-
let parent = (0, ($parcel$interopDefault($
|
|
876
|
+
let parent = (0, ($parcel$interopDefault($8sOVI$path))).resolve(filePath, '..');
|
|
876
877
|
if (parent === filePath) return false;
|
|
877
878
|
try {
|
|
878
879
|
for (let dirent of this.readdirSync(parent, {
|
|
@@ -893,12 +894,12 @@ class $68f42b77897ad65b$export$5963299e2424ca1c {
|
|
|
893
894
|
}
|
|
894
895
|
async _copyPathForWrite(filePath) {
|
|
895
896
|
filePath = await this._normalizePath(filePath);
|
|
896
|
-
let dirPath = (0, ($parcel$interopDefault($
|
|
897
|
+
let dirPath = (0, ($parcel$interopDefault($8sOVI$path))).dirname(filePath);
|
|
897
898
|
if (this.existsSync(dirPath) && !this.writable.existsSync(dirPath)) await this.writable.mkdirp(dirPath);
|
|
898
899
|
return filePath;
|
|
899
900
|
}
|
|
900
901
|
_normalizePath(filePath) {
|
|
901
|
-
return (0, ($parcel$interopDefault($
|
|
902
|
+
return (0, ($parcel$interopDefault($8sOVI$path))).resolve(this.cwd(), filePath);
|
|
902
903
|
}
|
|
903
904
|
// eslint-disable-next-line require-await
|
|
904
905
|
async readFile(filePath, encoding) {
|
|
@@ -931,22 +932,22 @@ class $68f42b77897ad65b$export$5963299e2424ca1c {
|
|
|
931
932
|
let toDelete = [
|
|
932
933
|
filePath
|
|
933
934
|
];
|
|
934
|
-
if (this.writable instanceof (0, $
|
|
935
|
+
if (this.writable instanceof (0, $a44e20ab74dfaf6b$export$3048eb7ec07c2c4e) && this._isSymlink(filePath)) this.writable.symlinks.delete(filePath);
|
|
935
936
|
else if (this.statSync(filePath).isDirectory()) {
|
|
936
937
|
let stack = [
|
|
937
938
|
filePath
|
|
938
939
|
];
|
|
939
940
|
// Recursively add every descendant path to deleted.
|
|
940
941
|
while(stack.length){
|
|
941
|
-
let root = (0, (/*@__PURE__*/$parcel$interopDefault($
|
|
942
|
+
let root = (0, (/*@__PURE__*/$parcel$interopDefault($7b68cc90d1a072a1$exports)))(stack.pop());
|
|
942
943
|
for (let ent of this.readdirSync(root, {
|
|
943
944
|
withFileTypes: true
|
|
944
945
|
}))if (typeof ent === 'string') {
|
|
945
|
-
let childPath = (0, ($parcel$interopDefault($
|
|
946
|
+
let childPath = (0, ($parcel$interopDefault($8sOVI$path))).join(root, ent);
|
|
946
947
|
toDelete.push(childPath);
|
|
947
948
|
if (this.statSync(childPath).isDirectory()) stack.push(childPath);
|
|
948
949
|
} else {
|
|
949
|
-
let childPath = (0, ($parcel$interopDefault($
|
|
950
|
+
let childPath = (0, ($parcel$interopDefault($8sOVI$path))).join(root, ent.name);
|
|
950
951
|
toDelete.push(childPath);
|
|
951
952
|
if (ent.isDirectory()) stack.push(childPath);
|
|
952
953
|
}
|
|
@@ -963,10 +964,10 @@ class $68f42b77897ad65b$export$5963299e2424ca1c {
|
|
|
963
964
|
dir = this._normalizePath(dir);
|
|
964
965
|
await this.writable.mkdirp(dir);
|
|
965
966
|
if (this.deleted != null) {
|
|
966
|
-
let root = (0, ($parcel$interopDefault($
|
|
967
|
+
let root = (0, ($parcel$interopDefault($8sOVI$path))).parse(dir).root;
|
|
967
968
|
while(dir !== root){
|
|
968
969
|
this.deleted.delete(dir);
|
|
969
|
-
dir = (0, ($parcel$interopDefault($
|
|
970
|
+
dir = (0, ($parcel$interopDefault($8sOVI$path))).dirname(dir);
|
|
970
971
|
}
|
|
971
972
|
}
|
|
972
973
|
}
|
|
@@ -1052,7 +1053,7 @@ class $68f42b77897ad65b$export$5963299e2424ca1c {
|
|
|
1052
1053
|
let entries = new Map();
|
|
1053
1054
|
try {
|
|
1054
1055
|
for (let entry of this.writable.readdirSync(dir, opts)){
|
|
1055
|
-
let filePath = (0, ($parcel$interopDefault($
|
|
1056
|
+
let filePath = (0, ($parcel$interopDefault($8sOVI$path))).join(dir, entry.name ?? entry);
|
|
1056
1057
|
if (this.deleted.has(filePath)) continue;
|
|
1057
1058
|
entries.set(filePath, entry);
|
|
1058
1059
|
}
|
|
@@ -1061,7 +1062,7 @@ class $68f42b77897ad65b$export$5963299e2424ca1c {
|
|
|
1061
1062
|
}
|
|
1062
1063
|
try {
|
|
1063
1064
|
for (let entry of this.readable.readdirSync(dir, opts)){
|
|
1064
|
-
let filePath = (0, ($parcel$interopDefault($
|
|
1065
|
+
let filePath = (0, ($parcel$interopDefault($8sOVI$path))).join(dir, entry.name ?? entry);
|
|
1065
1066
|
if (this.deleted.has(filePath)) continue;
|
|
1066
1067
|
if (entries.has(filePath)) continue;
|
|
1067
1068
|
entries.set(filePath, entry);
|
|
@@ -1093,16 +1094,16 @@ class $68f42b77897ad65b$export$5963299e2424ca1c {
|
|
|
1093
1094
|
await this.writable.writeSnapshot(dir, snapshot, opts);
|
|
1094
1095
|
}
|
|
1095
1096
|
findAncestorFile(fileNames, fromDir, root) {
|
|
1096
|
-
return (0, $
|
|
1097
|
+
return (0, $daab8b558e6f5694$export$d51a93c758976388)(this, fileNames, fromDir, root);
|
|
1097
1098
|
}
|
|
1098
1099
|
findNodeModule(moduleName, fromDir) {
|
|
1099
|
-
return (0, $
|
|
1100
|
+
return (0, $daab8b558e6f5694$export$4c6d088a7d7f9947)(this, moduleName, fromDir);
|
|
1100
1101
|
}
|
|
1101
1102
|
findFirstFile(filePaths) {
|
|
1102
|
-
return (0, $
|
|
1103
|
+
return (0, $daab8b558e6f5694$export$64df6e3182fd5b2d)(this, filePaths);
|
|
1103
1104
|
}
|
|
1104
1105
|
}
|
|
1105
|
-
class $
|
|
1106
|
+
class $7d25660af2107580$var$FSError extends Error {
|
|
1106
1107
|
constructor(code, path, message){
|
|
1107
1108
|
super(`${code}: ${path} ${message}`);
|
|
1108
1109
|
this.name = 'FSError';
|
|
@@ -1111,24 +1112,24 @@ class $68f42b77897ad65b$var$FSError extends Error {
|
|
|
1111
1112
|
Error.captureStackTrace?.(this, this.constructor);
|
|
1112
1113
|
}
|
|
1113
1114
|
}
|
|
1114
|
-
(0, $
|
|
1115
|
+
(0, $8sOVI$atlaspackbuildcache.registerSerializableClass)(`${(0, (/*@__PURE__*/$parcel$interopDefault($867c50d101d36a7d$exports))).version}:OverlayFS`, $7d25660af2107580$export$5963299e2424ca1c);
|
|
1115
1116
|
|
|
1116
1117
|
|
|
1117
|
-
const $
|
|
1118
|
-
async function $
|
|
1118
|
+
const $42d1854b7a928fd5$var$pipeline = (0, $8sOVI$util.promisify)((0, ($parcel$interopDefault($8sOVI$stream))).pipeline);
|
|
1119
|
+
async function $42d1854b7a928fd5$export$d3a8044e3fef7335(sourceFS, source, destinationFS, destination) {
|
|
1119
1120
|
await destinationFS.mkdirp(destination);
|
|
1120
1121
|
let files = await sourceFS.readdir(source);
|
|
1121
1122
|
for (let file of files){
|
|
1122
|
-
let sourcePath = (0, ($parcel$interopDefault($
|
|
1123
|
-
let destPath = (0, ($parcel$interopDefault($
|
|
1123
|
+
let sourcePath = (0, ($parcel$interopDefault($8sOVI$path))).join(source, file);
|
|
1124
|
+
let destPath = (0, ($parcel$interopDefault($8sOVI$path))).join(destination, file);
|
|
1124
1125
|
let stats = await sourceFS.stat(sourcePath);
|
|
1125
|
-
if (stats.isFile()) await $
|
|
1126
|
-
else if (stats.isDirectory()) await $
|
|
1126
|
+
if (stats.isFile()) await $42d1854b7a928fd5$var$pipeline(sourceFS.createReadStream(sourcePath), destinationFS.createWriteStream(destPath));
|
|
1127
|
+
else if (stats.isDirectory()) await $42d1854b7a928fd5$export$d3a8044e3fef7335(sourceFS, sourcePath, destinationFS, destPath);
|
|
1127
1128
|
}
|
|
1128
1129
|
}
|
|
1129
|
-
$parcel$exportWildcard(module.exports, $
|
|
1130
|
-
$parcel$exportWildcard(module.exports, $
|
|
1131
|
-
$parcel$exportWildcard(module.exports, $
|
|
1130
|
+
$parcel$exportWildcard(module.exports, $87241760c4ff27c3$exports);
|
|
1131
|
+
$parcel$exportWildcard(module.exports, $a44e20ab74dfaf6b$exports);
|
|
1132
|
+
$parcel$exportWildcard(module.exports, $7d25660af2107580$exports);
|
|
1132
1133
|
|
|
1133
1134
|
|
|
1134
1135
|
//# sourceMappingURL=browser.js.map
|