Skip to content

v3.0.0

Choose a tag to compare

@Garefild Garefild released this 06 Sep 16:31
· 21 commits to master since this release

What's Changed

A rewrite of the compiler-facing half of xBuild. Macros and the declaration pipeline moved from TypeScript's own AST to oxc, reporting became a level rather than a boolean, lifecycle hooks gained a named and reusable form, and a watch or serve run now holds an interactive terminal.

export const config: xBuildConfig = {
    logLevel: 'info',
    common: {
        plugins: [ timing ],
        logOverride: { 'direct-eval': 'silent' }
    },
    variants: {
        main: { esbuild: { outdir: 'dist', entryPoints: [ 'src/**/*.ts' ] } }
    },
    watch: { debounce: 50 }
};

Node.js 22 or newer is required.

npm install -g @remotex-labs/xbuild

Added

  • plugins — lifecycle hooks as a named set, several of which can stand on one build. Adds onSetup, the one place a plugin changes the options a build receives, run before every build of the variant rather than once.
  • logOverride — the level a single esbuild message is reported at, keyed by its id or by an anchored pattern claiming a family of them. silent drops a message rather than filing it.
  • watch as a configuration block — filter, recursive, debounce, dot, and followSymlinks. A filter a file names joins the defaults rather than replacing them, and each output directory is excluded automatically.
  • --clean removes dist before building.
  • An interactive terminal for watching and serving runs — a status bar on the last row, and single-key shortcuts: h menu, b build, r reload and build, v verbose, c clear, o open in a browser, q quit. r has every TypeScript project reparse its configuration first, which is what catches an edit to a file the tsconfig extends. See Getting Started.
  • Glob patterns in esbuild.entryPoints, matched from the working directory and keyed by path with the extension dropped.
  • context.stage.reachableFiles and context.stage.dropped on the lifecycle context, and info and verbose buckets on both context.logs and buildResult.

Changed

  • Lifecycle hooks take one object with the shared cother than the context itself — onLoad({ args, contents, loader, context }). contents arrives as a string rather than as bytes.
  • Macros are span edits over an oxc AST. A conditional binding s now dropped across the whole build: the declaration goes, the imports naming it are pruned, and its reads becomeundefined.
  • A define flag is decided by the text it substitutes, so only false, null, undefined, and an absent key leavpty string now set it.- $$inline serializes objects and arrays as JSON instead of ed, and a bigintas its exact digits. It and the configuration file run against the host intrinsics but not the hostglobal, so a write throughglobalThis` stays in the sandbox.
  • logLevel replaces the top-level verbose boolean, with verbose, info, warning, error, and silent.
  • Declarations follow esbuild.bundle — a bundled build gets one rolled-up .d.ts per entry point, an unbundled one
  • $argv carries the whole parsed command line, the project's own userArgv options included, rather than only the $argv global](https://remotex-labs.github.io/xBuild/configuration/cli#the-argv-global).
  • esbuild's own failures are reported as esbuild wrote them, keeping their locations and notes rather than being redu
  • The observable and symlink internals moved out to xObservable and @ both ServerModuleandWatchService` now report as streams rather than writing to the console.

Removed

  • BuildService, overwriteConfig, and patchConfig from the public exports. See Programmatic API.
  • The context global inside an $$inline sandbox, and MacroContextInterface with it. Reach the same values through afecycle hook.
  • declaration.bundle, which esbuild.bundle now decides.
  • Function references in $$inline — $$inline(getPort) no longer resolves, since the argument is built on its own.

Migrating from v2.5.x

  1. Move to Node.js 22 or newer.
  2. Rename verbose: true to logLevel: 'verbose'.
  3. Destructure context out of every hook argument, and drop .toString() on onLoad contents.
  4. Drop declaration.bundle.
  5. Replace 0 with false in any define that meant off.
  6. Move $$inline callbacks that read context onto define functions.

Links

Also at /private/tmp/claude-501/-Users-op-dev-sources-remotex-labs-xBuild/b103126f-d246-43bf-898a-caf3a5c423ef/scratchpadd rather pipe it: gh release create v3.0.0 -F (once gh is installed — it isn't on this machine).

Full Changelog: v2.5.1...v3.0.0