@ast-grep/napi
Advanced tools
Comparing version 0.15.1 to 0.16.0
@@ -6,2 +6,18 @@ /* tslint:disable */ | ||
/** | ||
* Rule configuration similar to YAML | ||
* See https://ast-grep.github.io/reference/yaml.html | ||
*/ | ||
export interface NapiConfig { | ||
/** The rule object, see https://ast-grep.github.io/reference/rule.html */ | ||
rule: any | ||
/** See https://ast-grep.github.io/guide/rule-config.html#constraints */ | ||
constraints?: any | ||
/** Available languages: html, css, js, jsx, ts, tsx */ | ||
language?: FrontEndLanguage | ||
/** https://ast-grep.github.io/reference/yaml.html#transform */ | ||
transform?: any | ||
/** https://ast-grep.github.io/guide/rule-config/utility-rule.html */ | ||
utils?: any | ||
} | ||
export const enum FrontEndLanguage { | ||
@@ -28,19 +44,7 @@ Html = 0, | ||
} | ||
/** | ||
* Rule configuration similar to YAML | ||
* See https://ast-grep.github.io/reference/yaml.html | ||
*/ | ||
export interface NapiConfig { | ||
/** The rule object, see https://ast-grep.github.io/reference/rule.html */ | ||
rule: any | ||
/** See https://ast-grep.github.io/guide/rule-config.html#constraints */ | ||
constraints?: any | ||
/** Available languages: html, css, js, jsx, ts, tsx */ | ||
language?: FrontEndLanguage | ||
/** https://ast-grep.github.io/reference/yaml.html#transform */ | ||
transform?: any | ||
/** https://ast-grep.github.io/guide/rule-config/utility-rule.html */ | ||
utils?: any | ||
export interface FileOption { | ||
paths: Array<string> | ||
languageGlobs: Record<string, Array<string>> | ||
} | ||
export function parseFiles(paths: string[], callback: (err: null | Error, result: SgRoot) => void): Promise<number> | ||
export function parseFiles(paths: Array<string> | FileOption, callback: (err: null | Error, result: SgRoot) => void): Promise<number> | ||
export interface FindConfig { | ||
@@ -51,2 +55,8 @@ /** specify the file paths to recursively find files */ | ||
matcher: NapiConfig | ||
/** | ||
* An list of pattern globs to treat of certain files in the specified language. | ||
* eg. ['*.vue', '*.svelte'] for html.findFiles, or ['*.ts'] for tsx.findFiles. | ||
* It is slightly different from https://ast-grep.github.io/reference/sgconfig.html#languageglobs | ||
*/ | ||
languageGlobs?: Array<string> | ||
} | ||
@@ -53,0 +63,0 @@ export class SgNode { |
29
index.js
@@ -240,2 +240,31 @@ /* tslint:disable */ | ||
break | ||
case 'riscv64': | ||
if (isMusl()) { | ||
localFileExisted = existsSync( | ||
join(__dirname, 'ast-grep-napi.linux-riscv64-musl.node') | ||
) | ||
try { | ||
if (localFileExisted) { | ||
nativeBinding = require('./ast-grep-napi.linux-riscv64-musl.node') | ||
} else { | ||
nativeBinding = require('@ast-grep/napi-linux-riscv64-musl') | ||
} | ||
} catch (e) { | ||
loadError = e | ||
} | ||
} else { | ||
localFileExisted = existsSync( | ||
join(__dirname, 'ast-grep-napi.linux-riscv64-gnu.node') | ||
) | ||
try { | ||
if (localFileExisted) { | ||
nativeBinding = require('./ast-grep-napi.linux-riscv64-gnu.node') | ||
} else { | ||
nativeBinding = require('@ast-grep/napi-linux-riscv64-gnu') | ||
} | ||
} catch (e) { | ||
loadError = e | ||
} | ||
} | ||
break | ||
default: | ||
@@ -242,0 +271,0 @@ throw new Error(`Unsupported architecture on Linux: ${arch}`) |
{ | ||
"name": "@ast-grep/napi", | ||
"version": "0.15.1", | ||
"version": "0.16.0", | ||
"description": "Search and Rewrite code at large scale using precise AST pattern", | ||
@@ -27,3 +27,4 @@ "homepage": "https://ast-grep.github.io", | ||
"aarch64-apple-darwin", | ||
"aarch64-pc-windows-msvc" | ||
"aarch64-pc-windows-msvc", | ||
"aarch64-unknown-linux-gnu" | ||
] | ||
@@ -68,9 +69,10 @@ } | ||
"optionalDependencies": { | ||
"@ast-grep/napi-win32-x64-msvc": "0.15.1", | ||
"@ast-grep/napi-darwin-x64": "0.15.1", | ||
"@ast-grep/napi-linux-x64-gnu": "0.15.1", | ||
"@ast-grep/napi-win32-ia32-msvc": "0.15.1", | ||
"@ast-grep/napi-darwin-arm64": "0.15.1", | ||
"@ast-grep/napi-win32-arm64-msvc": "0.15.1" | ||
"@ast-grep/napi-win32-x64-msvc": "0.16.0", | ||
"@ast-grep/napi-darwin-x64": "0.16.0", | ||
"@ast-grep/napi-linux-x64-gnu": "0.16.0", | ||
"@ast-grep/napi-win32-ia32-msvc": "0.16.0", | ||
"@ast-grep/napi-darwin-arm64": "0.16.0", | ||
"@ast-grep/napi-win32-arm64-msvc": "0.16.0", | ||
"@ast-grep/napi-linux-arm64-gnu": "0.16.0" | ||
} | ||
} |
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
22308
516
7