Redone (astro-redone-rust)

raw JSON →
1.0.0 verified Fri May 01 auth: no javascript

Redone is a high-performance Rust-based build system for Astro that replaces esbuild and Vite integration with native Rust components (SWC compilation, parallel bundler, tokio-based dev server with HMR). Current stable version is 1.0.0, with an active alpha track for Astro 7.0. Key differentiators: incremental bundling, sub-millisecond invalidation, 50%+ faster compilation than esbuild, 40%+ faster bundling than Rollup, and memory-efficient caching. Ships TypeScript types and uses napi-rs for Node.js bindings. Actively developed with frequent releases.

error Error: Cannot find module 'redone'
cause Redone is ESM-only and cannot be required with CommonJS.
fix
Change const redone = require('redone') to import ... from 'redone' and ensure your package.json has "type": "module".
error TypeError: redone.createBuilder is not a function
cause Incorrect import: using default import instead of named import.
fix
Use import { createBuilder } from 'redone' instead of import redone from 'redone'.
error Error: spawn rustup ENOENT
cause Rust toolchain not installed when building from source.
fix
Install Rust from https://rustup.rs, then run 'pnpm -C packages/redone build:rust'.
breaking Redone 1.0.0 drops support for Node.js <18. Requires Node.js 18+.
fix Upgrade Node.js to version 18 or later.
breaking The API changed from v0.x to v1.0.0: createBuilder is now async and returns a Builder object instead of direct compile/bundle functions.
fix Update code to use async createBuilder and call methods on the returned Builder instance.
deprecated The 'format' option default is deprecated; you must specify it explicitly in v1.1.0+.
fix Add format: 'esm' or 'cjs' to createBuilder options.
gotcha If using TypeScript, ensure your tsconfig.json includes 'moduleResolution': 'bundler' or 'node16' to resolve the types correctly.
fix Set moduleResolution to 'bundler' or 'node16' in tsconfig.json.
npm install astro-redone-rust
yarn add astro-redone-rust
pnpm add astro-redone-rust

Shows how to create a builder, compile a single TypeScript file, bundle a project, and clean up resources.

import { createBuilder } from 'redone';

async function build() {
  const builder = await createBuilder({
    root: process.cwd(),
    format: 'esm',
    target: 'ES2020',
  });

  // Compile a single file
  const result = await builder.compileFile(
    'src/component.ts',
    `const x: number = 1;\nexport default x;`,
    { format: 'esm', sourceMap: true }
  );
  console.log(result.code);

  // Bundle the project
  const bundle = await builder.bundle({
    entryPoints: ['src/index.ts'],
    external: ['astro'],
    format: 'esm',
  });
  console.log(bundle.outputFiles);

  await builder.cleanup();
}

build().catch(console.error);