@ruby/wasm-wasi 2.1.0 → 2.2.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/dist/browser.cjs.js +4 -11
- package/dist/browser.d.ts +2 -1
- package/dist/browser.esm.js +4 -11
- package/dist/browser.script.cjs.js +28 -18
- package/dist/browser.script.d.ts +2 -1
- package/dist/browser.script.esm.js +28 -18
- package/dist/browser.script.umd.js +28 -18
- package/dist/browser.umd.js +4 -11
- package/dist/node.cjs.js +2 -10
- package/dist/node.d.ts +3 -1
- package/dist/node.esm.js +2 -10
- package/package.json +9 -9
package/dist/browser.cjs.js
CHANGED
|
@@ -3218,21 +3218,14 @@ const consolePrinter = () => {
|
|
|
3218
3218
|
},
|
|
3219
3219
|
};
|
|
3220
3220
|
};
|
|
3221
|
-
const DefaultRubyVM = async (rubyModule, options = {
|
|
3221
|
+
const DefaultRubyVM = async (rubyModule, options = {}) => {
|
|
3222
|
+
var _a;
|
|
3222
3223
|
await n();
|
|
3223
|
-
const wasi = new s({
|
|
3224
|
-
env: {
|
|
3225
|
-
// FIXME(katei): setjmp consumes a LOT of stack now, so we extend
|
|
3226
|
-
// default Fiber stack size as well as main stack size allocated
|
|
3227
|
-
// by wasm-ld's --stack-size. The ideal solution is to reduce
|
|
3228
|
-
// stack consumption in setjmp.
|
|
3229
|
-
"RUBY_FIBER_MACHINE_STACK_SIZE": "16777216"
|
|
3230
|
-
}
|
|
3231
|
-
});
|
|
3224
|
+
const wasi = new s({ env: options.env });
|
|
3232
3225
|
const vm = new RubyVM();
|
|
3233
3226
|
const imports = wasi.getImports(rubyModule);
|
|
3234
3227
|
vm.addToImports(imports);
|
|
3235
|
-
const printer = options.consolePrint ? consolePrinter() : undefined;
|
|
3228
|
+
const printer = ((_a = options.consolePrint) !== null && _a !== void 0 ? _a : true) ? consolePrinter() : undefined;
|
|
3236
3229
|
printer === null || printer === void 0 ? void 0 : printer.addToImports(imports);
|
|
3237
3230
|
const instance = await WebAssembly.instantiate(rubyModule, imports);
|
|
3238
3231
|
wasi.instantiate(instance);
|
package/dist/browser.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { WASI } from "@wasmer/wasi";
|
|
2
2
|
import { RubyVM } from "./index";
|
|
3
3
|
export declare const DefaultRubyVM: (rubyModule: WebAssembly.Module, options?: {
|
|
4
|
-
consolePrint
|
|
4
|
+
consolePrint?: boolean;
|
|
5
|
+
env?: Record<string, string> | undefined;
|
|
5
6
|
}) => Promise<{
|
|
6
7
|
vm: RubyVM;
|
|
7
8
|
wasi: WASI;
|
package/dist/browser.esm.js
CHANGED
|
@@ -3216,21 +3216,14 @@ const consolePrinter = () => {
|
|
|
3216
3216
|
},
|
|
3217
3217
|
};
|
|
3218
3218
|
};
|
|
3219
|
-
const DefaultRubyVM = async (rubyModule, options = {
|
|
3219
|
+
const DefaultRubyVM = async (rubyModule, options = {}) => {
|
|
3220
|
+
var _a;
|
|
3220
3221
|
await n();
|
|
3221
|
-
const wasi = new s({
|
|
3222
|
-
env: {
|
|
3223
|
-
// FIXME(katei): setjmp consumes a LOT of stack now, so we extend
|
|
3224
|
-
// default Fiber stack size as well as main stack size allocated
|
|
3225
|
-
// by wasm-ld's --stack-size. The ideal solution is to reduce
|
|
3226
|
-
// stack consumption in setjmp.
|
|
3227
|
-
"RUBY_FIBER_MACHINE_STACK_SIZE": "16777216"
|
|
3228
|
-
}
|
|
3229
|
-
});
|
|
3222
|
+
const wasi = new s({ env: options.env });
|
|
3230
3223
|
const vm = new RubyVM();
|
|
3231
3224
|
const imports = wasi.getImports(rubyModule);
|
|
3232
3225
|
vm.addToImports(imports);
|
|
3233
|
-
const printer = options.consolePrint ? consolePrinter() : undefined;
|
|
3226
|
+
const printer = ((_a = options.consolePrint) !== null && _a !== void 0 ? _a : true) ? consolePrinter() : undefined;
|
|
3234
3227
|
printer === null || printer === void 0 ? void 0 : printer.addToImports(imports);
|
|
3235
3228
|
const instance = await WebAssembly.instantiate(rubyModule, imports);
|
|
3236
3229
|
wasi.instantiate(instance);
|
|
@@ -14,7 +14,7 @@ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
|
14
14
|
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
15
15
|
PERFORMANCE OF THIS SOFTWARE.
|
|
16
16
|
***************************************************************************** */
|
|
17
|
-
/* global Reflect, Promise */
|
|
17
|
+
/* global Reflect, Promise, SuppressedError, Symbol */
|
|
18
18
|
|
|
19
19
|
|
|
20
20
|
function __values(o) {
|
|
@@ -35,7 +35,12 @@ function __asyncValues(o) {
|
|
|
35
35
|
return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
|
|
36
36
|
function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
|
|
37
37
|
function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
|
|
38
|
-
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
41
|
+
var e = new Error(message);
|
|
42
|
+
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
43
|
+
};
|
|
39
44
|
|
|
40
45
|
var global$1 = (typeof global !== "undefined" ? global :
|
|
41
46
|
typeof self !== "undefined" ? self :
|
|
@@ -3255,21 +3260,14 @@ const consolePrinter = () => {
|
|
|
3255
3260
|
},
|
|
3256
3261
|
};
|
|
3257
3262
|
};
|
|
3258
|
-
const DefaultRubyVM = async (rubyModule, options = {
|
|
3263
|
+
const DefaultRubyVM = async (rubyModule, options = {}) => {
|
|
3264
|
+
var _a;
|
|
3259
3265
|
await n();
|
|
3260
|
-
const wasi = new s({
|
|
3261
|
-
env: {
|
|
3262
|
-
// FIXME(katei): setjmp consumes a LOT of stack now, so we extend
|
|
3263
|
-
// default Fiber stack size as well as main stack size allocated
|
|
3264
|
-
// by wasm-ld's --stack-size. The ideal solution is to reduce
|
|
3265
|
-
// stack consumption in setjmp.
|
|
3266
|
-
"RUBY_FIBER_MACHINE_STACK_SIZE": "16777216"
|
|
3267
|
-
}
|
|
3268
|
-
});
|
|
3266
|
+
const wasi = new s({ env: options.env });
|
|
3269
3267
|
const vm = new RubyVM();
|
|
3270
3268
|
const imports = wasi.getImports(rubyModule);
|
|
3271
3269
|
vm.addToImports(imports);
|
|
3272
|
-
const printer = options.consolePrint ? consolePrinter() : undefined;
|
|
3270
|
+
const printer = ((_a = options.consolePrint) !== null && _a !== void 0 ? _a : true) ? consolePrinter() : undefined;
|
|
3273
3271
|
printer === null || printer === void 0 ? void 0 : printer.addToImports(imports);
|
|
3274
3272
|
const instance = await WebAssembly.instantiate(rubyModule, imports);
|
|
3275
3273
|
wasi.instantiate(instance);
|
|
@@ -3286,11 +3284,10 @@ const DefaultRubyVM = async (rubyModule, options = { consolePrint: true }) => {
|
|
|
3286
3284
|
};
|
|
3287
3285
|
};
|
|
3288
3286
|
|
|
3289
|
-
const main = async (pkg) => {
|
|
3290
|
-
const response =
|
|
3291
|
-
const
|
|
3292
|
-
const
|
|
3293
|
-
const { vm } = await DefaultRubyVM(module);
|
|
3287
|
+
const main = async (pkg, options) => {
|
|
3288
|
+
const response = fetch(`https://cdn.jsdelivr.net/npm/${pkg.name}@${pkg.version}/dist/ruby+stdlib.wasm`);
|
|
3289
|
+
const module = await compileWebAssemblyModule(response);
|
|
3290
|
+
const { vm } = await DefaultRubyVM(module, options);
|
|
3294
3291
|
vm.printVersion();
|
|
3295
3292
|
globalThis.rubyVM = vm;
|
|
3296
3293
|
// Wait for the text/ruby script tag to be read.
|
|
@@ -3358,5 +3355,18 @@ const loadScriptAsync = async (tag) => {
|
|
|
3358
3355
|
}
|
|
3359
3356
|
return Promise.resolve({ scriptContent: tag.innerHTML, evalStyle });
|
|
3360
3357
|
};
|
|
3358
|
+
// WebAssembly.compileStreaming is a relatively new API.
|
|
3359
|
+
// For example, it is not available in iOS Safari 14,
|
|
3360
|
+
// so check whether WebAssembly.compileStreaming is available and
|
|
3361
|
+
// fall back to the existing implementation using WebAssembly.compile if not.
|
|
3362
|
+
const compileWebAssemblyModule = async function (response) {
|
|
3363
|
+
if (!WebAssembly.compileStreaming) {
|
|
3364
|
+
const buffer = await (await response).arrayBuffer();
|
|
3365
|
+
return WebAssembly.compile(buffer);
|
|
3366
|
+
}
|
|
3367
|
+
else {
|
|
3368
|
+
return WebAssembly.compileStreaming(response);
|
|
3369
|
+
}
|
|
3370
|
+
};
|
|
3361
3371
|
|
|
3362
3372
|
exports.main = main;
|
package/dist/browser.script.d.ts
CHANGED
|
@@ -12,7 +12,7 @@ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
|
12
12
|
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
13
13
|
PERFORMANCE OF THIS SOFTWARE.
|
|
14
14
|
***************************************************************************** */
|
|
15
|
-
/* global Reflect, Promise */
|
|
15
|
+
/* global Reflect, Promise, SuppressedError, Symbol */
|
|
16
16
|
|
|
17
17
|
|
|
18
18
|
function __values(o) {
|
|
@@ -33,7 +33,12 @@ function __asyncValues(o) {
|
|
|
33
33
|
return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
|
|
34
34
|
function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
|
|
35
35
|
function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
|
|
36
|
-
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
39
|
+
var e = new Error(message);
|
|
40
|
+
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
41
|
+
};
|
|
37
42
|
|
|
38
43
|
var global$1 = (typeof global !== "undefined" ? global :
|
|
39
44
|
typeof self !== "undefined" ? self :
|
|
@@ -3253,21 +3258,14 @@ const consolePrinter = () => {
|
|
|
3253
3258
|
},
|
|
3254
3259
|
};
|
|
3255
3260
|
};
|
|
3256
|
-
const DefaultRubyVM = async (rubyModule, options = {
|
|
3261
|
+
const DefaultRubyVM = async (rubyModule, options = {}) => {
|
|
3262
|
+
var _a;
|
|
3257
3263
|
await n();
|
|
3258
|
-
const wasi = new s({
|
|
3259
|
-
env: {
|
|
3260
|
-
// FIXME(katei): setjmp consumes a LOT of stack now, so we extend
|
|
3261
|
-
// default Fiber stack size as well as main stack size allocated
|
|
3262
|
-
// by wasm-ld's --stack-size. The ideal solution is to reduce
|
|
3263
|
-
// stack consumption in setjmp.
|
|
3264
|
-
"RUBY_FIBER_MACHINE_STACK_SIZE": "16777216"
|
|
3265
|
-
}
|
|
3266
|
-
});
|
|
3264
|
+
const wasi = new s({ env: options.env });
|
|
3267
3265
|
const vm = new RubyVM();
|
|
3268
3266
|
const imports = wasi.getImports(rubyModule);
|
|
3269
3267
|
vm.addToImports(imports);
|
|
3270
|
-
const printer = options.consolePrint ? consolePrinter() : undefined;
|
|
3268
|
+
const printer = ((_a = options.consolePrint) !== null && _a !== void 0 ? _a : true) ? consolePrinter() : undefined;
|
|
3271
3269
|
printer === null || printer === void 0 ? void 0 : printer.addToImports(imports);
|
|
3272
3270
|
const instance = await WebAssembly.instantiate(rubyModule, imports);
|
|
3273
3271
|
wasi.instantiate(instance);
|
|
@@ -3284,11 +3282,10 @@ const DefaultRubyVM = async (rubyModule, options = { consolePrint: true }) => {
|
|
|
3284
3282
|
};
|
|
3285
3283
|
};
|
|
3286
3284
|
|
|
3287
|
-
const main = async (pkg) => {
|
|
3288
|
-
const response =
|
|
3289
|
-
const
|
|
3290
|
-
const
|
|
3291
|
-
const { vm } = await DefaultRubyVM(module);
|
|
3285
|
+
const main = async (pkg, options) => {
|
|
3286
|
+
const response = fetch(`https://cdn.jsdelivr.net/npm/${pkg.name}@${pkg.version}/dist/ruby+stdlib.wasm`);
|
|
3287
|
+
const module = await compileWebAssemblyModule(response);
|
|
3288
|
+
const { vm } = await DefaultRubyVM(module, options);
|
|
3292
3289
|
vm.printVersion();
|
|
3293
3290
|
globalThis.rubyVM = vm;
|
|
3294
3291
|
// Wait for the text/ruby script tag to be read.
|
|
@@ -3356,5 +3353,18 @@ const loadScriptAsync = async (tag) => {
|
|
|
3356
3353
|
}
|
|
3357
3354
|
return Promise.resolve({ scriptContent: tag.innerHTML, evalStyle });
|
|
3358
3355
|
};
|
|
3356
|
+
// WebAssembly.compileStreaming is a relatively new API.
|
|
3357
|
+
// For example, it is not available in iOS Safari 14,
|
|
3358
|
+
// so check whether WebAssembly.compileStreaming is available and
|
|
3359
|
+
// fall back to the existing implementation using WebAssembly.compile if not.
|
|
3360
|
+
const compileWebAssemblyModule = async function (response) {
|
|
3361
|
+
if (!WebAssembly.compileStreaming) {
|
|
3362
|
+
const buffer = await (await response).arrayBuffer();
|
|
3363
|
+
return WebAssembly.compile(buffer);
|
|
3364
|
+
}
|
|
3365
|
+
else {
|
|
3366
|
+
return WebAssembly.compileStreaming(response);
|
|
3367
|
+
}
|
|
3368
|
+
};
|
|
3359
3369
|
|
|
3360
3370
|
export { main };
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
19
19
|
PERFORMANCE OF THIS SOFTWARE.
|
|
20
20
|
***************************************************************************** */
|
|
21
|
-
/* global Reflect, Promise */
|
|
21
|
+
/* global Reflect, Promise, SuppressedError, Symbol */
|
|
22
22
|
|
|
23
23
|
|
|
24
24
|
function __values(o) {
|
|
@@ -39,7 +39,12 @@
|
|
|
39
39
|
return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
|
|
40
40
|
function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
|
|
41
41
|
function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
|
|
42
|
-
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
45
|
+
var e = new Error(message);
|
|
46
|
+
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
47
|
+
};
|
|
43
48
|
|
|
44
49
|
var global$1 = (typeof global !== "undefined" ? global :
|
|
45
50
|
typeof self !== "undefined" ? self :
|
|
@@ -3259,21 +3264,14 @@
|
|
|
3259
3264
|
},
|
|
3260
3265
|
};
|
|
3261
3266
|
};
|
|
3262
|
-
const DefaultRubyVM = async (rubyModule, options = {
|
|
3267
|
+
const DefaultRubyVM = async (rubyModule, options = {}) => {
|
|
3268
|
+
var _a;
|
|
3263
3269
|
await n();
|
|
3264
|
-
const wasi = new s({
|
|
3265
|
-
env: {
|
|
3266
|
-
// FIXME(katei): setjmp consumes a LOT of stack now, so we extend
|
|
3267
|
-
// default Fiber stack size as well as main stack size allocated
|
|
3268
|
-
// by wasm-ld's --stack-size. The ideal solution is to reduce
|
|
3269
|
-
// stack consumption in setjmp.
|
|
3270
|
-
"RUBY_FIBER_MACHINE_STACK_SIZE": "16777216"
|
|
3271
|
-
}
|
|
3272
|
-
});
|
|
3270
|
+
const wasi = new s({ env: options.env });
|
|
3273
3271
|
const vm = new RubyVM();
|
|
3274
3272
|
const imports = wasi.getImports(rubyModule);
|
|
3275
3273
|
vm.addToImports(imports);
|
|
3276
|
-
const printer = options.consolePrint ? consolePrinter() : undefined;
|
|
3274
|
+
const printer = ((_a = options.consolePrint) !== null && _a !== void 0 ? _a : true) ? consolePrinter() : undefined;
|
|
3277
3275
|
printer === null || printer === void 0 ? void 0 : printer.addToImports(imports);
|
|
3278
3276
|
const instance = await WebAssembly.instantiate(rubyModule, imports);
|
|
3279
3277
|
wasi.instantiate(instance);
|
|
@@ -3290,11 +3288,10 @@
|
|
|
3290
3288
|
};
|
|
3291
3289
|
};
|
|
3292
3290
|
|
|
3293
|
-
const main = async (pkg) => {
|
|
3294
|
-
const response =
|
|
3295
|
-
const
|
|
3296
|
-
const
|
|
3297
|
-
const { vm } = await DefaultRubyVM(module);
|
|
3291
|
+
const main = async (pkg, options) => {
|
|
3292
|
+
const response = fetch(`https://cdn.jsdelivr.net/npm/${pkg.name}@${pkg.version}/dist/ruby+stdlib.wasm`);
|
|
3293
|
+
const module = await compileWebAssemblyModule(response);
|
|
3294
|
+
const { vm } = await DefaultRubyVM(module, options);
|
|
3298
3295
|
vm.printVersion();
|
|
3299
3296
|
globalThis.rubyVM = vm;
|
|
3300
3297
|
// Wait for the text/ruby script tag to be read.
|
|
@@ -3362,6 +3359,19 @@
|
|
|
3362
3359
|
}
|
|
3363
3360
|
return Promise.resolve({ scriptContent: tag.innerHTML, evalStyle });
|
|
3364
3361
|
};
|
|
3362
|
+
// WebAssembly.compileStreaming is a relatively new API.
|
|
3363
|
+
// For example, it is not available in iOS Safari 14,
|
|
3364
|
+
// so check whether WebAssembly.compileStreaming is available and
|
|
3365
|
+
// fall back to the existing implementation using WebAssembly.compile if not.
|
|
3366
|
+
const compileWebAssemblyModule = async function (response) {
|
|
3367
|
+
if (!WebAssembly.compileStreaming) {
|
|
3368
|
+
const buffer = await (await response).arrayBuffer();
|
|
3369
|
+
return WebAssembly.compile(buffer);
|
|
3370
|
+
}
|
|
3371
|
+
else {
|
|
3372
|
+
return WebAssembly.compileStreaming(response);
|
|
3373
|
+
}
|
|
3374
|
+
};
|
|
3365
3375
|
|
|
3366
3376
|
exports.main = main;
|
|
3367
3377
|
|
package/dist/browser.umd.js
CHANGED
|
@@ -3222,21 +3222,14 @@
|
|
|
3222
3222
|
},
|
|
3223
3223
|
};
|
|
3224
3224
|
};
|
|
3225
|
-
const DefaultRubyVM = async (rubyModule, options = {
|
|
3225
|
+
const DefaultRubyVM = async (rubyModule, options = {}) => {
|
|
3226
|
+
var _a;
|
|
3226
3227
|
await n();
|
|
3227
|
-
const wasi = new s({
|
|
3228
|
-
env: {
|
|
3229
|
-
// FIXME(katei): setjmp consumes a LOT of stack now, so we extend
|
|
3230
|
-
// default Fiber stack size as well as main stack size allocated
|
|
3231
|
-
// by wasm-ld's --stack-size. The ideal solution is to reduce
|
|
3232
|
-
// stack consumption in setjmp.
|
|
3233
|
-
"RUBY_FIBER_MACHINE_STACK_SIZE": "16777216"
|
|
3234
|
-
}
|
|
3235
|
-
});
|
|
3228
|
+
const wasi = new s({ env: options.env });
|
|
3236
3229
|
const vm = new RubyVM();
|
|
3237
3230
|
const imports = wasi.getImports(rubyModule);
|
|
3238
3231
|
vm.addToImports(imports);
|
|
3239
|
-
const printer = options.consolePrint ? consolePrinter() : undefined;
|
|
3232
|
+
const printer = ((_a = options.consolePrint) !== null && _a !== void 0 ? _a : true) ? consolePrinter() : undefined;
|
|
3240
3233
|
printer === null || printer === void 0 ? void 0 : printer.addToImports(imports);
|
|
3241
3234
|
const instance = await WebAssembly.instantiate(rubyModule, imports);
|
|
3242
3235
|
wasi.instantiate(instance);
|
package/dist/node.cjs.js
CHANGED
|
@@ -1188,16 +1188,8 @@ class RbFatalError extends RbError {
|
|
|
1188
1188
|
}
|
|
1189
1189
|
}
|
|
1190
1190
|
|
|
1191
|
-
const DefaultRubyVM = async (rubyModule) => {
|
|
1192
|
-
const wasi$1 = new wasi.WASI({
|
|
1193
|
-
env: {
|
|
1194
|
-
// FIXME(katei): setjmp consumes a LOT of stack now, so we extend
|
|
1195
|
-
// default Fiber stack size as well as main stack size allocated
|
|
1196
|
-
// by wasm-ld's --stack-size. The ideal solution is to reduce
|
|
1197
|
-
// stack consumption in setjmp.
|
|
1198
|
-
"RUBY_FIBER_MACHINE_STACK_SIZE": "16777216"
|
|
1199
|
-
}
|
|
1200
|
-
});
|
|
1191
|
+
const DefaultRubyVM = async (rubyModule, options = {}) => {
|
|
1192
|
+
const wasi$1 = new wasi.WASI({ env: options.env });
|
|
1201
1193
|
const vm = new RubyVM();
|
|
1202
1194
|
const imports = {
|
|
1203
1195
|
wasi_snapshot_preview1: wasi$1.wasiImport,
|
package/dist/node.d.ts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
import { WASI } from "wasi";
|
|
3
3
|
import { RubyVM } from "./index";
|
|
4
|
-
export declare const DefaultRubyVM: (rubyModule: WebAssembly.Module
|
|
4
|
+
export declare const DefaultRubyVM: (rubyModule: WebAssembly.Module, options?: {
|
|
5
|
+
env?: Record<string, string> | undefined;
|
|
6
|
+
}) => Promise<{
|
|
5
7
|
vm: RubyVM;
|
|
6
8
|
wasi: WASI;
|
|
7
9
|
instance: WebAssembly.Instance;
|
package/dist/node.esm.js
CHANGED
|
@@ -1186,16 +1186,8 @@ class RbFatalError extends RbError {
|
|
|
1186
1186
|
}
|
|
1187
1187
|
}
|
|
1188
1188
|
|
|
1189
|
-
const DefaultRubyVM = async (rubyModule) => {
|
|
1190
|
-
const wasi = new WASI({
|
|
1191
|
-
env: {
|
|
1192
|
-
// FIXME(katei): setjmp consumes a LOT of stack now, so we extend
|
|
1193
|
-
// default Fiber stack size as well as main stack size allocated
|
|
1194
|
-
// by wasm-ld's --stack-size. The ideal solution is to reduce
|
|
1195
|
-
// stack consumption in setjmp.
|
|
1196
|
-
"RUBY_FIBER_MACHINE_STACK_SIZE": "16777216"
|
|
1197
|
-
}
|
|
1198
|
-
});
|
|
1189
|
+
const DefaultRubyVM = async (rubyModule, options = {}) => {
|
|
1190
|
+
const wasi = new WASI({ env: options.env });
|
|
1199
1191
|
const vm = new RubyVM();
|
|
1200
1192
|
const imports = {
|
|
1201
1193
|
wasi_snapshot_preview1: wasi.wasiImport,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ruby/wasm-wasi",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.2.0",
|
|
4
4
|
"description": "WebAssembly port of CRuby with WASI",
|
|
5
5
|
"main": "./dist/index.cjs.js",
|
|
6
6
|
"umd:main": "./dist/index.umd.js",
|
|
@@ -68,20 +68,20 @@
|
|
|
68
68
|
"@babel/core": "^7.19.3",
|
|
69
69
|
"@babel/preset-env": "^7.19.3",
|
|
70
70
|
"@babel/preset-typescript": "^7.18.6",
|
|
71
|
-
"@rollup/plugin-inject": "^5.0.
|
|
71
|
+
"@rollup/plugin-inject": "^5.0.5",
|
|
72
72
|
"@rollup/plugin-node-resolve": "^15.1.0",
|
|
73
73
|
"@rollup/plugin-typescript": "^11.1.2",
|
|
74
|
-
"@types/jest": "^29.
|
|
75
|
-
"@types/node": "20.
|
|
74
|
+
"@types/jest": "^29.5.3",
|
|
75
|
+
"@types/node": "20.8.10",
|
|
76
76
|
"@wasmer/wasi": "^1.2.2",
|
|
77
|
-
"babel-jest": "^29.
|
|
78
|
-
"jest": "^29.
|
|
79
|
-
"prettier": "^
|
|
77
|
+
"babel-jest": "^29.7.0",
|
|
78
|
+
"jest": "^29.6.2",
|
|
79
|
+
"prettier": "^3.0.0",
|
|
80
80
|
"rollup": "^3.2.2",
|
|
81
81
|
"rollup-plugin-polyfill-node": "^0.12.0",
|
|
82
|
-
"typescript": "^5.
|
|
82
|
+
"typescript": "^5.2.2"
|
|
83
83
|
},
|
|
84
84
|
"dependencies": {
|
|
85
|
-
"tslib": "^2.
|
|
85
|
+
"tslib": "^2.6.1"
|
|
86
86
|
}
|
|
87
87
|
}
|