Skip to content

Import attribute for controlling builtins compilation option #99

Open
@guybedford

Description

@guybedford

Follow-on from #95 (comment) to track support for a new import attribute to support builtins compilation options.

From that discussion:

Add an import attribute for the wasm builtin collections to enable: either 'all', 'none', or a list of specific ones to enable. The default if not specified would be 'all' (as opposed to the JS-API which defaults to 'none').

The exact name can be confirmed, but for now consider we had an attribute called wasmBuiltins:

import source mod1 from './mod.wasm' with { wasmBuiltins: 'none' };
import source mod2 from './mod.wasm' with { wasmBuiltins: 'js-string,another-builtin' };

Ideally we would define canonicalization of the import attribute string to ensure that we do not end up treating:

import source mod1 from './mod.wasm' with { wasmBuiltins: 'all' };
import source mod2 from './mod.wasm' with { wasmBuiltins: 'js-string' };
import source mod3 from './mod.wasm';

As three separate binary compilations, but that the compilation and module record is shared between all of the above.

One issue with canonicalization when it comes to supporting multiple builtins (say comma-separated - wasmBuiltins: 'js-string,another-builtin' is that this also implies some kind of sorting canonicalization.

I think these cases should be possible to address though.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions