@biomejs/wasm-web 2.0.6 → 2.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/biome_wasm.js CHANGED
@@ -171,6 +171,19 @@ export function main() {
171
171
  wasm.main();
172
172
  }
173
173
 
174
+ function passArray8ToWasm0(arg, malloc) {
175
+ const ptr = malloc(arg.length * 1, 1) >>> 0;
176
+ getUint8ArrayMemory0().set(arg, ptr / 1);
177
+ WASM_VECTOR_LEN = arg.length;
178
+ return ptr;
179
+ }
180
+
181
+ function _assertClass(instance, klass) {
182
+ if (!(instance instanceof klass)) {
183
+ throw new Error(`expected instance of ${klass.name}`);
184
+ }
185
+ }
186
+
174
187
  function takeFromExternrefTable0(idx) {
175
188
  const value = wasm.__wbindgen_export_4.get(idx);
176
189
  wasm.__externref_table_dealloc(idx);
@@ -250,12 +263,64 @@ export class DiagnosticPrinter {
250
263
  }
251
264
  }
252
265
 
266
+ const MemoryFileSystemFinalization = (typeof FinalizationRegistry === 'undefined')
267
+ ? { register: () => {}, unregister: () => {} }
268
+ : new FinalizationRegistry(ptr => wasm.__wbg_memoryfilesystem_free(ptr >>> 0, 1));
269
+
270
+ export class MemoryFileSystem {
271
+
272
+ __destroy_into_raw() {
273
+ const ptr = this.__wbg_ptr;
274
+ this.__wbg_ptr = 0;
275
+ MemoryFileSystemFinalization.unregister(this);
276
+ return ptr;
277
+ }
278
+
279
+ free() {
280
+ const ptr = this.__destroy_into_raw();
281
+ wasm.__wbg_memoryfilesystem_free(ptr, 0);
282
+ }
283
+ constructor() {
284
+ const ret = wasm.memoryfilesystem_new();
285
+ this.__wbg_ptr = ret >>> 0;
286
+ MemoryFileSystemFinalization.register(this, this.__wbg_ptr, this);
287
+ return this;
288
+ }
289
+ /**
290
+ * @param {string} path
291
+ * @param {Uint8Array} data
292
+ */
293
+ insert(path, data) {
294
+ const ptr0 = passStringToWasm0(path, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
295
+ const len0 = WASM_VECTOR_LEN;
296
+ const ptr1 = passArray8ToWasm0(data, wasm.__wbindgen_malloc);
297
+ const len1 = WASM_VECTOR_LEN;
298
+ wasm.memoryfilesystem_insert(this.__wbg_ptr, ptr0, len0, ptr1, len1);
299
+ }
300
+ /**
301
+ * @param {string} path
302
+ */
303
+ remove(path) {
304
+ const ptr0 = passStringToWasm0(path, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
305
+ const len0 = WASM_VECTOR_LEN;
306
+ wasm.memoryfilesystem_remove(this.__wbg_ptr, ptr0, len0);
307
+ }
308
+ }
309
+
253
310
  const WorkspaceFinalization = (typeof FinalizationRegistry === 'undefined')
254
311
  ? { register: () => {}, unregister: () => {} }
255
312
  : new FinalizationRegistry(ptr => wasm.__wbg_workspace_free(ptr >>> 0, 1));
256
313
 
257
314
  export class Workspace {
258
315
 
316
+ static __wrap(ptr) {
317
+ ptr = ptr >>> 0;
318
+ const obj = Object.create(Workspace.prototype);
319
+ obj.__wbg_ptr = ptr;
320
+ WorkspaceFinalization.register(obj, obj.__wbg_ptr, obj);
321
+ return obj;
322
+ }
323
+
259
324
  __destroy_into_raw() {
260
325
  const ptr = this.__wbg_ptr;
261
326
  this.__wbg_ptr = 0;
@@ -273,6 +338,15 @@ export class Workspace {
273
338
  WorkspaceFinalization.register(this, this.__wbg_ptr, this);
274
339
  return this;
275
340
  }
341
+ /**
342
+ * @param {MemoryFileSystem} fs
343
+ * @returns {Workspace}
344
+ */
345
+ static withFileSystem(fs) {
346
+ _assertClass(fs, MemoryFileSystem);
347
+ const ret = wasm.workspace_withFileSystem(fs.__wbg_ptr);
348
+ return Workspace.__wrap(ret);
349
+ }
276
350
  /**
277
351
  * @param {SupportsFeatureParams} params
278
352
  * @returns {FileFeaturesResult}
Binary file
package/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "Biome Developers and Contributors"
6
6
  ],
7
7
  "description": "WebAssembly bindings to the Biome workspace API",
8
- "version": "2.0.6",
8
+ "version": "2.1.0",
9
9
  "license": "MIT OR Apache-2.0",
10
10
  "repository": {
11
11
  "type": "git",