@ast-grep/napi
Advanced tools
Comparing version 0.26.1 to 0.26.2
@@ -26,3 +26,3 @@ /* tslint:disable */ | ||
} | ||
export function parseFiles(paths: Array<string> | FileOption, callback: (err: null | Error, result: SgRoot) => void): Promise<number> | ||
export declare function parseFiles(paths: Array<string> | FileOption, callback: (err: null | Error, result: SgRoot) => void): Promise<number> | ||
export interface FindConfig { | ||
@@ -63,2 +63,3 @@ /** specify the file paths to recursively find files */ | ||
Scala = 'Scala', | ||
Sql = 'Sql', | ||
Swift = 'Swift' | ||
@@ -89,3 +90,3 @@ } | ||
/** Parse a string to an ast-grep instance */ | ||
export function parse(lang: Lang, src: string): SgRoot | ||
export declare function parse(lang: Lang, src: string): SgRoot | ||
/** | ||
@@ -98,7 +99,7 @@ * Parse a string to an ast-grep instance asynchronously in threads. | ||
*/ | ||
export function parseAsync(lang: Lang, src: string): Promise<SgRoot> | ||
export declare function parseAsync(lang: Lang, src: string): Promise<SgRoot> | ||
/** Get the `kind` number from its string name. */ | ||
export function kind(lang: Lang, kindName: string): number | ||
export declare function kind(lang: Lang, kindName: string): number | ||
/** Compile a string to ast-grep Pattern. */ | ||
export function pattern(lang: Lang, pattern: string): NapiConfig | ||
export declare function pattern(lang: Lang, pattern: string): NapiConfig | ||
/** | ||
@@ -110,4 +111,4 @@ * Discover and parse multiple files in Rust. | ||
*/ | ||
export function findInFiles(lang: Lang, config: FindConfig, callback: (err: null | Error, result: SgNode[]) => void): Promise<number> | ||
export class SgNode { | ||
export declare function findInFiles(lang: Lang, config: FindConfig, callback: (err: null | Error, result: SgNode[]) => void): Promise<number> | ||
export declare class SgNode { | ||
range(): Range | ||
@@ -146,3 +147,3 @@ isLeaf(): boolean | ||
/** Represents the parsed tree of code. */ | ||
export class SgRoot { | ||
export declare class SgRoot { | ||
/** Returns the root SgNode of the ast-grep instance. */ | ||
@@ -156,3 +157,3 @@ root(): SgNode | ||
} | ||
export namespace html { | ||
export declare namespace html { | ||
/** Parse a string to an ast-grep instance */ | ||
@@ -179,3 +180,3 @@ export function parse(src: string): SgRoot | ||
} | ||
export namespace js { | ||
export declare namespace js { | ||
/** Parse a string to an ast-grep instance */ | ||
@@ -202,3 +203,3 @@ export function parse(src: string): SgRoot | ||
} | ||
export namespace jsx { | ||
export declare namespace jsx { | ||
/** Parse a string to an ast-grep instance */ | ||
@@ -225,3 +226,3 @@ export function parse(src: string): SgRoot | ||
} | ||
export namespace ts { | ||
export declare namespace ts { | ||
/** Parse a string to an ast-grep instance */ | ||
@@ -248,3 +249,3 @@ export function parse(src: string): SgRoot | ||
} | ||
export namespace tsx { | ||
export declare namespace tsx { | ||
/** Parse a string to an ast-grep instance */ | ||
@@ -271,3 +272,3 @@ export function parse(src: string): SgRoot | ||
} | ||
export namespace css { | ||
export declare namespace css { | ||
/** Parse a string to an ast-grep instance */ | ||
@@ -274,0 +275,0 @@ export function parse(src: string): SgRoot |
49
index.js
@@ -227,13 +227,28 @@ /* tslint:disable */ | ||
case 'arm': | ||
localFileExisted = existsSync( | ||
join(__dirname, 'ast-grep-napi.linux-arm-gnueabihf.node') | ||
) | ||
try { | ||
if (localFileExisted) { | ||
nativeBinding = require('./ast-grep-napi.linux-arm-gnueabihf.node') | ||
} else { | ||
nativeBinding = require('@ast-grep/napi-linux-arm-gnueabihf') | ||
if (isMusl()) { | ||
localFileExisted = existsSync( | ||
join(__dirname, 'ast-grep-napi.linux-arm-musleabihf.node') | ||
) | ||
try { | ||
if (localFileExisted) { | ||
nativeBinding = require('./ast-grep-napi.linux-arm-musleabihf.node') | ||
} else { | ||
nativeBinding = require('@ast-grep/napi-linux-arm-musleabihf') | ||
} | ||
} catch (e) { | ||
loadError = e | ||
} | ||
} catch (e) { | ||
loadError = e | ||
} else { | ||
localFileExisted = existsSync( | ||
join(__dirname, 'ast-grep-napi.linux-arm-gnueabihf.node') | ||
) | ||
try { | ||
if (localFileExisted) { | ||
nativeBinding = require('./ast-grep-napi.linux-arm-gnueabihf.node') | ||
} else { | ||
nativeBinding = require('@ast-grep/napi-linux-arm-gnueabihf') | ||
} | ||
} catch (e) { | ||
loadError = e | ||
} | ||
} | ||
@@ -270,2 +285,16 @@ break | ||
break | ||
case 's390x': | ||
localFileExisted = existsSync( | ||
join(__dirname, 'ast-grep-napi.linux-s390x-gnu.node') | ||
) | ||
try { | ||
if (localFileExisted) { | ||
nativeBinding = require('./ast-grep-napi.linux-s390x-gnu.node') | ||
} else { | ||
nativeBinding = require('@ast-grep/napi-linux-s390x-gnu') | ||
} | ||
} catch (e) { | ||
loadError = e | ||
} | ||
break | ||
default: | ||
@@ -272,0 +301,0 @@ throw new Error(`Unsupported architecture on Linux: ${arch}`) |
{ | ||
"name": "@ast-grep/napi", | ||
"version": "0.26.1", | ||
"version": "0.26.2", | ||
"description": "Search and Rewrite code at large scale using precise AST pattern", | ||
@@ -70,12 +70,12 @@ "homepage": "https://ast-grep.github.io", | ||
"optionalDependencies": { | ||
"@ast-grep/napi-win32-x64-msvc": "0.26.1", | ||
"@ast-grep/napi-darwin-x64": "0.26.1", | ||
"@ast-grep/napi-linux-x64-gnu": "0.26.1", | ||
"@ast-grep/napi-win32-ia32-msvc": "0.26.1", | ||
"@ast-grep/napi-darwin-arm64": "0.26.1", | ||
"@ast-grep/napi-win32-arm64-msvc": "0.26.1", | ||
"@ast-grep/napi-linux-arm64-gnu": "0.26.1", | ||
"@ast-grep/napi-linux-arm64-musl": "0.26.1", | ||
"@ast-grep/napi-linux-x64-musl": "0.26.1" | ||
"@ast-grep/napi-win32-x64-msvc": "0.26.2", | ||
"@ast-grep/napi-darwin-x64": "0.26.2", | ||
"@ast-grep/napi-linux-x64-gnu": "0.26.2", | ||
"@ast-grep/napi-win32-ia32-msvc": "0.26.2", | ||
"@ast-grep/napi-darwin-arm64": "0.26.2", | ||
"@ast-grep/napi-win32-arm64-msvc": "0.26.2", | ||
"@ast-grep/napi-linux-arm64-gnu": "0.26.2", | ||
"@ast-grep/napi-linux-arm64-musl": "0.26.2", | ||
"@ast-grep/napi-linux-x64-musl": "0.26.2" | ||
} | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
25358
600