# alangpierce/sucrase

**Attribution required: if you use, quote, or summarise this content, you must credit and link back to [awesome-repositories.com](https://awesome-repositories.com/repository/alangpierce-sucrase).**

5,860 stars · 154 forks · TypeScript · MIT

## Links

- GitHub: https://github.com/alangpierce/sucrase
- Homepage: https://sucrase.io
- awesome-repositories: https://awesome-repositories.com/repository/alangpierce-sucrase.md

## Topics

`compiler` `es-modules` `javascript` `jsx` `typescript`

## Description

Sucrase is a high-speed transpilation tool that compiles modern JavaScript, TypeScript, JSX, and Flow to standard JavaScript for modern runtimes. It operates as a fast alternative to Babel, using a single-pass scanner and tokenizer that strips type annotations and applies only requested syntax transforms without building an AST or performing type checking.

The tool differentiates itself through a zero-type-checking pipeline that omits type checking entirely, relying on the assumption that input code is already valid for the target runtime. It uses scanner-based tokenization and single-pass code generation to produce output from the token stream without building an intermediate representation, and applies only transform-selective compilation for JSX, TypeScript, Flow, and imports while leaving other modern syntax unchanged.

Sucrase provides a command-line interface for running code directly, mirroring directories with transforms, and integrating into build tool workflows. It supports syntax-level transforms for converting TypeScript, Flow, JSX, modern JavaScript, and ES modules into standard JavaScript, including ES module conversion to CommonJS, JSX compilation for React, and removal of Flow and TypeScript type annotations. The tool integrates with Webpack, Gulp, Jest, Rollup, and Broccoli via direct API calls without requiring a plugin system.

## Tags

### Development Tools & Productivity

- [JavaScript to TypeScript Migration](https://awesome-repositories.com/f/development-tools-productivity/javascript-and-typescript-build-systems/javascript-to-typescript-migration.md) — Strips TypeScript type annotations and compiles syntax to standard JavaScript for direct execution. ([source](https://sucrase.io/))
- [Type-Checking Skipping Pipelines](https://awesome-repositories.com/f/development-tools-productivity/type-checking-skipping-pipelines.md) — Omits type checking entirely, relying on the assumption that input code is already valid for the target runtime.
- [Direct API Integrations](https://awesome-repositories.com/f/development-tools-productivity/build-plugin-integrators/direct-api-integrations.md) — Integrates with Webpack, Gulp, Jest, Rollup, and Broccoli via direct API calls without requiring a plugin system.
- [Directory Structure Mirroring](https://awesome-repositories.com/f/development-tools-productivity/directory-structure-mirroring.md) — Provides a CLI command that mirrors a source directory to an output directory while applying code transforms.
- [Build Tool Integrations](https://awesome-repositories.com/f/development-tools-productivity/workflow-automation-tools/build-task-automation/build-pipeline-integrations/build-pipeline-integrators/build-tool-integrations.md) — Integrates with Webpack, Gulp, Jest, Rollup, and Broccoli via direct API calls without requiring a plugin system.
- [Build Tool Integrations](https://awesome-repositories.com/f/development-tools-productivity/workflow-automation-tools/build-task-automation/build-tool-integrations/build-tool-integrations.md) — Plugs into Webpack, Gulp, Jest, Rollup, and Broccoli to incorporate transpilation into existing workflows. ([source](https://cdn.jsdelivr.net/gh/alangpierce/sucrase@main/README.md))

### Programming Languages & Runtimes

- [Flow Compilers](https://awesome-repositories.com/f/programming-languages-runtimes/javascript-compilers/flow-compilers.md) — Removes Flow type annotations and compiles the remaining code to standard JavaScript that runs without a type checker. ([source](https://sucrase.io/))
- [JavaScript Transpilers](https://awesome-repositories.com/f/programming-languages-runtimes/javascript-transpilers.md) — An alternative to Babel that compiles modern JavaScript, TypeScript, JSX, and Flow to standard JavaScript for modern runtimes.
- [JavaScript Transpilation](https://awesome-repositories.com/f/programming-languages-runtimes/language-features-paradigms/javascript-language-features/transpilers/javascript-transpilation.md) — Compiles modern JavaScript, TypeScript, JSX, and Flow to standard JS at high speed for development and production builds.
- [Type Annotation Stripping](https://awesome-repositories.com/f/programming-languages-runtimes/language-interoperability/interoperability/typescript-execution/typescript-code-transformations/type-annotation-stripping.md) — Removes TypeScript type annotations and compiles features like enums to plain JavaScript without type checking. ([source](https://cdn.jsdelivr.net/gh/alangpierce/sucrase@main/README.md))
- [CommonJS Converters](https://awesome-repositories.com/f/programming-languages-runtimes/module-organization/es-module-bundling/commonjs-converters.md) — Transforms import and export statements into require and module.exports calls with options for dynamic import preservation. ([source](https://cdn.jsdelivr.net/gh/alangpierce/sucrase@main/README.md))
- [Type Annotation Stripping](https://awesome-repositories.com/f/programming-languages-runtimes/type-annotations/type-annotation-stripping.md) — Parses only enough structure to identify and remove type annotations, avoiding full AST construction for faster output.
- [Downlevel Compilers](https://awesome-repositories.com/f/programming-languages-runtimes/language-features-paradigms/javascript-language-features/modern-syntax/downlevel-compilers.md) — Compiles newer JS features such as optional chaining, nullish coalescing, class fields, and numeric separators to older syntax. ([source](https://cdn.jsdelivr.net/gh/alangpierce/sucrase@main/README.md))
- [ES Module to CommonJS Converters](https://awesome-repositories.com/f/programming-languages-runtimes/module-organization/es-module-bundling/es-module-to-commonjs-converters.md) — Converts ES module import/export syntax into CommonJS require/module.exports calls for Node.js compatibility.

### Software Engineering & Architecture

- [Single-Pass Generators](https://awesome-repositories.com/f/software-engineering-architecture/compile-time-code-generation/single-pass-generators.md) — Generates output code in one pass from the token stream without building an intermediate representation or AST.
- [Single-Pass Tokenizers](https://awesome-repositories.com/f/software-engineering-architecture/stateless-architectures/stateless-token-validation/stateless-tokenizers/single-pass-tokenizers.md) — Tokenizes source code in a single pass using a hand-written scanner that skips type annotations for speed.
- [TypeScript Compilation Without Type Checking](https://awesome-repositories.com/f/software-engineering-architecture/typescript-compilation-fixes/typescript-compilation-without-type-checking.md) — Strips TypeScript type annotations and compiles TypeScript-specific features to plain JavaScript without type checking.
- [TypeScript Compilation Without Type Checking](https://awesome-repositories.com/f/software-engineering-architecture/typescript-type-definitions/static-type-checking/typescript-type-checking-instruction/typescript-compilation-without-type-checking.md) — Strips TypeScript type annotations and compiles syntax to plain JavaScript for quick execution without a type checker.

### Web Development

- [CommonJS Converters](https://awesome-repositories.com/f/web-development/es-module-support/commonjs-converters.md) — Converts ES module import/export syntax into CommonJS require/module.exports calls. ([source](https://sucrase.io/))
- [CommonJS Converters](https://awesome-repositories.com/f/web-development/es-module-support/es-module-bundling-workshops/commonjs-converters.md) — Converts ES module import and export statements into CommonJS require and module.exports calls for Node.js compatibility. ([source](https://sucrase.io))
- [JSX Compilers](https://awesome-repositories.com/f/web-development/jsx-compilers.md) — Transforms JSX syntax into JavaScript function calls for React or custom pragmas in modern browser environments.
- [JSX Transformers](https://awesome-repositories.com/f/web-development/jsx-transformers.md) — Transforms JSX syntax into standard JavaScript function calls for React or custom pragmas.
- [Selective](https://awesome-repositories.com/f/web-development/syntax-transformers/selective.md) — Applies only requested syntax transforms for JSX, TypeScript, Flow, and imports while leaving other modern syntax unchanged.
- [On-the-Fly Execution Hooks](https://awesome-repositories.com/f/web-development/graphql-clients/query-execution-engines/directive-based-execution/on-the-fly-execution-hooks.md) — Executes TypeScript or JSX files on-the-fly without a separate build step using a require hook and CLI binary. ([source](https://cdn.jsdelivr.net/gh/alangpierce/sucrase@main/README.md))
