memfs 4.54.0 → 4.56.1

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 (293) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +57 -30
  3. package/demo/fsa-to-node-sync-tests/README.md +19 -0
  4. package/demo/fsa-to-node-zipfile/README.md +17 -0
  5. package/demo/git/README.md +16 -0
  6. package/demo/git-fsa/README.md +18 -0
  7. package/demo/git-opfs/README.md +20 -0
  8. package/lib/fsa/index.d.ts +1 -33
  9. package/lib/fsa/index.js +1 -39
  10. package/lib/fsa/index.js.map +1 -1
  11. package/lib/fsa-to-node/index.d.ts +1 -2
  12. package/lib/fsa-to-node/index.js +2 -5
  13. package/lib/fsa-to-node/index.js.map +1 -1
  14. package/lib/index.d.ts +6 -7
  15. package/lib/index.js +10 -14
  16. package/lib/index.js.map +1 -1
  17. package/lib/node-to-fsa/index.d.ts +1 -7
  18. package/lib/node-to-fsa/index.js +1 -10
  19. package/lib/node-to-fsa/index.js.map +1 -1
  20. package/package.json +43 -66
  21. package/lib/constants.d.ts +0 -67
  22. package/lib/constants.js +0 -54
  23. package/lib/constants.js.map +0 -1
  24. package/lib/consts/AMODE.d.ts +0 -9
  25. package/lib/consts/AMODE.js +0 -3
  26. package/lib/consts/AMODE.js.map +0 -1
  27. package/lib/consts/FLAG.d.ts +0 -53
  28. package/lib/consts/FLAG.js +0 -36
  29. package/lib/consts/FLAG.js.map +0 -1
  30. package/lib/core/File.d.ts +0 -39
  31. package/lib/core/File.js +0 -72
  32. package/lib/core/File.js.map +0 -1
  33. package/lib/core/Link.d.ts +0 -38
  34. package/lib/core/Link.js +0 -105
  35. package/lib/core/Link.js.map +0 -1
  36. package/lib/core/Node.d.ts +0 -85
  37. package/lib/core/Node.js +0 -287
  38. package/lib/core/Node.js.map +0 -1
  39. package/lib/core/Superblock.d.ts +0 -92
  40. package/lib/core/Superblock.js +0 -689
  41. package/lib/core/Superblock.js.map +0 -1
  42. package/lib/core/constants.d.ts +0 -15
  43. package/lib/core/constants.js +0 -3
  44. package/lib/core/constants.js.map +0 -1
  45. package/lib/core/index.d.ts +0 -6
  46. package/lib/core/index.js +0 -15
  47. package/lib/core/index.js.map +0 -1
  48. package/lib/core/json.d.ts +0 -9
  49. package/lib/core/json.js +0 -35
  50. package/lib/core/json.js.map +0 -1
  51. package/lib/core/result.d.ts +0 -11
  52. package/lib/core/result.js +0 -11
  53. package/lib/core/result.js.map +0 -1
  54. package/lib/core/types.d.ts +0 -8
  55. package/lib/core/types.js +0 -3
  56. package/lib/core/types.js.map +0 -1
  57. package/lib/core/util.d.ts +0 -12
  58. package/lib/core/util.js +0 -74
  59. package/lib/core/util.js.map +0 -1
  60. package/lib/encoding.d.ts +0 -6
  61. package/lib/encoding.js +0 -20
  62. package/lib/encoding.js.map +0 -1
  63. package/lib/fsa/CoreFileSystemDirectoryHandle.d.ts +0 -73
  64. package/lib/fsa/CoreFileSystemDirectoryHandle.js +0 -265
  65. package/lib/fsa/CoreFileSystemDirectoryHandle.js.map +0 -1
  66. package/lib/fsa/CoreFileSystemFileHandle.d.ts +0 -25
  67. package/lib/fsa/CoreFileSystemFileHandle.js +0 -75
  68. package/lib/fsa/CoreFileSystemFileHandle.js.map +0 -1
  69. package/lib/fsa/CoreFileSystemHandle.d.ts +0 -34
  70. package/lib/fsa/CoreFileSystemHandle.js +0 -53
  71. package/lib/fsa/CoreFileSystemHandle.js.map +0 -1
  72. package/lib/fsa/CoreFileSystemObserver.d.ts +0 -10
  73. package/lib/fsa/CoreFileSystemObserver.js +0 -18
  74. package/lib/fsa/CoreFileSystemObserver.js.map +0 -1
  75. package/lib/fsa/CoreFileSystemSyncAccessHandle.d.ts +0 -38
  76. package/lib/fsa/CoreFileSystemSyncAccessHandle.js +0 -123
  77. package/lib/fsa/CoreFileSystemSyncAccessHandle.js.map +0 -1
  78. package/lib/fsa/CoreFileSystemWritableFileStream.d.ts +0 -32
  79. package/lib/fsa/CoreFileSystemWritableFileStream.js +0 -163
  80. package/lib/fsa/CoreFileSystemWritableFileStream.js.map +0 -1
  81. package/lib/fsa/CorePermissionStatus.d.ts +0 -9
  82. package/lib/fsa/CorePermissionStatus.js +0 -14
  83. package/lib/fsa/CorePermissionStatus.js.map +0 -1
  84. package/lib/fsa/FileLockManager.d.ts +0 -7
  85. package/lib/fsa/FileLockManager.js +0 -26
  86. package/lib/fsa/FileLockManager.js.map +0 -1
  87. package/lib/fsa/types.d.ts +0 -182
  88. package/lib/fsa/types.js +0 -3
  89. package/lib/fsa/types.js.map +0 -1
  90. package/lib/fsa/util.d.ts +0 -12
  91. package/lib/fsa/util.js +0 -45
  92. package/lib/fsa/util.js.map +0 -1
  93. package/lib/fsa-to-node/FsaNodeCore.d.ts +0 -33
  94. package/lib/fsa-to-node/FsaNodeCore.js +0 -191
  95. package/lib/fsa-to-node/FsaNodeCore.js.map +0 -1
  96. package/lib/fsa-to-node/FsaNodeDirent.d.ts +0 -19
  97. package/lib/fsa-to-node/FsaNodeDirent.js +0 -39
  98. package/lib/fsa-to-node/FsaNodeDirent.js.map +0 -1
  99. package/lib/fsa-to-node/FsaNodeFs.d.ts +0 -187
  100. package/lib/fsa-to-node/FsaNodeFs.js +0 -831
  101. package/lib/fsa-to-node/FsaNodeFs.js.map +0 -1
  102. package/lib/fsa-to-node/FsaNodeFsOpenFile.d.ts +0 -24
  103. package/lib/fsa-to-node/FsaNodeFsOpenFile.js +0 -37
  104. package/lib/fsa-to-node/FsaNodeFsOpenFile.js.map +0 -1
  105. package/lib/fsa-to-node/FsaNodeReadStream.d.ts +0 -23
  106. package/lib/fsa-to-node/FsaNodeReadStream.js +0 -92
  107. package/lib/fsa-to-node/FsaNodeReadStream.js.map +0 -1
  108. package/lib/fsa-to-node/FsaNodeStats.d.ts +0 -30
  109. package/lib/fsa-to-node/FsaNodeStats.js +0 -53
  110. package/lib/fsa-to-node/FsaNodeStats.js.map +0 -1
  111. package/lib/fsa-to-node/FsaNodeWriteStream.d.ts +0 -47
  112. package/lib/fsa-to-node/FsaNodeWriteStream.js +0 -150
  113. package/lib/fsa-to-node/FsaNodeWriteStream.js.map +0 -1
  114. package/lib/fsa-to-node/constants.d.ts +0 -3
  115. package/lib/fsa-to-node/constants.js +0 -3
  116. package/lib/fsa-to-node/constants.js.map +0 -1
  117. package/lib/fsa-to-node/json.d.ts +0 -2
  118. package/lib/fsa-to-node/json.js +0 -7
  119. package/lib/fsa-to-node/json.js.map +0 -1
  120. package/lib/fsa-to-node/types.d.ts +0 -37
  121. package/lib/fsa-to-node/types.js +0 -3
  122. package/lib/fsa-to-node/types.js.map +0 -1
  123. package/lib/fsa-to-node/util.d.ts +0 -4
  124. package/lib/fsa-to-node/util.js +0 -34
  125. package/lib/fsa-to-node/util.js.map +0 -1
  126. package/lib/fsa-to-node/worker/FsaNodeSyncAdapterWorker.d.ts +0 -10
  127. package/lib/fsa-to-node/worker/FsaNodeSyncAdapterWorker.js +0 -62
  128. package/lib/fsa-to-node/worker/FsaNodeSyncAdapterWorker.js.map +0 -1
  129. package/lib/fsa-to-node/worker/FsaNodeSyncWorker.d.ts +0 -20
  130. package/lib/fsa-to-node/worker/FsaNodeSyncWorker.js +0 -178
  131. package/lib/fsa-to-node/worker/FsaNodeSyncWorker.js.map +0 -1
  132. package/lib/fsa-to-node/worker/SyncMessenger.d.ts +0 -24
  133. package/lib/fsa-to-node/worker/SyncMessenger.js +0 -72
  134. package/lib/fsa-to-node/worker/SyncMessenger.js.map +0 -1
  135. package/lib/fsa-to-node/worker/constants.d.ts +0 -8
  136. package/lib/fsa-to-node/worker/constants.js +0 -3
  137. package/lib/fsa-to-node/worker/constants.js.map +0 -1
  138. package/lib/fsa-to-node/worker/types.d.ts +0 -17
  139. package/lib/fsa-to-node/worker/types.js +0 -3
  140. package/lib/fsa-to-node/worker/types.js.map +0 -1
  141. package/lib/node/Dir.d.ts +0 -26
  142. package/lib/node/Dir.js +0 -186
  143. package/lib/node/Dir.js.map +0 -1
  144. package/lib/node/Dirent.d.ts +0 -26
  145. package/lib/node/Dirent.js +0 -57
  146. package/lib/node/Dirent.js.map +0 -1
  147. package/lib/node/FileHandle.d.ts +0 -52
  148. package/lib/node/FileHandle.js +0 -189
  149. package/lib/node/FileHandle.js.map +0 -1
  150. package/lib/node/FsPromises.d.ts +0 -91
  151. package/lib/node/FsPromises.js +0 -161
  152. package/lib/node/FsPromises.js.map +0 -1
  153. package/lib/node/StatFs.d.ts +0 -19
  154. package/lib/node/StatFs.js +0 -34
  155. package/lib/node/StatFs.js.map +0 -1
  156. package/lib/node/Stats.d.ts +0 -41
  157. package/lib/node/Stats.js +0 -72
  158. package/lib/node/Stats.js.map +0 -1
  159. package/lib/node/constants.d.ts +0 -41
  160. package/lib/node/constants.js +0 -57
  161. package/lib/node/constants.js.map +0 -1
  162. package/lib/node/glob.d.ts +0 -5
  163. package/lib/node/glob.js +0 -94
  164. package/lib/node/glob.js.map +0 -1
  165. package/lib/node/lists/fsCallbackApiList.d.ts +0 -2
  166. package/lib/node/lists/fsCallbackApiList.js +0 -55
  167. package/lib/node/lists/fsCallbackApiList.js.map +0 -1
  168. package/lib/node/lists/fsCommonObjectsList.d.ts +0 -2
  169. package/lib/node/lists/fsCommonObjectsList.js +0 -19
  170. package/lib/node/lists/fsCommonObjectsList.js.map +0 -1
  171. package/lib/node/lists/fsSynchronousApiList.d.ts +0 -2
  172. package/lib/node/lists/fsSynchronousApiList.js +0 -49
  173. package/lib/node/lists/fsSynchronousApiList.js.map +0 -1
  174. package/lib/node/options.d.ts +0 -27
  175. package/lib/node/options.js +0 -112
  176. package/lib/node/options.js.map +0 -1
  177. package/lib/node/types/FsCallbackApi.d.ts +0 -143
  178. package/lib/node/types/FsCallbackApi.js +0 -3
  179. package/lib/node/types/FsCallbackApi.js.map +0 -1
  180. package/lib/node/types/FsCommonObjects.d.ts +0 -17
  181. package/lib/node/types/FsCommonObjects.js +0 -3
  182. package/lib/node/types/FsCommonObjects.js.map +0 -1
  183. package/lib/node/types/FsPromisesApi.d.ts +0 -41
  184. package/lib/node/types/FsPromisesApi.js +0 -3
  185. package/lib/node/types/FsPromisesApi.js.map +0 -1
  186. package/lib/node/types/FsSynchronousApi.d.ts +0 -114
  187. package/lib/node/types/FsSynchronousApi.js +0 -3
  188. package/lib/node/types/FsSynchronousApi.js.map +0 -1
  189. package/lib/node/types/index.d.ts +0 -7
  190. package/lib/node/types/index.js +0 -3
  191. package/lib/node/types/index.js.map +0 -1
  192. package/lib/node/types/misc.d.ts +0 -157
  193. package/lib/node/types/misc.js +0 -3
  194. package/lib/node/types/misc.js.map +0 -1
  195. package/lib/node/types/options.d.ts +0 -191
  196. package/lib/node/types/options.js +0 -3
  197. package/lib/node/types/options.js.map +0 -1
  198. package/lib/node/util.d.ts +0 -21
  199. package/lib/node/util.js +0 -297
  200. package/lib/node/util.js.map +0 -1
  201. package/lib/node/volume.d.ts +0 -395
  202. package/lib/node/volume.js +0 -1641
  203. package/lib/node/volume.js.map +0 -1
  204. package/lib/node-to-fsa/NodeFileSystemDirectoryHandle.d.ts +0 -72
  205. package/lib/node-to-fsa/NodeFileSystemDirectoryHandle.js +0 -217
  206. package/lib/node-to-fsa/NodeFileSystemDirectoryHandle.js.map +0 -1
  207. package/lib/node-to-fsa/NodeFileSystemFileHandle.d.ts +0 -28
  208. package/lib/node-to-fsa/NodeFileSystemFileHandle.js +0 -70
  209. package/lib/node-to-fsa/NodeFileSystemFileHandle.js.map +0 -1
  210. package/lib/node-to-fsa/NodeFileSystemHandle.d.ts +0 -37
  211. package/lib/node-to-fsa/NodeFileSystemHandle.js +0 -68
  212. package/lib/node-to-fsa/NodeFileSystemHandle.js.map +0 -1
  213. package/lib/node-to-fsa/NodeFileSystemSyncAccessHandle.d.ts +0 -42
  214. package/lib/node-to-fsa/NodeFileSystemSyncAccessHandle.js +0 -97
  215. package/lib/node-to-fsa/NodeFileSystemSyncAccessHandle.js.map +0 -1
  216. package/lib/node-to-fsa/NodeFileSystemWritableFileStream.d.ts +0 -56
  217. package/lib/node-to-fsa/NodeFileSystemWritableFileStream.js +0 -191
  218. package/lib/node-to-fsa/NodeFileSystemWritableFileStream.js.map +0 -1
  219. package/lib/node-to-fsa/NodePermissionStatus.d.ts +0 -8
  220. package/lib/node-to-fsa/NodePermissionStatus.js +0 -14
  221. package/lib/node-to-fsa/NodePermissionStatus.js.map +0 -1
  222. package/lib/node-to-fsa/types.d.ts +0 -18
  223. package/lib/node-to-fsa/types.js +0 -3
  224. package/lib/node-to-fsa/types.js.map +0 -1
  225. package/lib/node-to-fsa/util.d.ts +0 -12
  226. package/lib/node-to-fsa/util.js +0 -45
  227. package/lib/node-to-fsa/util.js.map +0 -1
  228. package/lib/node.d.ts +0 -3
  229. package/lib/node.js +0 -10
  230. package/lib/node.js.map +0 -1
  231. package/lib/print/index.d.ts +0 -9
  232. package/lib/print/index.js +0 -49
  233. package/lib/print/index.js.map +0 -1
  234. package/lib/process.d.ts +0 -11
  235. package/lib/process.js +0 -40
  236. package/lib/process.js.map +0 -1
  237. package/lib/queueMicrotask.d.ts +0 -2
  238. package/lib/queueMicrotask.js +0 -6
  239. package/lib/queueMicrotask.js.map +0 -1
  240. package/lib/setTimeoutUnref.d.ts +0 -7
  241. package/lib/setTimeoutUnref.js +0 -14
  242. package/lib/setTimeoutUnref.js.map +0 -1
  243. package/lib/snapshot/async.d.ts +0 -3
  244. package/lib/snapshot/async.js +0 -59
  245. package/lib/snapshot/async.js.map +0 -1
  246. package/lib/snapshot/binary.d.ts +0 -6
  247. package/lib/snapshot/binary.js +0 -31
  248. package/lib/snapshot/binary.js.map +0 -1
  249. package/lib/snapshot/constants.d.ts +0 -5
  250. package/lib/snapshot/constants.js +0 -3
  251. package/lib/snapshot/constants.js.map +0 -1
  252. package/lib/snapshot/index.d.ts +0 -5
  253. package/lib/snapshot/index.js +0 -8
  254. package/lib/snapshot/index.js.map +0 -1
  255. package/lib/snapshot/json.d.ts +0 -10
  256. package/lib/snapshot/json.js +0 -31
  257. package/lib/snapshot/json.js.map +0 -1
  258. package/lib/snapshot/shared.d.ts +0 -2
  259. package/lib/snapshot/shared.js +0 -6
  260. package/lib/snapshot/shared.js.map +0 -1
  261. package/lib/snapshot/sync.d.ts +0 -3
  262. package/lib/snapshot/sync.js +0 -59
  263. package/lib/snapshot/sync.js.map +0 -1
  264. package/lib/snapshot/types.d.ts +0 -30
  265. package/lib/snapshot/types.js +0 -3
  266. package/lib/snapshot/types.js.map +0 -1
  267. package/lib/vendor/node/buffer.d.ts +0 -1
  268. package/lib/vendor/node/buffer.js +0 -6
  269. package/lib/vendor/node/buffer.js.map +0 -1
  270. package/lib/vendor/node/events.d.ts +0 -1
  271. package/lib/vendor/node/events.js +0 -6
  272. package/lib/vendor/node/events.js.map +0 -1
  273. package/lib/vendor/node/fs.d.ts +0 -6
  274. package/lib/vendor/node/fs.js +0 -4
  275. package/lib/vendor/node/fs.js.map +0 -1
  276. package/lib/vendor/node/internal/buffer.d.ts +0 -9
  277. package/lib/vendor/node/internal/buffer.js +0 -13
  278. package/lib/vendor/node/internal/buffer.js.map +0 -1
  279. package/lib/vendor/node/internal/errors.d.ts +0 -31
  280. package/lib/vendor/node/internal/errors.js +0 -77
  281. package/lib/vendor/node/internal/errors.js.map +0 -1
  282. package/lib/vendor/node/path.d.ts +0 -1
  283. package/lib/vendor/node/path.js +0 -14
  284. package/lib/vendor/node/path.js.map +0 -1
  285. package/lib/vendor/node/stream.d.ts +0 -1
  286. package/lib/vendor/node/stream.js +0 -7
  287. package/lib/vendor/node/stream.js.map +0 -1
  288. package/lib/vendor/node/url.d.ts +0 -1
  289. package/lib/vendor/node/url.js +0 -6
  290. package/lib/vendor/node/url.js.map +0 -1
  291. package/lib/vendor/node/util.d.ts +0 -20
  292. package/lib/vendor/node/util.js +0 -112
  293. package/lib/vendor/node/util.js.map +0 -1
