Skip to content

Separate middleware context from stream instance#55

Open
jamilahmadzai wants to merge 1 commit into
egoist:masterfrom
jamilahmadzai:jamil/majo-context-12
Open

Separate middleware context from stream instance#55
jamilahmadzai wants to merge 1 commit into
egoist:masterfrom
jamilahmadzai:jamil/majo-context-12

Conversation

@jamilahmadzai
Copy link
Copy Markdown

@jamilahmadzai jamilahmadzai commented May 24, 2026

Fixes #12.

This separates the middleware-facing context from the public Majo stream instance while keeping the existing fluent stream API intact. Middleware now receives a smaller MajoContext with file helpers, files, meta, and baseDir; source/dest/process/use stay on the outer stream.

What changed:

  • added MajoContext and made middleware run against that context instead of the stream instance
  • preserved queued pre-process helpers such as filter, transform, rename, createFile, deleteFile, and writeContents
  • copied middleware meta and processed files back to the stream after process()
  • avoided dependency or lockfile changes

Coverage added:

  • middleware context is not the Majo stream and does not expose source/dest/process
  • queued file operations keep order across sync and async transforms
  • ctx.filter() still works inside middleware
  • reassigned ctx.meta is preserved on the stream
  • rename works before dest() and helpers still work after process() without reprocessing

Validation:

  • corepack yarn install --frozen-lockfile
  • corepack yarn test --runInBand (11 passed)
  • corepack yarn build
  • git diff --check

IssueHunt payout note:


IssueHunt Summary

Referenced issues

This pull request has been submitted to:


@vercel
Copy link
Copy Markdown

vercel Bot commented May 24, 2026

@jamilahmadzai is attempting to deploy a commit to the EGOIST's projects Team on Vercel.

A member of the Team first needs to authorize it.

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.

Separate the majo instance and middleware context

1 participant