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

flast

Package Overview
Dependencies
Maintainers
0
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.7.1 to 2.0.0

eslint.config.js

16

package.json
{
"name": "flast",
"version": "1.7.1",
"version": "2.0.0",
"description": "Flatten JS AST",
"main": "src/index.js",
"type": "module",
"scripts": {
"lint": "eslint .",
"prepare": "husky install",
"test": "node tests/tester.js"
"prepare": "husky",
"test": "node --test",
"test:coverage": "node --test --experimental-test-coverage"
},

@@ -28,10 +30,10 @@ "repository": {

"escodegen": "^2.1.0",
"espree": "^10.1.0",
"eslint-scope": "^8.0.1",
"eslint-scope": "^8.1.0",
"espree": "^10.2.0",
"estraverse": "^5.3.0"
},
"devDependencies": {
"eslint": "^8.49.0",
"husky": "^8.0.3"
"eslint": "^9.12.0",
"husky": "^9.1.6"
}
}

@@ -30,3 +30,3 @@ # flAST - FLat Abstract Syntax Tree

### Clone The Repo
Requires Node 16 or newer.
Requires Node 18 or newer.
```bash

@@ -169,3 +169,3 @@ git clone git@github.com:PerimeterX/flast.git

```javascript
const {generateFlatAST, generateCode} = require('flast');
import {generateFlatAST, generateCode} from 'flast';
const ast = generateFlatAST(`console.log('flAST')`);

@@ -202,3 +202,3 @@ const reconstructedCode = generateCode(ast[0]); // rebuild from root node

```javascript
const {generateFlatAST, generateCode, Arborist} = require('flast');
import {generateFlatAST, generateCode, Arborist} from 'flast';
const ast = generateFlatAST(`console.log('Hello' + ' ' + 'there!');`);

@@ -219,6 +219,6 @@ const replacements = {

```
The Arborist can be called with an extra argument - logFunc - which can be used to log
inside the arborist.
The Arborist can be called with an extra argument - logFunc - which can be used to override the log
function inside the arborist.
## How to Contribute
To contribute to this project see our [contribution guide](CONTRIBUTING.md)

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

const {generateCode, generateFlatAST,} = require('./flast');
import {generateCode, generateFlatAST} from './flast.js';

@@ -172,4 +172,4 @@ const Arborist = class {

module.exports = {
export {
Arborist,
};

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

const {parse} = require('espree');
const {generate, attachComments} = require('escodegen');
const estraverse = require('estraverse');
const {analyze} = require('eslint-scope');
import {parse} from 'espree';
import {generate, attachComments} from 'escodegen';
import estraverse from 'estraverse';
import {analyze} from 'eslint-scope';

@@ -291,3 +291,3 @@ const ecmaVersion = 'latest';

module.exports = {
export {
estraverse,

@@ -294,0 +294,0 @@ extractNodesFromRoot,

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

module.exports = {
...require('./flast'),
...require('./arborist'),
...require('./types'),
utils: require('./utils'),
};
export * from './flast.js';
export * from './arborist.js';
export * from './types.js';
export * from './utils/index.js';

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

const {Scope} = require('eslint-scope');
import {Scope} from 'eslint-scope';

@@ -91,5 +91,5 @@ /**

module.exports = {
export {
ASTNode,
ASTScope,
};

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

const {Arborist} = require('../arborist');
const logger = require('./logger');
const {createHash} = require('node:crypto');
import {Arborist} from '../arborist.js';
import {logger} from './logger.js';
import {createHash} from 'node:crypto';

@@ -15,3 +15,3 @@ const generateHash = str => createHash('sha256').update(str).digest('hex');

*/
function runLoop(script, funcs, maxIterations = 500) {
function applyIteratively(script, funcs, maxIterations = 500) {
let scriptSnapshot = '';

@@ -66,2 +66,2 @@ let currentIteration = 0;

module.exports = runLoop;
export {applyIteratively};

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

module.exports = {
applyIteratively: require('./applyIteratively'),
logger: require('./logger'),
treeModifier: require('./treeModifier'),
export const utils = {
applyIteratively: (await import('./applyIteratively.js')).applyIteratively,
logger: (await import('./logger.js')).logger,
treeModifier: (await import('./treeModifier.js')).treeModifier,
};

@@ -38,3 +38,3 @@ const logLevels = {

setLogLevelError() {this.setLogLevel(this.logLevels.ERROR);},
setLogFunc(newLogfunc) {

@@ -45,2 +45,2 @@ this.logFunc = newLogfunc;

module.exports = logger;
export {logger};

@@ -23,2 +23,2 @@ /**

module.exports = treeModifier;
export {treeModifier};

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