@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/node.js
CHANGED
|
@@ -7734,7 +7734,7 @@ function satisfies(version, range2) {
|
|
|
7734
7734
|
}
|
|
7735
7735
|
|
|
7736
7736
|
// src/version.ts
|
|
7737
|
-
var KERNEL_VERSION = true ? "1.196.
|
|
7737
|
+
var KERNEL_VERSION = true ? "1.196.19" : "0.0.0-dev";
|
|
7738
7738
|
var OS_RELEASE = "6.0.0-slicc";
|
|
7739
7739
|
function procVersion() {
|
|
7740
7740
|
return `Linux version ${OS_RELEASE} (slicc-kernel ${KERNEL_VERSION}) #1 SMP PREEMPT_DYNAMIC
|
|
@@ -33534,6 +33534,123 @@ function noticeOf(data) {
|
|
|
33534
33534
|
return { paths: strings3(notice.paths), trees: strings3(notice.trees), outside: true };
|
|
33535
33535
|
}
|
|
33536
33536
|
|
|
33537
|
+
// src/fs/private-rename.ts
|
|
33538
|
+
var DRAIN_MS = 500;
|
|
33539
|
+
var ADMISSION_MS = 5e3;
|
|
33540
|
+
var within10 = (at, root) => at === root || root === "/" || at.startsWith(root + "/");
|
|
33541
|
+
var PrivatePaths = class {
|
|
33542
|
+
names;
|
|
33543
|
+
bound = false;
|
|
33544
|
+
shifted = false;
|
|
33545
|
+
listing;
|
|
33546
|
+
removing;
|
|
33547
|
+
constructor(paths, listing, removing) {
|
|
33548
|
+
this.listing = listing;
|
|
33549
|
+
this.removing = removing;
|
|
33550
|
+
this.names = new Set(paths.map(normalizePath));
|
|
33551
|
+
}
|
|
33552
|
+
touches(roots, names2 = this.names) {
|
|
33553
|
+
for (const at of names2)
|
|
33554
|
+
for (const root of roots) {
|
|
33555
|
+
if (within10(at, root) || this.removing && within10(root, at)) return true;
|
|
33556
|
+
if (this.listing && at === (root.slice(0, root.lastIndexOf("/")) || "/")) return true;
|
|
33557
|
+
}
|
|
33558
|
+
return false;
|
|
33559
|
+
}
|
|
33560
|
+
bind(path) {
|
|
33561
|
+
if (this.shifted) return;
|
|
33562
|
+
this.names.clear();
|
|
33563
|
+
this.names.add(path);
|
|
33564
|
+
this.bound = true;
|
|
33565
|
+
}
|
|
33566
|
+
moved(from, to) {
|
|
33567
|
+
const names2 = this.redirected(from, to);
|
|
33568
|
+
if (!names2.size) return;
|
|
33569
|
+
this.shifted = true;
|
|
33570
|
+
if (this.bound) this.names.clear();
|
|
33571
|
+
for (const name2 of names2) this.names.add(name2);
|
|
33572
|
+
}
|
|
33573
|
+
redirected(from, to) {
|
|
33574
|
+
const names2 = /* @__PURE__ */ new Set();
|
|
33575
|
+
for (const path of this.names)
|
|
33576
|
+
if (within10(path, from)) {
|
|
33577
|
+
const next3 = resolvePath(to, path.slice(from.length).replace(/^\//, ""));
|
|
33578
|
+
if (!this.names.has(next3)) names2.add(next3);
|
|
33579
|
+
}
|
|
33580
|
+
return names2;
|
|
33581
|
+
}
|
|
33582
|
+
};
|
|
33583
|
+
var PrivateRename = class {
|
|
33584
|
+
active = /* @__PURE__ */ new Set();
|
|
33585
|
+
barriers = /* @__PURE__ */ new Map();
|
|
33586
|
+
waiters = /* @__PURE__ */ new Set();
|
|
33587
|
+
wait(take, ms) {
|
|
33588
|
+
if (take()) return Promise.resolve();
|
|
33589
|
+
return new Promise((resolve2, reject) => {
|
|
33590
|
+
const wake = () => {
|
|
33591
|
+
if (!take()) return;
|
|
33592
|
+
this.waiters.delete(wake);
|
|
33593
|
+
clearTimeout(timer);
|
|
33594
|
+
resolve2();
|
|
33595
|
+
};
|
|
33596
|
+
const timer = setTimeout(() => {
|
|
33597
|
+
this.waiters.delete(wake);
|
|
33598
|
+
reject(fsError("EBUSY", "private rename"));
|
|
33599
|
+
}, ms);
|
|
33600
|
+
this.waiters.add(wake);
|
|
33601
|
+
});
|
|
33602
|
+
}
|
|
33603
|
+
wake() {
|
|
33604
|
+
for (const waiter of this.waiters) waiter();
|
|
33605
|
+
}
|
|
33606
|
+
blocked(op, names2 = op.names) {
|
|
33607
|
+
for (const [barrier, draining] of this.barriers) {
|
|
33608
|
+
if (!draining.has(op) && op.touches(barrier.names, names2)) return true;
|
|
33609
|
+
}
|
|
33610
|
+
return false;
|
|
33611
|
+
}
|
|
33612
|
+
enter(op) {
|
|
33613
|
+
return this.wait(() => {
|
|
33614
|
+
if (this.blocked(op)) return false;
|
|
33615
|
+
this.active.add(op);
|
|
33616
|
+
return true;
|
|
33617
|
+
}, ADMISSION_MS);
|
|
33618
|
+
}
|
|
33619
|
+
leave(op) {
|
|
33620
|
+
this.active.delete(op);
|
|
33621
|
+
for (const draining of this.barriers.values()) draining.delete(op);
|
|
33622
|
+
this.wake();
|
|
33623
|
+
}
|
|
33624
|
+
redirect(op, from, to) {
|
|
33625
|
+
const names2 = op.redirected(from, to);
|
|
33626
|
+
if (this.barriers.has(op) && names2.size) throw fsError("EBUSY", from);
|
|
33627
|
+
return this.wait(() => {
|
|
33628
|
+
if (this.blocked(op, names2)) return false;
|
|
33629
|
+
for (const name2 of names2) op.names.add(name2);
|
|
33630
|
+
return true;
|
|
33631
|
+
}, ADMISSION_MS);
|
|
33632
|
+
}
|
|
33633
|
+
moved(from, to) {
|
|
33634
|
+
for (const op of this.active) op.moved(from, to);
|
|
33635
|
+
}
|
|
33636
|
+
async exclusive(op, run2) {
|
|
33637
|
+
const draining = /* @__PURE__ */ new Set();
|
|
33638
|
+
await this.wait(() => {
|
|
33639
|
+
if (this.blocked(op)) return false;
|
|
33640
|
+
for (const active of this.active) if (active.touches(op.names)) draining.add(active);
|
|
33641
|
+
this.barriers.set(op, draining);
|
|
33642
|
+
return true;
|
|
33643
|
+
}, ADMISSION_MS);
|
|
33644
|
+
try {
|
|
33645
|
+
await this.wait(() => ![...draining].some((active) => this.active.has(active)), DRAIN_MS);
|
|
33646
|
+
return await run2();
|
|
33647
|
+
} finally {
|
|
33648
|
+
this.barriers.delete(op);
|
|
33649
|
+
this.wake();
|
|
33650
|
+
}
|
|
33651
|
+
}
|
|
33652
|
+
};
|
|
33653
|
+
|
|
33537
33654
|
// src/fs/opfs.ts
|
|
33538
33655
|
var S_IFDIR2 = 16384;
|
|
33539
33656
|
var S_IFREG3 = 32768;
|
|
@@ -33574,8 +33691,12 @@ var PAIRED = /* @__PURE__ */ new Set(["rename", "link", "copyFile"]);
|
|
|
33574
33691
|
var LISTINGS = /* @__PURE__ */ new Set(["readdir", "readdirStat"]);
|
|
33575
33692
|
var REMOVALS2 = /* @__PURE__ */ new Set(["rm", "rename"]);
|
|
33576
33693
|
var RETRY = /* @__PURE__ */ Symbol("retry");
|
|
33694
|
+
var PRIVATE_COPY = /* @__PURE__ */ Symbol("private-copy");
|
|
33577
33695
|
var ACK_SAMPLES = 4096;
|
|
33578
33696
|
var INTENT_POLL_MS = 5;
|
|
33697
|
+
function needsCopy(handle, swap) {
|
|
33698
|
+
return swap || handle.kind === "directory" && !movable(handle);
|
|
33699
|
+
}
|
|
33579
33700
|
function movable(handle) {
|
|
33580
33701
|
return typeof handle.move === "function";
|
|
33581
33702
|
}
|
|
@@ -33658,7 +33779,7 @@ function prefixes(path) {
|
|
|
33658
33779
|
const parts2 = split2(path);
|
|
33659
33780
|
return parts2.map((_, i) => `/${parts2.slice(0, i + 1).join("/")}`);
|
|
33660
33781
|
}
|
|
33661
|
-
function
|
|
33782
|
+
function within11(path, root) {
|
|
33662
33783
|
return path === root || path.startsWith(`${root}/`);
|
|
33663
33784
|
}
|
|
33664
33785
|
var unstored = () => Object.assign(new Error("the file system kept fewer bytes than were written"), {
|
|
@@ -33770,6 +33891,10 @@ function isHandle(child2) {
|
|
|
33770
33891
|
var FILE_TIMES_MS = 100;
|
|
33771
33892
|
var OpfsFs = class {
|
|
33772
33893
|
root;
|
|
33894
|
+
privateRename;
|
|
33895
|
+
insidePrivateOp = false;
|
|
33896
|
+
privateRedirect;
|
|
33897
|
+
privateSession;
|
|
33773
33898
|
meta;
|
|
33774
33899
|
dirs = new PathMap();
|
|
33775
33900
|
files = new PathMap();
|
|
@@ -33794,6 +33919,7 @@ var OpfsFs = class {
|
|
|
33794
33919
|
renamePrefix;
|
|
33795
33920
|
constructor(root, meta = new MemoryMeta(), channel, options = {}) {
|
|
33796
33921
|
this.root = root;
|
|
33922
|
+
this.privateRename = channel === void 0 ? new PrivateRename() : void 0;
|
|
33797
33923
|
this.meta = sidecar(meta);
|
|
33798
33924
|
this.ranged = options.ranged === true;
|
|
33799
33925
|
this.locks = options.locks === void 0 ? lockManager() : options.locks ?? void 0;
|
|
@@ -34373,6 +34499,7 @@ var OpfsFs = class {
|
|
|
34373
34499
|
if (this.rejectLinks) throw fsError("ELOOP", path);
|
|
34374
34500
|
const stored = link2.link;
|
|
34375
34501
|
if (overPath(stored)) throw fsError("ENAMETOOLONG", link2.path);
|
|
34502
|
+
const previous = current;
|
|
34376
34503
|
const target = stored + current.slice(link2.path.length);
|
|
34377
34504
|
if (target.split("/").includes("..") || longParent(stored) !== void 0) {
|
|
34378
34505
|
const resolved2 = await this.physical(parentOf11(link2.path), target, hops + 1, path);
|
|
@@ -34382,6 +34509,7 @@ var OpfsFs = class {
|
|
|
34382
34509
|
current = resolvePath(parentOf11(link2.path), target);
|
|
34383
34510
|
}
|
|
34384
34511
|
this.crossing(path, current);
|
|
34512
|
+
await this.privateRedirect?.(previous, current);
|
|
34385
34513
|
}
|
|
34386
34514
|
}
|
|
34387
34515
|
throw fsError("ELOOP", path);
|
|
@@ -34473,11 +34601,11 @@ var OpfsFs = class {
|
|
|
34473
34601
|
movePending(from, to) {
|
|
34474
34602
|
if (to !== void 0) {
|
|
34475
34603
|
for (const path of [...this.fileTimes.keys()]) {
|
|
34476
|
-
if (
|
|
34604
|
+
if (within11(path, to)) this.fileTimes.delete(path);
|
|
34477
34605
|
}
|
|
34478
34606
|
}
|
|
34479
34607
|
for (const [path, ms] of [...this.fileTimes]) {
|
|
34480
|
-
if (!
|
|
34608
|
+
if (!within11(path, from)) continue;
|
|
34481
34609
|
this.fileTimes.delete(path);
|
|
34482
34610
|
if (to !== void 0) this.fileTimes.set(to + path.slice(from.length), ms);
|
|
34483
34611
|
}
|
|
@@ -34757,8 +34885,8 @@ var OpfsFs = class {
|
|
|
34757
34885
|
const file = this.movingFiles.get(at);
|
|
34758
34886
|
if (file !== void 0) return { done: file, away: true };
|
|
34759
34887
|
for (const m of this.renamingDirs) {
|
|
34760
|
-
if (
|
|
34761
|
-
if (
|
|
34888
|
+
if (within11(at, m.from)) return { done: m.done, away: true };
|
|
34889
|
+
if (within11(at, m.to)) return { done: m.done, away: false };
|
|
34762
34890
|
}
|
|
34763
34891
|
return void 0;
|
|
34764
34892
|
}
|
|
@@ -34794,7 +34922,7 @@ var OpfsFs = class {
|
|
|
34794
34922
|
idle2.resolve();
|
|
34795
34923
|
}
|
|
34796
34924
|
async writesDrained(tree2) {
|
|
34797
|
-
while ([...this.fileWrites.keys()].some((at) =>
|
|
34925
|
+
while ([...this.fileWrites.keys()].some((at) => within11(at, tree2))) {
|
|
34798
34926
|
this.writesIdle ??= Promise.withResolvers();
|
|
34799
34927
|
await this.writesIdle.promise;
|
|
34800
34928
|
}
|
|
@@ -34871,6 +34999,7 @@ var OpfsFs = class {
|
|
|
34871
34999
|
}
|
|
34872
35000
|
async writeSession(path, truncate) {
|
|
34873
35001
|
const [handle, , target] = await this.fileFor(path);
|
|
35002
|
+
this.privateSession?.bind(target);
|
|
34874
35003
|
const writable3 = await this.retrying(
|
|
34875
35004
|
path,
|
|
34876
35005
|
() => this.io(handle.createWritable({ keepExistingData: !truncate })),
|
|
@@ -35253,15 +35382,14 @@ var OpfsFs = class {
|
|
|
35253
35382
|
if (parent.handle?.kind !== "directory") throw fsError("ENOTDIR", to);
|
|
35254
35383
|
const destination = resolvePath(parent.path, baseOf4(to));
|
|
35255
35384
|
this.refuse(destination, true);
|
|
35256
|
-
if (directory)
|
|
35257
|
-
|
|
35258
|
-
if (source.path === destination) return;
|
|
35259
|
-
}
|
|
35385
|
+
if (directory && source.handle?.kind !== "directory") throw fsError("ENOTDIR", from);
|
|
35386
|
+
if (source.path === destination) return;
|
|
35260
35387
|
await this.entering(destination, () => this.moveTo(source, parent, destination, to, call));
|
|
35388
|
+
this.privateRename?.moved(source.path, destination);
|
|
35261
35389
|
}
|
|
35262
35390
|
async moveTo(source, parent, destination, to, call) {
|
|
35263
35391
|
const sourceStat = await this.describe(source);
|
|
35264
|
-
if (sourceStat.isDirectory &&
|
|
35392
|
+
if (sourceStat.isDirectory && within11(destination, source.path)) throw fsError("EINVAL", to);
|
|
35265
35393
|
const target = await this.exactly(() => this.locate(destination, false)).catch((err) => {
|
|
35266
35394
|
if (missing6(err)) return null;
|
|
35267
35395
|
throw err;
|
|
@@ -35297,8 +35425,10 @@ var OpfsFs = class {
|
|
|
35297
35425
|
let lock;
|
|
35298
35426
|
const hooks = {};
|
|
35299
35427
|
const staging = swap ? `.${name2}.${crypto.randomUUID()}` : name2;
|
|
35300
|
-
const copying =
|
|
35428
|
+
const copying = needsCopy(source.handle, swap);
|
|
35301
35429
|
const staged2 = resolvePath(parent.path, staging);
|
|
35430
|
+
if (this.usePrivateCopy(source.handle, copying))
|
|
35431
|
+
return this.privateCopy(source, parent, destination, target?.handle, moving);
|
|
35302
35432
|
const place = async () => {
|
|
35303
35433
|
this.forget(destination);
|
|
35304
35434
|
const copies = /* @__PURE__ */ new Map();
|
|
@@ -35533,7 +35663,7 @@ var OpfsFs = class {
|
|
|
35533
35663
|
for (const move of this.peerMoves.values()) {
|
|
35534
35664
|
for (const tree2 of move.trees) {
|
|
35535
35665
|
for (const mine of [from, to]) {
|
|
35536
|
-
if (tree2.some((theirs) =>
|
|
35666
|
+
if (tree2.some((theirs) => within11(mine, theirs) || within11(theirs, mine))) return move;
|
|
35537
35667
|
}
|
|
35538
35668
|
}
|
|
35539
35669
|
}
|
|
@@ -35625,6 +35755,95 @@ var OpfsFs = class {
|
|
|
35625
35755
|
});
|
|
35626
35756
|
return { ...session, close: () => session.close().finally(done4) };
|
|
35627
35757
|
}
|
|
35758
|
+
async privateOp(name2, args, inner) {
|
|
35759
|
+
const gate = this.privateRename;
|
|
35760
|
+
if (!gate || this.insidePrivateOp) return inner.apply(this, args);
|
|
35761
|
+
const paths = name2 === "symlink" ? args.slice(1, 2) : args.slice(0, PAIRED.has(name2) ? 2 : 1);
|
|
35762
|
+
const op = new PrivatePaths(paths, LISTINGS.has(name2), REMOVALS2.has(name2));
|
|
35763
|
+
const inside2 = view(this, {
|
|
35764
|
+
insidePrivateOp: true,
|
|
35765
|
+
privateSession: name2 === "writeSession" ? op : void 0,
|
|
35766
|
+
privateRedirect: (from, to) => gate.redirect(op, from, to)
|
|
35767
|
+
});
|
|
35768
|
+
await gate.enter(op);
|
|
35769
|
+
const leave = () => gate.leave(op);
|
|
35770
|
+
let sessionOwnsAdmission = false;
|
|
35771
|
+
try {
|
|
35772
|
+
if (name2 === "writeSession") {
|
|
35773
|
+
const session = await inner.apply(inside2, args);
|
|
35774
|
+
sessionOwnsAdmission = true;
|
|
35775
|
+
let closed;
|
|
35776
|
+
return { ...session, close: () => closed ??= session.close().finally(leave) };
|
|
35777
|
+
}
|
|
35778
|
+
if (name2 !== "rename") return await inner.apply(inside2, args);
|
|
35779
|
+
try {
|
|
35780
|
+
return await inner.apply(inside2, args);
|
|
35781
|
+
} catch (err) {
|
|
35782
|
+
if (err !== PRIVATE_COPY) throw err;
|
|
35783
|
+
}
|
|
35784
|
+
} finally {
|
|
35785
|
+
if (!sessionOwnsAdmission) leave();
|
|
35786
|
+
}
|
|
35787
|
+
const exclusive = view(inside2, { privateCopyReady: true });
|
|
35788
|
+
return gate.exclusive(op, () => inner.apply(exclusive, args));
|
|
35789
|
+
}
|
|
35790
|
+
privateCopyReady = false;
|
|
35791
|
+
usePrivateCopy(handle, staging) {
|
|
35792
|
+
if (!this.privateRename) return false;
|
|
35793
|
+
if (this.privateCopyReady) return true;
|
|
35794
|
+
if (staging || !movable(handle)) throw PRIVATE_COPY;
|
|
35795
|
+
return false;
|
|
35796
|
+
}
|
|
35797
|
+
async privateCopy(source, parent, to, target, owner) {
|
|
35798
|
+
const handle = source.handle;
|
|
35799
|
+
const dir = parent.handle;
|
|
35800
|
+
const name2 = baseOf4(to);
|
|
35801
|
+
const copies = /* @__PURE__ */ new Map();
|
|
35802
|
+
const [entry] = await this.meta.get([source.path]);
|
|
35803
|
+
const root = { ino: occupied(entry).ino ?? inodeOf(source.path), ...owner };
|
|
35804
|
+
const intent = await this.intend({ from: source.path, to, root, privateCopy: true });
|
|
35805
|
+
try {
|
|
35806
|
+
await this.duplicate(handle, dir, name2, copies, "");
|
|
35807
|
+
} catch (err) {
|
|
35808
|
+
if (!target)
|
|
35809
|
+
await dir.removeEntry(name2, { recursive: true }).catch((e) => {
|
|
35810
|
+
if (e.name !== "NotFoundError") throw e;
|
|
35811
|
+
});
|
|
35812
|
+
else if (target.kind === "directory") {
|
|
35813
|
+
for await (const child2 of target.keys())
|
|
35814
|
+
await target.removeEntry(child2, { recursive: true });
|
|
35815
|
+
}
|
|
35816
|
+
this.forget(to);
|
|
35817
|
+
await this.meta.update(intent, () => void 0);
|
|
35818
|
+
throw translate(err, to, "write");
|
|
35819
|
+
}
|
|
35820
|
+
await this.commitPrivateCopy(source.path, to, root, intent, copies);
|
|
35821
|
+
}
|
|
35822
|
+
async commitPrivateCopy(from, to, root, intent, copies) {
|
|
35823
|
+
const { ino, ...owner } = root;
|
|
35824
|
+
const entries = await this.meta.get([from, to]);
|
|
35825
|
+
if (!entries[0]?.vacated || entries[1]?.ino !== ino) {
|
|
35826
|
+
await this.meta.move(
|
|
35827
|
+
from,
|
|
35828
|
+
to,
|
|
35829
|
+
(entry) => ({ ...occupied(entry), ...owner, ino, path: to, ctimeMs: Date.now() }),
|
|
35830
|
+
vacatedAt(from)
|
|
35831
|
+
);
|
|
35832
|
+
}
|
|
35833
|
+
this.movePending(from, to);
|
|
35834
|
+
await this.removePhysical(from, true);
|
|
35835
|
+
await this.meta.update(intent, () => void 0);
|
|
35836
|
+
await this.restamp(to, copies);
|
|
35837
|
+
this.changed(from, to);
|
|
35838
|
+
this.touch(Date.now(), parentOf11(from), parentOf11(to));
|
|
35839
|
+
}
|
|
35840
|
+
async duplicate(handle, parent, name2, copies, rest2) {
|
|
35841
|
+
if (handle.kind === "file") return this.copyBytes(handle, parent, name2, { copies }, rest2);
|
|
35842
|
+
const dir = await this.io(parent.getDirectoryHandle(name2, { create: true }));
|
|
35843
|
+
this.others++;
|
|
35844
|
+
for await (const child2 of handle.values())
|
|
35845
|
+
await this.duplicate(child2, dir, child2.name, copies, rest2 + "/" + child2.name);
|
|
35846
|
+
}
|
|
35628
35847
|
renamingDirs = /* @__PURE__ */ new Set();
|
|
35629
35848
|
intents = 0;
|
|
35630
35849
|
async intend(rename, at = `${RENAMES2}/${crypto.randomUUID()}`) {
|
|
@@ -35687,6 +35906,28 @@ var OpfsFs = class {
|
|
|
35687
35906
|
this.forget(to);
|
|
35688
35907
|
try {
|
|
35689
35908
|
const left = await this.real(from);
|
|
35909
|
+
if (current.rename.privateCopy) {
|
|
35910
|
+
if (left) {
|
|
35911
|
+
const src = await this.locate(from, false);
|
|
35912
|
+
const dir = await this.locate(parentOf11(to), true);
|
|
35913
|
+
const copies = /* @__PURE__ */ new Map();
|
|
35914
|
+
await this.duplicate(
|
|
35915
|
+
src.handle,
|
|
35916
|
+
dir.handle,
|
|
35917
|
+
baseOf4(to),
|
|
35918
|
+
copies,
|
|
35919
|
+
""
|
|
35920
|
+
);
|
|
35921
|
+
await this.commitPrivateCopy(
|
|
35922
|
+
from,
|
|
35923
|
+
to,
|
|
35924
|
+
root ?? { ino: inodeOf(from) },
|
|
35925
|
+
entry.path,
|
|
35926
|
+
copies
|
|
35927
|
+
);
|
|
35928
|
+
} else await this.meta.update(entry.path, () => void 0);
|
|
35929
|
+
return;
|
|
35930
|
+
}
|
|
35690
35931
|
if (left && replace && await this.real(to))
|
|
35691
35932
|
await PLAIN3.rm.call(this, to, { recursive: true });
|
|
35692
35933
|
if (left) {
|
|
@@ -35802,7 +36043,7 @@ var OpfsFs = class {
|
|
|
35802
36043
|
}
|
|
35803
36044
|
renameAt(at) {
|
|
35804
36045
|
for (const m of this.renamingDirs) {
|
|
35805
|
-
if (
|
|
36046
|
+
if (within11(at, m.from) || within11(at, m.to) || at === parentOf11(m.from) || at === parentOf11(m.to))
|
|
35806
36047
|
return m;
|
|
35807
36048
|
}
|
|
35808
36049
|
return void 0;
|
|
@@ -35838,7 +36079,10 @@ var OpfsFs = class {
|
|
|
35838
36079
|
}
|
|
35839
36080
|
async place(handle, dir, name2, copies, admitted) {
|
|
35840
36081
|
if (await this.moved(handle, dir, name2, admitted)) return true;
|
|
35841
|
-
if (!admitted)
|
|
36082
|
+
if (!admitted) {
|
|
36083
|
+
if (this.privateRename) throw PRIVATE_COPY;
|
|
36084
|
+
throw fsError("EBUSY", name2);
|
|
36085
|
+
}
|
|
35842
36086
|
const before = this.fileMoves;
|
|
35843
36087
|
try {
|
|
35844
36088
|
await this.copy(handle, dir, name2, { copies });
|
|
@@ -35886,21 +36130,7 @@ var OpfsFs = class {
|
|
|
35886
36130
|
if (handle.kind === "file") {
|
|
35887
36131
|
if (options.restoring && await this.handleExists(dir, name2)) return;
|
|
35888
36132
|
if (await this.moveChild(handle, dir, name2)) return;
|
|
35889
|
-
|
|
35890
|
-
const made2 = await this.io(dir.getFileHandle(name2, { create: true }));
|
|
35891
|
-
const writable3 = await this.io(made2.createWritable());
|
|
35892
|
-
try {
|
|
35893
|
-
await writable3.write(file);
|
|
35894
|
-
await writable3.close();
|
|
35895
|
-
} catch (err) {
|
|
35896
|
-
await writable3.abort().catch(nothing2);
|
|
35897
|
-
throw err;
|
|
35898
|
-
}
|
|
35899
|
-
options.copies?.set(rest2, {
|
|
35900
|
-
before: options.copies.get(rest2)?.before ?? file.lastModified,
|
|
35901
|
-
made: made2
|
|
35902
|
-
});
|
|
35903
|
-
return;
|
|
36133
|
+
return this.copyBytes(handle, dir, name2, options, rest2);
|
|
35904
36134
|
}
|
|
35905
36135
|
const target = await this.io(dir.getDirectoryHandle(name2, { create: true }));
|
|
35906
36136
|
this.others++;
|
|
@@ -35908,6 +36138,22 @@ var OpfsFs = class {
|
|
|
35908
36138
|
await this.copy(child2, target, child2.name, options, `${rest2}/${child2.name}`);
|
|
35909
36139
|
}
|
|
35910
36140
|
}
|
|
36141
|
+
async copyBytes(handle, dir, name2, options, rest2) {
|
|
36142
|
+
const file = await this.io(handle.getFile());
|
|
36143
|
+
const made2 = await this.io(dir.getFileHandle(name2, { create: true }));
|
|
36144
|
+
const writable3 = await this.io(made2.createWritable());
|
|
36145
|
+
try {
|
|
36146
|
+
await writable3.write(file);
|
|
36147
|
+
await writable3.close();
|
|
36148
|
+
} catch (err) {
|
|
36149
|
+
await writable3.abort().catch(nothing2);
|
|
36150
|
+
throw err;
|
|
36151
|
+
}
|
|
36152
|
+
options.copies?.set(rest2, {
|
|
36153
|
+
before: options.copies.get(rest2)?.before ?? file.lastModified,
|
|
36154
|
+
made: made2
|
|
36155
|
+
});
|
|
36156
|
+
}
|
|
35911
36157
|
async symlink(target, path, owner) {
|
|
35912
36158
|
if (overPath(target)) throw fsError("ENAMETOOLONG", path);
|
|
35913
36159
|
const parent = await this.exactly(() => this.locate(parentOf11(path), true));
|
|
@@ -36075,7 +36321,7 @@ function nothing2() {
|
|
|
36075
36321
|
}
|
|
36076
36322
|
function touches2(at, trees, listing = true, removing = false) {
|
|
36077
36323
|
return trees.some(
|
|
36078
|
-
([from, to]) =>
|
|
36324
|
+
([from, to]) => within11(at, from) || within11(at, to) || listing && (at === parentOf11(from) || at === parentOf11(to)) || removing && (at === "/" || within11(from, at) || within11(to, at))
|
|
36079
36325
|
);
|
|
36080
36326
|
}
|
|
36081
36327
|
function byIntent(a, b) {
|
|
@@ -36120,6 +36366,7 @@ var WRITES = [
|
|
|
36120
36366
|
const proto = OpfsFs.prototype;
|
|
36121
36367
|
const inner = proto.createExclusive;
|
|
36122
36368
|
proto.createExclusive = function(...args) {
|
|
36369
|
+
if (this.privateRename) return this.privateOp("createExclusive", args, inner);
|
|
36123
36370
|
if (this.amongPeers()) return this.peerOp("createExclusive", args, inner);
|
|
36124
36371
|
return this.alonePlain(inner, args);
|
|
36125
36372
|
};
|
|
@@ -36133,6 +36380,7 @@ for (const [names2, op] of [
|
|
|
36133
36380
|
const inner = proto[name2];
|
|
36134
36381
|
proto[name2] = async function(...args) {
|
|
36135
36382
|
try {
|
|
36383
|
+
if (this.privateRename) return await this.privateOp(name2, args, inner);
|
|
36136
36384
|
if (op === "read") await this.settledRename(args[0]);
|
|
36137
36385
|
if (this.amongPeers() || name2 === "writeSession")
|
|
36138
36386
|
return await this.peerOp(name2, args, inner);
|
|
@@ -40057,9 +40305,9 @@ var Launcher = class {
|
|
|
40057
40305
|
}
|
|
40058
40306
|
packageRootIs(path) {
|
|
40059
40307
|
const at = normalizePath(path);
|
|
40060
|
-
const
|
|
40308
|
+
const within12 = `${at}/`;
|
|
40061
40309
|
const roots = [this.modulesDir, ...this.appended];
|
|
40062
|
-
const root = PACKAGE_ROOT.exec(
|
|
40310
|
+
const root = PACKAGE_ROOT.exec(within12)?.[1] ?? packageRootOf(within12, roots);
|
|
40063
40311
|
return root === at;
|
|
40064
40312
|
}
|
|
40065
40313
|
packageRoots(planned) {
|