Socket
Socket
Sign inDemoInstall

@typescript-eslint/typescript-estree

Package Overview
Dependencies
Maintainers
1
Versions
3812
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@typescript-eslint/typescript-estree - npm Package Compare versions

Comparing version 1.7.1-alpha.19 to 1.7.1-alpha.20

2

dist/ast-converter.d.ts
import ts from 'typescript';
import { Extra } from './parser-options';
export default function astConverter(ast: ts.SourceFile, extra: Extra, shouldProvideParserServices: boolean): {
export default function astConverter(ast: ts.SourceFile, extra: Extra, shouldPreserveNodeMaps: boolean): {
estree: import("./ts-estree/ts-estree").Program;

@@ -5,0 +5,0 @@ astMaps: {

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

const node_utils_1 = require("./node-utils");
function astConverter(ast, extra, shouldProvideParserServices) {
function astConverter(ast, extra, shouldPreserveNodeMaps) {
/**

@@ -21,3 +21,3 @@ * The TypeScript compiler produced fundamental parse errors when parsing the

useJSXTextNode: extra.useJSXTextNode || false,
shouldProvideParserServices,
shouldPreserveNodeMaps,
});

@@ -37,5 +37,3 @@ const estree = instance.convertProgram();

}
const astMaps = shouldProvideParserServices
? instance.getASTMaps()
: undefined;
const astMaps = shouldPreserveNodeMaps ? instance.getASTMaps() : undefined;
return { estree, astMaps };

@@ -42,0 +40,0 @@ }

@@ -6,3 +6,3 @@ import ts from 'typescript';

useJSXTextNode: boolean;
shouldProvideParserServices: boolean;
shouldPreserveNodeMaps: boolean;
}

@@ -9,0 +9,0 @@ /**

@@ -20,2 +20,3 @@ import { Program } from 'typescript';

extraFileExtensions: string[];
preserveNodeMaps?: boolean;
}

@@ -36,2 +37,3 @@ export interface ParserOptions {

extraFileExtensions?: string[];
preserveNodeMaps?: boolean;
}

@@ -38,0 +40,0 @@ export interface ParserWeakMap<TKey, TValueBase> {

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

extraFileExtensions: [],
preserveNodeMaps: undefined,
};

@@ -202,2 +203,14 @@ }

}
/**
* Allow the user to enable or disable the preservation of the AST node maps
* during the conversion process.
*
* NOTE: For backwards compatibility we also preserve node maps in the case where `project` is set,
* and `preserveNodeMaps` is not explicitly set to anything.
*/
extra.preserveNodeMaps =
typeof options.preserveNodeMaps === 'boolean' && options.preserveNodeMaps;
if (options.preserveNodeMaps === undefined && extra.projects.length > 0) {
extra.preserveNodeMaps = true;
}
}

@@ -299,6 +312,13 @@ function warnAboutTSVersion() {

/**
* Determine whether or not two-way maps of converted AST nodes should be preserved
* during the conversion process
*/
const shouldPreserveNodeMaps = extra.preserveNodeMaps !== undefined
? extra.preserveNodeMaps
: shouldProvideParserServices;
/**
* Convert the TypeScript AST to an ESTree-compatible one, and optionally preserve
* mappings between converted and original AST nodes
*/
const { estree, astMaps } = ast_converter_1.default(ast, extra, shouldProvideParserServices);
const { estree, astMaps } = ast_converter_1.default(ast, extra, shouldPreserveNodeMaps);
/**

@@ -321,6 +341,6 @@ * Even if TypeScript parsed the source code ok, and we had no problems converting the AST,

program: shouldProvideParserServices ? program : undefined,
esTreeNodeToTSNodeMap: shouldProvideParserServices && astMaps
esTreeNodeToTSNodeMap: shouldPreserveNodeMaps && astMaps
? astMaps.esTreeNodeToTSNodeMap
: undefined,
tsNodeToESTreeNodeMap: shouldProvideParserServices && astMaps
tsNodeToESTreeNodeMap: shouldPreserveNodeMaps && astMaps
? astMaps.tsNodeToESTreeNodeMap

@@ -327,0 +347,0 @@ : undefined,

{
"name": "@typescript-eslint/typescript-estree",
"version": "1.7.1-alpha.19+6ccf482",
"version": "1.7.1-alpha.20+c3061f9",
"description": "A parser that converts TypeScript source code into an ESTree compatible form",

@@ -44,5 +44,5 @@ "main": "dist/parser.js",

"@babel/types": "^7.3.2",
"@typescript-eslint/shared-fixtures": "1.7.1-alpha.19+6ccf482"
"@typescript-eslint/shared-fixtures": "1.7.1-alpha.20+c3061f9"
},
"gitHead": "6ccf482250383335bf0f62117fd672782d447569"
"gitHead": "c3061f9e452b6f32f74d2fd2b9a9f8bdddbef26c"
}

@@ -69,3 +69,15 @@ <h1 align="center">TypeScript ESTree</h1>

*/
loggerFn: undefined
loggerFn: undefined,
/**
* Allows the user to control whether or not two-way AST node maps are preserved
* during the AST conversion process.
*
* By default: the AST node maps are NOT preserved, unless `project` has been specified,
* in which case the maps are made available on the returned `parserServices`.
*
* NOTE: If `preserveNodeMaps` is explicitly set by the user, it will be respected,
* regardless of whether or not `project` is in use.
*/
preserveNodeMaps: undefined
}

@@ -72,0 +84,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 too big to display

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