@poe-platform/safe-js 0.1.2 → 0.1.4

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.
Files changed (66) hide show
  1. package/README.md +1 -1
  2. package/dist/compat/fs-core.d.ts +1 -0
  3. package/dist/compat/fs-core.js +1 -0
  4. package/dist/compat/fs-node.d.ts +1 -0
  5. package/dist/compat/fs-node.js +1 -0
  6. package/dist/compat/fs.d.ts +1 -0
  7. package/dist/compat/fs.js +1 -0
  8. package/dist/safe-js/chunks/{chunk-DC5B3GYM.js → chunk-4HHBSGDR.js} +12 -12
  9. package/dist/safe-js/chunks/{chunk-DC5B3GYM.js.map → chunk-4HHBSGDR.js.map} +1 -1
  10. package/dist/safe-js/cli.js +1 -3
  11. package/dist/safe-js/cli.js.map +1 -1
  12. package/dist/safe-js/index.js +1 -3
  13. package/dist/safe-js/index.js.map +1 -1
  14. package/dist/safe-js/modules/fs-config.d.ts +1 -1
  15. package/dist/safe-js/modules/fs.d.ts +1 -1
  16. package/package.json +15 -34
  17. package/dist/safe-fs/bridge/filesystem.d.ts +0 -88
  18. package/dist/safe-fs/bridge/index.d.ts +0 -6
  19. package/dist/safe-fs/bridge/types.d.ts +0 -75
  20. package/dist/safe-fs/config.d.ts +0 -15
  21. package/dist/safe-fs/config.node.d.ts +0 -2
  22. package/dist/safe-fs/contracts/errors.d.ts +0 -50
  23. package/dist/safe-fs/contracts/filesystem.d.ts +0 -96
  24. package/dist/safe-fs/contracts/index.d.ts +0 -4
  25. package/dist/safe-fs/contracts/io.d.ts +0 -8
  26. package/dist/safe-fs/contracts/path.d.ts +0 -8
  27. package/dist/safe-fs/contracts/portable-path.d.ts +0 -13
  28. package/dist/safe-fs/contracts/virtual-path.d.ts +0 -7
  29. package/dist/safe-fs/core.d.ts +0 -12
  30. package/dist/safe-fs/fs/memory/index.d.ts +0 -58
  31. package/dist/safe-fs/fs/mount/comparison.d.ts +0 -19
  32. package/dist/safe-fs/fs/mount/index.d.ts +0 -44
  33. package/dist/safe-fs/fs/overlay/index.d.ts +0 -73
  34. package/dist/safe-fs/fs/readonly/index.d.ts +0 -31
  35. package/dist/safe-fs/fs/real/index.d.ts +0 -76
  36. package/dist/safe-fs/fs/s3/filesystem.d.ts +0 -93
  37. package/dist/safe-fs/fs/s3/http/index.d.ts +0 -2
  38. package/dist/safe-fs/fs/s3/http/transport.d.ts +0 -3
  39. package/dist/safe-fs/fs/s3/http/types.d.ts +0 -30
  40. package/dist/safe-fs/fs/s3/index.d.ts +0 -6
  41. package/dist/safe-fs/fs/s3/mock.d.ts +0 -48
  42. package/dist/safe-fs/fs/s3/transport.d.ts +0 -103
  43. package/dist/safe-fs/fs/webdav/index.d.ts +0 -2
  44. package/dist/safe-fs/fs/webdav/webdav.d.ts +0 -101
  45. package/dist/safe-fs/index.d.ts +0 -14
  46. package/dist/safe-fs/node/filesystem.d.ts +0 -11
  47. package/dist/safe-fs/node/index.d.ts +0 -2
  48. package/dist/safe-fs/node-host.d.ts +0 -1
  49. package/dist/safe-fs/platform/browser.d.ts +0 -12
  50. package/dist/safe-fs/platform/node.d.ts +0 -13
  51. package/dist/safe-js/browser/chunks/chunk-QGN6DKT5.js +0 -4335
  52. package/dist/safe-js/browser/chunks/chunk-QGN6DKT5.js.map +0 -7
  53. package/dist/safe-js/browser/safe-fs-core.js +0 -67
  54. package/dist/safe-js/browser/safe-fs-core.js.map +0 -7
  55. package/dist/safe-js/browser/safe-fs.js +0 -67
  56. package/dist/safe-js/browser/safe-fs.js.map +0 -7
  57. package/dist/safe-js/chunks/chunk-2QRYPKQQ.js +0 -4315
  58. package/dist/safe-js/chunks/chunk-2QRYPKQQ.js.map +0 -7
  59. package/dist/safe-js/chunks/chunk-7M2SJPSZ.js +0 -2613
  60. package/dist/safe-js/chunks/chunk-7M2SJPSZ.js.map +0 -7
  61. package/dist/safe-js/safe-fs-core.js +0 -130
  62. package/dist/safe-js/safe-fs-core.js.map +0 -7
  63. package/dist/safe-js/safe-fs-node.js +0 -94
  64. package/dist/safe-js/safe-fs-node.js.map +0 -7
  65. package/dist/safe-js/safe-fs.js +0 -94
  66. package/dist/safe-js/safe-fs.js.map +0 -7
