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.
- package/LICENSE +1 -1
- package/README.md +57 -30
- package/demo/fsa-to-node-sync-tests/README.md +19 -0
- package/demo/fsa-to-node-zipfile/README.md +17 -0
- package/demo/git/README.md +16 -0
- package/demo/git-fsa/README.md +18 -0
- package/demo/git-opfs/README.md +20 -0
- package/lib/fsa/index.d.ts +1 -33
- package/lib/fsa/index.js +1 -39
- package/lib/fsa/index.js.map +1 -1
- package/lib/fsa-to-node/index.d.ts +1 -2
- package/lib/fsa-to-node/index.js +2 -5
- package/lib/fsa-to-node/index.js.map +1 -1
- package/lib/index.d.ts +6 -7
- package/lib/index.js +10 -14
- package/lib/index.js.map +1 -1
- package/lib/node-to-fsa/index.d.ts +1 -7
- package/lib/node-to-fsa/index.js +1 -10
- package/lib/node-to-fsa/index.js.map +1 -1
- package/package.json +43 -66
- package/lib/constants.d.ts +0 -67
- package/lib/constants.js +0 -54
- package/lib/constants.js.map +0 -1
- package/lib/consts/AMODE.d.ts +0 -9
- package/lib/consts/AMODE.js +0 -3
- package/lib/consts/AMODE.js.map +0 -1
- package/lib/consts/FLAG.d.ts +0 -53
- package/lib/consts/FLAG.js +0 -36
- package/lib/consts/FLAG.js.map +0 -1
- package/lib/core/File.d.ts +0 -39
- package/lib/core/File.js +0 -72
- package/lib/core/File.js.map +0 -1
- package/lib/core/Link.d.ts +0 -38
- package/lib/core/Link.js +0 -105
- package/lib/core/Link.js.map +0 -1
- package/lib/core/Node.d.ts +0 -85
- package/lib/core/Node.js +0 -287
- package/lib/core/Node.js.map +0 -1
- package/lib/core/Superblock.d.ts +0 -92
- package/lib/core/Superblock.js +0 -689
- package/lib/core/Superblock.js.map +0 -1
- package/lib/core/constants.d.ts +0 -15
- package/lib/core/constants.js +0 -3
- package/lib/core/constants.js.map +0 -1
- package/lib/core/index.d.ts +0 -6
- package/lib/core/index.js +0 -15
- package/lib/core/index.js.map +0 -1
- package/lib/core/json.d.ts +0 -9
- package/lib/core/json.js +0 -35
- package/lib/core/json.js.map +0 -1
- package/lib/core/result.d.ts +0 -11
- package/lib/core/result.js +0 -11
- package/lib/core/result.js.map +0 -1
- package/lib/core/types.d.ts +0 -8
- package/lib/core/types.js +0 -3
- package/lib/core/types.js.map +0 -1
- package/lib/core/util.d.ts +0 -12
- package/lib/core/util.js +0 -74
- package/lib/core/util.js.map +0 -1
- package/lib/encoding.d.ts +0 -6
- package/lib/encoding.js +0 -20
- package/lib/encoding.js.map +0 -1
- package/lib/fsa/CoreFileSystemDirectoryHandle.d.ts +0 -73
- package/lib/fsa/CoreFileSystemDirectoryHandle.js +0 -265
- package/lib/fsa/CoreFileSystemDirectoryHandle.js.map +0 -1
- package/lib/fsa/CoreFileSystemFileHandle.d.ts +0 -25
- package/lib/fsa/CoreFileSystemFileHandle.js +0 -75
- package/lib/fsa/CoreFileSystemFileHandle.js.map +0 -1
- package/lib/fsa/CoreFileSystemHandle.d.ts +0 -34
- package/lib/fsa/CoreFileSystemHandle.js +0 -53
- package/lib/fsa/CoreFileSystemHandle.js.map +0 -1
- package/lib/fsa/CoreFileSystemObserver.d.ts +0 -10
- package/lib/fsa/CoreFileSystemObserver.js +0 -18
- package/lib/fsa/CoreFileSystemObserver.js.map +0 -1
- package/lib/fsa/CoreFileSystemSyncAccessHandle.d.ts +0 -38
- package/lib/fsa/CoreFileSystemSyncAccessHandle.js +0 -123
- package/lib/fsa/CoreFileSystemSyncAccessHandle.js.map +0 -1
- package/lib/fsa/CoreFileSystemWritableFileStream.d.ts +0 -32
- package/lib/fsa/CoreFileSystemWritableFileStream.js +0 -163
- package/lib/fsa/CoreFileSystemWritableFileStream.js.map +0 -1
- package/lib/fsa/CorePermissionStatus.d.ts +0 -9
- package/lib/fsa/CorePermissionStatus.js +0 -14
- package/lib/fsa/CorePermissionStatus.js.map +0 -1
- package/lib/fsa/FileLockManager.d.ts +0 -7
- package/lib/fsa/FileLockManager.js +0 -26
- package/lib/fsa/FileLockManager.js.map +0 -1
- package/lib/fsa/types.d.ts +0 -182
- package/lib/fsa/types.js +0 -3
- package/lib/fsa/types.js.map +0 -1
- package/lib/fsa/util.d.ts +0 -12
- package/lib/fsa/util.js +0 -45
- package/lib/fsa/util.js.map +0 -1
- package/lib/fsa-to-node/FsaNodeCore.d.ts +0 -33
- package/lib/fsa-to-node/FsaNodeCore.js +0 -191
- package/lib/fsa-to-node/FsaNodeCore.js.map +0 -1
- package/lib/fsa-to-node/FsaNodeDirent.d.ts +0 -19
- package/lib/fsa-to-node/FsaNodeDirent.js +0 -39
- package/lib/fsa-to-node/FsaNodeDirent.js.map +0 -1
- package/lib/fsa-to-node/FsaNodeFs.d.ts +0 -187
- package/lib/fsa-to-node/FsaNodeFs.js +0 -831
- package/lib/fsa-to-node/FsaNodeFs.js.map +0 -1
- package/lib/fsa-to-node/FsaNodeFsOpenFile.d.ts +0 -24
- package/lib/fsa-to-node/FsaNodeFsOpenFile.js +0 -37
- package/lib/fsa-to-node/FsaNodeFsOpenFile.js.map +0 -1
- package/lib/fsa-to-node/FsaNodeReadStream.d.ts +0 -23
- package/lib/fsa-to-node/FsaNodeReadStream.js +0 -92
- package/lib/fsa-to-node/FsaNodeReadStream.js.map +0 -1
- package/lib/fsa-to-node/FsaNodeStats.d.ts +0 -30
- package/lib/fsa-to-node/FsaNodeStats.js +0 -53
- package/lib/fsa-to-node/FsaNodeStats.js.map +0 -1
- package/lib/fsa-to-node/FsaNodeWriteStream.d.ts +0 -47
- package/lib/fsa-to-node/FsaNodeWriteStream.js +0 -150
- package/lib/fsa-to-node/FsaNodeWriteStream.js.map +0 -1
- package/lib/fsa-to-node/constants.d.ts +0 -3
- package/lib/fsa-to-node/constants.js +0 -3
- package/lib/fsa-to-node/constants.js.map +0 -1
- package/lib/fsa-to-node/json.d.ts +0 -2
- package/lib/fsa-to-node/json.js +0 -7
- package/lib/fsa-to-node/json.js.map +0 -1
- package/lib/fsa-to-node/types.d.ts +0 -37
- package/lib/fsa-to-node/types.js +0 -3
- package/lib/fsa-to-node/types.js.map +0 -1
- package/lib/fsa-to-node/util.d.ts +0 -4
- package/lib/fsa-to-node/util.js +0 -34
- package/lib/fsa-to-node/util.js.map +0 -1
- package/lib/fsa-to-node/worker/FsaNodeSyncAdapterWorker.d.ts +0 -10
- package/lib/fsa-to-node/worker/FsaNodeSyncAdapterWorker.js +0 -62
- package/lib/fsa-to-node/worker/FsaNodeSyncAdapterWorker.js.map +0 -1
- package/lib/fsa-to-node/worker/FsaNodeSyncWorker.d.ts +0 -20
- package/lib/fsa-to-node/worker/FsaNodeSyncWorker.js +0 -178
- package/lib/fsa-to-node/worker/FsaNodeSyncWorker.js.map +0 -1
- package/lib/fsa-to-node/worker/SyncMessenger.d.ts +0 -24
- package/lib/fsa-to-node/worker/SyncMessenger.js +0 -72
- package/lib/fsa-to-node/worker/SyncMessenger.js.map +0 -1
- package/lib/fsa-to-node/worker/constants.d.ts +0 -8
- package/lib/fsa-to-node/worker/constants.js +0 -3
- package/lib/fsa-to-node/worker/constants.js.map +0 -1
- package/lib/fsa-to-node/worker/types.d.ts +0 -17
- package/lib/fsa-to-node/worker/types.js +0 -3
- package/lib/fsa-to-node/worker/types.js.map +0 -1
- package/lib/node/Dir.d.ts +0 -26
- package/lib/node/Dir.js +0 -186
- package/lib/node/Dir.js.map +0 -1
- package/lib/node/Dirent.d.ts +0 -26
- package/lib/node/Dirent.js +0 -57
- package/lib/node/Dirent.js.map +0 -1
- package/lib/node/FileHandle.d.ts +0 -52
- package/lib/node/FileHandle.js +0 -189
- package/lib/node/FileHandle.js.map +0 -1
- package/lib/node/FsPromises.d.ts +0 -91
- package/lib/node/FsPromises.js +0 -161
- package/lib/node/FsPromises.js.map +0 -1
- package/lib/node/StatFs.d.ts +0 -19
- package/lib/node/StatFs.js +0 -34
- package/lib/node/StatFs.js.map +0 -1
- package/lib/node/Stats.d.ts +0 -41
- package/lib/node/Stats.js +0 -72
- package/lib/node/Stats.js.map +0 -1
- package/lib/node/constants.d.ts +0 -41
- package/lib/node/constants.js +0 -57
- package/lib/node/constants.js.map +0 -1
- package/lib/node/glob.d.ts +0 -5
- package/lib/node/glob.js +0 -94
- package/lib/node/glob.js.map +0 -1
- package/lib/node/lists/fsCallbackApiList.d.ts +0 -2
- package/lib/node/lists/fsCallbackApiList.js +0 -55
- package/lib/node/lists/fsCallbackApiList.js.map +0 -1
- package/lib/node/lists/fsCommonObjectsList.d.ts +0 -2
- package/lib/node/lists/fsCommonObjectsList.js +0 -19
- package/lib/node/lists/fsCommonObjectsList.js.map +0 -1
- package/lib/node/lists/fsSynchronousApiList.d.ts +0 -2
- package/lib/node/lists/fsSynchronousApiList.js +0 -49
- package/lib/node/lists/fsSynchronousApiList.js.map +0 -1
- package/lib/node/options.d.ts +0 -27
- package/lib/node/options.js +0 -112
- package/lib/node/options.js.map +0 -1
- package/lib/node/types/FsCallbackApi.d.ts +0 -143
- package/lib/node/types/FsCallbackApi.js +0 -3
- package/lib/node/types/FsCallbackApi.js.map +0 -1
- package/lib/node/types/FsCommonObjects.d.ts +0 -17
- package/lib/node/types/FsCommonObjects.js +0 -3
- package/lib/node/types/FsCommonObjects.js.map +0 -1
- package/lib/node/types/FsPromisesApi.d.ts +0 -41
- package/lib/node/types/FsPromisesApi.js +0 -3
- package/lib/node/types/FsPromisesApi.js.map +0 -1
- package/lib/node/types/FsSynchronousApi.d.ts +0 -114
- package/lib/node/types/FsSynchronousApi.js +0 -3
- package/lib/node/types/FsSynchronousApi.js.map +0 -1
- package/lib/node/types/index.d.ts +0 -7
- package/lib/node/types/index.js +0 -3
- package/lib/node/types/index.js.map +0 -1
- package/lib/node/types/misc.d.ts +0 -157
- package/lib/node/types/misc.js +0 -3
- package/lib/node/types/misc.js.map +0 -1
- package/lib/node/types/options.d.ts +0 -191
- package/lib/node/types/options.js +0 -3
- package/lib/node/types/options.js.map +0 -1
- package/lib/node/util.d.ts +0 -21
- package/lib/node/util.js +0 -297
- package/lib/node/util.js.map +0 -1
- package/lib/node/volume.d.ts +0 -395
- package/lib/node/volume.js +0 -1641
- package/lib/node/volume.js.map +0 -1
- package/lib/node-to-fsa/NodeFileSystemDirectoryHandle.d.ts +0 -72
- package/lib/node-to-fsa/NodeFileSystemDirectoryHandle.js +0 -217
- package/lib/node-to-fsa/NodeFileSystemDirectoryHandle.js.map +0 -1
- package/lib/node-to-fsa/NodeFileSystemFileHandle.d.ts +0 -28
- package/lib/node-to-fsa/NodeFileSystemFileHandle.js +0 -70
- package/lib/node-to-fsa/NodeFileSystemFileHandle.js.map +0 -1
- package/lib/node-to-fsa/NodeFileSystemHandle.d.ts +0 -37
- package/lib/node-to-fsa/NodeFileSystemHandle.js +0 -68
- package/lib/node-to-fsa/NodeFileSystemHandle.js.map +0 -1
- package/lib/node-to-fsa/NodeFileSystemSyncAccessHandle.d.ts +0 -42
- package/lib/node-to-fsa/NodeFileSystemSyncAccessHandle.js +0 -97
- package/lib/node-to-fsa/NodeFileSystemSyncAccessHandle.js.map +0 -1
- package/lib/node-to-fsa/NodeFileSystemWritableFileStream.d.ts +0 -56
- package/lib/node-to-fsa/NodeFileSystemWritableFileStream.js +0 -191
- package/lib/node-to-fsa/NodeFileSystemWritableFileStream.js.map +0 -1
- package/lib/node-to-fsa/NodePermissionStatus.d.ts +0 -8
- package/lib/node-to-fsa/NodePermissionStatus.js +0 -14
- package/lib/node-to-fsa/NodePermissionStatus.js.map +0 -1
- package/lib/node-to-fsa/types.d.ts +0 -18
- package/lib/node-to-fsa/types.js +0 -3
- package/lib/node-to-fsa/types.js.map +0 -1
- package/lib/node-to-fsa/util.d.ts +0 -12
- package/lib/node-to-fsa/util.js +0 -45
- package/lib/node-to-fsa/util.js.map +0 -1
- package/lib/node.d.ts +0 -3
- package/lib/node.js +0 -10
- package/lib/node.js.map +0 -1
- package/lib/print/index.d.ts +0 -9
- package/lib/print/index.js +0 -49
- package/lib/print/index.js.map +0 -1
- package/lib/process.d.ts +0 -11
- package/lib/process.js +0 -40
- package/lib/process.js.map +0 -1
- package/lib/queueMicrotask.d.ts +0 -2
- package/lib/queueMicrotask.js +0 -6
- package/lib/queueMicrotask.js.map +0 -1
- package/lib/setTimeoutUnref.d.ts +0 -7
- package/lib/setTimeoutUnref.js +0 -14
- package/lib/setTimeoutUnref.js.map +0 -1
- package/lib/snapshot/async.d.ts +0 -3
- package/lib/snapshot/async.js +0 -59
- package/lib/snapshot/async.js.map +0 -1
- package/lib/snapshot/binary.d.ts +0 -6
- package/lib/snapshot/binary.js +0 -31
- package/lib/snapshot/binary.js.map +0 -1
- package/lib/snapshot/constants.d.ts +0 -5
- package/lib/snapshot/constants.js +0 -3
- package/lib/snapshot/constants.js.map +0 -1
- package/lib/snapshot/index.d.ts +0 -5
- package/lib/snapshot/index.js +0 -8
- package/lib/snapshot/index.js.map +0 -1
- package/lib/snapshot/json.d.ts +0 -10
- package/lib/snapshot/json.js +0 -31
- package/lib/snapshot/json.js.map +0 -1
- package/lib/snapshot/shared.d.ts +0 -2
- package/lib/snapshot/shared.js +0 -6
- package/lib/snapshot/shared.js.map +0 -1
- package/lib/snapshot/sync.d.ts +0 -3
- package/lib/snapshot/sync.js +0 -59
- package/lib/snapshot/sync.js.map +0 -1
- package/lib/snapshot/types.d.ts +0 -30
- package/lib/snapshot/types.js +0 -3
- package/lib/snapshot/types.js.map +0 -1
- package/lib/vendor/node/buffer.d.ts +0 -1
- package/lib/vendor/node/buffer.js +0 -6
- package/lib/vendor/node/buffer.js.map +0 -1
- package/lib/vendor/node/events.d.ts +0 -1
- package/lib/vendor/node/events.js +0 -6
- package/lib/vendor/node/events.js.map +0 -1
- package/lib/vendor/node/fs.d.ts +0 -6
- package/lib/vendor/node/fs.js +0 -4
- package/lib/vendor/node/fs.js.map +0 -1
- package/lib/vendor/node/internal/buffer.d.ts +0 -9
- package/lib/vendor/node/internal/buffer.js +0 -13
- package/lib/vendor/node/internal/buffer.js.map +0 -1
- package/lib/vendor/node/internal/errors.d.ts +0 -31
- package/lib/vendor/node/internal/errors.js +0 -77
- package/lib/vendor/node/internal/errors.js.map +0 -1
- package/lib/vendor/node/path.d.ts +0 -1
- package/lib/vendor/node/path.js +0 -14
- package/lib/vendor/node/path.js.map +0 -1
- package/lib/vendor/node/stream.d.ts +0 -1
- package/lib/vendor/node/stream.js +0 -7
- package/lib/vendor/node/stream.js.map +0 -1
- package/lib/vendor/node/url.d.ts +0 -1
- package/lib/vendor/node/url.js +0 -6
- package/lib/vendor/node/url.js.map +0 -1
- package/lib/vendor/node/util.d.ts +0 -20
- package/lib/vendor/node/util.js +0 -112
- 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
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
##
|
|
14
|
+
## Installation
|
|
11
15
|
|
|
12
|
-
```
|
|
13
|
-
npm
|
|
16
|
+
```bash
|
|
17
|
+
npm install memfs
|
|
14
18
|
```
|
|
15
19
|
|
|
16
|
-
##
|
|
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
|
-
|
|
19
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
[
|
|
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 — virtual file system built into browsers.
|
|
9
|
+
- Native File System Access API folder — 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
|
+

|
|
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.
|
package/lib/fsa/index.d.ts
CHANGED
|
@@ -1,33 +1 @@
|
|
|
1
|
-
|
|
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
|
-
|
|
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
|
package/lib/fsa/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/fsa/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/fsa/index.ts"],"names":[],"mappings":";;;AAAA,8DAAoC"}
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
export
|
|
2
|
-
export { FsaNodeSyncAdapterWorker } from './worker/FsaNodeSyncAdapterWorker';
|
|
1
|
+
export * from '@jsonjoy.com/fs-fsa-to-node';
|
package/lib/fsa-to-node/index.js
CHANGED
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
|
|
4
|
-
|
|
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,
|
|
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 '
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import type
|
|
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
|
|
6
|
-
|
|
7
|
-
const
|
|
8
|
-
|
|
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
|
|
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:
|
|
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
|
|
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
|
|
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 =
|
|
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 =
|
|
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":";;;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"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"}
|
|
@@ -1,7 +1 @@
|
|
|
1
|
-
|
|
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';
|
package/lib/node-to-fsa/index.js
CHANGED
|
@@ -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
|
-
|
|
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":"
|
|
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.
|
|
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
|
-
"
|
|
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
|
-
"
|
|
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
|
-
|
|
127
|
-
|
|
128
|
-
"
|
|
129
|
-
"
|
|
130
|
-
"
|
|
131
|
-
|
|
132
|
-
|
|
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": "^
|
|
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
|
+
}
|