Skip to content

Vendor is-number, fill-range, braces, picomatch, micromatch + Effect-based fast-glob#2

Open
sam-goodwin wants to merge 3 commits into
mainfrom
sam/vendor-glob-stack
Open

Vendor is-number, fill-range, braces, picomatch, micromatch + Effect-based fast-glob#2
sam-goodwin wants to merge 3 commits into
mainfrom
sam/vendor-glob-stack

Conversation

@sam-goodwin
Copy link
Copy Markdown
Contributor

Summary

Vendors the full glob stack into @alchemy.run/node-utils, rewritten in pure TypeScript ESM. The leaf libs (is-number → fill-range → braces → picomatch → micromatch) are direct 1:1 ports with all upstream tests mirrored under bun:test. fast-glob is reimplemented on top of Effect 4 (FileSystem.FileSystem, Path.Path, BunServices.layer), collapsing upstream's readers/ + providers/ + filters/ + transformers/ layering into a single recursive walker.

Layout:

Lib Source Tests
is-number src/is-number.ts 111
fill-range (with to-regex-range inlined) src/fill-range.ts 65
braces src/braces/ (6 files) 875
picomatch src/picomatch/ (5 files) 1,975
micromatch src/micromatch/index.ts 1,953
fast-glob (Effect rewrite) src/fast-glob/ (5 files) 22

Totals: ~5,000 LOC of source ported; 5,001 pass, 1 skip, 0 fail across 86 test files.

The one skipped test is a Node@<10 lookbehind compatibility check that is structurally inapplicable on Bun (we only support Node 22+). The surrounding tests that exercise real lookbehind semantics all pass.

fast-glob API

  • glob(patterns, options)Effect<EntryItem[], …, BunServices>
  • globStream(patterns, options)Stream<EntryItem, …, BunServices>
  • globPromise(patterns, options)Promise<EntryItem[]> (provides BunServices.layer internally — convenience for non-Effect callers)
  • generateTasks / isDynamicPattern — pure helpers

Test harness

test/fast-glob/_test.ts exports a test(name, Effect.gen(...)) wrapper that provides BunServices.layer (FileSystem, Path, Stdio, Terminal, ChildProcessSpawner) per test.

Dependencies

  • effect@4.0.0-beta.66
  • @effect/platform-bun@4.0.0-beta.66
  • @effect/platform-node@4.0.0-beta.66

(No micromatch, glob-parent, @nodelib/*, or merge2 runtime deps — all vendored.)

Test plan

  • `bun test test/is-number.test.ts test/fill-range.test.ts test/braces/ test/picomatch/ test/micromatch/ test/fast-glob/` — 5,001 pass / 1 skip / 0 fail
  • Verify on CI

sam-goodwin and others added 2 commits May 15, 2026 13:39
…/ micromatch + Effect-based fast-glob

Vendors the full glob stack (~5,000 LOC of source) into a single
@alchemy.run/node-utils package, rewritten in pure TypeScript ESM. fast-glob
itself is reimplemented on Effect 4 (FileSystem.FileSystem, Path.Path,
BunServices.layer), collapsing upstream's readers/providers/filters/transformers
into a single walker. Upstream tests are mirrored 1:1 under bun:test —
5,001 pass, 1 skip (a Node@<10 lookbehind compat check we don't need on Bun).

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
…nically-ported tests

Source fixes:
- fill-range: toRegex accepts (string | number)[] (matches range push site)
- fill-range: add strictZeros, shorthand to FillRangeOptions
- picomatch/parse: cast `backslashes` past TS literal-narrowing in fastpath
- bun, sep, etc. via path.sep readonly cast

Test infra:
- tsconfig.test.json: relax strict for mechanically-ported test files
- Add `// @ts-nocheck` header to picomatch/micromatch test ports — they're
  1:1 from upstream JS and bun runs them as-is; type-checking the dynamic
  shim helpers (`equal`, `match`, `assert`-like) adds no value.
- is-number test: ts-nocheck for unary-plus on null/undefined fixtures
- Path.sep mutations rewritten as `(path as any).sep =` in transformer
- Drop duplicate `path` import from generated tests

Tests: 5,001 pass / 1 skip / 0 fail (unchanged).
Build: `bun run build` exits clean.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 15, 2026

Install the package built from this commit:

@alchemy.run/node-utils

bun add https://pkg.ing/@alchemy.run/node-utils/946cd4e

Source already uses import/export and `tsc` emits ESM-shaped `.js` (with
explicit `.js` extensions on relative imports), but Node defaults `.js`
files to CommonJS without `type: module` — so consumers loading the package
under Node would crash on the first `import`. Bun was forgiving.

No code change. Build still clean, 5001 tests pass / 1 skip / 0 fail.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
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.

1 participant