package/LICENSE CHANGED
@@ -186,7 +186,7 @@
186
186
  same "printed page" as the copyright notice for easier
187
187
  identification within third-party archives.
188
188
 
189
- Copyright 2023 Vadim @streamich Dalecky <vadimsdaleckis@gmail.com> and other contributors
189
+ Copyright 2026 Vadims @streamich Daleckis <vadimsdaleckis@gmail.com>
190
190
 
191
191
  Licensed under the Apache License, Version 2.0 (the "License");
192
192
  you may not use this file except in compliance with the License.
package/README.md CHANGED
@@ -1,48 +1,75 @@
1
1
  # memfs
2
2
 
3
- [![][npm-badge]][npm-url]
3
+ In-memory file system with Node.js `fs` API and browser File System (Access) API.
4
+
5
+ [![npm][npm-badge]][npm-url]
4
6
 
5
- [npm-url]: https://www.npmjs.com/package/memfs
6
7
  [npm-badge]: https://img.shields.io/npm/v/memfs.svg
8
+ [npm-url]: https://www.npmjs.com/package/memfs
9
+
10
+ ## Overview
7
11
 
8
- JavaScript file system utilities for Node.js and browser. Implementation of in-memory [Node.js `fs` module API](https://nodejs.org/api/fs.html) and in-memory [browser File System API](https://developer.mozilla.org/en-US/docs/Web/API/File_System_API), as well as adapters from `fs` module to File Sytem API and from File Sytem API to `fs` module.
12
+ `memfs` is a JavaScript library that implements an in-memory file system compatible with Node.js `fs` module and the browser File System (Access) API. Use it for testing, mocking file systems, or creating virtual file systems in both Node.js and browser environments.
9
13
 
10
- ## Install
14
+ ## Installation
11
15
 
12
- ```shell
13
- npm i memfs
16
+ ```bash
17
+ npm install memfs
14
18
  ```
15
19
 
16
- ## Resources
20
+ ## Quick Start
21
+
22
+ ### Node.js `fs` API
23
+
24
+ ```javascript
25
+ import { fs } from 'memfs';
26
+
27
+ // Write a file
28
+ fs.writeFileSync('/hello.txt', 'Hello, World!');
29
+
30
+ // Read a file
31
+ const content = fs.readFileSync('/hello.txt', 'utf-8');
32
+ console.log(content); // "Hello, World!"
17
33
 
18
- - [In-memory Node.js `fs` API](./docs/node/index.md)
19
- - [In-memory browser File System (Access) API](./docs/fsa/fsa.md)
20
- - [`fs` to File System (Access) API adapter](./docs/fsa/fs-to-fsa.md)
21
- - [File System (Access) API to `fs` adapter](./docs/fsa/fsa-to-fs.md)
22
- - [Directory `snapshot` utility](./docs/snapshot/index.md)
23
- - [`print` directory tree to terminal](./docs/print/index.md)
24
- - [Code reference](https://streamich.github.io/memfs/)
25
- - [Test coverage](https://streamich.github.io/memfs/coverage/lcov-report/)
34
+ // Create a directory
35
+ fs.mkdirSync('/mydir');
26
36
 
27
- ## Demos
37
+ // List directory contents
38
+ console.log(fs.readdirSync('/')); // ['hello.txt', 'mydir']
39
+ ```
40
+
41
+ ### Browser File System API
42
+
43
+ ```javascript
44
+ import { fsa } from 'memfs';
45
+
46
+ // Get root directory handle
47
+ const root = await fsa.getRoot();
48
+
49
+ // Create a file
50
+ const file = await root.getFileHandle('hello.txt', { create: true });
51
+ const writable = await file.createWritable();
52
+ await writable.write('Hello, World!');
53
+ await writable.close();
54
+
55
+ // Read the file
56
+ const readable = await file.getFile();
57
+ const text = await readable.text();
58
+ console.log(text); // "Hello, World!"
59
+ ```
28
60
 
29
- - [Git in browser, which writes to a real folder](demo/git-fsa/README.md)
30
- - [Git in browser, which writes to OPFS file system](demo/git-opfs/README.md)
31
- - [Git on in-memory file system](demo/git/README.md)
32
- - [`fs` in browser, creates a `.tar` file in real folder](demo/fsa-to-node-zipfile/README.md)
33
- - [`fs` in browser, synchronous API, writes to real folder](demo/fsa-to-node-sync-tests/README.md)
61
+ ## Features
34
62
 
35
- ## See also
63
+ - Node.js `fs` module API compatibility
64
+ - Browser File System (Access) API implementation
65
+ - Adapters between `fs` and File System API
66
+ - Directory snapshots and tree printing utilities
67
+ - Works in Node.js and modern browsers
68
+ - TypeScript support
36
69
 
37
- - [`unionfs`][unionfs] - creates a union of multiple filesystem volumes
38
- - [`fs-monkey`][fs-monkey] - monkey-patches Node's `fs` module and `require` function
39
- - [`linkfs`][linkfs] - redirects filesystem paths
40
- - [`spyfs`][spyfs] - spies on filesystem actions
70
+ ## Documentation
41
71
 
42
- [unionfs]: https://github.com/streamich/unionfs
43
- [fs-monkey]: https://github.com/streamich/fs-monkey
44
- [linkfs]: https://github.com/streamich/linkfs
45
- [spyfs]: https://github.com/streamich/spyfs
72
+ For detailed documentation and more examples, visit the [main project page](https://github.com/streamich/memfs).
46
73
 
47
74
  ## License
48
75
 
@@ -0,0 +1,19 @@
1
+ # Synchronous `fs` in browser
2
+
3
+ This demo executes tests of **synchronous** Node.js API built on top of File
4
+ System Access API in browser.
5
+
6
+ There are two tests:
7
+
8
+ - OPFS &mdash; virtual file system built into browsers.
9
+ - Native File System Access API folder &mdash; a real folder that user explicitly grants permission to.
10
+
11
+ See the assertions run in the browser console.
12
+
13
+ https://github.com/streamich/memfs/assets/9773803/f841b6cc-728d-4341-b426-3daa6b43f8ac
14
+
15
+ Run:
16
+
17
+ ```
18
+ demo:fsa-to-node-sync-tests
19
+ ```
@@ -0,0 +1,17 @@
1
+ This demo shows how `tar-stream` package can be used to create a zip file from
2
+ a folder selected with File System Access API.
3
+
4
+ Below demo uses the File System Access API in the browser to get access to a real folder
5
+ on the file system. It then converts a [`FileSystemDirectoryHandle`](https://developer.mozilla.org/en-US/docs/Web/API/FileSystemDirectoryHandle) instance
6
+ to a Node-like `fs` file system.
7
+
8
+ It then creates two text files using `fs.promises.writeFile`, and then uses `tar-stream` package to create a zip file
9
+ and write it back got the file system using Node's `fs.createWriteStream`.
10
+
11
+ https://github.com/streamich/memfs/assets/9773803/8dc61d1e-61bf-4dfc-973b-028332fd4473
12
+
13
+ Run:
14
+
15
+ ```
16
+ demo:fsa-to-node-zipfile
17
+ ```
@@ -0,0 +1,16 @@
1
+ # `isomorphic-git` running on `memfs` in-memory file system
2
+
3
+ This demo shows how to run `isomorphic-git` on `memfs` in-memory file system. It
4
+ creates a new folder `/repo`, then inits a Git repository there, then creates a
5
+ a file `/repo/README.md` and commits it.
6
+
7
+ ![](https://github.com/streamich/memfs/assets/9773803/021af8ea-690d-4e4e-9d05-d3e0dea60672)
8
+
9
+ Run:
10
+
11
+ ```
12
+ yarn
13
+ npx ts-node demo/git/index.ts
14
+ ```
15
+
16
+ The demo will print the snapshot of the file system after each step.
@@ -0,0 +1,18 @@
1
+ This demo showcase how to run Git in browser but write to a real user file system
2
+ folder. It is possible through File System Access API. The API allows to request
3
+ a folder from user and then use it as a real file system in browser.
4
+
5
+ In this demo we use `memfs` to create a Node `fs`-like file system in browser
6
+ out of the folder provided by File System Access API. We then use `isomorphic-git`
7
+ to run Git commands on that file system.
8
+
9
+ In the demo itself we initiate a Git repo, then we create a `README.md` file, we
10
+ stage it, and finally we commit it.
11
+
12
+ https://github.com/streamich/memfs/assets/9773803/c15212e8-3ee2-4d2a-b325-9fbdcc377c12
13
+
14
+ Run:
15
+
16
+ ```
17
+ yarn demo:git-fsa
18
+ ```
@@ -0,0 +1,20 @@
1
+ This demo showcase how to run Git in browser built-int OPFS file system. OPFS
2
+ stands for (Origin Private File System) it is a virtual file system available
3
+ in browser and it requires no permission to access.
4
+
5
+ In this demo we use `memfs` to create a Node `fs`-like file system in browser
6
+ out of OPFS. We then use `isomorphic-git` to run Git commands on that file system.
7
+
8
+ In the demo itself we initiate a Git repo, then we create a `README.md` file, we
9
+ stage it, and finally we commit it.
10
+
11
+ https://github.com/streamich/memfs/assets/9773803/bbc83f3f-98ad-48cc-9259-b6f543aa1a03
12
+
13
+ Run:
14
+
15
+ ```
16
+ yarn demo:git-opfs
17
+ ```
18
+
19
+ You can install [OPFS Explorer](https://chrome.google.com/webstore/detail/opfs-explorer/acndjpgkpaclldomagafnognkcgjignd) Chrome
20
+ extension to verify the contents of the OPFS file system.
@@ -1,33 +1 @@
1
- import { CoreFileSystemDirectoryHandle } from './CoreFileSystemDirectoryHandle';
2
- import { CoreFsaContext, IFileSystemObserverConstructable } from './types';
3
- import { Superblock } from '../core/Superblock';
4
- export * from './types';
5
- export * from './CoreFileSystemHandle';
6
- export * from './CoreFileSystemDirectoryHandle';
7
- export * from './CoreFileSystemFileHandle';
8
- export * from './CoreFileSystemSyncAccessHandle';
9
- export * from './CoreFileSystemWritableFileStream';
10
- export * from './CoreFileSystemObserver';
11
- export * from './CorePermissionStatus';
12
- export * from './FileLockManager';
13
- /**
14
- * Create a new instance of an in-memory File System Access API
15
- * implementation rooted at the root directory of the filesystem.
16
- *
17
- * @param ctx Optional context for the File System Access API.
18
- * @param core Optional low-level file system implementation to
19
- * back the File System Access API. If not provided, a new empty
20
- * Superblock instance will be created.
21
- * @param dirPath Optional path within the filesystem to use as the root
22
- * directory of the File System Access API. Defaults to `/`.
23
- * @returns A File System Access API implementation `dir` rooted at
24
- * the root directory of the filesystem, as well as the `core`,
25
- * a low-level file system implementation itself. Also, returns
26
- * `FileSystemObserver`, a class that can be used to create
27
- * observers that watch for changes to files and directories.
28
- */
29
- export declare const fsa: (ctx?: Partial<CoreFsaContext>, core?: Superblock, dirPath?: string) => {
30
- core: Superblock;
31
- dir: CoreFileSystemDirectoryHandle;
32
- FileSystemObserver: IFileSystemObserverConstructable;
33
- };
1
+ export * from '@jsonjoy.com/fs-fsa';
package/lib/fsa/index.js CHANGED
@@ -1,43 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.fsa = void 0;
4
3
  const tslib_1 = require("tslib");
5
- const CoreFileSystemDirectoryHandle_1 = require("./CoreFileSystemDirectoryHandle");
6
- const Superblock_1 = require("../core/Superblock");
7
- const CoreFileSystemObserver_1 = require("./CoreFileSystemObserver");
8
- tslib_1.__exportStar(require("./types"), exports);
9
- tslib_1.__exportStar(require("./CoreFileSystemHandle"), exports);
10
- tslib_1.__exportStar(require("./CoreFileSystemDirectoryHandle"), exports);
11
- tslib_1.__exportStar(require("./CoreFileSystemFileHandle"), exports);
12
- tslib_1.__exportStar(require("./CoreFileSystemSyncAccessHandle"), exports);
13
- tslib_1.__exportStar(require("./CoreFileSystemWritableFileStream"), exports);
14
- tslib_1.__exportStar(require("./CoreFileSystemObserver"), exports);
15
- tslib_1.__exportStar(require("./CorePermissionStatus"), exports);
16
- tslib_1.__exportStar(require("./FileLockManager"), exports);
17
- /**
18
- * Create a new instance of an in-memory File System Access API
19
- * implementation rooted at the root directory of the filesystem.
20
- *
21
- * @param ctx Optional context for the File System Access API.
22
- * @param core Optional low-level file system implementation to
23
- * back the File System Access API. If not provided, a new empty
24
- * Superblock instance will be created.
25
- * @param dirPath Optional path within the filesystem to use as the root
26
- * directory of the File System Access API. Defaults to `/`.
27
- * @returns A File System Access API implementation `dir` rooted at
28
- * the root directory of the filesystem, as well as the `core`,
29
- * a low-level file system implementation itself. Also, returns
30
- * `FileSystemObserver`, a class that can be used to create
31
- * observers that watch for changes to files and directories.
32
- */
33
- const fsa = (ctx, core = new Superblock_1.Superblock(), dirPath = '/') => {
34
- const dir = new CoreFileSystemDirectoryHandle_1.CoreFileSystemDirectoryHandle(core, dirPath, ctx);
35
- const FileSystemObserver = class FileSystemObserver extends CoreFileSystemObserver_1.CoreFileSystemObserver {
36
- constructor(callback) {
37
- super(core, callback);
38
- }
39
- };
40
- return { core, dir, FileSystemObserver };
41
- };
42
- exports.fsa = fsa;
4
+ tslib_1.__exportStar(require("@jsonjoy.com/fs-fsa"), exports);
43
5
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/fsa/index.ts"],"names":[],"mappings":";;;;AAAA,mFAAgF;AAOhF,mDAAgD;AAChD,qEAAkE;AAElE,kDAAwB;AACxB,iEAAuC;AACvC,0EAAgD;AAChD,qEAA2C;AAC3C,2EAAiD;AACjD,6EAAmD;AACnD,mEAAyC;AACzC,iEAAuC;AACvC,4DAAkC;AAElC;;;;;;;;;;;;;;;GAeG;AACI,MAAM,GAAG,GAAG,CAAC,GAA6B,EAAE,IAAI,GAAG,IAAI,uBAAU,EAAE,EAAE,UAAkB,GAAG,EAAE,EAAE;IACnG,MAAM,GAAG,GAAG,IAAI,6DAA6B,CAAC,IAAI,EAAE,OAAO,EAAE,GAAG,CAAC,CAAC;IAClE,MAAM,kBAAkB,GAAqC,MAAM,kBAAmB,SAAQ,+CAAsB;QAClH,YAAY,QAAqF;YAC/F,KAAK,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;QACxB,CAAC;KACF,CAAC;IACF,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,kBAAkB,EAAE,CAAC;AAC3C,CAAC,CAAC;AARW,QAAA,GAAG,OAQd"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/fsa/index.ts"],"names":[],"mappings":";;;AAAA,8DAAoC"}
@@ -1,2 +1 @@
1
- export { FsaNodeFs } from './FsaNodeFs';
2
- export { FsaNodeSyncAdapterWorker } from './worker/FsaNodeSyncAdapterWorker';
1
+ export * from '@jsonjoy.com/fs-fsa-to-node';
@@ -1,8 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.FsaNodeSyncAdapterWorker = exports.FsaNodeFs = void 0;
4
- var FsaNodeFs_1 = require("./FsaNodeFs");
5
- Object.defineProperty(exports, "FsaNodeFs", { enumerable: true, get: function () { return FsaNodeFs_1.FsaNodeFs; } });
6
- var FsaNodeSyncAdapterWorker_1 = require("./worker/FsaNodeSyncAdapterWorker");
7
- Object.defineProperty(exports, "FsaNodeSyncAdapterWorker", { enumerable: true, get: function () { return FsaNodeSyncAdapterWorker_1.FsaNodeSyncAdapterWorker; } });
3
+ const tslib_1 = require("tslib");
4
+ tslib_1.__exportStar(require("@jsonjoy.com/fs-fsa-to-node"), exports);
8
5
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/fsa-to-node/index.ts"],"names":[],"mappings":";;;AAAA,yCAAwC;AAA/B,sGAAA,SAAS,OAAA;AAClB,8EAA6E;AAApE,oIAAA,wBAAwB,OAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/fsa-to-node/index.ts"],"names":[],"mappings":";;;AAAA,sEAA4C"}
package/lib/index.d.ts CHANGED
@@ -1,10 +1,9 @@
1
- import Stats from './node/Stats';
2
- import Dirent from './node/Dirent';
3
- import { Volume, StatWatcher, FSWatcher, IWriteStream } from './node/volume';
4
- import { DirectoryJSON, NestedDirectoryJSON } from './core';
5
- import { constants } from './constants';
6
- import type { FsPromisesApi } from './node/types';
7
- import type * as misc from './node/types/misc';
1
+ import { Stats, Dirent, Volume, StatWatcher, FSWatcher } from '@jsonjoy.com/fs-node';
2
+ import type { IWriteStream } from '@jsonjoy.com/fs-node';
3
+ import { DirectoryJSON, NestedDirectoryJSON } from '@jsonjoy.com/fs-core';
4
+ import { constants } from '@jsonjoy.com/fs-node-utils';
5
+ import type { FsPromisesApi } from '@jsonjoy.com/fs-node-utils';
6
+ import type * as misc from '@jsonjoy.com/fs-node-utils/lib/types/misc';
8
7
  export { DirectoryJSON, NestedDirectoryJSON, Volume };
9
8
  export declare const vol: Volume;
10
9
  export interface IFs extends Volume {
package/lib/index.js CHANGED
@@ -2,23 +2,19 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.memfs = exports.fs = exports.vol = exports.Volume = void 0;
4
4
  exports.createFsFromVolume = createFsFromVolume;
5
- const Stats_1 = require("./node/Stats");
6
- const Dirent_1 = require("./node/Dirent");
7
- const volume_1 = require("./node/volume");
8
- Object.defineProperty(exports, "Volume", { enumerable: true, get: function () { return volume_1.Volume; } });
9
- const constants_1 = require("./constants");
10
- const fsSynchronousApiList_1 = require("./node/lists/fsSynchronousApiList");
11
- const fsCallbackApiList_1 = require("./node/lists/fsCallbackApiList");
12
- const { F_OK, R_OK, W_OK, X_OK } = constants_1.constants;
5
+ const fs_node_1 = require("@jsonjoy.com/fs-node");
6
+ Object.defineProperty(exports, "Volume", { enumerable: true, get: function () { return fs_node_1.Volume; } });
7
+ const fs_node_utils_1 = require("@jsonjoy.com/fs-node-utils");
8
+ const { F_OK, R_OK, W_OK, X_OK } = fs_node_utils_1.constants;
13
9
  // Default volume.
14
- exports.vol = new volume_1.Volume();
10
+ exports.vol = new fs_node_1.Volume();
15
11
  function createFsFromVolume(vol) {
16
- const fs = { F_OK, R_OK, W_OK, X_OK, constants: constants_1.constants, Stats: Stats_1.default, Dirent: Dirent_1.default };
12
+ const fs = { F_OK, R_OK, W_OK, X_OK, constants: fs_node_utils_1.constants, Stats: fs_node_1.Stats, Dirent: fs_node_1.Dirent };
17
13
  // Bind FS methods.
18
- for (const method of fsSynchronousApiList_1.fsSynchronousApiList)
14
+ for (const method of fs_node_1.fsSynchronousApiList)
19
15
  if (typeof vol[method] === 'function')
20
16
  fs[method] = vol[method].bind(vol);
21
- for (const method of fsCallbackApiList_1.fsCallbackApiList)
17
+ for (const method of fs_node_1.fsCallbackApiList)
22
18
  if (typeof vol[method] === 'function')
23
19
  fs[method] = vol[method].bind(vol);
24
20
  fs.StatWatcher = vol.StatWatcher;
@@ -39,7 +35,7 @@ function createFsFromVolume(vol) {
39
35
  fs.realpathSync.native = vol.realpathSync.native.bind(vol);
40
36
  }
41
37
  }
42
- fs._toUnixTimestamp = volume_1.toUnixTimestamp;
38
+ fs._toUnixTimestamp = fs_node_1.toUnixTimestamp;
43
39
  fs.__vol = vol;
44
40
  return fs;
45
41
  }
@@ -55,7 +51,7 @@ exports.fs = createFsFromVolume(exports.vol);
55
51
  * the `fs` module.
56
52
  */
57
53
  const memfs = (json = {}, cwd = '/') => {
58
- const vol = volume_1.Volume.fromNestedJSON(json, cwd);
54
+ const vol = fs_node_1.Volume.fromNestedJSON(json, cwd);
59
55
  const fs = createFsFromVolume(vol);
60
56
  return { fs, vol };
61
57
  };
package/lib/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AA4BA,gDA+BC;AA3DD,wCAAiC;AACjC,0CAAmC;AACnC,0CAA8F;AASjD,uFATpC,eAAM,OASoC;AAPnD,2CAAwC;AAGxC,4EAAyE;AACzE,sEAAmE;AACnE,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,qBAAS,CAAC;AAI7C,kBAAkB;AACL,QAAA,GAAG,GAAG,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AG,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QACrD,CAAC;IACH,CAAC;IACD,IAAI,OAAO,GAAG,CAAC,YAAY,KAAK,UAAU,EAAE,CAAC;QAC3C,EAAE,CAAC,YAAY,GAAG,GAAG,CAAC,YAAY,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QAC7C,IAAI,OAAO,GAAG,CAAC,YAAY,CAAC,MAAM,KAAK,UAAU,EAAE,CAAC;YAClD,EAAE,CAAC,YAAY,CAAC,MAAM,GAAG,GAAG,CAAC,YAAY,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QAC7D,CAAC;IACH,CAAC;IAED,EAAE,CAAC,gBAAgB,GAAG,yBAAe,CAAC;IACrC,EAAU,CAAC,KAAK,GAAG,GAAG,CAAC;IAExB,OAAO,EAAE,CAAC;AACZ,CAAC;AAEY,QAAA,EAAE,GAAQ,kBAAkB,CAAC,WAAG,CAAC,CAAC;AAE/C;;;;;;;;;GASG;AACI,MAAM,KAAK,GAAG,CAAC,OAA4B,EAAE,EAAE,MAAc,GAAG,EAA4B,EAAE;IACnG,MAAM,GAAG,GAAG,gBAAM,CAAC,cAAc,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;IAC7C,MAAM,EAAE,GAAG,kBAAkB,CAAC,GAAG,CAAC,CAAC;IACnC,OAAO,EAAE,EAAE,EAAE,GAAG,EAAE,CAAC;AACrB,CAAC,CAAC;AAJW,QAAA,KAAK,SAIhB;AAKF,MAAM,CAAC,OAAO,GAAG,EAAE,GAAG,MAAM,CAAC,OAAO,EAAE,GAAG,UAAE,EAAE,CAAC;AAC9C,MAAM,CAAC,OAAO,CAAC,QAAQ,GAAG,IAAI,CAAC"}
@@ -1,7 +1 @@
1
- import { NodeFileSystemDirectoryHandle } from './NodeFileSystemDirectoryHandle';
2
- import { NodeFsaContext, NodeFsaFs } from './types';
3
- export * from './types';
4
- export * from './NodeFileSystemHandle';
5
- export * from './NodeFileSystemDirectoryHandle';
6
- export * from './NodeFileSystemFileHandle';
7
- export declare const nodeToFsa: (fs: NodeFsaFs, dirPath: string, ctx?: Partial<NodeFsaContext>) => NodeFileSystemDirectoryHandle;
1
+ export * from '@jsonjoy.com/fs-node-to-fsa';
@@ -1,14 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.nodeToFsa = void 0;
4
3
  const tslib_1 = require("tslib");
5
- const NodeFileSystemDirectoryHandle_1 = require("./NodeFileSystemDirectoryHandle");
6
- tslib_1.__exportStar(require("./types"), exports);
7
- tslib_1.__exportStar(require("./NodeFileSystemHandle"), exports);
8
- tslib_1.__exportStar(require("./NodeFileSystemDirectoryHandle"), exports);
9
- tslib_1.__exportStar(require("./NodeFileSystemFileHandle"), exports);
10
- const nodeToFsa = (fs, dirPath, ctx) => {
11
- return new NodeFileSystemDirectoryHandle_1.NodeFileSystemDirectoryHandle(fs, dirPath, ctx);
12
- };
13
- exports.nodeToFsa = nodeToFsa;
4
+ tslib_1.__exportStar(require("@jsonjoy.com/fs-node-to-fsa"), exports);
14
5
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/node-to-fsa/index.ts"],"names":[],"mappings":";;;;AAAA,mFAAgF;AAGhF,kDAAwB;AACxB,iEAAuC;AACvC,0EAAgD;AAChD,qEAA2C;AAEpC,MAAM,SAAS,GAAG,CACvB,EAAa,EACb,OAAe,EACf,GAA6B,EACE,EAAE;IACjC,OAAO,IAAI,6DAA6B,CAAC,EAAE,EAAE,OAAO,EAAE,GAAG,CAAC,CAAC;AAC7D,CAAC,CAAC;AANW,QAAA,SAAS,aAMpB"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/node-to-fsa/index.ts"],"names":[],"mappings":";;;AAAA,sEAA4C"}
package/package.json CHANGED
@@ -1,6 +1,9 @@
1
1
  {
2
2
  "name": "memfs",
3
- "version": "4.54.0",
3
+ "version": "4.56.1",
4
+ "publishConfig": {
5
+ "access": "public"
6
+ },
4
7
  "description": "In-memory file-system with Node's fs API.",
5
8
  "keywords": [
6
9
  "fs",
@@ -50,94 +53,51 @@
50
53
  "demo/runkit.js"
51
54
  ],
52
55
  "scripts": {
53
- "build": "tsc -p . && rimraf --glob lib/__tests__ 'lib/**/__tests__'",
56
+ "clean": "rimraf lib types typedocs coverage gh-pages yarn-error.log",
57
+ "build": "tsc --project tsconfig.build.json --module commonjs --target es2020 --outDir lib && rimraf --glob lib/__tests__ 'lib/**/__tests__'",
58
+ "jest": "node -r ts-node/register ./node_modules/.bin/jest",
59
+ "test": "jest --maxWorkers 7",
60
+ "test:ci": "yarn jest --maxWorkers 3 --no-cache",
61
+ "coverage": "yarn test --collectCoverage",
62
+ "typecheck": "tsc -p .",
54
63
  "build:webfs": "NODE_ENV=production webpack --config ./src/webfs/webpack.config.js",
55
- "clean": "rimraf lib types typedocs gh-pages coverage",
56
64
  "demo:crud-and-cas": "webpack serve --config ./demo/crud-and-cas/webpack.config.js",
57
65
  "demo:fsa-to-node-sync-tests": "webpack serve --config ./demo/fsa-to-node-sync-tests/webpack.config.js",
58
66
  "demo:fsa-to-node-zipfile": "webpack serve --config ./demo/fsa-to-node-zipfile/webpack.config.js",
59
67
  "demo:git-fsa": "webpack serve --config ./demo/git-fsa/webpack.config.js",
60
68
  "demo:git-opfs": "webpack serve --config ./demo/git-opfs/webpack.config.js",
61
69
  "demo:webfs": "webpack serve --config ./src/webfs/webpack.config.js",
62
- "prettier": "prettier --write .",
63
- "prettier:check": "prettier --check .",
64
- "test": "jest --maxWorkers 2",
65
70
  "test:coverage": "jest --coverage",
66
71
  "test:watch": "jest --watch",
67
72
  "tslint": "tslint \"src/**/*.ts\" -t verbose",
68
- "typecheck": "tsc -p .",
69
73
  "watch": "watch \"npm run build\" ./src",
70
- "coverage": "yarn test --collectCoverage",
71
74
  "typedoc": "npx typedoc@0.25.13 --tsconfig tsconfig.json",
72
75
  "build:pages": "npx rimraf@5.0.5 gh-pages && mkdir -p gh-pages && cp -r typedocs/* gh-pages && cp -r coverage gh-pages/coverage"
73
76
  },
74
- "commitlint": {
75
- "extends": [
76
- "@commitlint/config-conventional"
77
- ]
78
- },
79
- "config": {
80
- "commitizen": {
81
- "path": "git-cz"
82
- }
83
- },
84
- "prettier": {
85
- "arrowParens": "avoid",
86
- "bracketSpacing": true,
87
- "printWidth": 120,
88
- "semi": true,
89
- "singleQuote": true,
90
- "tabWidth": 2,
91
- "trailingComma": "all",
92
- "useTabs": false
93
- },
94
- "release": {
95
- "branches": [
96
- "master",
97
- {
98
- "name": "next",
99
- "prerelease": true
100
- }
101
- ],
102
- "prepare": [
103
- "@semantic-release/changelog",
104
- "@semantic-release/npm",
105
- "@semantic-release/git"
106
- ],
107
- "verifyConditions": [
108
- "@semantic-release/changelog",
109
- "@semantic-release/npm",
110
- "@semantic-release/git"
111
- ]
112
- },
113
77
  "jest": {
78
+ "preset": "ts-jest",
79
+ "testEnvironment": "node",
114
80
  "moduleFileExtensions": [
115
81
  "ts",
116
- "tsx",
117
82
  "js",
118
- "jsx"
83
+ "tsx"
119
84
  ],
120
- "testEnvironment": "node",
121
- "testRegex": ".*/__tests__/.*\\.(test|spec)\\.(jsx?|tsx?)$",
122
85
  "transform": {
123
86
  "^.+\\.tsx?$": "ts-jest"
124
- }
125
- },
126
- "dependencies": {
127
- "@jsonjoy.com/json-pack": "^1.11.0",
128
- "@jsonjoy.com/util": "^1.9.0",
129
- "glob-to-regex.js": "^1.0.1",
130
- "thingies": "^2.5.0",
131
- "tree-dump": "^1.0.3",
132
- "tslib": "^2.0.0"
87
+ },
88
+ "transformIgnorePatterns": [
89
+ ".*/node_modules/.*"
90
+ ],
91
+ "testRegex": ".*/(__tests__|__jest__|demo)/.*\\.(test|spec)\\.tsx?$",
92
+ "rootDir": ".",
93
+ "testPathIgnorePatterns": [
94
+ "node_modules"
95
+ ]
133
96
  },
134
97
  "devDependencies": {
135
- "@semantic-release/changelog": "^6.0.3",
136
- "@semantic-release/git": "^10.0.1",
137
- "@semantic-release/npm": "^13.1.3",
138
98
  "@types/jest": "^29.0.0",
139
99
  "@types/mime": "^3.0.0",
140
- "@types/node": "^24.5.0",
100
+ "@types/node": "^20.0.0",
141
101
  "app-root-path": "^3.1.0",
142
102
  "assert": "^2.0.0",
143
103
  "buffer": "^6.0.3",
@@ -150,7 +110,6 @@
150
110
  "process": "^0.11.10",
151
111
  "readable-stream": "^4.4.0",
152
112
  "rimraf": "^5.0.0",
153
- "semantic-release": "^25.0.2",
154
113
  "tar-stream": "^3.1.2",
155
114
  "ts-jest": "^29.4.2",
156
115
  "ts-loader": "^9.5.4",
@@ -163,5 +122,23 @@
163
122
  "webpack": "^5.87.0",
164
123
  "webpack-cli": "^5.1.4",
165
124
  "webpack-dev-server": "^4.15.1"
125
+ },
126
+ "peerDependencies": {
127
+ "tslib": "2"
128
+ },
129
+ "dependencies": {
130
+ "@jsonjoy.com/fs-core": "4.56.1",
131
+ "@jsonjoy.com/fs-fsa": "4.56.1",
132
+ "@jsonjoy.com/fs-node": "4.56.1",
133
+ "@jsonjoy.com/fs-node-builtins": "4.56.1",
134
+ "@jsonjoy.com/fs-node-to-fsa": "4.56.1",
135
+ "@jsonjoy.com/fs-node-utils": "4.56.1",
136
+ "@jsonjoy.com/fs-print": "4.56.1",
137
+ "@jsonjoy.com/json-pack": "^1.11.0",
138
+ "@jsonjoy.com/util": "^1.9.0",
139
+ "glob-to-regex.js": "^1.0.1",
140
+ "thingies": "^2.5.0",
141
+ "tree-dump": "^1.0.3",
142
+ "tslib": "^2.0.0"
166
143
  }
167
- }
144
+ }