@biomejs/js-api
Advanced tools
Comparing version 0.3.0-nightly.efc084c to 0.4.0
@@ -1,4 +0,5 @@ | ||
import type { Configuration, Diagnostic, PullDiagnosticsResult } from "@biomejs/wasm-nodejs"; | ||
import type { Diagnostic, PartialConfiguration, PullDiagnosticsResult } from "@biomejs/wasm-nodejs"; | ||
import { Distribution } from "./wasm"; | ||
export type { Configuration, Diagnostic }; | ||
export declare type Configuration = PartialConfiguration; | ||
export type { Diagnostic }; | ||
export { Distribution }; | ||
@@ -32,12 +33,4 @@ export interface FormatContentDebugOptions extends FormatContentOptions { | ||
} | ||
export interface FormatDebugResult { | ||
export interface FormatDebugResult extends FormatResult { | ||
/** | ||
* The new formatted content | ||
*/ | ||
content: string; | ||
/** | ||
* A series of errors encountered while executing an operation | ||
*/ | ||
diagnostics: Diagnostic[]; | ||
/** | ||
* The IR emitted by the formatter | ||
@@ -94,2 +87,3 @@ */ | ||
applyConfiguration(configuration: Configuration): void; | ||
private tryCatchWrapper; | ||
private withFile; | ||
@@ -96,0 +90,0 @@ formatContent(content: string, options: FormatContentOptions): FormatResult; |
@@ -49,4 +49,12 @@ "use strict"; | ||
} | ||
tryCatchWrapper(func) { | ||
try { | ||
return func(); | ||
} | ||
catch (err) { | ||
throw (0, wasm_1.wrapError)(err); | ||
} | ||
} | ||
withFile(path, content, func) { | ||
try { | ||
return this.tryCatchWrapper(() => { | ||
const biomePath = { | ||
@@ -68,6 +76,3 @@ path, | ||
} | ||
} | ||
catch (err) { | ||
throw (0, wasm_1.wrapError)(err); | ||
} | ||
}); | ||
} | ||
@@ -142,3 +147,3 @@ /** | ||
printDiagnostics(diagnostics, options) { | ||
try { | ||
return this.tryCatchWrapper(() => { | ||
const printer = new this.module.DiagnosticPrinter(options.filePath, options.fileSource); | ||
@@ -154,2 +159,3 @@ try { | ||
} | ||
return printer.finish(); | ||
} | ||
@@ -162,7 +168,3 @@ catch (err) { | ||
} | ||
return printer.finish(); | ||
} | ||
catch (err) { | ||
throw (0, wasm_1.wrapError)(err); | ||
} | ||
}); | ||
} | ||
@@ -169,0 +171,0 @@ } |
@@ -1,1 +0,65 @@ | ||
{"name":"@biomejs/js-api","version":"0.3.0-nightly.efc084c","description":"JavaScript APIs for the Biome package","scripts":{"tsc":"tsc --noEmit","format":"cargo biome-cli-dev format ./ --write","ci":"cargo biome-cli-dev ci ./src && tsc --noEmit","check":"pnpm biome:check && tsc --noEmit","biome:check":"cargo biome-cli-dev check ./","check:apply":"cargo biome-cli-dev check ./ --apply-unsafe","build:wasm-bundler-dev":"wasm-pack build --out-dir ../../packages/@biomejs/wasm-bundler --target bundler --dev --scope biomedev ../../../crates/biome_wasm","build:wasm-bundler":"wasm-pack build --out-dir ../../packages/@biomejs/wasm-bundler --target bundler --release --scope biomedev ../../../crates/biome_wasm","build:wasm-node-dev":"wasm-pack build --out-dir ../../packages/@biomejs/wasm-nodejs --target nodejs --dev --scope biomedev ../../../crates/biome_wasm","build:wasm-node":"wasm-pack build --out-dir ../../packages/@biomejs/wasm-nodejs --target nodejs --release --scope biomedev ../../../crates/biome_wasm","build:wasm-web-dev":"wasm-pack build --out-dir ../../packages/@biomejs/wasm-web --target web --dev --scope biomedev ../../../crates/biome_wasm","build:wasm-web":"wasm-pack build --out-dir ../../packages/@biomejs/wasm-web --target web --release --scope biomedev ../../../crates/biome_wasm","test":"vitest","test:ci":"vitest --run","build":"tsc "},"files":["README.md","LICENSE-APACHE","LICENSE-MIT","ROME-LICENSE-MIT","dist/"],"main":"./dist/index.js","types":"./dist/index.d.ts","keywords":["JavaScript","bindings","APIs","biome"],"license":"MIT OR Apache-2.0","homepage":"https://biomejs.dev","repository":{"type":"git","url":"https://github.com/biomejs/biome.git","directory":"packages/@biomejs/js-api"},"author":"Biome Developers and Contributors","bugs":"https://github.com/biomejs/biome/issues","devDependencies":{"typescript":"^4.8.2","vitest":"^0.22.0","vite":"^3.0.8","@biomejs/wasm-bundler":"../wasm-bundler","@biomejs/wasm-nodejs":"../wasm-nodejs","@biomejs/wasm-web":"../wasm-web"},"peerDependencies":{"@biomejs/wasm-bundler":"^10.0.0","@biomejs/wasm-nodejs":"^10.0.0","@biomejs/wasm-web":"^10.0.0"},"peerDependenciesMeta":{"@biomejs/wasm-bundler":{"optional":true},"@biomejs/wasm-nodejs":{"optional":true},"@biomejs/wasm-web":{"optional":true}}} | ||
{ | ||
"name": "@biomejs/js-api", | ||
"version": "0.4.0", | ||
"description": "JavaScript APIs for the Biome package", | ||
"scripts": { | ||
"tsc": "tsc --noEmit", | ||
"format": "cargo biome-cli-dev format ./ --write", | ||
"ci": "cargo biome-cli-dev ci ./src && tsc --noEmit", | ||
"check": "pnpm biome:check && tsc --noEmit", | ||
"biome:check": "cargo biome-cli-dev check ./", | ||
"check:apply": "cargo biome-cli-dev check ./ --apply-unsafe", | ||
"build:wasm-bundler-dev": "wasm-pack build --out-dir ../../packages/@biomejs/wasm-bundler --target bundler --dev --scope biomedev ../../../crates/biome_wasm", | ||
"build:wasm-bundler": "wasm-pack build --out-dir ../../packages/@biomejs/wasm-bundler --target bundler --release --scope biomedev ../../../crates/biome_wasm", | ||
"build:wasm-node-dev": "wasm-pack build --out-dir ../../packages/@biomejs/wasm-nodejs --target nodejs --dev --scope biomedev ../../../crates/biome_wasm", | ||
"build:wasm-node": "wasm-pack build --out-dir ../../packages/@biomejs/wasm-nodejs --target nodejs --release --scope biomedev ../../../crates/biome_wasm", | ||
"build:wasm-web-dev": "wasm-pack build --out-dir ../../packages/@biomejs/wasm-web --target web --dev --scope biomedev ../../../crates/biome_wasm", | ||
"build:wasm-web": "wasm-pack build --out-dir ../../packages/@biomejs/wasm-web --target web --release --scope biomedev ../../../crates/biome_wasm", | ||
"test": "vitest", | ||
"test:ci": "vitest --run", | ||
"build": "tsc " | ||
}, | ||
"files": [ | ||
"README.md", | ||
"LICENSE-APACHE", | ||
"LICENSE-MIT", | ||
"ROME-LICENSE-MIT", | ||
"dist/" | ||
], | ||
"main": "./dist/index.js", | ||
"types": "./dist/index.d.ts", | ||
"keywords": ["JavaScript", "bindings", "APIs", "biome"], | ||
"license": "MIT OR Apache-2.0", | ||
"homepage": "https://biomejs.dev", | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/biomejs/biome.git", | ||
"directory": "packages/@biomejs/js-api" | ||
}, | ||
"author": "Biome Developers and Contributors", | ||
"bugs": "https://github.com/biomejs/biome/issues", | ||
"devDependencies": { | ||
"typescript": "^4.8.2", | ||
"vitest": "^1.3.0", | ||
"vite": "^5.1.3", | ||
"@biomejs/wasm-bundler": "../wasm-bundler", | ||
"@biomejs/wasm-nodejs": "../wasm-nodejs", | ||
"@biomejs/wasm-web": "../wasm-web" | ||
}, | ||
"peerDependencies": { | ||
"@biomejs/wasm-bundler": "^1.5.3", | ||
"@biomejs/wasm-nodejs": "^1.5.3", | ||
"@biomejs/wasm-web": "^1.5.3" | ||
}, | ||
"peerDependenciesMeta": { | ||
"@biomejs/wasm-bundler": { | ||
"optional": true | ||
}, | ||
"@biomejs/wasm-nodejs": { | ||
"optional": true | ||
}, | ||
"@biomejs/wasm-web": { | ||
"optional": true | ||
} | ||
} | ||
} |
@@ -29,3 +29,3 @@ # Biome JavaScript Bindings | ||
const formatted = await biome.formatContent("function f (a, b) { return a == b; }", { | ||
const formatted = biome.formatContent("function f (a, b) { return a == b; }", { | ||
filePath: "example.js", | ||
@@ -36,3 +36,3 @@ }); | ||
const result = await biome.lintContent(formatted.content, { | ||
const result = biome.lintContent(formatted.content, { | ||
filePath: "example.js", | ||
@@ -39,0 +39,0 @@ }); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
37601
407