Skip to content

feat: 🎸 add event emission to fs-core#1262

Merged
streamich merged 4 commits into
masterfrom
fs-core-events
Jul 6, 2026
Merged

feat: 🎸 add event emission to fs-core#1262
streamich merged 4 commits into
masterfrom
fs-core-events

Conversation

@streamich

Copy link
Copy Markdown
Owner

No description provided.

Copilot AI review requested due to automatic review settings July 6, 2026 12:48

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR introduces a filesystem-change event mechanism in fs-core (via Superblock.onchange) and routes several mutation operations through Superblock so that key write/metadata operations can consistently emit CREATE/DELETE/MODIFY/MOVE events across higher-level adapters.

Changes:

  • Add FsEvent/FsEventType and export them from @jsonjoy.com/fs-core.
  • Implement Superblock.onchange and emit events for create/delete/modify/move across multiple core operations (including new ftruncate/fchmod/chmod/lchmod/fchown/chown/lchown/futimes/utimes helpers).
  • Update fs-node Volume and fs-fsa adapters to call the new Superblock mutation helpers so event emission occurs centrally.

Reviewed changes

Copilot reviewed 6 out of 7 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
packages/fs-node/src/volume.ts Routes several FD/path mutation ops through Superblock so they can emit events consistently.
packages/fs-fsa/src/CoreFileSystemWritableFileStream.ts Switches truncate to operate via FD + Superblock.ftruncate to enable core-level event emission.
packages/fs-fsa/src/CoreFileSystemSyncAccessHandle.ts Switches truncate to Superblock.ftruncate using the ensured-open FD.
packages/fs-core/src/watch/FsEvent.ts Adds the event payload/type used by the new watcher hook.
packages/fs-core/src/Superblock.ts Introduces onchange + emits FsEvents across core operations; adds helper APIs for metadata/time updates.
packages/fs-core/src/index.ts Re-exports the new watcher event types from the package entrypoint.
.gitignore Ignores .docs/ directory.

Comment on lines +10 to +17
export class FsEvent {
constructor(
public readonly type: FsEventType,
public readonly steps: string[],
public readonly node: Node,
public readonly oldSteps: string[] | undefined = void 0,
) {}
}
Comment on lines +105 to +109
public onchange?: (event: FsEvent) => void;

protected emit(change: FsEvent) {
if (this.onchange) this.onchange(change);
}

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 7 out of 8 changed files in this pull request and generated 4 comments.

Comment thread packages/fs-core/src/Superblock.ts
Comment thread packages/fs-core/src/Superblock.ts
Comment thread packages/fs-core/src/Superblock.ts
Comment thread packages/fs-node/src/volume.ts

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 7 out of 8 changed files in this pull request and generated 1 comment.

Comment thread packages/fs-core/src/Superblock.ts
@streamich streamich merged commit ebbcbcc into master Jul 6, 2026
9 checks passed
@streamich streamich deleted the fs-core-events branch July 6, 2026 14:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants