Skip to content

Commit c68fdb0

Browse files
authored
Merge pull request #1232 from streamich/finalize-monorepo
Finalize monorepo
2 parents 78cbd1a + e229748 commit c68fdb0

File tree

271 files changed

+4665
-1479
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

271 files changed

+4665
-1479
lines changed

AGENTS.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@
22
- Use Angular style commits, e.g `feat: implemented xyz`.
33
- Make sure tests (`yarn test`) pass.
44
- In the end, make sure linter and formatter pass.
5+
- Do not every Git commit or push without explicit review by USER.

CONTRIBUTING.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ Yarn workspaces monorepo with packages:
55
## Packages
66

77
- **memfs** - In-memory file system with Node.js `fs` API
8-
- **node-fs-dependencies** - Node.js standard library polyfills (fs, events, stream)
9-
- **node-fs-utils** - Utility types and helpers for `fs` operations
8+
- **fs-node-builtins** - Node.js standard library polyfills (fs, events, stream)
9+
- **fs-node-utils** - Utility types and helpers for `fs` operations
1010

1111
## Common Commands
1212

packages/fs-core/README.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# @jsonjoy.com/fs-core
2+
3+
Core filesystem primitives for building in-memory and virtual filesystems.
4+
5+
## Overview
6+
7+
This package provides the core data structures for representing a virtual filesystem:
8+
9+
- **Node** - Represents an i-node (index node), containing file data and metadata
10+
- **Link** - Represents a hard link pointing to a Node
11+
- **File** - Represents an open file descriptor
12+
- **Superblock** - The root of a virtual filesystem, managing nodes and links
13+
14+
## Installation
15+
16+
```bash
17+
npm install @jsonjoy.com/fs-core
18+
```
19+
20+
## Usage
21+
22+
```typescript
23+
import { Superblock, DirectoryJSON } from '@jsonjoy.com/fs-core';
24+
25+
// Create a new filesystem
26+
const fs = new Superblock();
27+
28+
// Or create from a JSON structure
29+
const json: DirectoryJSON = {
30+
'/file.txt': 'Hello, World!',
31+
'/dir/nested.txt': 'Nested content',
32+
};
33+
const fs = Superblock.fromJSON(json);
34+
```
File renamed without changes.

