@atlaspack/fs 2.12.1-dev.3450 → 2.12.1-dev.3466
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 +168 -168
- package/lib/browser.js.map +1 -1
- package/lib/index.js +340 -340
- package/lib/index.js.map +1 -1
- package/package.json +11 -11
- package/src/MemoryFS.js +15 -9
- package/src/NodeFS.js +6 -6
- 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.3466+9a12fb8bd\",\"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/feature-flags\":\"2.12.1-dev.3466+9a12fb8bd\",\"@atlaspack/rust\":\"2.12.1-dev.3466+9a12fb8bd\",\"@atlaspack/types-internal\":\"2.12.1-dev.3466+9a12fb8bd\",\"@atlaspack/utils\":\"2.12.1-dev.3466+9a12fb8bd\",\"@atlaspack/workers\":\"2.12.1-dev.3466+9a12fb8bd\",\"@parcel/watcher\":\"^2.0.7\"},\"devDependencies\":{\"@atlaspack/watcher-watchman-js\":\"2.12.1-dev.3466+9a12fb8bd\",\"graceful-fs\":\"^4.2.4\",\"ncp\":\"^2.0.0\",\"nullthrows\":\"^1.1.1\",\"utility-types\":\"^3.10.0\"},\"peerDependencies\":{\"@atlaspack/build-cache\":\"^2.12.0\"},\"browser\":{\"@atlaspack/fs\":\"./lib/browser.js\",\"./src/NodeFS.js\":\"./src/NodeFS.browser.js\"},\"gitHead\":\"9a12fb8bd1b72e407ed043e20337dc60fbec9cbe\"}");
|
|
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,34 @@ 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
518
|
await this.writeFile(snapshot, '' + this.events.length);
|
|
519
519
|
}
|
|
520
520
|
findAncestorFile(fileNames, fromDir, root) {
|
|
521
|
-
return (0, $
|
|
521
|
+
return (0, $daab8b558e6f5694$export$d51a93c758976388)(this, fileNames, fromDir, root);
|
|
522
522
|
}
|
|
523
523
|
findNodeModule(moduleName, fromDir) {
|
|
524
|
-
return (0, $
|
|
524
|
+
return (0, $daab8b558e6f5694$export$4c6d088a7d7f9947)(this, moduleName, fromDir);
|
|
525
525
|
}
|
|
526
526
|
findFirstFile(filePaths) {
|
|
527
|
-
return (0, $
|
|
527
|
+
return (0, $daab8b558e6f5694$export$64df6e3182fd5b2d)(this, filePaths);
|
|
528
528
|
}
|
|
529
529
|
}
|
|
530
|
-
class $
|
|
530
|
+
class $a44e20ab74dfaf6b$var$Watcher {
|
|
531
531
|
constructor(fn, options){
|
|
532
532
|
this.fn = fn;
|
|
533
533
|
this.options = options;
|
|
534
534
|
}
|
|
535
535
|
trigger(events) {
|
|
536
536
|
let ignore = this.options.ignore;
|
|
537
|
-
if (ignore) events = events.filter((event)=>!ignore.some((i)=>event.path.startsWith(i + (0, ($parcel$interopDefault($
|
|
537
|
+
if (ignore) events = events.filter((event)=>!ignore.some((i)=>event.path.startsWith(i + (0, ($parcel$interopDefault($8sOVI$path))).sep)));
|
|
538
538
|
if (events.length > 0) this.fn(null, events);
|
|
539
539
|
}
|
|
540
540
|
}
|
|
541
|
-
class $
|
|
541
|
+
class $a44e20ab74dfaf6b$export$d414276624ebf134 extends Error {
|
|
542
542
|
constructor(code, path, message){
|
|
543
543
|
super(`${code}: ${path} ${message}`);
|
|
544
544
|
this.name = 'FSError';
|
|
@@ -547,7 +547,7 @@ class $fd981db2f03c0168$export$d414276624ebf134 extends Error {
|
|
|
547
547
|
Error.captureStackTrace?.(this, this.constructor);
|
|
548
548
|
}
|
|
549
549
|
}
|
|
550
|
-
class $
|
|
550
|
+
class $a44e20ab74dfaf6b$var$ReadStream extends (0, $8sOVI$stream.Readable) {
|
|
551
551
|
constructor(fs, filePath){
|
|
552
552
|
super();
|
|
553
553
|
this.fs = fs;
|
|
@@ -567,7 +567,7 @@ class $fd981db2f03c0168$var$ReadStream extends (0, $f8tya$stream.Readable) {
|
|
|
567
567
|
});
|
|
568
568
|
}
|
|
569
569
|
}
|
|
570
|
-
class $
|
|
570
|
+
class $a44e20ab74dfaf6b$var$WriteStream extends (0, $8sOVI$stream.Writable) {
|
|
571
571
|
constructor(fs, filePath, options){
|
|
572
572
|
super({
|
|
573
573
|
emitClose: true,
|
|
@@ -576,11 +576,11 @@ class $fd981db2f03c0168$var$WriteStream extends (0, $f8tya$stream.Writable) {
|
|
|
576
576
|
this.fs = fs;
|
|
577
577
|
this.filePath = filePath;
|
|
578
578
|
this.options = options;
|
|
579
|
-
this.buffer = $
|
|
579
|
+
this.buffer = $a44e20ab74dfaf6b$require$Buffer.alloc(0);
|
|
580
580
|
}
|
|
581
581
|
_write(chunk, encoding, callback) {
|
|
582
|
-
let c = typeof chunk === 'string' ? $
|
|
583
|
-
this.buffer = $
|
|
582
|
+
let c = typeof chunk === 'string' ? $a44e20ab74dfaf6b$require$Buffer.from(chunk, encoding) : chunk;
|
|
583
|
+
this.buffer = $a44e20ab74dfaf6b$require$Buffer.concat([
|
|
584
584
|
this.buffer,
|
|
585
585
|
c
|
|
586
586
|
]);
|
|
@@ -590,11 +590,11 @@ class $fd981db2f03c0168$var$WriteStream extends (0, $f8tya$stream.Writable) {
|
|
|
590
590
|
this.fs.writeFile(this.filePath, this.buffer, this.options).then(callback).catch(callback);
|
|
591
591
|
}
|
|
592
592
|
}
|
|
593
|
-
const $
|
|
594
|
-
const $
|
|
595
|
-
const $
|
|
596
|
-
const $
|
|
597
|
-
class $
|
|
593
|
+
const $a44e20ab74dfaf6b$var$S_IFREG = 32768;
|
|
594
|
+
const $a44e20ab74dfaf6b$var$S_IFDIR = 16384;
|
|
595
|
+
const $a44e20ab74dfaf6b$var$S_IFLNK = 40960;
|
|
596
|
+
const $a44e20ab74dfaf6b$var$S_IFMT = 61440;
|
|
597
|
+
class $a44e20ab74dfaf6b$var$Entry {
|
|
598
598
|
constructor(mode){
|
|
599
599
|
this.mode = mode;
|
|
600
600
|
let now = Date.now();
|
|
@@ -618,10 +618,10 @@ class $fd981db2f03c0168$var$Entry {
|
|
|
618
618
|
return 0;
|
|
619
619
|
}
|
|
620
620
|
stat() {
|
|
621
|
-
return new $
|
|
621
|
+
return new $a44e20ab74dfaf6b$var$Stat(this);
|
|
622
622
|
}
|
|
623
623
|
}
|
|
624
|
-
class $
|
|
624
|
+
class $a44e20ab74dfaf6b$var$Stat {
|
|
625
625
|
dev = 0;
|
|
626
626
|
ino = 0;
|
|
627
627
|
nlink = 0;
|
|
@@ -643,10 +643,10 @@ class $fd981db2f03c0168$var$Stat {
|
|
|
643
643
|
this.birthtime = new Date(entry.birthtime);
|
|
644
644
|
}
|
|
645
645
|
isFile() {
|
|
646
|
-
return Boolean(this.mode & $
|
|
646
|
+
return Boolean(this.mode & $a44e20ab74dfaf6b$var$S_IFREG);
|
|
647
647
|
}
|
|
648
648
|
isDirectory() {
|
|
649
|
-
return Boolean(this.mode & $
|
|
649
|
+
return Boolean(this.mode & $a44e20ab74dfaf6b$var$S_IFDIR);
|
|
650
650
|
}
|
|
651
651
|
isBlockDevice() {
|
|
652
652
|
return false;
|
|
@@ -664,17 +664,17 @@ class $fd981db2f03c0168$var$Stat {
|
|
|
664
664
|
return false;
|
|
665
665
|
}
|
|
666
666
|
}
|
|
667
|
-
class $
|
|
667
|
+
class $a44e20ab74dfaf6b$var$Dirent {
|
|
668
668
|
#mode;
|
|
669
669
|
constructor(name, entry){
|
|
670
670
|
this.name = name;
|
|
671
671
|
this.#mode = entry.mode;
|
|
672
672
|
}
|
|
673
673
|
isFile() {
|
|
674
|
-
return (this.#mode & $
|
|
674
|
+
return (this.#mode & $a44e20ab74dfaf6b$var$S_IFMT) === $a44e20ab74dfaf6b$var$S_IFREG;
|
|
675
675
|
}
|
|
676
676
|
isDirectory() {
|
|
677
|
-
return (this.#mode & $
|
|
677
|
+
return (this.#mode & $a44e20ab74dfaf6b$var$S_IFMT) === $a44e20ab74dfaf6b$var$S_IFDIR;
|
|
678
678
|
}
|
|
679
679
|
isBlockDevice() {
|
|
680
680
|
return false;
|
|
@@ -683,7 +683,7 @@ class $fd981db2f03c0168$var$Dirent {
|
|
|
683
683
|
return false;
|
|
684
684
|
}
|
|
685
685
|
isSymbolicLink() {
|
|
686
|
-
return (this.#mode & $
|
|
686
|
+
return (this.#mode & $a44e20ab74dfaf6b$var$S_IFMT) === $a44e20ab74dfaf6b$var$S_IFLNK;
|
|
687
687
|
}
|
|
688
688
|
isFIFO() {
|
|
689
689
|
return false;
|
|
@@ -692,55 +692,55 @@ class $fd981db2f03c0168$var$Dirent {
|
|
|
692
692
|
return false;
|
|
693
693
|
}
|
|
694
694
|
}
|
|
695
|
-
class $
|
|
695
|
+
class $a44e20ab74dfaf6b$export$b6afa8811b7e644e extends $a44e20ab74dfaf6b$var$Entry {
|
|
696
696
|
constructor(buffer, mode){
|
|
697
|
-
super($
|
|
697
|
+
super($a44e20ab74dfaf6b$var$S_IFREG | mode);
|
|
698
698
|
this.buffer = buffer;
|
|
699
699
|
}
|
|
700
700
|
read() {
|
|
701
701
|
super.access();
|
|
702
|
-
return $
|
|
702
|
+
return $a44e20ab74dfaf6b$require$Buffer.from(this.buffer);
|
|
703
703
|
}
|
|
704
704
|
write(buffer, mode) {
|
|
705
|
-
super.modify($
|
|
705
|
+
super.modify($a44e20ab74dfaf6b$var$S_IFREG | mode);
|
|
706
706
|
this.buffer = buffer;
|
|
707
707
|
}
|
|
708
708
|
getSize() {
|
|
709
709
|
return this.buffer.byteLength;
|
|
710
710
|
}
|
|
711
711
|
}
|
|
712
|
-
class $
|
|
712
|
+
class $a44e20ab74dfaf6b$var$Directory extends $a44e20ab74dfaf6b$var$Entry {
|
|
713
713
|
constructor(){
|
|
714
|
-
super($
|
|
714
|
+
super($a44e20ab74dfaf6b$var$S_IFDIR);
|
|
715
715
|
}
|
|
716
716
|
}
|
|
717
|
-
function $
|
|
718
|
-
if (typeof contents !== 'string' && contents.buffer instanceof (0, $
|
|
717
|
+
function $a44e20ab74dfaf6b$export$df9eb3e75aa27a22(contents) {
|
|
718
|
+
if (typeof contents !== 'string' && contents.buffer instanceof (0, $8sOVI$atlaspackutils.SharedBuffer)) return contents;
|
|
719
719
|
let contentsBuffer = contents;
|
|
720
720
|
// For the polyfilled buffer module, it's faster to always convert once so that the subsequent
|
|
721
721
|
// 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 = $
|
|
722
|
+
contentsBuffer = contentsBuffer instanceof $a44e20ab74dfaf6b$require$Buffer ? contentsBuffer : $a44e20ab74dfaf6b$require$Buffer.from(contentsBuffer);
|
|
723
|
+
let length = $a44e20ab74dfaf6b$require$Buffer.byteLength(contentsBuffer);
|
|
724
|
+
let shared = new (0, $8sOVI$atlaspackutils.SharedBuffer)(length);
|
|
725
|
+
let buffer = $a44e20ab74dfaf6b$require$Buffer.from(shared);
|
|
726
726
|
if (length > 0) {
|
|
727
727
|
if (typeof contentsBuffer === 'string') buffer.write(contentsBuffer);
|
|
728
728
|
else buffer.set(contentsBuffer);
|
|
729
729
|
}
|
|
730
730
|
return buffer;
|
|
731
731
|
}
|
|
732
|
-
class $
|
|
732
|
+
class $a44e20ab74dfaf6b$var$WorkerFS extends $a44e20ab74dfaf6b$export$3048eb7ec07c2c4e {
|
|
733
733
|
constructor(id, handle){
|
|
734
734
|
// TODO Make this not a subclass
|
|
735
735
|
// $FlowFixMe
|
|
736
736
|
super();
|
|
737
737
|
this.id = id;
|
|
738
|
-
this.handleFn = (methodName, args)=>(0, ($parcel$interopDefault($
|
|
738
|
+
this.handleFn = (methodName, args)=>(0, ($parcel$interopDefault($8sOVI$atlaspackworkers))).getWorkerApi().runHandle(handle, [
|
|
739
739
|
methodName,
|
|
740
740
|
args
|
|
741
741
|
]);
|
|
742
742
|
this.handleFn('_registerWorker', [
|
|
743
|
-
(0, ($parcel$interopDefault($
|
|
743
|
+
(0, ($parcel$interopDefault($8sOVI$atlaspackworkers))).getWorkerApi().createReverseHandle((event)=>{
|
|
744
744
|
switch(event.type){
|
|
745
745
|
case 'writeFile':
|
|
746
746
|
this.files.set(event.path, event.entry);
|
|
@@ -751,7 +751,7 @@ class $fd981db2f03c0168$var$WorkerFS extends $fd981db2f03c0168$export$3048eb7ec0
|
|
|
751
751
|
this.symlinks.delete(event.path);
|
|
752
752
|
break;
|
|
753
753
|
case 'mkdir':
|
|
754
|
-
this.dirs.set(event.path, new $
|
|
754
|
+
this.dirs.set(event.path, new $a44e20ab74dfaf6b$var$Directory());
|
|
755
755
|
break;
|
|
756
756
|
case 'symlink':
|
|
757
757
|
this.symlinks.set(event.path, event.target);
|
|
@@ -761,7 +761,7 @@ class $fd981db2f03c0168$var$WorkerFS extends $fd981db2f03c0168$export$3048eb7ec0
|
|
|
761
761
|
]);
|
|
762
762
|
}
|
|
763
763
|
static deserialize(opts) {
|
|
764
|
-
return (0, (/*@__PURE__*/$parcel$interopDefault($
|
|
764
|
+
return (0, (/*@__PURE__*/$parcel$interopDefault($7b68cc90d1a072a1$exports)))($a44e20ab74dfaf6b$var$instances.get(opts.id));
|
|
765
765
|
}
|
|
766
766
|
serialize() {
|
|
767
767
|
// $FlowFixMe
|
|
@@ -771,7 +771,7 @@ class $fd981db2f03c0168$var$WorkerFS extends $fd981db2f03c0168$export$3048eb7ec0
|
|
|
771
771
|
}
|
|
772
772
|
writeFile(filePath, contents, options) {
|
|
773
773
|
super.writeFile(filePath, contents, options);
|
|
774
|
-
let buffer = $
|
|
774
|
+
let buffer = $a44e20ab74dfaf6b$export$df9eb3e75aa27a22(contents);
|
|
775
775
|
return this.handleFn('writeFile', [
|
|
776
776
|
filePath,
|
|
777
777
|
buffer,
|
|
@@ -811,16 +811,16 @@ class $fd981db2f03c0168$var$WorkerFS extends $fd981db2f03c0168$export$3048eb7ec0
|
|
|
811
811
|
]);
|
|
812
812
|
}
|
|
813
813
|
}
|
|
814
|
-
(0, $
|
|
815
|
-
(0, $
|
|
816
|
-
(0, $
|
|
817
|
-
(0, $
|
|
818
|
-
(0, $
|
|
814
|
+
(0, $8sOVI$atlaspackbuildcache.registerSerializableClass)(`${(0, (/*@__PURE__*/$parcel$interopDefault($867c50d101d36a7d$exports))).version}:MemoryFS`, $a44e20ab74dfaf6b$export$3048eb7ec07c2c4e);
|
|
815
|
+
(0, $8sOVI$atlaspackbuildcache.registerSerializableClass)(`${(0, (/*@__PURE__*/$parcel$interopDefault($867c50d101d36a7d$exports))).version}:WorkerFS`, $a44e20ab74dfaf6b$var$WorkerFS);
|
|
816
|
+
(0, $8sOVI$atlaspackbuildcache.registerSerializableClass)(`${(0, (/*@__PURE__*/$parcel$interopDefault($867c50d101d36a7d$exports))).version}:Stat`, $a44e20ab74dfaf6b$var$Stat);
|
|
817
|
+
(0, $8sOVI$atlaspackbuildcache.registerSerializableClass)(`${(0, (/*@__PURE__*/$parcel$interopDefault($867c50d101d36a7d$exports))).version}:File`, $a44e20ab74dfaf6b$export$b6afa8811b7e644e);
|
|
818
|
+
(0, $8sOVI$atlaspackbuildcache.registerSerializableClass)(`${(0, (/*@__PURE__*/$parcel$interopDefault($867c50d101d36a7d$exports))).version}:Directory`, $a44e20ab74dfaf6b$var$Directory);
|
|
819
819
|
|
|
820
820
|
|
|
821
|
-
var $
|
|
821
|
+
var $7d25660af2107580$exports = {};
|
|
822
822
|
|
|
823
|
-
$parcel$export($
|
|
823
|
+
$parcel$export($7d25660af2107580$exports, "OverlayFS", () => $7d25660af2107580$export$5963299e2424ca1c);
|
|
824
824
|
|
|
825
825
|
|
|
826
826
|
|
|
@@ -828,16 +828,16 @@ $parcel$export($68f42b77897ad65b$exports, "OverlayFS", () => $68f42b77897ad65b$e
|
|
|
828
828
|
|
|
829
829
|
|
|
830
830
|
|
|
831
|
-
class $
|
|
831
|
+
class $7d25660af2107580$export$5963299e2424ca1c {
|
|
832
832
|
deleted = new Set();
|
|
833
833
|
constructor(workerFarmOrFS, readable){
|
|
834
|
-
if (workerFarmOrFS instanceof (0, ($parcel$interopDefault($
|
|
834
|
+
if (workerFarmOrFS instanceof (0, ($parcel$interopDefault($8sOVI$atlaspackworkers)))) this.writable = new (0, $a44e20ab74dfaf6b$export$3048eb7ec07c2c4e)(workerFarmOrFS);
|
|
835
835
|
else this.writable = workerFarmOrFS;
|
|
836
836
|
this.readable = readable;
|
|
837
837
|
this._cwd = readable.cwd();
|
|
838
838
|
}
|
|
839
839
|
static deserialize(opts) {
|
|
840
|
-
let fs = new $
|
|
840
|
+
let fs = new $7d25660af2107580$export$5963299e2424ca1c(opts.writable, opts.readable);
|
|
841
841
|
if (opts.deleted != null) fs.deleted = opts.deleted;
|
|
842
842
|
return fs;
|
|
843
843
|
}
|
|
@@ -851,28 +851,28 @@ class $68f42b77897ad65b$export$5963299e2424ca1c {
|
|
|
851
851
|
}
|
|
852
852
|
_deletedThrows(filePath) {
|
|
853
853
|
filePath = this._normalizePath(filePath);
|
|
854
|
-
if (this.deleted.has(filePath)) throw new $
|
|
854
|
+
if (this.deleted.has(filePath)) throw new $7d25660af2107580$var$FSError('ENOENT', filePath, 'does not exist');
|
|
855
855
|
return filePath;
|
|
856
856
|
}
|
|
857
857
|
_checkExists(filePath) {
|
|
858
858
|
filePath = this._deletedThrows(filePath);
|
|
859
|
-
if (!this.existsSync(filePath)) throw new $
|
|
859
|
+
if (!this.existsSync(filePath)) throw new $7d25660af2107580$var$FSError('ENOENT', filePath, 'does not exist');
|
|
860
860
|
return filePath;
|
|
861
861
|
}
|
|
862
862
|
_isSymlink(filePath) {
|
|
863
863
|
filePath = this._normalizePath(filePath);
|
|
864
864
|
// 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($
|
|
865
|
+
let { root: root, dir: dir, base: base } = (0, ($parcel$interopDefault($8sOVI$path))).parse(filePath);
|
|
866
|
+
let segments = dir.slice(root.length).split((0, ($parcel$interopDefault($8sOVI$path))).sep).concat(base);
|
|
867
867
|
while(segments.length){
|
|
868
|
-
filePath = (0, ($parcel$interopDefault($
|
|
868
|
+
filePath = (0, ($parcel$interopDefault($8sOVI$path))).join(root, ...segments);
|
|
869
869
|
let name = segments.pop();
|
|
870
870
|
if (this.deleted.has(filePath)) return false;
|
|
871
|
-
else if (this.writable instanceof (0, $
|
|
871
|
+
else if (this.writable instanceof (0, $a44e20ab74dfaf6b$export$3048eb7ec07c2c4e) && this.writable.symlinks.has(filePath)) return true;
|
|
872
872
|
else {
|
|
873
873
|
// HACK: Atlaspack fs does not provide `lstatSync`,
|
|
874
874
|
// so we use `readdirSync` to check if the path is a symlink.
|
|
875
|
-
let parent = (0, ($parcel$interopDefault($
|
|
875
|
+
let parent = (0, ($parcel$interopDefault($8sOVI$path))).resolve(filePath, '..');
|
|
876
876
|
if (parent === filePath) return false;
|
|
877
877
|
try {
|
|
878
878
|
for (let dirent of this.readdirSync(parent, {
|
|
@@ -893,12 +893,12 @@ class $68f42b77897ad65b$export$5963299e2424ca1c {
|
|
|
893
893
|
}
|
|
894
894
|
async _copyPathForWrite(filePath) {
|
|
895
895
|
filePath = await this._normalizePath(filePath);
|
|
896
|
-
let dirPath = (0, ($parcel$interopDefault($
|
|
896
|
+
let dirPath = (0, ($parcel$interopDefault($8sOVI$path))).dirname(filePath);
|
|
897
897
|
if (this.existsSync(dirPath) && !this.writable.existsSync(dirPath)) await this.writable.mkdirp(dirPath);
|
|
898
898
|
return filePath;
|
|
899
899
|
}
|
|
900
900
|
_normalizePath(filePath) {
|
|
901
|
-
return (0, ($parcel$interopDefault($
|
|
901
|
+
return (0, ($parcel$interopDefault($8sOVI$path))).resolve(this.cwd(), filePath);
|
|
902
902
|
}
|
|
903
903
|
// eslint-disable-next-line require-await
|
|
904
904
|
async readFile(filePath, encoding) {
|
|
@@ -931,22 +931,22 @@ class $68f42b77897ad65b$export$5963299e2424ca1c {
|
|
|
931
931
|
let toDelete = [
|
|
932
932
|
filePath
|
|
933
933
|
];
|
|
934
|
-
if (this.writable instanceof (0, $
|
|
934
|
+
if (this.writable instanceof (0, $a44e20ab74dfaf6b$export$3048eb7ec07c2c4e) && this._isSymlink(filePath)) this.writable.symlinks.delete(filePath);
|
|
935
935
|
else if (this.statSync(filePath).isDirectory()) {
|
|
936
936
|
let stack = [
|
|
937
937
|
filePath
|
|
938
938
|
];
|
|
939
939
|
// Recursively add every descendant path to deleted.
|
|
940
940
|
while(stack.length){
|
|
941
|
-
let root = (0, (/*@__PURE__*/$parcel$interopDefault($
|
|
941
|
+
let root = (0, (/*@__PURE__*/$parcel$interopDefault($7b68cc90d1a072a1$exports)))(stack.pop());
|
|
942
942
|
for (let ent of this.readdirSync(root, {
|
|
943
943
|
withFileTypes: true
|
|
944
944
|
}))if (typeof ent === 'string') {
|
|
945
|
-
let childPath = (0, ($parcel$interopDefault($
|
|
945
|
+
let childPath = (0, ($parcel$interopDefault($8sOVI$path))).join(root, ent);
|
|
946
946
|
toDelete.push(childPath);
|
|
947
947
|
if (this.statSync(childPath).isDirectory()) stack.push(childPath);
|
|
948
948
|
} else {
|
|
949
|
-
let childPath = (0, ($parcel$interopDefault($
|
|
949
|
+
let childPath = (0, ($parcel$interopDefault($8sOVI$path))).join(root, ent.name);
|
|
950
950
|
toDelete.push(childPath);
|
|
951
951
|
if (ent.isDirectory()) stack.push(childPath);
|
|
952
952
|
}
|
|
@@ -963,10 +963,10 @@ class $68f42b77897ad65b$export$5963299e2424ca1c {
|
|
|
963
963
|
dir = this._normalizePath(dir);
|
|
964
964
|
await this.writable.mkdirp(dir);
|
|
965
965
|
if (this.deleted != null) {
|
|
966
|
-
let root = (0, ($parcel$interopDefault($
|
|
966
|
+
let root = (0, ($parcel$interopDefault($8sOVI$path))).parse(dir).root;
|
|
967
967
|
while(dir !== root){
|
|
968
968
|
this.deleted.delete(dir);
|
|
969
|
-
dir = (0, ($parcel$interopDefault($
|
|
969
|
+
dir = (0, ($parcel$interopDefault($8sOVI$path))).dirname(dir);
|
|
970
970
|
}
|
|
971
971
|
}
|
|
972
972
|
}
|
|
@@ -1052,7 +1052,7 @@ class $68f42b77897ad65b$export$5963299e2424ca1c {
|
|
|
1052
1052
|
let entries = new Map();
|
|
1053
1053
|
try {
|
|
1054
1054
|
for (let entry of this.writable.readdirSync(dir, opts)){
|
|
1055
|
-
let filePath = (0, ($parcel$interopDefault($
|
|
1055
|
+
let filePath = (0, ($parcel$interopDefault($8sOVI$path))).join(dir, entry.name ?? entry);
|
|
1056
1056
|
if (this.deleted.has(filePath)) continue;
|
|
1057
1057
|
entries.set(filePath, entry);
|
|
1058
1058
|
}
|
|
@@ -1061,7 +1061,7 @@ class $68f42b77897ad65b$export$5963299e2424ca1c {
|
|
|
1061
1061
|
}
|
|
1062
1062
|
try {
|
|
1063
1063
|
for (let entry of this.readable.readdirSync(dir, opts)){
|
|
1064
|
-
let filePath = (0, ($parcel$interopDefault($
|
|
1064
|
+
let filePath = (0, ($parcel$interopDefault($8sOVI$path))).join(dir, entry.name ?? entry);
|
|
1065
1065
|
if (this.deleted.has(filePath)) continue;
|
|
1066
1066
|
if (entries.has(filePath)) continue;
|
|
1067
1067
|
entries.set(filePath, entry);
|
|
@@ -1093,16 +1093,16 @@ class $68f42b77897ad65b$export$5963299e2424ca1c {
|
|
|
1093
1093
|
await this.writable.writeSnapshot(dir, snapshot, opts);
|
|
1094
1094
|
}
|
|
1095
1095
|
findAncestorFile(fileNames, fromDir, root) {
|
|
1096
|
-
return (0, $
|
|
1096
|
+
return (0, $daab8b558e6f5694$export$d51a93c758976388)(this, fileNames, fromDir, root);
|
|
1097
1097
|
}
|
|
1098
1098
|
findNodeModule(moduleName, fromDir) {
|
|
1099
|
-
return (0, $
|
|
1099
|
+
return (0, $daab8b558e6f5694$export$4c6d088a7d7f9947)(this, moduleName, fromDir);
|
|
1100
1100
|
}
|
|
1101
1101
|
findFirstFile(filePaths) {
|
|
1102
|
-
return (0, $
|
|
1102
|
+
return (0, $daab8b558e6f5694$export$64df6e3182fd5b2d)(this, filePaths);
|
|
1103
1103
|
}
|
|
1104
1104
|
}
|
|
1105
|
-
class $
|
|
1105
|
+
class $7d25660af2107580$var$FSError extends Error {
|
|
1106
1106
|
constructor(code, path, message){
|
|
1107
1107
|
super(`${code}: ${path} ${message}`);
|
|
1108
1108
|
this.name = 'FSError';
|
|
@@ -1111,24 +1111,24 @@ class $68f42b77897ad65b$var$FSError extends Error {
|
|
|
1111
1111
|
Error.captureStackTrace?.(this, this.constructor);
|
|
1112
1112
|
}
|
|
1113
1113
|
}
|
|
1114
|
-
(0, $
|
|
1114
|
+
(0, $8sOVI$atlaspackbuildcache.registerSerializableClass)(`${(0, (/*@__PURE__*/$parcel$interopDefault($867c50d101d36a7d$exports))).version}:OverlayFS`, $7d25660af2107580$export$5963299e2424ca1c);
|
|
1115
1115
|
|
|
1116
1116
|
|
|
1117
|
-
const $
|
|
1118
|
-
async function $
|
|
1117
|
+
const $42d1854b7a928fd5$var$pipeline = (0, $8sOVI$util.promisify)((0, ($parcel$interopDefault($8sOVI$stream))).pipeline);
|
|
1118
|
+
async function $42d1854b7a928fd5$export$d3a8044e3fef7335(sourceFS, source, destinationFS, destination) {
|
|
1119
1119
|
await destinationFS.mkdirp(destination);
|
|
1120
1120
|
let files = await sourceFS.readdir(source);
|
|
1121
1121
|
for (let file of files){
|
|
1122
|
-
let sourcePath = (0, ($parcel$interopDefault($
|
|
1123
|
-
let destPath = (0, ($parcel$interopDefault($
|
|
1122
|
+
let sourcePath = (0, ($parcel$interopDefault($8sOVI$path))).join(source, file);
|
|
1123
|
+
let destPath = (0, ($parcel$interopDefault($8sOVI$path))).join(destination, file);
|
|
1124
1124
|
let stats = await sourceFS.stat(sourcePath);
|
|
1125
|
-
if (stats.isFile()) await $
|
|
1126
|
-
else if (stats.isDirectory()) await $
|
|
1125
|
+
if (stats.isFile()) await $42d1854b7a928fd5$var$pipeline(sourceFS.createReadStream(sourcePath), destinationFS.createWriteStream(destPath));
|
|
1126
|
+
else if (stats.isDirectory()) await $42d1854b7a928fd5$export$d3a8044e3fef7335(sourceFS, sourcePath, destinationFS, destPath);
|
|
1127
1127
|
}
|
|
1128
1128
|
}
|
|
1129
|
-
$parcel$exportWildcard(module.exports, $
|
|
1130
|
-
$parcel$exportWildcard(module.exports, $
|
|
1131
|
-
$parcel$exportWildcard(module.exports, $
|
|
1129
|
+
$parcel$exportWildcard(module.exports, $87241760c4ff27c3$exports);
|
|
1130
|
+
$parcel$exportWildcard(module.exports, $a44e20ab74dfaf6b$exports);
|
|
1131
|
+
$parcel$exportWildcard(module.exports, $7d25660af2107580$exports);
|
|
1132
1132
|
|
|
1133
1133
|
|
|
1134
1134
|
//# sourceMappingURL=browser.js.map
|