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

@chialab/estransform

Package Overview
Dependencies
Maintainers
2
Versions
47
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@chialab/estransform - npm Package Compare versions

Comparing version 0.18.1 to 0.19.0-beta.0

lib/helpers.js

19

package.json
{
"name": "@chialab/estransform",
"type": "module",
"version": "0.18.1",
"version": "0.19.0-beta.0",
"description": "Execute multiple transformations on JavaScript sources with full sourcemaps support.",
"main": "dist/index.js",
"main": "lib/index.js",
"typings": "./types/index.d.ts",

@@ -21,7 +21,4 @@ "author": "Chialab <dev@chialab.io> (https://www.chialab.it)",

],
"scripts": {
"build": "rimraf dist && node build.js"
},
"files": [
"dist",
"lib",
"types",

@@ -36,12 +33,12 @@ "package.json",

"dependencies": {
"@parcel/source-map": "^2.0.0"
"@napi-rs/magic-string": "^0.3.4",
"@parcel/source-map": "^2.0.0",
"cjs-module-lexer": "^1.2.2",
"es-module-lexer": "^1.0.0",
"oxc-parser": "^0.8.0"
},
"devDependencies": {
"cjs-module-lexer": "^1.2.2",
"es-module-lexer": "^1.0.0",
"magic-string": "^0.30.3",
"rimraf": "^5.0.1",
"sucrase": "^3.0.0",
"typescript": "^5.0.0"
}
}

@@ -10,12 +10,2 @@ /**

/**
* Detect first level identifier for esbuild file loader imports.
* File could be previously bundled using esbuild, so the first argument of a new URL(something, import.meta.url)
* is not a literal anymore but an identifier.
* Here, we are looking for its computed value.
* @param {import('./parser.js').TokenProcessor} processor The program processor.
* @param {import('./types.js').Token} id The name of the identifier.
* @returns {string|undefined} The init token.
*/
export function getIdentifierValue(processor: import("sucrase/dist/types/TokenProcessor.js").default, id: import('./types.js').Token): string | undefined;
/**
* Get token location.

@@ -30,63 +20,1 @@ * @param {string} code Source code.

};
/**
* Get a block of tokens.
* @param {import('./parser.js').TokenProcessor} processor
* @param {TokenType} [openingToken]
* @param {TokenType} [closingToken]
* @returns {import('./types.js').Token[]}
*/
export function getBlock(processor: import("sucrase/dist/types/TokenProcessor.js").default, openingToken?: any, closingToken?: any): import('./types.js').Token[];
/**
* @param {import('./parser.js').TokenProcessor} processor
*/
export function getStatement(processor: import("sucrase/dist/types/TokenProcessor.js").default): import("sucrase/dist/types/parser/tokenizer/index.js").Token[];
/**
* Split tokens into function arguments.
* @param {import('./types.js').Token[]} tokens
* @returns {import('./types.js').Token[][]}
*/
export function splitArgs(tokens: import('./types.js').Token[]): import('./types.js').Token[][];
/**
* Extract argument tokens for a function declaration.
* @param {import('./parser.js').TokenProcessor} processor
*/
export function extractFunctionArguments(processor: import("sucrase/dist/types/TokenProcessor.js").default): {
index: number;
type?: import("sucrase/dist/types/parser/tokenizer/types.js").TokenType | undefined;
contextualKeyword?: import("sucrase/dist/types/parser/tokenizer/keywords.js").ContextualKeyword | undefined;
start?: number | undefined;
end?: number | undefined;
scopeDepth?: number | undefined;
isType?: boolean | undefined;
identifierRole?: import("sucrase/dist/types/parser/tokenizer/index.js").IdentifierRole | null | undefined;
jsxRole?: import("sucrase/dist/types/parser/tokenizer/index.js").JSXRole | null | undefined;
shadowsGlobal?: boolean | undefined;
isAsyncOperation?: boolean | undefined;
contextId?: number | null | undefined;
rhsEndIndex?: number | null | undefined;
isExpression?: boolean | undefined;
numNullishCoalesceStarts?: number | undefined;
numNullishCoalesceEnds?: number | undefined;
isOptionalChainStart?: boolean | undefined;
isOptionalChainEnd?: boolean | undefined;
subscriptStartIndex?: number | null | undefined;
nullishStartIndex?: number | null | undefined;
}[][];
/**
* Move forward in tokens list and return the current token.
* @param {import('./parser.js').TokenProcessor} processor
* @returns {import('./types.js').Token|null}
*/
export function getNextToken(processor: import("sucrase/dist/types/TokenProcessor.js").default): import('./types.js').Token | null;
/**
* Move forward until `)` closes the block.
* @param {import('./parser.js').TokenProcessor} processor
*/
export function nextBlock(processor: import("sucrase/dist/types/TokenProcessor.js").default): void;
/**
* Extract comments for a code range delmited by node span.
* @param {string} code The original code.
* @param {number} start The start index.
* @param {number} end The end index.
*/
export function getNodeComments(code: string, start: number, end: number): string[];

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

export * from "./types.js";
export * from "./parser.js";

@@ -3,0 +2,0 @@ export * from "./modules.js";

/**
* Walk through tokens and wait async visitors.
*
* @param {InstanceType<TokenProcessor>} processor
* @param {(token: import('./types.js').Token, index: number, processor: InstanceType<TokenProcessor>) => void|false|Promise<void|false>} callback
* Walk an ast node.
* @param {Node} root
* @param {Record<string, (node: Node) => void | Promise<void>>} visitors
* @returns {Promise<void>}
*/
export function walk(processor: InstanceType<typeof import("sucrase/dist/types/TokenProcessor").default>, callback: (token: import('./types.js').Token, index: number, processor: InstanceType<typeof import("sucrase/dist/types/TokenProcessor").default>) => void | false | Promise<void | false>): Promise<void>;
export function walk(root: Node, visitors: Record<string, (node: Node) => void | Promise<void>>): Promise<void>;
/**

@@ -12,9 +12,13 @@ * @param {string} inputCode The code to parse.

*/
export function parse(inputCode: string, filePath?: string | undefined): {
program: any;
nameManager: any;
helperManager: any;
processor: import("sucrase/dist/types/TokenProcessor").default;
export function parse(inputCode: string, filePath?: string | undefined): Promise<{
ast: any;
comments: import("oxc-parser").Comment[];
helpers: {
/**
* @param {number} start
* @param {number} end
* @returns {string}
*/
substring(start: number, end: number): string;
/**
* @param {string} code

@@ -47,4 +51,8 @@ * @param {number} [index]

};
}>;
export type Node = {
[key: string]: any;
type: string;
start: number;
end: number;
};
export const NameManager: any;
export const TokenProcessor: typeof import("sucrase/dist/types/TokenProcessor").default;
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