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.14.1 to 3.15.0

9

CHANGELOG.md

@@ -0,4 +1,8 @@

# 3.15.0 (2020-05-18)
* Add support for `declare` class fields in TypeScript. ([#537])
# 3.14.1 (2020-05-17)
* Add support for `export type {T} from './T';` type-only export syntax. ([#533])
* Add support for `export type {T} from './T';` type-only export syntax. ([#533]) (Patrik Oldsberg)

@@ -8,3 +12,3 @@ # 3.14.0 (2020-05-10)

* Add support for TypeScript 3.8 type-only imports and exports. ([#523], [#532])
* Add a `--production` flag to the CLI. ([#529])
* Add a `--production` flag to the CLI. ([#529]) (Matthew Phillips)
* Fix crash when using `+` or `-` in constructor parameter defaults. ([#531])

@@ -292,1 +296,2 @@

[#533]: https://github.com/alangpierce/sucrase/pull/533
[#537]: https://github.com/alangpierce/sucrase/pull/537

@@ -1,5 +0,5 @@

import { HelperManager } from "./HelperManager";
import { Options } from "./index";
import NameManager from "./NameManager";
import TokenProcessor from "./TokenProcessor";
import type { HelperManager } from "./HelperManager";
import type { Options } from "./index";
import type NameManager from "./NameManager";
import type TokenProcessor from "./TokenProcessor";
/**

@@ -6,0 +6,0 @@ * Class responsible for preprocessing and bookkeeping import and export declarations within the

@@ -1,2 +0,2 @@

"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
"use strict";Object.defineProperty(exports, "__esModule", {value: true});

@@ -3,0 +3,0 @@

@@ -1,2 +0,2 @@

import { SourceMapOptions } from "./index";
import type { SourceMapOptions } from "./index";
export interface RawSourceMap {

@@ -3,0 +3,0 @@ version: number;

@@ -1,2 +0,2 @@

import NameManager from "./NameManager";
import type NameManager from "./NameManager";
declare const HELPERS: {

@@ -3,0 +3,0 @@ interopRequireWildcard: string;

@@ -1,2 +0,2 @@

"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
"use strict";Object.defineProperty(exports, "__esModule", {value: true});

@@ -161,6 +161,3 @@ const HELPERS = {

resultCode += " ";
resultCode += helperCode
.replace(baseName, helperName)
.replace(/\s+/g, " ")
.trim();
resultCode += helperCode.replace(baseName, helperName).replace(/\s+/g, " ").trim();
}

@@ -167,0 +164,0 @@ }

@@ -1,3 +0,3 @@

import { Scope } from "./parser/tokenizer/state";
import TokenProcessor from "./TokenProcessor";
import type { Scope } from "./parser/tokenizer/state";
import type TokenProcessor from "./TokenProcessor";
/**

@@ -4,0 +4,0 @@ * Traverse the given tokens and modify them if necessary to indicate that some names shadow global

@@ -1,2 +0,2 @@

"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
"use strict";Object.defineProperty(exports, "__esModule", {value: true});

@@ -3,0 +3,0 @@

@@ -5,3 +5,3 @@ import CJSImportProcessor from "./CJSImportProcessor";

import NameManager from "./NameManager";
import { Scope } from "./parser/tokenizer/state";
import type { Scope } from "./parser/tokenizer/state";
import TokenProcessor from "./TokenProcessor";

@@ -8,0 +8,0 @@ export interface TransformResult {

@@ -1,2 +0,2 @@

import { Token } from "./parser/tokenizer";
import type { Token } from "./parser/tokenizer";
export default class NameManager {

@@ -3,0 +3,0 @@ private readonly usedNames;

@@ -1,3 +0,3 @@

import { Token } from "./tokenizer/index";
import { Scope } from "./tokenizer/state";
import type { Token } from "./tokenizer/index";
import type { Scope } from "./tokenizer/state";
export declare class File {

@@ -4,0 +4,0 @@ tokens: Array<Token>;

"use strict";Object.defineProperty(exports, "__esModule", {value: true});
var _base = require('./traverser/base');
var _index3 = require('./traverser/index');
var _index = require('./traverser/index');

@@ -26,3 +26,3 @@ class File {

_base.initParser.call(void 0, input, isJSXEnabled, isTypeScriptEnabled, isFlowEnabled);
const result = _index3.parseFile.call(void 0, );
const result = _index.parseFile.call(void 0, );
if (_base.state.error) {

@@ -29,0 +29,0 @@ throw _base.augmentError.call(void 0, _base.state.error);

@@ -116,2 +116,5 @@ "use strict";Object.defineProperty(exports, "__esModule", {value: true});

break;
case _keywords.ContextualKeyword._declare:
_base.state.tokens[_base.state.tokens.length - 1].type = _types.TokenType._declare;
break;
default:

@@ -1217,14 +1220,17 @@ break;

const mod = tsParseModifier([_keywords.ContextualKeyword._abstract, _keywords.ContextualKeyword._readonly]);
switch (mod) {
case _keywords.ContextualKeyword._readonly:
while (true) {
const mod = tsParseModifier([
_keywords.ContextualKeyword._abstract,
_keywords.ContextualKeyword._readonly,
_keywords.ContextualKeyword._declare,
]);
if (mod == null) {
break;
}
if (mod === _keywords.ContextualKeyword._readonly) {
isReadonly = true;
isAbstract = !!tsParseModifier([_keywords.ContextualKeyword._abstract]);
break;
case _keywords.ContextualKeyword._abstract:
}
if (mod === _keywords.ContextualKeyword._abstract) {
isAbstract = true;
isReadonly = !!tsParseModifier([_keywords.ContextualKeyword._readonly]);
break;
default:
break;
}
}

@@ -1231,0 +1237,0 @@

@@ -1,2 +0,2 @@

import { Token } from "./index";
import type { Token } from "./index";
import { ContextualKeyword } from "./keywords";

@@ -3,0 +3,0 @@ import { TokenType } from "./types";

@@ -1,2 +0,2 @@

import { File } from "../index";
import type { File } from "../index";
export declare function parseFile(): File;
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
var _index3 = require('../tokenizer/index');
var _index = require('../tokenizer/index');
var _charcodes = require('../util/charcodes');

@@ -14,6 +14,6 @@ var _base = require('./base');

) {
_index3.skipLineComment.call(void 0, 2);
_index.skipLineComment.call(void 0, 2);
}
_index3.nextToken.call(void 0, );
_index.nextToken.call(void 0, );
return _statement.parseTopLevel.call(void 0, );
} exports.parseFile = parseFile;

@@ -691,3 +691,5 @@ "use strict";Object.defineProperty(exports, "__esModule", {value: true});/* eslint max-len: 0 */

if (_base.isTypeScriptEnabled) {
_util.eatContextual.call(void 0, _keywords.ContextualKeyword._declare);
_typescript.tsParseAccessModifier.call(void 0, );
_util.eatContextual.call(void 0, _keywords.ContextualKeyword._declare);
}

@@ -694,0 +696,0 @@ let isStatic = false;

@@ -1,2 +0,2 @@

import { ContextualKeyword } from "../tokenizer/keywords";
import type { ContextualKeyword } from "../tokenizer/keywords";
import { TokenType } from "../tokenizer/types";

@@ -3,0 +3,0 @@ export declare function isContextual(contextualKeyword: ContextualKeyword): boolean;

@@ -1,4 +0,4 @@

import { HelperManager } from "./HelperManager";
import { Token } from "./parser/tokenizer";
import { ContextualKeyword } from "./parser/tokenizer/keywords";
import type { HelperManager } from "./HelperManager";
import type { Token } from "./parser/tokenizer";
import type { ContextualKeyword } from "./parser/tokenizer/keywords";
import { TokenType } from "./parser/tokenizer/types";

@@ -5,0 +5,0 @@ export interface TokenProcessorSnapshot {

@@ -1,6 +0,6 @@

import CJSImportProcessor from "../CJSImportProcessor";
import NameManager from "../NameManager";
import TokenProcessor from "../TokenProcessor";
import ReactHotLoaderTransformer from "./ReactHotLoaderTransformer";
import RootTransformer from "./RootTransformer";
import type CJSImportProcessor from "../CJSImportProcessor";
import type NameManager from "../NameManager";
import type TokenProcessor from "../TokenProcessor";
import type ReactHotLoaderTransformer from "./ReactHotLoaderTransformer";
import type RootTransformer from "./RootTransformer";
import Transformer from "./Transformer";

@@ -7,0 +7,0 @@ /**

@@ -1,5 +0,5 @@

import { Options } from "../index";
import NameManager from "../NameManager";
import TokenProcessor from "../TokenProcessor";
import ReactHotLoaderTransformer from "./ReactHotLoaderTransformer";
import type { Options } from "../index";
import type NameManager from "../NameManager";
import type TokenProcessor from "../TokenProcessor";
import type ReactHotLoaderTransformer from "./ReactHotLoaderTransformer";
import Transformer from "./Transformer";

@@ -6,0 +6,0 @@ /**

@@ -1,3 +0,3 @@

import TokenProcessor from "../TokenProcessor";
import RootTransformer from "./RootTransformer";
import type TokenProcessor from "../TokenProcessor";
import type RootTransformer from "./RootTransformer";
import Transformer from "./Transformer";

@@ -4,0 +4,0 @@ export default class FlowTransformer extends Transformer {

@@ -1,7 +0,7 @@

import CJSImportProcessor from "../CJSImportProcessor";
import { Options } from "../index";
import NameManager from "../NameManager";
import TokenProcessor from "../TokenProcessor";
import type CJSImportProcessor from "../CJSImportProcessor";
import type { Options } from "../index";
import type NameManager from "../NameManager";
import type TokenProcessor from "../TokenProcessor";
import { JSXPragmaInfo } from "../util/getJSXPragmaInfo";
import RootTransformer from "./RootTransformer";
import type RootTransformer from "./RootTransformer";
import Transformer from "./Transformer";

@@ -8,0 +8,0 @@ export default class JSXTransformer extends Transformer {

@@ -1,2 +0,2 @@

import TokenProcessor from "../TokenProcessor";
import type TokenProcessor from "../TokenProcessor";
import Transformer from "./Transformer";

@@ -3,0 +3,0 @@ export default class NumericSeparatorTransformer extends Transformer {

@@ -1,3 +0,3 @@

import NameManager from "../NameManager";
import TokenProcessor from "../TokenProcessor";
import type NameManager from "../NameManager";
import type TokenProcessor from "../TokenProcessor";
import Transformer from "./Transformer";

@@ -4,0 +4,0 @@ export default class OptionalCatchBindingTransformer extends Transformer {

@@ -1,3 +0,3 @@

import NameManager from "../NameManager";
import TokenProcessor from "../TokenProcessor";
import type NameManager from "../NameManager";
import type TokenProcessor from "../TokenProcessor";
import Transformer from "./Transformer";

@@ -4,0 +4,0 @@ /**

@@ -1,5 +0,5 @@

import CJSImportProcessor from "../CJSImportProcessor";
import { Options } from "../index";
import TokenProcessor from "../TokenProcessor";
import RootTransformer from "./RootTransformer";
import type CJSImportProcessor from "../CJSImportProcessor";
import type { Options } from "../index";
import type TokenProcessor from "../TokenProcessor";
import type RootTransformer from "./RootTransformer";
import Transformer from "./Transformer";

@@ -6,0 +6,0 @@ /**

@@ -1,2 +0,2 @@

import TokenProcessor from "../TokenProcessor";
import type TokenProcessor from "../TokenProcessor";
import Transformer from "./Transformer";

@@ -3,0 +3,0 @@ export default class ReactHotLoaderTransformer extends Transformer {

@@ -1,2 +0,2 @@

import { Options, SucraseContext, Transform } from "../index";
import type { Options, SucraseContext, Transform } from "../index";
import { ClassInfo } from "../util/getClassInfo";

@@ -3,0 +3,0 @@ export default class RootTransformer {

@@ -1,3 +0,3 @@

import TokenProcessor from "../TokenProcessor";
import RootTransformer from "./RootTransformer";
import type TokenProcessor from "../TokenProcessor";
import type RootTransformer from "./RootTransformer";
import Transformer from "./Transformer";

@@ -4,0 +4,0 @@ export default class TypeScriptTransformer extends Transformer {

@@ -1,2 +0,2 @@

import TokenProcessor from "../TokenProcessor";
import type TokenProcessor from "../TokenProcessor";
export default function elideImportEquals(tokens: TokenProcessor): void;

@@ -1,2 +0,2 @@

"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }var _types = require('../parser/tokenizer/types');
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _types = require('../parser/tokenizer/types');

@@ -3,0 +3,0 @@

@@ -1,2 +0,2 @@

import { Token } from "../parser/tokenizer";
import type { Token } from "../parser/tokenizer";
export default function formatTokens(code: string, tokens: Array<Token>): string;

@@ -1,4 +0,4 @@

import NameManager from "../NameManager";
import TokenProcessor from "../TokenProcessor";
import RootTransformer from "../transformers/RootTransformer";
import type NameManager from "../NameManager";
import type TokenProcessor from "../TokenProcessor";
import type RootTransformer from "../transformers/RootTransformer";
export interface ClassHeaderInfo {

@@ -5,0 +5,0 @@ isExpression: boolean;

@@ -1,2 +0,2 @@

"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
"use strict";Object.defineProperty(exports, "__esModule", {value: true});

@@ -266,2 +266,3 @@ var _keywords = require('../parser/tokenizer/keywords');

_types.TokenType.star,
_types.TokenType._declare,
].includes(token.type);

@@ -268,0 +269,0 @@ }

@@ -1,2 +0,2 @@

import TokenProcessor from "../TokenProcessor";
import type TokenProcessor from "../TokenProcessor";
export interface DeclarationInfo {

@@ -3,0 +3,0 @@ typeDeclarations: Set<string>;

@@ -1,2 +0,2 @@

"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }var _tokenizer = require('../parser/tokenizer');
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _tokenizer = require('../parser/tokenizer');
var _types = require('../parser/tokenizer/types');

@@ -3,0 +3,0 @@

@@ -1,2 +0,2 @@

import { Token } from "../parser/tokenizer";
import type { Token } from "../parser/tokenizer";
/**

@@ -3,0 +3,0 @@ * Get all identifier names in the code, in order, including duplicates.

@@ -1,2 +0,2 @@

import { Options } from "../index";
import type { Options } from "../index";
export interface JSXPragmaInfo {

@@ -3,0 +3,0 @@ base: string;

@@ -1,3 +0,3 @@

import { Options } from "../index";
import TokenProcessor from "../TokenProcessor";
import type { Options } from "../index";
import type TokenProcessor from "../TokenProcessor";
export declare function getNonTypeIdentifiers(tokens: TokenProcessor, options: Options): Set<string>;

@@ -1,2 +0,2 @@

import TokenProcessor from "../TokenProcessor";
import type TokenProcessor from "../TokenProcessor";
/**

@@ -3,0 +3,0 @@ * Special case code to scan for imported names in ESM TypeScript. We need to do this so we can

@@ -1,2 +0,2 @@

"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }var _keywords = require('../parser/tokenizer/keywords');
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _keywords = require('../parser/tokenizer/keywords');
var _types = require('../parser/tokenizer/types');

@@ -3,0 +3,0 @@

@@ -1,2 +0,2 @@

import TokenProcessor from "../TokenProcessor";
import type TokenProcessor from "../TokenProcessor";
/**

@@ -3,0 +3,0 @@ * Determine whether this optional chain or nullish coalescing operation has any await statements in

@@ -1,2 +0,2 @@

"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }var _keywords = require('../parser/tokenizer/keywords');
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _keywords = require('../parser/tokenizer/keywords');

@@ -3,0 +3,0 @@

@@ -1,3 +0,3 @@

import TokenProcessor from "../TokenProcessor";
import { DeclarationInfo } from "./getDeclarationInfo";
import type TokenProcessor from "../TokenProcessor";
import type { DeclarationInfo } from "./getDeclarationInfo";
/**

@@ -4,0 +4,0 @@ * Common method sharing code between CJS and ESM cases, since they're the same here.

@@ -1,2 +0,2 @@

"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }var _types = require('../parser/tokenizer/types');
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _types = require('../parser/tokenizer/types');

@@ -3,0 +3,0 @@

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

@@ -62,3 +62,3 @@ "author": "Alan Pierce <alangpierce@gmail.com>",

"@types/yargs-parser": "^13.1.0",
"@typescript-eslint/parser": "^2.6.1",
"@typescript-eslint/parser": "^2.33.0",
"chalk": "2.4.1",

@@ -74,4 +74,4 @@ "codecov": "^3.6.1",

"nyc": "^14.1.1",
"prettier": "^1.19.1",
"sucrase": "^3.14.0",
"prettier": "^2.0.5",
"sucrase": "^3.14.1",
"test262-harness": "^6.5.0",

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

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