"wasm:js-string"corresponding to builtins: ['js-string'] in CompileOptions.
"wasm:js/string-constants"via passing { importedStringConstants: 'wasm:js/string-constants', builtins: ['js-string'] } in WebAssembly/esm-integration#115.
Currently uses:
"wasm:text-encoding"based off of original suggestions:
"wasm:text-encoder"
"wasm:text-decoder""wasm:js-prototypes"via builtins: ['js-prototypes']
- Module specifier name is kebab case
- Import name is camel case (at least for JS builtins so far)
Motivation to add wasm:js/ prefix came up in bikeshed discussion WebAssembly/esm-integration#118 by @eqrion.
Was not formally discussed in CG, so bringing this up. As far as I understand the justification:
wasm:chosen as the general builtin scheme overwasm-js:for builtinsjs/prefix allows separating JS host builtins from non-JS host builtins
- Does the committee align with this logic?
- Should these guidelines be written up somewhere?
The recommendation going forward would then be for all JS builtins to be defined under the wasm:js/ prefix.
Given current experimental status, perhaps only JS String Builtins requires a migration path?
For the others, simply switching to wasm:js/ should be sufficient:
- Update
builtins: ['js-string']to enablewasm:js/stringas well aswasm:js-stringfor a migration path - Update
builtins: ['js-prototypes']to enablewasm:js/prototypes - Update
builtins: ['text-encoding']to enablewasm:js/text-encoding(orwasm:js/text-encoderandwasm:js/text-decoder)
The builtins: ['<builtinset>'] naming remains an inconsistency then, but perhaps we can consider JS CompileOptions as implying JS already to some extent so that repeating the js term here is less necessary?
- Do we have consensus for the proposed migration path, or are there suggested adjustments?
- Are we okay with
builtinsnaming not fully relating to the import, at least for the original proposals? - The ESM Integration always turns on all JS builtins - if we had a consistent definition for this we could more simply specify
builtins: ['js']. would there be support for this and where should it be specified? In the ESM Integration itself?
Would like to also discuss making WebAssembly.JSTag available as a builtin import, perhaps via:
(module
(import "wasm:js/exceptions" "jsTag" (tag $js-tag (param externref)))
(func (export "throwArg") (param $msg externref)
local.get $msg
throw $js-tag
)
)Usage:
import { throwArg } from './mod.wasm';
throwArg(new Error('this error gets thrown'));- Would there be interest in this builtin?
- Since the exception handling proposal is already integrated, would a dedicated proposal be necessary?