@atlaspack/fs 2.13.1-canary.3631 → 2.13.1
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 +15 -0
- package/lib/browser.js +183 -181
- package/lib/browser.js.map +1 -1
- package/lib/index.js +354 -352
- package/lib/index.js.map +1 -1
- package/package.json +15 -11
- package/src/NodeVCSAwareFS.js +7 -7
- package/LICENSE +0 -201
package/lib/browser.js
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
var $
|
|
2
|
-
var $
|
|
3
|
-
var $
|
|
4
|
-
var $
|
|
5
|
-
var $
|
|
6
|
-
var $
|
|
7
|
-
var $
|
|
8
|
-
var $
|
|
9
|
-
var $
|
|
1
|
+
var $jF595$path = require("path");
|
|
2
|
+
var $jF595$stream = require("stream");
|
|
3
|
+
var $jF595$util = require("util");
|
|
4
|
+
var $jF595$buffer = require("buffer");
|
|
5
|
+
var $jF595$atlaspackbuildcache = require("@atlaspack/build-cache");
|
|
6
|
+
var $jF595$atlaspackutils = require("@atlaspack/utils");
|
|
7
|
+
var $jF595$atlaspackworkers = require("@atlaspack/workers");
|
|
8
|
+
var $jF595$events = require("events");
|
|
9
|
+
var $jF595$atlaspackrust = require("@atlaspack/rust");
|
|
10
|
+
var $jF595$atlaspacklogger = require("@atlaspack/logger");
|
|
10
11
|
|
|
11
12
|
|
|
12
13
|
function $parcel$interopDefault(a) {
|
|
@@ -34,77 +35,77 @@ function $parcel$export(e, n, v, s) {
|
|
|
34
35
|
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
|
|
35
36
|
}
|
|
36
37
|
|
|
37
|
-
$parcel$export(module.exports, "ncp", () => $
|
|
38
|
+
$parcel$export(module.exports, "ncp", () => $81d23888a9e9b3a9$export$d3a8044e3fef7335);
|
|
38
39
|
|
|
39
40
|
|
|
40
41
|
|
|
41
|
-
var $
|
|
42
|
+
var $3efdc9f199571449$exports = {};
|
|
42
43
|
|
|
43
|
-
$parcel$export($
|
|
44
|
+
$parcel$export($3efdc9f199571449$exports, "NodeFS", () => $3efdc9f199571449$export$c4e0ef2ab73c21e7);
|
|
44
45
|
// $FlowFixMe[prop-missing] handled by the throwing constructor
|
|
45
|
-
class $
|
|
46
|
+
class $3efdc9f199571449$export$c4e0ef2ab73c21e7 {
|
|
46
47
|
constructor(){
|
|
47
48
|
throw new Error("NodeFS isn't available in the browser");
|
|
48
49
|
}
|
|
49
50
|
}
|
|
50
51
|
|
|
51
52
|
|
|
52
|
-
var $
|
|
53
|
+
var $ce546cd73efa5b9e$exports = {};
|
|
53
54
|
|
|
54
|
-
$parcel$export($
|
|
55
|
-
$parcel$export($
|
|
56
|
-
$parcel$export($
|
|
57
|
-
$parcel$export($
|
|
55
|
+
$parcel$export($ce546cd73efa5b9e$exports, "MemoryFS", () => $ce546cd73efa5b9e$export$3048eb7ec07c2c4e);
|
|
56
|
+
$parcel$export($ce546cd73efa5b9e$exports, "FSError", () => $ce546cd73efa5b9e$export$d414276624ebf134);
|
|
57
|
+
$parcel$export($ce546cd73efa5b9e$exports, "makeShared", () => $ce546cd73efa5b9e$export$df9eb3e75aa27a22);
|
|
58
|
+
$parcel$export($ce546cd73efa5b9e$exports, "File", () => $ce546cd73efa5b9e$export$b6afa8811b7e644e);
|
|
58
59
|
|
|
59
60
|
|
|
60
61
|
|
|
61
62
|
|
|
62
|
-
var $
|
|
63
|
-
$
|
|
63
|
+
var $a29f1902b85e3e69$exports = {};
|
|
64
|
+
$a29f1902b85e3e69$exports = JSON.parse("{\"name\":\"@atlaspack/fs\",\"version\":\"2.13.2-canary.3634+14fb7718e\",\"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/diagnostic\":false,\"@atlaspack/feature-flags\":false,\"@atlaspack/logger\":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/diagnostic\":false,\"@atlaspack/feature-flags\":false,\"@atlaspack/logger\":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.13.2-canary.3634+14fb7718e\",\"@atlaspack/feature-flags\":\"2.13.2-canary.3634+14fb7718e\",\"@atlaspack/logger\":\"2.13.2-canary.3634+14fb7718e\",\"@atlaspack/rust\":\"2.13.2-canary.3634+14fb7718e\",\"@atlaspack/types-internal\":\"2.13.2-canary.3634+14fb7718e\",\"@atlaspack/utils\":\"2.13.2-canary.3634+14fb7718e\",\"@atlaspack/workers\":\"2.13.2-canary.3634+14fb7718e\",\"@parcel/watcher\":\"^2.0.7\"},\"devDependencies\":{\"@atlaspack/watcher-watchman-js\":\"2.13.2-canary.3634+14fb7718e\",\"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\":\"14fb7718e1f24e890b92354c645049300691ee8c\"}");
|
|
64
65
|
|
|
65
66
|
|
|
66
67
|
|
|
67
|
-
var $
|
|
68
|
+
var $500746ffcc30dcc7$exports = {};
|
|
68
69
|
'use strict';
|
|
69
|
-
function $
|
|
70
|
+
function $500746ffcc30dcc7$var$nullthrows(x, message) {
|
|
70
71
|
if (x != null) return x;
|
|
71
72
|
var error = new Error(message !== undefined ? message : 'Got unexpected ' + x);
|
|
72
73
|
error.framesToPop = 1; // Skip nullthrows's own stack frame.
|
|
73
74
|
throw error;
|
|
74
75
|
}
|
|
75
|
-
$
|
|
76
|
-
$
|
|
77
|
-
Object.defineProperty($
|
|
76
|
+
$500746ffcc30dcc7$exports = $500746ffcc30dcc7$var$nullthrows;
|
|
77
|
+
$500746ffcc30dcc7$exports.default = $500746ffcc30dcc7$var$nullthrows;
|
|
78
|
+
Object.defineProperty($500746ffcc30dcc7$exports, '__esModule', {
|
|
78
79
|
value: true
|
|
79
80
|
});
|
|
80
81
|
|
|
81
82
|
|
|
82
83
|
|
|
83
84
|
|
|
84
|
-
function $
|
|
85
|
-
let { root: root } = (0, ($parcel$interopDefault($
|
|
85
|
+
function $7f6bcebe3ce84296$export$4c6d088a7d7f9947(fs, moduleName, dir) {
|
|
86
|
+
let { root: root } = (0, ($parcel$interopDefault($jF595$path))).parse(dir);
|
|
86
87
|
while(dir !== root){
|
|
87
88
|
// Skip node_modules directories
|
|
88
|
-
if ((0, ($parcel$interopDefault($
|
|
89
|
+
if ((0, ($parcel$interopDefault($jF595$path))).basename(dir) === 'node_modules') dir = (0, ($parcel$interopDefault($jF595$path))).dirname(dir);
|
|
89
90
|
try {
|
|
90
|
-
let moduleDir = (0, ($parcel$interopDefault($
|
|
91
|
+
let moduleDir = (0, ($parcel$interopDefault($jF595$path))).join(dir, 'node_modules', moduleName);
|
|
91
92
|
let stats = fs.statSync(moduleDir);
|
|
92
93
|
if (stats.isDirectory()) return moduleDir;
|
|
93
94
|
} catch (err) {
|
|
94
95
|
// ignore
|
|
95
96
|
}
|
|
96
97
|
// Move up a directory
|
|
97
|
-
dir = (0, ($parcel$interopDefault($
|
|
98
|
+
dir = (0, ($parcel$interopDefault($jF595$path))).dirname(dir);
|
|
98
99
|
}
|
|
99
100
|
return null;
|
|
100
101
|
}
|
|
101
|
-
function $
|
|
102
|
-
let { root: pathRoot } = (0, ($parcel$interopDefault($
|
|
102
|
+
function $7f6bcebe3ce84296$export$d51a93c758976388(fs, fileNames, dir, root) {
|
|
103
|
+
let { root: pathRoot } = (0, ($parcel$interopDefault($jF595$path))).parse(dir);
|
|
103
104
|
// eslint-disable-next-line no-constant-condition
|
|
104
105
|
while(true){
|
|
105
|
-
if ((0, ($parcel$interopDefault($
|
|
106
|
+
if ((0, ($parcel$interopDefault($jF595$path))).basename(dir) === 'node_modules') return null;
|
|
106
107
|
for (const fileName of fileNames){
|
|
107
|
-
let filePath = (0, ($parcel$interopDefault($
|
|
108
|
+
let filePath = (0, ($parcel$interopDefault($jF595$path))).join(dir, fileName);
|
|
108
109
|
try {
|
|
109
110
|
if (fs.statSync(filePath).isFile()) return filePath;
|
|
110
111
|
} catch (err) {
|
|
@@ -112,11 +113,11 @@ function $daab8b558e6f5694$export$d51a93c758976388(fs, fileNames, dir, root) {
|
|
|
112
113
|
}
|
|
113
114
|
}
|
|
114
115
|
if (dir === root || dir === pathRoot) break;
|
|
115
|
-
dir = (0, ($parcel$interopDefault($
|
|
116
|
+
dir = (0, ($parcel$interopDefault($jF595$path))).dirname(dir);
|
|
116
117
|
}
|
|
117
118
|
return null;
|
|
118
119
|
}
|
|
119
|
-
function $
|
|
120
|
+
function $7f6bcebe3ce84296$export$64df6e3182fd5b2d(fs, filePaths) {
|
|
120
121
|
for (let filePath of filePaths)try {
|
|
121
122
|
if (fs.statSync(filePath).isFile()) return filePath;
|
|
122
123
|
} catch (err) {
|
|
@@ -126,46 +127,46 @@ function $daab8b558e6f5694$export$64df6e3182fd5b2d(fs, filePaths) {
|
|
|
126
127
|
|
|
127
128
|
|
|
128
129
|
|
|
129
|
-
var $
|
|
130
|
-
const $
|
|
131
|
-
let $
|
|
132
|
-
class $
|
|
130
|
+
var $ce546cd73efa5b9e$require$Buffer = $jF595$buffer.Buffer;
|
|
131
|
+
const $ce546cd73efa5b9e$var$instances = new Map();
|
|
132
|
+
let $ce546cd73efa5b9e$var$id = 0;
|
|
133
|
+
class $ce546cd73efa5b9e$export$3048eb7ec07c2c4e {
|
|
133
134
|
_numWorkerInstances = 0;
|
|
134
135
|
_workerRegisterResolves = [];
|
|
135
|
-
_emitter = new (0, ($parcel$interopDefault($
|
|
136
|
+
_emitter = new (0, ($parcel$interopDefault($jF595$events)))();
|
|
136
137
|
constructor(workerFarm){
|
|
137
138
|
this.farm = workerFarm;
|
|
138
|
-
this._cwd = (0, ($parcel$interopDefault($
|
|
139
|
+
this._cwd = (0, ($parcel$interopDefault($jF595$path))).resolve((0, ($parcel$interopDefault($jF595$path))).sep);
|
|
139
140
|
this.dirs = new Map([
|
|
140
141
|
[
|
|
141
142
|
this._cwd,
|
|
142
|
-
new $
|
|
143
|
+
new $ce546cd73efa5b9e$var$Directory()
|
|
143
144
|
]
|
|
144
145
|
]);
|
|
145
146
|
this.files = new Map();
|
|
146
147
|
this.symlinks = new Map();
|
|
147
148
|
this.watchers = new Map();
|
|
148
149
|
this.events = [];
|
|
149
|
-
this.id = $
|
|
150
|
+
this.id = $ce546cd73efa5b9e$var$id++;
|
|
150
151
|
this._workerHandles = [];
|
|
151
152
|
this._eventQueue = [];
|
|
152
|
-
$
|
|
153
|
+
$ce546cd73efa5b9e$var$instances.set(this.id, this);
|
|
153
154
|
this._emitter.on('allWorkersRegistered', ()=>{
|
|
154
155
|
for (let resolve of this._workerRegisterResolves)resolve();
|
|
155
156
|
this._workerRegisterResolves = [];
|
|
156
157
|
});
|
|
157
158
|
}
|
|
158
159
|
static deserialize(opts) {
|
|
159
|
-
let existing = $
|
|
160
|
+
let existing = $ce546cd73efa5b9e$var$instances.get(opts.id);
|
|
160
161
|
if (existing != null) {
|
|
161
162
|
// Correct the count of worker instances since serialization assumes a new instance is created
|
|
162
|
-
(0, ($parcel$interopDefault($
|
|
163
|
+
(0, ($parcel$interopDefault($jF595$atlaspackworkers))).getWorkerApi().runHandle(opts.handle, [
|
|
163
164
|
'decrementWorkerInstance',
|
|
164
165
|
[]
|
|
165
166
|
]);
|
|
166
167
|
return existing;
|
|
167
168
|
}
|
|
168
|
-
let fs = new $
|
|
169
|
+
let fs = new $ce546cd73efa5b9e$var$WorkerFS(opts.id, (0, (/*@__PURE__*/$parcel$interopDefault($500746ffcc30dcc7$exports)))(opts.handle));
|
|
169
170
|
fs.dirs = opts.dirs;
|
|
170
171
|
fs.files = opts.files;
|
|
171
172
|
fs.symlinks = opts.symlinks;
|
|
@@ -198,15 +199,15 @@ class $a44e20ab74dfaf6b$export$3048eb7ec07c2c4e {
|
|
|
198
199
|
this._cwd = dir;
|
|
199
200
|
}
|
|
200
201
|
_normalizePath(filePath, realpath = true) {
|
|
201
|
-
filePath = (0, ($parcel$interopDefault($
|
|
202
|
-
if (!filePath.startsWith(this.cwd())) filePath = (0, ($parcel$interopDefault($
|
|
202
|
+
filePath = (0, ($parcel$interopDefault($jF595$path))).normalize(filePath);
|
|
203
|
+
if (!filePath.startsWith(this.cwd())) filePath = (0, ($parcel$interopDefault($jF595$path))).resolve(this.cwd(), filePath);
|
|
203
204
|
// get realpath by following symlinks
|
|
204
205
|
if (realpath) {
|
|
205
|
-
let { root: root, dir: dir, base: base } = (0, ($parcel$interopDefault($
|
|
206
|
-
let parts = dir.slice(root.length).split((0, ($parcel$interopDefault($
|
|
206
|
+
let { root: root, dir: dir, base: base } = (0, ($parcel$interopDefault($jF595$path))).parse(filePath);
|
|
207
|
+
let parts = dir.slice(root.length).split((0, ($parcel$interopDefault($jF595$path))).sep).concat(base);
|
|
207
208
|
let res = root;
|
|
208
209
|
for (let part of parts){
|
|
209
|
-
res = (0, ($parcel$interopDefault($
|
|
210
|
+
res = (0, ($parcel$interopDefault($jF595$path))).join(res, part);
|
|
210
211
|
let symlink = this.symlinks.get(res);
|
|
211
212
|
if (symlink) res = symlink;
|
|
212
213
|
}
|
|
@@ -216,16 +217,16 @@ class $a44e20ab74dfaf6b$export$3048eb7ec07c2c4e {
|
|
|
216
217
|
}
|
|
217
218
|
async writeFile(filePath, contents, options) {
|
|
218
219
|
filePath = this._normalizePath(filePath);
|
|
219
|
-
if (this.dirs.has(filePath)) throw new $
|
|
220
|
-
let dir = (0, ($parcel$interopDefault($
|
|
221
|
-
if (!this.dirs.has(dir)) throw new $
|
|
222
|
-
let buffer = $
|
|
220
|
+
if (this.dirs.has(filePath)) throw new $ce546cd73efa5b9e$export$d414276624ebf134('EISDIR', filePath, 'is a directory');
|
|
221
|
+
let dir = (0, ($parcel$interopDefault($jF595$path))).dirname(filePath);
|
|
222
|
+
if (!this.dirs.has(dir)) throw new $ce546cd73efa5b9e$export$d414276624ebf134('ENOENT', dir, 'does not exist');
|
|
223
|
+
let buffer = $ce546cd73efa5b9e$export$df9eb3e75aa27a22(contents);
|
|
223
224
|
let file = this.files.get(filePath);
|
|
224
225
|
let mode = options && options.mode || 438;
|
|
225
226
|
if (file) {
|
|
226
227
|
file.write(buffer, mode);
|
|
227
228
|
this.files.set(filePath, file);
|
|
228
|
-
} else this.files.set(filePath, new $
|
|
229
|
+
} else this.files.set(filePath, new $ce546cd73efa5b9e$export$b6afa8811b7e644e(buffer, mode));
|
|
229
230
|
await this._sendWorkerEvent({
|
|
230
231
|
type: 'writeFile',
|
|
231
232
|
path: filePath,
|
|
@@ -243,7 +244,7 @@ class $a44e20ab74dfaf6b$export$3048eb7ec07c2c4e {
|
|
|
243
244
|
readFileSync(filePath, encoding) {
|
|
244
245
|
filePath = this._normalizePath(filePath);
|
|
245
246
|
let file = this.files.get(filePath);
|
|
246
|
-
if (file == null) throw new $
|
|
247
|
+
if (file == null) throw new $ce546cd73efa5b9e$export$d414276624ebf134('ENOENT', filePath, 'does not exist');
|
|
247
248
|
let buffer = file.read();
|
|
248
249
|
if (encoding) return buffer.toString(encoding);
|
|
249
250
|
return buffer;
|
|
@@ -257,7 +258,7 @@ class $a44e20ab74dfaf6b$export$3048eb7ec07c2c4e {
|
|
|
257
258
|
let dir = this.dirs.get(filePath);
|
|
258
259
|
if (dir) return dir.stat();
|
|
259
260
|
let file = this.files.get(filePath);
|
|
260
|
-
if (file == null) throw new $
|
|
261
|
+
if (file == null) throw new $ce546cd73efa5b9e$export$d414276624ebf134('ENOENT', filePath, 'does not exist');
|
|
261
262
|
return file.stat();
|
|
262
263
|
}
|
|
263
264
|
// eslint-disable-next-line require-await
|
|
@@ -266,26 +267,26 @@ class $a44e20ab74dfaf6b$export$3048eb7ec07c2c4e {
|
|
|
266
267
|
}
|
|
267
268
|
readdirSync(dir, opts) {
|
|
268
269
|
dir = this._normalizePath(dir);
|
|
269
|
-
if (!this.dirs.has(dir)) throw new $
|
|
270
|
-
if (!dir.endsWith((0, ($parcel$interopDefault($
|
|
270
|
+
if (!this.dirs.has(dir)) throw new $ce546cd73efa5b9e$export$d414276624ebf134('ENOENT', dir, 'does not exist');
|
|
271
|
+
if (!dir.endsWith((0, ($parcel$interopDefault($jF595$path))).sep)) dir += (0, ($parcel$interopDefault($jF595$path))).sep;
|
|
271
272
|
let res = [];
|
|
272
273
|
for (let [filePath, entry] of this.dirs){
|
|
273
274
|
if (filePath === dir) continue;
|
|
274
|
-
if (filePath.startsWith(dir) && filePath.indexOf((0, ($parcel$interopDefault($
|
|
275
|
+
if (filePath.startsWith(dir) && filePath.indexOf((0, ($parcel$interopDefault($jF595$path))).sep, dir.length) === -1) {
|
|
275
276
|
let name = filePath.slice(dir.length);
|
|
276
|
-
if (opts?.withFileTypes) res.push(new $
|
|
277
|
+
if (opts?.withFileTypes) res.push(new $ce546cd73efa5b9e$var$Dirent(name, entry));
|
|
277
278
|
else res.push(name);
|
|
278
279
|
}
|
|
279
280
|
}
|
|
280
|
-
for (let [filePath, entry] of this.files)if (filePath.startsWith(dir) && filePath.indexOf((0, ($parcel$interopDefault($
|
|
281
|
+
for (let [filePath, entry] of this.files)if (filePath.startsWith(dir) && filePath.indexOf((0, ($parcel$interopDefault($jF595$path))).sep, dir.length) === -1) {
|
|
281
282
|
let name = filePath.slice(dir.length);
|
|
282
|
-
if (opts?.withFileTypes) res.push(new $
|
|
283
|
+
if (opts?.withFileTypes) res.push(new $ce546cd73efa5b9e$var$Dirent(name, entry));
|
|
283
284
|
else res.push(name);
|
|
284
285
|
}
|
|
285
|
-
for (let [from] of this.symlinks)if (from.startsWith(dir) && from.indexOf((0, ($parcel$interopDefault($
|
|
286
|
+
for (let [from] of this.symlinks)if (from.startsWith(dir) && from.indexOf((0, ($parcel$interopDefault($jF595$path))).sep, dir.length) === -1) {
|
|
286
287
|
let name = from.slice(dir.length);
|
|
287
|
-
if (opts?.withFileTypes) res.push(new $
|
|
288
|
-
mode: $
|
|
288
|
+
if (opts?.withFileTypes) res.push(new $ce546cd73efa5b9e$var$Dirent(name, {
|
|
289
|
+
mode: $ce546cd73efa5b9e$var$S_IFLNK
|
|
289
290
|
}));
|
|
290
291
|
else res.push(name);
|
|
291
292
|
}
|
|
@@ -297,7 +298,7 @@ class $a44e20ab74dfaf6b$export$3048eb7ec07c2c4e {
|
|
|
297
298
|
}
|
|
298
299
|
async unlink(filePath) {
|
|
299
300
|
filePath = this._normalizePath(filePath);
|
|
300
|
-
if (!this.files.has(filePath) && !this.dirs.has(filePath)) throw new $
|
|
301
|
+
if (!this.files.has(filePath) && !this.dirs.has(filePath)) throw new $ce546cd73efa5b9e$export$d414276624ebf134('ENOENT', filePath, 'does not exist');
|
|
301
302
|
this.files.delete(filePath);
|
|
302
303
|
this.dirs.delete(filePath);
|
|
303
304
|
this.watchers.delete(filePath);
|
|
@@ -314,11 +315,11 @@ class $a44e20ab74dfaf6b$export$3048eb7ec07c2c4e {
|
|
|
314
315
|
async mkdirp(dir) {
|
|
315
316
|
dir = this._normalizePath(dir);
|
|
316
317
|
if (this.dirs.has(dir)) return Promise.resolve();
|
|
317
|
-
if (this.files.has(dir)) throw new $
|
|
318
|
-
let root = (0, ($parcel$interopDefault($
|
|
318
|
+
if (this.files.has(dir)) throw new $ce546cd73efa5b9e$export$d414276624ebf134('ENOENT', dir, 'is not a directory');
|
|
319
|
+
let root = (0, ($parcel$interopDefault($jF595$path))).parse(dir).root;
|
|
319
320
|
while(dir !== root){
|
|
320
321
|
if (this.dirs.has(dir)) break;
|
|
321
|
-
this.dirs.set(dir, new $
|
|
322
|
+
this.dirs.set(dir, new $ce546cd73efa5b9e$var$Directory());
|
|
322
323
|
await this._sendWorkerEvent({
|
|
323
324
|
type: 'mkdir',
|
|
324
325
|
path: dir
|
|
@@ -327,14 +328,14 @@ class $a44e20ab74dfaf6b$export$3048eb7ec07c2c4e {
|
|
|
327
328
|
type: 'create',
|
|
328
329
|
path: dir
|
|
329
330
|
});
|
|
330
|
-
dir = (0, ($parcel$interopDefault($
|
|
331
|
+
dir = (0, ($parcel$interopDefault($jF595$path))).dirname(dir);
|
|
331
332
|
}
|
|
332
333
|
return Promise.resolve();
|
|
333
334
|
}
|
|
334
335
|
async rimraf(filePath) {
|
|
335
336
|
filePath = this._normalizePath(filePath);
|
|
336
337
|
if (this.dirs.has(filePath)) {
|
|
337
|
-
let dir = filePath + (0, ($parcel$interopDefault($
|
|
338
|
+
let dir = filePath + (0, ($parcel$interopDefault($jF595$path))).sep;
|
|
338
339
|
for (let filePath of this.files.keys())if (filePath.startsWith(dir)) {
|
|
339
340
|
this.files.delete(filePath);
|
|
340
341
|
await this._sendWorkerEvent({
|
|
@@ -391,7 +392,7 @@ class $a44e20ab74dfaf6b$export$3048eb7ec07c2c4e {
|
|
|
391
392
|
source = this._normalizePath(source);
|
|
392
393
|
if (this.dirs.has(source)) {
|
|
393
394
|
if (!this.dirs.has(destination)) {
|
|
394
|
-
this.dirs.set(destination, new $
|
|
395
|
+
this.dirs.set(destination, new $ce546cd73efa5b9e$var$Directory());
|
|
395
396
|
await this._sendWorkerEvent({
|
|
396
397
|
type: 'mkdir',
|
|
397
398
|
path: destination
|
|
@@ -401,11 +402,11 @@ class $a44e20ab74dfaf6b$export$3048eb7ec07c2c4e {
|
|
|
401
402
|
path: destination
|
|
402
403
|
});
|
|
403
404
|
}
|
|
404
|
-
let dir = source + (0, ($parcel$interopDefault($
|
|
405
|
+
let dir = source + (0, ($parcel$interopDefault($jF595$path))).sep;
|
|
405
406
|
for (let dirPath of this.dirs.keys())if (dirPath.startsWith(dir)) {
|
|
406
|
-
let destName = (0, ($parcel$interopDefault($
|
|
407
|
+
let destName = (0, ($parcel$interopDefault($jF595$path))).join(destination, dirPath.slice(dir.length));
|
|
407
408
|
if (!this.dirs.has(destName)) {
|
|
408
|
-
this.dirs.set(destName, new $
|
|
409
|
+
this.dirs.set(destName, new $ce546cd73efa5b9e$var$Directory());
|
|
409
410
|
await this._sendWorkerEvent({
|
|
410
411
|
type: 'mkdir',
|
|
411
412
|
path: destination
|
|
@@ -417,7 +418,7 @@ class $a44e20ab74dfaf6b$export$3048eb7ec07c2c4e {
|
|
|
417
418
|
}
|
|
418
419
|
}
|
|
419
420
|
for (let [filePath, file] of this.files)if (filePath.startsWith(dir)) {
|
|
420
|
-
let destName = (0, ($parcel$interopDefault($
|
|
421
|
+
let destName = (0, ($parcel$interopDefault($jF595$path))).join(destination, filePath.slice(dir.length));
|
|
421
422
|
let exists = this.files.has(destName);
|
|
422
423
|
this.files.set(destName, file);
|
|
423
424
|
await this._sendWorkerEvent({
|
|
@@ -433,10 +434,10 @@ class $a44e20ab74dfaf6b$export$3048eb7ec07c2c4e {
|
|
|
433
434
|
} else await this.copyFile(source, destination);
|
|
434
435
|
}
|
|
435
436
|
createReadStream(filePath) {
|
|
436
|
-
return new $
|
|
437
|
+
return new $ce546cd73efa5b9e$var$ReadStream(this, filePath);
|
|
437
438
|
}
|
|
438
439
|
createWriteStream(filePath, options) {
|
|
439
|
-
return new $
|
|
440
|
+
return new $ce546cd73efa5b9e$var$WriteStream(this, filePath, options);
|
|
440
441
|
}
|
|
441
442
|
realpathSync(filePath) {
|
|
442
443
|
return this._normalizePath(filePath);
|
|
@@ -473,7 +474,7 @@ class $a44e20ab74dfaf6b$export$3048eb7ec07c2c4e {
|
|
|
473
474
|
let events = this._eventQueue;
|
|
474
475
|
this._eventQueue = [];
|
|
475
476
|
for (let [dir, watchers] of this.watchers){
|
|
476
|
-
if (!dir.endsWith((0, ($parcel$interopDefault($
|
|
477
|
+
if (!dir.endsWith((0, ($parcel$interopDefault($jF595$path))).sep)) dir += (0, ($parcel$interopDefault($jF595$path))).sep;
|
|
477
478
|
if (event.path.startsWith(dir)) for (let watcher of watchers)watcher.trigger(events);
|
|
478
479
|
}
|
|
479
480
|
}, 50);
|
|
@@ -491,7 +492,7 @@ class $a44e20ab74dfaf6b$export$3048eb7ec07c2c4e {
|
|
|
491
492
|
}
|
|
492
493
|
watch(dir, fn, opts) {
|
|
493
494
|
dir = this._normalizePath(dir);
|
|
494
|
-
let watcher = new $
|
|
495
|
+
let watcher = new $ce546cd73efa5b9e$var$Watcher(fn, opts);
|
|
495
496
|
let watchers = this.watchers.get(dir);
|
|
496
497
|
if (!watchers) {
|
|
497
498
|
watchers = new Set();
|
|
@@ -500,7 +501,7 @@ class $a44e20ab74dfaf6b$export$3048eb7ec07c2c4e {
|
|
|
500
501
|
watchers.add(watcher);
|
|
501
502
|
return Promise.resolve({
|
|
502
503
|
unsubscribe: ()=>{
|
|
503
|
-
watchers = (0, (/*@__PURE__*/$parcel$interopDefault($
|
|
504
|
+
watchers = (0, (/*@__PURE__*/$parcel$interopDefault($500746ffcc30dcc7$exports)))(watchers);
|
|
504
505
|
watchers.delete(watcher);
|
|
505
506
|
if (watchers.size === 0) this.watchers.delete(dir);
|
|
506
507
|
return Promise.resolve();
|
|
@@ -512,35 +513,35 @@ class $a44e20ab74dfaf6b$export$3048eb7ec07c2c4e {
|
|
|
512
513
|
let len = Number(contents);
|
|
513
514
|
let events = this.events.slice(len);
|
|
514
515
|
let ignore = opts.ignore;
|
|
515
|
-
if (ignore) events = events.filter((event)=>!ignore.some((i)=>event.path.startsWith(i + (0, ($parcel$interopDefault($
|
|
516
|
+
if (ignore) events = events.filter((event)=>!ignore.some((i)=>event.path.startsWith(i + (0, ($parcel$interopDefault($jF595$path))).sep)));
|
|
516
517
|
return events;
|
|
517
518
|
}
|
|
518
519
|
async writeSnapshot(dir, snapshot) {
|
|
519
|
-
await this.mkdirp((0, ($parcel$interopDefault($
|
|
520
|
+
await this.mkdirp((0, ($parcel$interopDefault($jF595$path))).dirname(snapshot));
|
|
520
521
|
await this.writeFile(snapshot, '' + this.events.length);
|
|
521
522
|
}
|
|
522
523
|
findAncestorFile(fileNames, fromDir, root) {
|
|
523
|
-
return (0, $
|
|
524
|
+
return (0, $7f6bcebe3ce84296$export$d51a93c758976388)(this, fileNames, fromDir, root);
|
|
524
525
|
}
|
|
525
526
|
findNodeModule(moduleName, fromDir) {
|
|
526
|
-
return (0, $
|
|
527
|
+
return (0, $7f6bcebe3ce84296$export$4c6d088a7d7f9947)(this, moduleName, fromDir);
|
|
527
528
|
}
|
|
528
529
|
findFirstFile(filePaths) {
|
|
529
|
-
return (0, $
|
|
530
|
+
return (0, $7f6bcebe3ce84296$export$64df6e3182fd5b2d)(this, filePaths);
|
|
530
531
|
}
|
|
531
532
|
}
|
|
532
|
-
class $
|
|
533
|
+
class $ce546cd73efa5b9e$var$Watcher {
|
|
533
534
|
constructor(fn, options){
|
|
534
535
|
this.fn = fn;
|
|
535
536
|
this.options = options;
|
|
536
537
|
}
|
|
537
538
|
trigger(events) {
|
|
538
539
|
let ignore = this.options.ignore;
|
|
539
|
-
if (ignore) events = events.filter((event)=>!ignore.some((i)=>event.path.startsWith(i + (0, ($parcel$interopDefault($
|
|
540
|
+
if (ignore) events = events.filter((event)=>!ignore.some((i)=>event.path.startsWith(i + (0, ($parcel$interopDefault($jF595$path))).sep)));
|
|
540
541
|
if (events.length > 0) this.fn(null, events);
|
|
541
542
|
}
|
|
542
543
|
}
|
|
543
|
-
class $
|
|
544
|
+
class $ce546cd73efa5b9e$export$d414276624ebf134 extends Error {
|
|
544
545
|
constructor(code, path, message){
|
|
545
546
|
super(`${code}: ${path} ${message}`);
|
|
546
547
|
this.name = 'FSError';
|
|
@@ -549,7 +550,7 @@ class $a44e20ab74dfaf6b$export$d414276624ebf134 extends Error {
|
|
|
549
550
|
Error.captureStackTrace?.(this, this.constructor);
|
|
550
551
|
}
|
|
551
552
|
}
|
|
552
|
-
class $
|
|
553
|
+
class $ce546cd73efa5b9e$var$ReadStream extends (0, $jF595$stream.Readable) {
|
|
553
554
|
constructor(fs, filePath){
|
|
554
555
|
super();
|
|
555
556
|
this.fs = fs;
|
|
@@ -569,7 +570,7 @@ class $a44e20ab74dfaf6b$var$ReadStream extends (0, $8sOVI$stream.Readable) {
|
|
|
569
570
|
});
|
|
570
571
|
}
|
|
571
572
|
}
|
|
572
|
-
class $
|
|
573
|
+
class $ce546cd73efa5b9e$var$WriteStream extends (0, $jF595$stream.Writable) {
|
|
573
574
|
constructor(fs, filePath, options){
|
|
574
575
|
super({
|
|
575
576
|
emitClose: true,
|
|
@@ -578,11 +579,11 @@ class $a44e20ab74dfaf6b$var$WriteStream extends (0, $8sOVI$stream.Writable) {
|
|
|
578
579
|
this.fs = fs;
|
|
579
580
|
this.filePath = filePath;
|
|
580
581
|
this.options = options;
|
|
581
|
-
this.buffer = $
|
|
582
|
+
this.buffer = $ce546cd73efa5b9e$require$Buffer.alloc(0);
|
|
582
583
|
}
|
|
583
584
|
_write(chunk, encoding, callback) {
|
|
584
|
-
let c = typeof chunk === 'string' ? $
|
|
585
|
-
this.buffer = $
|
|
585
|
+
let c = typeof chunk === 'string' ? $ce546cd73efa5b9e$require$Buffer.from(chunk, encoding) : chunk;
|
|
586
|
+
this.buffer = $ce546cd73efa5b9e$require$Buffer.concat([
|
|
586
587
|
this.buffer,
|
|
587
588
|
c
|
|
588
589
|
]);
|
|
@@ -592,11 +593,11 @@ class $a44e20ab74dfaf6b$var$WriteStream extends (0, $8sOVI$stream.Writable) {
|
|
|
592
593
|
this.fs.writeFile(this.filePath, this.buffer, this.options).then(callback).catch(callback);
|
|
593
594
|
}
|
|
594
595
|
}
|
|
595
|
-
const $
|
|
596
|
-
const $
|
|
597
|
-
const $
|
|
598
|
-
const $
|
|
599
|
-
class $
|
|
596
|
+
const $ce546cd73efa5b9e$var$S_IFREG = 32768;
|
|
597
|
+
const $ce546cd73efa5b9e$var$S_IFDIR = 16384;
|
|
598
|
+
const $ce546cd73efa5b9e$var$S_IFLNK = 40960;
|
|
599
|
+
const $ce546cd73efa5b9e$var$S_IFMT = 61440;
|
|
600
|
+
class $ce546cd73efa5b9e$var$Entry {
|
|
600
601
|
constructor(mode){
|
|
601
602
|
this.mode = mode;
|
|
602
603
|
let now = Date.now();
|
|
@@ -620,10 +621,10 @@ class $a44e20ab74dfaf6b$var$Entry {
|
|
|
620
621
|
return 0;
|
|
621
622
|
}
|
|
622
623
|
stat() {
|
|
623
|
-
return new $
|
|
624
|
+
return new $ce546cd73efa5b9e$var$Stat(this);
|
|
624
625
|
}
|
|
625
626
|
}
|
|
626
|
-
class $
|
|
627
|
+
class $ce546cd73efa5b9e$var$Stat {
|
|
627
628
|
dev = 0;
|
|
628
629
|
ino = 0;
|
|
629
630
|
nlink = 0;
|
|
@@ -645,10 +646,10 @@ class $a44e20ab74dfaf6b$var$Stat {
|
|
|
645
646
|
this.birthtime = new Date(entry.birthtime);
|
|
646
647
|
}
|
|
647
648
|
isFile() {
|
|
648
|
-
return Boolean(this.mode & $
|
|
649
|
+
return Boolean(this.mode & $ce546cd73efa5b9e$var$S_IFREG);
|
|
649
650
|
}
|
|
650
651
|
isDirectory() {
|
|
651
|
-
return Boolean(this.mode & $
|
|
652
|
+
return Boolean(this.mode & $ce546cd73efa5b9e$var$S_IFDIR);
|
|
652
653
|
}
|
|
653
654
|
isBlockDevice() {
|
|
654
655
|
return false;
|
|
@@ -666,17 +667,17 @@ class $a44e20ab74dfaf6b$var$Stat {
|
|
|
666
667
|
return false;
|
|
667
668
|
}
|
|
668
669
|
}
|
|
669
|
-
class $
|
|
670
|
+
class $ce546cd73efa5b9e$var$Dirent {
|
|
670
671
|
#mode;
|
|
671
672
|
constructor(name, entry){
|
|
672
673
|
this.name = name;
|
|
673
674
|
this.#mode = entry.mode;
|
|
674
675
|
}
|
|
675
676
|
isFile() {
|
|
676
|
-
return (this.#mode & $
|
|
677
|
+
return (this.#mode & $ce546cd73efa5b9e$var$S_IFMT) === $ce546cd73efa5b9e$var$S_IFREG;
|
|
677
678
|
}
|
|
678
679
|
isDirectory() {
|
|
679
|
-
return (this.#mode & $
|
|
680
|
+
return (this.#mode & $ce546cd73efa5b9e$var$S_IFMT) === $ce546cd73efa5b9e$var$S_IFDIR;
|
|
680
681
|
}
|
|
681
682
|
isBlockDevice() {
|
|
682
683
|
return false;
|
|
@@ -685,7 +686,7 @@ class $a44e20ab74dfaf6b$var$Dirent {
|
|
|
685
686
|
return false;
|
|
686
687
|
}
|
|
687
688
|
isSymbolicLink() {
|
|
688
|
-
return (this.#mode & $
|
|
689
|
+
return (this.#mode & $ce546cd73efa5b9e$var$S_IFMT) === $ce546cd73efa5b9e$var$S_IFLNK;
|
|
689
690
|
}
|
|
690
691
|
isFIFO() {
|
|
691
692
|
return false;
|
|
@@ -694,55 +695,55 @@ class $a44e20ab74dfaf6b$var$Dirent {
|
|
|
694
695
|
return false;
|
|
695
696
|
}
|
|
696
697
|
}
|
|
697
|
-
class $
|
|
698
|
+
class $ce546cd73efa5b9e$export$b6afa8811b7e644e extends $ce546cd73efa5b9e$var$Entry {
|
|
698
699
|
constructor(buffer, mode){
|
|
699
|
-
super($
|
|
700
|
+
super($ce546cd73efa5b9e$var$S_IFREG | mode);
|
|
700
701
|
this.buffer = buffer;
|
|
701
702
|
}
|
|
702
703
|
read() {
|
|
703
704
|
super.access();
|
|
704
|
-
return $
|
|
705
|
+
return $ce546cd73efa5b9e$require$Buffer.from(this.buffer);
|
|
705
706
|
}
|
|
706
707
|
write(buffer, mode) {
|
|
707
|
-
super.modify($
|
|
708
|
+
super.modify($ce546cd73efa5b9e$var$S_IFREG | mode);
|
|
708
709
|
this.buffer = buffer;
|
|
709
710
|
}
|
|
710
711
|
getSize() {
|
|
711
712
|
return this.buffer.byteLength;
|
|
712
713
|
}
|
|
713
714
|
}
|
|
714
|
-
class $
|
|
715
|
+
class $ce546cd73efa5b9e$var$Directory extends $ce546cd73efa5b9e$var$Entry {
|
|
715
716
|
constructor(){
|
|
716
|
-
super($
|
|
717
|
+
super($ce546cd73efa5b9e$var$S_IFDIR);
|
|
717
718
|
}
|
|
718
719
|
}
|
|
719
|
-
function $
|
|
720
|
-
if (typeof contents !== 'string' && contents.buffer instanceof (0, $
|
|
720
|
+
function $ce546cd73efa5b9e$export$df9eb3e75aa27a22(contents) {
|
|
721
|
+
if (typeof contents !== 'string' && contents.buffer instanceof (0, $jF595$atlaspackutils.SharedBuffer)) return contents;
|
|
721
722
|
let contentsBuffer = contents;
|
|
722
723
|
// For the polyfilled buffer module, it's faster to always convert once so that the subsequent
|
|
723
724
|
// operations are fast (.byteLength and using .set instead of .write)
|
|
724
|
-
contentsBuffer = contentsBuffer instanceof $
|
|
725
|
-
let length = $
|
|
726
|
-
let shared = new (0, $
|
|
727
|
-
let buffer = $
|
|
725
|
+
contentsBuffer = contentsBuffer instanceof $ce546cd73efa5b9e$require$Buffer ? contentsBuffer : $ce546cd73efa5b9e$require$Buffer.from(contentsBuffer);
|
|
726
|
+
let length = $ce546cd73efa5b9e$require$Buffer.byteLength(contentsBuffer);
|
|
727
|
+
let shared = new (0, $jF595$atlaspackutils.SharedBuffer)(length);
|
|
728
|
+
let buffer = $ce546cd73efa5b9e$require$Buffer.from(shared);
|
|
728
729
|
if (length > 0) {
|
|
729
730
|
if (typeof contentsBuffer === 'string') buffer.write(contentsBuffer);
|
|
730
731
|
else buffer.set(contentsBuffer);
|
|
731
732
|
}
|
|
732
733
|
return buffer;
|
|
733
734
|
}
|
|
734
|
-
class $
|
|
735
|
+
class $ce546cd73efa5b9e$var$WorkerFS extends $ce546cd73efa5b9e$export$3048eb7ec07c2c4e {
|
|
735
736
|
constructor(id, handle){
|
|
736
737
|
// TODO Make this not a subclass
|
|
737
738
|
// $FlowFixMe
|
|
738
739
|
super();
|
|
739
740
|
this.id = id;
|
|
740
|
-
this.handleFn = (methodName, args)=>(0, ($parcel$interopDefault($
|
|
741
|
+
this.handleFn = (methodName, args)=>(0, ($parcel$interopDefault($jF595$atlaspackworkers))).getWorkerApi().runHandle(handle, [
|
|
741
742
|
methodName,
|
|
742
743
|
args
|
|
743
744
|
]);
|
|
744
745
|
this.handleFn('_registerWorker', [
|
|
745
|
-
(0, ($parcel$interopDefault($
|
|
746
|
+
(0, ($parcel$interopDefault($jF595$atlaspackworkers))).getWorkerApi().createReverseHandle((event)=>{
|
|
746
747
|
switch(event.type){
|
|
747
748
|
case 'writeFile':
|
|
748
749
|
this.files.set(event.path, event.entry);
|
|
@@ -753,7 +754,7 @@ class $a44e20ab74dfaf6b$var$WorkerFS extends $a44e20ab74dfaf6b$export$3048eb7ec0
|
|
|
753
754
|
this.symlinks.delete(event.path);
|
|
754
755
|
break;
|
|
755
756
|
case 'mkdir':
|
|
756
|
-
this.dirs.set(event.path, new $
|
|
757
|
+
this.dirs.set(event.path, new $ce546cd73efa5b9e$var$Directory());
|
|
757
758
|
break;
|
|
758
759
|
case 'symlink':
|
|
759
760
|
this.symlinks.set(event.path, event.target);
|
|
@@ -763,7 +764,7 @@ class $a44e20ab74dfaf6b$var$WorkerFS extends $a44e20ab74dfaf6b$export$3048eb7ec0
|
|
|
763
764
|
]);
|
|
764
765
|
}
|
|
765
766
|
static deserialize(opts) {
|
|
766
|
-
return (0, (/*@__PURE__*/$parcel$interopDefault($
|
|
767
|
+
return (0, (/*@__PURE__*/$parcel$interopDefault($500746ffcc30dcc7$exports)))($ce546cd73efa5b9e$var$instances.get(opts.id));
|
|
767
768
|
}
|
|
768
769
|
serialize() {
|
|
769
770
|
// $FlowFixMe
|
|
@@ -773,7 +774,7 @@ class $a44e20ab74dfaf6b$var$WorkerFS extends $a44e20ab74dfaf6b$export$3048eb7ec0
|
|
|
773
774
|
}
|
|
774
775
|
writeFile(filePath, contents, options) {
|
|
775
776
|
super.writeFile(filePath, contents, options);
|
|
776
|
-
let buffer = $
|
|
777
|
+
let buffer = $ce546cd73efa5b9e$export$df9eb3e75aa27a22(contents);
|
|
777
778
|
return this.handleFn('writeFile', [
|
|
778
779
|
filePath,
|
|
779
780
|
buffer,
|
|
@@ -813,16 +814,16 @@ class $a44e20ab74dfaf6b$var$WorkerFS extends $a44e20ab74dfaf6b$export$3048eb7ec0
|
|
|
813
814
|
]);
|
|
814
815
|
}
|
|
815
816
|
}
|
|
816
|
-
(0, $
|
|
817
|
-
(0, $
|
|
818
|
-
(0, $
|
|
819
|
-
(0, $
|
|
820
|
-
(0, $
|
|
817
|
+
(0, $jF595$atlaspackbuildcache.registerSerializableClass)(`${(0, (/*@__PURE__*/$parcel$interopDefault($a29f1902b85e3e69$exports))).version}:MemoryFS`, $ce546cd73efa5b9e$export$3048eb7ec07c2c4e);
|
|
818
|
+
(0, $jF595$atlaspackbuildcache.registerSerializableClass)(`${(0, (/*@__PURE__*/$parcel$interopDefault($a29f1902b85e3e69$exports))).version}:WorkerFS`, $ce546cd73efa5b9e$var$WorkerFS);
|
|
819
|
+
(0, $jF595$atlaspackbuildcache.registerSerializableClass)(`${(0, (/*@__PURE__*/$parcel$interopDefault($a29f1902b85e3e69$exports))).version}:Stat`, $ce546cd73efa5b9e$var$Stat);
|
|
820
|
+
(0, $jF595$atlaspackbuildcache.registerSerializableClass)(`${(0, (/*@__PURE__*/$parcel$interopDefault($a29f1902b85e3e69$exports))).version}:File`, $ce546cd73efa5b9e$export$b6afa8811b7e644e);
|
|
821
|
+
(0, $jF595$atlaspackbuildcache.registerSerializableClass)(`${(0, (/*@__PURE__*/$parcel$interopDefault($a29f1902b85e3e69$exports))).version}:Directory`, $ce546cd73efa5b9e$var$Directory);
|
|
821
822
|
|
|
822
823
|
|
|
823
|
-
var $
|
|
824
|
+
var $e75797f2a6f0115f$exports = {};
|
|
824
825
|
|
|
825
|
-
$parcel$export($
|
|
826
|
+
$parcel$export($e75797f2a6f0115f$exports, "OverlayFS", () => $e75797f2a6f0115f$export$5963299e2424ca1c);
|
|
826
827
|
|
|
827
828
|
|
|
828
829
|
|
|
@@ -830,16 +831,16 @@ $parcel$export($7d25660af2107580$exports, "OverlayFS", () => $7d25660af2107580$e
|
|
|
830
831
|
|
|
831
832
|
|
|
832
833
|
|
|
833
|
-
class $
|
|
834
|
+
class $e75797f2a6f0115f$export$5963299e2424ca1c {
|
|
834
835
|
deleted = new Set();
|
|
835
836
|
constructor(workerFarmOrFS, readable){
|
|
836
|
-
if (workerFarmOrFS instanceof (0, ($parcel$interopDefault($
|
|
837
|
+
if (workerFarmOrFS instanceof (0, ($parcel$interopDefault($jF595$atlaspackworkers)))) this.writable = new (0, $ce546cd73efa5b9e$export$3048eb7ec07c2c4e)(workerFarmOrFS);
|
|
837
838
|
else this.writable = workerFarmOrFS;
|
|
838
839
|
this.readable = readable;
|
|
839
840
|
this._cwd = readable.cwd();
|
|
840
841
|
}
|
|
841
842
|
static deserialize(opts) {
|
|
842
|
-
let fs = new $
|
|
843
|
+
let fs = new $e75797f2a6f0115f$export$5963299e2424ca1c(opts.writable, opts.readable);
|
|
843
844
|
if (opts.deleted != null) fs.deleted = opts.deleted;
|
|
844
845
|
return fs;
|
|
845
846
|
}
|
|
@@ -853,28 +854,28 @@ class $7d25660af2107580$export$5963299e2424ca1c {
|
|
|
853
854
|
}
|
|
854
855
|
_deletedThrows(filePath) {
|
|
855
856
|
filePath = this._normalizePath(filePath);
|
|
856
|
-
if (this.deleted.has(filePath)) throw new $
|
|
857
|
+
if (this.deleted.has(filePath)) throw new $e75797f2a6f0115f$var$FSError('ENOENT', filePath, 'does not exist');
|
|
857
858
|
return filePath;
|
|
858
859
|
}
|
|
859
860
|
_checkExists(filePath) {
|
|
860
861
|
filePath = this._deletedThrows(filePath);
|
|
861
|
-
if (!this.existsSync(filePath)) throw new $
|
|
862
|
+
if (!this.existsSync(filePath)) throw new $e75797f2a6f0115f$var$FSError('ENOENT', filePath, 'does not exist');
|
|
862
863
|
return filePath;
|
|
863
864
|
}
|
|
864
865
|
_isSymlink(filePath) {
|
|
865
866
|
filePath = this._normalizePath(filePath);
|
|
866
867
|
// Check the parts of the path to see if any are symlinks.
|
|
867
|
-
let { root: root, dir: dir, base: base } = (0, ($parcel$interopDefault($
|
|
868
|
-
let segments = dir.slice(root.length).split((0, ($parcel$interopDefault($
|
|
868
|
+
let { root: root, dir: dir, base: base } = (0, ($parcel$interopDefault($jF595$path))).parse(filePath);
|
|
869
|
+
let segments = dir.slice(root.length).split((0, ($parcel$interopDefault($jF595$path))).sep).concat(base);
|
|
869
870
|
while(segments.length){
|
|
870
|
-
filePath = (0, ($parcel$interopDefault($
|
|
871
|
+
filePath = (0, ($parcel$interopDefault($jF595$path))).join(root, ...segments);
|
|
871
872
|
let name = segments.pop();
|
|
872
873
|
if (this.deleted.has(filePath)) return false;
|
|
873
|
-
else if (this.writable instanceof (0, $
|
|
874
|
+
else if (this.writable instanceof (0, $ce546cd73efa5b9e$export$3048eb7ec07c2c4e) && this.writable.symlinks.has(filePath)) return true;
|
|
874
875
|
else {
|
|
875
876
|
// HACK: Atlaspack fs does not provide `lstatSync`,
|
|
876
877
|
// so we use `readdirSync` to check if the path is a symlink.
|
|
877
|
-
let parent = (0, ($parcel$interopDefault($
|
|
878
|
+
let parent = (0, ($parcel$interopDefault($jF595$path))).resolve(filePath, '..');
|
|
878
879
|
if (parent === filePath) return false;
|
|
879
880
|
try {
|
|
880
881
|
for (let dirent of this.readdirSync(parent, {
|
|
@@ -895,12 +896,12 @@ class $7d25660af2107580$export$5963299e2424ca1c {
|
|
|
895
896
|
}
|
|
896
897
|
async _copyPathForWrite(filePath) {
|
|
897
898
|
filePath = await this._normalizePath(filePath);
|
|
898
|
-
let dirPath = (0, ($parcel$interopDefault($
|
|
899
|
+
let dirPath = (0, ($parcel$interopDefault($jF595$path))).dirname(filePath);
|
|
899
900
|
if (this.existsSync(dirPath) && !this.writable.existsSync(dirPath)) await this.writable.mkdirp(dirPath);
|
|
900
901
|
return filePath;
|
|
901
902
|
}
|
|
902
903
|
_normalizePath(filePath) {
|
|
903
|
-
return (0, ($parcel$interopDefault($
|
|
904
|
+
return (0, ($parcel$interopDefault($jF595$path))).resolve(this.cwd(), filePath);
|
|
904
905
|
}
|
|
905
906
|
// eslint-disable-next-line require-await
|
|
906
907
|
async readFile(filePath, encoding) {
|
|
@@ -933,22 +934,22 @@ class $7d25660af2107580$export$5963299e2424ca1c {
|
|
|
933
934
|
let toDelete = [
|
|
934
935
|
filePath
|
|
935
936
|
];
|
|
936
|
-
if (this.writable instanceof (0, $
|
|
937
|
+
if (this.writable instanceof (0, $ce546cd73efa5b9e$export$3048eb7ec07c2c4e) && this._isSymlink(filePath)) this.writable.symlinks.delete(filePath);
|
|
937
938
|
else if (this.statSync(filePath).isDirectory()) {
|
|
938
939
|
let stack = [
|
|
939
940
|
filePath
|
|
940
941
|
];
|
|
941
942
|
// Recursively add every descendant path to deleted.
|
|
942
943
|
while(stack.length){
|
|
943
|
-
let root = (0, (/*@__PURE__*/$parcel$interopDefault($
|
|
944
|
+
let root = (0, (/*@__PURE__*/$parcel$interopDefault($500746ffcc30dcc7$exports)))(stack.pop());
|
|
944
945
|
for (let ent of this.readdirSync(root, {
|
|
945
946
|
withFileTypes: true
|
|
946
947
|
}))if (typeof ent === 'string') {
|
|
947
|
-
let childPath = (0, ($parcel$interopDefault($
|
|
948
|
+
let childPath = (0, ($parcel$interopDefault($jF595$path))).join(root, ent);
|
|
948
949
|
toDelete.push(childPath);
|
|
949
950
|
if (this.statSync(childPath).isDirectory()) stack.push(childPath);
|
|
950
951
|
} else {
|
|
951
|
-
let childPath = (0, ($parcel$interopDefault($
|
|
952
|
+
let childPath = (0, ($parcel$interopDefault($jF595$path))).join(root, ent.name);
|
|
952
953
|
toDelete.push(childPath);
|
|
953
954
|
if (ent.isDirectory()) stack.push(childPath);
|
|
954
955
|
}
|
|
@@ -965,10 +966,10 @@ class $7d25660af2107580$export$5963299e2424ca1c {
|
|
|
965
966
|
dir = this._normalizePath(dir);
|
|
966
967
|
await this.writable.mkdirp(dir);
|
|
967
968
|
if (this.deleted != null) {
|
|
968
|
-
let root = (0, ($parcel$interopDefault($
|
|
969
|
+
let root = (0, ($parcel$interopDefault($jF595$path))).parse(dir).root;
|
|
969
970
|
while(dir !== root){
|
|
970
971
|
this.deleted.delete(dir);
|
|
971
|
-
dir = (0, ($parcel$interopDefault($
|
|
972
|
+
dir = (0, ($parcel$interopDefault($jF595$path))).dirname(dir);
|
|
972
973
|
}
|
|
973
974
|
}
|
|
974
975
|
}
|
|
@@ -1054,7 +1055,7 @@ class $7d25660af2107580$export$5963299e2424ca1c {
|
|
|
1054
1055
|
let entries = new Map();
|
|
1055
1056
|
try {
|
|
1056
1057
|
for (let entry of this.writable.readdirSync(dir, opts)){
|
|
1057
|
-
let filePath = (0, ($parcel$interopDefault($
|
|
1058
|
+
let filePath = (0, ($parcel$interopDefault($jF595$path))).join(dir, entry.name ?? entry);
|
|
1058
1059
|
if (this.deleted.has(filePath)) continue;
|
|
1059
1060
|
entries.set(filePath, entry);
|
|
1060
1061
|
}
|
|
@@ -1063,7 +1064,7 @@ class $7d25660af2107580$export$5963299e2424ca1c {
|
|
|
1063
1064
|
}
|
|
1064
1065
|
try {
|
|
1065
1066
|
for (let entry of this.readable.readdirSync(dir, opts)){
|
|
1066
|
-
let filePath = (0, ($parcel$interopDefault($
|
|
1067
|
+
let filePath = (0, ($parcel$interopDefault($jF595$path))).join(dir, entry.name ?? entry);
|
|
1067
1068
|
if (this.deleted.has(filePath)) continue;
|
|
1068
1069
|
if (entries.has(filePath)) continue;
|
|
1069
1070
|
entries.set(filePath, entry);
|
|
@@ -1095,16 +1096,16 @@ class $7d25660af2107580$export$5963299e2424ca1c {
|
|
|
1095
1096
|
await this.writable.writeSnapshot(dir, snapshot, opts);
|
|
1096
1097
|
}
|
|
1097
1098
|
findAncestorFile(fileNames, fromDir, root) {
|
|
1098
|
-
return (0, $
|
|
1099
|
+
return (0, $7f6bcebe3ce84296$export$d51a93c758976388)(this, fileNames, fromDir, root);
|
|
1099
1100
|
}
|
|
1100
1101
|
findNodeModule(moduleName, fromDir) {
|
|
1101
|
-
return (0, $
|
|
1102
|
+
return (0, $7f6bcebe3ce84296$export$4c6d088a7d7f9947)(this, moduleName, fromDir);
|
|
1102
1103
|
}
|
|
1103
1104
|
findFirstFile(filePaths) {
|
|
1104
|
-
return (0, $
|
|
1105
|
+
return (0, $7f6bcebe3ce84296$export$64df6e3182fd5b2d)(this, filePaths);
|
|
1105
1106
|
}
|
|
1106
1107
|
}
|
|
1107
|
-
class $
|
|
1108
|
+
class $e75797f2a6f0115f$var$FSError extends Error {
|
|
1108
1109
|
constructor(code, path, message){
|
|
1109
1110
|
super(`${code}: ${path} ${message}`);
|
|
1110
1111
|
this.name = 'FSError';
|
|
@@ -1113,18 +1114,19 @@ class $7d25660af2107580$var$FSError extends Error {
|
|
|
1113
1114
|
Error.captureStackTrace?.(this, this.constructor);
|
|
1114
1115
|
}
|
|
1115
1116
|
}
|
|
1116
|
-
(0, $
|
|
1117
|
+
(0, $jF595$atlaspackbuildcache.registerSerializableClass)(`${(0, (/*@__PURE__*/$parcel$interopDefault($a29f1902b85e3e69$exports))).version}:OverlayFS`, $e75797f2a6f0115f$export$5963299e2424ca1c);
|
|
1117
1118
|
|
|
1118
1119
|
|
|
1119
|
-
var $
|
|
1120
|
+
var $80660f432e25e217$exports = {};
|
|
1120
1121
|
|
|
1121
|
-
$parcel$export($
|
|
1122
|
+
$parcel$export($80660f432e25e217$exports, "NodeVCSAwareFS", () => $80660f432e25e217$export$80de92554c03942a);
|
|
1122
1123
|
|
|
1123
1124
|
|
|
1124
1125
|
|
|
1125
1126
|
|
|
1126
1127
|
|
|
1127
|
-
|
|
1128
|
+
|
|
1129
|
+
class $80660f432e25e217$export$80de92554c03942a extends (0, $3efdc9f199571449$export$c4e0ef2ab73c21e7) {
|
|
1128
1130
|
#options;
|
|
1129
1131
|
constructor(options){
|
|
1130
1132
|
super();
|
|
@@ -1135,43 +1137,43 @@ class $0552b3a82740e275$export$80de92554c03942a extends (0, $87241760c4ff27c3$ex
|
|
|
1135
1137
|
const snapshotFile = await this.readFile(snapshot);
|
|
1136
1138
|
const snapshotFileContent = snapshotFile.toString();
|
|
1137
1139
|
const { nativeSnapshotPath: nativeSnapshotPath, vcsState: vcsState } = JSON.parse(snapshotFileContent);
|
|
1138
|
-
const watcherEventsSince = await this.watcher().getEventsSince(dir, nativeSnapshotPath, opts);
|
|
1139
|
-
const vcsEventsSince = (0, $
|
|
1140
|
+
const watcherEventsSince = await (0, $jF595$atlaspacklogger.instrumentAsync)('NodeVCSAwareFS::watchman.getEventsSince', ()=>this.watcher().getEventsSince(dir, nativeSnapshotPath, opts));
|
|
1141
|
+
const vcsEventsSince = (0, $jF595$atlaspacklogger.instrument)('NodeVCSAwareFS::rust.getEventsSince', ()=>(0, $jF595$atlaspackrust.getEventsSince)(this.#options.gitRepoPath, vcsState.gitHash));
|
|
1140
1142
|
this.#options.logEventDiff(watcherEventsSince, vcsEventsSince);
|
|
1141
1143
|
return watcherEventsSince;
|
|
1142
1144
|
}
|
|
1143
1145
|
async writeSnapshot(dir, snapshot, opts) {
|
|
1144
|
-
const snapshotDirectory = (0, ($parcel$interopDefault($
|
|
1145
|
-
const filename = (0, ($parcel$interopDefault($
|
|
1146
|
-
const nativeSnapshotPath = (0, ($parcel$interopDefault($
|
|
1146
|
+
const snapshotDirectory = (0, ($parcel$interopDefault($jF595$path))).dirname(snapshot);
|
|
1147
|
+
const filename = (0, ($parcel$interopDefault($jF595$path))).basename(snapshot, '.txt');
|
|
1148
|
+
const nativeSnapshotPath = (0, ($parcel$interopDefault($jF595$path))).join(snapshotDirectory, `${filename}.native-snapshot.txt`);
|
|
1147
1149
|
await this.watcher().writeSnapshot(dir, nativeSnapshotPath, opts);
|
|
1148
1150
|
// TODO: we need the git repo path, pass the exclude patterns
|
|
1149
|
-
const vcsState = await (0, $
|
|
1151
|
+
const vcsState = await (0, $jF595$atlaspackrust.getVcsStateSnapshot)(this.#options.gitRepoPath, this.#options.excludePatterns);
|
|
1150
1152
|
await this.writeFile(snapshot, JSON.stringify({
|
|
1151
1153
|
vcsState: vcsState,
|
|
1152
1154
|
nativeSnapshotPath: nativeSnapshotPath
|
|
1153
1155
|
}));
|
|
1154
1156
|
}
|
|
1155
1157
|
}
|
|
1156
|
-
(0, $
|
|
1158
|
+
(0, $jF595$atlaspackbuildcache.registerSerializableClass)(`${(0, (/*@__PURE__*/$parcel$interopDefault($a29f1902b85e3e69$exports))).version}:NodeVCSAwareFS`, $80660f432e25e217$export$80de92554c03942a);
|
|
1157
1159
|
|
|
1158
1160
|
|
|
1159
|
-
const $
|
|
1160
|
-
async function $
|
|
1161
|
+
const $81d23888a9e9b3a9$var$pipeline = (0, $jF595$util.promisify)((0, ($parcel$interopDefault($jF595$stream))).pipeline);
|
|
1162
|
+
async function $81d23888a9e9b3a9$export$d3a8044e3fef7335(sourceFS, source, destinationFS, destination) {
|
|
1161
1163
|
await destinationFS.mkdirp(destination);
|
|
1162
1164
|
let files = await sourceFS.readdir(source);
|
|
1163
1165
|
for (let file of files){
|
|
1164
|
-
let sourcePath = (0, ($parcel$interopDefault($
|
|
1165
|
-
let destPath = (0, ($parcel$interopDefault($
|
|
1166
|
+
let sourcePath = (0, ($parcel$interopDefault($jF595$path))).join(source, file);
|
|
1167
|
+
let destPath = (0, ($parcel$interopDefault($jF595$path))).join(destination, file);
|
|
1166
1168
|
let stats = await sourceFS.stat(sourcePath);
|
|
1167
|
-
if (stats.isFile()) await $
|
|
1168
|
-
else if (stats.isDirectory()) await $
|
|
1169
|
+
if (stats.isFile()) await $81d23888a9e9b3a9$var$pipeline(sourceFS.createReadStream(sourcePath), destinationFS.createWriteStream(destPath));
|
|
1170
|
+
else if (stats.isDirectory()) await $81d23888a9e9b3a9$export$d3a8044e3fef7335(sourceFS, sourcePath, destinationFS, destPath);
|
|
1169
1171
|
}
|
|
1170
1172
|
}
|
|
1171
|
-
$parcel$exportWildcard(module.exports, $
|
|
1172
|
-
$parcel$exportWildcard(module.exports, $
|
|
1173
|
-
$parcel$exportWildcard(module.exports, $
|
|
1174
|
-
$parcel$exportWildcard(module.exports, $
|
|
1173
|
+
$parcel$exportWildcard(module.exports, $3efdc9f199571449$exports);
|
|
1174
|
+
$parcel$exportWildcard(module.exports, $ce546cd73efa5b9e$exports);
|
|
1175
|
+
$parcel$exportWildcard(module.exports, $e75797f2a6f0115f$exports);
|
|
1176
|
+
$parcel$exportWildcard(module.exports, $80660f432e25e217$exports);
|
|
1175
1177
|
|
|
1176
1178
|
|
|
1177
1179
|
//# sourceMappingURL=browser.js.map
|