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 1.13.0 to 1.14.0

2

dist/src/cli.js

@@ -40,3 +40,3 @@ "use strict";

const extension = transforms.includes("typescript") ? ".ts" : ".js";
if (!await fs_1.exists(outDirPath)) {
if (!(await fs_1.exists(outDirPath))) {
await fs_1.mkdir(outDirPath);

@@ -43,0 +43,0 @@ }

@@ -172,3 +172,3 @@ "use strict";

index++;
if ((this.tokens.matchesContextualAtIndex(index, 28 /* _type */) ||
if ((this.tokens.matchesContextualAtIndex(index, 30 /* _type */) ||
this.tokens.matchesAtIndex(index, [46736 /* _typeof */])) &&

@@ -296,3 +296,3 @@ !this.tokens.matchesAtIndex(index + 1, [7168 /* comma */]) &&

let isTypeImport = false;
if ((this.tokens.matchesContextualAtIndex(index, 28 /* _type */) ||
if ((this.tokens.matchesContextualAtIndex(index, 30 /* _type */) ||
this.tokens.matchesAtIndex(index, [46736 /* _typeof */])) &&

@@ -299,0 +299,0 @@ this.tokens.matchesAtIndex(index + 1, [2048 /* name */]) &&

@@ -98,3 +98,3 @@ "use strict";

this.tokens.removeInitialToken();
if (this.tokens.matchesContextual(28 /* _type */) &&
if (this.tokens.matchesContextual(30 /* _type */) &&
!this.tokens.matchesAtIndex(this.tokens.currentIndex() + 1, [7168 /* comma */]) &&

@@ -265,2 +265,5 @@ !this.tokens.matchesContextualAtIndex(this.tokens.currentIndex() + 1, 10 /* _from */)) {

}
else if (this.tokens.matches3(42512 /* _export */, 31760 /* _default */, 13312 /* at */)) {
throw new Error("Export default statements with decorators are not yet supported.");
}
else {

@@ -267,0 +270,0 @@ this.tokens.replaceToken("exports.");

@@ -22,3 +22,3 @@ "use strict";

const startIndex = this.tokens.currentIndex();
if (this.tokens.matchesContextual(32 /* _createReactClass */)) {
if (this.tokens.matchesContextual(34 /* _createReactClass */)) {
const newName = this.importProcessor.getIdentifierReplacement("createReactClass");

@@ -35,4 +35,4 @@ if (newName) {

if (this.tokens.matches3(2048 /* name */, 9216 /* dot */, 2048 /* name */) &&
this.tokens.matchesContextual(30 /* _React */) &&
this.tokens.matchesContextualAtIndex(this.tokens.currentIndex() + 2, 31 /* _createClass */)) {
this.tokens.matchesContextual(32 /* _React */) &&
this.tokens.matchesContextualAtIndex(this.tokens.currentIndex() + 2, 33 /* _createClass */)) {
const newName = this.importProcessor.getIdentifierReplacement("React");

@@ -108,3 +108,3 @@ if (newName) {

}
if (this.tokens.matchesContextualAtIndex(index, 33 /* _displayName */) &&
if (this.tokens.matchesContextualAtIndex(index, 35 /* _displayName */) &&
this.tokens.tokens[index].identifierRole === tokenizer_1.IdentifierRole.ObjectKey &&

@@ -111,0 +111,0 @@ token.contextId === objectContextId) {

@@ -805,2 +805,3 @@ "use strict";

lval_1.parseSpread();
parseParenItem();
}

@@ -810,5 +811,2 @@ else {

}
if (base_1.hasPlugin("flow") && tokenizer_1.match(8192 /* colon */)) {
flow_1.flowParseTypeAnnotation();
}
}

@@ -815,0 +813,0 @@ // Parse the next token as an identifier.

@@ -92,3 +92,3 @@ "use strict";

typescript_1.tsParseAccessModifier();
typescript_1.tsParseModifier([25 /* _readonly */]);
typescript_1.tsParseModifier([26 /* _readonly */]);
}

@@ -95,0 +95,0 @@ parseMaybeDefault(isBlockScope);

@@ -177,5 +177,11 @@ "use strict";

tokenizer_1.next();
expression_1.parseIdentifier();
while (tokenizer_1.eat(9216 /* dot */)) {
if (tokenizer_1.eat(6144 /* parenL */)) {
expression_1.parseExpression();
util_1.expect(6656 /* parenR */);
}
else {
expression_1.parseIdentifier();
while (tokenizer_1.eat(9216 /* dot */)) {
expression_1.parseIdentifier();
}
}

@@ -236,3 +242,3 @@ if (tokenizer_1.eat(6144 /* parenL */)) {

parseVar(true, varKind);
if (tokenizer_1.match(45592 /* _in */) || util_1.isContextual(20 /* _of */)) {
if (tokenizer_1.match(45592 /* _in */) || util_1.isContextual(21 /* _of */)) {
parseForIn(forAwait);

@@ -245,3 +251,3 @@ return;

expression_1.parseExpression(true);
if (tokenizer_1.match(45592 /* _in */) || util_1.isContextual(20 /* _of */)) {
if (tokenizer_1.match(45592 /* _in */) || util_1.isContextual(21 /* _of */)) {
parseForIn(forAwait);

@@ -408,3 +414,3 @@ return;

if (forAwait) {
util_1.eatContextual(20 /* _of */);
util_1.eatContextual(21 /* _of */);
}

@@ -526,3 +532,3 @@ else {

function isClassProperty() {
return tokenizer_1.match(14368 /* eq */) || tokenizer_1.match(7680 /* semi */) || tokenizer_1.match(5120 /* braceR */) || tokenizer_1.match(8192 /* colon */);
return tokenizer_1.match(14368 /* eq */) || tokenizer_1.match(7680 /* semi */) || tokenizer_1.match(5120 /* braceR */) || tokenizer_1.match(16000 /* bang */) || tokenizer_1.match(8192 /* colon */);
}

@@ -551,3 +557,3 @@ function isClassMethod() {

let isStatic = false;
if (tokenizer_1.match(2048 /* name */) && base_1.state.contextualKeyword === 27 /* _static */) {
if (tokenizer_1.match(2048 /* name */) && base_1.state.contextualKeyword === 29 /* _static */) {
expression_1.parseIdentifier(); // eats 'static'

@@ -608,3 +614,3 @@ if (isClassMethod()) {

else if ((token.contextualKeyword === 11 /* _get */ ||
token.contextualKeyword === 29 /* _set */) &&
token.contextualKeyword === 28 /* _set */) &&
!(util_1.isLineTerminator() && tokenizer_1.match(24587 /* star */))) {

@@ -647,3 +653,2 @@ if (token.contextualKeyword === 11 /* _get */) {

exports.parseClassPropertyName = parseClassPropertyName;
// Overridden in typescript.js
function parsePostMemberNameModifiers() {

@@ -657,2 +662,3 @@ if (base_1.hasPlugin("typescript")) {

if (base_1.hasPlugin("typescript")) {
tokenizer_1.eat(16000 /* bang */);
typescript_1.tsTryParseTypeAnnotation();

@@ -768,2 +774,6 @@ }

}
else if (tokenizer_1.match(13312 /* at */)) {
parseDecorators();
parseClass(true, true);
}
else {

@@ -770,0 +780,0 @@ expression_1.parseMaybeAssign();

@@ -67,3 +67,3 @@ "use strict";

}
else if (util_1.isContextual(18 /* _module */)) {
else if (util_1.isContextual(19 /* _module */)) {
if (tokenizer_1.lookaheadType() === 9216 /* dot */) {

@@ -76,9 +76,9 @@ flowParseDeclareModuleExports();

}
else if (util_1.isContextual(28 /* _type */)) {
else if (util_1.isContextual(30 /* _type */)) {
flowParseDeclareTypeAlias();
}
else if (util_1.isContextual(21 /* _opaque */)) {
else if (util_1.isContextual(22 /* _opaque */)) {
flowParseDeclareOpaqueType();
}
else if (util_1.isContextual(14 /* _interface */)) {
else if (util_1.isContextual(15 /* _interface */)) {
flowParseDeclareInterface();

@@ -132,3 +132,3 @@ }

tokenizer_1.match(41488 /* _class */) || // declare export class ...
util_1.isContextual(21 /* _opaque */) // declare export opaque ..
util_1.isContextual(22 /* _opaque */) // declare export opaque ..
) {

@@ -139,5 +139,5 @@ flowParseDeclare();

tokenizer_1.match(4096 /* braceL */) || // declare export {} ...
util_1.isContextual(14 /* _interface */) || // declare export interface ...
util_1.isContextual(28 /* _type */) || // declare export type ...
util_1.isContextual(21 /* _opaque */) // declare export opaque type ...
util_1.isContextual(15 /* _interface */) || // declare export interface ...
util_1.isContextual(30 /* _type */) || // declare export type ...
util_1.isContextual(22 /* _opaque */) // declare export opaque type ...
) {

@@ -151,3 +151,3 @@ statement_1.parseExport();

function flowParseDeclareModuleExports() {
util_1.expectContextual(18 /* _module */);
util_1.expectContextual(19 /* _module */);
util_1.expect(9216 /* dot */);

@@ -181,3 +181,3 @@ util_1.expectContextual(9 /* _exports */);

}
if (util_1.isContextual(17 /* _mixins */)) {
if (util_1.isContextual(18 /* _mixins */)) {
tokenizer_1.next();

@@ -188,2 +188,8 @@ do {

}
if (util_1.isContextual(13 /* _implements */)) {
tokenizer_1.next();
do {
flowParseInterfaceExtends();
} while (tokenizer_1.eat(7168 /* comma */));
}
flowParseObjectType(true, false);

@@ -212,3 +218,3 @@ }

function flowParseOpaqueType(declare) {
util_1.expectContextual(28 /* _type */);
util_1.expectContextual(30 /* _type */);
flowParseRestrictedIdentifier();

@@ -317,3 +323,3 @@ if (tokenizer_1.match(21000 /* lessThan */)) {

let isStatic = false;
if (allowStatic && util_1.isContextual(27 /* _static */) && tokenizer_1.lookaheadType() !== 8192 /* colon */) {
if (allowStatic && util_1.isContextual(29 /* _static */) && tokenizer_1.lookaheadType() !== 8192 /* colon */) {
tokenizer_1.next();

@@ -330,3 +336,3 @@ isStatic = true;

else {
if (util_1.isContextual(11 /* _get */) || util_1.isContextual(29 /* _set */)) {
if (util_1.isContextual(11 /* _get */) || util_1.isContextual(28 /* _set */)) {
const lookahead = tokenizer_1.lookaheadType();

@@ -567,3 +573,3 @@ if (lookahead === 2048 /* name */ || lookahead === 1536 /* string */ || lookahead === 0 /* num */) {

function flowTryParseStatement() {
if (tokenizer_1.match(2048 /* name */) && base_1.state.contextualKeyword === 14 /* _interface */) {
if (tokenizer_1.match(2048 /* name */) && base_1.state.contextualKeyword === 15 /* _interface */) {
tokenizer_1.runInTypeContext(0, () => {

@@ -594,3 +600,3 @@ tokenizer_1.next();

else if (tokenizer_1.match(2048 /* name */)) {
if (contextualKeyword === 14 /* _interface */) {
if (contextualKeyword === 15 /* _interface */) {
tokenizer_1.runInTypeContext(1, () => {

@@ -600,3 +606,3 @@ flowParseInterface();

}
else if (contextualKeyword === 28 /* _type */) {
else if (contextualKeyword === 30 /* _type */) {
tokenizer_1.runInTypeContext(1, () => {

@@ -606,3 +612,3 @@ flowParseTypeAlias();

}
else if (contextualKeyword === 21 /* _opaque */) {
else if (contextualKeyword === 22 /* _opaque */) {
tokenizer_1.runInTypeContext(1, () => {

@@ -618,5 +624,5 @@ flowParseOpaqueType(false);

function flowShouldParseExportDeclaration() {
return (util_1.isContextual(28 /* _type */) ||
util_1.isContextual(14 /* _interface */) ||
util_1.isContextual(21 /* _opaque */));
return (util_1.isContextual(30 /* _type */) ||
util_1.isContextual(15 /* _interface */) ||
util_1.isContextual(22 /* _opaque */));
}

@@ -626,9 +632,9 @@ exports.flowShouldParseExportDeclaration = flowShouldParseExportDeclaration;

return (tokenizer_1.match(2048 /* name */) &&
(base_1.state.contextualKeyword === 28 /* _type */ ||
base_1.state.contextualKeyword === 14 /* _interface */ ||
base_1.state.contextualKeyword === 21 /* _opaque */));
(base_1.state.contextualKeyword === 30 /* _type */ ||
base_1.state.contextualKeyword === 15 /* _interface */ ||
base_1.state.contextualKeyword === 22 /* _opaque */));
}
exports.flowShouldDisallowExportDefaultSpecifier = flowShouldDisallowExportDefaultSpecifier;
function flowParseExportDeclaration() {
if (util_1.isContextual(28 /* _type */)) {
if (util_1.isContextual(30 /* _type */)) {
tokenizer_1.runInTypeContext(1, () => {

@@ -647,3 +653,3 @@ tokenizer_1.next();

}
else if (util_1.isContextual(21 /* _opaque */)) {
else if (util_1.isContextual(22 /* _opaque */)) {
tokenizer_1.runInTypeContext(1, () => {

@@ -655,3 +661,3 @@ tokenizer_1.next();

}
else if (util_1.isContextual(14 /* _interface */)) {
else if (util_1.isContextual(15 /* _interface */)) {
tokenizer_1.runInTypeContext(1, () => {

@@ -668,7 +674,7 @@ tokenizer_1.next();

function flowShouldParseExportStar() {
return tokenizer_1.match(24587 /* star */) || (util_1.isContextual(28 /* _type */) && tokenizer_1.lookaheadType() === 24587 /* star */);
return tokenizer_1.match(24587 /* star */) || (util_1.isContextual(30 /* _type */) && tokenizer_1.lookaheadType() === 24587 /* star */);
}
exports.flowShouldParseExportStar = flowShouldParseExportStar;
function flowParseExportStar() {
if (util_1.eatContextual(28 /* _type */)) {
if (util_1.eatContextual(30 /* _type */)) {
tokenizer_1.runInTypeContext(2, () => {

@@ -727,3 +733,3 @@ statement_1.baseParseExportStar();

}
else if (util_1.isContextual(28 /* _type */)) {
else if (util_1.isContextual(30 /* _type */)) {
kind = "type";

@@ -741,3 +747,3 @@ }

function flowParseImportSpecifier() {
const isTypeKeyword = base_1.state.contextualKeyword === 28 /* _type */ || base_1.state.type === 46736 /* _typeof */;
const isTypeKeyword = base_1.state.contextualKeyword === 30 /* _type */ || base_1.state.type === 46736 /* _typeof */;
if (isTypeKeyword) {

@@ -744,0 +750,0 @@ tokenizer_1.next();

@@ -10,2 +10,3 @@ import { ContextualKeyword } from "../tokenizer";

export declare function tsParseType(): void;
export declare function tsParseNonConditionalType(): void;
export declare function tsParseTypeAssertion(): void;

@@ -12,0 +13,0 @@ export declare function tsParseImportEqualsDeclaration(): void;

@@ -40,3 +40,3 @@ "use strict";

switch (modifier) {
case 25 /* _readonly */:
case 26 /* _readonly */:
base_1.state.tokens[base_1.state.tokens.length - 1].type = 50192 /* _readonly */;

@@ -47,12 +47,12 @@ break;

break;
case 27 /* _static */:
case 29 /* _static */:
base_1.state.tokens[base_1.state.tokens.length - 1].type = 51216 /* _static */;
break;
case 24 /* _public */:
case 25 /* _public */:
base_1.state.tokens[base_1.state.tokens.length - 1].type = 51728 /* _public */;
break;
case 22 /* _private */:
case 23 /* _private */:
base_1.state.tokens[base_1.state.tokens.length - 1].type = 52240 /* _private */;
break;
case 23 /* _protected */:
case 24 /* _protected */:
base_1.state.tokens[base_1.state.tokens.length - 1].type = 52752 /* _protected */;

@@ -246,3 +246,3 @@ break;

}
const readonly = !!tsParseModifier([25 /* _readonly */]);
const readonly = !!tsParseModifier([26 /* _readonly */]);
const found = tsTryParseIndexSignature();

@@ -268,3 +268,6 @@ if (found) {

tokenizer_1.next();
if (util_1.isContextual(25 /* _readonly */)) {
if (tokenizer_1.eat(23178 /* plus */) || tokenizer_1.eat(23690 /* minus */)) {
return util_1.isContextual(26 /* _readonly */);
}
if (util_1.isContextual(26 /* _readonly */)) {
tokenizer_1.next();

@@ -289,7 +292,19 @@ }

util_1.expect(4096 /* braceL */);
util_1.eatContextual(25 /* _readonly */);
if (tokenizer_1.match(23178 /* plus */) || tokenizer_1.match(23690 /* minus */)) {
tokenizer_1.next();
util_1.expectContextual(26 /* _readonly */);
}
else {
util_1.eatContextual(26 /* _readonly */);
}
util_1.expect(3072 /* bracketL */);
tsParseMappedTypeParameter();
util_1.expect(3584 /* bracketR */);
tokenizer_1.eat(9728 /* question */);
if (tokenizer_1.match(23178 /* plus */) || tokenizer_1.match(23690 /* minus */)) {
tokenizer_1.next();
util_1.expect(9728 /* question */);
}
else {
tokenizer_1.eat(9728 /* question */);
}
tsTryParseType();

@@ -336,3 +351,3 @@ util_1.semicolon();

tsParseThisTypeNode();
if (util_1.isContextual(15 /* _is */) && !util_1.hasPrecedingLineBreak()) {
if (util_1.isContextual(16 /* _is */) && !util_1.hasPrecedingLineBreak()) {
tsParseThisTypePredicate();

@@ -374,6 +389,14 @@ }

}
function tsParseInferType() {
util_1.expectContextual(14 /* _infer */);
expression_1.parseIdentifier();
}
function tsParseTypeOperatorOrHigher() {
if (util_1.eatContextual(16 /* _keyof */)) {
if (util_1.isContextual(17 /* _keyof */) || util_1.isContextual(31 /* _unique */)) {
tokenizer_1.next();
tsParseTypeOperatorOrHigher();
}
else if (util_1.isContextual(14 /* _infer */)) {
tsParseInferType();
}
else {

@@ -463,3 +486,3 @@ tsParseArrayTypeOrHigher();

expression_1.parseIdentifier();
if (util_1.isContextual(15 /* _is */) && !util_1.hasPrecedingLineBreak()) {
if (util_1.isContextual(16 /* _is */) && !util_1.hasPrecedingLineBreak()) {
tokenizer_1.next();

@@ -478,2 +501,17 @@ return true;

function tsParseType() {
tsParseNonConditionalType();
if (util_1.hasPrecedingLineBreak() || !tokenizer_1.eat(42000 /* _extends */)) {
return;
}
// extends type
tsParseNonConditionalType();
util_1.expect(9728 /* question */);
// true type
tsParseType();
util_1.expect(8192 /* colon */);
// false type
tsParseType();
}
exports.tsParseType = tsParseType;
function tsParseNonConditionalType() {
if (tsIsStartOfFunctionType()) {

@@ -490,3 +528,3 @@ tsParseFunctionOrConstructorType("TSFunctionType");

}
exports.tsParseType = tsParseType;
exports.tsParseNonConditionalType = tsParseNonConditionalType;
function tsParseTypeAssertion() {

@@ -597,3 +635,3 @@ tokenizer_1.runInTypeContext(1, () => {

function tsIsExternalModuleReference() {
return util_1.isContextual(26 /* _require */) && tokenizer_1.lookaheadType() === 6144 /* parenL */;
return util_1.isContextual(27 /* _require */) && tokenizer_1.lookaheadType() === 6144 /* parenL */;
}

@@ -609,3 +647,3 @@ function tsParseModuleReference() {

function tsParseExternalModuleReference() {
util_1.expectContextual(26 /* _require */);
util_1.expectContextual(27 /* _require */);
util_1.expect(6144 /* parenL */);

@@ -756,3 +794,3 @@ if (!tokenizer_1.match(1536 /* string */)) {

break;
case 14 /* _interface */:
case 15 /* _interface */:
if (isBeforeToken || tokenizer_1.match(2048 /* name */)) {

@@ -769,3 +807,3 @@ // `next` is true in "export" and "declare" contexts, so we want to remove that token

break;
case 18 /* _module */:
case 19 /* _module */:
if (isBeforeToken)

@@ -786,3 +824,3 @@ tokenizer_1.next();

break;
case 19 /* _namespace */:
case 20 /* _namespace */:
if (isBeforeToken || tokenizer_1.match(2048 /* name */)) {

@@ -797,3 +835,3 @@ tokenizer_1.runInTypeContext(1, () => {

break;
case 28 /* _type */:
case 30 /* _type */:
if (isBeforeToken || tokenizer_1.match(2048 /* name */)) {

@@ -843,6 +881,6 @@ tokenizer_1.runInTypeContext(1, () => {

case 8 /* _enum */:
case 14 /* _interface */:
case 18 /* _module */:
case 19 /* _namespace */:
case 28 /* _type */:
case 15 /* _interface */:
case 19 /* _module */:
case 20 /* _namespace */:
case 30 /* _type */:
return true;

@@ -936,3 +974,3 @@ default:

// See `parseNamespaceExportDeclaration` in TypeScript's own parser
util_1.expectContextual(19 /* _namespace */);
util_1.expectContextual(20 /* _namespace */);
expression_1.parseIdentifier();

@@ -973,5 +1011,5 @@ util_1.semicolon();

tsParseModifier([
24 /* _public */,
23 /* _protected */,
22 /* _private */,
25 /* _public */,
24 /* _protected */,
23 /* _private */,
]);

@@ -983,5 +1021,5 @@ }

let isReadonly = false;
const mod = tsParseModifier([1 /* _abstract */, 25 /* _readonly */]);
const mod = tsParseModifier([1 /* _abstract */, 26 /* _readonly */]);
switch (mod) {
case 25 /* _readonly */:
case 26 /* _readonly */:
isReadonly = true;

@@ -992,3 +1030,3 @@ isAbstract = !!tsParseModifier([1 /* _abstract */]);

isAbstract = true;
isReadonly = !!tsParseModifier([25 /* _readonly */]);
isReadonly = !!tsParseModifier([26 /* _readonly */]);
break;

@@ -1078,2 +1116,3 @@ default:

function tsAfterParseVarHead() {
tokenizer_1.eat(16000 /* bang */);
tsTryParseTypeAnnotation();

@@ -1080,0 +1119,0 @@ }

@@ -25,22 +25,24 @@ import { TokenType } from "./types";

_implements = 13,
_interface = 14,
_is = 15,
_keyof = 16,
_mixins = 17,
_module = 18,
_namespace = 19,
_of = 20,
_opaque = 21,
_private = 22,
_protected = 23,
_public = 24,
_readonly = 25,
_require = 26,
_static = 27,
_type = 28,
_set = 29,
_React = 30,
_createClass = 31,
_createReactClass = 32,
_displayName = 33,
_infer = 14,
_interface = 15,
_is = 16,
_keyof = 17,
_mixins = 18,
_module = 19,
_namespace = 20,
_of = 21,
_opaque = 22,
_private = 23,
_protected = 24,
_public = 25,
_readonly = 26,
_require = 27,
_set = 28,
_static = 29,
_type = 30,
_unique = 31,
_React = 32,
_createClass = 33,
_createReactClass = 34,
_displayName = 35,
}

@@ -47,0 +49,0 @@ export declare class Token {

@@ -125,3 +125,5 @@ "use strict";

// identifiers, so '\' also dispatches to that.
if (identifier_1.isIdentifierStart(code) || code === 92 /* backslash */) {
if (identifier_1.isIdentifierStart(code) ||
code === 92 /* backslash */ ||
(code === 64 /* atSign */ && base_1.input.charCodeAt(base_1.state.pos + 1) === 64 /* atSign */)) {
readWord_1.default();

@@ -258,3 +260,10 @@ }

if (nextChar === code) {
finishOp(code === 124 /* verticalBar */ ? 17922 /* logicalOR */ : 18435 /* logicalAND */, 2);
if (base_1.input.charCodeAt(base_1.state.pos + 2) === 61 /* equalsTo */) {
// ||= or &&=
finishOp(14880 /* assign */, 3);
}
else {
// || or &&
finishOp(code === 124 /* verticalBar */ ? 17922 /* logicalOR */ : 18435 /* logicalAND */, 2);
}
return;

@@ -357,4 +366,10 @@ }

if (nextChar === 63 /* questionMark */) {
// '??'
finishOp(17410 /* nullishCoalescing */, 2);
if (nextChar2 === 61 /* equalsTo */) {
// '??='
finishOp(14880 /* assign */, 3);
}
else {
// '??'
finishOp(17410 /* nullishCoalescing */, 2);
}
}

@@ -361,0 +376,0 @@ else if (nextChar === 46 /* dot */ &&

@@ -23,3 +23,3 @@ "use strict";

base_1.input.charCodeAt(base_1.state.pos) !== 92 /* backslash */) {
index_1.finishToken(2048 /* name */, 30 /* _React */);
index_1.finishToken(2048 /* name */, 32 /* _React */);
return;

@@ -175,3 +175,3 @@ }

base_1.input.charCodeAt(base_1.state.pos) !== 92 /* backslash */) {
index_1.finishToken(2048 /* name */, 31 /* _createClass */);
index_1.finishToken(2048 /* name */, 33 /* _createClass */);
return;

@@ -192,3 +192,3 @@ }

base_1.input.charCodeAt(base_1.state.pos) !== 92 /* backslash */) {
index_1.finishToken(2048 /* name */, 32 /* _createReactClass */);
index_1.finishToken(2048 /* name */, 34 /* _createReactClass */);
return;

@@ -267,3 +267,3 @@ }

base_1.input.charCodeAt(base_1.state.pos) !== 92 /* backslash */) {
index_1.finishToken(2048 /* name */, 33 /* _displayName */);
index_1.finishToken(2048 /* name */, 35 /* _displayName */);
return;

@@ -460,2 +460,11 @@ }

switch (base_1.input.charCodeAt(base_1.state.pos++)) {
case 102 /* lowercaseF */:
if (base_1.input.charCodeAt(base_1.state.pos++) === 101 /* lowercaseE */ &&
base_1.input.charCodeAt(base_1.state.pos++) === 114 /* lowercaseR */ &&
!identifier_1.isIdentifierChar(base_1.input.charCodeAt(base_1.state.pos)) &&
base_1.input.charCodeAt(base_1.state.pos) !== 92 /* backslash */) {
index_1.finishToken(2048 /* name */, 14 /* _infer */);
return;
}
break;
case 115 /* lowercaseS */:

@@ -484,3 +493,3 @@ if (base_1.input.charCodeAt(base_1.state.pos++) === 116 /* lowercaseT */ &&

base_1.input.charCodeAt(base_1.state.pos) !== 92 /* backslash */) {
index_1.finishToken(2048 /* name */, 14 /* _interface */);
index_1.finishToken(2048 /* name */, 15 /* _interface */);
return;

@@ -494,3 +503,3 @@ }

base_1.input.charCodeAt(base_1.state.pos) !== 92 /* backslash */) {
index_1.finishToken(2048 /* name */, 15 /* _is */);
index_1.finishToken(2048 /* name */, 16 /* _is */);
return;

@@ -508,3 +517,3 @@ }

base_1.input.charCodeAt(base_1.state.pos) !== 92 /* backslash */) {
index_1.finishToken(2048 /* name */, 16 /* _keyof */);
index_1.finishToken(2048 /* name */, 17 /* _keyof */);
return;

@@ -531,3 +540,3 @@ }

base_1.input.charCodeAt(base_1.state.pos) !== 92 /* backslash */) {
index_1.finishToken(2048 /* name */, 17 /* _mixins */);
index_1.finishToken(2048 /* name */, 18 /* _mixins */);
return;

@@ -543,3 +552,3 @@ }

base_1.input.charCodeAt(base_1.state.pos) !== 92 /* backslash */) {
index_1.finishToken(2048 /* name */, 18 /* _module */);
index_1.finishToken(2048 /* name */, 19 /* _module */);
return;

@@ -562,3 +571,3 @@ }

base_1.input.charCodeAt(base_1.state.pos) !== 92 /* backslash */) {
index_1.finishToken(2048 /* name */, 19 /* _namespace */);
index_1.finishToken(2048 /* name */, 20 /* _namespace */);
return;

@@ -591,3 +600,3 @@ }

base_1.input.charCodeAt(base_1.state.pos) !== 92 /* backslash */) {
index_1.finishToken(2048 /* name */, 20 /* _of */);
index_1.finishToken(2048 /* name */, 21 /* _of */);
return;

@@ -603,3 +612,3 @@ }

base_1.input.charCodeAt(base_1.state.pos) !== 92 /* backslash */) {
index_1.finishToken(2048 /* name */, 21 /* _opaque */);
index_1.finishToken(2048 /* name */, 22 /* _opaque */);
return;

@@ -621,3 +630,3 @@ }

base_1.input.charCodeAt(base_1.state.pos) !== 92 /* backslash */) {
index_1.finishToken(2048 /* name */, 22 /* _private */);
index_1.finishToken(2048 /* name */, 23 /* _private */);
return;

@@ -635,3 +644,3 @@ }

base_1.input.charCodeAt(base_1.state.pos) !== 92 /* backslash */) {
index_1.finishToken(2048 /* name */, 23 /* _protected */);
index_1.finishToken(2048 /* name */, 24 /* _protected */);
return;

@@ -649,3 +658,3 @@ }

base_1.input.charCodeAt(base_1.state.pos) !== 92 /* backslash */) {
index_1.finishToken(2048 /* name */, 24 /* _public */);
index_1.finishToken(2048 /* name */, 25 /* _public */);
return;

@@ -667,3 +676,3 @@ }

base_1.input.charCodeAt(base_1.state.pos) !== 92 /* backslash */) {
index_1.finishToken(2048 /* name */, 25 /* _readonly */);
index_1.finishToken(2048 /* name */, 26 /* _readonly */);
return;

@@ -679,3 +688,3 @@ }

base_1.input.charCodeAt(base_1.state.pos) !== 92 /* backslash */) {
index_1.finishToken(2048 /* name */, 26 /* _require */);
index_1.finishToken(2048 /* name */, 27 /* _require */);
return;

@@ -703,3 +712,3 @@ }

base_1.input.charCodeAt(base_1.state.pos) !== 92 /* backslash */) {
index_1.finishToken(2048 /* name */, 29 /* _set */);
index_1.finishToken(2048 /* name */, 28 /* _set */);
return;

@@ -715,3 +724,3 @@ }

base_1.input.charCodeAt(base_1.state.pos) !== 92 /* backslash */) {
index_1.finishToken(2048 /* name */, 27 /* _static */);
index_1.finishToken(2048 /* name */, 29 /* _static */);
return;

@@ -790,3 +799,3 @@ }

base_1.input.charCodeAt(base_1.state.pos) !== 92 /* backslash */) {
index_1.finishToken(2048 /* name */, 28 /* _type */);
index_1.finishToken(2048 /* name */, 30 /* _type */);
return;

@@ -806,2 +815,14 @@ }

break;
case 117 /* lowercaseU */:
if (base_1.input.charCodeAt(base_1.state.pos++) === 110 /* lowercaseN */ &&
base_1.input.charCodeAt(base_1.state.pos++) === 105 /* lowercaseI */ &&
base_1.input.charCodeAt(base_1.state.pos++) === 113 /* lowercaseQ */ &&
base_1.input.charCodeAt(base_1.state.pos++) === 117 /* lowercaseU */ &&
base_1.input.charCodeAt(base_1.state.pos++) === 101 /* lowercaseE */ &&
!identifier_1.isIdentifierChar(base_1.input.charCodeAt(base_1.state.pos)) &&
base_1.input.charCodeAt(base_1.state.pos) !== 92 /* backslash */) {
index_1.finishToken(2048 /* name */, 31 /* _unique */);
return;
}
break;
case 118 /* lowercaseV */:

@@ -879,2 +900,5 @@ switch (base_1.input.charCodeAt(base_1.state.pos++)) {

}
else if (ch === 64 /* atSign */ && base_1.input.charCodeAt(base_1.state.pos + 1) === 64 /* atSign */) {
base_1.state.pos += 2;
}
else {

@@ -881,0 +905,0 @@ break;

{
"name": "sucrase",
"version": "1.13.0",
"version": "1.14.0",
"description": "Super-fast alternative to Babel for when you can target modern JS runtimes",

@@ -25,4 +25,6 @@ "author": "Alan Pierce <alangpierce@gmail.com>",

"benchmark": "node ./build/benchmark/benchmark.js",
"benchmark-react": "node ./build/benchmark/benchmark-react.js",
"lint": "eslint './src/**/*.ts' './test/**/*.ts' './sucrase-babylon/**/*.ts' './integrations/gulp-plugin/src/**/*.ts'",
"profile": "node --inspect-brk ./build/benchmark/profile.js",
"profile-react": "node --inspect-brk ./build/benchmark/profile-react.js",
"prepublish": "yarn run build",

@@ -48,6 +50,9 @@ "run-examples": "ts-node ./example-runner/example-runner.ts",

"devDependencies": {
"@babel/cli": "7.0.0-beta.35",
"@babel/core": "7.0.0-beta.35",
"@babel/cli": "7.0.0-beta.39",
"@babel/core": "7.0.0-beta.39",
"@babel/plugin-proposal-class-properties": "^7.0.0-beta.39",
"@babel/plugin-proposal-object-rest-spread": "^7.0.0-beta.39",
"@babel/plugin-transform-modules-commonjs": "^7.0.0-beta.35",
"@babel/preset-react": "7.0.0-beta.35",
"@babel/preset-flow": "^7.0.0-beta.39",
"@babel/preset-react": "7.0.0-beta.39",
"@babel/preset-typescript": "^7.0.0-beta.36",

@@ -66,8 +71,8 @@ "@babel/register": "^7.0.0-beta.35",

"mocha": "^3.5.3",
"prettier": "^1.9.2",
"prettier": "^1.12.1",
"ts-node": "^4.0.2",
"tslint": "^5.8.0",
"tslint-language-service": "^0.9.7",
"typescript": "^2.6.2",
"typescript-eslint-parser": "^11.0.0"
"tslint": "^5.9.1",
"tslint-language-service": "^0.9.9",
"typescript": "^2.8.3",
"typescript-eslint-parser": "^15.0.0"
},

@@ -80,3 +85,3 @@ "dependencies": {

"pirates": "^3.0.2",
"tslib": "^1.7.1"
"tslib": "^1.9.0"
},

@@ -83,0 +88,0 @@ "engines": {

@@ -6,4 +6,4 @@ # Sucrase

[![MIT License](https://img.shields.io/npm/l/express.svg?maxAge=2592000)](LICENSE)
[![Join the chat at https://gitter.im/sucrasejs](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/sucrasejs/Lobby)
### [Try it out](https://sucrase.io)

@@ -23,3 +23,3 @@

Sucrase can convert the following codebases with all tests passing:
Sucrase can build the following codebases with all tests passing:
* Sucrase itself (6K lines of code excluding Babylon fork, typescript, imports).

@@ -44,3 +44,3 @@ * The [Benchling](https://benchling.com/) frontend codebase

are four main transforms that you may want to enable:
* **jsx**: Converts JSX syntax to `React.createElement`, e.g. `<div a={b} />`
* **jsx**: Transforms JSX syntax to `React.createElement`, e.g. `<div a={b} />`
becomes `React.createElement('div', {a: b})`. Behaves like Babel 7's

@@ -53,3 +53,3 @@ [babel-preset-react](https://github.com/babel/babel/tree/master/packages/babel-preset-react),

to `const f = (x) => "hi";`. Does not check types.
* **imports**: Converts ES Modules (`import`/`export`) to CommonJS
* **imports**: Transforms ES Modules (`import`/`export`) to CommonJS
(`require`/`module.exports`) using the same approach as Babel. With the

@@ -56,0 +56,0 @@ `typescript` transform enabled, the import conversion uses the behavior of the

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

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

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