Skip to content

JS: ES module scripts — <script type=module>, module graph loading, import semantics #343

Description

@mplsllc

Status

QuickJS itself can execute modern ECMAScript, but MacSurf's browser script loader still lacks the web module-script pipeline. The current capability audit records <script type="module"> as silently dropped.

This is distinct from JavaScript syntax support: module scripts require browser-side URL resolution, fetch ordering, module graph/linking, realm ownership, error/load events, and execution semantics.

V1 scope

  • Recognize <script type="module" src=...> and inline module scripts.
  • Resolve static imports relative to the referring module URL.
  • Fetch each module once per realm/module map and link through QuickJS's module loader hooks.
  • Preserve defer-like module execution ordering and document lifecycle interaction.
  • Fire script load/error correctly.
  • Surface unsupported/failing modules explicitly rather than silently dropping them.

Dynamic import() and import maps may be follow-up rounds if they require separate infrastructure.

Acceptance

A controlled entry module imports a second relative module, both execute exactly once in the correct order, exported/imported values work, load/error behavior is deterministic, and the page reaches the expected DOM result on the G3. Include failure and duplicate-import tests.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: js-engineDuktape, ES5 evaluator, JS bindingsenhancementNew feature or request

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions