hermes-parser
Advanced tools
@@ -7,3 +7,3 @@ /** | ||
| * | ||
| * | ||
| * strict | ||
| * @format | ||
@@ -281,4 +281,6 @@ */ | ||
| } // Non-method property nodes should be renamed to ObjectProperty | ||
| // $FlowExpectedError[incompatible-type] | ||
| const propertyValue = value; | ||
| return { | ||
@@ -288,4 +290,3 @@ type: 'ObjectProperty', | ||
| key: node.key, | ||
| // $FlowExpectedError[incompatible-type] | ||
| value: node.value, | ||
| value: propertyValue, | ||
| method: node.method, | ||
@@ -292,0 +293,0 @@ shorthand: node.shorthand, |
@@ -7,3 +7,3 @@ /** | ||
| * | ||
| * | ||
| * strict | ||
| * @format | ||
@@ -10,0 +10,0 @@ */ |
@@ -7,3 +7,3 @@ /** | ||
| * | ||
| * | ||
| * strict | ||
| * @format | ||
@@ -10,0 +10,0 @@ */ |
@@ -7,3 +7,3 @@ /** | ||
| * | ||
| * | ||
| * strict | ||
| * @format | ||
@@ -10,0 +10,0 @@ */ |
@@ -7,3 +7,3 @@ /** | ||
| * | ||
| * | ||
| * strict | ||
| * @format | ||
@@ -10,0 +10,0 @@ */ |
@@ -7,3 +7,3 @@ /** | ||
| * | ||
| * | ||
| * strict | ||
| * @format | ||
@@ -52,3 +52,11 @@ */ | ||
| /** | ||
| * The conditional aspect of a match pattern for a single location. | ||
| */ | ||
| /** | ||
| * A binding introduced by a match pattern. | ||
| */ | ||
| function objKeyToString(node) { | ||
@@ -373,3 +381,4 @@ switch (node.type) { | ||
| } = analyzePattern(asPattern, key, seenBindingNames); | ||
| const [id, kind] = target.type === 'MatchBindingPattern' ? [target.id, target.kind] : [target, 'const']; | ||
| const constKind = 'const'; | ||
| const [id, kind] = target.type === 'MatchBindingPattern' ? [target.id, target.kind] : [target, constKind]; | ||
| checkDuplicateBindingName(seenBindingNames, pattern, id.name); | ||
@@ -376,0 +385,0 @@ checkBindingKind(pattern, kind); |
@@ -7,3 +7,3 @@ /** | ||
| * | ||
| * | ||
| * strict | ||
| * @format | ||
@@ -10,0 +10,0 @@ */ |
@@ -21,3 +21,3 @@ /** | ||
| /* global $NonMaybeType, Partial, $ReadOnly, $ReadOnlyArray, $FlowFixMe */ | ||
| /* global NonNullable, Partial, Readonly, ReadonlyArray, $FlowFixMe */ | ||
| 'use strict'; | ||
@@ -24,0 +24,0 @@ |
@@ -21,3 +21,3 @@ /** | ||
| /* global $NonMaybeType, Partial, $ReadOnly, $ReadOnlyArray, $FlowFixMe */ | ||
| /* global NonNullable, Partial, Readonly, ReadonlyArray, $FlowFixMe */ | ||
| 'use strict'; | ||
@@ -24,0 +24,0 @@ |
@@ -7,3 +7,3 @@ /** | ||
| * | ||
| * | ||
| * strict | ||
| * @format | ||
@@ -10,0 +10,0 @@ */ |
@@ -16,3 +16,3 @@ "use strict"; | ||
| * | ||
| * | ||
| * strict | ||
| * @format | ||
@@ -19,0 +19,0 @@ */ |
@@ -7,3 +7,3 @@ /** | ||
| * | ||
| * | ||
| * strict | ||
| * @format | ||
@@ -10,0 +10,0 @@ */ |
@@ -7,3 +7,3 @@ /** | ||
| * | ||
| * | ||
| * strict | ||
| * @format | ||
@@ -10,0 +10,0 @@ */ |
@@ -7,3 +7,3 @@ /** | ||
| * | ||
| * | ||
| * strict | ||
| * @format | ||
@@ -10,0 +10,0 @@ */ |
@@ -20,5 +20,6 @@ "use strict"; | ||
| * | ||
| * | ||
| * strict | ||
| * @format | ||
| */ | ||
| // eslint-disable-next-line no-unused-vars | ||
| class HermesToESTreeAdapter extends _HermesASTAdapter.default { | ||
@@ -189,3 +190,3 @@ constructor(options, code) { | ||
| value = new RegExp(pattern, flags); | ||
| } catch (e) { | ||
| } catch { | ||
| value = null; | ||
@@ -192,0 +193,0 @@ } |
+4
-3
@@ -7,3 +7,3 @@ /** | ||
| * | ||
| * | ||
| * strict | ||
| * @format | ||
@@ -139,5 +139,6 @@ */ | ||
| return options; | ||
| } | ||
| } // eslint-disable-next-line no-redeclare | ||
| // eslint-disable-next-line no-redeclare | ||
| // eslint-disable-next-line no-redeclare | ||
| function parse(code, opts) { | ||
@@ -144,0 +145,0 @@ var _options$transformOpt, _options$transformOpt2; |
@@ -14,6 +14,8 @@ "use strict"; | ||
| * | ||
| * | ||
| * @format | ||
| * strict | ||
| * @noformat | ||
| */ | ||
| const ParserOptionsKeys = new Set(['allowReturnOutsideFunction', 'babel', 'flow', 'enableExperimentalComponentSyntax', 'enableExperimentalFlowMatchSyntax', 'enableExperimentalFlowRecordSyntax', 'reactRuntimeTarget', 'sourceFilename', 'sourceType', 'tokens', 'transformOptions']); | ||
| const ParserOptionsKeys | ||
| /*: ReadonlySet<keyof ParserOptions> */ | ||
| = new Set(['allowReturnOutsideFunction', 'babel', 'flow', 'enableExperimentalComponentSyntax', 'enableExperimentalFlowMatchSyntax', 'enableExperimentalFlowRecordSyntax', 'reactRuntimeTarget', 'sourceFilename', 'sourceType', 'tokens', 'transformOptions']); | ||
| exports.ParserOptionsKeys = ParserOptionsKeys; |
@@ -7,3 +7,3 @@ /** | ||
| * | ||
| * | ||
| * strict | ||
| * @format | ||
@@ -281,4 +281,6 @@ */ | ||
| } // Non-method property nodes should be renamed to ObjectProperty | ||
| // $FlowExpectedError[incompatible-type] | ||
| const propertyValue = value; | ||
| return { | ||
@@ -288,4 +290,3 @@ type: 'ObjectProperty', | ||
| key: node.key, | ||
| // $FlowExpectedError[incompatible-type] | ||
| value: node.value, | ||
| value: propertyValue, | ||
| method: node.method, | ||
@@ -292,0 +293,0 @@ shorthand: node.shorthand, |
@@ -7,3 +7,3 @@ /** | ||
| * | ||
| * | ||
| * strict | ||
| * @format | ||
@@ -10,0 +10,0 @@ */ |
@@ -7,3 +7,3 @@ /** | ||
| * | ||
| * | ||
| * strict | ||
| * @format | ||
@@ -10,0 +10,0 @@ */ |
@@ -7,3 +7,3 @@ /** | ||
| * | ||
| * | ||
| * strict | ||
| * @format | ||
@@ -10,0 +10,0 @@ */ |
@@ -7,3 +7,3 @@ /** | ||
| * | ||
| * | ||
| * strict | ||
| * @format | ||
@@ -10,0 +10,0 @@ */ |
@@ -7,3 +7,3 @@ /** | ||
| * | ||
| * | ||
| * strict | ||
| * @format | ||
@@ -52,3 +52,11 @@ */ | ||
| /** | ||
| * The conditional aspect of a match pattern for a single location. | ||
| */ | ||
| /** | ||
| * A binding introduced by a match pattern. | ||
| */ | ||
| function objKeyToString(node) { | ||
@@ -373,3 +381,4 @@ switch (node.type) { | ||
| } = analyzePattern(asPattern, key, seenBindingNames); | ||
| const [id, kind] = target.type === 'MatchBindingPattern' ? [target.id, target.kind] : [target, 'const']; | ||
| const constKind = 'const'; | ||
| const [id, kind] = target.type === 'MatchBindingPattern' ? [target.id, target.kind] : [target, constKind]; | ||
| checkDuplicateBindingName(seenBindingNames, pattern, id.name); | ||
@@ -376,0 +385,0 @@ checkBindingKind(pattern, kind); |
@@ -7,3 +7,3 @@ /** | ||
| * | ||
| * | ||
| * strict | ||
| * @format | ||
@@ -10,0 +10,0 @@ */ |
@@ -21,3 +21,3 @@ /** | ||
| /* global $NonMaybeType, Partial, $ReadOnly, $ReadOnlyArray, $FlowFixMe */ | ||
| /* global NonNullable, Partial, Readonly, ReadonlyArray, $FlowFixMe */ | ||
| 'use strict'; | ||
@@ -24,0 +24,0 @@ |
@@ -21,3 +21,3 @@ /** | ||
| /* global $NonMaybeType, Partial, $ReadOnly, $ReadOnlyArray, $FlowFixMe */ | ||
| /* global NonNullable, Partial, Readonly, ReadonlyArray, $FlowFixMe */ | ||
| 'use strict'; | ||
@@ -24,0 +24,0 @@ |
@@ -7,3 +7,3 @@ /** | ||
| * | ||
| * | ||
| * strict | ||
| * @format | ||
@@ -10,0 +10,0 @@ */ |
@@ -16,3 +16,3 @@ "use strict"; | ||
| * | ||
| * | ||
| * strict | ||
| * @format | ||
@@ -19,0 +19,0 @@ */ |
@@ -7,3 +7,3 @@ /** | ||
| * | ||
| * | ||
| * strict | ||
| * @format | ||
@@ -10,0 +10,0 @@ */ |
@@ -7,3 +7,3 @@ /** | ||
| * | ||
| * | ||
| * strict | ||
| * @format | ||
@@ -10,0 +10,0 @@ */ |
@@ -7,3 +7,3 @@ /** | ||
| * | ||
| * | ||
| * strict | ||
| * @format | ||
@@ -10,0 +10,0 @@ */ |
@@ -20,5 +20,6 @@ "use strict"; | ||
| * | ||
| * | ||
| * strict | ||
| * @format | ||
| */ | ||
| // eslint-disable-next-line no-unused-vars | ||
| class HermesToESTreeAdapter extends _HermesASTAdapter.default { | ||
@@ -189,3 +190,3 @@ constructor(options, code) { | ||
| value = new RegExp(pattern, flags); | ||
| } catch (e) { | ||
| } catch { | ||
| value = null; | ||
@@ -192,0 +193,0 @@ } |
@@ -7,3 +7,3 @@ /** | ||
| * | ||
| * | ||
| * strict | ||
| * @format | ||
@@ -139,5 +139,6 @@ */ | ||
| return options; | ||
| } | ||
| } // eslint-disable-next-line no-redeclare | ||
| // eslint-disable-next-line no-redeclare | ||
| // eslint-disable-next-line no-redeclare | ||
| function parse(code, opts) { | ||
@@ -144,0 +145,0 @@ var _options$transformOpt, _options$transformOpt2; |
@@ -14,6 +14,8 @@ "use strict"; | ||
| * | ||
| * | ||
| * @format | ||
| * strict | ||
| * @noformat | ||
| */ | ||
| const ParserOptionsKeys = new Set(['allowReturnOutsideFunction', 'babel', 'flow', 'enableExperimentalComponentSyntax', 'enableExperimentalFlowMatchSyntax', 'enableExperimentalFlowRecordSyntax', 'reactRuntimeTarget', 'sourceFilename', 'sourceType', 'tokens', 'transformOptions']); | ||
| const ParserOptionsKeys | ||
| /*: ReadonlySet<keyof ParserOptions> */ | ||
| = new Set(['allowReturnOutsideFunction', 'babel', 'flow', 'enableExperimentalComponentSyntax', 'enableExperimentalFlowMatchSyntax', 'enableExperimentalFlowRecordSyntax', 'reactRuntimeTarget', 'sourceFilename', 'sourceType', 'tokens', 'transformOptions']); | ||
| exports.ParserOptionsKeys = ParserOptionsKeys; |
@@ -17,3 +17,3 @@ "use strict"; | ||
| * | ||
| * | ||
| * strict | ||
| * @format | ||
@@ -20,0 +20,0 @@ */ |
@@ -7,3 +7,3 @@ /** | ||
| * | ||
| * | ||
| * strict | ||
| * @format | ||
@@ -46,6 +46,7 @@ */ | ||
| } | ||
| } else if (Array.isArray(parent[key])) { | ||
| } else if (Array.isArray( // $FlowExpectedError[prop-missing] | ||
| parent[key])) { | ||
| for (let i = 0; i < parent[key].length; i += 1) { | ||
| // $FlowExpectedError[invalid-tuple-index] | ||
| const current = parent[key][i]; | ||
| const current = parent[key][i]; // $FlowFixMe[invalid-compare] | ||
@@ -52,0 +53,0 @@ if (current === target) { |
@@ -7,3 +7,3 @@ /** | ||
| * | ||
| * | ||
| * strict | ||
| * @format | ||
@@ -22,2 +22,11 @@ */ | ||
| /** | ||
| * Transform callback | ||
| * @param node The node we are visiting | ||
| * @returns | ||
| * - return input node, signals no changes were made will continue to the next node. | ||
| * - return new node, the old node will be replaced in the AST. The new node and its | ||
| * children are then traversed. | ||
| * - return null, signals the node should be deleted from the AST. | ||
| */ | ||
| function setParentPointer(node, parent) { | ||
@@ -24,0 +33,0 @@ if (parent != null) { |
@@ -7,3 +7,3 @@ /** | ||
| * | ||
| * | ||
| * strict | ||
| * @noformat | ||
@@ -24,3 +24,3 @@ */ | ||
| function isNode(thing) | ||
| /*: implies thing is {+[string]: mixed} */ | ||
| /*: implies thing is {readonly [string]: unknown} */ | ||
| { | ||
@@ -30,3 +30,5 @@ return typeof thing === 'object' && thing != null && typeof thing.type === 'string'; | ||
| function getVisitorKeys(node, visitorKeys) { | ||
| function getVisitorKeys(node, visitorKeys) | ||
| /*: ReadonlyArray<keyof T> */ | ||
| { | ||
| const keys = (visitorKeys != null ? visitorKeys : _ESTreeVisitorKeys.default)[node.type]; | ||
@@ -33,0 +35,0 @@ |
@@ -7,3 +7,3 @@ /** | ||
| * | ||
| * | ||
| * strict | ||
| * @format | ||
@@ -84,3 +84,5 @@ */ | ||
| for (const key of keys) { | ||
| const child = node[key]; | ||
| const lookupKey = key; | ||
| const childAny = node[lookupKey]; | ||
| const child = childAny; | ||
@@ -87,0 +89,0 @@ if (Array.isArray(child)) { |
@@ -7,6 +7,6 @@ /** | ||
| * | ||
| * | ||
| * strict | ||
| * @format | ||
| */ | ||
| 'use strict'; | ||
| 'use strict'; // Rely on the mapper to fix up parent relationships. | ||
@@ -30,3 +30,2 @@ Object.defineProperty(exports, "__esModule", { | ||
| exports.variableDeclaration = variableDeclaration; | ||
| // Rely on the mapper to fix up parent relationships. | ||
| const EMPTY_PARENT = null; | ||
@@ -33,0 +32,0 @@ exports.EMPTY_PARENT = EMPTY_PARENT; |
@@ -7,3 +7,3 @@ /** | ||
| * | ||
| * | ||
| * strict | ||
| * @format | ||
@@ -10,0 +10,0 @@ */ |
@@ -7,3 +7,3 @@ /** | ||
| * | ||
| * | ||
| * strict | ||
| * @format | ||
@@ -10,0 +10,0 @@ */ |
@@ -7,3 +7,3 @@ /** | ||
| * | ||
| * | ||
| * strict | ||
| * @format | ||
@@ -10,0 +10,0 @@ */ |
@@ -7,3 +7,3 @@ /** | ||
| * | ||
| * | ||
| * strict | ||
| * @format | ||
@@ -10,0 +10,0 @@ */ |
@@ -17,3 +17,3 @@ "use strict"; | ||
| * | ||
| * | ||
| * strict | ||
| * @format | ||
@@ -20,0 +20,0 @@ */ |
@@ -7,3 +7,3 @@ /** | ||
| * | ||
| * | ||
| * strict | ||
| * @format | ||
@@ -46,6 +46,7 @@ */ | ||
| } | ||
| } else if (Array.isArray(parent[key])) { | ||
| } else if (Array.isArray( // $FlowExpectedError[prop-missing] | ||
| parent[key])) { | ||
| for (let i = 0; i < parent[key].length; i += 1) { | ||
| // $FlowExpectedError[invalid-tuple-index] | ||
| const current = parent[key][i]; | ||
| const current = parent[key][i]; // $FlowFixMe[invalid-compare] | ||
@@ -52,0 +53,0 @@ if (current === target) { |
@@ -7,3 +7,3 @@ /** | ||
| * | ||
| * | ||
| * strict | ||
| * @format | ||
@@ -22,2 +22,11 @@ */ | ||
| /** | ||
| * Transform callback | ||
| * @param node The node we are visiting | ||
| * @returns | ||
| * - return input node, signals no changes were made will continue to the next node. | ||
| * - return new node, the old node will be replaced in the AST. The new node and its | ||
| * children are then traversed. | ||
| * - return null, signals the node should be deleted from the AST. | ||
| */ | ||
| function setParentPointer(node, parent) { | ||
@@ -24,0 +33,0 @@ if (parent != null) { |
@@ -7,3 +7,3 @@ /** | ||
| * | ||
| * | ||
| * strict | ||
| * @noformat | ||
@@ -24,3 +24,3 @@ */ | ||
| function isNode(thing) | ||
| /*: implies thing is {+[string]: mixed} */ | ||
| /*: implies thing is {readonly [string]: unknown} */ | ||
| { | ||
@@ -30,3 +30,5 @@ return typeof thing === 'object' && thing != null && typeof thing.type === 'string'; | ||
| function getVisitorKeys(node, visitorKeys) { | ||
| function getVisitorKeys(node, visitorKeys) | ||
| /*: ReadonlyArray<keyof T> */ | ||
| { | ||
| const keys = (visitorKeys != null ? visitorKeys : _ESTreeVisitorKeys.default)[node.type]; | ||
@@ -33,0 +35,0 @@ |
@@ -7,3 +7,3 @@ /** | ||
| * | ||
| * | ||
| * strict | ||
| * @format | ||
@@ -84,3 +84,5 @@ */ | ||
| for (const key of keys) { | ||
| const child = node[key]; | ||
| const lookupKey = key; | ||
| const childAny = node[lookupKey]; | ||
| const child = childAny; | ||
@@ -87,0 +89,0 @@ if (Array.isArray(child)) { |
@@ -7,6 +7,6 @@ /** | ||
| * | ||
| * | ||
| * strict | ||
| * @format | ||
| */ | ||
| 'use strict'; | ||
| 'use strict'; // Rely on the mapper to fix up parent relationships. | ||
@@ -30,3 +30,2 @@ Object.defineProperty(exports, "__esModule", { | ||
| exports.variableDeclaration = variableDeclaration; | ||
| // Rely on the mapper to fix up parent relationships. | ||
| const EMPTY_PARENT = null; | ||
@@ -33,0 +32,0 @@ exports.EMPTY_PARENT = EMPTY_PARENT; |
@@ -7,3 +7,3 @@ /** | ||
| * | ||
| * | ||
| * strict | ||
| * @format | ||
@@ -10,0 +10,0 @@ */ |
@@ -7,3 +7,3 @@ /** | ||
| * | ||
| * | ||
| * strict | ||
| * @format | ||
@@ -10,0 +10,0 @@ */ |
@@ -7,3 +7,3 @@ /** | ||
| * | ||
| * | ||
| * strict | ||
| * @format | ||
@@ -10,0 +10,0 @@ */ |
@@ -7,3 +7,3 @@ /** | ||
| * | ||
| * | ||
| * strict | ||
| * @format | ||
@@ -10,0 +10,0 @@ */ |
+4
-3
| { | ||
| "name": "hermes-parser", | ||
| "version": "0.36.1", | ||
| "version": "0.37.0", | ||
| "description": "A JavaScript parser built from the Hermes engine", | ||
@@ -9,6 +9,7 @@ "main": "dist/index.js", | ||
| "type": "git", | ||
| "url": "git@github.com:facebook/hermes.git" | ||
| "url": "git+https://github.com/facebook/hermes.git", | ||
| "directory": "tools/hermes-parser/js/hermes-parser" | ||
| }, | ||
| "dependencies": { | ||
| "hermes-estree": "0.36.1" | ||
| "hermes-estree": "0.37.0" | ||
| }, | ||
@@ -15,0 +16,0 @@ "devDependencies": { |
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 too big to display
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
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
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
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
1616588
0.28%17351
0.27%+ Added
- Removed
Updated