poe-code 14.0.94 → 14.0.95
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/apply-patch/apply.d.ts.map +1 -1
- package/packages/safe-bash/dist/commands/apply-patch/apply.js +5 -2
- package/packages/safe-bash/dist/commands/apply-patch/apply.js.map +1 -1
- package/packages/safe-bash/dist/commands/archive/extract.d.ts.map +1 -1
- package/packages/safe-bash/dist/commands/archive/extract.js +5 -2
- package/packages/safe-bash/dist/commands/archive/extract.js.map +1 -1
- package/packages/safe-bash/dist/commands/archive/internal.d.ts.map +1 -1
- package/packages/safe-bash/dist/commands/archive/internal.js +6 -2
- package/packages/safe-bash/dist/commands/archive/internal.js.map +1 -1
- package/packages/safe-bash/dist/commands/bytes/compression/files.d.ts.map +1 -1
- package/packages/safe-bash/dist/commands/bytes/compression/files.js +10 -6
- package/packages/safe-bash/dist/commands/bytes/compression/files.js.map +1 -1
- package/packages/safe-bash/dist/commands/diff-patch/diff.d.ts.map +1 -1
- package/packages/safe-bash/dist/commands/diff-patch/diff.js +4 -3
- package/packages/safe-bash/dist/commands/diff-patch/diff.js.map +1 -1
- package/packages/safe-bash/dist/commands/diff-patch/shared.d.ts.map +1 -1
- package/packages/safe-bash/dist/commands/diff-patch/shared.js +5 -3
- package/packages/safe-bash/dist/commands/diff-patch/shared.js.map +1 -1
- package/packages/safe-bash/dist/commands/du/du.d.ts.map +1 -1
- package/packages/safe-bash/dist/commands/du/du.js +6 -6
- package/packages/safe-bash/dist/commands/du/du.js.map +1 -1
- package/packages/safe-bash/dist/commands/file/index.d.ts.map +1 -1
- package/packages/safe-bash/dist/commands/file/index.js +9 -3
- package/packages/safe-bash/dist/commands/file/index.js.map +1 -1
- package/packages/safe-bash/dist/commands/filesystem.d.ts.map +1 -1
- package/packages/safe-bash/dist/commands/filesystem.js +25 -9
- package/packages/safe-bash/dist/commands/filesystem.js.map +1 -1
- package/packages/safe-bash/dist/commands/find.js +1 -1
- package/packages/safe-bash/dist/commands/find.js.map +1 -1
- package/packages/safe-bash/dist/commands/html-to-markdown/input.d.ts.map +1 -1
- package/packages/safe-bash/dist/commands/html-to-markdown/input.js +12 -18
- package/packages/safe-bash/dist/commands/html-to-markdown/input.js.map +1 -1
- package/packages/safe-bash/dist/commands/internal.d.ts +1 -1
- package/packages/safe-bash/dist/commands/internal.d.ts.map +1 -1
- package/packages/safe-bash/dist/commands/internal.js +3 -2
- package/packages/safe-bash/dist/commands/internal.js.map +1 -1
- package/packages/safe-bash/dist/commands/metadata/internal.d.ts +2 -2
- package/packages/safe-bash/dist/commands/metadata/internal.d.ts.map +1 -1
- package/packages/safe-bash/dist/commands/metadata/internal.js +1 -1
- package/packages/safe-bash/dist/commands/metadata/internal.js.map +1 -1
- package/packages/safe-bash/dist/commands/metadata/mktemp.d.ts.map +1 -1
- package/packages/safe-bash/dist/commands/metadata/mktemp.js +5 -2
- package/packages/safe-bash/dist/commands/metadata/mktemp.js.map +1 -1
- package/packages/safe-bash/dist/commands/metadata/stat.js +1 -1
- package/packages/safe-bash/dist/commands/metadata/stat.js.map +1 -1
- package/packages/safe-bash/dist/commands/move.d.ts.map +1 -1
- package/packages/safe-bash/dist/commands/move.js +3 -2
- package/packages/safe-bash/dist/commands/move.js.map +1 -1
- package/packages/safe-bash/dist/commands/network/body.d.ts.map +1 -1
- package/packages/safe-bash/dist/commands/network/body.js +3 -1
- package/packages/safe-bash/dist/commands/network/body.js.map +1 -1
- package/packages/safe-bash/dist/commands/predicates.d.ts.map +1 -1
- package/packages/safe-bash/dist/commands/predicates.js +8 -2
- package/packages/safe-bash/dist/commands/predicates.js.map +1 -1
- package/packages/safe-bash/dist/commands/safejs/index.d.ts.map +1 -1
- package/packages/safe-bash/dist/commands/safejs/index.js +2 -1
- package/packages/safe-bash/dist/commands/safejs/index.js.map +1 -1
- package/packages/safe-bash/dist/commands/split/io.d.ts.map +1 -1
- package/packages/safe-bash/dist/commands/split/io.js +2 -1
- package/packages/safe-bash/dist/commands/split/io.js.map +1 -1
- package/packages/safe-bash/dist/commands/split/split.d.ts.map +1 -1
- package/packages/safe-bash/dist/commands/split/split.js +2 -1
- package/packages/safe-bash/dist/commands/split/split.js.map +1 -1
- package/packages/safe-bash/dist/commands/stream-format/shared.d.ts.map +1 -1
- package/packages/safe-bash/dist/commands/stream-format/shared.js +7 -4
- package/packages/safe-bash/dist/commands/stream-format/shared.js.map +1 -1
- package/packages/safe-bash/dist/commands/stream-inspection/shared.d.ts.map +1 -1
- package/packages/safe-bash/dist/commands/stream-inspection/shared.js +7 -4
- package/packages/safe-bash/dist/commands/stream-inspection/shared.js.map +1 -1
- package/packages/safe-bash/dist/commands/streams.d.ts.map +1 -1
- package/packages/safe-bash/dist/commands/streams.js +4 -2
- package/packages/safe-bash/dist/commands/streams.js.map +1 -1
- package/packages/safe-bash/dist/commands/structured/jq.d.ts.map +1 -1
- package/packages/safe-bash/dist/commands/structured/jq.js +15 -5
- package/packages/safe-bash/dist/commands/structured/jq.js.map +1 -1
- package/packages/safe-bash/dist/commands/table-text/internal.d.ts.map +1 -1
- package/packages/safe-bash/dist/commands/table-text/internal.js +5 -4
- package/packages/safe-bash/dist/commands/table-text/internal.js.map +1 -1
- package/packages/safe-bash/dist/commands/text-programs/awk-runtime.d.ts.map +1 -1
- package/packages/safe-bash/dist/commands/text-programs/awk-runtime.js +10 -4
- package/packages/safe-bash/dist/commands/text-programs/awk-runtime.js.map +1 -1
- package/packages/safe-bash/dist/commands/text.d.ts.map +1 -1
- package/packages/safe-bash/dist/commands/text.js +3 -2
- package/packages/safe-bash/dist/commands/text.js.map +1 -1
- package/packages/safe-bash/dist/commands/time-env/date.d.ts.map +1 -1
- package/packages/safe-bash/dist/commands/time-env/date.js +3 -2
- package/packages/safe-bash/dist/commands/time-env/date.js.map +1 -1
- package/packages/safe-bash/dist/commands/tree/tree.d.ts.map +1 -1
- package/packages/safe-bash/dist/commands/tree/tree.js +2 -1
- package/packages/safe-bash/dist/commands/tree/tree.js.map +1 -1
- package/packages/safe-bash/dist/core.browser.js +226 -118
- package/packages/safe-bash/dist/core.browser.js.map +4 -4
- package/packages/safe-bash/dist/shell/conditional.d.ts.map +1 -1
- package/packages/safe-bash/dist/shell/conditional.js +10 -6
- package/packages/safe-bash/dist/shell/conditional.js.map +1 -1
- package/packages/safe-bash/dist/shell/input.d.ts +1 -1
- package/packages/safe-bash/dist/shell/input.d.ts.map +1 -1
- package/packages/safe-bash/dist/shell/input.js +7 -3
- package/packages/safe-bash/dist/shell/input.js.map +1 -1
- package/packages/safe-bash/dist/shell/runtime.d.ts +2 -1
- package/packages/safe-bash/dist/shell/runtime.d.ts.map +1 -1
- package/packages/safe-bash/dist/shell/runtime.js +37 -28
- package/packages/safe-bash/dist/shell/runtime.js.map +1 -1
- package/packages/safe-bash/dist/shell/shell.d.ts.map +1 -1
- package/packages/safe-bash/dist/shell/shell.js +3 -1
- package/packages/safe-bash/dist/shell/shell.js.map +1 -1
- package/packages/safe-fs/dist/contracts/filesystem.d.ts +1 -1
- package/packages/safe-fs/dist/core.d.ts +1 -0
- package/packages/safe-fs/dist/fs/devices/index.d.ts +33 -0
- package/packages/safe-fs/dist/fs/devices/path.d.ts +5 -0
- package/packages/safe-fs/dist/fs/devices/stream.d.ts +5 -0
- package/packages/safe-fs/dist/index.d.ts +1 -0
- package/packages/safe-js/dist/browser/chunks/{chunk-I3HSJDAA.js → chunk-YJ7IIV57.js} +567 -3
- package/packages/safe-js/dist/browser/chunks/chunk-YJ7IIV57.js.map +7 -0
- package/packages/safe-js/dist/browser/safe-fs-core.js +5 -1
- package/packages/safe-js/dist/browser/safe-fs.js +5 -1
- package/packages/safe-js/dist/chunks/{chunk-CQZRYT3K.js → chunk-3HQSRMV6.js} +567 -3
- package/packages/safe-js/dist/chunks/chunk-3HQSRMV6.js.map +7 -0
- package/packages/safe-js/dist/chunks/{chunk-66PPRTEP.js → chunk-5JIIALYB.js} +2 -2
- package/packages/safe-js/dist/chunks/{chunk-PZSJ52ZO.js → chunk-NZIVWYYY.js} +3 -3
- 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 +5 -1
- package/packages/safe-js/dist/safe-fs-core.js.map +1 -1
- package/packages/safe-js/dist/safe-fs-node.js +6 -2
- package/packages/safe-js/dist/safe-fs.js +6 -2
- package/packages/safe-js/dist/browser/chunks/chunk-I3HSJDAA.js.map +0 -7
- package/packages/safe-js/dist/chunks/chunk-CQZRYT3K.js.map +0 -7
- /package/packages/safe-js/dist/chunks/{chunk-66PPRTEP.js.map → chunk-5JIIALYB.js.map} +0 -0
- /package/packages/safe-js/dist/chunks/{chunk-PZSJ52ZO.js.map → chunk-NZIVWYYY.js.map} +0 -0
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ACCESS_MODES,
|
|
3
|
+
DeviceFileSystem,
|
|
3
4
|
FileSystemQuotaError,
|
|
4
5
|
FsError,
|
|
5
6
|
MemoryFileSystem,
|
|
@@ -11,6 +12,7 @@ import {
|
|
|
11
12
|
basename,
|
|
12
13
|
collectBytes,
|
|
13
14
|
compareEntries,
|
|
15
|
+
createDeviceFileSystem,
|
|
14
16
|
createFsBridge,
|
|
15
17
|
createMemoryFileSystem,
|
|
16
18
|
createMountFileSystem,
|
|
@@ -34,9 +36,10 @@ import {
|
|
|
34
36
|
toFsError,
|
|
35
37
|
validatePath,
|
|
36
38
|
withFileSystemQuota
|
|
37
|
-
} from "./chunks/chunk-
|
|
39
|
+
} from "./chunks/chunk-YJ7IIV57.js";
|
|
38
40
|
export {
|
|
39
41
|
ACCESS_MODES,
|
|
42
|
+
DeviceFileSystem,
|
|
40
43
|
FileSystemQuotaError,
|
|
41
44
|
FsError,
|
|
42
45
|
MemoryFileSystem,
|
|
@@ -48,6 +51,7 @@ export {
|
|
|
48
51
|
basename,
|
|
49
52
|
collectBytes,
|
|
50
53
|
compareEntries,
|
|
54
|
+
createDeviceFileSystem,
|
|
51
55
|
createFsBridge,
|
|
52
56
|
createMemoryFileSystem,
|
|
53
57
|
createMountFileSystem,
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ACCESS_MODES,
|
|
3
|
+
DeviceFileSystem,
|
|
3
4
|
FileSystemQuotaError,
|
|
4
5
|
FsError,
|
|
5
6
|
MemoryFileSystem,
|
|
@@ -11,6 +12,7 @@ import {
|
|
|
11
12
|
basename,
|
|
12
13
|
collectBytes,
|
|
13
14
|
compareEntries,
|
|
15
|
+
createDeviceFileSystem,
|
|
14
16
|
createFsBridge,
|
|
15
17
|
createMemoryFileSystem,
|
|
16
18
|
createMountFileSystem,
|
|
@@ -34,9 +36,10 @@ import {
|
|
|
34
36
|
toFsError,
|
|
35
37
|
validatePath,
|
|
36
38
|
withFileSystemQuota
|
|
37
|
-
} from "./chunks/chunk-
|
|
39
|
+
} from "./chunks/chunk-YJ7IIV57.js";
|
|
38
40
|
export {
|
|
39
41
|
ACCESS_MODES,
|
|
42
|
+
DeviceFileSystem,
|
|
40
43
|
FileSystemQuotaError,
|
|
41
44
|
FsError,
|
|
42
45
|
MemoryFileSystem,
|
|
@@ -48,6 +51,7 @@ export {
|
|
|
48
51
|
basename,
|
|
49
52
|
collectBytes,
|
|
50
53
|
compareEntries,
|
|
54
|
+
createDeviceFileSystem,
|
|
51
55
|
createFsBridge,
|
|
52
56
|
createMemoryFileSystem,
|
|
53
57
|
createMountFileSystem,
|
|
@@ -1521,6 +1521,568 @@ function createMemoryFileSystem(options = {}) {
|
|
|
1521
1521
|
return new MemoryFileSystem(normalizeMemoryFileSystemLimits(options));
|
|
1522
1522
|
}
|
|
1523
1523
|
|
|
1524
|
+
// packages/safe-fs/src/fs/devices/path.ts
|
|
1525
|
+
var nullPath = "/dev/null";
|
|
1526
|
+
var deviceDirectory = "/dev";
|
|
1527
|
+
function lexicalDevicePath(path) {
|
|
1528
|
+
validatePath(path);
|
|
1529
|
+
const parts = [];
|
|
1530
|
+
for (const component of path.split("/")) {
|
|
1531
|
+
if (`/${parts.join("/")}` === nullPath) throw new FsError("ENOTDIR", { path });
|
|
1532
|
+
if (component === "..") parts.pop();
|
|
1533
|
+
else if (component && component !== ".") parts.push(component);
|
|
1534
|
+
}
|
|
1535
|
+
return `/${parts.join("/")}`;
|
|
1536
|
+
}
|
|
1537
|
+
async function resolveDevicePath(filesystem, path, options, followFinal = true) {
|
|
1538
|
+
options.signal?.throwIfAborted();
|
|
1539
|
+
const lexical = lexicalDevicePath(path);
|
|
1540
|
+
const aliases = typeof filesystem.lstat === "function";
|
|
1541
|
+
if (!aliases && lexical !== nullPath && lexical !== deviceDirectory && lexical !== "/") return lexical;
|
|
1542
|
+
const pending = path.split("/");
|
|
1543
|
+
const parts = [];
|
|
1544
|
+
let links = 0;
|
|
1545
|
+
let expanded = path.length;
|
|
1546
|
+
let absolute = path.startsWith("/");
|
|
1547
|
+
let traversalFailure;
|
|
1548
|
+
while (pending.length) {
|
|
1549
|
+
options.signal?.throwIfAborted();
|
|
1550
|
+
if (`/${parts.join("/")}` === nullPath) throw new FsError("ENOTDIR", { path });
|
|
1551
|
+
const component = pending.shift();
|
|
1552
|
+
if (!component || component === ".") continue;
|
|
1553
|
+
if (component === "..") {
|
|
1554
|
+
parts.pop();
|
|
1555
|
+
continue;
|
|
1556
|
+
}
|
|
1557
|
+
const candidate = `/${[...parts, component].join("/")}`;
|
|
1558
|
+
if (candidate !== deviceDirectory && candidate !== nullPath && (followFinal && aliases || pending.length)) {
|
|
1559
|
+
const lookup = absolute ? candidate : candidate.slice(1);
|
|
1560
|
+
let stat;
|
|
1561
|
+
try {
|
|
1562
|
+
if (typeof filesystem.lstat !== "function") throw new FsError("ENOTSUP", { path });
|
|
1563
|
+
stat = await filesystem.lstat(lookup, options);
|
|
1564
|
+
} catch (error) {
|
|
1565
|
+
options.signal?.throwIfAborted();
|
|
1566
|
+
if (isFsError(error, "ENOTSUP") && links === 0 && lexical !== nullPath && lexical !== deviceDirectory && lexical !== "/") return lexical;
|
|
1567
|
+
if (!isFsError(error, "ENOENT")) throw error;
|
|
1568
|
+
if (pending.length) traversalFailure ??= error;
|
|
1569
|
+
}
|
|
1570
|
+
options.signal?.throwIfAborted();
|
|
1571
|
+
if (stat?.type === "symlink") {
|
|
1572
|
+
if (typeof filesystem.readlink !== "function") throw new FsError("ENOTSUP", { path });
|
|
1573
|
+
if (++links > 40) throw new FsError("ELOOP", { path });
|
|
1574
|
+
const target = await filesystem.readlink(lookup, options);
|
|
1575
|
+
options.signal?.throwIfAborted();
|
|
1576
|
+
validatePath(target);
|
|
1577
|
+
expanded += target.length;
|
|
1578
|
+
if (expanded > 65536) throw new FsError("ENAMETOOLONG", { path });
|
|
1579
|
+
if (target.startsWith("/")) {
|
|
1580
|
+
parts.length = 0;
|
|
1581
|
+
absolute = true;
|
|
1582
|
+
}
|
|
1583
|
+
pending.unshift(...target.split("/"));
|
|
1584
|
+
continue;
|
|
1585
|
+
}
|
|
1586
|
+
if (stat && pending.length && stat.type !== "directory") traversalFailure ??= new FsError("ENOTDIR", { path });
|
|
1587
|
+
}
|
|
1588
|
+
parts.push(component);
|
|
1589
|
+
}
|
|
1590
|
+
const resolved = `/${parts.join("/")}`;
|
|
1591
|
+
if (traversalFailure && (resolved === nullPath || resolved === deviceDirectory || resolved === "/")) throw traversalFailure;
|
|
1592
|
+
return resolved;
|
|
1593
|
+
}
|
|
1594
|
+
|
|
1595
|
+
// packages/safe-fs/src/fs/devices/stream.ts
|
|
1596
|
+
function deviceReadStream(open) {
|
|
1597
|
+
return { [Symbol.asyncIterator]() {
|
|
1598
|
+
let opened;
|
|
1599
|
+
let closing;
|
|
1600
|
+
const iterator = () => opened ??= open().then((source) => source[Symbol.asyncIterator]());
|
|
1601
|
+
const close = () => closing ??= iterator().then(async (source) => source.return ? source.return() : { done: true, value: void 0 });
|
|
1602
|
+
return {
|
|
1603
|
+
async next() {
|
|
1604
|
+
if (closing) {
|
|
1605
|
+
await closing;
|
|
1606
|
+
return { done: true, value: void 0 };
|
|
1607
|
+
}
|
|
1608
|
+
try {
|
|
1609
|
+
return await (await iterator()).next();
|
|
1610
|
+
} catch (error) {
|
|
1611
|
+
await finishCleanup(close, true);
|
|
1612
|
+
throw error;
|
|
1613
|
+
}
|
|
1614
|
+
},
|
|
1615
|
+
return: close
|
|
1616
|
+
};
|
|
1617
|
+
} };
|
|
1618
|
+
}
|
|
1619
|
+
async function drainDeviceFile(handle, signal) {
|
|
1620
|
+
let failed = false;
|
|
1621
|
+
let position = 0;
|
|
1622
|
+
try {
|
|
1623
|
+
await drainDeviceInput({ [Symbol.asyncIterator]: () => ({ async next() {
|
|
1624
|
+
const value = await handle.read(position, 65536, signal ? { signal } : {});
|
|
1625
|
+
if (!(value instanceof Uint8Array) || value.byteLength > 65536) throw new TypeError("Retained reads must return bounded Uint8Array chunks");
|
|
1626
|
+
position += value.byteLength;
|
|
1627
|
+
if (!Number.isSafeInteger(position)) throw new RangeError("Retained read position exceeds safe integer range");
|
|
1628
|
+
return { done: value.byteLength === 0, value };
|
|
1629
|
+
} }) }, signal);
|
|
1630
|
+
} catch (error) {
|
|
1631
|
+
failed = true;
|
|
1632
|
+
throw error;
|
|
1633
|
+
} finally {
|
|
1634
|
+
await finishCleanup(async () => {
|
|
1635
|
+
try {
|
|
1636
|
+
await handle.close();
|
|
1637
|
+
} catch (error) {
|
|
1638
|
+
signal?.throwIfAborted();
|
|
1639
|
+
throw error;
|
|
1640
|
+
}
|
|
1641
|
+
}, failed);
|
|
1642
|
+
}
|
|
1643
|
+
signal?.throwIfAborted();
|
|
1644
|
+
}
|
|
1645
|
+
function nextChunk(iterator, signal) {
|
|
1646
|
+
signal?.throwIfAborted();
|
|
1647
|
+
return new Promise((resolve, reject) => {
|
|
1648
|
+
const aborted = () => {
|
|
1649
|
+
signal?.removeEventListener("abort", aborted);
|
|
1650
|
+
reject(signal?.reason);
|
|
1651
|
+
};
|
|
1652
|
+
signal?.addEventListener("abort", aborted, { once: true });
|
|
1653
|
+
try {
|
|
1654
|
+
Promise.resolve(iterator.next()).then((result) => {
|
|
1655
|
+
signal?.removeEventListener("abort", aborted);
|
|
1656
|
+
if (signal?.aborted) reject(signal.reason);
|
|
1657
|
+
else resolve(result);
|
|
1658
|
+
}, (error) => {
|
|
1659
|
+
signal?.removeEventListener("abort", aborted);
|
|
1660
|
+
reject(signal?.aborted ? signal.reason : error);
|
|
1661
|
+
});
|
|
1662
|
+
} catch (error) {
|
|
1663
|
+
signal?.removeEventListener("abort", aborted);
|
|
1664
|
+
reject(signal?.aborted ? signal.reason : error);
|
|
1665
|
+
}
|
|
1666
|
+
});
|
|
1667
|
+
}
|
|
1668
|
+
async function drainDeviceInput(source, signal) {
|
|
1669
|
+
signal?.throwIfAborted();
|
|
1670
|
+
const iterator = source[Symbol.asyncIterator]();
|
|
1671
|
+
let failed = false;
|
|
1672
|
+
let bytes = 0;
|
|
1673
|
+
let pulls = 0;
|
|
1674
|
+
try {
|
|
1675
|
+
for (; ; ) {
|
|
1676
|
+
const result = await nextChunk(iterator, signal);
|
|
1677
|
+
signal?.throwIfAborted();
|
|
1678
|
+
if (result.done) break;
|
|
1679
|
+
if (!(result.value instanceof Uint8Array)) throw new TypeError("Byte sources must yield Uint8Array chunks");
|
|
1680
|
+
bytes += result.value.byteLength;
|
|
1681
|
+
if (++pulls >= 64 || bytes >= 65536) {
|
|
1682
|
+
await new Promise((resolve) => setTimeout(resolve, 0));
|
|
1683
|
+
signal?.throwIfAborted();
|
|
1684
|
+
bytes = 0;
|
|
1685
|
+
pulls = 0;
|
|
1686
|
+
}
|
|
1687
|
+
}
|
|
1688
|
+
} catch (error) {
|
|
1689
|
+
failed = true;
|
|
1690
|
+
throw error;
|
|
1691
|
+
} finally {
|
|
1692
|
+
await finishCleanup(async () => {
|
|
1693
|
+
try {
|
|
1694
|
+
await iterator.return?.();
|
|
1695
|
+
} catch (error) {
|
|
1696
|
+
signal?.throwIfAborted();
|
|
1697
|
+
throw error;
|
|
1698
|
+
}
|
|
1699
|
+
}, failed);
|
|
1700
|
+
}
|
|
1701
|
+
signal?.throwIfAborted();
|
|
1702
|
+
}
|
|
1703
|
+
|
|
1704
|
+
// packages/safe-fs/src/fs/devices/index.ts
|
|
1705
|
+
var views = /* @__PURE__ */ new WeakMap();
|
|
1706
|
+
var deviceCapabilities = Object.freeze({
|
|
1707
|
+
readOnly: false,
|
|
1708
|
+
read: true,
|
|
1709
|
+
stat: true,
|
|
1710
|
+
realpath: true,
|
|
1711
|
+
access: true,
|
|
1712
|
+
readdir: false,
|
|
1713
|
+
write: true,
|
|
1714
|
+
append: true,
|
|
1715
|
+
exclusiveCreate: true,
|
|
1716
|
+
streamingRead: true,
|
|
1717
|
+
retainedRead: true,
|
|
1718
|
+
streamingWrite: true,
|
|
1719
|
+
streamingAppend: true,
|
|
1720
|
+
copy: true,
|
|
1721
|
+
exclusiveCopy: true,
|
|
1722
|
+
remove: false,
|
|
1723
|
+
removeDirectory: false,
|
|
1724
|
+
recursiveRemove: false,
|
|
1725
|
+
rename: false,
|
|
1726
|
+
mkdir: false,
|
|
1727
|
+
recursiveMkdir: false,
|
|
1728
|
+
symlinks: false,
|
|
1729
|
+
hardlinks: false,
|
|
1730
|
+
readlink: false,
|
|
1731
|
+
permissions: false,
|
|
1732
|
+
timestamps: false,
|
|
1733
|
+
truncate: false,
|
|
1734
|
+
randomAccessWrite: false,
|
|
1735
|
+
atomicRename: false,
|
|
1736
|
+
descriptorWriteStream: true
|
|
1737
|
+
});
|
|
1738
|
+
function globalCapabilities(filesystem) {
|
|
1739
|
+
const capabilities = { readOnly: false };
|
|
1740
|
+
const optional = {
|
|
1741
|
+
streamingRead: ["readStream"],
|
|
1742
|
+
streamingWrite: ["writeStream"],
|
|
1743
|
+
retainedRead: ["openReadFile"],
|
|
1744
|
+
streamingAppend: ["writeStream"],
|
|
1745
|
+
descriptorWriteStream: ["writeStream"],
|
|
1746
|
+
symlinks: ["symlink", "readlink"],
|
|
1747
|
+
hardlinks: ["link"],
|
|
1748
|
+
permissions: ["chmod"],
|
|
1749
|
+
timestamps: ["utimes"],
|
|
1750
|
+
readlink: ["readlink"],
|
|
1751
|
+
truncate: ["truncate"],
|
|
1752
|
+
removeDirectory: ["rmdir"]
|
|
1753
|
+
};
|
|
1754
|
+
for (const key of /* @__PURE__ */ new Set([...Object.keys(filesystem.capabilities), ...Object.keys(deviceCapabilities)])) {
|
|
1755
|
+
if (key === "readOnly") continue;
|
|
1756
|
+
Object.defineProperty(capabilities, key, { enumerable: true, get() {
|
|
1757
|
+
if (key === "copy" || key === "exclusiveCopy") return void 0;
|
|
1758
|
+
let declared = filesystem.capabilities[key];
|
|
1759
|
+
if (declared === true && optional[key]?.some((method) => typeof filesystem[method] !== "function")) declared = false;
|
|
1760
|
+
if (key === "descriptorWriteStream" && filesystem.capabilities.streamingWrite === false) declared = false;
|
|
1761
|
+
return declared === deviceCapabilities[key] ? declared : void 0;
|
|
1762
|
+
} });
|
|
1763
|
+
}
|
|
1764
|
+
return Object.freeze(capabilities);
|
|
1765
|
+
}
|
|
1766
|
+
function reserved(path) {
|
|
1767
|
+
return path === "/" || path === deviceDirectory || path === nullPath;
|
|
1768
|
+
}
|
|
1769
|
+
function nonnegative(value, path) {
|
|
1770
|
+
if (value !== void 0 && (!Number.isSafeInteger(value) || value < 0)) throw new FsError("EINVAL", { path });
|
|
1771
|
+
}
|
|
1772
|
+
var DeviceFileSystem = class {
|
|
1773
|
+
#filesystem;
|
|
1774
|
+
capabilities;
|
|
1775
|
+
#nullStat;
|
|
1776
|
+
#directoryStat;
|
|
1777
|
+
constructor(filesystem) {
|
|
1778
|
+
this.#filesystem = filesystem;
|
|
1779
|
+
this.capabilities = globalCapabilities(filesystem);
|
|
1780
|
+
const identityScope = Object.freeze({});
|
|
1781
|
+
this.#nullStat = Object.freeze({
|
|
1782
|
+
type: "character",
|
|
1783
|
+
mode: 8630,
|
|
1784
|
+
size: 0,
|
|
1785
|
+
allocatedBytes: 0,
|
|
1786
|
+
mtimeMs: 0,
|
|
1787
|
+
atimeMs: 0,
|
|
1788
|
+
ctimeMs: 0,
|
|
1789
|
+
birthtimeMs: 0,
|
|
1790
|
+
identityScope,
|
|
1791
|
+
ino: 1,
|
|
1792
|
+
dev: 0,
|
|
1793
|
+
nlink: 1
|
|
1794
|
+
});
|
|
1795
|
+
this.#directoryStat = Object.freeze({ ...this.#nullStat, type: "directory", mode: 16877, ino: 2 });
|
|
1796
|
+
const methods = /* @__PURE__ */ new Map();
|
|
1797
|
+
const view = new Proxy(this, {
|
|
1798
|
+
set: (_target, property, value) => Reflect.set(filesystem, property, value, filesystem),
|
|
1799
|
+
get(target, property) {
|
|
1800
|
+
const value = Reflect.get(target, property, target);
|
|
1801
|
+
if (typeof value !== "function" || property === "constructor") return value;
|
|
1802
|
+
const backing = Reflect.get(filesystem, property, filesystem);
|
|
1803
|
+
const cached = methods.get(property);
|
|
1804
|
+
if (cached && cached.backing === backing) return cached.bound;
|
|
1805
|
+
const bound = value.bind(target);
|
|
1806
|
+
methods.set(property, { backing, bound });
|
|
1807
|
+
return bound;
|
|
1808
|
+
}
|
|
1809
|
+
});
|
|
1810
|
+
for (const identity of [this, view]) registerEntryView(identity, async (path, options) => {
|
|
1811
|
+
const resolved = await this.#resolve(path, options);
|
|
1812
|
+
if (resolved === nullPath || resolved === deviceDirectory) return {
|
|
1813
|
+
filesystem: this,
|
|
1814
|
+
path: resolved,
|
|
1815
|
+
stat: resolved === nullPath ? this.#nullStat : this.#directoryStat,
|
|
1816
|
+
readOnly: false
|
|
1817
|
+
};
|
|
1818
|
+
return { filesystem, path };
|
|
1819
|
+
});
|
|
1820
|
+
return view;
|
|
1821
|
+
}
|
|
1822
|
+
#resolve(path, options, followFinal = true) {
|
|
1823
|
+
return resolveDevicePath(this.#filesystem, path, options, followFinal);
|
|
1824
|
+
}
|
|
1825
|
+
async #mutable(path, options, followFinal = true) {
|
|
1826
|
+
if (reserved(await this.#resolve(path, options, followFinal))) throw new FsError("EBUSY", { path });
|
|
1827
|
+
}
|
|
1828
|
+
async #writeTarget(path, options) {
|
|
1829
|
+
const resolved = await this.#resolve(path, options);
|
|
1830
|
+
if (resolved === nullPath) {
|
|
1831
|
+
if (options.flag === "wx" || options.flag === "ax") throw new FsError("EEXIST", { path });
|
|
1832
|
+
if (options.flag !== void 0 && options.flag !== "w" && options.flag !== "a") throw new FsError("EINVAL", { path });
|
|
1833
|
+
return true;
|
|
1834
|
+
}
|
|
1835
|
+
if (resolved === "/" || resolved === deviceDirectory) throw new FsError("EISDIR", { path });
|
|
1836
|
+
return false;
|
|
1837
|
+
}
|
|
1838
|
+
canonicalizeMissingTarget(path, options = {}) {
|
|
1839
|
+
options.signal?.throwIfAborted();
|
|
1840
|
+
const resolved = lexicalDevicePath(path);
|
|
1841
|
+
return reserved(resolved) ? resolved : this.#filesystem.canonicalizeMissingTarget?.(path, options);
|
|
1842
|
+
}
|
|
1843
|
+
async capabilitiesFor(path, options = {}) {
|
|
1844
|
+
const resolved = await this.#resolve(path, options);
|
|
1845
|
+
if (resolved === nullPath) return deviceCapabilities;
|
|
1846
|
+
if (resolved === deviceDirectory) return {
|
|
1847
|
+
...deviceCapabilities,
|
|
1848
|
+
readdir: true,
|
|
1849
|
+
write: false,
|
|
1850
|
+
append: false,
|
|
1851
|
+
exclusiveCreate: false,
|
|
1852
|
+
streamingWrite: false,
|
|
1853
|
+
streamingAppend: false,
|
|
1854
|
+
descriptorWriteStream: false,
|
|
1855
|
+
retainedRead: false,
|
|
1856
|
+
streamingRead: false,
|
|
1857
|
+
copy: false,
|
|
1858
|
+
exclusiveCopy: false
|
|
1859
|
+
};
|
|
1860
|
+
const capabilities = await this.#filesystem.capabilitiesFor?.(path, options) ?? this.#filesystem.capabilities;
|
|
1861
|
+
const unavailable = {};
|
|
1862
|
+
if (typeof this.#filesystem.readStream !== "function") unavailable.streamingRead = false;
|
|
1863
|
+
if (typeof this.#filesystem.writeStream !== "function") {
|
|
1864
|
+
unavailable.streamingWrite = false;
|
|
1865
|
+
unavailable.streamingAppend = false;
|
|
1866
|
+
unavailable.descriptorWriteStream = false;
|
|
1867
|
+
}
|
|
1868
|
+
if (typeof this.#filesystem.openReadFile !== "function") unavailable.retainedRead = false;
|
|
1869
|
+
return Object.keys(unavailable).some((key) => capabilities[key] !== false) ? { ...capabilities, ...unavailable } : capabilities;
|
|
1870
|
+
}
|
|
1871
|
+
async stat(path, options = {}) {
|
|
1872
|
+
const resolved = await this.#resolve(path, options);
|
|
1873
|
+
if (resolved === nullPath) return { ...this.#nullStat };
|
|
1874
|
+
if (resolved === deviceDirectory) return { ...this.#directoryStat };
|
|
1875
|
+
return this.#filesystem.stat(path, options);
|
|
1876
|
+
}
|
|
1877
|
+
async lstat(path, options = {}) {
|
|
1878
|
+
const resolved = await this.#resolve(path, options, false);
|
|
1879
|
+
if (resolved === nullPath) return { ...this.#nullStat };
|
|
1880
|
+
if (resolved === deviceDirectory) return { ...this.#directoryStat };
|
|
1881
|
+
return this.#filesystem.lstat(path, options);
|
|
1882
|
+
}
|
|
1883
|
+
compareEntry(path, peer, peerPath, options = {}) {
|
|
1884
|
+
return compareEntries(this, path, peer, peerPath, options);
|
|
1885
|
+
}
|
|
1886
|
+
async realpath(path, options = {}) {
|
|
1887
|
+
const resolved = await this.#resolve(path, options);
|
|
1888
|
+
return reserved(resolved) ? resolved : this.#filesystem.realpath(path, options);
|
|
1889
|
+
}
|
|
1890
|
+
async readFile(path, options = {}) {
|
|
1891
|
+
const resolved = await this.#resolve(path, options);
|
|
1892
|
+
if (resolved === nullPath) {
|
|
1893
|
+
nonnegative(options.maxBytes, path);
|
|
1894
|
+
return new Uint8Array();
|
|
1895
|
+
}
|
|
1896
|
+
if (resolved === deviceDirectory) throw new FsError("EISDIR", { path });
|
|
1897
|
+
return this.#filesystem.readFile(path, options);
|
|
1898
|
+
}
|
|
1899
|
+
readStream(path, options = {}) {
|
|
1900
|
+
return deviceReadStream(async () => {
|
|
1901
|
+
const resolved = await this.#resolve(path, options);
|
|
1902
|
+
if (resolved === nullPath) {
|
|
1903
|
+
nonnegative(options.start, path);
|
|
1904
|
+
nonnegative(options.endExclusive, path);
|
|
1905
|
+
nonnegative(options.chunkSize, path);
|
|
1906
|
+
if (options.chunkSize === 0 || options.endExclusive !== void 0 && options.endExclusive < (options.start ?? 0)) throw new FsError("EINVAL", { path });
|
|
1907
|
+
return { [Symbol.asyncIterator]: () => ({ next: async () => ({ done: true, value: void 0 }) }) };
|
|
1908
|
+
}
|
|
1909
|
+
if (resolved === deviceDirectory) throw new FsError("EISDIR", { path });
|
|
1910
|
+
if (!this.#filesystem.readStream) throw new FsError("ENOTSUP", { path });
|
|
1911
|
+
return this.#filesystem.readStream(path, options);
|
|
1912
|
+
});
|
|
1913
|
+
}
|
|
1914
|
+
async openReadFile(path, options = {}) {
|
|
1915
|
+
const resolved = await this.#resolve(path, options);
|
|
1916
|
+
if (resolved !== nullPath) {
|
|
1917
|
+
if (resolved === deviceDirectory) throw new FsError("EISDIR", { path });
|
|
1918
|
+
if (!this.#filesystem.openReadFile) throw new FsError("ENOTSUP", { path });
|
|
1919
|
+
return this.#filesystem.openReadFile(path, options);
|
|
1920
|
+
}
|
|
1921
|
+
const stat = this.#nullStat;
|
|
1922
|
+
let closed = false;
|
|
1923
|
+
const check = (settings) => {
|
|
1924
|
+
settings.signal?.throwIfAborted();
|
|
1925
|
+
if (closed) throw new FsError("EBADF", { path });
|
|
1926
|
+
};
|
|
1927
|
+
return {
|
|
1928
|
+
async stat(settings = {}) {
|
|
1929
|
+
check(settings);
|
|
1930
|
+
return { ...stat };
|
|
1931
|
+
},
|
|
1932
|
+
async read(position, maxBytes, settings = {}) {
|
|
1933
|
+
check(settings);
|
|
1934
|
+
nonnegative(position, path);
|
|
1935
|
+
nonnegative(maxBytes, path);
|
|
1936
|
+
return new Uint8Array();
|
|
1937
|
+
},
|
|
1938
|
+
async close() {
|
|
1939
|
+
closed = true;
|
|
1940
|
+
}
|
|
1941
|
+
};
|
|
1942
|
+
}
|
|
1943
|
+
async writeFile(path, data, options = {}) {
|
|
1944
|
+
if (await this.#writeTarget(path, options)) {
|
|
1945
|
+
if (!(data instanceof Uint8Array)) throw new TypeError("File data must be Uint8Array");
|
|
1946
|
+
return;
|
|
1947
|
+
}
|
|
1948
|
+
await this.#filesystem.writeFile(path, data, options);
|
|
1949
|
+
}
|
|
1950
|
+
async appendFile(path, data, options = {}) {
|
|
1951
|
+
if (await this.#writeTarget(path, options)) {
|
|
1952
|
+
if (!(data instanceof Uint8Array)) throw new TypeError("File data must be Uint8Array");
|
|
1953
|
+
return;
|
|
1954
|
+
}
|
|
1955
|
+
await this.#filesystem.appendFile(path, data, options);
|
|
1956
|
+
}
|
|
1957
|
+
async writeStream(path, source, options = {}) {
|
|
1958
|
+
if (await this.#writeTarget(path, options)) return drainDeviceInput(source, options.signal);
|
|
1959
|
+
if (!this.#filesystem.writeStream) throw new FsError("ENOTSUP", { path });
|
|
1960
|
+
await this.#filesystem.writeStream(path, source, options);
|
|
1961
|
+
}
|
|
1962
|
+
async readdir(path, options = {}) {
|
|
1963
|
+
const resolved = await this.#resolve(path, options);
|
|
1964
|
+
if (resolved === nullPath) throw new FsError("ENOTDIR", { path });
|
|
1965
|
+
if (resolved !== "/" && resolved !== deviceDirectory) return this.#filesystem.readdir(path, options);
|
|
1966
|
+
const limit = directoryEntryLimit(options, path);
|
|
1967
|
+
let entries2;
|
|
1968
|
+
try {
|
|
1969
|
+
entries2 = await this.#filesystem.readdir(resolved, options);
|
|
1970
|
+
} catch (error) {
|
|
1971
|
+
options.signal?.throwIfAborted();
|
|
1972
|
+
if (!isFsError(error, "ENOENT") && !isFsError(error, "ENOTDIR")) throw error;
|
|
1973
|
+
entries2 = [];
|
|
1974
|
+
}
|
|
1975
|
+
options.signal?.throwIfAborted();
|
|
1976
|
+
const merged = /* @__PURE__ */ new Map();
|
|
1977
|
+
for (const entry of entries2) {
|
|
1978
|
+
if (entry.name === "." || entry.name === "..") continue;
|
|
1979
|
+
if (!entry.name || entry.name.includes("/") || entry.name.includes("\0")) throw new FsError("EIO", { path, message: "invalid directory entry" });
|
|
1980
|
+
merged.set(entry.name, { name: entry.name, type: entry.type });
|
|
1981
|
+
admitDirectoryEntries(merged.size, limit, path);
|
|
1982
|
+
}
|
|
1983
|
+
const name = resolved === "/" ? "dev" : "null";
|
|
1984
|
+
merged.set(name, { name, type: resolved === "/" ? "directory" : "character" });
|
|
1985
|
+
admitDirectoryEntries(merged.size, limit, path);
|
|
1986
|
+
return [...merged.values()];
|
|
1987
|
+
}
|
|
1988
|
+
async mkdir(path, options = {}) {
|
|
1989
|
+
const resolved = await this.#resolve(path, options);
|
|
1990
|
+
if (reserved(resolved)) {
|
|
1991
|
+
if (resolved !== nullPath && options.recursive) return;
|
|
1992
|
+
throw new FsError("EEXIST", { path });
|
|
1993
|
+
}
|
|
1994
|
+
await this.#filesystem.mkdir(path, options);
|
|
1995
|
+
}
|
|
1996
|
+
async rm(path, options = {}) {
|
|
1997
|
+
await this.#mutable(path, options, false);
|
|
1998
|
+
await this.#filesystem.rm(path, options);
|
|
1999
|
+
}
|
|
2000
|
+
async rmdir(path, options = {}) {
|
|
2001
|
+
const resolved = await this.#resolve(path, options, false);
|
|
2002
|
+
if (resolved === nullPath) throw new FsError("ENOTDIR", { path });
|
|
2003
|
+
if (reserved(resolved)) throw new FsError("EBUSY", { path });
|
|
2004
|
+
if (!this.#filesystem.rmdir) throw new FsError("ENOTSUP", { path });
|
|
2005
|
+
await this.#filesystem.rmdir(path, options);
|
|
2006
|
+
}
|
|
2007
|
+
async rename(source, destination, options = {}) {
|
|
2008
|
+
await this.#mutable(source, options, false);
|
|
2009
|
+
await this.#mutable(destination, options, false);
|
|
2010
|
+
await this.#filesystem.rename(source, destination, options);
|
|
2011
|
+
}
|
|
2012
|
+
async copyFile(source, destination, options = {}) {
|
|
2013
|
+
const target = await this.#resolve(destination, options);
|
|
2014
|
+
if (target === nullPath && options.exclusive) throw new FsError("EEXIST", { path: destination });
|
|
2015
|
+
const origin = await this.#resolve(source, options);
|
|
2016
|
+
if (target !== nullPath && origin !== nullPath) {
|
|
2017
|
+
if (target === "/" || target === deviceDirectory) throw new FsError("EISDIR", { path: destination });
|
|
2018
|
+
await this.#filesystem.copyFile(source, destination, options);
|
|
2019
|
+
return;
|
|
2020
|
+
}
|
|
2021
|
+
if (target === nullPath) {
|
|
2022
|
+
if (origin === nullPath) return;
|
|
2023
|
+
if (origin === "/" || origin === deviceDirectory) throw new FsError("EISDIR", { path: source });
|
|
2024
|
+
const capabilities = await this.capabilitiesFor(source, options);
|
|
2025
|
+
if (this.#filesystem.readStream && capabilities.streamingRead !== false) {
|
|
2026
|
+
await drainDeviceInput(this.#filesystem.readStream(source, options), options.signal);
|
|
2027
|
+
} else if (this.#filesystem.openReadFile && capabilities.retainedRead !== false) {
|
|
2028
|
+
await drainDeviceFile(await this.#filesystem.openReadFile(source, options), options.signal);
|
|
2029
|
+
} else throw new FsError("ENOTSUP", { path: source });
|
|
2030
|
+
return;
|
|
2031
|
+
}
|
|
2032
|
+
if (reserved(target)) throw new FsError("EISDIR", { path: destination });
|
|
2033
|
+
await this.#filesystem.writeFile(destination, new Uint8Array(), { ...options, flag: options.exclusive ? "wx" : "w" });
|
|
2034
|
+
}
|
|
2035
|
+
async access(path, mode2 = 0, options = {}) {
|
|
2036
|
+
const resolved = await this.#resolve(path, options);
|
|
2037
|
+
if (resolved === nullPath || resolved === deviceDirectory) {
|
|
2038
|
+
if (!Number.isInteger(mode2) || mode2 < 0 || mode2 > 7) throw new FsError("EINVAL", { path });
|
|
2039
|
+
if (resolved === nullPath && mode2 & 1 || resolved === deviceDirectory && mode2 & 2) throw new FsError("EACCES", { path });
|
|
2040
|
+
return;
|
|
2041
|
+
}
|
|
2042
|
+
await this.#filesystem.access(path, mode2, options);
|
|
2043
|
+
}
|
|
2044
|
+
async readlink(path, options = {}) {
|
|
2045
|
+
if (reserved(await this.#resolve(path, options, false))) throw new FsError("EINVAL", { path });
|
|
2046
|
+
if (!this.#filesystem.readlink) throw new FsError("ENOTSUP", { path });
|
|
2047
|
+
return this.#filesystem.readlink(path, options);
|
|
2048
|
+
}
|
|
2049
|
+
async symlink(target, path, options = {}) {
|
|
2050
|
+
await this.#mutable(path, options, false);
|
|
2051
|
+
if (!this.#filesystem.symlink) throw new FsError("ENOTSUP", { path });
|
|
2052
|
+
await this.#filesystem.symlink(target, path, options);
|
|
2053
|
+
}
|
|
2054
|
+
async link(existingPath, newPath, options = {}) {
|
|
2055
|
+
await this.#mutable(existingPath, options, false);
|
|
2056
|
+
await this.#mutable(newPath, options, false);
|
|
2057
|
+
if (!this.#filesystem.link) throw new FsError("ENOTSUP", { path: newPath });
|
|
2058
|
+
await this.#filesystem.link(existingPath, newPath, options);
|
|
2059
|
+
}
|
|
2060
|
+
async chmod(path, mode2, options = {}) {
|
|
2061
|
+
await this.#mutable(path, options);
|
|
2062
|
+
if (!this.#filesystem.chmod) throw new FsError("ENOTSUP", { path });
|
|
2063
|
+
await this.#filesystem.chmod(path, mode2, options);
|
|
2064
|
+
}
|
|
2065
|
+
async utimes(path, atimeMs, mtimeMs, options = {}) {
|
|
2066
|
+
await this.#mutable(path, options);
|
|
2067
|
+
if (!this.#filesystem.utimes) throw new FsError("ENOTSUP", { path });
|
|
2068
|
+
await this.#filesystem.utimes(path, atimeMs, mtimeMs, options);
|
|
2069
|
+
}
|
|
2070
|
+
async truncate(path, length, options = {}) {
|
|
2071
|
+
await this.#mutable(path, options);
|
|
2072
|
+
if (!this.#filesystem.truncate) throw new FsError("ENOTSUP", { path });
|
|
2073
|
+
await this.#filesystem.truncate(path, length, options);
|
|
2074
|
+
}
|
|
2075
|
+
};
|
|
2076
|
+
function createDeviceFileSystem(filesystem) {
|
|
2077
|
+
if (filesystem instanceof DeviceFileSystem) return filesystem;
|
|
2078
|
+
let view = views.get(filesystem);
|
|
2079
|
+
if (!view) {
|
|
2080
|
+
view = new DeviceFileSystem(filesystem);
|
|
2081
|
+
views.set(filesystem, view);
|
|
2082
|
+
}
|
|
2083
|
+
return view;
|
|
2084
|
+
}
|
|
2085
|
+
|
|
1524
2086
|
// packages/safe-fs/src/contracts/abort.ts
|
|
1525
2087
|
function composeAbortSignals(signals) {
|
|
1526
2088
|
const controller = new AbortController();
|
|
@@ -4825,7 +5387,7 @@ function predicates(type) {
|
|
|
4825
5387
|
isDirectory: () => type === "directory",
|
|
4826
5388
|
isSymbolicLink: () => type === "symlink",
|
|
4827
5389
|
isBlockDevice: () => false,
|
|
4828
|
-
isCharacterDevice: () =>
|
|
5390
|
+
isCharacterDevice: () => type === "character",
|
|
4829
5391
|
isFIFO: () => false,
|
|
4830
5392
|
isSocket: () => false
|
|
4831
5393
|
};
|
|
@@ -4834,7 +5396,7 @@ function bridgeStats(stat) {
|
|
|
4834
5396
|
return {
|
|
4835
5397
|
dev: stat.dev ?? 0,
|
|
4836
5398
|
ino: stat.ino ?? 0,
|
|
4837
|
-
mode: stat.mode & 4095 | (stat.type === "directory" ? 16384 : stat.type === "symlink" ? 40960 : 32768),
|
|
5399
|
+
mode: stat.mode & 4095 | (stat.type === "directory" ? 16384 : stat.type === "symlink" ? 40960 : stat.type === "character" ? 8192 : 32768),
|
|
4838
5400
|
nlink: stat.nlink ?? 1,
|
|
4839
5401
|
uid: stat.uid ?? 0,
|
|
4840
5402
|
gid: stat.gid ?? 0,
|
|
@@ -5439,6 +6001,8 @@ export {
|
|
|
5439
6001
|
normalizeMemoryFileSystemLimits,
|
|
5440
6002
|
MemoryFileSystem,
|
|
5441
6003
|
createMemoryFileSystem,
|
|
6004
|
+
DeviceFileSystem,
|
|
6005
|
+
createDeviceFileSystem,
|
|
5442
6006
|
composeAbortSignals,
|
|
5443
6007
|
WebDavFileSystem,
|
|
5444
6008
|
ReadOnlyFileSystem,
|
|
@@ -5452,4 +6016,4 @@ export {
|
|
|
5452
6016
|
scopeFileSystem,
|
|
5453
6017
|
FileSystemBridge
|
|
5454
6018
|
};
|
|
5455
|
-
//# sourceMappingURL=chunk-
|
|
6019
|
+
//# sourceMappingURL=chunk-3HQSRMV6.js.map
|