sucrase
sucrase copied to clipboard
Super-fast alternative to Babel for when you can target modern JS runtimes
The default build system does not work verbatim on Windows because of the run.ts script spawning `"/bin/bash"` and because of Prettier not liking CRLF line endings. Building from WSL in...
I am using sucrase to transpile some jest tests and came across a (typescript) file containing a function invocation followed by an `export` declaration. Since the export declaration is wrapped...
## Description The output of sucrase is not valid JavaScript code. ## Input ```TypeScript export enum E { A = 1 } export enum E { B = 2 }...
It looks like jest.mock hoisting breaks as soon as jest is imported from @jest/globals import {jest} from "@jest/globals"; import {foo} from './module1.js'; import {bar} from './module2.js'; jest.mock('./module1.js'); test fails, but...
Sample code: ```ts import { Foo } from 'foo' import Bar = Foo console.log(Foo) console.log(Bar) ``` tsc output [playground](https://www.typescriptlang.org/play?target=1&module=1#code/JYWwDg9gTgLgBAbzgMQhOBfOAzKERwDk2ahAUKJLHAEICGUcAvCmmWQMYQB2AzhABsApgDoBEAOYAKVBACUnHv2FjJU+lAVA) ```js "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var foo_1...
The two source files should generate equivalent imports transformation: [Sandbox](https://sucrase.io/#compareWithTypeScript=true&code=%0Aimport%20foo%20from%20'bar'%0Aexport%20%7B%20foo%20%7D) ```ts import foo from 'bar' export { foo } ``` [Sandbox](https://sucrase.io/#compareWithTypeScript=true&code=%0Aexport%20%7B%20default%20as%20foo%20%7D%20from%20'bar') ```ts export { default as foo } from 'bar'...
With the following Javascript code: ```jsx (() => { This div has no end })(); ``` Babel gives an expected error message: ``` /sample.js: Unterminated JSX contents. (2:9) 1 |...
I'm writing plugin targeting a rather old JavaScript engine which support only ES3 syntax. I've tried compile my *.ts to es3 with TypeScript which have no problem. But I want...
I have tsconfig with such baseUrl `"baseUrl": ".",` transpilation produce such error: ` Cannot find module 'src/hivemind/experiments' from 'src/components/invoices/invoices-page/invoice-banner.tsx'`
`fs/promises` has been supported since Node v10, a version released 6 years ago and have long been EOL. This pull request removes an unnecessary dependency on non-EOL Node.js platforms. Async...