@biomejs/js-api
Advanced tools
+50
-28
| { | ||
| "name": "@biomejs/js-api", | ||
| "version": "1.0.0", | ||
| "version": "2.0.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-dev": "pnpm run \"/^build:wasm-.+-dev$/\"", | ||
| "build:wasm": "pnpm run \"/^build:wasm-.+(?<!dev)$/\"", | ||
| "build:wasm-bundler-dev": "wasm-pack build --out-dir ../../packages/@biomejs/wasm-bundler --target bundler --dev --scope biomejs ../../../crates/biome_wasm", | ||
| "build:wasm-bundler": "wasm-pack build --out-dir ../../packages/@biomejs/wasm-bundler --target bundler --release --scope biomejs ../../../crates/biome_wasm", | ||
| "build:wasm-node-dev": "wasm-pack build --out-dir ../../packages/@biomejs/wasm-nodejs --target nodejs --dev --scope biomejs ../../../crates/biome_wasm", | ||
| "build:wasm-node": "wasm-pack build --out-dir ../../packages/@biomejs/wasm-nodejs --target nodejs --release --scope biomejs ../../../crates/biome_wasm", | ||
| "build:wasm-web-dev": "wasm-pack build --out-dir ../../packages/@biomejs/wasm-web --target web --dev --scope biomejs ../../../crates/biome_wasm", | ||
| "build:wasm-web": "wasm-pack build --out-dir ../../packages/@biomejs/wasm-web --target web --release --scope biomejs ../../../crates/biome_wasm", | ||
| "test": "vitest", | ||
| "test:ci": "vitest run", | ||
| "build": "tsc" | ||
| }, | ||
| "files": [ | ||
@@ -31,2 +12,21 @@ "README.md", | ||
| ], | ||
| "exports": { | ||
| ".": { | ||
| "types": "./dist/index.d.ts", | ||
| "default": "./dist/index.js" | ||
| }, | ||
| "./bundler": { | ||
| "types": "./dist/bundler.d.ts", | ||
| "default": "./dist/bundler.js" | ||
| }, | ||
| "./nodejs": { | ||
| "types": "./dist/nodejs.d.ts", | ||
| "default": "./dist/nodejs.js" | ||
| }, | ||
| "./web": { | ||
| "types": "./dist/web.d.ts", | ||
| "default": "./dist/web.js" | ||
| }, | ||
| "./package.json": "./package.json" | ||
| }, | ||
| "main": "./dist/index.js", | ||
@@ -50,13 +50,13 @@ "types": "./dist/index.d.ts", | ||
| "devDependencies": { | ||
| "@biomejs/wasm-bundler": "link:../wasm-bundler", | ||
| "@biomejs/wasm-nodejs": "link:../wasm-nodejs", | ||
| "@biomejs/wasm-web": "link:../wasm-web", | ||
| "typescript": "5.8.3", | ||
| "vite": "6.3.5", | ||
| "vitest": "3.2.3" | ||
| "vitest": "3.2.4", | ||
| "@biomejs/wasm-bundler": "2.1.0", | ||
| "@biomejs/wasm-nodejs": "2.1.0", | ||
| "@biomejs/wasm-web": "2.1.0" | ||
| }, | ||
| "peerDependencies": { | ||
| "@biomejs/wasm-bundler": "^2.0.0", | ||
| "@biomejs/wasm-nodejs": "^2.0.0", | ||
| "@biomejs/wasm-web": "^2.0.0" | ||
| "@biomejs/wasm-bundler": "^2.1.0", | ||
| "@biomejs/wasm-nodejs": "^2.1.0", | ||
| "@biomejs/wasm-web": "^2.1.0" | ||
| }, | ||
@@ -73,3 +73,25 @@ "peerDependenciesMeta": { | ||
| } | ||
| }, | ||
| "publishConfig": { | ||
| "provenance": true | ||
| }, | ||
| "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-dev": "pnpm run \"/^build:wasm-.+-dev$/\"", | ||
| "build:wasm": "pnpm run \"/^build:wasm-.+(?<!dev)$/\"", | ||
| "build:wasm-bundler-dev": "wasm-pack build --out-dir ../../packages/@biomejs/wasm-bundler --target bundler --dev --scope biomejs ../../../crates/biome_wasm", | ||
| "build:wasm-bundler": "wasm-pack build --out-dir ../../packages/@biomejs/wasm-bundler --target bundler --release --scope biomejs ../../../crates/biome_wasm", | ||
| "build:wasm-node-dev": "wasm-pack build --out-dir ../../packages/@biomejs/wasm-nodejs --target nodejs --dev --scope biomejs ../../../crates/biome_wasm", | ||
| "build:wasm-node": "wasm-pack build --out-dir ../../packages/@biomejs/wasm-nodejs --target nodejs --release --scope biomejs ../../../crates/biome_wasm", | ||
| "build:wasm-web-dev": "wasm-pack build --out-dir ../../packages/@biomejs/wasm-web --target web --dev --scope biomejs ../../../crates/biome_wasm", | ||
| "build:wasm-web": "wasm-pack build --out-dir ../../packages/@biomejs/wasm-web --target web --release --scope biomejs ../../../crates/biome_wasm", | ||
| "test": "vitest", | ||
| "test:ci": "vitest run", | ||
| "build": "tsc" | ||
| } | ||
| } | ||
| } |
+23
-19
@@ -5,3 +5,3 @@ # Biome JavaScript Bindings | ||
| > **Warning**: | ||
| > [!WARNING] | ||
| > The API is currently in alpha. It is not yet ready for production use. We appreciate your support and feedback as we work to make it ready for everyone. | ||
@@ -19,3 +19,3 @@ | ||
| - `@biomejs/wasm-nodejs`: Install this package if you're using Node.js to load the WebAssembly bundle use the `fs` API | ||
| - `@biomejs/wasm-web`: Install this package if you are targeting the web platform to load the WASM bundle using the `fetch` API | ||
| - `@biomejs/wasm-web`: Install this package if you're targeting the web platform to load the WASM bundle using the `fetch` API | ||
@@ -25,29 +25,33 @@ ## Usage | ||
| ```js | ||
| import { Biome, Distribution } from "@biomejs/js-api"; | ||
| import { Biome } from "@biomejs/js-api/nodejs"; | ||
| // Or: | ||
| // import { Biome, Distribution } from "@biomejs/js-api/bundler"; | ||
| // import { Biome, Distribution } from "@biomejs/js-api/web"; | ||
| const biome = await Biome.create({ | ||
| distribution: Distribution.NODE, // Or BUNDLER / WEB depending on the distribution package you've installed | ||
| }); | ||
| const biome = new Biome(); | ||
| const { projectKey } = biome.openProject("path/to/project/dir"); | ||
| const projectKey = biome.openProject('path/to/project/dir'); | ||
| // Optionally apply a Biome configuration (instead of biome.json) | ||
| biome.applyConfiguration(projectKey, {...}); | ||
| const formatted = biome.formatContent("function f (a, b) { return a == b; }", { | ||
| filePath: "example.js", | ||
| }); | ||
| const formatted = biome.formatContent( | ||
| projectKey, | ||
| "function f (a, b) { return a == b; }", | ||
| { | ||
| filePath: "example.js", | ||
| }, | ||
| ); | ||
| console.log('Formatted content: ', formatted.content); | ||
| console.log("Formatted content: ", formatted.content); | ||
| const result = biome.lintContent(formatted.content, { | ||
| filePath: "example.js", | ||
| const result = biome.lintContent(projectKey, formatted.content, { | ||
| filePath: "example.js", | ||
| }); | ||
| const html = biome.printDiagnostics(result.diagnostics, { | ||
| filePath: "example.js", | ||
| fileSource: formatted.content, | ||
| filePath: "example.js", | ||
| fileSource: formatted.content, | ||
| }); | ||
| console.log('Lint diagnostics: ', html); | ||
| console.log("Lint diagnostics: ", html); | ||
| ``` | ||
@@ -61,4 +65,4 @@ | ||
| Contribution and development instructions can be found in [CONTRIBUTING](../../CONTRIBUTING.md). | ||
| Contribution and development instructions can be found in [Contributing](../../../CONTRIBUTING.md). | ||
| Additional project coordination and real-time discussion happens on our [Discord server](https://biomejs.dev/chat). Remember that all activity on the Discord server is still moderated and will be strictly enforced under the project's [Code of Conduct](../../CODE_OF_CONDUCT.md). | ||
| Additional project coordination and real-time discussion happens on our [Discord server](https://biomejs.dev/chat). Remember that all activity on the Discord server is still moderated and will be strictly enforced under the project's [Code of Conduct](../../../CODE_OF_CONDUCT.md). |
-117
| import type { Configuration, Diagnostic, FixFileMode, OpenProjectResult, ProjectKey } from "@biomejs/wasm-nodejs"; | ||
| import { Distribution } from "./wasm"; | ||
| export type { Diagnostic, Configuration }; | ||
| export { Distribution }; | ||
| export interface FormatContentDebugOptions extends FormatContentOptions { | ||
| /** | ||
| * If `true`, you'll be able to inspect the IR of the formatter | ||
| */ | ||
| debug: boolean; | ||
| } | ||
| export interface FormatContentOptions { | ||
| /** | ||
| * A virtual path of the file. You should add the extension, | ||
| * so Biome knows how to parse the content | ||
| */ | ||
| filePath: string; | ||
| /** | ||
| * The range where to format the content | ||
| */ | ||
| range?: [number, number]; | ||
| } | ||
| export interface FormatResult { | ||
| /** | ||
| * The new formatted content | ||
| */ | ||
| content: string; | ||
| /** | ||
| * A series of errors encountered while executing an operation | ||
| */ | ||
| diagnostics: Diagnostic[]; | ||
| } | ||
| export interface FormatDebugResult extends FormatResult { | ||
| /** | ||
| * The IR emitted by the formatter | ||
| */ | ||
| ir: string; | ||
| } | ||
| export interface LintContentOptions { | ||
| /** | ||
| * A virtual path of the file. You should add the extension, | ||
| * so Biome knows how to parse the content | ||
| */ | ||
| filePath: string; | ||
| fixFileMode?: FixFileMode; | ||
| } | ||
| export interface LintResult { | ||
| content: string; | ||
| diagnostics: Diagnostic[]; | ||
| } | ||
| export interface BiomeCreate { | ||
| distribution: Distribution; | ||
| } | ||
| export interface PrintDiagnosticsOptions { | ||
| /** | ||
| * The name of the file to print diagnostics for | ||
| */ | ||
| filePath: string; | ||
| /** | ||
| * The content of the file the diagnostics were emitted for | ||
| */ | ||
| fileSource: string; | ||
| /** | ||
| * Whether to print the diagnostics in verbose mode | ||
| */ | ||
| verbose?: boolean; | ||
| } | ||
| export declare class Biome { | ||
| private readonly module; | ||
| private readonly workspace; | ||
| private constructor(); | ||
| /** | ||
| * It creates a new instance of the class {Biome}. | ||
| */ | ||
| static create(options: BiomeCreate): Promise<Biome>; | ||
| /** | ||
| * Stop this instance of Biome | ||
| * | ||
| * After calling `shutdown()` on this object, it should be considered | ||
| * unusable as calling any method on it will fail | ||
| */ | ||
| shutdown(): void; | ||
| /** | ||
| * Allows to apply a custom configuration. | ||
| * | ||
| * If fails when the configuration is incorrect. | ||
| * | ||
| * @param {ProjectKey} projectKey The identifier of the project | ||
| * @param {Configuration} configuration | ||
| */ | ||
| applyConfiguration(projectKey: ProjectKey, configuration: Configuration): void; | ||
| /** | ||
| * Open a possible workspace project folder. Returns the key of said project. Use this key when you want to switch to different projects. | ||
| * | ||
| * @param {string} [path] | ||
| */ | ||
| openProject(path?: string): OpenProjectResult; | ||
| private tryCatchWrapper; | ||
| private withFile; | ||
| formatContent(projectKey: ProjectKey, content: string, options: FormatContentOptions): FormatResult; | ||
| formatContent(projectKey: ProjectKey, content: string, options: FormatContentDebugOptions): FormatDebugResult; | ||
| /** | ||
| * Lint the content of a file. | ||
| * | ||
| * @param {ProjectKey} projectKey The identifier of the project | ||
| * @param {String} content The content to lint | ||
| * @param {LintContentOptions} options Options needed when linting some content | ||
| */ | ||
| lintContent(projectKey: ProjectKey, content: string, { filePath, fixFileMode }: LintContentOptions): LintResult; | ||
| /** | ||
| * Print a list of diagnostics to an HTML string. | ||
| * | ||
| * @param {Diagnostic[]} diagnostics The list of diagnostics to print | ||
| * @param {PrintDiagnosticsOptions} options Options needed for printing the diagnostics | ||
| */ | ||
| printDiagnostics(diagnostics: Diagnostic[], options: PrintDiagnosticsOptions): string; | ||
| } | ||
| //# sourceMappingURL=index.d.ts.map |
| {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEX,aAAa,EACb,UAAU,EACV,WAAW,EACX,iBAAiB,EACjB,UAAU,EAEV,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,YAAY,EAA0C,MAAM,QAAQ,CAAC;AAG9E,YAAY,EAAE,UAAU,EAAE,aAAa,EAAE,CAAC;AAC1C,OAAO,EAAE,YAAY,EAAE,CAAC;AAExB,MAAM,WAAW,yBAA0B,SAAQ,oBAAoB;IACtE;;OAEG;IACH,KAAK,EAAE,OAAO,CAAC;CACf;AAED,MAAM,WAAW,oBAAoB;IACpC;;;OAGG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB;;OAEG;IACH,KAAK,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACzB;AAED,MAAM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OAAO,EAAE,yBAAyB,GAChC,iBAAiB;IAkEpB;;;;;;OAMG;IACH,WAAW,CACV,UAAU,EAAE,UAAU,EACtB,OAAO,EAAE,MAAM,EACf,EAAE,QAAQ,EAAE,WAAW,EAAE,EAAE,kBAAkB,GAC3C,UAAU;IAsCb;;;;;OAKG;IACH,gBAAgB,CACf,WAAW,EAAE,UAAU,EAAE,EACzB,OAAO,EAAE,uBAAuB,GAC9B,MAAM;CAwBT"} |
-212
| "use strict"; | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| exports.Biome = exports.Distribution = void 0; | ||
| const wasm_1 = require("./wasm"); | ||
| Object.defineProperty(exports, "Distribution", { enumerable: true, get: function () { return wasm_1.Distribution; } }); | ||
| function isFormatContentDebug(options) { | ||
| return "debug" in options && options.debug !== undefined; | ||
| } | ||
| class Biome { | ||
| constructor(module, workspace) { | ||
| this.module = module; | ||
| this.workspace = workspace; | ||
| } | ||
| /** | ||
| * It creates a new instance of the class {Biome}. | ||
| */ | ||
| static async create(options) { | ||
| const module = await (0, wasm_1.loadModule)(options.distribution); | ||
| const workspace = new module.Workspace(); | ||
| const biome = new Biome(module, workspace); | ||
| biome.openProject(); | ||
| return biome; | ||
| } | ||
| /** | ||
| * Stop this instance of Biome | ||
| * | ||
| * After calling `shutdown()` on this object, it should be considered | ||
| * unusable as calling any method on it will fail | ||
| */ | ||
| shutdown() { | ||
| this.workspace.free(); | ||
| } | ||
| /** | ||
| * Allows to apply a custom configuration. | ||
| * | ||
| * If fails when the configuration is incorrect. | ||
| * | ||
| * @param {ProjectKey} projectKey The identifier of the project | ||
| * @param {Configuration} configuration | ||
| */ | ||
| applyConfiguration(projectKey, configuration) { | ||
| try { | ||
| this.workspace.updateSettings({ | ||
| projectKey, | ||
| configuration, | ||
| workspaceDirectory: "./", | ||
| }); | ||
| } | ||
| catch (e) { | ||
| throw (0, wasm_1.wrapError)(e); | ||
| } | ||
| } | ||
| /** | ||
| * Open a possible workspace project folder. Returns the key of said project. Use this key when you want to switch to different projects. | ||
| * | ||
| * @param {string} [path] | ||
| */ | ||
| openProject(path) { | ||
| return this.workspace.openProject({ | ||
| path: path || "", | ||
| openUninitialized: true, | ||
| }); | ||
| } | ||
| tryCatchWrapper(func) { | ||
| try { | ||
| return func(); | ||
| } | ||
| catch (err) { | ||
| throw (0, wasm_1.wrapError)(err); | ||
| } | ||
| } | ||
| withFile(projectKey, path, content, func) { | ||
| return this.tryCatchWrapper(() => { | ||
| this.workspace.openFile({ | ||
| projectKey, | ||
| content: { type: "fromClient", content, version: 0 }, | ||
| path, | ||
| }); | ||
| try { | ||
| return func(path); | ||
| } | ||
| finally { | ||
| this.workspace.closeFile({ | ||
| projectKey, | ||
| path, | ||
| }); | ||
| } | ||
| }); | ||
| } | ||
| /** | ||
| * If formats some content. | ||
| * | ||
| * @param {ProjectKey} projectKey The identifier of the project | ||
| * @param {String} content The content to format | ||
| * @param {FormatContentOptions | FormatContentDebugOptions} options Options needed when formatting some content | ||
| */ | ||
| formatContent(projectKey, content, options) { | ||
| return this.withFile(projectKey, options.filePath, content, (path) => { | ||
| let code = content; | ||
| const { diagnostics } = this.workspace.pullDiagnostics({ | ||
| projectKey, | ||
| path, | ||
| categories: ["syntax"], | ||
| only: [], | ||
| skip: [], | ||
| pullCodeActions: false, | ||
| }); | ||
| const hasErrors = diagnostics.some((diag) => diag.severity === "fatal" || diag.severity === "error"); | ||
| if (!hasErrors) { | ||
| if (options.range) { | ||
| const result = this.workspace.formatRange({ | ||
| projectKey, | ||
| path, | ||
| range: options.range, | ||
| }); | ||
| code = result.code; | ||
| } | ||
| else { | ||
| const result = this.workspace.formatFile({ | ||
| projectKey, | ||
| path, | ||
| }); | ||
| code = result.code; | ||
| } | ||
| if (isFormatContentDebug(options)) { | ||
| const ir = this.workspace.getFormatterIr({ | ||
| projectKey, | ||
| path, | ||
| }); | ||
| return { | ||
| content: code, | ||
| diagnostics, | ||
| ir, | ||
| }; | ||
| } | ||
| } | ||
| return { | ||
| content: code, | ||
| diagnostics, | ||
| }; | ||
| }); | ||
| } | ||
| /** | ||
| * Lint the content of a file. | ||
| * | ||
| * @param {ProjectKey} projectKey The identifier of the project | ||
| * @param {String} content The content to lint | ||
| * @param {LintContentOptions} options Options needed when linting some content | ||
| */ | ||
| lintContent(projectKey, content, { filePath, fixFileMode }) { | ||
| const maybeFixedContent = fixFileMode | ||
| ? this.withFile(projectKey, filePath, content, (path) => { | ||
| let code = content; | ||
| const result = this.workspace.fixFile({ | ||
| projectKey, | ||
| path, | ||
| fixFileMode: fixFileMode, | ||
| shouldFormat: false, | ||
| only: [], | ||
| skip: [], | ||
| ruleCategories: ["syntax", "lint", "action"], | ||
| }); | ||
| code = result.code; | ||
| return code; | ||
| }) | ||
| : content; | ||
| return this.withFile(projectKey, filePath, maybeFixedContent, (path) => { | ||
| const { diagnostics } = this.workspace.pullDiagnostics({ | ||
| projectKey, | ||
| path, | ||
| categories: ["syntax", "lint", "action"], | ||
| only: [], | ||
| skip: [], | ||
| pullCodeActions: false, | ||
| }); | ||
| return { | ||
| content: maybeFixedContent, | ||
| diagnostics, | ||
| }; | ||
| }); | ||
| } | ||
| /** | ||
| * Print a list of diagnostics to an HTML string. | ||
| * | ||
| * @param {Diagnostic[]} diagnostics The list of diagnostics to print | ||
| * @param {PrintDiagnosticsOptions} options Options needed for printing the diagnostics | ||
| */ | ||
| printDiagnostics(diagnostics, options) { | ||
| return this.tryCatchWrapper(() => { | ||
| const printer = new this.module.DiagnosticPrinter(options.filePath, options.fileSource); | ||
| try { | ||
| for (const diag of diagnostics) { | ||
| if (options.verbose) { | ||
| printer.print_verbose(diag); | ||
| } | ||
| else { | ||
| printer.print_simple(diag); | ||
| } | ||
| } | ||
| return printer.finish(); | ||
| } | ||
| catch (err) { | ||
| // Only call `free` if the `print` method throws, `finish` will | ||
| // take care of deallocating the printer even if it fails | ||
| printer.free(); | ||
| throw err; | ||
| } | ||
| }); | ||
| } | ||
| } | ||
| exports.Biome = Biome; | ||
| //# sourceMapp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oBAC5B,CAAC;gBACF,CAAC;gBACD,OAAO,OAAO,CAAC,MAAM,EAAE,CAAC;YACzB,CAAC;YAAC,OAAO,GAAG,EAAE,CAAC;gBACd,+DAA+D;gBAC/D,yDAAyD;gBACzD,OAAO,CAAC,IAAI,EAAE,CAAC;gBACf,MAAM,GAAG,CAAC;YACX,CAAC;QACF,CAAC,CAAC,CAAC;IACJ,CAAC;CACD;AA3PD,sBA2PC"} |
| export type WasmBundler = typeof import("@biomejs/wasm-bundler"); | ||
| export type WasmNodejs = typeof import("@biomejs/wasm-nodejs"); | ||
| export type WasmWeb = typeof import("@biomejs/wasm-web"); | ||
| export type WasmModule = WasmBundler | WasmNodejs | WasmWeb; | ||
| /** | ||
| * What kind of client Biome should use to communicate with the binary | ||
| */ | ||
| export declare enum Distribution { | ||
| /** | ||
| * Use this if you want to communicate with the WebAssembly client built for bundlers | ||
| */ | ||
| BUNDLER = 0, | ||
| /** | ||
| * Use this if you want to communicate with the WebAssembly client built for Node.JS | ||
| */ | ||
| NODE = 1, | ||
| /** | ||
| * Use this if you want to communicate with the WebAssembly client built for the Web | ||
| */ | ||
| WEB = 2 | ||
| } | ||
| export declare function loadModule(dist: Distribution): Promise<WasmModule>; | ||
| /** | ||
| * The error generated when communicating with WebAssembly | ||
| */ | ||
| declare class WasmError extends Error { | ||
| /** | ||
| * The stack trace of the error. | ||
| * | ||
| * It might be useful, but the first like of the stack trace contains the error | ||
| */ | ||
| stackTrace: string; | ||
| private constructor(); | ||
| static fromError(e: unknown): WasmError; | ||
| } | ||
| /** | ||
| * Creates wrap a WebAssembly error into a native JS Error | ||
| * | ||
| * @param e | ||
| */ | ||
| export declare function wrapError(e: unknown): WasmError; | ||
| export {}; | ||
| //# sourceMappingURL=wasm.d.ts.map |
| {"version":3,"file":"wasm.d.ts","sourceRoot":"","sources":["../src/wasm.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,WAAW,GAAG,cAAc,uBAAuB,CAAC,CAAC;AACjE,MAAM,MAAM,UAAU,GAAG,cAAc,sBAAsB,CAAC,CAAC;AAC/D,MAAM,MAAM,OAAO,GAAG,cAAc,mBAAmB,CAAC,CAAC;AAEzD,MAAM,MAAM,UAAU,GAAG,WAAW,GAAG,UAAU,GAAG,OAAO,CAAC;AAE5D;;GAEG;AACH,oBAAY,YAAY;IACvB;;OAEG;IACH,OAAO,IAAI;IACX;;OAEG;IACH,IAAI,IAAI;IACR;;OAEG;IACH,GAAG,IAAI;CACP;AAQD,wBAAsB,UAAU,CAAC,IAAI,EAAE,YAAY,GAAG,OAAO,CAAC,UAAU,CAAC,CA0BxE;AAED;;GAEG;AACH,cAAM,SAAU,SAAQ,KAAK;IAC5B;;;;OAIG;IACH,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO;IAKP,MAAM,CAAC,SAAS,CAAC,CAAC,EAAE,OAAO,GAAG,SAAS;CAGvC;AAED;;;;GAIG;AACH,wBAAgB,SAAS,CAAC,CAAC,EAAE,OAAO,GAAG,SAAS,CAE/C"} |
-105
| "use strict"; | ||
| var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
| if (k2 === undefined) k2 = k; | ||
| var desc = Object.getOwnPropertyDescriptor(m, k); | ||
| if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { | ||
| desc = { enumerable: true, get: function() { return m[k]; } }; | ||
| } | ||
| Object.defineProperty(o, k2, desc); | ||
| }) : (function(o, m, k, k2) { | ||
| if (k2 === undefined) k2 = k; | ||
| o[k2] = m[k]; | ||
| })); | ||
| var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { | ||
| Object.defineProperty(o, "default", { enumerable: true, value: v }); | ||
| }) : function(o, v) { | ||
| o["default"] = v; | ||
| }); | ||
| var __importStar = (this && this.__importStar) || (function () { | ||
| var ownKeys = function(o) { | ||
| ownKeys = Object.getOwnPropertyNames || function (o) { | ||
| var ar = []; | ||
| for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; | ||
| return ar; | ||
| }; | ||
| return ownKeys(o); | ||
| }; | ||
| return function (mod) { | ||
| if (mod && mod.__esModule) return mod; | ||
| var result = {}; | ||
| if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); | ||
| __setModuleDefault(result, mod); | ||
| return result; | ||
| }; | ||
| })(); | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| exports.Distribution = void 0; | ||
| exports.loadModule = loadModule; | ||
| exports.wrapError = wrapError; | ||
| /** | ||
| * What kind of client Biome should use to communicate with the binary | ||
| */ | ||
| var Distribution; | ||
| (function (Distribution) { | ||
| /** | ||
| * Use this if you want to communicate with the WebAssembly client built for bundlers | ||
| */ | ||
| Distribution[Distribution["BUNDLER"] = 0] = "BUNDLER"; | ||
| /** | ||
| * Use this if you want to communicate with the WebAssembly client built for Node.JS | ||
| */ | ||
| Distribution[Distribution["NODE"] = 1] = "NODE"; | ||
| /** | ||
| * Use this if you want to communicate with the WebAssembly client built for the Web | ||
| */ | ||
| Distribution[Distribution["WEB"] = 2] = "WEB"; | ||
| })(Distribution || (exports.Distribution = Distribution = {})); | ||
| const isInitialized = { | ||
| [Distribution.BUNDLER]: false, | ||
| [Distribution.NODE]: false, | ||
| [Distribution.WEB]: false, | ||
| }; | ||
| async function loadModule(dist) { | ||
| let modulePromise; | ||
| switch (dist) { | ||
| case Distribution.BUNDLER: { | ||
| modulePromise = Promise.resolve().then(() => __importStar(require("@biomejs/wasm-bundler"))); | ||
| break; | ||
| } | ||
| case Distribution.NODE: { | ||
| modulePromise = Promise.resolve().then(() => __importStar(require("@biomejs/wasm-nodejs"))); | ||
| break; | ||
| } | ||
| case Distribution.WEB: { | ||
| modulePromise = Promise.resolve().then(() => __importStar(require("@biomejs/wasm-web"))); | ||
| break; | ||
| } | ||
| } | ||
| const module = await modulePromise; | ||
| if (!isInitialized[dist]) { | ||
| isInitialized[dist] = true; | ||
| module.main(); | ||
| } | ||
| return module; | ||
| } | ||
| /** | ||
| * The error generated when communicating with WebAssembly | ||
| */ | ||
| class WasmError extends Error { | ||
| constructor(stackTrace) { | ||
| super(); | ||
| this.stackTrace = stackTrace; | ||
| } | ||
| static fromError(e) { | ||
| return new WasmError(e); | ||
| } | ||
| } | ||
| /** | ||
| * Creates wrap a WebAssembly error into a native JS Error | ||
| * | ||
| * @param e | ||
| */ | ||
| function wrapError(e) { | ||
| return WasmError.fromError(e); | ||
| } | ||
| //# sourceMappingURL=wasm.js.map |
| {"version":3,"file":"wasm.js","sourceRoot":"","sources":["../src/wasm.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8BA,gCA0BC;AA2BD,8BAEC;AA/ED;;GAEG;AACH,IAAY,YAaX;AAbD,WAAY,YAAY;IACvB;;OAEG;IACH,qDAAW,CAAA;IACX;;OAEG;IACH,+CAAQ,CAAA;IACR;;OAEG;IACH,6CAAO,CAAA;AACR,CAAC,EAbW,YAAY,4BAAZ,YAAY,QAavB;AAED,MAAM,aAAa,GAAG;IACrB,CAAC,YAAY,CAAC,OAAO,CAAC,EAAE,KAAK;IAC7B,CAAC,YAAY,CAAC,IAAI,CAAC,EAAE,KAAK;IAC1B,CAAC,YAAY,CAAC,GAAG,CAAC,EAAE,KAAK;CACzB,CAAC;AAEK,KAAK,UAAU,UAAU,CAAC,IAAkB;IAClD,IAAI,aAAkC,CAAC;IAEvC,QAAQ,IAAI,EAAE,CAAC;QACd,KAAK,YAAY,CAAC,OAAO,CAAC,CAAC,CAAC;YAC3B,aAAa,qDAAU,uBAAuB,GAAC,CAAC;YAChD,MAAM;QACP,CAAC;QACD,KAAK,YAAY,CAAC,IAAI,CAAC,CAAC,CAAC;YACxB,aAAa,qDAAU,sBAAsB,GAAC,CAAC;YAC/C,MAAM;QACP,CAAC;QACD,KAAK,YAAY,CAAC,GAAG,CAAC,CAAC,CAAC;YACvB,aAAa,qDAAU,mBAAmB,GAAC,CAAC;YAC5C,MAAM;QACP,CAAC;IACF,CAAC;IAED,MAAM,MAAM,GAAG,MAAM,aAAa,CAAC;IAEnC,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,EAAE,CAAC;QAC1B,aAAa,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;QAC3B,MAAM,CAAC,IAAI,EAAE,CAAC;IACf,CAAC;IAED,OAAO,MAAM,CAAC;AACf,CAAC;AAED;;GAEG;AACH,MAAM,SAAU,SAAQ,KAAK;IAO5B,YAAoB,UAAkB;QACrC,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;IAC9B,CAAC;IAED,MAAM,CAAC,SAAS,CAAC,CAAU;QAC1B,OAAO,IAAI,SAAS,CAAC,CAAW,CAAC,CAAC;IACnC,CAAC;CACD;AAED;;;;GAIG;AACH,SAAgB,SAAS,CAAC,CAAU;IACnC,OAAO,SAAS,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;AAC/B,CAAC"} |
Empty package
Supply chain riskPackage does not contain any code. It may be removed, is name squatting, or the result of a faulty package publish.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
65
6.56%18470
-56.06%5
-61.54%0
-100%2
Infinity%