packages/fs-core/package.json

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
{
2+
"name": "@jsonjoy.com/fs-core",
3+
"publishConfig": {
4+
"access": "public"
5+
},
6+
"version": "4.55.0",
7+
"description": "Core filesystem primitives: Node, Link, File, Superblock",
8+
"author": {
9+
"name": "streamich",
10+
"url": "https://github.com/streamich"
11+
},
12+
"homepage": "https://github.com/streamich/memfs/tree/master/packages/fs-core",
13+
"repository": "streamich/memfs",
14+
"license": "Apache-2.0",
15+
"funding": {
16+
"type": "github",
17+
"url": "https://github.com/sponsors/streamich"
18+
},
19+
"keywords": [
20+
"node",
21+
"fs",
22+
"filesystem",
23+
"inode",
24+
"link",
25+
"file",
26+
"superblock",
27+
"virtual",
28+
"memory"
29+
],
30+
"engines": {
31+
"node": ">=10.0"
32+
},
33+
"main": "lib/index.js",
34+
"types": "lib/index.d.ts",
35+
"typings": "lib/index.d.ts",
36+
"files": [
37+
"LICENSE",
38+
"lib/"
39+
],
40+
"scripts": {
41+
"clean": "rimraf lib typedocs coverage gh-pages yarn-error.log",
42+
"build": "tsc --project tsconfig.build.json --module commonjs --target es2020 --outDir lib",
43+
"jest": "node -r ts-node/register ./node_modules/.bin/jest",
44+
"test": "jest --maxWorkers 7",
45+
"test:ci": "yarn jest --maxWorkers 3 --no-cache",
46+
"coverage": "yarn test --collectCoverage",
47+
"typedoc": "typedoc",
48+
"typecheck": "tsc -p ."
49+
},
50+
"jest": {
51+
"preset": "ts-jest",
52+
"testEnvironment": "node",
53+
"moduleFileExtensions": [
54+
"ts",
55+
"js",
56+
"tsx"
57+
],
58+
"transform": {
59+
"^.+\\.tsx?$": "ts-jest"
60+
},
61+
"transformIgnorePatterns": [
62+
".*/node_modules/.*"
63+
],
64+
"testRegex": ".*/(__tests__|__jest__|demo)/.*\\.(test|spec)\\.tsx?$",
65+
"rootDir": ".",
66+
"testPathIgnorePatterns": [
67+
"node_modules"
68+
]
69+
},
70+
"devDependencies": {
71+
"@types/jest": "^29.0.0",
72+
"@types/node": "^20.0.0",
73+
"jest": "^29.0.0",
74+
"rimraf": "^5.0.0",
75+
"ts-jest": "^29.4.2",
76+
"ts-node": "^10.9.2",
77+
"typescript": "^5.9.2"
78+
},
79+
"peerDependencies": {
80+
"tslib": "2"
81+
},
82+
"dependencies": {
83+
"@jsonjoy.com/fs-node-builtins": "workspace:*",
84+
"@jsonjoy.com/fs-node-utils": "workspace:*",
85+
"thingies": "^2.5.0"
86+
}
87+
}
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { constants } from '../constants';
2-
import { Buffer } from '../vendor/node/internal/buffer';
1+
import { constants } from '@jsonjoy.com/fs-node-utils';
2+
import { Buffer } from '@jsonjoy.com/fs-node-builtins/lib/internal/buffer';
33
import type { Link } from './Link';
44
import type { Node } from './Node';
55

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { constants, PATH } from '../constants';
1+
import { constants, PATH } from '@jsonjoy.com/fs-node-utils';
22
import { FanOut } from 'thingies/lib/fanout';
33
import type { Node } from './Node';
44
import type { Superblock } from './Superblock';
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { FanOut } from 'thingies/lib/fanout';
2-
import process from '../process';
3-
import { Buffer, bufferAllocUnsafe, bufferFrom } from '../vendor/node/internal/buffer';
4-
import { constants, S } from '../constants';
2+
import process from './process';
3+
import { Buffer, bufferAllocUnsafe, bufferFrom } from '@jsonjoy.com/fs-node-builtins/lib/internal/buffer';
4+
import { constants, S } from '@jsonjoy.com/fs-node-utils';
55

66
export type NodeEventModify = [type: 'modify'];
77

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,23 @@
1-
import { sep, relative, join, dirname, isAbsolute, basename, posix } from '../vendor/node/path';
1+
import { sep, relative, join, dirname, isAbsolute, basename, posix } from '@jsonjoy.com/fs-node-builtins/lib/path';
22
import { Node } from './Node';
33
import { Link } from './Link';
44
import { File } from './File';
5-
import { Buffer } from '../vendor/node/internal/buffer';
6-
import process from '../process';
7-
import { constants } from '../constants';
8-
import { ERRSTR, FLAGS, MODE } from '../node/constants';
9-
import { pathToFilename, createError, createStatError } from '../node/util';
10-
import { dataToBuffer, filenameToSteps, isFd, resolve, validateFd } from './util';
5+
import { Buffer } from '@jsonjoy.com/fs-node-builtins/lib/internal/buffer';
6+
import process from './process';
7+
import { constants } from '@jsonjoy.com/fs-node-utils';
8+
import { ERRSTR, FLAGS, MODE } from '@jsonjoy.com/fs-node-utils';
9+
import {
10+
pathToFilename,
11+
createError,
12+
createStatError,
13+
dataToBuffer,
14+
filenameToSteps,
15+
isFd,
16+
resolve,
17+
validateFd,
18+
} from './util';
1119
import { DirectoryJSON, flattenJSON, NestedDirectoryJSON } from './json';
12-
import type { PathLike } from '../node/types/misc';
20+
import type { PathLike } from '@jsonjoy.com/fs-node-utils/lib/types/misc';
1321
import { ERROR_CODE } from './constants';
1422
import { TFileId, StatError } from './types';
1523
import { Err, Ok, Result } from './result';

0 commit comments

Comments
 (0)