Comparing version 3.17.0 to 3.17.1
@@ -0,1 +1,6 @@ | ||
# 3.17.1 (2021-01-31) | ||
* Fix bug where TS method overloads in a class would cause later class fields to | ||
not be handled properly. ([#593]) | ||
# 3.17.0 (2020-12-29) | ||
@@ -323,1 +328,2 @@ | ||
[#575]: https://github.com/alangpierce/sucrase/pull/575 | ||
[#593]: https://github.com/alangpierce/sucrase/pull/593 |
import type NameManager from "./NameManager"; | ||
declare const HELPERS: { | ||
interopRequireWildcard: string; | ||
interopRequireDefault: string; | ||
createNamedExportFrom: string; | ||
createStarExport: string; | ||
nullishCoalesce: string; | ||
asyncNullishCoalesce: string; | ||
optionalChain: string; | ||
asyncOptionalChain: string; | ||
optionalChainDelete: string; | ||
asyncOptionalChainDelete: string; | ||
[name: string]: string; | ||
}; | ||
@@ -14,0 +5,0 @@ export declare class HelperManager { |
@@ -22,7 +22,7 @@ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
let suffixNum = 2; | ||
while (this.usedNames.has(name + suffixNum)) { | ||
while (this.usedNames.has(name + String(suffixNum))) { | ||
suffixNum++; | ||
} | ||
return name + suffixNum; | ||
return name + String(suffixNum); | ||
} | ||
} exports.default = NameManager; |
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }var _tsinterfacechecker = require('ts-interface-checker'); | ||
var _Optionsgentypes = require('./Options-gen-types'); var _Optionsgentypes2 = _interopRequireDefault(_Optionsgentypes); | ||
@@ -3,0 +4,0 @@ |
@@ -101,2 +101,3 @@ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }/* eslint max-len: 0 */ | ||
this.shadowsGlobal = false; | ||
this.isAsyncOperation = false; | ||
this.contextId = null; | ||
@@ -103,0 +104,0 @@ this.rhsEndIndex = null; |
@@ -15,3 +15,3 @@ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }var _state = require('../tokenizer/state'); var _state2 = _interopRequireDefault(_state); | ||
// tslint:disable-next-line no-any | ||
// eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
function augmentError(error) { | ||
@@ -18,0 +18,0 @@ if ("pos" in error) { |
@@ -82,3 +82,3 @@ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _index = require('../tokenizer/index'); | ||
} | ||
// tslint:disable-next-line no-any | ||
// eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
const err = new SyntaxError(message); | ||
@@ -85,0 +85,0 @@ err.pos = pos; |
@@ -289,5 +289,7 @@ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
rangeToRemoveIndex < rangesToRemove.length && | ||
this.tokens.currentIndex() === rangesToRemove[rangeToRemoveIndex].start | ||
this.tokens.currentIndex() >= rangesToRemove[rangeToRemoveIndex].start | ||
) { | ||
this.tokens.removeInitialToken(); | ||
if (this.tokens.currentIndex() < rangesToRemove[rangeToRemoveIndex].end) { | ||
this.tokens.removeInitialToken(); | ||
} | ||
while (this.tokens.currentIndex() < rangesToRemove[rangeToRemoveIndex].end) { | ||
@@ -294,0 +296,0 @@ this.tokens.removeToken(); |
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }var _linesandcolumns = require('lines-and-columns'); var _linesandcolumns2 = _interopRequireDefault(_linesandcolumns); | ||
var _types = require('../parser/tokenizer/types'); | ||
@@ -35,3 +36,5 @@ | ||
truncate(String(raw), 14), | ||
// @ts-ignore: Intentional dynamic access by key. | ||
...tokenKeys.map((key) => formatValue(token[key], key)), | ||
// @ts-ignore: Intentional dynamic access by key. | ||
...typeKeys.map((key) => formatValue(token.type[key], key)), | ||
@@ -41,3 +44,3 @@ ]; | ||
// tslint:disable-next-line no-any | ||
// eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
function formatValue(value, key) { | ||
@@ -44,0 +47,0 @@ if (value === true) { |
{ | ||
"name": "sucrase", | ||
"version": "3.17.0", | ||
"version": "3.17.1", | ||
"description": "Super-fast alternative to Babel for when you can target modern JS runtimes", | ||
@@ -19,6 +19,5 @@ "author": "Alan Pierce <alangpierce@gmail.com>", | ||
"generate": "sucrase-node generator/generate.ts", | ||
"benchmark": "sucrase-node benchmark/benchmark.ts", | ||
"benchmark": "cd benchmark && yarn && sucrase-node ./benchmark.ts", | ||
"benchmark-compare": "sucrase-node ./benchmark/compare-performance.ts", | ||
"microbenchmark": "sucrase-node benchmark/microbenchmark.ts", | ||
"benchmark-react": "sucrase-node benchmark/benchmark-react.ts", | ||
"benchmark-project": "sucrase-node benchmark/benchmark-project.ts", | ||
"lint": "sucrase-node script/lint.ts", | ||
@@ -50,10 +49,2 @@ "profile": "node --inspect-brk ./node_modules/.bin/sucrase-node ./benchmark/profile", | ||
"devDependencies": { | ||
"@babel/cli": "^7.7.0", | ||
"@babel/core": "^7.7.2", | ||
"@babel/plugin-proposal-class-properties": "^7.7.0", | ||
"@babel/plugin-proposal-object-rest-spread": "^7.6.2", | ||
"@babel/plugin-transform-modules-commonjs": "^7.7.0", | ||
"@babel/preset-flow": "^7.0.0", | ||
"@babel/preset-react": "^7.7.0", | ||
"@babel/preset-typescript": "^7.7.2", | ||
"@types/glob": "7.1.1", | ||
@@ -63,21 +54,18 @@ "@types/mocha": "^5.2.7", | ||
"@types/node": "^12.12.7", | ||
"@typescript-eslint/parser": "^2.33.0", | ||
"@typescript-eslint/eslint-plugin": "^4.11.1", | ||
"@typescript-eslint/parser": "^4.11.1", | ||
"chalk": "2.4.1", | ||
"codecov": "^3.6.1", | ||
"codecov": "^3.8.1", | ||
"eslint": "^6.6.0", | ||
"eslint-config-airbnb-base": "^14.0.0", | ||
"eslint-config-prettier": "^6.5.0", | ||
"eslint-plugin-import": "^2.18.2", | ||
"eslint-plugin-import": "^2.22.1", | ||
"eslint-plugin-prettier": "^3.1.1", | ||
"eslint-plugin-typescript": "^0.14.0", | ||
"mocha": "^7.1.1", | ||
"nyc": "^14.1.1", | ||
"prettier": "^2.0.5", | ||
"sucrase": "^3.16.0", | ||
"sucrase": "^3.17.0", | ||
"test262-harness": "^6.5.0", | ||
"ts-interface-builder": "^0.2.1", | ||
"tslint": "^5.20.1", | ||
"typescript": "^3.7.2", | ||
"typescript-tslint-plugin": "^0.5.4", | ||
"yargs-parser": "^19.0.4" | ||
"typescript": "^4.1.3" | ||
}, | ||
@@ -84,0 +72,0 @@ "dependencies": { |
# Sucrase | ||
[![Build Status](https://travis-ci.org/alangpierce/sucrase.svg?branch=master)](https://travis-ci.org/alangpierce/sucrase) | ||
[![Build Status](https://github.com/alangpierce/sucrase/workflows/All%20tests/badge.svg)](https://github.com/alangpierce/sucrase/actions) | ||
[![npm version](https://img.shields.io/npm/v/sucrase.svg)](https://www.npmjs.com/package/sucrase) | ||
@@ -31,12 +31,16 @@ [![Install Size](https://packagephobia.now.sh/badge?p=sucrase)](https://packagephobia.now.sh/result?p=sucrase) | ||
**Sucrase is about 20x faster than Babel.** Here's one measurement of how Sucrase | ||
compares with other tools on a large TypeScript codebase with 4045 files and | ||
661081 lines of code: | ||
**Sucrase is about 20x faster than Babel.** Here's one measurement of how | ||
Sucrase compares with other tools when compiling the Jest codebase 3 times, | ||
about 360k lines of code total: | ||
``` | ||
Time Speed | ||
Sucrase 2.928s 225752 lines per second | ||
swc 13.782s 47966 lines per second | ||
TypeScript 39.603s 16693 lines per second | ||
Babel 52.598s 12569 lines per second | ||
Time Speed | ||
Sucrase 1.64 seconds 220221 lines per second | ||
swc 2.13 seconds 169502 lines per second | ||
esbuild 3.02 seconds 119738 lines per second | ||
TypeScript 24.18 seconds 14937 lines per second | ||
Babel 27.22 seconds 13270 lines per second | ||
``` | ||
Details: Measured on January 2021. Tools run in single-threaded mode without warm-up. See the | ||
[benchmark code](https://github.com/alangpierce/sucrase/blob/main/benchmark/benchmark.ts) | ||
for methodology and caveats. | ||
@@ -49,3 +53,3 @@ ## Transforms | ||
becomes `React.createElement('div', {a: b})`. Behaves like Babel 7's | ||
[React preset](https://github.com/babel/babel/tree/master/packages/babel-preset-react), | ||
[React preset](https://github.com/babel/babel/tree/main/packages/babel-preset-react), | ||
including adding `createReactClass` display names and JSX context information. | ||
@@ -120,5 +124,5 @@ * **typescript**: Compiles TypeScript code to JavaScript, removing type | ||
Often, you'll want to use one of the build tool integrations: | ||
[Webpack](https://github.com/alangpierce/sucrase/tree/master/integrations/webpack-loader), | ||
[Gulp](https://github.com/alangpierce/sucrase/tree/master/integrations/gulp-plugin), | ||
[Jest](https://github.com/alangpierce/sucrase/tree/master/integrations/jest-plugin), | ||
[Webpack](https://github.com/alangpierce/sucrase/tree/main/integrations/webpack-loader), | ||
[Gulp](https://github.com/alangpierce/sucrase/tree/main/integrations/gulp-plugin), | ||
[Jest](https://github.com/alangpierce/sucrase/tree/main/integrations/jest-plugin), | ||
[Rollup](https://github.com/rollup/plugins/tree/master/packages/sucrase), | ||
@@ -230,3 +234,3 @@ [Broccoli](https://github.com/stefanpenner/broccoli-sucrase). | ||
Sucrase is MIT-licensed. A large part of Sucrase is based on a fork of the | ||
[Babel parser](https://github.com/babel/babel/tree/master/packages/babel-parser), | ||
[Babel parser](https://github.com/babel/babel/tree/main/packages/babel-parser), | ||
which is also MIT-licensed. | ||
@@ -233,0 +237,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
950969
20
24170
237