Skip to content

feat(plugin)!: drop ast/filename, cache rebuilds, fix error lines - #41

Merged
johnie merged 4 commits into
masterfrom
feature/updates-2026-10-16
Oct 16, 2026
Merged

johnie merged 4 commits into
masterfrom
feature/updates-2026-10-16

Conversation

@johnie

@johnie johnie commented Oct 16, 2026 •

Copy link
Copy Markdown
Owner

What

  • chore(ci): bump GitHub Actions and Node to 24.21.0
  • chore: migrate from Biome to oxlint and oxfmt via Ultracite
  • feat(plugin)!: drop ast/filename, cache rebuilds, fix error lines
  • docs(agents): rewrite AGENTS.md for this repo

Why

pnpm check failed after the Ultracite/oxlint migration. Fixing it turned up several plugin bugs: error lines were off by one, two options were broken, and every rebuild recompiled every file.

How

Plugin (src/index.ts)

  • Caches compiled output per file for the life of a build context and recompiles only when the source changes. In a 301-file bench, context.rebuild() went from ~2.4s to 22–29ms.
  • Reports location.line 1-based, which esbuild expects (CoffeeScript's is 0-based). An error on line 3 used to show as :2:8.
  • Removes ast: it returned an AST object, which esbuild rejects with "contents" must be a string.
  • Removes filename: a plugin-level value replaced every file's path in errors and source maps. Each file's own path is always used now.
  • Replaces the unsafe casts with a type guard for CoffeeScript syntax errors. transpile is now typed from @types/coffeescript (Babel TransformOptions).

Tooling

  • tsconfig.json type-checks src and test without emitting; tsconfig.build.json emits dist. ci now runs typecheck.
  • require-unicode-regexp is off for src/**. esbuild filters run on Go's RE2, which rejects the (?u) flag group esbuild generates from the u flag (confirmed at runtime).
  • The agent hook now runs ultracite fix --hook; the old Biome-only --skip flag broke it. Removed the duplicate whole-repo pnpm run fix lefthook job.
  • @types/coffeescript moved to dependencies, since the published .d.ts references it. esbuild is now a pinned devDependency.

Changes

  • Changeset: major (3.1.0 → 4.0.0), .changeset/remove-broken-options.md
  • README: v3→v4 migration notes, accurate error-output example, note on rebuild caching
  • CONTRIBUTING: oxlint/oxfmt and the typecheck script
  • AGENTS.md: replaced the generic Ultracite boilerplate with this repo's commands, stack gotchas, layout, code style, git workflow and always / ask first / never boundaries

Testing

  • pnpm run ci passes: check, typecheck, 9 tests, build.
  • New test: a changed file is recompiled on context.rebuild().
  • The error-location fixture now has its error on line 3, so the test checks a real line number.
  • Removed two tests: one only exercised the CoffeeScript compiler, and the bare: false test duplicated the default-options test.

Deployment

  • Merging triggers release.yml, which opens a "Version Packages" PR for 4.0.0. Merging that PR publishes to npm.
  • ast is removed only from the TypeScript types. Plain-JS callers who still pass it fail exactly as before.

Splits tsconfig so tests are type-checked (tsconfig.json, noEmit) while
tsconfig.build.json emits dist, and adds a typecheck step to ci. Moves
@types/coffeescript to dependencies because the published .d.ts now
references CoffeeScript's option types, and pins esbuild as a devDependency.
- Remove the ast and filename options: ast returned an object esbuild
  rejects, and filename replaced every file's path in errors/source maps.
- Report 1-based error lines (esbuild) instead of CoffeeScript's 0-based.
- Cache compiled output per file within a build context; a 301-file
  rebuild drops from ~2.4s to ~25ms.
- Narrow CoffeeScript syntax errors with a type guard instead of casts.

BREAKING CHANGE: the ast and filename options are removed.
@changeset-bot

changeset-bot Bot commented Oct 16, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 730a81d

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
esbuild-coffeescript Major

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Replace the generic Ultracite boilerplate with repo-specific commands,
stack gotchas (esbuild RE2 filters, 1-based lines), structure, code style,
git workflow, and always/ask/never boundaries.
@johnie
johnie merged commit 8dbc7fc into master Oct 16, 2026
1 check passed
@johnie
johnie deleted the feature/updates-2026-10-16 branch October 16, 2026 20:22
@github-actions github-actions Bot mentioned this pull request Oct 16, 2026
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