@ruby/wasm-wasi 2.6.2 → 2.7.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.
@@ -206,39 +206,23 @@
206
206
  class RbAbiGuest {
207
207
  constructor() {
208
208
  this._resource0_slab = new Slab();
209
- this._resource1_slab = new Slab();
210
209
  }
211
210
  addToImports(imports) {
212
211
  if (!("canonical_abi" in imports)) imports["canonical_abi"] = {};
213
212
 
214
- imports.canonical_abi['resource_drop_rb-iseq'] = i => {
213
+ imports.canonical_abi['resource_drop_rb-abi-value'] = i => {
215
214
  this._resource0_slab.remove(i).drop();
216
215
  };
217
- imports.canonical_abi['resource_clone_rb-iseq'] = i => {
216
+ imports.canonical_abi['resource_clone_rb-abi-value'] = i => {
218
217
  const obj = this._resource0_slab.get(i);
219
218
  return this._resource0_slab.insert(obj.clone())
220
219
  };
221
- imports.canonical_abi['resource_get_rb-iseq'] = i => {
222
- return this._resource0_slab.get(i)._wasm_val;
223
- };
224
- imports.canonical_abi['resource_new_rb-iseq'] = i => {
225
- this._registry0;
226
- return this._resource0_slab.insert(new RbIseq(i, this));
227
- };
228
-
229
- imports.canonical_abi['resource_drop_rb-abi-value'] = i => {
230
- this._resource1_slab.remove(i).drop();
231
- };
232
- imports.canonical_abi['resource_clone_rb-abi-value'] = i => {
233
- const obj = this._resource1_slab.get(i);
234
- return this._resource1_slab.insert(obj.clone())
235
- };
236
220
  imports.canonical_abi['resource_get_rb-abi-value'] = i => {
237
- return this._resource1_slab.get(i)._wasm_val;
221
+ return this._resource0_slab.get(i)._wasm_val;
238
222
  };
239
223
  imports.canonical_abi['resource_new_rb-abi-value'] = i => {
240
- this._registry1;
241
- return this._resource1_slab.insert(new RbAbiValue(i, this));
224
+ this._registry0;
225
+ return this._resource0_slab.insert(new RbAbiValue(i, this));
242
226
  };
243
227
  }
244
228
 
@@ -258,16 +242,12 @@
258
242
  this.instance = instance;
259
243
  }
260
244
  this._exports = this.instance.exports;
261
- this._registry0 = new FinalizationRegistry(this._exports['canonical_abi_drop_rb-iseq']);
262
- this._registry1 = new FinalizationRegistry(this._exports['canonical_abi_drop_rb-abi-value']);
245
+ this._registry0 = new FinalizationRegistry(this._exports['canonical_abi_drop_rb-abi-value']);
263
246
  }
264
247
  rubyShowVersion() {
265
248
  this._exports['ruby-show-version: func() -> ()']();
266
249
  }
267
- rubyInit() {
268
- this._exports['ruby-init: func() -> ()']();
269
- }
270
- rubySysinit(arg0) {
250
+ rubyInit(arg0) {
271
251
  const memory = this._exports.memory;
272
252
  const realloc = this._exports["cabi_realloc"];
273
253
  const vec1 = arg0;
@@ -281,31 +261,7 @@
281
261
  data_view(memory).setInt32(base + 4, len0, true);
282
262
  data_view(memory).setInt32(base + 0, ptr0, true);
283
263
  }
284
- this._exports['ruby-sysinit: func(args: list<string>) -> ()'](result1, len1);
285
- }
286
- rubyOptions(arg0) {
287
- const memory = this._exports.memory;
288
- const realloc = this._exports["cabi_realloc"];
289
- const vec1 = arg0;
290
- const len1 = vec1.length;
291
- const result1 = realloc(0, 0, 4, len1 * 8);
292
- for (let i = 0; i < vec1.length; i++) {
293
- const e = vec1[i];
294
- const base = result1 + i * 8;
295
- const ptr0 = utf8_encode(e, realloc, memory);
296
- const len0 = UTF8_ENCODED_LEN;
297
- data_view(memory).setInt32(base + 4, len0, true);
298
- data_view(memory).setInt32(base + 0, ptr0, true);
299
- }
300
- const ret = this._exports['ruby-options: func(args: list<string>) -> handle<rb-iseq>'](result1, len1);
301
- return this._resource0_slab.remove(ret);
302
- }
303
- rubyScript(arg0) {
304
- const memory = this._exports.memory;
305
- const realloc = this._exports["cabi_realloc"];
306
- const ptr0 = utf8_encode(arg0, realloc, memory);
307
- const len0 = UTF8_ENCODED_LEN;
308
- this._exports['ruby-script: func(name: string) -> ()'](ptr0, len0);
264
+ this._exports['ruby-init: func(args: list<string>) -> ()'](result1, len1);
309
265
  }
310
266
  rubyInitLoadpath() {
311
267
  this._exports['ruby-init-loadpath: func() -> ()']();
@@ -316,7 +272,7 @@
316
272
  const ptr0 = utf8_encode(arg0, realloc, memory);
317
273
  const len0 = UTF8_ENCODED_LEN;
318
274
  const ret = this._exports['rb-eval-string-protect: func(str: string) -> tuple<handle<rb-abi-value>, s32>'](ptr0, len0);
319
- return [this._resource1_slab.remove(data_view(memory).getInt32(ret + 0, true)), data_view(memory).getInt32(ret + 4, true)];
275
+ return [this._resource0_slab.remove(data_view(memory).getInt32(ret + 0, true)), data_view(memory).getInt32(ret + 4, true)];
320
276
  }
321
277
  rbFuncallvProtect(arg0, arg1, arg2) {
322
278
  const memory = this._exports.memory;
@@ -331,10 +287,10 @@
331
287
  const base = result2 + i * 4;
332
288
  const obj1 = e;
333
289
  if (!(obj1 instanceof RbAbiValue)) throw new TypeError('expected instance of RbAbiValue');
334
- data_view(memory).setInt32(base + 0, this._resource1_slab.insert(obj1.clone()), true);
290
+ data_view(memory).setInt32(base + 0, this._resource0_slab.insert(obj1.clone()), true);
335
291
  }
336
- const ret = this._exports['rb-funcallv-protect: func(recv: handle<rb-abi-value>, mid: u32, args: list<handle<rb-abi-value>>) -> tuple<handle<rb-abi-value>, s32>'](this._resource1_slab.insert(obj0.clone()), to_uint32(arg1), result2, len2);
337
- return [this._resource1_slab.remove(data_view(memory).getInt32(ret + 0, true)), data_view(memory).getInt32(ret + 4, true)];
292
+ const ret = this._exports['rb-funcallv-protect: func(recv: handle<rb-abi-value>, mid: u32, args: list<handle<rb-abi-value>>) -> tuple<handle<rb-abi-value>, s32>'](this._resource0_slab.insert(obj0.clone()), to_uint32(arg1), result2, len2);
293
+ return [this._resource0_slab.remove(data_view(memory).getInt32(ret + 0, true)), data_view(memory).getInt32(ret + 4, true)];
338
294
  }
