poe-code 15.0.5 → 15.0.6
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/dist/metafile.json +1 -1
- package/package.json +1 -1
- package/packages/safe-bash/dist/commands/archive/index.d.ts +2 -0
- package/packages/safe-bash/dist/commands/archive/index.d.ts.map +1 -1
- package/packages/safe-bash/dist/commands/archive/index.js +11 -3
- package/packages/safe-bash/dist/commands/archive/index.js.map +1 -1
- package/packages/safe-bash/dist/commands/archive/unzip/arguments.d.ts +32 -0
- package/packages/safe-bash/dist/commands/archive/unzip/arguments.d.ts.map +1 -0
- package/packages/safe-bash/dist/commands/archive/unzip/arguments.js +214 -0
- package/packages/safe-bash/dist/commands/archive/unzip/arguments.js.map +1 -0
- package/packages/safe-bash/dist/commands/archive/unzip/safety.d.ts +28 -0
- package/packages/safe-bash/dist/commands/archive/unzip/safety.d.ts.map +1 -0
- package/packages/safe-bash/dist/commands/archive/unzip/safety.js +288 -0
- package/packages/safe-bash/dist/commands/archive/unzip/safety.js.map +1 -0
- package/packages/safe-bash/dist/commands/archive/unzip.d.ts +4 -0
- package/packages/safe-bash/dist/commands/archive/unzip.d.ts.map +1 -0
- package/packages/safe-bash/dist/commands/archive/unzip.js +264 -0
- package/packages/safe-bash/dist/commands/archive/unzip.js.map +1 -0
- package/packages/safe-bash/dist/commands/archive/zip/safety.d.ts +28 -0
- package/packages/safe-bash/dist/commands/archive/zip/safety.d.ts.map +1 -0
- package/packages/safe-bash/dist/commands/archive/zip/safety.js +228 -0
- package/packages/safe-bash/dist/commands/archive/zip/safety.js.map +1 -0
- package/packages/safe-bash/dist/commands/archive/zip-format.d.ts +39 -0
- package/packages/safe-bash/dist/commands/archive/zip-format.d.ts.map +1 -0
- package/packages/safe-bash/dist/commands/archive/zip-format.js +509 -0
- package/packages/safe-bash/dist/commands/archive/zip-format.js.map +1 -0
- package/packages/safe-bash/dist/commands/archive/zip.d.ts +4 -0
- package/packages/safe-bash/dist/commands/archive/zip.d.ts.map +1 -0
- package/packages/safe-bash/dist/commands/archive/zip.js +290 -0
- package/packages/safe-bash/dist/commands/archive/zip.js.map +1 -0
- package/packages/safe-bash/dist/commands/bytes/compression/codec.d.ts +1 -1
- package/packages/safe-bash/dist/commands/bytes/compression/codec.d.ts.map +1 -1
- package/packages/safe-bash/dist/commands/bytes/compression/codec.js +2 -2
- package/packages/safe-bash/dist/commands/bytes/compression/codec.js.map +1 -1
- package/packages/safe-bash/dist/core.browser.js +1937 -389
- package/packages/safe-bash/dist/core.browser.js.map +4 -4
- package/packages/safe-bash/dist/shell/runtime.d.ts +1 -0
- package/packages/safe-bash/dist/shell/runtime.d.ts.map +1 -1
- package/packages/safe-bash/dist/shell/runtime.js +4 -1
- package/packages/safe-bash/dist/shell/runtime.js.map +1 -1
- package/packages/safe-fs/dist/core.d.ts +2 -1
- package/packages/safe-fs/dist/fs/scoped.d.ts +12 -2
- package/packages/safe-fs/dist/index.d.ts +2 -1
- package/packages/safe-js/dist/browser/chunks/{chunk-GQOAEEHU.js → chunk-3EJ7BQOJ.js} +89 -5
- package/packages/safe-js/dist/browser/chunks/{chunk-GQOAEEHU.js.map → chunk-3EJ7BQOJ.js.map} +3 -3
- package/packages/safe-js/dist/browser/safe-fs-core.js +3 -1
- package/packages/safe-js/dist/browser/safe-fs.js +3 -1
- package/packages/safe-js/dist/chunks/{chunk-DIISVPWF.js → chunk-742TUUOL.js} +89 -5
- package/packages/safe-js/dist/chunks/{chunk-DIISVPWF.js.map → chunk-742TUUOL.js.map} +3 -3
- package/packages/safe-js/dist/chunks/{chunk-L6LDJNBY.js → chunk-NMX3FJ3X.js} +3 -3
- package/packages/safe-js/dist/chunks/{chunk-CAWKMCKD.js → chunk-UVHJFEFO.js} +2 -2
- package/packages/safe-js/dist/cli.js +3 -3
- package/packages/safe-js/dist/index.js +3 -3
- package/packages/safe-js/dist/safe-fs-core.js +3 -1
- package/packages/safe-js/dist/safe-fs-core.js.map +1 -1
- package/packages/safe-js/dist/safe-fs-node.js +4 -2
- package/packages/safe-js/dist/safe-fs.js +4 -2
- /package/packages/safe-js/dist/chunks/{chunk-L6LDJNBY.js.map → chunk-NMX3FJ3X.js.map} +0 -0
- /package/packages/safe-js/dist/chunks/{chunk-CAWKMCKD.js.map → chunk-UVHJFEFO.js.map} +0 -0
|
@@ -34,12 +34,13 @@ import {
|
|
|
34
34
|
readBytes,
|
|
35
35
|
relativePath,
|
|
36
36
|
resolvePath,
|
|
37
|
+
retainFileSystemCleanup,
|
|
37
38
|
scopeFileSystem,
|
|
38
39
|
toByteSource,
|
|
39
40
|
toFsError,
|
|
40
41
|
validatePath,
|
|
41
42
|
withFileSystemQuota
|
|
42
|
-
} from "./chunks/chunk-
|
|
43
|
+
} from "./chunks/chunk-3EJ7BQOJ.js";
|
|
43
44
|
export {
|
|
44
45
|
ACCESS_MODES,
|
|
45
46
|
DeviceFileSystem,
|
|
@@ -76,6 +77,7 @@ export {
|
|
|
76
77
|
readBytes,
|
|
77
78
|
relativePath,
|
|
78
79
|
resolvePath,
|
|
80
|
+
retainFileSystemCleanup,
|
|
79
81
|
scopeFileSystem,
|
|
80
82
|
toByteSource,
|
|
81
83
|
toFsError,
|
|
@@ -34,12 +34,13 @@ import {
|
|
|
34
34
|
readBytes,
|
|
35
35
|
relativePath,
|
|
36
36
|
resolvePath,
|
|
37
|
+
retainFileSystemCleanup,
|
|
37
38
|
scopeFileSystem,
|
|
38
39
|
toByteSource,
|
|
39
40
|
toFsError,
|
|
40
41
|
validatePath,
|
|
41
42
|
withFileSystemQuota
|
|
42
|
-
} from "./chunks/chunk-
|
|
43
|
+
} from "./chunks/chunk-3EJ7BQOJ.js";
|
|
43
44
|
export {
|
|
44
45
|
ACCESS_MODES,
|
|
45
46
|
DeviceFileSystem,
|
|
@@ -76,6 +77,7 @@ export {
|
|
|
76
77
|
readBytes,
|
|
77
78
|
relativePath,
|
|
78
79
|
resolvePath,
|
|
80
|
+
retainFileSystemCleanup,
|
|
79
81
|
scopeFileSystem,
|
|
80
82
|
toByteSource,
|
|
81
83
|
toFsError,
|
|
@@ -6150,8 +6150,8 @@ var operations = /* @__PURE__ */ new Set([
|
|
|
6150
6150
|
"writeFile",
|
|
6151
6151
|
"writeStream"
|
|
6152
6152
|
]);
|
|
6153
|
-
function scopeFileSystem(filesystem, charge, signal) {
|
|
6154
|
-
const original = originals.get(filesystem) ?? filesystem;
|
|
6153
|
+
function scopeFileSystem(filesystem, charge, signal, cleanupCharge = charge) {
|
|
6154
|
+
const original = originals.get(filesystem)?.filesystem ?? filesystem;
|
|
6155
6155
|
const methods = /* @__PURE__ */ new Map();
|
|
6156
6156
|
const assertOpen = (options) => {
|
|
6157
6157
|
signal.throwIfAborted();
|
|
@@ -6304,7 +6304,7 @@ function scopeFileSystem(filesystem, charge, signal) {
|
|
|
6304
6304
|
}
|
|
6305
6305
|
if (property === "compareEntry") {
|
|
6306
6306
|
const peer = args[1];
|
|
6307
|
-
args[1] = originals.get(peer) ?? peer;
|
|
6307
|
+
args[1] = originals.get(peer)?.filesystem ?? peer;
|
|
6308
6308
|
}
|
|
6309
6309
|
if (property === "rename" && args[2]?.noReplace) return (async () => {
|
|
6310
6310
|
const options = args[2];
|
|
@@ -6328,13 +6328,96 @@ function scopeFileSystem(filesystem, charge, signal) {
|
|
|
6328
6328
|
return scoped;
|
|
6329
6329
|
}
|
|
6330
6330
|
});
|
|
6331
|
-
originals.set(view, original);
|
|
6331
|
+
originals.set(view, { filesystem: original, signal, cleanupCharge });
|
|
6332
6332
|
registerEntryView(view, async (path, options) => {
|
|
6333
6333
|
assertOpen(options);
|
|
6334
6334
|
return { filesystem: original, path };
|
|
6335
6335
|
});
|
|
6336
6336
|
return view;
|
|
6337
6337
|
}
|
|
6338
|
+
function retainFileSystemCleanup(filesystem, cleanupCallback, options) {
|
|
6339
|
+
const maximum = options?.maxOperations === void 0 ? 256 : options.maxOperations;
|
|
6340
|
+
if (!Number.isSafeInteger(maximum) || maximum < 0 || maximum > 4096) throw new RangeError("cleanup maxOperations must be an integer between 0 and 4096");
|
|
6341
|
+
if (typeof cleanupCallback !== "function") throw new TypeError("cleanup callback must be a function");
|
|
6342
|
+
const scope = originals.get(filesystem);
|
|
6343
|
+
scope?.signal.throwIfAborted();
|
|
6344
|
+
const backing = scope?.filesystem ?? filesystem;
|
|
6345
|
+
const pending = /* @__PURE__ */ new Set();
|
|
6346
|
+
let operations2 = 0;
|
|
6347
|
+
let active = false;
|
|
6348
|
+
let closing;
|
|
6349
|
+
const invoke = (method, path, settings) => {
|
|
6350
|
+
if (!active) {
|
|
6351
|
+
const rejected = Promise.reject(new FsError("EBADF", { syscall: method, path, message: "cleanup callback is not active" }));
|
|
6352
|
+
void rejected.catch(() => {
|
|
6353
|
+
});
|
|
6354
|
+
return rejected;
|
|
6355
|
+
}
|
|
6356
|
+
let result;
|
|
6357
|
+
try {
|
|
6358
|
+
settings?.signal?.throwIfAborted();
|
|
6359
|
+
if (operations2 >= maximum) throw new FsError("EFBIG", { syscall: method, path, message: "cleanup operation limit exceeded" });
|
|
6360
|
+
operations2++;
|
|
6361
|
+
scope?.cleanupCharge();
|
|
6362
|
+
settings?.signal?.throwIfAborted();
|
|
6363
|
+
const operation = backing[method];
|
|
6364
|
+
if (typeof operation !== "function") throw new FsError("ENOTSUP", { syscall: method, path });
|
|
6365
|
+
const parameters = method === "rm" ? { ...settings, recursive: false, force: false } : settings;
|
|
6366
|
+
result = Promise.resolve(Reflect.apply(operation, backing, [path, parameters]));
|
|
6367
|
+
} catch (error) {
|
|
6368
|
+
result = Promise.reject(error);
|
|
6369
|
+
void result.catch(() => {
|
|
6370
|
+
});
|
|
6371
|
+
return result;
|
|
6372
|
+
}
|
|
6373
|
+
const completion = result.then(
|
|
6374
|
+
() => {
|
|
6375
|
+
pending.delete(completion);
|
|
6376
|
+
return { status: "fulfilled", value: void 0 };
|
|
6377
|
+
},
|
|
6378
|
+
(error) => {
|
|
6379
|
+
pending.delete(completion);
|
|
6380
|
+
return { status: "rejected", reason: error };
|
|
6381
|
+
}
|
|
6382
|
+
);
|
|
6383
|
+
pending.add(completion);
|
|
6384
|
+
return result;
|
|
6385
|
+
};
|
|
6386
|
+
const view = Object.freeze(Object.assign(/* @__PURE__ */ Object.create(null), {
|
|
6387
|
+
lstat: invoke.bind(void 0, "lstat"),
|
|
6388
|
+
realpath: invoke.bind(void 0, "realpath"),
|
|
6389
|
+
rm: invoke.bind(void 0, "rm"),
|
|
6390
|
+
...typeof backing.rmdir === "function" ? { rmdir: invoke.bind(void 0, "rmdir") } : {}
|
|
6391
|
+
}));
|
|
6392
|
+
scope?.signal.throwIfAborted();
|
|
6393
|
+
return () => {
|
|
6394
|
+
if (!closing) {
|
|
6395
|
+
closing = Promise.resolve().then(async () => {
|
|
6396
|
+
active = true;
|
|
6397
|
+
let callbackFailed = false;
|
|
6398
|
+
let callbackFailure;
|
|
6399
|
+
try {
|
|
6400
|
+
const result = cleanupCallback(view);
|
|
6401
|
+
if (result !== void 0) await result;
|
|
6402
|
+
} catch (error) {
|
|
6403
|
+
callbackFailed = true;
|
|
6404
|
+
callbackFailure = error;
|
|
6405
|
+
} finally {
|
|
6406
|
+
active = false;
|
|
6407
|
+
}
|
|
6408
|
+
const outcomes = await Promise.all(pending);
|
|
6409
|
+
if (callbackFailed) throw callbackFailure;
|
|
6410
|
+
const failures = [];
|
|
6411
|
+
for (const outcome of outcomes) if (outcome.status === "rejected") failures.push(outcome.reason);
|
|
6412
|
+
if (failures.length === 1) throw failures[0];
|
|
6413
|
+
if (failures.length > 1) throw new AggregateError(failures, "retained filesystem cleanup failed");
|
|
6414
|
+
});
|
|
6415
|
+
void closing.catch(() => {
|
|
6416
|
+
});
|
|
6417
|
+
}
|
|
6418
|
+
return closing;
|
|
6419
|
+
};
|
|
6420
|
+
}
|
|
6338
6421
|
|
|
6339
6422
|
// packages/safe-fs/src/bridge/stats.ts
|
|
6340
6423
|
function predicates(type) {
|
|
@@ -6973,6 +7056,7 @@ export {
|
|
|
6973
7056
|
FileSystemQuotaError,
|
|
6974
7057
|
withFileSystemQuota,
|
|
6975
7058
|
scopeFileSystem,
|
|
7059
|
+
retainFileSystemCleanup,
|
|
6976
7060
|
FileSystemBridge
|
|
6977
7061
|
};
|
|
6978
|
-
//# sourceMappingURL=chunk-
|
|
7062
|
+
//# sourceMappingURL=chunk-742TUUOL.js.map
|