@ai-ecoverse/slicc-kernel 1.196.18 → 1.196.19
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/README.md +2 -2
- package/dist/async-process.js +1 -1
- package/dist/cloudflare-sources.js +1 -1
- package/dist/cloudflare.js +284 -36
- package/dist/cloudflare.js.map +4 -4
- package/dist/kernel-worker.js +332 -84
- package/dist/kernel-worker.js.map +4 -4
- package/dist/meta.js.map +2 -2
- package/dist/node-process-worker.cjs +1 -1
- package/dist/node-process-worker.js +1 -1
- package/dist/node.js +282 -34
- package/dist/node.js.map +4 -4
- package/dist/process-worker.js +1 -1
- package/dist/types/fs/meta.d.ts +1 -0
- package/dist/types/fs/opfs.d.ts +12 -0
- package/dist/types/fs/private-rename.d.ts +25 -0
- package/package.json +1 -1
package/dist/cloudflare.js
CHANGED
|
@@ -5237,7 +5237,7 @@ function satisfies(version, range2) {
|
|
|
5237
5237
|
}
|
|
5238
5238
|
|
|
5239
5239
|
// src/version.ts
|
|
5240
|
-
var KERNEL_VERSION = true ? "1.196.
|
|
5240
|
+
var KERNEL_VERSION = true ? "1.196.19" : "0.0.0-dev";
|
|
5241
5241
|
var OS_RELEASE = "6.0.0-slicc";
|
|
5242
5242
|
function procVersion() {
|
|
5243
5243
|
return `Linux version ${OS_RELEASE} (slicc-kernel ${KERNEL_VERSION}) #1 SMP PREEMPT_DYNAMIC
|
|
@@ -33206,6 +33206,123 @@ function noticeOf(data) {
|
|
|
33206
33206
|
return { paths: strings3(notice.paths), trees: strings3(notice.trees), outside: true };
|
|
33207
33207
|
}
|
|
33208
33208
|
|
|
33209
|
+
// src/fs/private-rename.ts
|
|
33210
|
+
var DRAIN_MS = 500;
|
|
33211
|
+
var ADMISSION_MS = 5e3;
|
|
33212
|
+
var within10 = (at, root) => at === root || root === "/" || at.startsWith(root + "/");
|
|
33213
|
+
var PrivatePaths = class {
|
|
33214
|
+
names;
|
|
33215
|
+
bound = false;
|
|
33216
|
+
shifted = false;
|
|
33217
|
+
listing;
|
|
33218
|
+
removing;
|
|
33219
|
+
constructor(paths, listing, removing) {
|
|
33220
|
+
this.listing = listing;
|
|
33221
|
+
this.removing = removing;
|
|
33222
|
+
this.names = new Set(paths.map(normalizePath));
|
|
33223
|
+
}
|
|
33224
|
+
touches(roots, names2 = this.names) {
|
|
33225
|
+
for (const at of names2)
|
|
33226
|
+
for (const root of roots) {
|
|
33227
|
+
if (within10(at, root) || this.removing && within10(root, at)) return true;
|
|
33228
|
+
if (this.listing && at === (root.slice(0, root.lastIndexOf("/")) || "/")) return true;
|
|
33229
|
+
}
|
|
33230
|
+
return false;
|
|
33231
|
+
}
|
|
33232
|
+
bind(path) {
|
|
33233
|
+
if (this.shifted) return;
|
|
33234
|
+
this.names.clear();
|
|
33235
|
+
this.names.add(path);
|
|
33236
|
+
this.bound = true;
|
|
33237
|
+
}
|
|
33238
|
+
moved(from, to) {
|
|
33239
|
+
const names2 = this.redirected(from, to);
|
|
33240
|
+
if (!names2.size) return;
|
|
33241
|
+
this.shifted = true;
|
|
33242
|
+
if (this.bound) this.names.clear();
|
|
33243
|
+
for (const name2 of names2) this.names.add(name2);
|
|
33244
|
+
}
|
|
33245
|
+
redirected(from, to) {
|
|
33246
|
+
const names2 = /* @__PURE__ */ new Set();
|
|
33247
|
+
for (const path of this.names)
|
|
33248
|
+
if (within10(path, from)) {
|
|
33249
|
+
const next3 = resolvePath(to, path.slice(from.length).replace(/^\//, ""));
|
|
33250
|
+
if (!this.names.has(next3)) names2.add(next3);
|
|
33251
|
+
}
|
|
33252
|
+
return names2;
|
|
33253
|
+
}
|
|
33254
|
+
};
|
|
33255
|
+
var PrivateRename = class {
|
|
33256
|
+
active = /* @__PURE__ */ new Set();
|
|
33257
|
+
barriers = /* @__PURE__ */ new Map();
|
|
33258
|
+
waiters = /* @__PURE__ */ new Set();
|
|
33259
|
+
wait(take, ms) {
|
|
33260
|
+
if (take()) return Promise.resolve();
|
|
33261
|
+
return new Promise((resolve2, reject) => {
|
|
33262
|
+
const wake = () => {
|
|
33263
|
+
if (!take()) return;
|
|
33264
|
+
this.waiters.delete(wake);
|
|
33265
|
+
clearTimeout(timer);
|
|
33266
|
+
resolve2();
|
|
33267
|
+
};
|
|
33268
|
+
const timer = setTimeout(() => {
|
|
33269
|
+
this.waiters.delete(wake);
|
|
33270
|
+
reject(fsError("EBUSY", "private rename"));
|
|
33271
|
+
}, ms);
|
|
33272
|
+
this.waiters.add(wake);
|
|
33273
|
+
});
|
|
33274
|
+
}
|
|
33275
|
+
wake() {
|
|
33276
|
+
for (const waiter of this.waiters) waiter();
|
|
33277
|
+
}
|
|
33278
|
+
blocked(op, names2 = op.names) {
|
|
33279
|
+
for (const [barrier, draining] of this.barriers) {
|
|
33280
|
+
if (!draining.has(op) && op.touches(barrier.names, names2)) return true;
|
|
33281
|
+
}
|
|
33282
|
+
return false;
|
|
33283
|
+
}
|
|
33284
|
+
enter(op) {
|
|
33285
|
+
return this.wait(() => {
|
|
33286
|
+
if (this.blocked(op)) return false;
|
|
33287
|
+
this.active.add(op);
|
|
33288
|
+
return true;
|
|
33289
|
+
}, ADMISSION_MS);
|
|
33290
|
+
}
|
|
33291
|
+
leave(op) {
|
|
33292
|
+
this.active.delete(op);
|
|
33293
|
+
for (const draining of this.barriers.values()) draining.delete(op);
|
|
33294
|
+
this.wake();
|
|
33295
|
+
}
|
|
33296
|
+
redirect(op, from, to) {
|
|
33297
|
+
const names2 = op.redirected(from, to);
|
|
33298
|
+
if (this.barriers.has(op) && names2.size) throw fsError("EBUSY", from);
|
|
33299
|
+
return this.wait(() => {
|
|
33300
|
+
if (this.blocked(op, names2)) return false;
|
|
33301
|
+
for (const name2 of names2) op.names.add(name2);
|
|
33302
|
+
return true;
|
|
33303
|
+
}, ADMISSION_MS);
|
|
33304
|
+
}
|
|
33305
|
+
moved(from, to) {
|
|
33306
|
+
for (const op of this.active) op.moved(from, to);
|
|
33307
|
+
}
|
|
33308
|
+
async exclusive(op, run2) {
|
|
33309
|
+
const draining = /* @__PURE__ */ new Set();
|
|
33310
|
+
await this.wait(() => {
|
|
33311
|
+
if (this.blocked(op)) return false;
|
|
33312
|
+
for (const active of this.active) if (active.touches(op.names)) draining.add(active);
|
|
33313
|
+
this.barriers.set(op, draining);
|
|
33314
|
+
return true;
|
|
33315
|
+
}, ADMISSION_MS);
|
|
33316
|
+
try {
|
|
33317
|
+
await this.wait(() => ![...draining].some((active) => this.active.has(active)), DRAIN_MS);
|
|
33318
|
+
return await run2();
|
|
33319
|
+
} finally {
|
|
33320
|
+
this.barriers.delete(op);
|
|
33321
|
+
this.wake();
|
|
33322
|
+
}
|
|
33323
|
+
}
|
|
33324
|
+
};
|
|
33325
|
+
|
|
33209
33326
|
// src/fs/opfs.ts
|
|
33210
33327
|
var S_IFDIR2 = 16384;
|
|
33211
33328
|
var S_IFREG3 = 32768;
|
|
@@ -33246,8 +33363,12 @@ var PAIRED = /* @__PURE__ */ new Set(["rename", "link", "copyFile"]);
|
|
|
33246
33363
|
var LISTINGS = /* @__PURE__ */ new Set(["readdir", "readdirStat"]);
|
|
33247
33364
|
var REMOVALS2 = /* @__PURE__ */ new Set(["rm", "rename"]);
|
|
33248
33365
|
var RETRY = /* @__PURE__ */ Symbol("retry");
|
|
33366
|
+
var PRIVATE_COPY = /* @__PURE__ */ Symbol("private-copy");
|
|
33249
33367
|
var ACK_SAMPLES = 4096;
|
|
33250
33368
|
var INTENT_POLL_MS = 5;
|
|
33369
|
+
function needsCopy(handle, swap) {
|
|
33370
|
+
return swap || handle.kind === "directory" && !movable(handle);
|
|
33371
|
+
}
|
|
33251
33372
|
function movable(handle) {
|
|
33252
33373
|
return typeof handle.move === "function";
|
|
33253
33374
|
}
|
|
@@ -33330,7 +33451,7 @@ function prefixes(path) {
|
|
|
33330
33451
|
const parts2 = split2(path);
|
|
33331
33452
|
return parts2.map((_, i) => `/${parts2.slice(0, i + 1).join("/")}`);
|
|
33332
33453
|
}
|
|
33333
|
-
function
|
|
33454
|
+
function within11(path, root) {
|
|
33334
33455
|
return path === root || path.startsWith(`${root}/`);
|
|
33335
33456
|
}
|
|
33336
33457
|
var unstored = () => Object.assign(new Error("the file system kept fewer bytes than were written"), {
|
|
@@ -33442,6 +33563,10 @@ function isHandle(child2) {
|
|
|
33442
33563
|
var FILE_TIMES_MS = 100;
|
|
33443
33564
|
var OpfsFs = class {
|
|
33444
33565
|
root;
|
|
33566
|
+
privateRename;
|
|
33567
|
+
insidePrivateOp = false;
|
|
33568
|
+
privateRedirect;
|
|
33569
|
+
privateSession;
|
|
33445
33570
|
meta;
|
|
33446
33571
|
dirs = new PathMap();
|
|
33447
33572
|
files = new PathMap();
|
|
@@ -33466,6 +33591,7 @@ var OpfsFs = class {
|
|
|
33466
33591
|
renamePrefix;
|
|
33467
33592
|
constructor(root, meta = new MemoryMeta(), channel, options = {}) {
|
|
33468
33593
|
this.root = root;
|
|
33594
|
+
this.privateRename = channel === void 0 ? new PrivateRename() : void 0;
|
|
33469
33595
|
this.meta = sidecar(meta);
|
|
33470
33596
|
this.ranged = options.ranged === true;
|
|
33471
33597
|
this.locks = options.locks === void 0 ? lockManager() : options.locks ?? void 0;
|
|
@@ -34045,6 +34171,7 @@ var OpfsFs = class {
|
|
|
34045
34171
|
if (this.rejectLinks) throw fsError("ELOOP", path);
|
|
34046
34172
|
const stored = link2.link;
|
|
34047
34173
|
if (overPath(stored)) throw fsError("ENAMETOOLONG", link2.path);
|
|
34174
|
+
const previous = current;
|
|
34048
34175
|
const target = stored + current.slice(link2.path.length);
|
|
34049
34176
|
if (target.split("/").includes("..") || longParent(stored) !== void 0) {
|
|
34050
34177
|
const resolved2 = await this.physical(parentOf11(link2.path), target, hops + 1, path);
|
|
@@ -34054,6 +34181,7 @@ var OpfsFs = class {
|
|
|
34054
34181
|
current = resolvePath(parentOf11(link2.path), target);
|
|
34055
34182
|
}
|
|
34056
34183
|
this.crossing(path, current);
|
|
34184
|
+
await this.privateRedirect?.(previous, current);
|
|
34057
34185
|
}
|
|
34058
34186
|
}
|
|
34059
34187
|
throw fsError("ELOOP", path);
|
|
@@ -34145,11 +34273,11 @@ var OpfsFs = class {
|
|
|
34145
34273
|
movePending(from, to) {
|
|
34146
34274
|
if (to !== void 0) {
|
|
34147
34275
|
for (const path of [...this.fileTimes.keys()]) {
|
|
34148
|
-
if (
|
|
34276
|
+
if (within11(path, to)) this.fileTimes.delete(path);
|
|
34149
34277
|
}
|
|
34150
34278
|
}
|
|
34151
34279
|
for (const [path, ms] of [...this.fileTimes]) {
|
|
34152
|
-
if (!
|
|
34280
|
+
if (!within11(path, from)) continue;
|
|
34153
34281
|
this.fileTimes.delete(path);
|
|
34154
34282
|
if (to !== void 0) this.fileTimes.set(to + path.slice(from.length), ms);
|
|
34155
34283
|
}
|
|
@@ -34429,8 +34557,8 @@ var OpfsFs = class {
|
|
|
34429
34557
|
const file = this.movingFiles.get(at);
|
|
34430
34558
|
if (file !== void 0) return { done: file, away: true };
|
|
34431
34559
|
for (const m of this.renamingDirs) {
|
|
34432
|
-
if (
|
|
34433
|
-
if (
|
|
34560
|
+
if (within11(at, m.from)) return { done: m.done, away: true };
|
|
34561
|
+
if (within11(at, m.to)) return { done: m.done, away: false };
|
|
34434
34562
|
}
|
|
34435
34563
|
return void 0;
|
|
34436
34564
|
}
|
|
@@ -34466,7 +34594,7 @@ var OpfsFs = class {
|
|
|
34466
34594
|
idle2.resolve();
|
|
34467
34595
|
}
|
|
34468
34596
|
async writesDrained(tree2) {
|
|
34469
|
-
while ([...this.fileWrites.keys()].some((at) =>
|
|
34597
|
+
while ([...this.fileWrites.keys()].some((at) => within11(at, tree2))) {
|
|
34470
34598
|
this.writesIdle ??= Promise.withResolvers();
|
|
34471
34599
|
await this.writesIdle.promise;
|
|
34472
34600
|
}
|
|
@@ -34543,6 +34671,7 @@ var OpfsFs = class {
|
|
|
34543
34671
|
}
|
|
34544
34672
|
async writeSession(path, truncate) {
|
|
34545
34673
|
const [handle, , target] = await this.fileFor(path);
|
|
34674
|
+
this.privateSession?.bind(target);
|
|
34546
34675
|
const writable3 = await this.retrying(
|
|
34547
34676
|
path,
|
|
34548
34677
|
() => this.io(handle.createWritable({ keepExistingData: !truncate })),
|
|
@@ -34925,15 +35054,14 @@ var OpfsFs = class {
|
|
|
34925
35054
|
if (parent.handle?.kind !== "directory") throw fsError("ENOTDIR", to);
|
|
34926
35055
|
const destination = resolvePath(parent.path, baseOf4(to));
|
|
34927
35056
|
this.refuse(destination, true);
|
|
34928
|
-
if (directory2)
|
|
34929
|
-
|
|
34930
|
-
if (source.path === destination) return;
|
|
34931
|
-
}
|
|
35057
|
+
if (directory2 && source.handle?.kind !== "directory") throw fsError("ENOTDIR", from);
|
|
35058
|
+
if (source.path === destination) return;
|
|
34932
35059
|
await this.entering(destination, () => this.moveTo(source, parent, destination, to, call));
|
|
35060
|
+
this.privateRename?.moved(source.path, destination);
|
|
34933
35061
|
}
|
|
34934
35062
|
async moveTo(source, parent, destination, to, call) {
|
|
34935
35063
|
const sourceStat = await this.describe(source);
|
|
34936
|
-
if (sourceStat.isDirectory &&
|
|
35064
|
+
if (sourceStat.isDirectory && within11(destination, source.path)) throw fsError("EINVAL", to);
|
|
34937
35065
|
const target = await this.exactly(() => this.locate(destination, false)).catch((err) => {
|
|
34938
35066
|
if (missing5(err)) return null;
|
|
34939
35067
|
throw err;
|
|
@@ -34969,8 +35097,10 @@ var OpfsFs = class {
|
|
|
34969
35097
|
let lock;
|
|
34970
35098
|
const hooks = {};
|
|
34971
35099
|
const staging = swap ? `.${name2}.${crypto.randomUUID()}` : name2;
|
|
34972
|
-
const copying =
|
|
35100
|
+
const copying = needsCopy(source.handle, swap);
|
|
34973
35101
|
const staged2 = resolvePath(parent.path, staging);
|
|
35102
|
+
if (this.usePrivateCopy(source.handle, copying))
|
|
35103
|
+
return this.privateCopy(source, parent, destination, target?.handle, moving);
|
|
34974
35104
|
const place = async () => {
|
|
34975
35105
|
this.forget(destination);
|
|
34976
35106
|
const copies = /* @__PURE__ */ new Map();
|
|
@@ -35205,7 +35335,7 @@ var OpfsFs = class {
|
|
|
35205
35335
|
for (const move of this.peerMoves.values()) {
|
|
35206
35336
|
for (const tree2 of move.trees) {
|
|
35207
35337
|
for (const mine of [from, to]) {
|
|
35208
|
-
if (tree2.some((theirs) =>
|
|
35338
|
+
if (tree2.some((theirs) => within11(mine, theirs) || within11(theirs, mine))) return move;
|
|
35209
35339
|
}
|
|
35210
35340
|
}
|
|
35211
35341
|
}
|
|
@@ -35297,6 +35427,95 @@ var OpfsFs = class {
|
|
|
35297
35427
|
});
|
|
35298
35428
|
return { ...session, close: () => session.close().finally(done4) };
|
|
35299
35429
|
}
|
|
35430
|
+
async privateOp(name2, args, inner) {
|
|
35431
|
+
const gate = this.privateRename;
|
|
35432
|
+
if (!gate || this.insidePrivateOp) return inner.apply(this, args);
|
|
35433
|
+
const paths = name2 === "symlink" ? args.slice(1, 2) : args.slice(0, PAIRED.has(name2) ? 2 : 1);
|
|
35434
|
+
const op = new PrivatePaths(paths, LISTINGS.has(name2), REMOVALS2.has(name2));
|
|
35435
|
+
const inside2 = view(this, {
|
|
35436
|
+
insidePrivateOp: true,
|
|
35437
|
+
privateSession: name2 === "writeSession" ? op : void 0,
|
|
35438
|
+
privateRedirect: (from, to) => gate.redirect(op, from, to)
|
|
35439
|
+
});
|
|
35440
|
+
await gate.enter(op);
|
|
35441
|
+
const leave = () => gate.leave(op);
|
|
35442
|
+
let sessionOwnsAdmission = false;
|
|
35443
|
+
try {
|
|
35444
|
+
if (name2 === "writeSession") {
|
|
35445
|
+
const session = await inner.apply(inside2, args);
|
|
35446
|
+
sessionOwnsAdmission = true;
|
|
35447
|
+
let closed;
|
|
35448
|
+
return { ...session, close: () => closed ??= session.close().finally(leave) };
|
|
35449
|
+
}
|
|
35450
|
+
if (name2 !== "rename") return await inner.apply(inside2, args);
|
|
35451
|
+
try {
|
|
35452
|
+
return await inner.apply(inside2, args);
|
|
35453
|
+
} catch (err) {
|
|
35454
|
+
if (err !== PRIVATE_COPY) throw err;
|
|
35455
|
+
}
|
|
35456
|
+
} finally {
|
|
35457
|
+
if (!sessionOwnsAdmission) leave();
|
|
35458
|
+
}
|
|
35459
|
+
const exclusive = view(inside2, { privateCopyReady: true });
|
|
35460
|
+
return gate.exclusive(op, () => inner.apply(exclusive, args));
|
|
35461
|
+
}
|
|
35462
|
+
privateCopyReady = false;
|
|
35463
|
+
usePrivateCopy(handle, staging) {
|
|
35464
|
+
if (!this.privateRename) return false;
|
|
35465
|
+
if (this.privateCopyReady) return true;
|
|
35466
|
+
if (staging || !movable(handle)) throw PRIVATE_COPY;
|
|
35467
|
+
return false;
|
|
35468
|
+
}
|
|
35469
|
+
async privateCopy(source, parent, to, target, owner) {
|
|
35470
|
+
const handle = source.handle;
|
|
35471
|
+
const dir = parent.handle;
|
|
35472
|
+
const name2 = baseOf4(to);
|
|
35473
|
+
const copies = /* @__PURE__ */ new Map();
|
|
35474
|
+
const [entry] = await this.meta.get([source.path]);
|
|
35475
|
+
const root = { ino: occupied(entry).ino ?? inodeOf(source.path), ...owner };
|
|
35476
|
+
const intent = await this.intend({ from: source.path, to, root, privateCopy: true });
|
|
35477
|
+
try {
|
|
35478
|
+
await this.duplicate(handle, dir, name2, copies, "");
|
|
35479
|
+
} catch (err) {
|
|
35480
|
+
if (!target)
|
|
35481
|
+
await dir.removeEntry(name2, { recursive: true }).catch((e) => {
|
|
35482
|
+
if (e.name !== "NotFoundError") throw e;
|
|
35483
|
+
});
|
|
35484
|
+
else if (target.kind === "directory") {
|
|
35485
|
+
for await (const child2 of target.keys())
|
|
35486
|
+
await target.removeEntry(child2, { recursive: true });
|
|
35487
|
+
}
|
|
35488
|
+
this.forget(to);
|
|
35489
|
+
await this.meta.update(intent, () => void 0);
|
|
35490
|
+
throw translate(err, to, "write");
|
|
35491
|
+
}
|
|
35492
|
+
await this.commitPrivateCopy(source.path, to, root, intent, copies);
|
|
35493
|
+
}
|
|
35494
|
+
async commitPrivateCopy(from, to, root, intent, copies) {
|
|
35495
|
+
const { ino, ...owner } = root;
|
|
35496
|
+
const entries = await this.meta.get([from, to]);
|
|
35497
|
+
if (!entries[0]?.vacated || entries[1]?.ino !== ino) {
|
|
35498
|
+
await this.meta.move(
|
|
35499
|
+
from,
|
|
35500
|
+
to,
|
|
35501
|
+
(entry) => ({ ...occupied(entry), ...owner, ino, path: to, ctimeMs: Date.now() }),
|
|
35502
|
+
vacatedAt(from)
|
|
35503
|
+
);
|
|
35504
|
+
}
|
|
35505
|
+
this.movePending(from, to);
|
|
35506
|
+
await this.removePhysical(from, true);
|
|
35507
|
+
await this.meta.update(intent, () => void 0);
|
|
35508
|
+
await this.restamp(to, copies);
|
|
35509
|
+
this.changed(from, to);
|
|
35510
|
+
this.touch(Date.now(), parentOf11(from), parentOf11(to));
|
|
35511
|
+
}
|
|
35512
|
+
async duplicate(handle, parent, name2, copies, rest2) {
|
|
35513
|
+
if (handle.kind === "file") return this.copyBytes(handle, parent, name2, { copies }, rest2);
|
|
35514
|
+
const dir = await this.io(parent.getDirectoryHandle(name2, { create: true }));
|
|
35515
|
+
this.others++;
|
|
35516
|
+
for await (const child2 of handle.values())
|
|
35517
|
+
await this.duplicate(child2, dir, child2.name, copies, rest2 + "/" + child2.name);
|
|
35518
|
+
}
|
|
35300
35519
|
renamingDirs = /* @__PURE__ */ new Set();
|
|
35301
35520
|
intents = 0;
|
|
35302
35521
|
async intend(rename, at = `${RENAMES2}/${crypto.randomUUID()}`) {
|
|
@@ -35359,6 +35578,28 @@ var OpfsFs = class {
|
|
|
35359
35578
|
this.forget(to);
|
|
35360
35579
|
try {
|
|
35361
35580
|
const left = await this.real(from);
|
|
35581
|
+
if (current.rename.privateCopy) {
|
|
35582
|
+
if (left) {
|
|
35583
|
+
const src = await this.locate(from, false);
|
|
35584
|
+
const dir = await this.locate(parentOf11(to), true);
|
|
35585
|
+
const copies = /* @__PURE__ */ new Map();
|
|
35586
|
+
await this.duplicate(
|
|
35587
|
+
src.handle,
|
|
35588
|
+
dir.handle,
|
|
35589
|
+
baseOf4(to),
|
|
35590
|
+
copies,
|
|
35591
|
+
""
|
|
35592
|
+
);
|
|
35593
|
+
await this.commitPrivateCopy(
|
|
35594
|
+
from,
|
|
35595
|
+
to,
|
|
35596
|
+
root ?? { ino: inodeOf(from) },
|
|
35597
|
+
entry.path,
|
|
35598
|
+
copies
|
|
35599
|
+
);
|
|
35600
|
+
} else await this.meta.update(entry.path, () => void 0);
|
|
35601
|
+
return;
|
|
35602
|
+
}
|
|
35362
35603
|
if (left && replace && await this.real(to))
|
|
35363
35604
|
await PLAIN3.rm.call(this, to, { recursive: true });
|
|
35364
35605
|
if (left) {
|
|
@@ -35474,7 +35715,7 @@ var OpfsFs = class {
|
|
|
35474
35715
|
}
|
|
35475
35716
|
renameAt(at) {
|
|
35476
35717
|
for (const m of this.renamingDirs) {
|
|
35477
|
-
if (
|
|
35718
|
+
if (within11(at, m.from) || within11(at, m.to) || at === parentOf11(m.from) || at === parentOf11(m.to))
|
|
35478
35719
|
return m;
|
|
35479
35720
|
}
|
|
35480
35721
|
return void 0;
|
|
@@ -35510,7 +35751,10 @@ var OpfsFs = class {
|
|
|
35510
35751
|
}
|
|
35511
35752
|
async place(handle, dir, name2, copies, admitted) {
|
|
35512
35753
|
if (await this.moved(handle, dir, name2, admitted)) return true;
|
|
35513
|
-
if (!admitted)
|
|
35754
|
+
if (!admitted) {
|
|
35755
|
+
if (this.privateRename) throw PRIVATE_COPY;
|
|
35756
|
+
throw fsError("EBUSY", name2);
|
|
35757
|
+
}
|
|
35514
35758
|
const before = this.fileMoves;
|
|
35515
35759
|
try {
|
|
35516
35760
|
await this.copy(handle, dir, name2, { copies });
|
|
@@ -35558,21 +35802,7 @@ var OpfsFs = class {
|
|
|
35558
35802
|
if (handle.kind === "file") {
|
|
35559
35803
|
if (options.restoring && await this.handleExists(dir, name2)) return;
|
|
35560
35804
|
if (await this.moveChild(handle, dir, name2)) return;
|
|
35561
|
-
|
|
35562
|
-
const made2 = await this.io(dir.getFileHandle(name2, { create: true }));
|
|
35563
|
-
const writable3 = await this.io(made2.createWritable());
|
|
35564
|
-
try {
|
|
35565
|
-
await writable3.write(file);
|
|
35566
|
-
await writable3.close();
|
|
35567
|
-
} catch (err) {
|
|
35568
|
-
await writable3.abort().catch(nothing2);
|
|
35569
|
-
throw err;
|
|
35570
|
-
}
|
|
35571
|
-
options.copies?.set(rest2, {
|
|
35572
|
-
before: options.copies.get(rest2)?.before ?? file.lastModified,
|
|
35573
|
-
made: made2
|
|
35574
|
-
});
|
|
35575
|
-
return;
|
|
35805
|
+
return this.copyBytes(handle, dir, name2, options, rest2);
|
|
35576
35806
|
}
|
|
35577
35807
|
const target = await this.io(dir.getDirectoryHandle(name2, { create: true }));
|
|
35578
35808
|
this.others++;
|
|
@@ -35580,6 +35810,22 @@ var OpfsFs = class {
|
|
|
35580
35810
|
await this.copy(child2, target, child2.name, options, `${rest2}/${child2.name}`);
|
|
35581
35811
|
}
|
|
35582
35812
|
}
|
|
35813
|
+
async copyBytes(handle, dir, name2, options, rest2) {
|
|
35814
|
+
const file = await this.io(handle.getFile());
|
|
35815
|
+
const made2 = await this.io(dir.getFileHandle(name2, { create: true }));
|
|
35816
|
+
const writable3 = await this.io(made2.createWritable());
|
|
35817
|
+
try {
|
|
35818
|
+
await writable3.write(file);
|
|
35819
|
+
await writable3.close();
|
|
35820
|
+
} catch (err) {
|
|
35821
|
+
await writable3.abort().catch(nothing2);
|
|
35822
|
+
throw err;
|
|
35823
|
+
}
|
|
35824
|
+
options.copies?.set(rest2, {
|
|
35825
|
+
before: options.copies.get(rest2)?.before ?? file.lastModified,
|
|
35826
|
+
made: made2
|
|
35827
|
+
});
|
|
35828
|
+
}
|
|
35583
35829
|
async symlink(target, path, owner) {
|
|
35584
35830
|
if (overPath(target)) throw fsError("ENAMETOOLONG", path);
|
|
35585
35831
|
const parent = await this.exactly(() => this.locate(parentOf11(path), true));
|
|
@@ -35747,7 +35993,7 @@ function nothing2() {
|
|
|
35747
35993
|
}
|
|
35748
35994
|
function touches2(at, trees, listing = true, removing = false) {
|
|
35749
35995
|
return trees.some(
|
|
35750
|
-
([from, to]) =>
|
|
35996
|
+
([from, to]) => within11(at, from) || within11(at, to) || listing && (at === parentOf11(from) || at === parentOf11(to)) || removing && (at === "/" || within11(from, at) || within11(to, at))
|
|
35751
35997
|
);
|
|
35752
35998
|
}
|
|
35753
35999
|
function byIntent(a, b) {
|
|
@@ -35792,6 +36038,7 @@ var WRITES = [
|
|
|
35792
36038
|
const proto = OpfsFs.prototype;
|
|
35793
36039
|
const inner = proto.createExclusive;
|
|
35794
36040
|
proto.createExclusive = function(...args) {
|
|
36041
|
+
if (this.privateRename) return this.privateOp("createExclusive", args, inner);
|
|
35795
36042
|
if (this.amongPeers()) return this.peerOp("createExclusive", args, inner);
|
|
35796
36043
|
return this.alonePlain(inner, args);
|
|
35797
36044
|
};
|
|
@@ -35805,6 +36052,7 @@ for (const [names2, op] of [
|
|
|
35805
36052
|
const inner = proto[name2];
|
|
35806
36053
|
proto[name2] = async function(...args) {
|
|
35807
36054
|
try {
|
|
36055
|
+
if (this.privateRename) return await this.privateOp(name2, args, inner);
|
|
35808
36056
|
if (op === "read") await this.settledRename(args[0]);
|
|
35809
36057
|
if (this.amongPeers() || name2 === "writeSession")
|
|
35810
36058
|
return await this.peerOp(name2, args, inner);
|
|
@@ -39691,9 +39939,9 @@ var Launcher = class {
|
|
|
39691
39939
|
}
|
|
39692
39940
|
packageRootIs(path) {
|
|
39693
39941
|
const at = normalizePath(path);
|
|
39694
|
-
const
|
|
39942
|
+
const within13 = `${at}/`;
|
|
39695
39943
|
const roots = [this.modulesDir, ...this.appended];
|
|
39696
|
-
const root = PACKAGE_ROOT.exec(
|
|
39944
|
+
const root = PACKAGE_ROOT.exec(within13)?.[1] ?? packageRootOf(within13, roots);
|
|
39697
39945
|
return root === at;
|
|
39698
39946
|
}
|
|
39699
39947
|
packageRoots(planned) {
|
|
@@ -43957,7 +44205,7 @@ function treeBindings(path) {
|
|
|
43957
44205
|
return [encodeText(path), encodeText(`${path}/`), encodeText(`${path}0`)];
|
|
43958
44206
|
}
|
|
43959
44207
|
var CACHED = 8192;
|
|
43960
|
-
function
|
|
44208
|
+
function within12(path, root) {
|
|
43961
44209
|
return root === "/" || path === root || path.startsWith(`${root}/`);
|
|
43962
44210
|
}
|
|
43963
44211
|
var SqliteMeta = class {
|
|
@@ -44066,7 +44314,7 @@ var SqliteMeta = class {
|
|
|
44066
44314
|
return out;
|
|
44067
44315
|
}
|
|
44068
44316
|
async under(path) {
|
|
44069
|
-
return this.tree(path).filter((entry) =>
|
|
44317
|
+
return this.tree(path).filter((entry) => within12(entry.path, path));
|
|
44070
44318
|
}
|
|
44071
44319
|
async all() {
|
|
44072
44320
|
return this.tree("/");
|