339
295
  rbIntern(arg0) {
340
296
  const memory = this._exports.memory;
@@ -346,7 +302,7 @@
346
302
  }
347
303
  rbErrinfo() {
348
304
  const ret = this._exports['rb-errinfo: func() -> handle<rb-abi-value>']();
349
- return this._resource1_slab.remove(ret);
305
+ return this._resource0_slab.remove(ret);
350
306
  }
351
307
  rbClearErrinfo() {
352
308
  this._exports['rb-clear-errinfo: func() -> ()']();
@@ -355,7 +311,7 @@
355
311
  const memory = this._exports.memory;
356
312
  const obj0 = arg0;
357
313
  if (!(obj0 instanceof RbAbiValue)) throw new TypeError('expected instance of RbAbiValue');
358
- const ret = this._exports['rstring-ptr: func(value: handle<rb-abi-value>) -> string'](this._resource1_slab.insert(obj0.clone()));
314
+ const ret = this._exports['rstring-ptr: func(value: handle<rb-abi-value>) -> string'](this._resource0_slab.insert(obj0.clone()));
359
315
  const ptr1 = data_view(memory).getInt32(ret + 0, true);
360
316
  const len1 = data_view(memory).getInt32(ret + 4, true);
361
317
  const result1 = UTF8_DECODER.decode(new Uint8Array(memory.buffer, ptr1, len1));
@@ -382,7 +338,7 @@
382
338
  }
383
339
  }
384
340
 
385
- class RbIseq {
341
+ class RbAbiValue {
386
342
  constructor(wasm_val, obj) {
387
343
  this._wasm_val = wasm_val;
388
344
  this._obj = obj;
@@ -400,33 +356,6 @@
400
356
  if (this._refcnt !== 0)
401
357
  return;
402
358
  this._obj._registry0.unregister(this);
403
- const dtor = this._obj._exports['canonical_abi_drop_rb-iseq'];
404
- const wasm_val = this._wasm_val;
405
- delete this._obj;
406
- delete this._refcnt;
407
- delete this._wasm_val;
408
- dtor(wasm_val);
409
- }
410
- }
411
-
412
- class RbAbiValue {
413
- constructor(wasm_val, obj) {
414
- this._wasm_val = wasm_val;
415
- this._obj = obj;
416
- this._refcnt = 1;
417
- obj._registry1.register(this, wasm_val, this);
418
- }
419
-
420
- clone() {
421
- this._refcnt += 1;
422
- return this;
423
- }
424
-
425
- drop() {
426
- this._refcnt -= 1;
427
- if (this._refcnt !== 0)
428
- return;
429
- this._obj._registry1.unregister(this);
430
359
  const dtor = this._obj._exports['canonical_abi_drop_rb-abi-value'];
431
360
  const wasm_val = this._wasm_val;
432
361
  delete this._obj;
@@ -727,17 +656,8 @@
727
656
  rubyShowVersion() {
728
657
  this.underlying.rubyShowVersion();
729
658
  }
730
- rubyInit() {
731
- this.underlying.rubyInit();
732
- }
733
- rubySysinit(args) {
734
- this.underlying.rubySysinit(args);
735
- }
736
- rubyOptions(args) {
737
- this.underlying.rubyOptions(args);
738
- }
739
- rubyScript(name) {
740
- this.underlying.rubyScript(name);
659
+ rubyInit(args) {
660
+ this.underlying.rubyInit(args);
741
661
  }
742
662
  rubyInitLoadpath() {
743
663
  this.underlying.rubyInitLoadpath();
@@ -782,24 +702,111 @@
782
702
 
783
703
  /**
784
704
  * A Ruby VM instance
785
- *
786
- * @example
787
- *
788
- * const wasi = new WASI();
789
- * const vm = new RubyVM();
790
- * const imports = {
791
- * wasi_snapshot_preview1: wasi.wasiImport,
792
- * };
793
- *
794
- * vm.addToImports(imports);
795
- *
796
- * const instance = await WebAssembly.instantiate(rubyModule, imports);
797
- * await vm.setInstance(instance);
798
- * wasi.initialize(instance);
799
- * vm.initialize();
800
- *
705
+ * @see {@link RubyVM.instantiateComponent} and {@link RubyVM.instantiateModule} to create a new instance
706
+ * @category Essentials
801
707
  */
802
708
  class RubyVM {
709
+ /**
710
+ * Instantiate a Ruby VM with the given WebAssembly Core module with WASI Preview 1 implementation.
711
+ *
712
+ * @param options The options to instantiate the Ruby VM
713
+ * @returns A promise that resolves to the Ruby VM instance and the WebAssembly instance
714
+ * @category Essentials
715
+ *
716
+ * @example
717
+ *
718
+ * import { WASI } from "@bjorn3/browser_wasi_shim";
719
+ * const wasip1 = new WASI([], [], []);
720
+ * const module = await WebAssembly.compile("./path/to/ruby.wasm");
721
+ * const { vm } = await RubyVM.instantiateModule({ module, wasip1 });
722
+ *
723
+ */
724
+ static async instantiateModule(options) {
725
+ var _a, _b;
726
+ const { module, wasip1 } = options;
727
+ const vm = new RubyVM();
728
+ const imports = {
729
+ wasi_snapshot_preview1: wasip1.wasiImport,
730
+ };
731
+ vm.addToImports(imports);
732
+ (_a = options.addToImports) === null || _a === void 0 ? void 0 : _a.call(options, imports);
733
+ const instance = await WebAssembly.instantiate(module, imports);
734
+ await vm.setInstance(instance);
735
+ (_b = options.setMemory) === null || _b === void 0 ? void 0 : _b.call(options, instance.exports.memory);
736
+ wasip1.initialize(instance);
737
+ vm.initialize(options.args);
738
+ return { vm, instance };
739
+ }
740
+ /**
741
+ * Instantiate a Ruby VM with the given WebAssembly component with WASI Preview 2 implementation.
742
+ *
743
+ * @param options The options to instantiate the Ruby VM
744
+ * @returns A promise that resolves to the Ruby VM instance
745
+ * @category Essentials
746
+ *
747
+ * @example
748
+ *
749
+ * // First, you need to transpile the Ruby component to a JavaScript module using jco.
750
+ * // $ jco transpile --no-wasi-shim --instantiation --valid-lifting-optimization ./ruby.component.wasm -o ./component
751
+ * // Then, you can instantiate the Ruby VM with the component:
752
+ *
753
+ * import * as wasip2 from "@bytecodealliance/preview2-shim"
754
+ * import fs from "fs/promises";
755
+ * import path from "path";
756
+ *
757
+ * const { instantiate } = await import("./component/ruby.component.js");
758
+ * const getCoreModule = async (relativePath) => {
759
+ * const buffer = await fs.readFile(path.join("./component", relativePath));
760
+ * return WebAssembly.compile(buffer);
761
+ * }
762
+ *
763
+ * const { vm } = await RubyVM.instantiateComponent({
764
+ * instantiate, getCoreModule, wasip2,
765
+ * });
766
+ *
767
+ */
768
+ static async instantiateComponent(options) {
769
+ let initComponent;
770
+ if ("getCoreModule" in options) {
771
+ // A convenience overload to instantiate with "instantiate" function generated by jco
772
+ initComponent = async (jsRuntime) => {
773
+ const { instantiate, getCoreModule, wasip2 } = options;
774
+ const { cli, clocks, filesystem, io, random, sockets, http } = wasip2;
775
+ const importObject = {
776
+ "ruby:js/js-runtime": jsRuntime,
777
+ "wasi:cli/environment": cli.environment,
778
+ "wasi:cli/exit": cli.exit,
779
+ "wasi:cli/stderr": cli.stderr,
780
+ "wasi:cli/stdin": cli.stdin,
781
+ "wasi:cli/stdout": cli.stdout,
782
+ "wasi:cli/terminal-input": cli.terminalInput,
783
+ "wasi:cli/terminal-output": cli.terminalOutput,
784
+ "wasi:cli/terminal-stderr": cli.terminalStderr,
785
+ "wasi:cli/terminal-stdin": cli.terminalStdin,
786
+ "wasi:cli/terminal-stdout": cli.terminalStdout,
787
+ "wasi:clocks/monotonic-clock": clocks.monotonicClock,
788
+ "wasi:clocks/wall-clock": clocks.wallClock,
789
+ "wasi:filesystem/preopens": filesystem.preopens,
790
+ "wasi:filesystem/types": filesystem.types,
791
+ "wasi:io/error": io.error,
792
+ "wasi:io/poll": io.poll,
793
+ "wasi:io/streams": io.streams,
794
+ "wasi:random/random": random.random,
795
+ "wasi:sockets/tcp": sockets.tcp,
796
+ "wasi:http/types": http.types,
797
+ "wasi:http/incoming-handler": http.incomingHandler,
798
+ "wasi:http/outgoing-handler": http.outgoingHandler,
799
+ };
800
+ const component = await instantiate(getCoreModule, importObject, options.instantiateCore);
801
+ return component.rubyRuntime;
802
+ };
803
+ }
804
+ else {
805
+ initComponent = options.instantiate;
806
+ }
807
+ const vm = await this._instantiate({}, initComponent);
808
+ return { vm };
809
+ }
803
810
  constructor(binding) {
804
811
  this.instance = null;
805
812
  this.interfaceState = {
@@ -848,7 +855,7 @@
848
855
  this.transport = new JsValueTransport();
849
856
  this.exceptionFormatter = new RbExceptionFormatter();
850
857
  }
851
- static async _instantiate(initComponent, options) {
858
+ static async _instantiate(options, initComponent) {
852
859
  const binding = new ComponentBinding();
853
860
  const vm = new RubyVM(binding);
854
861
  class JsAbiValue {
@@ -876,14 +883,21 @@
876
883
  * Initialize the Ruby VM with the given command line arguments
877
884
  * @param args The command line arguments to pass to Ruby. Must be
878
885
  * an array of strings starting with the Ruby program name.
886
+ * @category Low-level initialization
879
887
  */
880
888
  initialize(args = ["ruby.wasm", "-EUTF-8", "-e_=0"]) {
881
889
  const c_args = args.map((arg) => arg + "\0");
882
- this.guest.rubyInit();
883
- this.guest.rubySysinit(c_args);
884
- this.guest.rubyOptions(c_args);
890
+ this.guest.rubyInit(c_args);
885
891
  try {
886
- this.eval(`require "/bundle/setup"`);
892
+ this.eval(`
893
+ # Require Bundler standalone setup
894
+ if File.exist?("/bundle/bundler/setup.rb")
895
+ require "/bundle/bundler/setup.rb"
896
+ elsif File.exist?("/bundle/setup.rb")
897
+ # For non-CM builds, which doesn't use Bundler's standalone mode
898
+ require "/bundle/setup.rb"
899
+ end
900
+ `);
887
901
  }
888
902
  catch (e) {
889
903
  console.warn("Failed to load /bundle/setup", e);
@@ -897,6 +911,7 @@
897
911
  * @param instance The WebAssembly instance to interact with. Must
898
912
  * be instantiated from a Ruby built with JS extension, and built
899
913
  * with Reactor ABI instead of command line.
914
+ * @category Low-level initialization
900
915
  */
901
916
  async setInstance(instance) {
902
917
  this.instance = instance;
@@ -906,6 +921,7 @@
906
921
  * Add intrinsic import entries, which is necessary to interact JavaScript
907
922
  * and Ruby's WebAssembly instance.
908
923
  * @param imports The import object to add to the WebAssembly instance
924
+ * @category Low-level initialization
909
925
  */
910
926
  addToImports(imports) {
911
927
  this.guest.addToImports(imports);
@@ -1111,6 +1127,7 @@
1111
1127
  * Runs a string of Ruby code from JavaScript
1112
1128
  * @param code The Ruby code to run
1113
1129
  * @returns the result of the last expression
1130
+ * @category Essentials
1114
1131
  *
1115
1132
  * @example
1116
1133
  * vm.eval("puts 'hello world'");
@@ -1126,6 +1143,7 @@
1126
1143
  * Returns a promise that resolves when execution completes.
1127
1144
  * @param code The Ruby code to run
1128
1145
  * @returns a promise that resolves to the result of the last expression
1146
+ * @category Essentials
1129
1147
  *
1130
1148
  * @example
1131
1149
  * const text = await vm.evalAsync(`
@@ -1208,6 +1226,7 @@
1208
1226
  }
1209
1227
  /**
1210
1228
  * A RbValue is an object that represents a value in Ruby
1229
+ * @category Essentials
1211
1230
  */
1212
1231
  class RbValue {
1213
1232
  /**
@@ -1509,18 +1528,16 @@
1509
1528
  new PreopenDirectory("/", new Map()),
1510
1529
  ];
1511
1530
  const wasi = new WASI(args, env, fds, { debug: false });
1512
- const vm = new RubyVM();
1513
- const imports = {
1514
- wasi_snapshot_preview1: wasi.wasiImport,
1515
- };
1516
- vm.addToImports(imports);
1517
1531
  const printer = ((_b = options.consolePrint) !== null && _b !== void 0 ? _b : true) ? consolePrinter() : undefined;
1518
- printer === null || printer === void 0 ? void 0 : printer.addToImports(imports);
1519
- const instance = await WebAssembly.instantiate(rubyModule, imports);
1520
- await vm.setInstance(instance);
1521
- printer === null || printer === void 0 ? void 0 : printer.setMemory(instance.exports.memory);
1522
- wasi.initialize(instance);
1523
- vm.initialize();
1532
+ const { vm, instance } = await RubyVM.instantiateModule({
1533
+ module: rubyModule, wasip1: wasi,
1534
+ addToImports: (imports) => {
1535
+ printer === null || printer === void 0 ? void 0 : printer.addToImports(imports);
1536
+ },
1537
+ setMemory: (memory) => {
1538
+ printer === null || printer === void 0 ? void 0 : printer.setMemory(memory);
1539
+ }
1540
+ });
1524
1541
  return {
1525
1542
  vm,
1526
1543
  wasi,
@@ -16,7 +16,7 @@ export namespace RubyJsJsRuntime {
16
16
  export function jsValueTypeof(value: JsAbiValue): string;
17
17
  export function jsValueEqual(lhs: JsAbiValue, rhs: JsAbiValue): boolean;
18
18
  export function jsValueStrictlyEqual(lhs: JsAbiValue, rhs: JsAbiValue): boolean;
19
- export function reflectApply(target: JsAbiValue, thisArgument: JsAbiValue, arguments: JsAbiValue[]): JsAbiResult;
19
+ export function reflectApply(target: JsAbiValue, thisArgument: JsAbiValue, arguments: Array<JsAbiValue>): JsAbiResult;
20
20
  export function reflectGet(target: JsAbiValue, propertyKey: string): JsAbiResult;
21
21
  export function reflectSet(target: JsAbiValue, propertyKey: string, value: JsAbiValue): JsAbiResult;
22
22
  export function throwProhibitRewindException(message: string): void;
@@ -1,12 +1,9 @@
1
1
  export namespace RubyJsRubyRuntime {
2
2
  export function rubyShowVersion(): void;
3
- export function rubyInit(): void;
4
- export function rubySysinit(args: string[]): void;
5
- export function rubyOptions(args: string[]): RbIseq;
6
- export function rubyScript(name: string): void;
3
+ export function rubyInit(args: Array<string>): void;
7
4
  export function rubyInitLoadpath(): void;
8
5
  export function rbEvalStringProtect(str: string): [RbAbiValue, number];
9
- export function rbFuncallvProtect(recv: RbAbiValue, mid: RbId, args: RbAbiValue[]): [RbAbiValue, number];
6
+ export function rbFuncallvProtect(recv: RbAbiValue, mid: RbId, args: Array<RbAbiValue>): [RbAbiValue, number];
10
7
  export function rbIntern(name: string): RbId;
11
8
  export function rbErrinfo(): RbAbiValue;
12
9
  export function rbClearErrinfo(): void;
@@ -27,7 +24,6 @@ export namespace RubyJsRubyRuntime {
27
24
  * 4. `export-rb-value-to-js()` returns the staged value
28
25
  */
29
26
  export function exportRbValueToJs(): RbAbiValue;
30
- export { RbIseq };
31
27
  export { RbAbiValue };
32
28
  }
33
29
  import type { JsAbiValue } from './ruby-js-js-runtime.js';
@@ -37,6 +33,3 @@ export type RbId = number;
37
33
 
38
34
  export class RbAbiValue {
39
35
  }
40
-
41
- export class RbIseq {
42
- }
@@ -1,17 +1,19 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.throw_invalid_bool = exports.Slab = exports.UTF8_ENCODED_LEN = exports.utf8_encode = exports.UTF8_DECODER = exports.to_uint32 = exports.data_view = void 0;
3
+ exports.Slab = exports.UTF8_ENCODED_LEN = exports.UTF8_DECODER = void 0;
4
+ exports.data_view = data_view;
5
+ exports.to_uint32 = to_uint32;
6
+ exports.utf8_encode = utf8_encode;
7
+ exports.throw_invalid_bool = throw_invalid_bool;
4
8
  let DATA_VIEW = new DataView(new ArrayBuffer());
5
9
  function data_view(mem) {
6
10
  if (DATA_VIEW.buffer !== mem.buffer)
7
11
  DATA_VIEW = new DataView(mem.buffer);
8
12
  return DATA_VIEW;
9
13
  }
10
- exports.data_view = data_view;
11
14
  function to_uint32(val) {
12
15
  return val >>> 0;
13
16
  }
14
- exports.to_uint32 = to_uint32;
15
17
  exports.UTF8_DECODER = new TextDecoder('utf-8');
16
18
  const UTF8_ENCODER = new TextEncoder('utf-8');
17
19
  function utf8_encode(s, realloc, memory) {
@@ -36,7 +38,6 @@ function utf8_encode(s, realloc, memory) {
36
38
  exports.UTF8_ENCODED_LEN = writtenTotal;
37
39
  return ptr;
38
40
  }
39
- exports.utf8_encode = utf8_encode;
40
41
  exports.UTF8_ENCODED_LEN = 0;
41
42
  class Slab {
42
43
  constructor() {
@@ -78,4 +79,3 @@ exports.Slab = Slab;
78
79
  function throw_invalid_bool() {
79
80
  throw new RangeError("invalid variant discriminant for bool");
80
81
  }
81
- exports.throw_invalid_bool = throw_invalid_bool;
@@ -68,10 +68,7 @@ export class RbAbiGuest {
68
68
  imports?: any,
69
69
  ): Promise<void>;
70
70
  rubyShowVersion(): void;
71
- rubyInit(): void;
72
- rubySysinit(args: string[]): void;
73
- rubyOptions(args: string[]): RbIseq;
74
- rubyScript(name: string): void;
71
+ rubyInit(args: string[]): void;
75
72
  rubyInitLoadpath(): void;
76
73
  rbEvalStringProtect(str: string): [RbAbiValue, number];
77
74
  rbFuncallvProtect(recv: RbAbiValue, mid: RbId, args: RbAbiValue[]): [RbAbiValue, number];
@@ -85,33 +82,6 @@ export class RbAbiGuest {
85
82
  rbSetShouldProhibitRewind(newValue: boolean): boolean;
86
83
  }
87
84
 
88
- export class RbIseq {
89
- // Creates a new strong reference count as a new
90
- // object. This is only required if you're also
91
- // calling `drop` below and want to manually manage
92
- // the reference count from JS.
93
- //
94
- // If you don't call `drop`, you don't need to call
95
- // this and can simply use the object from JS.
96
- clone(): RbIseq;
97
-
98
- // Explicitly indicate that this JS object will no
99
- // longer be used. If the internal reference count
100
- // reaches zero then this will deterministically
101
- // destroy the underlying wasm object.
102
- //
103
- // This is not required to be called from JS. Wasm
104
- // destructors will be automatically called for you
105
- // if this is not called using the JS
106
- // `FinalizationRegistry`.
107
- //
108
- // Calling this method does not guarantee that the
109
- // underlying wasm object is deallocated. Something
110
- // else (including wasm) may be holding onto a
111
- // strong reference count.
112
- drop(): void;
113
- }
114
-
115
85
  export class RbAbiValue {
116
86
  // Creates a new strong reference count as a new
117
87
  // object. This is only required if you're also