Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

flast

Package Overview
Dependencies
Maintainers
2
Versions
24
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

flast - npm Package Compare versions

Comparing version 1.2.1 to 1.2.2

.github/workflows/node.js.yml

2

package.json
{
"name": "flast",
"version": "1.2.1",
"version": "1.2.2",
"description": "Flatten JS AST",

@@ -5,0 +5,0 @@ "main": "src/index.js",

// eslint-disable-next-line no-unused-vars
const {ASTNode} = require('espree');
const estraverse = require('estraverse');

@@ -32,3 +30,3 @@ const {generateCode, generateFlatAST} = require(__dirname + '/flast');

(currentNode.parentNode.declarations.length === 1 ||
!currentNode.parentNode.declarations.filter(d => d.nodeId !== currentNode.nodeId && !d.markedNode).length)
!currentNode.parentNode.declarations.filter(d => d.nodeId !== currentNode.nodeId && !d.isMarked).length)
)) currentNode = currentNode.parentNode;

@@ -45,11 +43,11 @@ return currentNode;

markNode(targetNode, replacementNode) {
if (!targetNode.markedNode) {
if (!targetNode.isMarked) {
if (replacementNode) { // Mark for replacement
this.markedForReplacement[targetNode.nodeId] = replacementNode;
targetNode.markedNode = true;
targetNode.isMarked = true;
} else { // Mark for deletion
targetNode = this._getCorrectTargetForDeletion(targetNode);
if (!targetNode.markedNode) {
if (!targetNode.isMarked) {
this.markedForDeletion.push(targetNode.nodeId);
targetNode.markedNode = true;
targetNode.isMarked = true;
}

@@ -56,0 +54,0 @@ }

// noinspection JSUnusedGlobalSymbols
// eslint-disable-next-line no-unused-vars
const {parse, ASTNode:espreeASTNode} = require('espree');
const {parse} = require('espree');
const {generate} = require('escodegen');
const estraverse = require('estraverse');
// eslint-disable-next-line no-unused-vars
const {analyze, ScopeManager} = require('eslint-scope');
const {analyze} = require('eslint-scope');

@@ -13,12 +11,2 @@ const ecmaVersion = 'latest';

/**
* @typedef ASTNode
* @property {number} nodeId
* @property {string} src
* @property {array} childNodes
* @property {?ASTNode} parentNode
* @property {ScopeManager} scope
* @property {?string} parentKey
*/
const ASTNode = espreeASTNode;

@@ -31,3 +19,2 @@ /**

function parseCode(inputCode, opts = {}) {
// noinspection JSValidateTypes
return parse(inputCode, {ecmaVersion, comment: true, range: true, ...opts});

@@ -86,2 +73,6 @@ }

estraverse.traverse(rootNode, {
/**
* @param {ASTNode} node
* @param {ASTNode} parentNode
*/
enter(node, parentNode) {

@@ -171,3 +162,2 @@ if (opts.detailed) {

generateCode,
ASTNode,
};
module.exports = {
...require(__dirname + '/flast'),
...require(__dirname + '/arborist'),
...require(__dirname + '/types'),
};
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