Vendor is-number, fill-range, braces, picomatch, micromatch + Effect-based fast-glob#2
Open
sam-goodwin wants to merge 3 commits into
Open
Vendor is-number, fill-range, braces, picomatch, micromatch + Effect-based fast-glob#2sam-goodwin wants to merge 3 commits into
sam-goodwin wants to merge 3 commits into
Conversation
…/ 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>
|
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 underbun:test.fast-globis reimplemented on top of Effect 4 (FileSystem.FileSystem,Path.Path,BunServices.layer), collapsing upstream'sreaders/+providers/+filters/+transformers/layering into a single recursive walker.Layout:
is-numbersrc/is-number.tsfill-range(withto-regex-rangeinlined)src/fill-range.tsbracessrc/braces/(6 files)picomatchsrc/picomatch/(5 files)micromatchsrc/micromatch/index.tsfast-glob(Effect rewrite)src/fast-glob/(5 files)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[]>(providesBunServices.layerinternally — convenience for non-Effect callers)generateTasks/isDynamicPattern— pure helpersTest harness
test/fast-glob/_test.tsexports atest(name, Effect.gen(...))wrapper that providesBunServices.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/*, ormerge2runtime deps — all vendored.)Test plan