@ast-grep/napi
Advanced tools
Comparing version 0.2.1 to 0.2.2
@@ -10,3 +10,4 @@ /* tslint:disable */ | ||
Tsx = 2, | ||
TypeScript = 3 | ||
Css = 3, | ||
TypeScript = 4 | ||
} | ||
@@ -30,2 +31,3 @@ export interface Pos { | ||
} | ||
export function parseFiles(paths: string[], callback: (err: null | Error, result: SgRoot) => void): Promise<unknown> | ||
export class SgNode { | ||
@@ -57,2 +59,3 @@ range(): Range | ||
root(): SgNode | ||
filename(): string | ||
} | ||
@@ -59,0 +62,0 @@ export namespace html { |
15
index.js
@@ -14,3 +14,4 @@ const { existsSync, readFileSync } = require('fs') | ||
try { | ||
return readFileSync('/usr/bin/ldd', 'utf8').includes('musl') | ||
const lddPath = require('child_process').execSync('which ldd').toString().trim(); | ||
return readFileSync(lddPath, 'utf8').includes('musl') | ||
} catch (e) { | ||
@@ -105,2 +106,11 @@ return true | ||
case 'darwin': | ||
localFileExisted = existsSync(join(__dirname, 'ast-grep-napi.darwin-universal.node')) | ||
try { | ||
if (localFileExisted) { | ||
nativeBinding = require('./ast-grep-napi.darwin-universal.node') | ||
} else { | ||
nativeBinding = require('@ast-grep/napi-darwin-universal') | ||
} | ||
break | ||
} catch {} | ||
switch (arch) { | ||
@@ -241,3 +251,3 @@ case 'x64': | ||
const { FrontEndLanguage, SgNode, SgRoot, html, js, jsx, ts, tsx } = nativeBinding | ||
const { FrontEndLanguage, SgNode, SgRoot, parseFiles, html, js, jsx, ts, tsx } = nativeBinding | ||
@@ -247,2 +257,3 @@ module.exports.FrontEndLanguage = FrontEndLanguage | ||
module.exports.SgRoot = SgRoot | ||
module.exports.parseFiles = parseFiles | ||
module.exports.html = html | ||
@@ -249,0 +260,0 @@ module.exports.js = js |
{ | ||
"name": "@ast-grep/napi", | ||
"version": "0.2.1", | ||
"version": "0.2.2", | ||
"description": "Search and Rewrite code at large scale using precise AST pattern", | ||
@@ -46,3 +46,3 @@ "main": "index.js", | ||
"devDependencies": { | ||
"@napi-rs/cli": "2.14.3", | ||
"@napi-rs/cli": "2.14.4", | ||
"ava": "5.1.1", | ||
@@ -68,9 +68,9 @@ "chalk": "5.2.0", | ||
"optionalDependencies": { | ||
"@ast-grep/napi-win32-x64-msvc": "0.2.1", | ||
"@ast-grep/napi-darwin-x64": "0.2.1", | ||
"@ast-grep/napi-linux-x64-gnu": "0.2.1", | ||
"@ast-grep/napi-win32-ia32-msvc": "0.2.1", | ||
"@ast-grep/napi-darwin-arm64": "0.2.1", | ||
"@ast-grep/napi-win32-arm64-msvc": "0.2.1" | ||
"@ast-grep/napi-win32-x64-msvc": "0.2.2", | ||
"@ast-grep/napi-darwin-x64": "0.2.2", | ||
"@ast-grep/napi-linux-x64-gnu": "0.2.2", | ||
"@ast-grep/napi-win32-ia32-msvc": "0.2.2", | ||
"@ast-grep/napi-darwin-arm64": "0.2.2", | ||
"@ast-grep/napi-win32-arm64-msvc": "0.2.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
Shell access
Supply chain riskThis module accesses the system shell. Accessing the system shell increases the risk of executing arbitrary code.
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
13748
333
1