Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 14 additions & 14 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ jobs:
if: ${{ !matrix.settings.docker }}
with:
node-version: 20
cache: 'npm' # Changed from yarn to npm
cache: 'npm'
- name: Install
uses: dtolnay/rust-toolchain@stable
if: ${{ !matrix.settings.docker }}
Expand All @@ -74,16 +74,16 @@ jobs:
shell: bash
- name: Setup node x86
if: matrix.settings.target == 'i686-pc-windows-msvc'
run: npm config set arch ia32 # Changed from yarn config
run: npm config set arch ia32
shell: bash
- name: Install dependencies
run: npm install # Changed from yarn install
run: npm install
- name: Setup node x86
uses: actions/setup-node@v4
if: matrix.settings.target == 'i686-pc-windows-msvc'
with:
node-version: 20
cache: 'npm' # Changed from yarn to npm
cache: 'npm'
architecture: x86
- name: Build in docker
uses: addnab/docker-run-action@v3
Expand Down Expand Up @@ -115,19 +115,19 @@ jobs:
- host: windows-latest
target: x86_64-pc-windows-msvc
node:
- '18'
- '20'
- '22'
runs-on: ${{ matrix.settings.host }}
steps:
- uses: actions/checkout@v4
- name: Setup node
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}
cache: 'npm' # Changed from yarn to npm
cache: 'npm'
architecture: x64
- name: Install dependencies
run: npm install # Changed from yarn install
run: npm install
- name: Download artifacts
uses: actions/download-artifact@v4
with:
Expand All @@ -137,7 +137,7 @@ jobs:
run: ls -R .
shell: bash
- name: Test bindings
run: npm test # Changed from yarn test
run: npm test
test-linux-x64-gnu-binding:
name: Test bindings on Linux-x64-gnu - node@${{ matrix.node }}
needs:
Expand All @@ -155,9 +155,9 @@ jobs:
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}
cache: 'npm' # Changed from yarn to npm
cache: 'npm'
- name: Install dependencies
run: npm install # Changed from yarn install
run: npm install
- name: Download artifacts
uses: actions/download-artifact@v4
with:
Expand All @@ -167,7 +167,7 @@ jobs:
run: ls -R .
shell: bash
- name: Test bindings
run: docker run --rm -v $(pwd):/build -w /build node:${{ matrix.node }}-slim npm test # Changed from yarn test
run: docker run --rm -v $(pwd):/build -w /build node:${{ matrix.node }}-slim npm test
publish:
name: Publish
runs-on: ubuntu-latest
Expand All @@ -180,15 +180,15 @@ jobs:
uses: actions/setup-node@v4
with:
node-version: 20
cache: 'npm' # Changed from yarn to npm
cache: 'npm'
- name: Install dependencies
run: npm install # Changed from yarn install
run: npm install
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
- name: Move artifacts
run: npm run artifacts # Changed from yarn artifacts
run: npm run artifacts
- name: List packages
run: ls -R ./npm
shell: bash
Expand Down
2 changes: 0 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,4 @@ Cargo.lock
*.node

# distribution files
index.js
index.d.ts
npm
70 changes: 70 additions & 0 deletions index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
/* tslint:disable */
/* eslint-disable */

/* auto-generated by NAPI-RS */

export interface MatchData {
offset: number
length: number
data: string
identifier: string
}
export interface RuleMatch {
ruleIdentifier: string
namespace: string
meta: object
tags: Array<string>
matches: Array<MatchData>
}
export interface CompilerOptions {
defineVariables?: object
ignoreModules?: Array<string>
bannedModules?: Array<BannedModule>
features?: Array<string>
relaxedReSyntax?: boolean
conditionOptimization?: boolean
errorOnSlowPattern?: boolean
errorOnSlowLoop?: boolean
}
export interface BannedModule {
name: string
errorTitle: string
errorMessage: string
}
export interface CompilerWarning {
code: string
message: string
source?: string
line?: number
column?: number
}
export interface CompilerError {
code: string
message: string
source?: string
line?: number
column?: number
}
export interface CompileResult {
warnings: Array<CompilerWarning>
errors: Array<CompilerError>
}
export declare function validateYaraRules(ruleSource: string, options?: CompilerOptions | undefined | null): CompileResult
export declare class YaraScanner {
constructor(ruleSource: string, options?: CompilerOptions | undefined | null)
getWarnings(): Array<CompilerWarning>
getErrors(): Array<CompilerError>
static fromFile(rulePath: string, options?: CompilerOptions | undefined | null): YaraScanner
scan(data: Buffer, variables?: Record<string, string | number>): Array<RuleMatch>
scanFile(filePath: string, variables?: Record<string, string | number>): Array<RuleMatch>
emitWasmFile(outputPath: string): void
static compileToWasm(ruleSource: string, outputPath: string, options?: CompilerOptions | undefined | null): void
static compileFileToWasm(rulePath: string, outputPath: string, options?: CompilerOptions | undefined | null): void
scanAsync(data: Buffer, variables?: object | undefined | null): Promise<unknown>
scanFileAsync(filePath: string, variables?: object | undefined | null): Promise<unknown>
emitWasmFileAsync(outputPath: string): Promise<unknown>
addRuleSource(ruleSource: string): void
addRuleFile(filePath: string): void
static createWithOptions(): YaraScanner
defineVariable(name: string, value: string): void
}
Loading
Loading