Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

sucrase

Package Overview
Dependencies
Maintainers
1
Versions
82
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

sucrase - npm Package Compare versions

Comparing version 3.20.3 to 3.21.0

dist/esm/CJSImportProcessor.js

3

dist/index.js

@@ -33,4 +33,3 @@ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }var _CJSImportProcessor = require('./CJSImportProcessor'); var _CJSImportProcessor2 = _interopRequireDefault(_CJSImportProcessor);

function getVersion() {
// eslint-disable-next-line
return require("../package.json").version;
return "3.21.0";
} exports.getVersion = getVersion;

@@ -37,0 +36,0 @@

{
"name": "sucrase",
"version": "3.20.3",
"version": "3.21.0",
"description": "Super-fast alternative to Babel for when you can target modern JS runtimes",
"author": "Alan Pierce <alangpierce@gmail.com>",
"license": "MIT",
"main": "dist/index",
"module": "dist/index.mjs",
"types": "dist/index.d.ts",
"main": "dist/index.js",
"module": "dist/esm/index.js",
"types": "dist/types/index.d.ts",
"bin": {

@@ -64,3 +64,3 @@ "sucrase": "./bin/sucrase",

"prettier": "^2.0.5",
"sucrase": "^3.20.2",
"sucrase": "^3.20.3",
"test262-harness": "^6.5.0",

@@ -67,0 +67,0 @@ "ts-interface-builder": "^0.2.1",

@@ -34,3 +34,4 @@ # Sucrase

about 360k lines of code total:
```
```text
Time Speed

@@ -43,2 +44,3 @@ Sucrase 1.64 seconds 220221 lines per second

```
Details: Measured on January 2021. Tools run in single-threaded mode without warm-up. See the

@@ -52,2 +54,3 @@ [benchmark code](https://github.com/alangpierce/sucrase/blob/main/benchmark/benchmark.ts)

transforms are available:
* **jsx**: Transforms JSX syntax to `React.createElement`, e.g. `<div a={b} />`

@@ -75,2 +78,3 @@ becomes `React.createElement('div', {a: b})`. Behaves like Babel 7's

These newer JS features are transformed by default:
* [Optional chaining](https://github.com/tc39/proposal-optional-chaining): `a?.b`

@@ -97,2 +101,3 @@ * [Nullish coalescing](https://github.com/tc39/proposal-nullish-coalescing): `a ?? b`

by your JS runtime. For example:
* Decorators, private fields, `throw` expressions, generator arrow functions,

@@ -107,4 +112,6 @@ and `do` expressions are all unsupported in browsers and Node (as of this

### JSX Options
Like Babel, Sucrase compiles JSX to React functions by default, but can be
configured for any JSX use case.
* **jsxPragma**: Element creation function, defaults to `React.createElement`.

@@ -114,3 +121,5 @@ * **jsxFragmentPragma**: Fragment component, defaults to `React.Fragment`.

### Legacy CommonJS interop
Two legacy modes can be used with the `import` transform:
Two legacy modes can be used with the `imports` transform:
* **enableLegacyTypeScriptModuleInterop**: Use the default TypeScript approach

@@ -133,3 +142,3 @@ to CommonJS interop instead of assuming that TypeScript's `--esModuleInterop`

```
```bash
yarn add --dev sucrase # Or npm install --save-dev sucrase

@@ -156,3 +165,3 @@ ```

```
```bash
sucrase-node index.ts

@@ -163,3 +172,3 @@ ```

```
```bash
sucrase ./srcDir -d ./outDir --transforms typescript,imports

@@ -228,2 +237,3 @@ ```

Sucrase bypasses most of these steps, and works like this:
1. Tokenize the input source code into a token stream using a trimmed-down fork

@@ -230,0 +240,0 @@ of the Babel parser. This fork does not produce a full AST, but still

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc