@ruby/3.2-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.
@@ -21,7 +21,7 @@ Please replace your \`require('ruby-3.2-wasm-wasi/dist/browser.script.umd');\` w
21
21
  OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
22
22
  PERFORMANCE OF THIS SOFTWARE.
23
23
  ***************************************************************************** */
24
- /* global Reflect, Promise, SuppressedError, Symbol */
24
+ /* global Reflect, Promise, SuppressedError, Symbol, Iterator */
25
25
 
26
26
 
27
27
  function __values(o) {
@@ -251,39 +251,23 @@ Please replace your \`require('ruby-3.2-wasm-wasi/dist/browser.script.umd');\` w
251
251
  class RbAbiGuest {
252
252
  constructor() {
253
253
  this._resource0_slab = new Slab();
254
- this._resource1_slab = new Slab();
255
254
  }
256
255
  addToImports(imports) {
257
256
  if (!("canonical_abi" in imports)) imports["canonical_abi"] = {};
258
257
 
259
- imports.canonical_abi['resource_drop_rb-iseq'] = i => {
258
+ imports.canonical_abi['resource_drop_rb-abi-value'] = i => {
260
259
  this._resource0_slab.remove(i).drop();
261
260
  };
262
- imports.canonical_abi['resource_clone_rb-iseq'] = i => {
261
+ imports.canonical_abi['resource_clone_rb-abi-value'] = i => {
263
262
  const obj = this._resource0_slab.get(i);
264
263
  return this._resource0_slab.insert(obj.clone())
265
264
  };
266
- imports.canonical_abi['resource_get_rb-iseq'] = i => {
267
- return this._resource0_slab.get(i)._wasm_val;
268
- };
269
- imports.canonical_abi['resource_new_rb-iseq'] = i => {
270
- this._registry0;
271
- return this._resource0_slab.insert(new RbIseq(i, this));
272
- };
273
-
274
- imports.canonical_abi['resource_drop_rb-abi-value'] = i => {
275
- this._resource1_slab.remove(i).drop();
276
- };
277
- imports.canonical_abi['resource_clone_rb-abi-value'] = i => {
278
- const obj = this._resource1_slab.get(i);
279
- return this._resource1_slab.insert(obj.clone())
280
- };
281
265
  imports.canonical_abi['resource_get_rb-abi-value'] = i => {
282
- return this._resource1_slab.get(i)._wasm_val;
266
+ return this._resource0_slab.get(i)._wasm_val;
283
267
  };
284
268
  imports.canonical_abi['resource_new_rb-abi-value'] = i => {
285
- this._registry1;
286
- return this._resource1_slab.insert(new RbAbiValue(i, this));
269
+ this._registry0;
270
+ return this._resource0_slab.insert(new RbAbiValue(i, this));
287
271
  };
288
272
  }
289
273
 
@@ -303,32 +287,12 @@ Please replace your \`require('ruby-3.2-wasm-wasi/dist/browser.script.umd');\` w
303
287
  this.instance = instance;
304
288
  }
305
289
  this._exports = this.instance.exports;
306
- this._registry0 = new FinalizationRegistry(this._exports['canonical_abi_drop_rb-iseq']);
307
- this._registry1 = new FinalizationRegistry(this._exports['canonical_abi_drop_rb-abi-value']);
290
+ this._registry0 = new FinalizationRegistry(this._exports['canonical_abi_drop_rb-abi-value']);
308
291
  }
309
292
  rubyShowVersion() {
310
293
  this._exports['ruby-show-version: func() -> ()']();
311
294
  }
312
- rubyInit() {
313
- this._exports['ruby-init: func() -> ()']();
314
- }
315
- rubySysinit(arg0) {
316
- const memory = this._exports.memory;
317
- const realloc = this._exports["cabi_realloc"];
318
- const vec1 = arg0;
319
- const len1 = vec1.length;
320
- const result1 = realloc(0, 0, 4, len1 * 8);
321
- for (let i = 0; i < vec1.length; i++) {
322
- const e = vec1[i];
323
- const base = result1 + i * 8;
324
- const ptr0 = utf8_encode(e, realloc, memory);
325
- const len0 = UTF8_ENCODED_LEN;
326
- data_view(memory).setInt32(base + 4, len0, true);
327
- data_view(memory).setInt32(base + 0, ptr0, true);
328
- }
329
- this._exports['ruby-sysinit: func(args: list<string>) -> ()'](result1, len1);
330
- }
331
- rubyOptions(arg0) {
295
+ rubyInit(arg0) {
332
296
  const memory = this._exports.memory;
333
297
  const realloc = this._exports["cabi_realloc"];
334
298
  const vec1 = arg0;
@@ -342,15 +306,7 @@ Please replace your \`require('ruby-3.2-wasm-wasi/dist/browser.script.umd');\` w
342
306
  data_view(memory).setInt32(base + 4, len0, true);
343
307
  data_view(memory).setInt32(base + 0, ptr0, true);
344
308
  }
345
- const ret = this._exports['ruby-options: func(args: list<string>) -> handle<rb-iseq>'](result1, len1);
346
- return this._resource0_slab.remove(ret);
347
- }
348
- rubyScript(arg0) {
349
- const memory = this._exports.memory;
350
- const realloc = this._exports["cabi_realloc"];
351
- const ptr0 = utf8_encode(arg0, realloc, memory);
352
- const len0 = UTF8_ENCODED_LEN;
353
- this._exports['ruby-script: func(name: string) -> ()'](ptr0, len0);
309
+ this._exports['ruby-init: func(args: list<string>) -> ()'](result1, len1);
354
310
  }
355
311
  rubyInitLoadpath() {
356
312
  this._exports['ruby-init-loadpath: func() -> ()']();
@@ -361,7 +317,7 @@ Please replace your \`require('ruby-3.2-wasm-wasi/dist/browser.script.umd');\` w
361
317
  const ptr0 = utf8_encode(arg0, realloc, memory);
362
318
  const len0 = UTF8_ENCODED_LEN;
363
319
  const ret = this._exports['rb-eval-string-protect: func(str: string) -> tuple<handle<rb-abi-value>, s32>'](ptr0, len0);
364
- return [this._resource1_slab.remove(data_view(memory).getInt32(ret + 0, true)), data_view(memory).getInt32(ret + 4, true)];
320
+ return [this._resource0_slab.remove(data_view(memory).getInt32(ret + 0, true)), data_view(memory).getInt32(ret + 4, true)];
365
321
  }
366
322
  rbFuncallvProtect(arg0, arg1, arg2) {
367
323
  const memory = this._exports.memory;
@@ -376,10 +332,10 @@ Please replace your \`require('ruby-3.2-wasm-wasi/dist/browser.script.umd');\` w
376
332
  const base = result2 + i * 4;
377
333
  const obj1 = e;
378
334
  if (!(obj1 instanceof RbAbiValue)) throw new TypeError('expected instance of RbAbiValue');
379
- data_view(memory).setInt32(base + 0, this._resource1_slab.insert(obj1.clone()), true);
335
+ data_view(memory).setInt32(base + 0, this._resource0_slab.insert(obj1.clone()), true);
380
336
  }
381
- 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);
382
- return [this._resource1_slab.remove(data_view(memory).getInt32(ret + 0, true)), data_view(memory).getInt32(ret + 4, true)];
337
+ 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);
338
+ return [this._resource0_slab.remove(data_view(memory).getInt32(ret + 0, true)), data_view(memory).getInt32(ret + 4, true)];
383
339
  }
384
340
  rbIntern(arg0) {
385
341
  const memory = this._exports.memory;
@@ -391,7 +347,7 @@ Please replace your \`require('ruby-3.2-wasm-wasi/dist/browser.script.umd');\` w
391
347
  }
392
348
  rbErrinfo() {
393
349
  const ret = this._exports['rb-errinfo: func() -> handle<rb-abi-value>']();
394
- return this._resource1_slab.remove(ret);
350
+ return this._resource0_slab.remove(ret);
395
351
  }
396
352
  rbClearErrinfo() {
397
353
  this._exports['rb-clear-errinfo: func() -> ()']();
@@ -400,7 +356,7 @@ Please replace your \`require('ruby-3.2-wasm-wasi/dist/browser.script.umd');\` w
400
356
  const memory = this._exports.memory;
401
357
  const obj0 = arg0;
402
358
  if (!(obj0 instanceof RbAbiValue)) throw new TypeError('expected instance of RbAbiValue');
403
- const ret = this._exports['rstring-ptr: func(value: handle<rb-abi-value>) -> string'](this._resource1_slab.insert(obj0.clone()));
359
+ const ret = this._exports['rstring-ptr: func(value: handle<rb-abi-value>) -> string'](this._resource0_slab.insert(obj0.clone()));
404
360
  const ptr1 = data_view(memory).getInt32(ret + 0, true);
405
361
  const len1 = data_view(memory).getInt32(ret + 4, true);
406
362
  const result1 = UTF8_DECODER.decode(new Uint8Array(memory.buffer, ptr1, len1));
@@ -427,7 +383,7 @@ Please replace your \`require('ruby-3.2-wasm-wasi/dist/browser.script.umd');\` w
427
383
  }
428
384
  }
429
385
 
430
- class RbIseq {
386
+ class RbAbiValue {
431
387
  constructor(wasm_val, obj) {
432
388
  this._wasm_val = wasm_val;
433
389
  this._obj = obj;
@@ -445,33 +401,6 @@ Please replace your \`require('ruby-3.2-wasm-wasi/dist/browser.script.umd');\` w
445
401
  if (this._refcnt !== 0)
446
402
  return;
447
403
  this._obj._registry0.unregister(this);
448
- const dtor = this._obj._exports['canonical_abi_drop_rb-iseq'];
449
- const wasm_val = this._wasm_val;
450
- delete this._obj;
451
- delete this._refcnt;
452
- delete this._wasm_val;
453
- dtor(wasm_val);
454
- }
455
- }
456
-
457
- class RbAbiValue {
458
- constructor(wasm_val, obj) {
459
- this._wasm_val = wasm_val;
460
- this._obj = obj;
461
- this._refcnt = 1;
462
- obj._registry1.register(this, wasm_val, this);
463
- }
464
-
465
- clone() {
466
- this._refcnt += 1;
467
- return this;
468
- }
469
-
470
- drop() {
471
- this._refcnt -= 1;
472
- if (this._refcnt !== 0)
473
- return;
474
- this._obj._registry1.unregister(this);
475
404
  const dtor = this._obj._exports['canonical_abi_drop_rb-abi-value'];
476
405
  const wasm_val = this._wasm_val;
477
406
  delete this._obj;
@@ -772,17 +701,8 @@ Please replace your \`require('ruby-3.2-wasm-wasi/dist/browser.script.umd');\` w
772
701
  rubyShowVersion() {
773
702
  this.underlying.rubyShowVersion();
774
703
  }
775
- rubyInit() {
776
- this.underlying.rubyInit();
777
- }
778
- rubySysinit(args) {
779
- this.underlying.rubySysinit(args);
780
- }
781
- rubyOptions(args) {
782
- this.underlying.rubyOptions(args);
783
- }
784
- rubyScript(name) {
785
- this.underlying.rubyScript(name);
704
+ rubyInit(args) {
705
+ this.underlying.rubyInit(args);
786
706
  }
787
707
  rubyInitLoadpath() {
788
708
  this.underlying.rubyInitLoadpath();
@@ -827,24 +747,111 @@ Please replace your \`require('ruby-3.2-wasm-wasi/dist/browser.script.umd');\` w
827
747
 
828
748
  /**
829
749
  * A Ruby VM instance
830
- *
831
- * @example
832
- *
833
- * const wasi = new WASI();
834
- * const vm = new RubyVM();
835
- * const imports = {
836
- * wasi_snapshot_preview1: wasi.wasiImport,
837
- * };
838
- *
839
- * vm.addToImports(imports);
840
- *
841
- * const instance = await WebAssembly.instantiate(rubyModule, imports);
842
- * await vm.setInstance(instance);
843
- * wasi.initialize(instance);
844
- * vm.initialize();
845
- *
750
+ * @see {@link RubyVM.instantiateComponent} and {@link RubyVM.instantiateModule} to create a new instance
751
+ * @category Essentials
846
752
  */
847
753
  class RubyVM {
754
+ /**
755
+ * Instantiate a Ruby VM with the given WebAssembly Core module with WASI Preview 1 implementation.
756
+ *
757
+ * @param options The options to instantiate the Ruby VM
758
+ * @returns A promise that resolves to the Ruby VM instance and the WebAssembly instance
759
+ * @category Essentials
760
+ *
761
+ * @example
762
+ *
763
+ * import { WASI } from "@bjorn3/browser_wasi_shim";
764
+ * const wasip1 = new WASI([], [], []);
765
+ * const module = await WebAssembly.compile("./path/to/ruby.wasm");
766
+ * const { vm } = await RubyVM.instantiateModule({ module, wasip1 });
767
+ *
768
+ */
769
+ static async instantiateModule(options) {
770
+ var _a, _b;
771
+ const { module, wasip1 } = options;
772
+ const vm = new RubyVM();
773
+ const imports = {
774
+ wasi_snapshot_preview1: wasip1.wasiImport,
775
+ };
776
+ vm.addToImports(imports);
777
+ (_a = options.addToImports) === null || _a === void 0 ? void 0 : _a.call(options, imports);
778
+ const instance = await WebAssembly.instantiate(module, imports);
779
+ await vm.setInstance(instance);
780
+ (_b = options.setMemory) === null || _b === void 0 ? void 0 : _b.call(options, instance.exports.memory);
781
+ wasip1.initialize(instance);
782
+ vm.initialize(options.args);
783
+ return { vm, instance };
784
+ }
785
+ /**
786
+ * Instantiate a Ruby VM with the given WebAssembly component with WASI Preview 2 implementation.
787
+ *
788
+ * @param options The options to instantiate the Ruby VM
789
+ * @returns A promise that resolves to the Ruby VM instance
790
+ * @category Essentials
791
+ *
792
+ * @example
793
+ *
794
+ * // First, you need to transpile the Ruby component to a JavaScript module using jco.
795
+ * // $ jco transpile --no-wasi-shim --instantiation --valid-lifting-optimization ./ruby.component.wasm -o ./component
796
+ * // Then, you can instantiate the Ruby VM with the component:
797
+ *
798
+ * import * as wasip2 from "@bytecodealliance/preview2-shim"
799
+ * import fs from "fs/promises";
800
+ * import path from "path";
801
+ *
802
+ * const { instantiate } = await import("./component/ruby.component.js");
803
+ * const getCoreModule = async (relativePath) => {
804
+ * const buffer = await fs.readFile(path.join("./component", relativePath));
805
+ * return WebAssembly.compile(buffer);
806
+ * }
807
+ *
808
+ * const { vm } = await RubyVM.instantiateComponent({
809
+ * instantiate, getCoreModule, wasip2,
810
+ * });
811
+ *
812
+ */
813
+ static async instantiateComponent(options) {
814
+ let initComponent;
815
+ if ("getCoreModule" in options) {
816
+ // A convenience overload to instantiate with "instantiate" function generated by jco
817
+ initComponent = async (jsRuntime) => {
818
+ const { instantiate, getCoreModule, wasip2 } = options;
819
+ const { cli, clocks, filesystem, io, random, sockets, http } = wasip2;
820
+ const importObject = {
821
+ "ruby:js/js-runtime": jsRuntime,
822
+ "wasi:cli/environment": cli.environment,
823
+ "wasi:cli/exit": cli.exit,
824
+ "wasi:cli/stderr": cli.stderr,
825
+ "wasi:cli/stdin": cli.stdin,
826
+ "wasi:cli/stdout": cli.stdout,
827
+ "wasi:cli/terminal-input": cli.terminalInput,
828
+ "wasi:cli/terminal-output": cli.terminalOutput,
829
+ "wasi:cli/terminal-stderr": cli.terminalStderr,
830
+ "wasi:cli/terminal-stdin": cli.terminalStdin,
831
+ "wasi:cli/terminal-stdout": cli.terminalStdout,
832
+ "wasi:clocks/monotonic-clock": clocks.monotonicClock,
833
+ "wasi:clocks/wall-clock": clocks.wallClock,
834
+ "wasi:filesystem/preopens": filesystem.preopens,
835
+ "wasi:filesystem/types": filesystem.types,
836
+ "wasi:io/error": io.error,
837
+ "wasi:io/poll": io.poll,
838
+ "wasi:io/streams": io.streams,
839
+ "wasi:random/random": random.random,
840
+ "wasi:sockets/tcp": sockets.tcp,
841
+ "wasi:http/types": http.types,
842
+ "wasi:http/incoming-handler": http.incomingHandler,
843
+ "wasi:http/outgoing-handler": http.outgoingHandler,
844
+ };
845
+ const component = await instantiate(getCoreModule, importObject, options.instantiateCore);
846
+ return component.rubyRuntime;
847
+ };
848
+ }
849
+ else {
850
+ initComponent = options.instantiate;
851
+ }
852
+ const vm = await this._instantiate({}, initComponent);
853
+ return { vm };
854
+ }
848
855
  constructor(binding) {
849
856
  this.instance = null;
850
857
  this.interfaceState = {
@@ -893,7 +900,7 @@ Please replace your \`require('ruby-3.2-wasm-wasi/dist/browser.script.umd');\` w
893
900
  this.transport = new JsValueTransport();
894
901
  this.exceptionFormatter = new RbExceptionFormatter();
895
902
  }
896
- static async _instantiate(initComponent, options) {
903
+ static async _instantiate(options, initComponent) {
897
904
  const binding = new ComponentBinding();
898
905
  const vm = new RubyVM(binding);
899
906
  class JsAbiValue {
@@ -921,14 +928,21 @@ Please replace your \`require('ruby-3.2-wasm-wasi/dist/browser.script.umd');\` w
921
928
  * Initialize the Ruby VM with the given command line arguments
922
929
  * @param args The command line arguments to pass to Ruby. Must be
923
930
  * an array of strings starting with the Ruby program name.
931
+ * @category Low-level initialization
924
932
  */
925
933
  initialize(args = ["ruby.wasm", "-EUTF-8", "-e_=0"]) {
926
934
  const c_args = args.map((arg) => arg + "\0");
927
- this.guest.rubyInit();
928
- this.guest.rubySysinit(c_args);
929
- this.guest.rubyOptions(c_args);
935
+ this.guest.rubyInit(c_args);
930
936
  try {
931
- this.eval(`require "/bundle/setup"`);
937
+ this.eval(`
938
+ # Require Bundler standalone setup
939
+ if File.exist?("/bundle/bundler/setup.rb")
940
+ require "/bundle/bundler/setup.rb"
941
+ elsif File.exist?("/bundle/setup.rb")
942
+ # For non-CM builds, which doesn't use Bundler's standalone mode
943
+ require "/bundle/setup.rb"
944
+ end
945
+ `);
932
946
  }
933
947
  catch (e) {
934
948
  console.warn("Failed to load /bundle/setup", e);
@@ -942,6 +956,7 @@ Please replace your \`require('ruby-3.2-wasm-wasi/dist/browser.script.umd');\` w
942
956
  * @param instance The WebAssembly instance to interact with. Must
943
957
  * be instantiated from a Ruby built with JS extension, and built
944
958
  * with Reactor ABI instead of command line.
959
+ * @category Low-level initialization
945
960
  */
946
961
  async setInstance(instance) {
947
962
  this.instance = instance;
@@ -951,6 +966,7 @@ Please replace your \`require('ruby-3.2-wasm-wasi/dist/browser.script.umd');\` w
951
966
  * Add intrinsic import entries, which is necessary to interact JavaScript
952
967
  * and Ruby's WebAssembly instance.
953
968
  * @param imports The import object to add to the WebAssembly instance
969
+ * @category Low-level initialization
954
970
  */
955
971
  addToImports(imports) {
956
972
  this.guest.addToImports(imports);
@@ -1156,6 +1172,7 @@ Please replace your \`require('ruby-3.2-wasm-wasi/dist/browser.script.umd');\` w
1156
1172
  * Runs a string of Ruby code from JavaScript
1157
1173
  * @param code The Ruby code to run
1158
1174
  * @returns the result of the last expression
1175
+ * @category Essentials
1159
1176
  *
1160
1177
  * @example
1161
1178
  * vm.eval("puts 'hello world'");
@@ -1171,6 +1188,7 @@ Please replace your \`require('ruby-3.2-wasm-wasi/dist/browser.script.umd');\` w
1171
1188
  * Returns a promise that resolves when execution completes.
1172
1189
  * @param code The Ruby code to run
1173
1190
  * @returns a promise that resolves to the result of the last expression
1191
+ * @category Essentials
1174
1192
  *
1175
1193
  * @example
1176
1194
  * const text = await vm.evalAsync(`
@@ -1253,6 +1271,7 @@ Please replace your \`require('ruby-3.2-wasm-wasi/dist/browser.script.umd');\` w
1253
1271
  }
1254
1272
  /**
1255
1273
  * A RbValue is an object that represents a value in Ruby
1274
+ * @category Essentials
1256
1275
  */
1257
1276
  class RbValue {
1258
1277
  /**
@@ -1554,18 +1573,16 @@ Please replace your \`require('ruby-3.2-wasm-wasi/dist/browser.script.umd');\` w
1554
1573
  new PreopenDirectory("/", new Map()),
1555
1574
  ];
1556
1575
  const wasi = new WASI(args, env, fds, { debug: false });
1557
- const vm = new RubyVM();
1558
- const imports = {
1559
- wasi_snapshot_preview1: wasi.wasiImport,
1560
- };
1561
- vm.addToImports(imports);
1562
1576
  const printer = ((_b = options.consolePrint) !== null && _b !== void 0 ? _b : true) ? consolePrinter() : undefined;
1563
- printer === null || printer === void 0 ? void 0 : printer.addToImports(imports);
1564
- const instance = await WebAssembly.instantiate(rubyModule, imports);
1565
- await vm.setInstance(instance);
1566
- printer === null || printer === void 0 ? void 0 : printer.setMemory(instance.exports.memory);
1567
- wasi.initialize(instance);
1568
- vm.initialize();
1577
+ const { vm, instance } = await RubyVM.instantiateModule({
1578
+ module: rubyModule, wasip1: wasi,
1579
+ addToImports: (imports) => {
1580
+ printer === null || printer === void 0 ? void 0 : printer.addToImports(imports);
1581
+ },
1582
+ setMemory: (memory) => {
1583
+ printer === null || printer === void 0 ? void 0 : printer.setMemory(memory);
1584
+ }
1585
+ });
1569
1586
  return {
1570
1587
  vm,
1571
1588
  wasi,
@@ -1573,10 +1590,28 @@ Please replace your \`require('ruby-3.2-wasm-wasi/dist/browser.script.umd');\` w
1573
1590
  };
1574
1591
  };
1575
1592
 
1593
+ /**
1594
+ * The main entry point of `<script type="text/ruby">`-based scripting with WebAssembly Core Module.
1595
+ */
1576
1596
  const main = async (pkg, options) => {
1577
1597
  const response = fetch(`https://cdn.jsdelivr.net/npm/${pkg.name}@${pkg.version}/dist/ruby+stdlib.wasm`);
