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
|
@@ -9,7 +9,8 @@ export * from "./fs/readonly/index.js";
|
|
|
9
9
|
export * from "./fs/mount/index.js";
|
|
10
10
|
export * from "./fs/overlay/index.js";
|
|
11
11
|
export * from "./fs/quota/index.js";
|
|
12
|
-
export { scopeFileSystem } from "./fs/scoped.js";
|
|
12
|
+
export { scopeFileSystem, retainFileSystemCleanup } from "./fs/scoped.js";
|
|
13
|
+
export type { RetainedFileSystemCleanupView, RetainedFileSystemCleanupOptions } from "./fs/scoped.js";
|
|
13
14
|
export * from "./fs/webdav/index.js";
|
|
14
15
|
export * from "./bridge/index.js";
|
|
15
16
|
export { compareEntries } from "./fs/mount/comparison.js";
|
|
@@ -1,2 +1,12 @@
|
|
|
1
|
-
import type { FileSystem } from "../contracts/filesystem.js";
|
|
2
|
-
export declare function scopeFileSystem(filesystem: FileSystem, charge: () => void, signal: AbortSignal): FileSystem;
|
|
1
|
+
import type { FileSystem, FsOptions } from "../contracts/filesystem.js";
|
|
2
|
+
export declare function scopeFileSystem(filesystem: FileSystem, charge: () => void, signal: AbortSignal, cleanupCharge?: () => void): FileSystem;
|
|
3
|
+
export interface RetainedFileSystemCleanupView {
|
|
4
|
+
readonly lstat: FileSystem["lstat"];
|
|
5
|
+
readonly realpath: FileSystem["realpath"];
|
|
6
|
+
readonly rm: (path: string, options?: FsOptions) => Promise<void>;
|
|
7
|
+
readonly rmdir?: NonNullable<FileSystem["rmdir"]>;
|
|
8
|
+
}
|
|
9
|
+
export interface RetainedFileSystemCleanupOptions {
|
|
10
|
+
readonly maxOperations?: number;
|
|
11
|
+
}
|
|
12
|
+
export declare function retainFileSystemCleanup(filesystem: FileSystem, cleanupCallback: (view: RetainedFileSystemCleanupView) => void | PromiseLike<void>, options?: RetainedFileSystemCleanupOptions): () => Promise<void>;
|
|
@@ -10,7 +10,8 @@ export * from "./fs/readonly/index.js";
|
|
|
10
10
|
export * from "./fs/mount/index.js";
|
|
11
11
|
export * from "./fs/overlay/index.js";
|
|
12
12
|
export * from "./fs/quota/index.js";
|
|
13
|
-
export { scopeFileSystem } from "./fs/scoped.js";
|
|
13
|
+
export { scopeFileSystem, retainFileSystemCleanup } from "./fs/scoped.js";
|
|
14
|
+
export type { RetainedFileSystemCleanupView, RetainedFileSystemCleanupOptions } from "./fs/scoped.js";
|
|
14
15
|
export * from "./node/index.js";
|
|
15
16
|
export { createFileSystem, readConfigRecord, validateFileSystemConfig } from "./config.js";
|
|
16
17
|
export type { FileSystemConfig, FileSystemAdapterDescriptor, FileSystemAdapterRegistry } from "./config.js";
|
|
@@ -4496,8 +4496,8 @@ var operations = /* @__PURE__ */ new Set([
|
|
|
4496
4496
|
"writeFile",
|
|
4497
4497
|
"writeStream"
|
|
4498
4498
|
]);
|
|
4499
|
-
function scopeFileSystem(filesystem, charge, signal) {
|
|
4500
|
-
const original = originals.get(filesystem) ?? filesystem;
|
|
4499
|
+
function scopeFileSystem(filesystem, charge, signal, cleanupCharge = charge) {
|
|
4500
|
+
const original = originals.get(filesystem)?.filesystem ?? filesystem;
|
|
4501
4501
|
const methods = /* @__PURE__ */ new Map();
|
|
4502
4502
|
const assertOpen = (options) => {
|
|
4503
4503
|
signal.throwIfAborted();
|
|
@@ -4650,7 +4650,7 @@ function scopeFileSystem(filesystem, charge, signal) {
|
|
|
4650
4650
|
}
|
|
4651
4651
|
if (property === "compareEntry") {
|
|
4652
4652
|
const peer = args[1];
|
|
4653
|
-
args[1] = originals.get(peer) ?? peer;
|
|
4653
|
+
args[1] = originals.get(peer)?.filesystem ?? peer;
|
|
4654
4654
|
}
|
|
4655
4655
|
if (property === "rename" && args[2]?.noReplace) return (async () => {
|
|
4656
4656
|
const options = args[2];
|
|
@@ -4674,13 +4674,96 @@ function scopeFileSystem(filesystem, charge, signal) {
|
|
|
4674
4674
|
return scoped;
|
|
4675
4675
|
}
|
|
4676
4676
|
});
|
|
4677
|
-
originals.set(view, original);
|
|
4677
|
+
originals.set(view, { filesystem: original, signal, cleanupCharge });
|
|
4678
4678
|
registerEntryView(view, async (path, options) => {
|
|
4679
4679
|
assertOpen(options);
|
|
4680
4680
|
return { filesystem: original, path };
|
|
4681
4681
|
});
|
|
4682
4682
|
return view;
|
|
4683
4683
|
}
|
|
4684
|
+
function retainFileSystemCleanup(filesystem, cleanupCallback, options) {
|
|
4685
|
+
const maximum = options?.maxOperations === void 0 ? 256 : options.maxOperations;
|
|
4686
|
+
if (!Number.isSafeInteger(maximum) || maximum < 0 || maximum > 4096) throw new RangeError("cleanup maxOperations must be an integer between 0 and 4096");
|
|
4687
|
+
if (typeof cleanupCallback !== "function") throw new TypeError("cleanup callback must be a function");
|
|
4688
|
+
const scope = originals.get(filesystem);
|
|
4689
|
+
scope?.signal.throwIfAborted();
|
|
4690
|
+
const backing = scope?.filesystem ?? filesystem;
|
|
4691
|
+
const pending = /* @__PURE__ */ new Set();
|
|
4692
|
+
let operations2 = 0;
|
|
4693
|
+
let active = false;
|
|
4694
|
+
let closing;
|
|
4695
|
+
const invoke = (method, path, settings) => {
|
|
4696
|
+
if (!active) {
|
|
4697
|
+
const rejected = Promise.reject(new FsError("EBADF", { syscall: method, path, message: "cleanup callback is not active" }));
|
|
4698
|
+
void rejected.catch(() => {
|
|
4699
|
+
});
|
|
4700
|
+
return rejected;
|
|
4701
|
+
}
|
|
4702
|
+
let result;
|
|
4703
|
+
try {
|
|
4704
|
+
settings?.signal?.throwIfAborted();
|
|
4705
|
+
if (operations2 >= maximum) throw new FsError("EFBIG", { syscall: method, path, message: "cleanup operation limit exceeded" });
|
|
4706
|
+
operations2++;
|
|
4707
|
+
scope?.cleanupCharge();
|
|
4708
|
+
settings?.signal?.throwIfAborted();
|
|
4709
|
+
const operation = backing[method];
|
|
4710
|
+
if (typeof operation !== "function") throw new FsError("ENOTSUP", { syscall: method, path });
|
|
4711
|
+
const parameters = method === "rm" ? { ...settings, recursive: false, force: false } : settings;
|
|
4712
|
+
result = Promise.resolve(Reflect.apply(operation, backing, [path, parameters]));
|
|
4713
|
+
} catch (error) {
|
|
4714
|
+
result = Promise.reject(error);
|
|
4715
|
+
void result.catch(() => {
|
|
4716
|
+
});
|
|
4717
|
+
return result;
|
|
4718
|
+
}
|
|
4719
|
+
const completion = result.then(
|
|
4720
|
+
() => {
|
|
4721
|
+
pending.delete(completion);
|
|
4722
|
+
return { status: "fulfilled", value: void 0 };
|
|
4723
|
+
},
|
|
4724
|
+
(error) => {
|
|
4725
|
+
pending.delete(completion);
|
|
4726
|
+
return { status: "rejected", reason: error };
|
|
4727
|
+
}
|
|
4728
|
+
);
|
|
4729
|
+
pending.add(completion);
|
|
4730
|
+
return result;
|
|
4731
|
+
};
|
|
4732
|
+
const view = Object.freeze(Object.assign(/* @__PURE__ */ Object.create(null), {
|
|
4733
|
+
lstat: invoke.bind(void 0, "lstat"),
|
|
4734
|
+
realpath: invoke.bind(void 0, "realpath"),
|
|
4735
|
+
rm: invoke.bind(void 0, "rm"),
|
|
4736
|
+
...typeof backing.rmdir === "function" ? { rmdir: invoke.bind(void 0, "rmdir") } : {}
|
|
4737
|
+
}));
|
|
4738
|
+
scope?.signal.throwIfAborted();
|
|
4739
|
+
return () => {
|
|
4740
|
+
if (!closing) {
|
|
4741
|
+
closing = Promise.resolve().then(async () => {
|
|
4742
|
+
active = true;
|
|
4743
|
+
let callbackFailed = false;
|
|
4744
|
+
let callbackFailure;
|
|
4745
|
+
try {
|
|
4746
|
+
const result = cleanupCallback(view);
|
|
4747
|
+
if (result !== void 0) await result;
|
|
4748
|
+
} catch (error) {
|
|
4749
|
+
callbackFailed = true;
|
|
4750
|
+
callbackFailure = error;
|
|
4751
|
+
} finally {
|
|
4752
|
+
active = false;
|
|
4753
|
+
}
|
|
4754
|
+
const outcomes = await Promise.all(pending);
|
|
4755
|
+
if (callbackFailed) throw callbackFailure;
|
|
4756
|
+
const failures = [];
|
|
4757
|
+
for (const outcome of outcomes) if (outcome.status === "rejected") failures.push(outcome.reason);
|
|
4758
|
+
if (failures.length === 1) throw failures[0];
|
|
4759
|
+
if (failures.length > 1) throw new AggregateError(failures, "retained filesystem cleanup failed");
|
|
4760
|
+
});
|
|
4761
|
+
void closing.catch(() => {
|
|
4762
|
+
});
|
|
4763
|
+
}
|
|
4764
|
+
return closing;
|
|
4765
|
+
};
|
|
4766
|
+
}
|
|
4684
4767
|
|
|
4685
4768
|
// packages/safe-fs/src/contracts/abort.ts
|
|
4686
4769
|
function composeAbortSignals(signals) {
|
|
@@ -6951,10 +7034,11 @@ export {
|
|
|
6951
7034
|
FileSystemQuotaError,
|
|
6952
7035
|
withFileSystemQuota,
|
|
6953
7036
|
scopeFileSystem,
|
|
7037
|
+
retainFileSystemCleanup,
|
|
6954
7038
|
XmlLimitError,
|
|
6955
7039
|
parseXmlSteps,
|
|
6956
7040
|
parseXml,
|
|
6957
7041
|
WebDavFileSystem,
|
|
6958
7042
|
createFsBridge
|
|
6959
7043
|
};
|
|
6960
|
-
//# sourceMappingURL=chunk-
|
|
7044
|
+
//# sourceMappingURL=chunk-3EJ7BQOJ.js.map
|