Comparing version 3.26.0 to 3.27.0
@@ -33,3 +33,3 @@ import CJSImportProcessor from "./CJSImportProcessor"; | ||
export function getVersion() { | ||
return "3.26.0"; | ||
return "3.27.0"; | ||
} | ||
@@ -36,0 +36,0 @@ |
@@ -6,3 +6,4 @@ export var ContextualKeyword; (function (ContextualKeyword) { | ||
const _as = _accessor + 1; ContextualKeyword[ContextualKeyword["_as"] = _as] = "_as"; | ||
const _asserts = _as + 1; ContextualKeyword[ContextualKeyword["_asserts"] = _asserts] = "_asserts"; | ||
const _assert = _as + 1; ContextualKeyword[ContextualKeyword["_assert"] = _assert] = "_assert"; | ||
const _asserts = _assert + 1; ContextualKeyword[ContextualKeyword["_asserts"] = _asserts] = "_asserts"; | ||
const _async = _asserts + 1; ContextualKeyword[ContextualKeyword["_async"] = _async] = "_async"; | ||
@@ -9,0 +10,0 @@ const _await = _async + 1; ContextualKeyword[ContextualKeyword["_await"] = _await] = "_await"; |
@@ -48,3 +48,3 @@ // Generated file, do not edit! Run "yarn generate" to re-generate this file. | ||
// "assert" | ||
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 567, -1, -1, -1, -1, -1, -1, -1, | ||
ContextualKeyword._assert << 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 567, -1, -1, -1, -1, -1, -1, -1, | ||
// "asserts" | ||
@@ -51,0 +51,0 @@ ContextualKeyword._asserts << 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
@@ -67,2 +67,3 @@ /* eslint max-len: 0 */ | ||
parseMethod, | ||
parseObj, | ||
parseParenExpression, | ||
@@ -82,2 +83,3 @@ parsePropertyName, | ||
expectContextual, | ||
hasPrecedingLineBreak, | ||
isContextual, | ||
@@ -1001,2 +1003,3 @@ isLineTerminator, | ||
parseExprAtom(); | ||
maybeParseImportAssertions(); | ||
} | ||
@@ -1124,2 +1127,3 @@ semicolon(); | ||
} | ||
maybeParseImportAssertions(); | ||
semicolon(); | ||
@@ -1198,1 +1202,14 @@ } | ||
} | ||
/** | ||
* Parse import assertions like `assert {type: "json"}`. | ||
* | ||
* Import assertions technically have their own syntax, but are always parseable | ||
* as a plain JS object, so just do that for simplicity. | ||
*/ | ||
function maybeParseImportAssertions() { | ||
if (isContextual(ContextualKeyword._assert) && !hasPrecedingLineBreak()) { | ||
next(); | ||
parseObj(false, false); | ||
} | ||
} |
@@ -192,2 +192,20 @@ | ||
/** | ||
* Remove all code until the next }, accounting for balanced braces. | ||
*/ | ||
removeBalancedCode() { | ||
let braceDepth = 0; | ||
while (!this.isAtEnd()) { | ||
if (this.matches1(tt.braceL)) { | ||
braceDepth++; | ||
} else if (this.matches1(tt.braceR)) { | ||
if (braceDepth === 0) { | ||
return; | ||
} | ||
braceDepth--; | ||
} | ||
this.removeToken(); | ||
} | ||
} | ||
copyExpectedToken(tokenType) { | ||
@@ -194,0 +212,0 @@ if (this.tokens[this.tokenIndex].type !== tokenType) { |
@@ -13,2 +13,3 @@ | ||
import getImportExportSpecifierInfo from "../util/getImportExportSpecifierInfo"; | ||
import {removeMaybeImportAssertion} from "../util/removeMaybeImportAssertion"; | ||
import shouldElideDefaultExport from "../util/shouldElideDefaultExport"; | ||
@@ -147,2 +148,3 @@ | ||
} | ||
removeMaybeImportAssertion(this.tokens); | ||
if (this.tokens.matches1(tt.semi)) { | ||
@@ -335,2 +337,3 @@ this.tokens.removeToken(); | ||
this.tokens.removeToken(); | ||
removeMaybeImportAssertion(this.tokens); | ||
} | ||
@@ -787,2 +790,3 @@ return true; | ||
this.tokens.replaceTokenTrimmingLeftWhitespace(this.importProcessor.claimImportCode(path)); | ||
removeMaybeImportAssertion(this.tokens); | ||
} else { | ||
@@ -805,2 +809,3 @@ // This is a normal named export, so use that. | ||
this.tokens.replaceTokenTrimmingLeftWhitespace(this.importProcessor.claimImportCode(path)); | ||
removeMaybeImportAssertion(this.tokens); | ||
if (this.tokens.matches1(tt.semi)) { | ||
@@ -807,0 +812,0 @@ this.tokens.removeToken(); |
@@ -14,2 +14,3 @@ | ||
import {getNonTypeIdentifiers} from "../util/getNonTypeIdentifiers"; | ||
import {removeMaybeImportAssertion} from "../util/removeMaybeImportAssertion"; | ||
import shouldElideDefaultExport from "../util/shouldElideDefaultExport"; | ||
@@ -106,2 +107,3 @@ | ||
this.tokens.removeToken(); | ||
removeMaybeImportAssertion(this.tokens); | ||
} | ||
@@ -150,2 +152,3 @@ return true; | ||
this.tokens.removeToken(); | ||
removeMaybeImportAssertion(this.tokens); | ||
if (this.tokens.matches1(tt.semi)) { | ||
@@ -152,0 +155,0 @@ this.tokens.removeToken(); |
@@ -33,3 +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() { | ||
return "3.26.0"; | ||
return "3.27.0"; | ||
} exports.getVersion = getVersion; | ||
@@ -36,0 +36,0 @@ |
@@ -6,3 +6,4 @@ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var ContextualKeyword; (function (ContextualKeyword) { | ||
const _as = _accessor + 1; ContextualKeyword[ContextualKeyword["_as"] = _as] = "_as"; | ||
const _asserts = _as + 1; ContextualKeyword[ContextualKeyword["_asserts"] = _asserts] = "_asserts"; | ||
const _assert = _as + 1; ContextualKeyword[ContextualKeyword["_assert"] = _assert] = "_assert"; | ||
const _asserts = _assert + 1; ContextualKeyword[ContextualKeyword["_asserts"] = _asserts] = "_asserts"; | ||
const _async = _asserts + 1; ContextualKeyword[ContextualKeyword["_async"] = _async] = "_async"; | ||
@@ -9,0 +10,0 @@ const _await = _async + 1; ContextualKeyword[ContextualKeyword["_await"] = _await] = "_await"; |
@@ -48,3 +48,3 @@ "use strict";Object.defineProperty(exports, "__esModule", {value: true});// Generated file, do not edit! Run "yarn generate" to re-generate this file. | ||
// "assert" | ||
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 567, -1, -1, -1, -1, -1, -1, -1, | ||
_keywords.ContextualKeyword._assert << 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 567, -1, -1, -1, -1, -1, -1, -1, | ||
// "asserts" | ||
@@ -51,0 +51,0 @@ _keywords.ContextualKeyword._asserts << 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
@@ -69,2 +69,3 @@ "use strict";Object.defineProperty(exports, "__esModule", {value: true});/* eslint max-len: 0 */ | ||
var _expression = require('./expression'); | ||
@@ -86,2 +87,3 @@ | ||
var _util = require('./util'); | ||
@@ -1001,2 +1003,3 @@ | ||
_expression.parseExprAtom.call(void 0, ); | ||
maybeParseImportAssertions(); | ||
} | ||
@@ -1124,2 +1127,3 @@ _util.semicolon.call(void 0, ); | ||
} | ||
maybeParseImportAssertions(); | ||
_util.semicolon.call(void 0, ); | ||
@@ -1198,1 +1202,14 @@ } exports.parseImport = parseImport; | ||
} | ||
/** | ||
* Parse import assertions like `assert {type: "json"}`. | ||
* | ||
* Import assertions technically have their own syntax, but are always parseable | ||
* as a plain JS object, so just do that for simplicity. | ||
*/ | ||
function maybeParseImportAssertions() { | ||
if (_util.isContextual.call(void 0, _keywords.ContextualKeyword._assert) && !_util.hasPrecedingLineBreak.call(void 0, )) { | ||
_tokenizer.next.call(void 0, ); | ||
_expression.parseObj.call(void 0, false, false); | ||
} | ||
} |
@@ -192,2 +192,20 @@ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
/** | ||
* Remove all code until the next }, accounting for balanced braces. | ||
*/ | ||
removeBalancedCode() { | ||
let braceDepth = 0; | ||
while (!this.isAtEnd()) { | ||
if (this.matches1(_types.TokenType.braceL)) { | ||
braceDepth++; | ||
} else if (this.matches1(_types.TokenType.braceR)) { | ||
if (braceDepth === 0) { | ||
return; | ||
} | ||
braceDepth--; | ||
} | ||
this.removeToken(); | ||
} | ||
} | ||
copyExpectedToken(tokenType) { | ||
@@ -194,0 +212,0 @@ if (this.tokens[this.tokenIndex].type !== tokenType) { |
@@ -13,2 +13,3 @@ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
var _getImportExportSpecifierInfo = require('../util/getImportExportSpecifierInfo'); var _getImportExportSpecifierInfo2 = _interopRequireDefault(_getImportExportSpecifierInfo); | ||
var _removeMaybeImportAssertion = require('../util/removeMaybeImportAssertion'); | ||
var _shouldElideDefaultExport = require('../util/shouldElideDefaultExport'); var _shouldElideDefaultExport2 = _interopRequireDefault(_shouldElideDefaultExport); | ||
@@ -147,2 +148,3 @@ | ||
} | ||
_removeMaybeImportAssertion.removeMaybeImportAssertion.call(void 0, this.tokens); | ||
if (this.tokens.matches1(_types.TokenType.semi)) { | ||
@@ -335,2 +337,3 @@ this.tokens.removeToken(); | ||
this.tokens.removeToken(); | ||
_removeMaybeImportAssertion.removeMaybeImportAssertion.call(void 0, this.tokens); | ||
} | ||
@@ -787,2 +790,3 @@ return true; | ||
this.tokens.replaceTokenTrimmingLeftWhitespace(this.importProcessor.claimImportCode(path)); | ||
_removeMaybeImportAssertion.removeMaybeImportAssertion.call(void 0, this.tokens); | ||
} else { | ||
@@ -805,2 +809,3 @@ // This is a normal named export, so use that. | ||
this.tokens.replaceTokenTrimmingLeftWhitespace(this.importProcessor.claimImportCode(path)); | ||
_removeMaybeImportAssertion.removeMaybeImportAssertion.call(void 0, this.tokens); | ||
if (this.tokens.matches1(_types.TokenType.semi)) { | ||
@@ -807,0 +812,0 @@ this.tokens.removeToken(); |
@@ -14,2 +14,3 @@ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
var _getNonTypeIdentifiers = require('../util/getNonTypeIdentifiers'); | ||
var _removeMaybeImportAssertion = require('../util/removeMaybeImportAssertion'); | ||
var _shouldElideDefaultExport = require('../util/shouldElideDefaultExport'); var _shouldElideDefaultExport2 = _interopRequireDefault(_shouldElideDefaultExport); | ||
@@ -106,2 +107,3 @@ | ||
this.tokens.removeToken(); | ||
_removeMaybeImportAssertion.removeMaybeImportAssertion.call(void 0, this.tokens); | ||
} | ||
@@ -150,2 +152,3 @@ return true; | ||
this.tokens.removeToken(); | ||
_removeMaybeImportAssertion.removeMaybeImportAssertion.call(void 0, this.tokens); | ||
if (this.tokens.matches1(_types.TokenType.semi)) { | ||
@@ -152,0 +155,0 @@ this.tokens.removeToken(); |
@@ -6,36 +6,37 @@ export declare enum ContextualKeyword { | ||
_as = 3, | ||
_asserts = 4, | ||
_async = 5, | ||
_await = 6, | ||
_checks = 7, | ||
_constructor = 8, | ||
_declare = 9, | ||
_enum = 10, | ||
_exports = 11, | ||
_from = 12, | ||
_get = 13, | ||
_global = 14, | ||
_implements = 15, | ||
_infer = 16, | ||
_interface = 17, | ||
_is = 18, | ||
_keyof = 19, | ||
_mixins = 20, | ||
_module = 21, | ||
_namespace = 22, | ||
_of = 23, | ||
_opaque = 24, | ||
_out = 25, | ||
_override = 26, | ||
_private = 27, | ||
_protected = 28, | ||
_proto = 29, | ||
_public = 30, | ||
_readonly = 31, | ||
_require = 32, | ||
_set = 33, | ||
_static = 34, | ||
_symbol = 35, | ||
_type = 36, | ||
_unique = 37 | ||
_assert = 4, | ||
_asserts = 5, | ||
_async = 6, | ||
_await = 7, | ||
_checks = 8, | ||
_constructor = 9, | ||
_declare = 10, | ||
_enum = 11, | ||
_exports = 12, | ||
_from = 13, | ||
_get = 14, | ||
_global = 15, | ||
_implements = 16, | ||
_infer = 17, | ||
_interface = 18, | ||
_is = 19, | ||
_keyof = 20, | ||
_mixins = 21, | ||
_module = 22, | ||
_namespace = 23, | ||
_of = 24, | ||
_opaque = 25, | ||
_out = 26, | ||
_override = 27, | ||
_private = 28, | ||
_protected = 29, | ||
_proto = 30, | ||
_public = 31, | ||
_readonly = 32, | ||
_require = 33, | ||
_set = 34, | ||
_static = 35, | ||
_symbol = 36, | ||
_type = 37, | ||
_unique = 38 | ||
} |
@@ -56,2 +56,6 @@ import type { HelperManager } from "./HelperManager"; | ||
removeToken(): void; | ||
/** | ||
* Remove all code until the next }, accounting for balanced braces. | ||
*/ | ||
removeBalancedCode(): void; | ||
copyExpectedToken(tokenType: TokenType): void; | ||
@@ -58,0 +62,0 @@ copyToken(): void; |
{ | ||
"name": "sucrase", | ||
"version": "3.26.0", | ||
"version": "3.27.0", | ||
"description": "Super-fast alternative to Babel for when you can target modern JS runtimes", | ||
@@ -66,3 +66,3 @@ "author": "Alan Pierce <alangpierce@gmail.com>", | ||
"prettier": "^2.6.2", | ||
"sucrase": "^3.25.0", | ||
"sucrase": "^3.26.0", | ||
"test262-harness": "^10.0.0", | ||
@@ -69,0 +69,0 @@ "ts-interface-builder": "^0.3.3", |
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
1086945
186
27438