1578
1598
  const module = await compileWebAssemblyModule(response);
1579
1599
  const { vm } = await DefaultRubyVM(module, options);
1600
+ await mainWithRubyVM(vm);
1601
+ };
1602
+ /**
1603
+ * The main entry point of `<script type="text/ruby">`-based scripting with WebAssembly Component.
1604
+ */
1605
+ const componentMain = async (pkg, options) => {
1606
+ const componentUrl = `https://cdn.jsdelivr.net/npm/${pkg.name}@${pkg.version}/dist/component`;
1607
+ const fetchComponentFile = (relativePath) => fetch(`${componentUrl}/${relativePath}`);
1608
+ const { vm } = await RubyVM.instantiateComponent(Object.assign(Object.assign({}, options), { getCoreModule: (relativePath) => {
1609
+ const response = fetchComponentFile(relativePath);
1610
+ return compileWebAssemblyModule(response);
1611
+ } }));
1612
+ await mainWithRubyVM(vm);
1613
+ };
1614
+ const mainWithRubyVM = async (vm) => {
1580
1615
  vm.printVersion();
1581
1616
  globalThis.rubyVM = vm;
1582
1617
  // Wait for the text/ruby script tag to be read.
@@ -1658,6 +1693,7 @@ Please replace your \`require('ruby-3.2-wasm-wasi/dist/browser.script.umd');\` w
1658
1693
  }
1659
1694
  };
1660
1695
 
1696
+ exports.componentMain = componentMain;
1661
1697
  exports.main = main;
1662
1698
 
1663
1699
  }));