@@ -1,130 +0,0 @@
1
- import {
2
- ACCESS_MODES,
3
- FileSystemBridge,
4
- FsError,
5
- MemoryFileSystem,
6
- MountFileSystem,
7
- OverlayFileSystem,
8
- ReadOnlyFileSystem,
9
- WebDavFileSystem,
10
- assertPathWithin,
11
- collectBytes,
12
- compareEntries,
13
- createMemoryFileSystem,
14
- createMountFileSystem,
15
- createOverlayFileSystem,
16
- createReadOnlyFileSystem,
17
- dirname,
18
- isErrnoCode,
19
- isFsError,
20
- isPathWithin,
21
- normalizePath,
22
- platform,
23
- readBytes,
24
- relativePath,
25
- resolvePath,
26
- toByteSource,
27
- toFsError,
28
- validatePath
29
- } from "./chunks/chunk-2QRYPKQQ.js";
30
- import "./chunks/chunk-4YIDX44G.js";
31
-
32
- // packages/safe-fs/src/contracts/portable-path.ts
33
- function assertString(value) {
34
- if (typeof value !== "string") throw new TypeError("path must be a string");
35
- }
36
- function basename(path, suffix = "") {
37
- assertString(path);
38
- assertString(suffix);
39
- if (suffix && path === suffix) return "";
40
- let end = path.length;
41
- while (end > 0 && path[end - 1] === "/") end--;
42
- if (end === 0 && suffix && suffix.length <= path.length) return path;
43
- const start = path.lastIndexOf("/", end - 1) + 1;
44
- const base = path.slice(start, end);
45
- if (suffix.length > base.length && suffix.length <= path.length && suffix.endsWith(base)) return path.slice(start);
46
- return suffix && suffix.length < base.length && base.endsWith(suffix) ? base.slice(0, -suffix.length) : base;
47
- }
48
- var dirname2 = dirname;
49
- function extname(path) {
50
- const base = basename(path);
51
- const position = base.lastIndexOf(".");
52
- return position <= 0 || base === ".." ? "" : base.slice(position);
53
- }
54
- function isAbsolutePath(path) {
55
- assertString(path);
56
- return path.startsWith("/");
57
- }
58
- function joinPath(...paths) {
59
- for (const path of paths) assertString(path);
60
- const joined = paths.filter(Boolean).join("/");
61
- if (!joined) return ".";
62
- const absolute = joined.startsWith("/");
63
- const components = [];
64
- for (const component of joined.split("/")) {
65
- if (!component || component === ".") continue;
66
- if (component === "..") {
67
- if (components.length && components.at(-1) !== "..") components.pop();
68
- else if (!absolute) components.push(component);
69
- } else components.push(component);
70
- }
71
- const result = `${absolute ? "/" : ""}${components.join("/")}` || ".";
72
- return joined.endsWith("/") && result !== "/" ? `${result}/` : result;
73
- }
74
- var posixPath = Object.freeze({ basename, dirname: dirname2, extname, join: joinPath, isAbsolute: isAbsolutePath });
75
-
76
- // packages/safe-fs/src/bridge/index.ts
77
- function createFsBridge(fs, options) {
78
- if (options === void 0 || options === null) throw new TypeError("An explicit filesystem codec is required");
79
- return new FileSystemBridge(fs, options, {
80
- codec: options.codec,
81
- copyBytes(bytes) {
82
- return new Uint8Array(bytes);
83
- },
84
- randomSuffix() {
85
- return platform.randomUUID().slice(0, 6);
86
- },
87
- paths: {
88
- isAbsolute(path) {
89
- return typeof path === "string" && path.startsWith("/");
90
- },
91
- dirname,
92
- relative: relativePath,
93
- resolve: resolvePath
94
- }
95
- });
96
- }
97
- export {
98
- ACCESS_MODES,
99
- FsError,
100
- MemoryFileSystem,
101
- MountFileSystem,
102
- OverlayFileSystem,
103
- ReadOnlyFileSystem,
104
- WebDavFileSystem,
105
- assertPathWithin,
106
- basename,
107
- collectBytes,
108
- compareEntries,
109
- createFsBridge,
110
- createMemoryFileSystem,
111
- createMountFileSystem,
112
- createOverlayFileSystem,
113
- createReadOnlyFileSystem,
114
- dirname2 as dirname,
115
- extname,
116
- isAbsolutePath,
117
- isErrnoCode,
118
- isFsError,
119
- isPathWithin,
120
- joinPath,
121
- normalizePath,
122
- posixPath,
123
- readBytes,
124
- relativePath,
125
- resolvePath,
126
- toByteSource,
127
- toFsError,
128
- validatePath
129
- };
130
- //# sourceMappingURL=safe-fs-core.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../safe-fs/src/contracts/portable-path.ts", "../../safe-fs/src/bridge/index.ts"],
4
- "sourcesContent": ["import { dirname as virtualDirname } from \"./virtual-path.js\";\n\nfunction assertString(value: unknown): asserts value is string {\n if (typeof value !== \"string\") throw new TypeError(\"path must be a string\");\n}\n\nexport function basename(path: string, suffix = \"\"): string {\n assertString(path);\n assertString(suffix);\n if (suffix && path === suffix) return \"\";\n let end = path.length;\n while (end > 0 && path[end - 1] === \"/\") end--;\n if (end === 0 && suffix && suffix.length <= path.length) return path;\n const start = path.lastIndexOf(\"/\", end - 1) + 1;\n const base = path.slice(start, end);\n if (suffix.length > base.length && suffix.length <= path.length && suffix.endsWith(base)) return path.slice(start);\n return suffix && suffix.length < base.length && base.endsWith(suffix)\n ? base.slice(0, -suffix.length)\n : base;\n}\n\nexport const dirname = virtualDirname;\n\nexport function extname(path: string): string {\n const base = basename(path);\n const position = base.lastIndexOf(\".\");\n return position <= 0 || base === \"..\" ? \"\" : base.slice(position);\n}\n\nexport function isAbsolutePath(path: string): boolean {\n assertString(path);\n return path.startsWith(\"/\");\n}\n\nexport function joinPath(...paths: string[]): string {\n for (const path of paths) assertString(path);\n const joined = paths.filter(Boolean).join(\"/\");\n if (!joined) return \".\";\n const absolute = joined.startsWith(\"/\");\n const components: string[] = [];\n for (const component of joined.split(\"/\")) {\n if (!component || component === \".\") continue;\n if (component === \"..\") {\n if (components.length && components.at(-1) !== \"..\") components.pop();\n else if (!absolute) components.push(component);\n } else components.push(component);\n }\n const result = `${absolute ? \"/\" : \"\"}${components.join(\"/\")}` || \".\";\n return joined.endsWith(\"/\") && result !== \"/\" ? `${result}/` : result;\n}\n\nexport const posixPath = Object.freeze({ basename, dirname, extname, join: joinPath, isAbsolute: isAbsolutePath });\n", "import { platform } from \"#safe-fs-platform\";\nimport type { FileSystem } from \"../contracts/filesystem.js\";\nimport { dirname, relativePath, resolvePath } from \"../contracts/virtual-path.js\";\nimport { FileSystemBridge } from \"./filesystem.js\";\nimport type { FsBridgeOptions } from \"./types.js\";\n\nexport type {\n FsBridgeCodec, FsBridgeDirent, FsBridgeEncoding, FsBridgeFileSystem, FsBridgeOptions, FsBridgeStats\n} from \"./types.js\";\nexport type FsBridge = FileSystemBridge<Uint8Array<ArrayBuffer>>;\n\nexport function createFsBridge(fs: FileSystem, options: FsBridgeOptions): FsBridge {\n if (options === undefined || options === null) throw new TypeError(\"An explicit filesystem codec is required\");\n return new FileSystemBridge(fs, options, {\n codec: options.codec,\n copyBytes(bytes) { return new Uint8Array(bytes); },\n randomSuffix() { return platform.randomUUID().slice(0, 6); },\n paths: {\n isAbsolute(path) { return typeof path === \"string\" && path.startsWith(\"/\"); },\n dirname,\n relative: relativePath,\n resolve: resolvePath\n }\n });\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,SAAS,aAAa,OAAyC;AAC7D,MAAI,OAAO,UAAU,SAAU,OAAM,IAAI,UAAU,uBAAuB;AAC5E;AAEO,SAAS,SAAS,MAAc,SAAS,IAAY;AAC1D,eAAa,IAAI;AACjB,eAAa,MAAM;AACnB,MAAI,UAAU,SAAS,OAAQ,QAAO;AACtC,MAAI,MAAM,KAAK;AACf,SAAO,MAAM,KAAK,KAAK,MAAM,CAAC,MAAM,IAAK;AACzC,MAAI,QAAQ,KAAK,UAAU,OAAO,UAAU,KAAK,OAAQ,QAAO;AAChE,QAAM,QAAQ,KAAK,YAAY,KAAK,MAAM,CAAC,IAAI;AAC/C,QAAM,OAAO,KAAK,MAAM,OAAO,GAAG;AAClC,MAAI,OAAO,SAAS,KAAK,UAAU,OAAO,UAAU,KAAK,UAAU,OAAO,SAAS,IAAI,EAAG,QAAO,KAAK,MAAM,KAAK;AACjH,SAAO,UAAU,OAAO,SAAS,KAAK,UAAU,KAAK,SAAS,MAAM,IAChE,KAAK,MAAM,GAAG,CAAC,OAAO,MAAM,IAC5B;AACN;AAEO,IAAMA,WAAU;AAEhB,SAAS,QAAQ,MAAsB;AAC5C,QAAM,OAAO,SAAS,IAAI;AAC1B,QAAM,WAAW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AAAE,eAAO,OAAO,SAAS,YAAY,KAAK,WAAW,GAAG;AAAA,MAAG;AAAA,MAC5E;AAAA,MACA,UAAU;AAAA,MACV,SAAS;AAAA,IACX;AAAA,EACF,CAAC;AACH;",
6
- "names": ["dirname"]
7
- }
@@ -1,94 +0,0 @@
1
- import {
2
- MockS3Client,
3
- RealFileSystem,
4
- S3FileSystem,
5
- S3RenameError,
6
- S3ServiceError,
7
- basename,
8
- createFileSystem,
9
- createNodeFileSystemAdapterRegistry,
10
- createNodeFsBridge,
11
- createRealFileSystem,
12
- createS3HttpTransport,
13
- createS3Transport,
14
- dirname,
15
- encodeCopySource,
16
- extname,
17
- isAbsolutePath,
18
- joinPath,
19
- posixPath,
20
- readConfigRecord,
21
- validateFileSystemConfig
22
- } from "./chunks/chunk-7M2SJPSZ.js";
23
- import {
24
- ACCESS_MODES,
25
- FsError,
26
- MemoryFileSystem,
27
- MountFileSystem,
28
- OverlayFileSystem,
29
- ReadOnlyFileSystem,
30
- WebDavFileSystem,
31
- assertPathWithin,
32
- collectBytes,
33
- createMemoryFileSystem,
34
- createMountFileSystem,
35
- createOverlayFileSystem,
36
- createReadOnlyFileSystem,
37
- isErrnoCode,
38
- isFsError,
39
- isPathWithin,
40
- normalizePath,
41
- readBytes,
42
- relativePath,
43
- resolvePath,
44
- toByteSource,
45
- toFsError,
46
- validatePath
47
- } from "./chunks/chunk-2QRYPKQQ.js";
48
- import "./chunks/chunk-4YIDX44G.js";
49
- export {
50
- ACCESS_MODES,
51
- FsError,
52
- MemoryFileSystem,
53
- MockS3Client,
54
- MountFileSystem,
55
- OverlayFileSystem,
56
- ReadOnlyFileSystem,
57
- RealFileSystem,
58
- S3FileSystem,
59
- S3RenameError,
60
- S3ServiceError,
61
- WebDavFileSystem,
62
- assertPathWithin,
63
- basename,
64
- collectBytes,
65
- createFileSystem,
66
- createMemoryFileSystem,
67
- createMountFileSystem,
68
- createNodeFileSystemAdapterRegistry,
69
- createNodeFsBridge,
70
- createOverlayFileSystem,
71
- createReadOnlyFileSystem,
72
- createRealFileSystem,
73
- createS3HttpTransport,
74
- createS3Transport,
75
- dirname,
76
- encodeCopySource,
77
- extname,
78
- isAbsolutePath,
79
- isErrnoCode,
80
- isFsError,
81
- isPathWithin,
82
- joinPath,
83
- normalizePath,
84
- posixPath,
85
- readBytes,
86
- readConfigRecord,
87
- relativePath,
88
- resolvePath,
89
- toByteSource,
90
- toFsError,
91
- validateFileSystemConfig,
92
- validatePath
93
- };
94
- //# sourceMappingURL=safe-fs-node.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": [],
4
- "sourcesContent": [],
5
- "mappings": "",
6
- "names": []
7
- }
@@ -1,94 +0,0 @@
1
- import {
2
- MockS3Client,
3
- RealFileSystem,
4
- S3FileSystem,
5
- S3RenameError,
6
- S3ServiceError,
7
- basename,
8
- createFileSystem,
9
- createNodeFileSystemAdapterRegistry,
10
- createNodeFsBridge,
11
- createRealFileSystem,
12
- createS3HttpTransport,
13
- createS3Transport,
14
- dirname,
15
- encodeCopySource,
16
- extname,
17
- isAbsolutePath,
18
- joinPath,
19
- posixPath,
20
- readConfigRecord,
21
- validateFileSystemConfig
22
- } from "./chunks/chunk-7M2SJPSZ.js";
23
- import {
24
- ACCESS_MODES,
25
- FsError,
26
- MemoryFileSystem,
27
- MountFileSystem,
28
- OverlayFileSystem,
29
- ReadOnlyFileSystem,
30
- WebDavFileSystem,
31
- assertPathWithin,
32
- collectBytes,
33
- createMemoryFileSystem,
34
- createMountFileSystem,
35
- createOverlayFileSystem,
36
- createReadOnlyFileSystem,
37
- isErrnoCode,
38
- isFsError,
39
- isPathWithin,
40
- normalizePath,
41
- readBytes,
42
- relativePath,
43
- resolvePath,
44
- toByteSource,
45
- toFsError,
46
- validatePath
47
- } from "./chunks/chunk-2QRYPKQQ.js";
48
- import "./chunks/chunk-4YIDX44G.js";
49
- export {
50
- ACCESS_MODES,
51
- FsError,
52
- MemoryFileSystem,
53
- MockS3Client,
54
- MountFileSystem,
55
- OverlayFileSystem,
56
- ReadOnlyFileSystem,
57
- RealFileSystem,
58
- S3FileSystem,
59
- S3RenameError,
60
- S3ServiceError,
61
- WebDavFileSystem,
62
- assertPathWithin,
63
- basename,
64
- collectBytes,
65
- createFileSystem,
66
- createMemoryFileSystem,
67
- createMountFileSystem,
68
- createNodeFileSystemAdapterRegistry,
69
- createNodeFsBridge,
70
- createOverlayFileSystem,
71
- createReadOnlyFileSystem,
72
- createRealFileSystem,
73
- createS3HttpTransport,
74
- createS3Transport,
75
- dirname,
76
- encodeCopySource,
77
- extname,
78
- isAbsolutePath,
79
- isErrnoCode,
80
- isFsError,
81
- isPathWithin,
82
- joinPath,
83
- normalizePath,
84
- posixPath,
85
- readBytes,
86
- readConfigRecord,
87
- relativePath,
88
- resolvePath,
89
- toByteSource,
90
- toFsError,
91
- validateFileSystemConfig,
92
- validatePath
93
- };
94
- //# sourceMappingURL=safe-fs.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": [],
4
- "sourcesContent": [],
5
- "mappings": "",
6
- "names": []
7
- }