jseption 0.0.5 → 0.0.6

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.
Files changed (86) hide show
  1. package/README.md +25 -4
  2. package/dist/atoms.d.ts +1 -0
  3. package/dist/atoms.js +2 -1
  4. package/dist/atoms.js.map +1 -1
  5. package/dist/builtins/base64.d.ts +14 -0
  6. package/dist/builtins/base64.js +219 -0
  7. package/dist/builtins/base64.js.map +1 -0
  8. package/dist/builtins/bigint.js +3 -3
  9. package/dist/builtins/bigint.js.map +1 -1
  10. package/dist/builtins/date.d.ts +1 -0
  11. package/dist/builtins/date.js +26 -12
  12. package/dist/builtins/date.js.map +1 -1
  13. package/dist/builtins/error.js +9 -0
  14. package/dist/builtins/error.js.map +1 -1
  15. package/dist/builtins/float16.d.ts +3 -0
  16. package/dist/builtins/float16.js +69 -0
  17. package/dist/builtins/float16.js.map +1 -0
  18. package/dist/builtins/function.js +2 -2
  19. package/dist/builtins/index.js +9 -6
  20. package/dist/builtins/index.js.map +1 -1
  21. package/dist/builtins/iterator.d.ts +2 -0
  22. package/dist/builtins/iterator.js +624 -0
  23. package/dist/builtins/iterator.js.map +1 -0
  24. package/dist/builtins/json.d.ts +13 -1
  25. package/dist/builtins/json.js +283 -211
  26. package/dist/builtins/json.js.map +1 -1
  27. package/dist/builtins/mapset.js +365 -6
  28. package/dist/builtins/mapset.js.map +1 -1
  29. package/dist/builtins/math.js +203 -3
  30. package/dist/builtins/math.js.map +1 -1
  31. package/dist/builtins/native.js +6 -6
  32. package/dist/builtins/object.js +9 -2
  33. package/dist/builtins/object.js.map +1 -1
  34. package/dist/builtins/promise.js +31 -11
  35. package/dist/builtins/promise.js.map +1 -1
  36. package/dist/builtins/proxy.js +2 -2
  37. package/dist/builtins/reflect.js +6 -2
  38. package/dist/builtins/reflect.js.map +1 -1
  39. package/dist/builtins/regexp.js +74 -3
  40. package/dist/builtins/regexp.js.map +1 -1
  41. package/dist/builtins/string.js +1 -1
  42. package/dist/builtins/symbol.js +1 -1
  43. package/dist/builtins/symbol.js.map +1 -1
  44. package/dist/builtins/typedarray.d.ts +1 -0
  45. package/dist/builtins/typedarray.js +302 -32
  46. package/dist/builtins/typedarray.js.map +1 -1
  47. package/dist/builtins/weakref.js +7 -7
  48. package/dist/embed.js +3 -3
  49. package/dist/interpreter.js +15 -14
  50. package/dist/interpreter.js.map +1 -1
  51. package/dist/jit.d.ts +1 -0
  52. package/dist/jit.js +51 -13
  53. package/dist/jit.js.map +1 -1
  54. package/dist/jit_hook.d.ts +1 -0
  55. package/dist/jit_hook.js.map +1 -1
  56. package/dist/jit_runtime.d.ts +1 -1
  57. package/dist/jit_runtime.js +6 -6
  58. package/dist/jit_runtime.js.map +1 -1
  59. package/dist/jit_stack.d.ts +1 -0
  60. package/dist/jit_stack.js +2 -1
  61. package/dist/jit_stack.js.map +1 -1
  62. package/dist/jseption.d.ts +2 -0
  63. package/dist/jseption.js +1 -0
  64. package/dist/jseption.js.map +1 -1
  65. package/dist/membrane.js +1 -1
  66. package/dist/module.js +5 -3
  67. package/dist/module.js.map +1 -1
  68. package/dist/parser.js +26 -9
  69. package/dist/parser.js.map +1 -1
  70. package/dist/print.d.ts +12 -0
  71. package/dist/print.js +494 -0
  72. package/dist/print.js.map +1 -0
  73. package/dist/qjs.js +13 -10
  74. package/dist/qjs.js.map +1 -1
  75. package/dist/quickjs.d.ts +8 -0
  76. package/dist/quickjs.js +132 -53
  77. package/dist/quickjs.js.map +1 -1
  78. package/dist/std.d.ts +4 -2
  79. package/dist/std.js +42 -8
  80. package/dist/std.js.map +1 -1
  81. package/dist/values.d.ts +31 -27
  82. package/dist/values.js.map +1 -1
  83. package/dist/version.d.ts +1 -1
  84. package/dist/version.js +1 -1
  85. package/dist/version.js.map +1 -1
  86. package/package.json +1 -1
package/dist/membrane.js CHANGED
@@ -513,7 +513,7 @@ class Membrane {
513
513
  return p.host;
514
514
  if (typeof v === 'function')
515
515
  return this.callable(v);
516
- if (JS_GetClassID(v) === 45 /* JSClassID.PROMISE */) {
516
+ if (JS_GetClassID(v) === 46 /* JSClassID.PROMISE */) {
517
517
  return guestPromiseToHostWith(this.ctx, v, x => this.fromGuest(x), e => (JS_GetClassID(e) === 3 /* JSClassID.ERROR */ ? guestErrorToHost(this.ctx, e) : this.fromGuest(e)));
518
518
  }
519
519
  return FROM_GUEST_DEFAULT;
package/dist/module.js CHANGED
@@ -414,7 +414,7 @@ function js_create_module_function(ctx, m) {
414
414
  const b = m.func_bytecode;
415
415
  /* create the module variables; the other variables are imported from other modules */
416
416
  const var_refs = b.closure_var.map(cv => cv.is_local ? new_var_ref_cell(cv.is_lexical ? JS_UNINITIALIZED : undefined) : null);
417
- const proto = ctx.class_proto[48 /* JSClassID.ASYNC_FUNCTION */] ?? ctx.function_proto;
417
+ const proto = ctx.class_proto[49 /* JSClassID.ASYNC_FUNCTION */] ?? ctx.function_proto;
418
418
  const f = js_closure_from_refs(ctx, b, var_refs, proto, false);
419
419
  if (JS_IsException(f))
420
420
  return -1;
@@ -890,10 +890,12 @@ function js_async_module_execution_rejected(ctx, module, error) {
890
890
  module.eval_exception = error;
891
891
  module.status = 5 /* JSModuleStatus.EVALUATED */;
892
892
  module.async_evaluation = false;
893
- for (const m of module.async_parent_modules)
894
- js_async_module_execution_rejected(ctx, m, error);
893
+ /* the module's own promise is rejected before its parents' (af16a97, after a
894
+ specification change) */
895
895
  if (module.promise !== undefined)
896
896
  JS_Call(ctx, module.resolving_funcs[1], undefined, [error]);
897
+ for (const m of module.async_parent_modules)
898
+ js_async_module_execution_rejected(ctx, m, error);
897
899
  }
898
900
  function js_async_module_execution_fulfilled(ctx, module) {
899
901
  if (module.status === 5 /* JSModuleStatus.EVALUATED */)
@@ -1 +1 @@
1
- {"version":3,"file":"module.js","sourceRoot":"","sources":["../src/module.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,OAAO,EAC6C,YAAY,EAAE,gBAAgB,EAAE,cAAc,EAAE,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AC,iBAAiB,GAAG,iBAAiB,CAAC;AAC5C,KAAK,CAAC,cAAc,GAAG,cAAc,CAAC;AACtC,KAAK,CAAC,uBAAuB,GAAG,uBAAuB,CAAC","sourcesContent":["/*\n * ES modules: loading, linking, evaluation (with top-level await), module\n * namespace objects, dynamic import() and import.meta.\n *\n * Ported from quickjs.c (js_create_module_function, js_inner_module_linking,\n * js_resolve_export, js_build_module_ns, js_inner_module_evaluation,\n * js_async_module_execution_fulfilled/rejected, js_dynamic_import), with one\n * change of shape: QuickJS asks a synchronous loader for each module while it\n * resolves the graph, but a browser fetches asynchronously, so here the whole\n * graph is fetched first (in parallel where the loader allows), and linking and\n * evaluation run once every module is there. A loader that answers\n * synchronously makes the whole sequence synchronous.\n *\n * The sandbox stays closed by default: with no loader set, nothing can be\n * imported. The embedder's loader decides what a specifier means.\n */\nimport {\n JSContext, JSRuntime, JSValue, JSAtom, JSClassID, JS_EXCEPTION, JS_UNINITIALIZED, JS_IsException, JS_IsObject,\n JS_NewAtom, JS_AtomGetStr, JS_Call, JS_NewCFunction, JS_EnqueueJob, JS_ToString, JS_Throw,\n JS_ThrowTypeError, JS_ThrowSyntaxError, JS_ThrowReferenceError, JS_NewObjectProto, JS_DefinePropertyValueStr,\n JS_GetPropertyStr, JS_GetFunctionData, js_take_exception, js_ensure_meta, js_host_exception_to_guest, hooks,\n JS_PROP_C_W_E, JS_ATOM_default, JS_ATOM__star_,\n JS_EVAL_TYPE_MODULE, JS_EVAL_FLAG_COMPILE_ONLY, JS_EVAL_FLAG_STRIP_TYPES, JS_EVAL_FLAG_JSX,\n} from './quickjs.ts';\nimport {\n JSModuleDef, JSModuleStatus, JSExportEntry, JSExportType, JSModuleKind, JSFunctionBytecode,\n JSVarRef, JSPromiseState, new_var_ref_cell,\n} from './values.ts';\nimport { js_closure_from_refs } from './interpreter.ts';\nimport { JS_NewPromiseCapability, JS_PromiseState, JS_PromiseResult, perform_promise_then } from './builtins/promise.ts';\nimport { JS_ParseJSON } from './builtins/json.ts';\nimport { toGuest, drainJobs } from './embed.ts';\n\n/* ---------------------------------------------------------------------\n The embedder's loader\n --------------------------------------------------------------------- */\n\n/* what a loader returns for a module id */\nexport interface JSModuleSource {\n /* JavaScript (or TypeScript, or JSON) source text */\n source?: string;\n /* bytecode written by JS_WriteObject for a compiled module */\n bytecode?: Uint8Array;\n /* import.meta.url (defaults to the id) */\n url?: string;\n /* 'js' (default), 'ts' (stripped like JS_EVAL_FLAG_STRIP_TYPES; also chosen by a .ts, .mts or\n .cts id), 'jsx' (JSX compiled like JS_EVAL_FLAG_JSX; also chosen by a .jsx id), 'tsx' (both;\n also chosen by a .tsx id), or 'json' (only for imports `with { type: \"json\" }`) */\n type?: JSModuleSourceType;\n /* a host module: its exports as host values, marshalled into the guest with toGuest()\n (`default` is the default export) */\n exports?: Record<string, unknown>;\n}\nexport type JSModuleLoadResult = string | Uint8Array | JSModuleSource;\nexport type JSModuleSourceType = 'js' | 'ts' | 'jsx' | 'tsx' | 'json';\n\n/* the source type an id implies: .ts, .mts and .cts are TypeScript, .tsx TSX, .jsx JSX. When the\n id is a URL (it has a scheme), its query and fragment are not part of the path, so\n `https://app/App.tsx?v=3` and `file:///a.ts#x` are TSX and TypeScript; other ids (file paths)\n are matched as they are, since `?` and `#` are ordinary characters there */\nexport function js_module_type_of(id: string): 'js' | 'ts' | 'jsx' | 'tsx' {\n const path = /^[a-z][a-z0-9+.-]*:/i.test(id) ? id.replace(/[?#].*$/s, '') : id;\n return /\\.[mc]?ts$/.test(path) ? 'ts' : /\\.tsx$/.test(path) ? 'tsx' : /\\.jsx$/.test(path) ? 'jsx' : 'js';\n}\n\n/* the JS_Eval flags that compile a source type */\nexport function js_module_type_flags(type: string): number {\n return (type === 'ts' || type === 'tsx' ? JS_EVAL_FLAG_STRIP_TYPES : 0) | (type === 'jsx' || type === 'tsx' ? JS_EVAL_FLAG_JSX : 0);\n}\n\nexport interface JSModuleLoader {\n /* the normalized id of `specifier` imported from `referrer` (the importing module's id, a\n script's file name, or null from the host). Default: URL-style resolution of relative\n specifiers (`./`, `../`, `/`) against the referrer; other specifiers are kept as they are */\n resolve?(specifier: string, referrer: string | null, attributes: Record<string, string>): string;\n /* the module for an id: its source, bytecode or host exports, or a promise of them */\n load(id: string, attributes: Record<string, string>): JSModuleLoadResult | PromiseLike<JSModuleLoadResult>;\n}\n\n/* Set (or clear, with null) the module loader of a runtime */\nexport function JS_SetModuleLoader(rt: JSRuntime, loader: JSModuleLoader | null): void {\n rt.module_loader = loader;\n}\n\n/* the default resolution: relative specifiers against the referrer, URL style */\nexport function js_default_module_resolve(specifier: string, referrer: string | null): string {\n if (!(specifier.startsWith('./') || specifier.startsWith('../') || specifier.startsWith('/'))) return specifier;\n if (referrer === null) return normalize_path(specifier);\n if (/^[a-zA-Z][a-zA-Z0-9+.-]*:/.test(referrer)) {\n try { return new URL(specifier, referrer).href; } catch { /* not a URL: fall through */ }\n }\n if (specifier.startsWith('/')) return normalize_path(specifier);\n const slash = referrer.lastIndexOf('/');\n const dir = slash >= 0 ? referrer.slice(0, slash + 1) : '';\n return normalize_path(dir + specifier);\n}\n\n/* collapse `.` and `..` segments of a path */\nfunction normalize_path(path: string): string {\n const abs = path.startsWith('/');\n const out: string[] = [];\n for (const seg of path.split('/')) {\n if (seg === '' || seg === '.') continue;\n if (seg === '..') {\n if (out.length > 0 && out[out.length - 1] !== '..') out.pop();\n else if (!abs) out.push('..');\n continue;\n }\n out.push(seg);\n }\n const r = out.join('/');\n return abs ? '/' + r : r;\n}\n\n/* QuickJS's JS_DetectModule heuristic: after comments, the source starts with `export`, or\n with `import` not followed by `(` or `.` */\nexport function JS_DetectModule(input: string): boolean {\n let p = 0;\n const n = input.length;\n if (input.startsWith('#!')) { while (p < n && input[p] !== '\\n') p++; }\n const skip = (): void => {\n for (;;) {\n while (p < n && /\\s/.test(input[p])) p++;\n if (input.startsWith('//', p)) { while (p < n && input[p] !== '\\n') p++; continue; }\n if (input.startsWith('/*', p)) { const e = input.indexOf('*/', p + 2); p = e < 0 ? n : e + 2; continue; }\n break;\n }\n };\n const word = (): string => { const m = /^[A-Za-z_$][\\w$]*/.exec(input.slice(p, p + 32)); return m ? m[0] : ''; };\n skip();\n const w = word();\n if (w === 'export') return true;\n if (w !== 'import') return false;\n p += 6;\n skip();\n return !(input[p] === '(' || input[p] === '.');\n}\n\n/* ---------------------------------------------------------------------\n Errors\n --------------------------------------------------------------------- */\n\nfunction throw_type_error(ctx: JSContext, msg: string): JSValue {\n JS_ThrowTypeError(ctx, msg);\n return js_take_exception(ctx);\n}\nfunction throw_syntax_error(ctx: JSContext, msg: string): JSValue {\n JS_ThrowSyntaxError(ctx, msg);\n return js_take_exception(ctx);\n}\n\n/* a value thrown by the embedder's loader, as a guest value */\nfunction host_error_to_guest(ctx: JSContext, e: unknown): JSValue {\n try { return toGuest(ctx, e); } catch { return throw_type_error(ctx, String(e)); }\n}\n\n/* a value caught in this file, in the engine's convention: guest values pass through, host\n errors become guest errors */\nfunction caught(ctx: JSContext, e: unknown): JSValue {\n js_host_exception_to_guest(ctx, e);\n return js_take_exception(ctx);\n}\n\nfunction mname(ctx: JSContext, m: JSModuleDef): string { return JS_AtomGetStr(ctx, m.module_name); }\n\n/* ---------------------------------------------------------------------\n Compiled modules\n --------------------------------------------------------------------- */\n\n/* every function of a module knows its module (import.meta, the referrer of import()) */\nfunction js_mark_module_functions(b: JSFunctionBytecode, m: JSModuleDef): void {\n b.module = m;\n for (const c of b.cpool) if (c instanceof JSFunctionBytecode) js_mark_module_functions(c, m);\n}\n\n/* the module record of a compiled module body */\nexport function js_module_set_function(m: JSModuleDef, b: JSFunctionBytecode): void {\n m.func_bytecode = b;\n js_mark_module_functions(b, m);\n}\n\n/* called by the parser for JS_EVAL_TYPE_MODULE */\nfunction js_module_compiled(ctx: JSContext, m: JSModuleDef, b: JSFunctionBytecode, flags: number): JSValue {\n js_module_set_function(m, b);\n if (flags & JS_EVAL_FLAG_COMPILE_ONLY) return m as unknown as JSValue;\n return js_module_eval_function(ctx, m);\n}\n\nfunction module_key(id: string, kind: 'js' | 'json'): string {\n return kind === 'json' ? id + '\\u0000json' : id;\n}\n\n/* register a root module (JS_Eval, JS_EvalFunction) under its name, if the name is free */\nfunction js_register_module(ctx: JSContext, m: JSModuleDef): void {\n const key = module_key(mname(ctx, m), m.kind === JSModuleKind.JSON ? 'json' : 'js');\n if (!ctx.module_map.has(key)) ctx.module_map.set(key, m);\n}\n\n/* a synthetic module (JSON or host values) with the given named exports */\nfunction js_new_synthetic_module(ctx: JSContext, id: string, kind: JSModuleKind, exports: Map<string, JSValue>): JSModuleDef {\n const m = new JSModuleDef(JS_NewAtom(ctx, id));\n m.kind = kind;\n m.realm = ctx;\n m.synthetic_exports = new Map();\n for (const [name, v] of exports) {\n const atom = JS_NewAtom(ctx, name);\n m.export_entries.push(new JSExportEntry(atom, atom, JSExportType.LOCAL));\n m.synthetic_exports.set(atom, v);\n }\n return m;\n}\n\n/* the module for what the loader returned; throws a guest value on failure */\nfunction js_module_from_load_result(ctx: JSContext, id: string, kind: 'js' | 'json', r: JSModuleLoadResult): JSModuleDef {\n let src: JSModuleSource;\n if (typeof r === 'string') src = { source: r };\n else if (r instanceof Uint8Array) src = { bytecode: r };\n else if (r !== null && typeof r === 'object') src = r;\n else throw throw_type_error(ctx, `the module loader returned no module for '${id}'`);\n\n if (src.exports !== undefined) {\n if (kind === 'json') throw throw_type_error(ctx, `'${id}' is a host module, not a JSON module`);\n const exports = new Map<string, JSValue>();\n for (const k of Object.keys(src.exports)) {\n try { exports.set(k, toGuest(ctx, src.exports[k])); }\n catch (e) { throw host_error_to_guest(ctx, e); }\n }\n const m = js_new_synthetic_module(ctx, id, JSModuleKind.HOST, exports);\n m.url = src.url ?? null;\n return m;\n }\n const type = src.type ?? (src.bytecode ? 'js' : js_module_type_of(id));\n if (kind === 'json' || type === 'json') {\n if (kind !== 'json') throw throw_type_error(ctx, `'${id}' is a JSON module: import it with { type: \"json\" }`);\n if (type !== 'json' && src.type !== undefined) throw throw_type_error(ctx, `'${id}' is not a JSON module`);\n if (typeof src.source !== 'string') throw throw_type_error(ctx, `the module loader returned no JSON source for '${id}'`);\n const v = JS_ParseJSON(ctx, src.source, id);\n if (JS_IsException(v)) throw js_take_exception(ctx);\n const m = js_new_synthetic_module(ctx, id, JSModuleKind.JSON, new Map([['default', v]]));\n m.url = src.url ?? null;\n return m;\n }\n let m: JSModuleDef;\n if (src.bytecode !== undefined) {\n const read = hooks_bytecode.read;\n if (read === null) throw throw_type_error(ctx, 'bytecode modules are not supported in this build');\n const v = read(ctx, src.bytecode);\n if (JS_IsException(v)) throw js_take_exception(ctx);\n if (!(v instanceof JSModuleDef)) throw throw_type_error(ctx, `the bytecode for '${id}' is not a module`);\n m = v;\n /* the module takes the id it was loaded under */\n m.module_name = JS_NewAtom(ctx, id);\n } else {\n if (typeof src.source !== 'string') throw throw_type_error(ctx, `the module loader returned no source for '${id}'`);\n const flags = JS_EVAL_TYPE_MODULE | JS_EVAL_FLAG_COMPILE_ONLY | js_module_type_flags(type);\n const v = hooks.JS_EvalInternal(ctx, undefined, src.source, id, flags, -1);\n if (JS_IsException(v)) throw js_take_exception(ctx);\n m = v as unknown as JSModuleDef;\n }\n m.url = src.url ?? null;\n return m;\n}\n\n/* set by src/bytecode.ts: read a compiled module from bytes */\nexport const hooks_bytecode: { read: ((ctx: JSContext, bytes: Uint8Array) => JSValue) | null } = { read: null };\n\n/* ---------------------------------------------------------------------\n Fetching the module graph\n --------------------------------------------------------------------- */\n\ntype LoadCallback = (err: JSValue | undefined, m: JSModuleDef | null) => void;\n\ninterface InflightLoad { waiters: LoadCallback[] }\n\n/* the module type a request asks for, or a guest error */\nfunction js_request_kind(ctx: JSContext, attrs: Record<string, string> | null): 'js' | 'json' | JSValue {\n if (attrs === null) return 'js';\n for (const k of Object.keys(attrs)) {\n if (k !== 'type') return throw_syntax_error(ctx, `unsupported import attribute '${k}'`);\n }\n const t = attrs.type;\n if (t === undefined) return 'js';\n if (t === 'json') return 'json';\n return throw_type_error(ctx, `unsupported module type '${t}'`);\n}\n\nfunction js_resolve_specifier(ctx: JSContext, specifier: string, referrer: string | null,\n attrs: Record<string, string>): string {\n const loader = ctx.rt.module_loader as JSModuleLoader | null;\n if (loader === null) throw throw_type_error(ctx, `cannot import '${specifier}': no module loader is set`);\n let id: unknown;\n try {\n id = loader.resolve ? loader.resolve(specifier, referrer, attrs) : js_default_module_resolve(specifier, referrer);\n } catch (e) {\n throw host_error_to_guest(ctx, e);\n }\n if (typeof id !== 'string') throw throw_type_error(ctx, `the module loader could not resolve '${specifier}'`);\n return id;\n}\n\n/* the module for `id`: from the context's map, or fetched with the loader. `cb` runs once,\n synchronously if the module is there or the loader answers synchronously */\nfunction js_fetch_module(ctx: JSContext, specifier: string, id: string, kind: 'js' | 'json',\n attrs: Record<string, string>, cb: LoadCallback): void {\n const key = module_key(id, kind);\n const existing = ctx.module_map.get(key) as JSModuleDef | undefined;\n if (existing !== undefined) { cb(undefined, existing); return; }\n const inflight = ctx.module_inflight.get(key) as InflightLoad | undefined;\n if (inflight !== undefined) { inflight.waiters.push(cb); return; }\n const loader = ctx.rt.module_loader as JSModuleLoader | null;\n if (loader === null) { cb(throw_type_error(ctx, `cannot import '${specifier}': no module loader is set`), null); return; }\n const entry: InflightLoad = { waiters: [cb] };\n ctx.module_inflight.set(key, entry);\n let is_async = false;\n const settle = (err: JSValue | undefined, m: JSModuleDef | null): void => {\n ctx.module_inflight.delete(key);\n if (m !== null) ctx.module_map.set(key, m);\n for (const w of entry.waiters) w(err, m);\n /* a load that finished in a host callback: run the guest jobs it started */\n if (is_async) drainJobs(ctx);\n };\n const done = (r: JSModuleLoadResult): void => {\n let m: JSModuleDef;\n try {\n m = js_module_from_load_result(ctx, id, kind, r);\n } catch (e) {\n settle(caught(ctx, e), null);\n return;\n }\n settle(undefined, m);\n };\n let r: JSModuleLoadResult | PromiseLike<JSModuleLoadResult>;\n try {\n r = loader.load(id, attrs);\n } catch (e) {\n settle(host_error_to_guest(ctx, e), null);\n return;\n }\n if (r !== null && typeof r === 'object' && typeof (r as PromiseLike<unknown>).then === 'function') {\n is_async = true;\n (r as PromiseLike<JSModuleLoadResult>).then(done, e => settle(host_error_to_guest(ctx, e), null));\n } else {\n done(r as JSModuleLoadResult);\n }\n}\n\n/* Make sure every request of `root`, transitively, has its module. `cb(err)` runs once; it\n runs synchronously when every module was already loaded or loaded synchronously */\nfunction js_load_graph(ctx: JSContext, root: JSModuleDef, cb: (err: JSValue | undefined) => void): void {\n let pending = 0;\n let finished = false;\n const visited = new Set<JSModuleDef>();\n const fail = (err: JSValue): void => { if (!finished) { finished = true; cb(err); } };\n const one_done = (): void => { if (--pending === 0 && !finished) { finished = true; cb(undefined); } };\n const visit = (m: JSModuleDef): void => {\n if (visited.has(m) || finished) return;\n visited.add(m);\n const referrer = mname(ctx, m);\n for (const rme of m.req_module_entries) {\n if (finished) return;\n if (rme.module !== null) { visit(rme.module); continue; }\n const specifier = JS_AtomGetStr(ctx, rme.module_name);\n const attrs = rme.attributes ?? {};\n const kind = js_request_kind(ctx, rme.attributes);\n if (kind !== 'js' && kind !== 'json') { fail(kind); return; }\n let id: string;\n try { id = js_resolve_specifier(ctx, specifier, referrer, attrs); } catch (e) { fail(caught(ctx, e)); return; }\n pending++;\n js_fetch_module(ctx, specifier, id, kind, attrs, (err, m1) => {\n if (finished) return;\n if (err !== undefined) { fail(err); return; }\n rme.module = m1;\n visit(m1!);\n one_done();\n });\n }\n };\n pending++;\n visit(root);\n one_done();\n}\n\n/* ---------------------------------------------------------------------\n Module functions and linking (js_create_module_function, js_link_module)\n --------------------------------------------------------------------- */\n\nfunction js_create_module_function(ctx: JSContext, m: JSModuleDef): number {\n if (m.func_created) return 0;\n if (m.kind !== JSModuleKind.JS) {\n /* initialize the exported variables */\n for (const me of m.export_entries) me.var_ref = new_var_ref_cell(undefined);\n } else {\n const b = m.func_bytecode!;\n /* create the module variables; the other variables are imported from other modules */\n const var_refs: (JSVarRef | null)[] = b.closure_var.map(cv =>\n cv.is_local ? new_var_ref_cell(cv.is_lexical ? JS_UNINITIALIZED : undefined) : null);\n const proto = ctx.class_proto[JSClassID.ASYNC_FUNCTION] ?? ctx.function_proto;\n const f = js_closure_from_refs(ctx, b, var_refs as JSVarRef[], proto, false);\n if (JS_IsException(f)) return -1;\n m.func_obj = f;\n }\n m.func_created = true;\n /* do it on the dependencies */\n for (const rme of m.req_module_entries) {\n if (js_create_module_function(ctx, rme.module!) < 0) return -1;\n }\n return 0;\n}\n\nfunction module_var_refs(m: JSModuleDef): JSVarRef[] {\n return JS_GetFunctionData(m.func_obj)!.var_refs as JSVarRef[];\n}\n\n/* the variable of a local export */\nfunction export_var_ref(m: JSModuleDef, me: JSExportEntry): JSVarRef {\n if (me.var_ref === null) me.var_ref = module_var_refs(m)[me.var_idx];\n return me.var_ref;\n}\n\nconst enum ResolveResult { FOUND, NOT_FOUND, CIRCULAR, AMBIGUOUS }\n\n/* a resolved binding: a module variable, or the namespace of a module */\ninterface ResolvedBinding { module: JSModuleDef; me: JSExportEntry; ns: JSModuleDef | null }\n\nfunction same_binding(a: ResolvedBinding, b: ResolvedBinding): boolean {\n if (a.ns !== null || b.ns !== null) return a.ns === b.ns;\n return a.module === b.module && a.me.var_idx === b.me.var_idx && a.me.local_name === b.me.local_name;\n}\n\n/* ResolveExport (js_resolve_export1) */\nfunction js_resolve_export1(m: JSModuleDef, export_name: JSAtom, set: Map<JSModuleDef, Set<JSAtom>>,\n out: { b: ResolvedBinding | null }): ResolveResult {\n out.b = null;\n let names = set.get(m);\n if (names === undefined) { names = new Set(); set.set(m, names); }\n if (names.has(export_name)) return ResolveResult.CIRCULAR;\n names.add(export_name);\n const me = m.export_entries.find(e => e.export_name === export_name) ?? null;\n if (me !== null) {\n if (me.export_type === JSExportType.LOCAL) {\n out.b = { module: m, me, ns: null };\n return ResolveResult.FOUND;\n }\n const m1 = m.req_module_entries[me.req_module_idx].module!;\n if (me.local_name === JS_ATOM__star_) {\n /* export * as ns from */\n out.b = { module: m, me, ns: m1 };\n return ResolveResult.FOUND;\n }\n return js_resolve_export1(m1, me.local_name, set, out);\n }\n if (export_name === JS_ATOM_default) return ResolveResult.NOT_FOUND;\n /* not found in the direct or indirect exports: try the star exports */\n let star: ResolvedBinding | null = null;\n for (const se of m.star_export_entries) {\n const m1 = m.req_module_entries[se.req_module_idx].module!;\n const r = { b: null as ResolvedBinding | null };\n const ret = js_resolve_export1(m1, export_name, set, r);\n if (ret === ResolveResult.AMBIGUOUS) return ret;\n if (ret === ResolveResult.FOUND) {\n if (star !== null) {\n if (!same_binding(star, r.b!)) return ResolveResult.AMBIGUOUS;\n } else {\n star = r.b;\n }\n }\n }\n if (star !== null) { out.b = star; return ResolveResult.FOUND; }\n return ResolveResult.NOT_FOUND;\n}\n\nfunction js_resolve_export(m: JSModuleDef, export_name: JSAtom, out: { b: ResolvedBinding | null }): ResolveResult {\n return js_resolve_export1(m, export_name, new Map(), out);\n}\n\nfunction js_resolve_export_throw_error(ctx: JSContext, res: ResolveResult, m: JSModuleDef, export_name: JSAtom): void {\n const n = JS_AtomGetStr(ctx, export_name), mn = mname(ctx, m);\n switch (res) {\n case ResolveResult.CIRCULAR:\n JS_ThrowSyntaxError(ctx, `circular reference when looking for export '${n}' in module '${mn}'`);\n break;\n case ResolveResult.AMBIGUOUS:\n JS_ThrowSyntaxError(ctx, `export '${n}' in module '${mn}' is ambiguous`);\n break;\n default:\n JS_ThrowSyntaxError(ctx, `Could not find export '${n}' in module '${mn}'`);\n break;\n }\n}\n\n/* the variable a resolved binding reads */\nfunction binding_var_ref(ctx: JSContext, b: ResolvedBinding): JSVarRef | null {\n if (b.ns !== null) {\n const ns = js_get_module_ns(ctx, b.ns);\n if (JS_IsException(ns)) return null;\n return new_var_ref_cell(ns);\n }\n return export_var_ref(b.module, b.me);\n}\n\n/* Prepare a module to be executed by resolving all the imported variables */\nfunction js_inner_module_linking(ctx: JSContext, m: JSModuleDef, stack: { top: JSModuleDef | null }, index: number): number {\n if (m.status === JSModuleStatus.LINKING || m.status === JSModuleStatus.LINKED ||\n m.status === JSModuleStatus.EVALUATING_ASYNC || m.status === JSModuleStatus.EVALUATED) return index;\n m.status = JSModuleStatus.LINKING;\n m.dfs_index = index;\n m.dfs_ancestor_index = index;\n index++;\n /* push 'm' on stack */\n m.stack_prev = stack.top;\n stack.top = m;\n\n for (const rme of m.req_module_entries) {\n const m1 = rme.module!;\n index = js_inner_module_linking(ctx, m1, stack, index);\n if (index < 0) return -1;\n if (m1.status === JSModuleStatus.LINKING) m.dfs_ancestor_index = Math.min(m.dfs_ancestor_index, m1.dfs_ancestor_index);\n }\n\n /* check the indirect exports */\n for (const me of m.export_entries) {\n if (me.export_type === JSExportType.INDIRECT && me.local_name !== JS_ATOM__star_) {\n const m1 = m.req_module_entries[me.req_module_idx].module!;\n const r = { b: null as ResolvedBinding | null };\n const ret = js_resolve_export(m1, me.local_name, r);\n if (ret !== ResolveResult.FOUND) {\n js_resolve_export_throw_error(ctx, ret, m1, me.local_name);\n return -1;\n }\n }\n }\n\n if (m.kind === JSModuleKind.JS) {\n const var_refs = module_var_refs(m);\n for (const mi of m.import_entries) {\n const m1 = m.req_module_entries[mi.req_module_idx].module!;\n if (mi.is_star) {\n /* namespace import */\n const ns = js_get_module_ns(ctx, m1);\n if (JS_IsException(ns)) return -1;\n var_refs[mi.var_idx].set(ns);\n } else {\n const r = { b: null as ResolvedBinding | null };\n const ret = js_resolve_export(m1, mi.import_name, r);\n if (ret !== ResolveResult.FOUND) {\n js_resolve_export_throw_error(ctx, ret, m1, mi.import_name);\n return -1;\n }\n const vr = binding_var_ref(ctx, r.b!);\n if (vr === null) return -1;\n var_refs[mi.var_idx] = vr;\n }\n }\n /* keep the exported variables in the module export entries */\n for (const me of m.export_entries) {\n if (me.export_type === JSExportType.LOCAL) export_var_ref(m, me);\n }\n /* initialize the global variables: with `this` true, the module function only runs its\n hoisted definitions */\n const ret = JS_Call(ctx, m.func_obj, true, []);\n if (JS_IsException(ret)) return -1;\n }\n\n if (m.dfs_index === m.dfs_ancestor_index) {\n for (;;) {\n /* pop m1 from stack */\n const m1: JSModuleDef = stack.top!;\n stack.top = m1.stack_prev;\n m1.status = JSModuleStatus.LINKED;\n if (m1 === m) break;\n }\n }\n return index;\n}\n\nfunction js_link_module(ctx: JSContext, m: JSModuleDef): number {\n const stack = { top: null as JSModuleDef | null };\n if (js_inner_module_linking(ctx, m, stack, 0) < 0) {\n while (stack.top !== null) {\n const m1 = stack.top;\n m1.status = JSModuleStatus.UNLINKED;\n stack.top = m1.stack_prev;\n }\n return -1;\n }\n return 0;\n}\n\n/* ---------------------------------------------------------------------\n Module namespace objects\n --------------------------------------------------------------------- */\n\n/* GetExportedNames */\nfunction get_exported_names(m: JSModuleDef, from_star: boolean, visited: Set<JSModuleDef>, out: JSAtom[]): void {\n if (visited.has(m)) return;\n visited.add(m);\n for (const me of m.export_entries) {\n if (from_star && me.export_name === JS_ATOM_default) continue;\n if (!out.includes(me.export_name)) out.push(me.export_name);\n }\n for (const se of m.star_export_entries) {\n get_exported_names(m.req_module_entries[se.req_module_idx].module!, true, visited, out);\n }\n}\n\nfunction compare_code_units(a: string, b: string): number { return a < b ? -1 : a > b ? 1 : 0; }\n\n/* Build the namespace object of a module: a host Proxy over a frozen-shape, null-prototype\n target, so that native property access sees the live bindings (spec 10.4.6) */\nfunction js_build_module_ns(ctx: JSContext, m: JSModuleDef): JSValue {\n const names: JSAtom[] = [];\n get_exported_names(m, false, new Set(), names);\n const bindings = new Map<string, () => JSValue>();\n for (const name of names) {\n const r = { b: null as ResolvedBinding | null };\n const ret = js_resolve_export(m, name, r);\n if (ret === ResolveResult.AMBIGUOUS) continue; /* ambiguous exports are left out */\n if (ret !== ResolveResult.FOUND) {\n js_resolve_export_throw_error(ctx, ret, m, name);\n return JS_EXCEPTION;\n }\n const b = r.b!;\n const key = JS_AtomGetStr(ctx, name);\n if (b.ns !== null) {\n /* the namespace of another module: resolved lazily (cycles) */\n const target_module = b.ns;\n bindings.set(key, () => {\n const v = js_get_module_ns(ctx, target_module);\n if (JS_IsException(v)) throw js_take_exception(ctx);\n return v;\n });\n } else {\n const vr = export_var_ref(b.module, b.me);\n bindings.set(key, () => {\n const v = vr.get();\n if (v === JS_UNINITIALIZED) {\n JS_ThrowReferenceError(ctx, `'${key}' is not initialized`);\n throw js_take_exception(ctx);\n }\n return v;\n });\n }\n }\n const keys = [...bindings.keys()].sort(compare_code_units);\n const target: Record<PropertyKey, unknown> = Object.create(null);\n for (const k of keys) Reflect.defineProperty(target, k, { value: undefined, writable: true, enumerable: true, configurable: false });\n Reflect.defineProperty(target, Symbol.toStringTag, { value: 'Module', writable: false, enumerable: false, configurable: false });\n Object.preventExtensions(target);\n const value_of = (k: string): JSValue => bindings.get(k)!();\n const handler: ProxyHandler<object> = Object.assign(Object.create(null), {\n get(t: object, key: string | symbol, receiver: unknown): unknown {\n if (typeof key === 'symbol') return Reflect.get(t, key, receiver);\n return bindings.has(key) ? value_of(key) : undefined;\n },\n set(): boolean { return false; },\n has(t: object, key: string | symbol): boolean {\n if (typeof key === 'symbol') return Reflect.has(t, key);\n return bindings.has(key);\n },\n deleteProperty(t: object, key: string | symbol): boolean {\n if (typeof key === 'symbol') return Reflect.deleteProperty(t, key);\n return !bindings.has(key);\n },\n getOwnPropertyDescriptor(t: object, key: string | symbol): PropertyDescriptor | undefined {\n if (typeof key === 'symbol') return Reflect.getOwnPropertyDescriptor(t, key);\n if (!bindings.has(key)) return undefined;\n return { value: value_of(key), writable: true, enumerable: true, configurable: false };\n },\n defineProperty(t: object, key: string | symbol, desc: PropertyDescriptor): boolean {\n if (typeof key === 'symbol') return Reflect.defineProperty(t, key, desc);\n if (!bindings.has(key)) return false;\n const value = value_of(key); /* TDZ */\n if (desc.configurable === true || desc.enumerable === false || desc.get !== undefined || desc.set !== undefined ||\n desc.writable === false) return false;\n if ('value' in desc) return Object.is(desc.value, value);\n return true;\n },\n ownKeys(): PropertyKey[] { return [...keys, Symbol.toStringTag]; },\n });\n const ns = new Proxy(target, handler);\n js_ensure_meta(ns, JSClassID.MODULE_NS).realm = ctx;\n return ns;\n}\n\nexport function js_get_module_ns(ctx: JSContext, m: JSModuleDef): JSValue {\n if (m.module_ns === undefined) {\n const ns = js_build_module_ns(ctx, m);\n if (JS_IsException(ns)) return ns;\n m.module_ns = ns;\n }\n return m.module_ns;\n}\n\n/* the namespace object of a module that has been linked */\nexport function JS_GetModuleNamespace(ctx: JSContext, m: JSModuleDef): JSValue {\n return js_get_module_ns(ctx, m);\n}\n\n/* ---------------------------------------------------------------------\n Evaluation (js_inner_module_evaluation and the asynchronous completion)\n --------------------------------------------------------------------- */\n\n/* run a module without top-level await: 0, or -1 with the error in out.error */\nfunction js_execute_sync_module(ctx: JSContext, m: JSModuleDef, out: { error: JSValue }): number {\n if (m.kind !== JSModuleKind.JS) {\n for (const me of m.export_entries) me.var_ref!.set(m.synthetic_exports!.get(me.export_name));\n return 0;\n }\n const promise = JS_Call(ctx, m.func_obj, undefined, []);\n if (JS_IsException(promise)) { out.error = js_take_exception(ctx); return -1; }\n const state = JS_PromiseState(ctx, promise);\n if (state === JSPromiseState.FULFILLED) return 0;\n if (state === JSPromiseState.REJECTED) {\n out.error = JS_PromiseResult(ctx, promise);\n /* the rejection is reported through the module's own promise */\n perform_promise_then(ctx, promise, [undefined, undefined], [undefined, undefined]);\n return -1;\n }\n out.error = throw_type_error(ctx, 'promise is pending');\n return -1;\n}\n\nfunction js_execute_async_module(ctx: JSContext, m: JSModuleDef): void {\n const promise = JS_Call(ctx, m.func_obj, undefined, []);\n if (JS_IsException(promise)) {\n js_async_module_execution_rejected(ctx, m, js_take_exception(ctx));\n return;\n }\n const on_fulfilled = JS_NewCFunction(ctx, () => { js_async_module_execution_fulfilled(ctx, m); return undefined; }, '', 0);\n const on_rejected = JS_NewCFunction(ctx, (_c, _t, argv) => { js_async_module_execution_rejected(ctx, m, argv[0]); return undefined; }, '', 1);\n perform_promise_then(ctx, promise, [on_fulfilled, on_rejected], [undefined, undefined]);\n}\n\nfunction js_inner_module_evaluation(ctx: JSContext, m: JSModuleDef, index: number, stack: { top: JSModuleDef | null },\n out: { error: JSValue }): number {\n if (m.status === JSModuleStatus.EVALUATING_ASYNC || m.status === JSModuleStatus.EVALUATED) {\n if (m.eval_has_exception) { out.error = m.eval_exception; return -1; }\n return index;\n }\n if (m.status === JSModuleStatus.EVALUATING) return index;\n m.status = JSModuleStatus.EVALUATING;\n m.dfs_index = index;\n m.dfs_ancestor_index = index;\n m.pending_async_dependencies = 0;\n index++;\n /* push 'm' on stack */\n m.stack_prev = stack.top;\n stack.top = m;\n\n for (const rme of m.req_module_entries) {\n let m1 = rme.module!;\n index = js_inner_module_evaluation(ctx, m1, index, stack, out);\n if (index < 0) return -1;\n if (m1.status === JSModuleStatus.EVALUATING) {\n m.dfs_ancestor_index = Math.min(m.dfs_ancestor_index, m1.dfs_ancestor_index);\n } else {\n m1 = m1.cycle_root!;\n if (m1.eval_has_exception) { out.error = m1.eval_exception; return -1; }\n }\n if (m1.async_evaluation) {\n m.pending_async_dependencies++;\n m1.async_parent_modules.push(m);\n }\n }\n\n if (m.pending_async_dependencies > 0) {\n m.async_evaluation = true;\n m.async_evaluation_timestamp = ctx.rt.module_async_evaluation_next_timestamp++;\n } else if (m.has_tla) {\n m.async_evaluation = true;\n m.async_evaluation_timestamp = ctx.rt.module_async_evaluation_next_timestamp++;\n js_execute_async_module(ctx, m);\n } else {\n if (js_execute_sync_module(ctx, m, out) < 0) return -1;\n }\n\n if (m.dfs_index === m.dfs_ancestor_index) {\n for (;;) {\n /* pop m1 from stack */\n const m1: JSModuleDef = stack.top!;\n stack.top = m1.stack_prev;\n m1.status = m1.async_evaluation ? JSModuleStatus.EVALUATING_ASYNC : JSModuleStatus.EVALUATED;\n m1.cycle_root = m;\n if (m1 === m) break;\n }\n }\n return index;\n}\n\n/* Run the module function of the module and of all its requested modules. Returns a\n promise (or an exception) */\nfunction js_evaluate_module(ctx: JSContext, m: JSModuleDef): JSValue {\n if (m.status === JSModuleStatus.EVALUATING_ASYNC || m.status === JSModuleStatus.EVALUATED) m = m.cycle_root!;\n /* a promise may be created only on the cycle_root of a cycle */\n if (m.promise !== undefined) return m.promise;\n const funcs: [JSValue, JSValue] = [undefined, undefined];\n const promise = JS_NewPromiseCapability(ctx, funcs);\n if (JS_IsException(promise)) return promise;\n m.promise = promise;\n m.resolving_funcs = funcs;\n const stack = { top: null as JSModuleDef | null };\n const out = { error: undefined as JSValue };\n if (js_inner_module_evaluation(ctx, m, 0, stack, out) < 0) {\n while (stack.top !== null) {\n const m1 = stack.top;\n m1.status = JSModuleStatus.EVALUATED;\n m1.eval_has_exception = true;\n m1.eval_exception = out.error;\n m1.cycle_root = m;\n stack.top = m1.stack_prev;\n }\n JS_Call(ctx, m.resolving_funcs[1], undefined, [m.eval_exception]);\n } else if (!m.async_evaluation) {\n JS_Call(ctx, m.resolving_funcs[0], undefined, [undefined]);\n }\n return m.promise;\n}\n\nfunction js_set_module_evaluated(ctx: JSContext, m: JSModuleDef): void {\n m.status = JSModuleStatus.EVALUATED;\n if (m.promise !== undefined) JS_Call(ctx, m.resolving_funcs[0], undefined, [undefined]);\n}\n\n/* the async parents of a module whose evaluation finished, ready to run */\nfunction gather_available_ancestors(module: JSModuleDef, exec_list: JSModuleDef[]): void {\n for (const m of module.async_parent_modules) {\n if (!exec_list.includes(m) && !m.cycle_root!.eval_has_exception) {\n m.pending_async_dependencies--;\n if (m.pending_async_dependencies === 0) {\n exec_list.push(m);\n if (!m.has_tla) gather_available_ancestors(m, exec_list);\n }\n }\n }\n}\n\nfunction js_async_module_execution_rejected(ctx: JSContext, module: JSModuleDef, error: JSValue): void {\n if (module.status === JSModuleStatus.EVALUATED) return;\n module.eval_has_exception = true;\n module.eval_exception = error;\n module.status = JSModuleStatus.EVALUATED;\n module.async_evaluation = false;\n for (const m of module.async_parent_modules) js_async_module_execution_rejected(ctx, m, error);\n if (module.promise !== undefined) JS_Call(ctx, module.resolving_funcs[1], undefined, [error]);\n}\n\nfunction js_async_module_execution_fulfilled(ctx: JSContext, module: JSModuleDef): void {\n if (module.status === JSModuleStatus.EVALUATED) return;\n module.async_evaluation = false;\n js_set_module_evaluated(ctx, module);\n const exec_list: JSModuleDef[] = [];\n gather_available_ancestors(module, exec_list);\n /* sort by increasing async_evaluation timestamp */\n exec_list.sort((a, b) => a.async_evaluation_timestamp - b.async_evaluation_timestamp);\n for (const m of exec_list) {\n if (m.status === JSModuleStatus.EVALUATED) continue; /* rejected meanwhile */\n if (m.has_tla) {\n js_execute_async_module(ctx, m);\n } else {\n const out = { error: undefined as JSValue };\n if (js_execute_sync_module(ctx, m, out) < 0) {\n js_async_module_execution_rejected(ctx, m, out.error);\n } else {\n m.async_evaluation = false;\n js_set_module_evaluated(ctx, m);\n }\n }\n }\n}\n\n/* ---------------------------------------------------------------------\n Running modules\n --------------------------------------------------------------------- */\n\n/* link and evaluate a module whose graph is loaded: the evaluation promise, or an exception */\nfunction js_link_and_evaluate(ctx: JSContext, m: JSModuleDef): JSValue {\n if (js_create_module_function(ctx, m) < 0) return JS_EXCEPTION;\n if (js_link_module(ctx, m) < 0) return JS_EXCEPTION;\n return js_evaluate_module(ctx, m);\n}\n\n/* Load the graph of `m`, link and evaluate it, then call `ok(ns)` or `fail(error)` */\nfunction js_run_module(ctx: JSContext, m: JSModuleDef, ok: (ns: JSValue) => void, fail: (e: JSValue) => void): void {\n js_load_graph(ctx, m, err => {\n if (err !== undefined) { fail(err); return; }\n const p = js_link_and_evaluate(ctx, m);\n if (JS_IsException(p)) { fail(js_take_exception(ctx)); return; }\n const on_ful = JS_NewCFunction(ctx, () => {\n const ns = js_get_module_ns(ctx, m);\n if (JS_IsException(ns)) fail(js_take_exception(ctx)); else ok(ns);\n return undefined;\n }, '', 0);\n const on_rej = JS_NewCFunction(ctx, (_c, _t, argv) => { fail(argv[0]); return undefined; }, '', 1);\n perform_promise_then(ctx, p, [on_ful, on_rej], [undefined, undefined]);\n });\n}\n\n/* JS_EvalFunction of a compiled module (and JS_Eval of a module): with a loader that\n answers synchronously, this is QuickJS's behaviour (load or link errors are thrown, the\n result is the evaluation promise); otherwise a promise that settles with the evaluation */\nfunction js_module_eval_function(ctx: JSContext, m: JSModuleDef): JSValue {\n js_register_module(ctx, m);\n let sync = true;\n let result: JSValue = undefined;\n let error: JSValue = undefined;\n let has_error = false;\n let funcs: [JSValue, JSValue] | null = null;\n let promise: JSValue = undefined;\n js_load_graph(ctx, m, err => {\n if (sync) {\n if (err !== undefined) { has_error = true; error = err; return; }\n result = js_link_and_evaluate(ctx, m);\n return;\n }\n if (err !== undefined) { JS_Call(ctx, funcs![1], undefined, [err]); return; }\n const p = js_link_and_evaluate(ctx, m);\n if (JS_IsException(p)) { JS_Call(ctx, funcs![1], undefined, [js_take_exception(ctx)]); return; }\n JS_Call(ctx, funcs![0], undefined, [p]);\n });\n if (has_error) return JS_Throw(ctx, error);\n if (result !== undefined) return result;\n /* still loading */\n sync = false;\n funcs = [undefined, undefined];\n promise = JS_NewPromiseCapability(ctx, funcs);\n return promise;\n}\n\nfunction js_new_promise(ctx: JSContext): { promise: JSValue; resolve: (v: JSValue) => void; reject: (e: JSValue) => void } {\n const funcs: [JSValue, JSValue] = [undefined, undefined];\n const promise = JS_NewPromiseCapability(ctx, funcs);\n return {\n promise,\n resolve: v => { JS_Call(ctx, funcs[0], undefined, [v]); },\n reject: e => { JS_Call(ctx, funcs[1], undefined, [e]); },\n };\n}\n\n/* Evaluate `source` as a module named `url`: a promise for its namespace object. `flags` may hold\n JS_EVAL_FLAG_STRIP_TYPES and JS_EVAL_FLAG_JSX */\nexport function JS_EvalModule(ctx: JSContext, source: string, url: string, flags = 0): JSValue {\n const p = js_new_promise(ctx);\n const v = hooks.JS_EvalInternal(ctx, undefined, source, url, JS_EVAL_TYPE_MODULE | JS_EVAL_FLAG_COMPILE_ONLY |\n (flags & (JS_EVAL_FLAG_STRIP_TYPES | JS_EVAL_FLAG_JSX)), -1);\n if (JS_IsException(v)) { p.reject(js_take_exception(ctx)); return p.promise; }\n const m = v as unknown as JSModuleDef;\n js_register_module(ctx, m);\n js_run_module(ctx, m, p.resolve, p.reject);\n return p.promise;\n}\n\n/* import(specifier) from the host: a promise for the namespace object */\nexport function JS_ImportModule(ctx: JSContext, specifier: string, referrer: string | null = null,\n attributes: Record<string, string> | null = null): JSValue {\n const p = js_new_promise(ctx);\n js_import(ctx, specifier, referrer, attributes, p.resolve, p.reject);\n return p.promise;\n}\n\nfunction js_import(ctx: JSContext, specifier: string, referrer: string | null, attributes: Record<string, string> | null,\n ok: (ns: JSValue) => void, fail: (e: JSValue) => void): void {\n const kind = js_request_kind(ctx, attributes);\n if (kind !== 'js' && kind !== 'json') { fail(kind); return; }\n const attrs = attributes ?? {};\n let id: string;\n try { id = js_resolve_specifier(ctx, specifier, referrer, attrs); } catch (e) { fail(caught(ctx, e)); return; }\n js_fetch_module(ctx, specifier, id, kind, attrs, (err, m) => {\n if (err !== undefined) { fail(err); return; }\n js_run_module(ctx, m!, ok, fail);\n });\n}\n\n/* the name a function's code is known by: its module's id, or its script's file name */\nfunction js_referrer_of(ctx: JSContext, b: JSFunctionBytecode | null): string | null {\n if (b === null) return null;\n if (b.module !== null) return mname(ctx, b.module);\n if (b.has_debug && b.debug.filename) return JS_AtomGetStr(ctx, b.debug.filename);\n return null;\n}\n\n/* import(specifier, options) */\nfunction js_dynamic_import(ctx: JSContext, b: JSFunctionBytecode | null, specifier: JSValue, options: JSValue): JSValue {\n const p = js_new_promise(ctx);\n if (JS_IsException(p.promise)) return p.promise;\n const reject_now = (): JSValue => { p.reject(js_take_exception(ctx)); return p.promise; };\n /* the string conversion must occur here */\n const spec = JS_ToString(ctx, specifier);\n if (JS_IsException(spec)) return reject_now();\n let attributes: Record<string, string> | null = null;\n if (options !== undefined) {\n if (!JS_IsObject(options)) { JS_ThrowTypeError(ctx, 'options must be an object'); return reject_now(); }\n const with_obj = JS_GetPropertyStr(ctx, options, 'with');\n if (JS_IsException(with_obj)) return reject_now();\n if (with_obj !== undefined) {\n if (!JS_IsObject(with_obj)) { JS_ThrowTypeError(ctx, 'options.with must be an object'); return reject_now(); }\n attributes = Object.create(null);\n let keys: PropertyKey[];\n try { keys = Reflect.ownKeys(with_obj as object); } catch (e) { p.reject(host_error_to_guest(ctx, e)); return p.promise; }\n for (const k of keys) {\n if (typeof k !== 'string') continue;\n let d: PropertyDescriptor | undefined;\n try { d = Reflect.getOwnPropertyDescriptor(with_obj as object, k); } catch (e) { p.reject(host_error_to_guest(ctx, e)); return p.promise; }\n if (!d || !d.enumerable) continue;\n const v = JS_GetPropertyStr(ctx, with_obj, k);\n if (JS_IsException(v)) return reject_now();\n if (typeof v !== 'string') { JS_ThrowTypeError(ctx, 'module attribute values must be strings'); return reject_now(); }\n attributes![k] = v;\n }\n }\n }\n const kind = js_request_kind(ctx, attributes);\n if (kind !== 'js' && kind !== 'json') { p.reject(kind); return p.promise; }\n const referrer = js_referrer_of(ctx, b);\n /* not run synchronously: it could recurse into js_evaluate_module() */\n JS_EnqueueJob(ctx, () => {\n js_import(ctx, spec as string, referrer, attributes, p.resolve, p.reject);\n return undefined;\n }, []);\n return p.promise;\n}\n\n/* import.meta: a null-prototype object with `url` and `resolve` */\nfunction js_import_meta(ctx: JSContext, b: JSFunctionBytecode | null): JSValue {\n const m = b?.module ?? null;\n if (m === null) return JS_ThrowTypeError(ctx, 'import.meta not supported in this context');\n if (m.meta_obj === undefined) {\n const meta = JS_NewObjectProto(ctx, null);\n if (JS_IsException(meta)) return meta;\n const id = mname(ctx, m);\n JS_DefinePropertyValueStr(ctx, meta, 'url', m.url ?? id, JS_PROP_C_W_E);\n const resolve = JS_NewCFunction(ctx, (c, _t, argv) => {\n const spec = JS_ToString(c, argv[0]);\n if (JS_IsException(spec)) return spec;\n try {\n return js_resolve_specifier(c, spec as string, id, {});\n } catch (e) {\n return JS_Throw(c, caught(c, e));\n }\n }, 'resolve', 1);\n JS_DefinePropertyValueStr(ctx, meta, 'resolve', resolve, JS_PROP_C_W_E);\n m.meta_obj = meta;\n }\n return m.meta_obj;\n}\n\nhooks.js_module_compiled = js_module_compiled;\nhooks.js_dynamic_import = js_dynamic_import;\nhooks.js_import_meta = js_import_meta;\nhooks.js_module_eval_function = js_module_eval_function;\n"]}
1
+ {"version":3,"file":"module.js","sourceRoot":"","sources":["../src/module.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,OAAO,EAC6C,YAAY,EAAE,gBAAgB,EAAE,cAAc,EAAE,WAAW,EAC7G,UAAU,EAAE,aAAa,EAAE,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,WAAW,EAAE,QAAQ,EACzF,iBAAiB,EAAE,mBAAmB,EAAE,sBAAsB,EAAE,iBAAiB,EAAE,yBAAyB,EAC5G,iBAAiB,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,cAAc,EAAE,0BAA0B,EAAE,KAAK,EAC3G,aAAa,EAAE,eAAe,EAAE,cAAc,EAC9C,mBAAmB,EAAE,yBAAyB,EAAE,wBAAwB,EAAE,gBAAgB,GAC3F,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,WAAW,EAAkB,aAAa,EAA8B,kBAAkB,EAChE,gBAAgB,GAC3C,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AACxD,OAAO,EAAE,uBAAuB,EAAE,eAAe,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AACzH,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAyBhD;;;8EAG8E;AAC9E,MAAM,UAAU,iBAAiB,CAAC,EAAU;IAC1C,MAAM,IAAI,GAAG,sBAAsB,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,OAAO,CAAC,UAAU,EAAE,EAAE,CAAC,CAAC,CAAC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,CAAC,CAAC,CAAC;YACnC,CAAC;QACH,CAAC,EAAE,SAAS,EAAE,CAAC,CAAC,CAAC;QACjB,yBAAyB,CAAC,GAAG,EAAE,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,aAAa,CAAC,CAAC;QACxE,CAAC,CAAC,QAAQ,GAAG,IAAI,CAAC;IACpB,CAAC;IACD,OAAO,CAAC,CAAC,QAAQ,CAAC;AACpB,CAAC;AAED,KAAK,CAAC,kBAAkB,GAAG,kBAAkB,CAAC;AAC9C,KAAK,CAAC,iBAAiB,GAAG,iBAAiB,CAAC;AAC5C,KAAK,CAAC,cAAc,GAAG,cAAc,CAAC;AACtC,KAAK,CAAC,uBAAuB,GAAG,uBAAuB,CAAC","sourcesContent":["/*\n * ES modules: loading, linking, evaluation (with top-level await), module\n * namespace objects, dynamic import() and import.meta.\n *\n * Ported from quickjs.c (js_create_module_function, js_inner_module_linking,\n * js_resolve_export, js_build_module_ns, js_inner_module_evaluation,\n * js_async_module_execution_fulfilled/rejected, js_dynamic_import), with one\n * change of shape: QuickJS asks a synchronous loader for each module while it\n * resolves the graph, but a browser fetches asynchronously, so here the whole\n * graph is fetched first (in parallel where the loader allows), and linking and\n * evaluation run once every module is there. A loader that answers\n * synchronously makes the whole sequence synchronous.\n *\n * The sandbox stays closed by default: with no loader set, nothing can be\n * imported. The embedder's loader decides what a specifier means.\n */\nimport {\n JSContext, JSRuntime, JSValue, JSAtom, JSClassID, JS_EXCEPTION, JS_UNINITIALIZED, JS_IsException, JS_IsObject,\n JS_NewAtom, JS_AtomGetStr, JS_Call, JS_NewCFunction, JS_EnqueueJob, JS_ToString, JS_Throw,\n JS_ThrowTypeError, JS_ThrowSyntaxError, JS_ThrowReferenceError, JS_NewObjectProto, JS_DefinePropertyValueStr,\n JS_GetPropertyStr, JS_GetFunctionData, js_take_exception, js_ensure_meta, js_host_exception_to_guest, hooks,\n JS_PROP_C_W_E, JS_ATOM_default, JS_ATOM__star_,\n JS_EVAL_TYPE_MODULE, JS_EVAL_FLAG_COMPILE_ONLY, JS_EVAL_FLAG_STRIP_TYPES, JS_EVAL_FLAG_JSX,\n} from './quickjs.ts';\nimport {\n JSModuleDef, JSModuleStatus, JSExportEntry, JSExportType, JSModuleKind, JSFunctionBytecode,\n JSVarRef, JSPromiseState, new_var_ref_cell,\n} from './values.ts';\nimport { js_closure_from_refs } from './interpreter.ts';\nimport { JS_NewPromiseCapability, JS_PromiseState, JS_PromiseResult, perform_promise_then } from './builtins/promise.ts';\nimport { JS_ParseJSON } from './builtins/json.ts';\nimport { toGuest, drainJobs } from './embed.ts';\n\n/* ---------------------------------------------------------------------\n The embedder's loader\n --------------------------------------------------------------------- */\n\n/* what a loader returns for a module id */\nexport interface JSModuleSource {\n /* JavaScript (or TypeScript, or JSON) source text */\n source?: string;\n /* bytecode written by JS_WriteObject for a compiled module */\n bytecode?: Uint8Array;\n /* import.meta.url (defaults to the id) */\n url?: string;\n /* 'js' (default), 'ts' (stripped like JS_EVAL_FLAG_STRIP_TYPES; also chosen by a .ts, .mts or\n .cts id), 'jsx' (JSX compiled like JS_EVAL_FLAG_JSX; also chosen by a .jsx id), 'tsx' (both;\n also chosen by a .tsx id), or 'json' (only for imports `with { type: \"json\" }`) */\n type?: JSModuleSourceType;\n /* a host module: its exports as host values, marshalled into the guest with toGuest()\n (`default` is the default export) */\n exports?: Record<string, unknown>;\n}\nexport type JSModuleLoadResult = string | Uint8Array | JSModuleSource;\nexport type JSModuleSourceType = 'js' | 'ts' | 'jsx' | 'tsx' | 'json';\n\n/* the source type an id implies: .ts, .mts and .cts are TypeScript, .tsx TSX, .jsx JSX. When the\n id is a URL (it has a scheme), its query and fragment are not part of the path, so\n `https://app/App.tsx?v=3` and `file:///a.ts#x` are TSX and TypeScript; other ids (file paths)\n are matched as they are, since `?` and `#` are ordinary characters there */\nexport function js_module_type_of(id: string): 'js' | 'ts' | 'jsx' | 'tsx' {\n const path = /^[a-z][a-z0-9+.-]*:/i.test(id) ? id.replace(/[?#].*$/s, '') : id;\n return /\\.[mc]?ts$/.test(path) ? 'ts' : /\\.tsx$/.test(path) ? 'tsx' : /\\.jsx$/.test(path) ? 'jsx' : 'js';\n}\n\n/* the JS_Eval flags that compile a source type */\nexport function js_module_type_flags(type: string): number {\n return (type === 'ts' || type === 'tsx' ? JS_EVAL_FLAG_STRIP_TYPES : 0) | (type === 'jsx' || type === 'tsx' ? JS_EVAL_FLAG_JSX : 0);\n}\n\nexport interface JSModuleLoader {\n /* the normalized id of `specifier` imported from `referrer` (the importing module's id, a\n script's file name, or null from the host). Default: URL-style resolution of relative\n specifiers (`./`, `../`, `/`) against the referrer; other specifiers are kept as they are */\n resolve?(specifier: string, referrer: string | null, attributes: Record<string, string>): string;\n /* the module for an id: its source, bytecode or host exports, or a promise of them */\n load(id: string, attributes: Record<string, string>): JSModuleLoadResult | PromiseLike<JSModuleLoadResult>;\n}\n\n/* Set (or clear, with null) the module loader of a runtime */\nexport function JS_SetModuleLoader(rt: JSRuntime, loader: JSModuleLoader | null): void {\n rt.module_loader = loader;\n}\n\n/* the default resolution: relative specifiers against the referrer, URL style */\nexport function js_default_module_resolve(specifier: string, referrer: string | null): string {\n if (!(specifier.startsWith('./') || specifier.startsWith('../') || specifier.startsWith('/'))) return specifier;\n if (referrer === null) return normalize_path(specifier);\n if (/^[a-zA-Z][a-zA-Z0-9+.-]*:/.test(referrer)) {\n try { return new URL(specifier, referrer).href; } catch { /* not a URL: fall through */ }\n }\n if (specifier.startsWith('/')) return normalize_path(specifier);\n const slash = referrer.lastIndexOf('/');\n const dir = slash >= 0 ? referrer.slice(0, slash + 1) : '';\n return normalize_path(dir + specifier);\n}\n\n/* collapse `.` and `..` segments of a path */\nfunction normalize_path(path: string): string {\n const abs = path.startsWith('/');\n const out: string[] = [];\n for (const seg of path.split('/')) {\n if (seg === '' || seg === '.') continue;\n if (seg === '..') {\n if (out.length > 0 && out[out.length - 1] !== '..') out.pop();\n else if (!abs) out.push('..');\n continue;\n }\n out.push(seg);\n }\n const r = out.join('/');\n return abs ? '/' + r : r;\n}\n\n/* QuickJS's JS_DetectModule heuristic: after comments, the source starts with `export`, or\n with `import` not followed by `(` or `.` */\nexport function JS_DetectModule(input: string): boolean {\n let p = 0;\n const n = input.length;\n if (input.startsWith('#!')) { while (p < n && input[p] !== '\\n') p++; }\n const skip = (): void => {\n for (;;) {\n while (p < n && /\\s/.test(input[p])) p++;\n if (input.startsWith('//', p)) { while (p < n && input[p] !== '\\n') p++; continue; }\n if (input.startsWith('/*', p)) { const e = input.indexOf('*/', p + 2); p = e < 0 ? n : e + 2; continue; }\n break;\n }\n };\n const word = (): string => { const m = /^[A-Za-z_$][\\w$]*/.exec(input.slice(p, p + 32)); return m ? m[0] : ''; };\n skip();\n const w = word();\n if (w === 'export') return true;\n if (w !== 'import') return false;\n p += 6;\n skip();\n return !(input[p] === '(' || input[p] === '.');\n}\n\n/* ---------------------------------------------------------------------\n Errors\n --------------------------------------------------------------------- */\n\nfunction throw_type_error(ctx: JSContext, msg: string): JSValue {\n JS_ThrowTypeError(ctx, msg);\n return js_take_exception(ctx);\n}\nfunction throw_syntax_error(ctx: JSContext, msg: string): JSValue {\n JS_ThrowSyntaxError(ctx, msg);\n return js_take_exception(ctx);\n}\n\n/* a value thrown by the embedder's loader, as a guest value */\nfunction host_error_to_guest(ctx: JSContext, e: unknown): JSValue {\n try { return toGuest(ctx, e); } catch { return throw_type_error(ctx, String(e)); }\n}\n\n/* a value caught in this file, in the engine's convention: guest values pass through, host\n errors become guest errors */\nfunction caught(ctx: JSContext, e: unknown): JSValue {\n js_host_exception_to_guest(ctx, e);\n return js_take_exception(ctx);\n}\n\nfunction mname(ctx: JSContext, m: JSModuleDef): string { return JS_AtomGetStr(ctx, m.module_name); }\n\n/* ---------------------------------------------------------------------\n Compiled modules\n --------------------------------------------------------------------- */\n\n/* every function of a module knows its module (import.meta, the referrer of import()) */\nfunction js_mark_module_functions(b: JSFunctionBytecode, m: JSModuleDef): void {\n b.module = m;\n for (const c of b.cpool) if (c instanceof JSFunctionBytecode) js_mark_module_functions(c, m);\n}\n\n/* the module record of a compiled module body */\nexport function js_module_set_function(m: JSModuleDef, b: JSFunctionBytecode): void {\n m.func_bytecode = b;\n js_mark_module_functions(b, m);\n}\n\n/* called by the parser for JS_EVAL_TYPE_MODULE */\nfunction js_module_compiled(ctx: JSContext, m: JSModuleDef, b: JSFunctionBytecode, flags: number): JSValue {\n js_module_set_function(m, b);\n if (flags & JS_EVAL_FLAG_COMPILE_ONLY) return m as unknown as JSValue;\n return js_module_eval_function(ctx, m);\n}\n\nfunction module_key(id: string, kind: 'js' | 'json'): string {\n return kind === 'json' ? id + '\\u0000json' : id;\n}\n\n/* register a root module (JS_Eval, JS_EvalFunction) under its name, if the name is free */\nfunction js_register_module(ctx: JSContext, m: JSModuleDef): void {\n const key = module_key(mname(ctx, m), m.kind === JSModuleKind.JSON ? 'json' : 'js');\n if (!ctx.module_map.has(key)) ctx.module_map.set(key, m);\n}\n\n/* a synthetic module (JSON or host values) with the given named exports */\nfunction js_new_synthetic_module(ctx: JSContext, id: string, kind: JSModuleKind, exports: Map<string, JSValue>): JSModuleDef {\n const m = new JSModuleDef(JS_NewAtom(ctx, id));\n m.kind = kind;\n m.realm = ctx;\n m.synthetic_exports = new Map();\n for (const [name, v] of exports) {\n const atom = JS_NewAtom(ctx, name);\n m.export_entries.push(new JSExportEntry(atom, atom, JSExportType.LOCAL));\n m.synthetic_exports.set(atom, v);\n }\n return m;\n}\n\n/* the module for what the loader returned; throws a guest value on failure */\nfunction js_module_from_load_result(ctx: JSContext, id: string, kind: 'js' | 'json', r: JSModuleLoadResult): JSModuleDef {\n let src: JSModuleSource;\n if (typeof r === 'string') src = { source: r };\n else if (r instanceof Uint8Array) src = { bytecode: r };\n else if (r !== null && typeof r === 'object') src = r;\n else throw throw_type_error(ctx, `the module loader returned no module for '${id}'`);\n\n if (src.exports !== undefined) {\n if (kind === 'json') throw throw_type_error(ctx, `'${id}' is a host module, not a JSON module`);\n const exports = new Map<string, JSValue>();\n for (const k of Object.keys(src.exports)) {\n try { exports.set(k, toGuest(ctx, src.exports[k])); }\n catch (e) { throw host_error_to_guest(ctx, e); }\n }\n const m = js_new_synthetic_module(ctx, id, JSModuleKind.HOST, exports);\n m.url = src.url ?? null;\n return m;\n }\n const type = src.type ?? (src.bytecode ? 'js' : js_module_type_of(id));\n if (kind === 'json' || type === 'json') {\n if (kind !== 'json') throw throw_type_error(ctx, `'${id}' is a JSON module: import it with { type: \"json\" }`);\n if (type !== 'json' && src.type !== undefined) throw throw_type_error(ctx, `'${id}' is not a JSON module`);\n if (typeof src.source !== 'string') throw throw_type_error(ctx, `the module loader returned no JSON source for '${id}'`);\n const v = JS_ParseJSON(ctx, src.source, id);\n if (JS_IsException(v)) throw js_take_exception(ctx);\n const m = js_new_synthetic_module(ctx, id, JSModuleKind.JSON, new Map([['default', v]]));\n m.url = src.url ?? null;\n return m;\n }\n let m: JSModuleDef;\n if (src.bytecode !== undefined) {\n const read = hooks_bytecode.read;\n if (read === null) throw throw_type_error(ctx, 'bytecode modules are not supported in this build');\n const v = read(ctx, src.bytecode);\n if (JS_IsException(v)) throw js_take_exception(ctx);\n if (!(v instanceof JSModuleDef)) throw throw_type_error(ctx, `the bytecode for '${id}' is not a module`);\n m = v;\n /* the module takes the id it was loaded under */\n m.module_name = JS_NewAtom(ctx, id);\n } else {\n if (typeof src.source !== 'string') throw throw_type_error(ctx, `the module loader returned no source for '${id}'`);\n const flags = JS_EVAL_TYPE_MODULE | JS_EVAL_FLAG_COMPILE_ONLY | js_module_type_flags(type);\n const v = hooks.JS_EvalInternal(ctx, undefined, src.source, id, flags, -1);\n if (JS_IsException(v)) throw js_take_exception(ctx);\n m = v as unknown as JSModuleDef;\n }\n m.url = src.url ?? null;\n return m;\n}\n\n/* set by src/bytecode.ts: read a compiled module from bytes */\nexport const hooks_bytecode: { read: ((ctx: JSContext, bytes: Uint8Array) => JSValue) | null } = { read: null };\n\n/* ---------------------------------------------------------------------\n Fetching the module graph\n --------------------------------------------------------------------- */\n\ntype LoadCallback = (err: JSValue | undefined, m: JSModuleDef | null) => void;\n\ninterface InflightLoad { waiters: LoadCallback[] }\n\n/* the module type a request asks for, or a guest error */\nfunction js_request_kind(ctx: JSContext, attrs: Record<string, string> | null): 'js' | 'json' | JSValue {\n if (attrs === null) return 'js';\n for (const k of Object.keys(attrs)) {\n if (k !== 'type') return throw_syntax_error(ctx, `unsupported import attribute '${k}'`);\n }\n const t = attrs.type;\n if (t === undefined) return 'js';\n if (t === 'json') return 'json';\n return throw_type_error(ctx, `unsupported module type '${t}'`);\n}\n\nfunction js_resolve_specifier(ctx: JSContext, specifier: string, referrer: string | null,\n attrs: Record<string, string>): string {\n const loader = ctx.rt.module_loader as JSModuleLoader | null;\n if (loader === null) throw throw_type_error(ctx, `cannot import '${specifier}': no module loader is set`);\n let id: unknown;\n try {\n id = loader.resolve ? loader.resolve(specifier, referrer, attrs) : js_default_module_resolve(specifier, referrer);\n } catch (e) {\n throw host_error_to_guest(ctx, e);\n }\n if (typeof id !== 'string') throw throw_type_error(ctx, `the module loader could not resolve '${specifier}'`);\n return id;\n}\n\n/* the module for `id`: from the context's map, or fetched with the loader. `cb` runs once,\n synchronously if the module is there or the loader answers synchronously */\nfunction js_fetch_module(ctx: JSContext, specifier: string, id: string, kind: 'js' | 'json',\n attrs: Record<string, string>, cb: LoadCallback): void {\n const key = module_key(id, kind);\n const existing = ctx.module_map.get(key) as JSModuleDef | undefined;\n if (existing !== undefined) { cb(undefined, existing); return; }\n const inflight = ctx.module_inflight.get(key) as InflightLoad | undefined;\n if (inflight !== undefined) { inflight.waiters.push(cb); return; }\n const loader = ctx.rt.module_loader as JSModuleLoader | null;\n if (loader === null) { cb(throw_type_error(ctx, `cannot import '${specifier}': no module loader is set`), null); return; }\n const entry: InflightLoad = { waiters: [cb] };\n ctx.module_inflight.set(key, entry);\n let is_async = false;\n const settle = (err: JSValue | undefined, m: JSModuleDef | null): void => {\n ctx.module_inflight.delete(key);\n if (m !== null) ctx.module_map.set(key, m);\n for (const w of entry.waiters) w(err, m);\n /* a load that finished in a host callback: run the guest jobs it started */\n if (is_async) drainJobs(ctx);\n };\n const done = (r: JSModuleLoadResult): void => {\n let m: JSModuleDef;\n try {\n m = js_module_from_load_result(ctx, id, kind, r);\n } catch (e) {\n settle(caught(ctx, e), null);\n return;\n }\n settle(undefined, m);\n };\n let r: JSModuleLoadResult | PromiseLike<JSModuleLoadResult>;\n try {\n r = loader.load(id, attrs);\n } catch (e) {\n settle(host_error_to_guest(ctx, e), null);\n return;\n }\n if (r !== null && typeof r === 'object' && typeof (r as PromiseLike<unknown>).then === 'function') {\n is_async = true;\n (r as PromiseLike<JSModuleLoadResult>).then(done, e => settle(host_error_to_guest(ctx, e), null));\n } else {\n done(r as JSModuleLoadResult);\n }\n}\n\n/* Make sure every request of `root`, transitively, has its module. `cb(err)` runs once; it\n runs synchronously when every module was already loaded or loaded synchronously */\nfunction js_load_graph(ctx: JSContext, root: JSModuleDef, cb: (err: JSValue | undefined) => void): void {\n let pending = 0;\n let finished = false;\n const visited = new Set<JSModuleDef>();\n const fail = (err: JSValue): void => { if (!finished) { finished = true; cb(err); } };\n const one_done = (): void => { if (--pending === 0 && !finished) { finished = true; cb(undefined); } };\n const visit = (m: JSModuleDef): void => {\n if (visited.has(m) || finished) return;\n visited.add(m);\n const referrer = mname(ctx, m);\n for (const rme of m.req_module_entries) {\n if (finished) return;\n if (rme.module !== null) { visit(rme.module); continue; }\n const specifier = JS_AtomGetStr(ctx, rme.module_name);\n const attrs = rme.attributes ?? {};\n const kind = js_request_kind(ctx, rme.attributes);\n if (kind !== 'js' && kind !== 'json') { fail(kind); return; }\n let id: string;\n try { id = js_resolve_specifier(ctx, specifier, referrer, attrs); } catch (e) { fail(caught(ctx, e)); return; }\n pending++;\n js_fetch_module(ctx, specifier, id, kind, attrs, (err, m1) => {\n if (finished) return;\n if (err !== undefined) { fail(err); return; }\n rme.module = m1;\n visit(m1!);\n one_done();\n });\n }\n };\n pending++;\n visit(root);\n one_done();\n}\n\n/* ---------------------------------------------------------------------\n Module functions and linking (js_create_module_function, js_link_module)\n --------------------------------------------------------------------- */\n\nfunction js_create_module_function(ctx: JSContext, m: JSModuleDef): number {\n if (m.func_created) return 0;\n if (m.kind !== JSModuleKind.JS) {\n /* initialize the exported variables */\n for (const me of m.export_entries) me.var_ref = new_var_ref_cell(undefined);\n } else {\n const b = m.func_bytecode!;\n /* create the module variables; the other variables are imported from other modules */\n const var_refs: (JSVarRef | null)[] = b.closure_var.map(cv =>\n cv.is_local ? new_var_ref_cell(cv.is_lexical ? JS_UNINITIALIZED : undefined) : null);\n const proto = ctx.class_proto[JSClassID.ASYNC_FUNCTION] ?? ctx.function_proto;\n const f = js_closure_from_refs(ctx, b, var_refs as JSVarRef[], proto, false);\n if (JS_IsException(f)) return -1;\n m.func_obj = f;\n }\n m.func_created = true;\n /* do it on the dependencies */\n for (const rme of m.req_module_entries) {\n if (js_create_module_function(ctx, rme.module!) < 0) return -1;\n }\n return 0;\n}\n\nfunction module_var_refs(m: JSModuleDef): JSVarRef[] {\n return JS_GetFunctionData(m.func_obj)!.var_refs as JSVarRef[];\n}\n\n/* the variable of a local export */\nfunction export_var_ref(m: JSModuleDef, me: JSExportEntry): JSVarRef {\n if (me.var_ref === null) me.var_ref = module_var_refs(m)[me.var_idx];\n return me.var_ref;\n}\n\nconst enum ResolveResult { FOUND, NOT_FOUND, CIRCULAR, AMBIGUOUS }\n\n/* a resolved binding: a module variable, or the namespace of a module */\ninterface ResolvedBinding { module: JSModuleDef; me: JSExportEntry; ns: JSModuleDef | null }\n\nfunction same_binding(a: ResolvedBinding, b: ResolvedBinding): boolean {\n if (a.ns !== null || b.ns !== null) return a.ns === b.ns;\n return a.module === b.module && a.me.var_idx === b.me.var_idx && a.me.local_name === b.me.local_name;\n}\n\n/* ResolveExport (js_resolve_export1) */\nfunction js_resolve_export1(m: JSModuleDef, export_name: JSAtom, set: Map<JSModuleDef, Set<JSAtom>>,\n out: { b: ResolvedBinding | null }): ResolveResult {\n out.b = null;\n let names = set.get(m);\n if (names === undefined) { names = new Set(); set.set(m, names); }\n if (names.has(export_name)) return ResolveResult.CIRCULAR;\n names.add(export_name);\n const me = m.export_entries.find(e => e.export_name === export_name) ?? null;\n if (me !== null) {\n if (me.export_type === JSExportType.LOCAL) {\n out.b = { module: m, me, ns: null };\n return ResolveResult.FOUND;\n }\n const m1 = m.req_module_entries[me.req_module_idx].module!;\n if (me.local_name === JS_ATOM__star_) {\n /* export * as ns from */\n out.b = { module: m, me, ns: m1 };\n return ResolveResult.FOUND;\n }\n return js_resolve_export1(m1, me.local_name, set, out);\n }\n if (export_name === JS_ATOM_default) return ResolveResult.NOT_FOUND;\n /* not found in the direct or indirect exports: try the star exports */\n let star: ResolvedBinding | null = null;\n for (const se of m.star_export_entries) {\n const m1 = m.req_module_entries[se.req_module_idx].module!;\n const r = { b: null as ResolvedBinding | null };\n const ret = js_resolve_export1(m1, export_name, set, r);\n if (ret === ResolveResult.AMBIGUOUS) return ret;\n if (ret === ResolveResult.FOUND) {\n if (star !== null) {\n if (!same_binding(star, r.b!)) return ResolveResult.AMBIGUOUS;\n } else {\n star = r.b;\n }\n }\n }\n if (star !== null) { out.b = star; return ResolveResult.FOUND; }\n return ResolveResult.NOT_FOUND;\n}\n\nfunction js_resolve_export(m: JSModuleDef, export_name: JSAtom, out: { b: ResolvedBinding | null }): ResolveResult {\n return js_resolve_export1(m, export_name, new Map(), out);\n}\n\nfunction js_resolve_export_throw_error(ctx: JSContext, res: ResolveResult, m: JSModuleDef, export_name: JSAtom): void {\n const n = JS_AtomGetStr(ctx, export_name), mn = mname(ctx, m);\n switch (res) {\n case ResolveResult.CIRCULAR:\n JS_ThrowSyntaxError(ctx, `circular reference when looking for export '${n}' in module '${mn}'`);\n break;\n case ResolveResult.AMBIGUOUS:\n JS_ThrowSyntaxError(ctx, `export '${n}' in module '${mn}' is ambiguous`);\n break;\n default:\n JS_ThrowSyntaxError(ctx, `Could not find export '${n}' in module '${mn}'`);\n break;\n }\n}\n\n/* the variable a resolved binding reads */\nfunction binding_var_ref(ctx: JSContext, b: ResolvedBinding): JSVarRef | null {\n if (b.ns !== null) {\n const ns = js_get_module_ns(ctx, b.ns);\n if (JS_IsException(ns)) return null;\n return new_var_ref_cell(ns);\n }\n return export_var_ref(b.module, b.me);\n}\n\n/* Prepare a module to be executed by resolving all the imported variables */\nfunction js_inner_module_linking(ctx: JSContext, m: JSModuleDef, stack: { top: JSModuleDef | null }, index: number): number {\n if (m.status === JSModuleStatus.LINKING || m.status === JSModuleStatus.LINKED ||\n m.status === JSModuleStatus.EVALUATING_ASYNC || m.status === JSModuleStatus.EVALUATED) return index;\n m.status = JSModuleStatus.LINKING;\n m.dfs_index = index;\n m.dfs_ancestor_index = index;\n index++;\n /* push 'm' on stack */\n m.stack_prev = stack.top;\n stack.top = m;\n\n for (const rme of m.req_module_entries) {\n const m1 = rme.module!;\n index = js_inner_module_linking(ctx, m1, stack, index);\n if (index < 0) return -1;\n if (m1.status === JSModuleStatus.LINKING) m.dfs_ancestor_index = Math.min(m.dfs_ancestor_index, m1.dfs_ancestor_index);\n }\n\n /* check the indirect exports */\n for (const me of m.export_entries) {\n if (me.export_type === JSExportType.INDIRECT && me.local_name !== JS_ATOM__star_) {\n const m1 = m.req_module_entries[me.req_module_idx].module!;\n const r = { b: null as ResolvedBinding | null };\n const ret = js_resolve_export(m1, me.local_name, r);\n if (ret !== ResolveResult.FOUND) {\n js_resolve_export_throw_error(ctx, ret, m1, me.local_name);\n return -1;\n }\n }\n }\n\n if (m.kind === JSModuleKind.JS) {\n const var_refs = module_var_refs(m);\n for (const mi of m.import_entries) {\n const m1 = m.req_module_entries[mi.req_module_idx].module!;\n if (mi.is_star) {\n /* namespace import */\n const ns = js_get_module_ns(ctx, m1);\n if (JS_IsException(ns)) return -1;\n var_refs[mi.var_idx].set(ns);\n } else {\n const r = { b: null as ResolvedBinding | null };\n const ret = js_resolve_export(m1, mi.import_name, r);\n if (ret !== ResolveResult.FOUND) {\n js_resolve_export_throw_error(ctx, ret, m1, mi.import_name);\n return -1;\n }\n const vr = binding_var_ref(ctx, r.b!);\n if (vr === null) return -1;\n var_refs[mi.var_idx] = vr;\n }\n }\n /* keep the exported variables in the module export entries */\n for (const me of m.export_entries) {\n if (me.export_type === JSExportType.LOCAL) export_var_ref(m, me);\n }\n /* initialize the global variables: with `this` true, the module function only runs its\n hoisted definitions */\n const ret = JS_Call(ctx, m.func_obj, true, []);\n if (JS_IsException(ret)) return -1;\n }\n\n if (m.dfs_index === m.dfs_ancestor_index) {\n for (;;) {\n /* pop m1 from stack */\n const m1: JSModuleDef = stack.top!;\n stack.top = m1.stack_prev;\n m1.status = JSModuleStatus.LINKED;\n if (m1 === m) break;\n }\n }\n return index;\n}\n\nfunction js_link_module(ctx: JSContext, m: JSModuleDef): number {\n const stack = { top: null as JSModuleDef | null };\n if (js_inner_module_linking(ctx, m, stack, 0) < 0) {\n while (stack.top !== null) {\n const m1 = stack.top;\n m1.status = JSModuleStatus.UNLINKED;\n stack.top = m1.stack_prev;\n }\n return -1;\n }\n return 0;\n}\n\n/* ---------------------------------------------------------------------\n Module namespace objects\n --------------------------------------------------------------------- */\n\n/* GetExportedNames */\nfunction get_exported_names(m: JSModuleDef, from_star: boolean, visited: Set<JSModuleDef>, out: JSAtom[]): void {\n if (visited.has(m)) return;\n visited.add(m);\n for (const me of m.export_entries) {\n if (from_star && me.export_name === JS_ATOM_default) continue;\n if (!out.includes(me.export_name)) out.push(me.export_name);\n }\n for (const se of m.star_export_entries) {\n get_exported_names(m.req_module_entries[se.req_module_idx].module!, true, visited, out);\n }\n}\n\nfunction compare_code_units(a: string, b: string): number { return a < b ? -1 : a > b ? 1 : 0; }\n\n/* Build the namespace object of a module: a host Proxy over a frozen-shape, null-prototype\n target, so that native property access sees the live bindings (spec 10.4.6) */\nfunction js_build_module_ns(ctx: JSContext, m: JSModuleDef): JSValue {\n const names: JSAtom[] = [];\n get_exported_names(m, false, new Set(), names);\n const bindings = new Map<string, () => JSValue>();\n for (const name of names) {\n const r = { b: null as ResolvedBinding | null };\n const ret = js_resolve_export(m, name, r);\n if (ret === ResolveResult.AMBIGUOUS) continue; /* ambiguous exports are left out */\n if (ret !== ResolveResult.FOUND) {\n js_resolve_export_throw_error(ctx, ret, m, name);\n return JS_EXCEPTION;\n }\n const b = r.b!;\n const key = JS_AtomGetStr(ctx, name);\n if (b.ns !== null) {\n /* the namespace of another module: resolved lazily (cycles) */\n const target_module = b.ns;\n bindings.set(key, () => {\n const v = js_get_module_ns(ctx, target_module);\n if (JS_IsException(v)) throw js_take_exception(ctx);\n return v;\n });\n } else {\n const vr = export_var_ref(b.module, b.me);\n bindings.set(key, () => {\n const v = vr.get();\n if (v === JS_UNINITIALIZED) {\n JS_ThrowReferenceError(ctx, `'${key}' is not initialized`);\n throw js_take_exception(ctx);\n }\n return v;\n });\n }\n }\n const keys = [...bindings.keys()].sort(compare_code_units);\n const target: Record<PropertyKey, unknown> = Object.create(null);\n for (const k of keys) Reflect.defineProperty(target, k, { value: undefined, writable: true, enumerable: true, configurable: false });\n Reflect.defineProperty(target, Symbol.toStringTag, { value: 'Module', writable: false, enumerable: false, configurable: false });\n Object.preventExtensions(target);\n const value_of = (k: string): JSValue => bindings.get(k)!();\n const handler: ProxyHandler<object> = Object.assign(Object.create(null), {\n get(t: object, key: string | symbol, receiver: unknown): unknown {\n if (typeof key === 'symbol') return Reflect.get(t, key, receiver);\n return bindings.has(key) ? value_of(key) : undefined;\n },\n set(): boolean { return false; },\n has(t: object, key: string | symbol): boolean {\n if (typeof key === 'symbol') return Reflect.has(t, key);\n return bindings.has(key);\n },\n deleteProperty(t: object, key: string | symbol): boolean {\n if (typeof key === 'symbol') return Reflect.deleteProperty(t, key);\n return !bindings.has(key);\n },\n getOwnPropertyDescriptor(t: object, key: string | symbol): PropertyDescriptor | undefined {\n if (typeof key === 'symbol') return Reflect.getOwnPropertyDescriptor(t, key);\n if (!bindings.has(key)) return undefined;\n return { value: value_of(key), writable: true, enumerable: true, configurable: false };\n },\n defineProperty(t: object, key: string | symbol, desc: PropertyDescriptor): boolean {\n if (typeof key === 'symbol') return Reflect.defineProperty(t, key, desc);\n if (!bindings.has(key)) return false;\n const value = value_of(key); /* TDZ */\n if (desc.configurable === true || desc.enumerable === false || desc.get !== undefined || desc.set !== undefined ||\n desc.writable === false) return false;\n if ('value' in desc) return Object.is(desc.value, value);\n return true;\n },\n ownKeys(): PropertyKey[] { return [...keys, Symbol.toStringTag]; },\n });\n const ns = new Proxy(target, handler);\n js_ensure_meta(ns, JSClassID.MODULE_NS).realm = ctx;\n return ns;\n}\n\nexport function js_get_module_ns(ctx: JSContext, m: JSModuleDef): JSValue {\n if (m.module_ns === undefined) {\n const ns = js_build_module_ns(ctx, m);\n if (JS_IsException(ns)) return ns;\n m.module_ns = ns;\n }\n return m.module_ns;\n}\n\n/* the namespace object of a module that has been linked */\nexport function JS_GetModuleNamespace(ctx: JSContext, m: JSModuleDef): JSValue {\n return js_get_module_ns(ctx, m);\n}\n\n/* ---------------------------------------------------------------------\n Evaluation (js_inner_module_evaluation and the asynchronous completion)\n --------------------------------------------------------------------- */\n\n/* run a module without top-level await: 0, or -1 with the error in out.error */\nfunction js_execute_sync_module(ctx: JSContext, m: JSModuleDef, out: { error: JSValue }): number {\n if (m.kind !== JSModuleKind.JS) {\n for (const me of m.export_entries) me.var_ref!.set(m.synthetic_exports!.get(me.export_name));\n return 0;\n }\n const promise = JS_Call(ctx, m.func_obj, undefined, []);\n if (JS_IsException(promise)) { out.error = js_take_exception(ctx); return -1; }\n const state = JS_PromiseState(ctx, promise);\n if (state === JSPromiseState.FULFILLED) return 0;\n if (state === JSPromiseState.REJECTED) {\n out.error = JS_PromiseResult(ctx, promise);\n /* the rejection is reported through the module's own promise */\n perform_promise_then(ctx, promise, [undefined, undefined], [undefined, undefined]);\n return -1;\n }\n out.error = throw_type_error(ctx, 'promise is pending');\n return -1;\n}\n\nfunction js_execute_async_module(ctx: JSContext, m: JSModuleDef): void {\n const promise = JS_Call(ctx, m.func_obj, undefined, []);\n if (JS_IsException(promise)) {\n js_async_module_execution_rejected(ctx, m, js_take_exception(ctx));\n return;\n }\n const on_fulfilled = JS_NewCFunction(ctx, () => { js_async_module_execution_fulfilled(ctx, m); return undefined; }, '', 0);\n const on_rejected = JS_NewCFunction(ctx, (_c, _t, argv) => { js_async_module_execution_rejected(ctx, m, argv[0]); return undefined; }, '', 1);\n perform_promise_then(ctx, promise, [on_fulfilled, on_rejected], [undefined, undefined]);\n}\n\nfunction js_inner_module_evaluation(ctx: JSContext, m: JSModuleDef, index: number, stack: { top: JSModuleDef | null },\n out: { error: JSValue }): number {\n if (m.status === JSModuleStatus.EVALUATING_ASYNC || m.status === JSModuleStatus.EVALUATED) {\n if (m.eval_has_exception) { out.error = m.eval_exception; return -1; }\n return index;\n }\n if (m.status === JSModuleStatus.EVALUATING) return index;\n m.status = JSModuleStatus.EVALUATING;\n m.dfs_index = index;\n m.dfs_ancestor_index = index;\n m.pending_async_dependencies = 0;\n index++;\n /* push 'm' on stack */\n m.stack_prev = stack.top;\n stack.top = m;\n\n for (const rme of m.req_module_entries) {\n let m1 = rme.module!;\n index = js_inner_module_evaluation(ctx, m1, index, stack, out);\n if (index < 0) return -1;\n if (m1.status === JSModuleStatus.EVALUATING) {\n m.dfs_ancestor_index = Math.min(m.dfs_ancestor_index, m1.dfs_ancestor_index);\n } else {\n m1 = m1.cycle_root!;\n if (m1.eval_has_exception) { out.error = m1.eval_exception; return -1; }\n }\n if (m1.async_evaluation) {\n m.pending_async_dependencies++;\n m1.async_parent_modules.push(m);\n }\n }\n\n if (m.pending_async_dependencies > 0) {\n m.async_evaluation = true;\n m.async_evaluation_timestamp = ctx.rt.module_async_evaluation_next_timestamp++;\n } else if (m.has_tla) {\n m.async_evaluation = true;\n m.async_evaluation_timestamp = ctx.rt.module_async_evaluation_next_timestamp++;\n js_execute_async_module(ctx, m);\n } else {\n if (js_execute_sync_module(ctx, m, out) < 0) return -1;\n }\n\n if (m.dfs_index === m.dfs_ancestor_index) {\n for (;;) {\n /* pop m1 from stack */\n const m1: JSModuleDef = stack.top!;\n stack.top = m1.stack_prev;\n m1.status = m1.async_evaluation ? JSModuleStatus.EVALUATING_ASYNC : JSModuleStatus.EVALUATED;\n m1.cycle_root = m;\n if (m1 === m) break;\n }\n }\n return index;\n}\n\n/* Run the module function of the module and of all its requested modules. Returns a\n promise (or an exception) */\nfunction js_evaluate_module(ctx: JSContext, m: JSModuleDef): JSValue {\n if (m.status === JSModuleStatus.EVALUATING_ASYNC || m.status === JSModuleStatus.EVALUATED) m = m.cycle_root!;\n /* a promise may be created only on the cycle_root of a cycle */\n if (m.promise !== undefined) return m.promise;\n const funcs: [JSValue, JSValue] = [undefined, undefined];\n const promise = JS_NewPromiseCapability(ctx, funcs);\n if (JS_IsException(promise)) return promise;\n m.promise = promise;\n m.resolving_funcs = funcs;\n const stack = { top: null as JSModuleDef | null };\n const out = { error: undefined as JSValue };\n if (js_inner_module_evaluation(ctx, m, 0, stack, out) < 0) {\n while (stack.top !== null) {\n const m1 = stack.top;\n m1.status = JSModuleStatus.EVALUATED;\n m1.eval_has_exception = true;\n m1.eval_exception = out.error;\n m1.cycle_root = m;\n stack.top = m1.stack_prev;\n }\n JS_Call(ctx, m.resolving_funcs[1], undefined, [m.eval_exception]);\n } else if (!m.async_evaluation) {\n JS_Call(ctx, m.resolving_funcs[0], undefined, [undefined]);\n }\n return m.promise;\n}\n\nfunction js_set_module_evaluated(ctx: JSContext, m: JSModuleDef): void {\n m.status = JSModuleStatus.EVALUATED;\n if (m.promise !== undefined) JS_Call(ctx, m.resolving_funcs[0], undefined, [undefined]);\n}\n\n/* the async parents of a module whose evaluation finished, ready to run */\nfunction gather_available_ancestors(module: JSModuleDef, exec_list: JSModuleDef[]): void {\n for (const m of module.async_parent_modules) {\n if (!exec_list.includes(m) && !m.cycle_root!.eval_has_exception) {\n m.pending_async_dependencies--;\n if (m.pending_async_dependencies === 0) {\n exec_list.push(m);\n if (!m.has_tla) gather_available_ancestors(m, exec_list);\n }\n }\n }\n}\n\nfunction js_async_module_execution_rejected(ctx: JSContext, module: JSModuleDef, error: JSValue): void {\n if (module.status === JSModuleStatus.EVALUATED) return;\n module.eval_has_exception = true;\n module.eval_exception = error;\n module.status = JSModuleStatus.EVALUATED;\n module.async_evaluation = false;\n /* the module's own promise is rejected before its parents' (af16a97, after a\n specification change) */\n if (module.promise !== undefined) JS_Call(ctx, module.resolving_funcs[1], undefined, [error]);\n for (const m of module.async_parent_modules) js_async_module_execution_rejected(ctx, m, error);\n}\n\nfunction js_async_module_execution_fulfilled(ctx: JSContext, module: JSModuleDef): void {\n if (module.status === JSModuleStatus.EVALUATED) return;\n module.async_evaluation = false;\n js_set_module_evaluated(ctx, module);\n const exec_list: JSModuleDef[] = [];\n gather_available_ancestors(module, exec_list);\n /* sort by increasing async_evaluation timestamp */\n exec_list.sort((a, b) => a.async_evaluation_timestamp - b.async_evaluation_timestamp);\n for (const m of exec_list) {\n if (m.status === JSModuleStatus.EVALUATED) continue; /* rejected meanwhile */\n if (m.has_tla) {\n js_execute_async_module(ctx, m);\n } else {\n const out = { error: undefined as JSValue };\n if (js_execute_sync_module(ctx, m, out) < 0) {\n js_async_module_execution_rejected(ctx, m, out.error);\n } else {\n m.async_evaluation = false;\n js_set_module_evaluated(ctx, m);\n }\n }\n }\n}\n\n/* ---------------------------------------------------------------------\n Running modules\n --------------------------------------------------------------------- */\n\n/* link and evaluate a module whose graph is loaded: the evaluation promise, or an exception */\nfunction js_link_and_evaluate(ctx: JSContext, m: JSModuleDef): JSValue {\n if (js_create_module_function(ctx, m) < 0) return JS_EXCEPTION;\n if (js_link_module(ctx, m) < 0) return JS_EXCEPTION;\n return js_evaluate_module(ctx, m);\n}\n\n/* Load the graph of `m`, link and evaluate it, then call `ok(ns)` or `fail(error)` */\nfunction js_run_module(ctx: JSContext, m: JSModuleDef, ok: (ns: JSValue) => void, fail: (e: JSValue) => void): void {\n js_load_graph(ctx, m, err => {\n if (err !== undefined) { fail(err); return; }\n const p = js_link_and_evaluate(ctx, m);\n if (JS_IsException(p)) { fail(js_take_exception(ctx)); return; }\n const on_ful = JS_NewCFunction(ctx, () => {\n const ns = js_get_module_ns(ctx, m);\n if (JS_IsException(ns)) fail(js_take_exception(ctx)); else ok(ns);\n return undefined;\n }, '', 0);\n const on_rej = JS_NewCFunction(ctx, (_c, _t, argv) => { fail(argv[0]); return undefined; }, '', 1);\n perform_promise_then(ctx, p, [on_ful, on_rej], [undefined, undefined]);\n });\n}\n\n/* JS_EvalFunction of a compiled module (and JS_Eval of a module): with a loader that\n answers synchronously, this is QuickJS's behaviour (load or link errors are thrown, the\n result is the evaluation promise); otherwise a promise that settles with the evaluation */\nfunction js_module_eval_function(ctx: JSContext, m: JSModuleDef): JSValue {\n js_register_module(ctx, m);\n let sync = true;\n let result: JSValue = undefined;\n let error: JSValue = undefined;\n let has_error = false;\n let funcs: [JSValue, JSValue] | null = null;\n let promise: JSValue = undefined;\n js_load_graph(ctx, m, err => {\n if (sync) {\n if (err !== undefined) { has_error = true; error = err; return; }\n result = js_link_and_evaluate(ctx, m);\n return;\n }\n if (err !== undefined) { JS_Call(ctx, funcs![1], undefined, [err]); return; }\n const p = js_link_and_evaluate(ctx, m);\n if (JS_IsException(p)) { JS_Call(ctx, funcs![1], undefined, [js_take_exception(ctx)]); return; }\n JS_Call(ctx, funcs![0], undefined, [p]);\n });\n if (has_error) return JS_Throw(ctx, error);\n if (result !== undefined) return result;\n /* still loading */\n sync = false;\n funcs = [undefined, undefined];\n promise = JS_NewPromiseCapability(ctx, funcs);\n return promise;\n}\n\nfunction js_new_promise(ctx: JSContext): { promise: JSValue; resolve: (v: JSValue) => void; reject: (e: JSValue) => void } {\n const funcs: [JSValue, JSValue] = [undefined, undefined];\n const promise = JS_NewPromiseCapability(ctx, funcs);\n return {\n promise,\n resolve: v => { JS_Call(ctx, funcs[0], undefined, [v]); },\n reject: e => { JS_Call(ctx, funcs[1], undefined, [e]); },\n };\n}\n\n/* Evaluate `source` as a module named `url`: a promise for its namespace object. `flags` may hold\n JS_EVAL_FLAG_STRIP_TYPES and JS_EVAL_FLAG_JSX */\nexport function JS_EvalModule(ctx: JSContext, source: string, url: string, flags = 0): JSValue {\n const p = js_new_promise(ctx);\n const v = hooks.JS_EvalInternal(ctx, undefined, source, url, JS_EVAL_TYPE_MODULE | JS_EVAL_FLAG_COMPILE_ONLY |\n (flags & (JS_EVAL_FLAG_STRIP_TYPES | JS_EVAL_FLAG_JSX)), -1);\n if (JS_IsException(v)) { p.reject(js_take_exception(ctx)); return p.promise; }\n const m = v as unknown as JSModuleDef;\n js_register_module(ctx, m);\n js_run_module(ctx, m, p.resolve, p.reject);\n return p.promise;\n}\n\n/* import(specifier) from the host: a promise for the namespace object */\nexport function JS_ImportModule(ctx: JSContext, specifier: string, referrer: string | null = null,\n attributes: Record<string, string> | null = null): JSValue {\n const p = js_new_promise(ctx);\n js_import(ctx, specifier, referrer, attributes, p.resolve, p.reject);\n return p.promise;\n}\n\nfunction js_import(ctx: JSContext, specifier: string, referrer: string | null, attributes: Record<string, string> | null,\n ok: (ns: JSValue) => void, fail: (e: JSValue) => void): void {\n const kind = js_request_kind(ctx, attributes);\n if (kind !== 'js' && kind !== 'json') { fail(kind); return; }\n const attrs = attributes ?? {};\n let id: string;\n try { id = js_resolve_specifier(ctx, specifier, referrer, attrs); } catch (e) { fail(caught(ctx, e)); return; }\n js_fetch_module(ctx, specifier, id, kind, attrs, (err, m) => {\n if (err !== undefined) { fail(err); return; }\n js_run_module(ctx, m!, ok, fail);\n });\n}\n\n/* the name a function's code is known by: its module's id, or its script's file name */\nfunction js_referrer_of(ctx: JSContext, b: JSFunctionBytecode | null): string | null {\n if (b === null) return null;\n if (b.module !== null) return mname(ctx, b.module);\n if (b.has_debug && b.debug.filename) return JS_AtomGetStr(ctx, b.debug.filename);\n return null;\n}\n\n/* import(specifier, options) */\nfunction js_dynamic_import(ctx: JSContext, b: JSFunctionBytecode | null, specifier: JSValue, options: JSValue): JSValue {\n const p = js_new_promise(ctx);\n if (JS_IsException(p.promise)) return p.promise;\n const reject_now = (): JSValue => { p.reject(js_take_exception(ctx)); return p.promise; };\n /* the string conversion must occur here */\n const spec = JS_ToString(ctx, specifier);\n if (JS_IsException(spec)) return reject_now();\n let attributes: Record<string, string> | null = null;\n if (options !== undefined) {\n if (!JS_IsObject(options)) { JS_ThrowTypeError(ctx, 'options must be an object'); return reject_now(); }\n const with_obj = JS_GetPropertyStr(ctx, options, 'with');\n if (JS_IsException(with_obj)) return reject_now();\n if (with_obj !== undefined) {\n if (!JS_IsObject(with_obj)) { JS_ThrowTypeError(ctx, 'options.with must be an object'); return reject_now(); }\n attributes = Object.create(null);\n let keys: PropertyKey[];\n try { keys = Reflect.ownKeys(with_obj as object); } catch (e) { p.reject(host_error_to_guest(ctx, e)); return p.promise; }\n for (const k of keys) {\n if (typeof k !== 'string') continue;\n let d: PropertyDescriptor | undefined;\n try { d = Reflect.getOwnPropertyDescriptor(with_obj as object, k); } catch (e) { p.reject(host_error_to_guest(ctx, e)); return p.promise; }\n if (!d || !d.enumerable) continue;\n const v = JS_GetPropertyStr(ctx, with_obj, k);\n if (JS_IsException(v)) return reject_now();\n if (typeof v !== 'string') { JS_ThrowTypeError(ctx, 'module attribute values must be strings'); return reject_now(); }\n attributes![k] = v;\n }\n }\n }\n const kind = js_request_kind(ctx, attributes);\n if (kind !== 'js' && kind !== 'json') { p.reject(kind); return p.promise; }\n const referrer = js_referrer_of(ctx, b);\n /* not run synchronously: it could recurse into js_evaluate_module() */\n JS_EnqueueJob(ctx, () => {\n js_import(ctx, spec as string, referrer, attributes, p.resolve, p.reject);\n return undefined;\n }, []);\n return p.promise;\n}\n\n/* import.meta: a null-prototype object with `url` and `resolve` */\nfunction js_import_meta(ctx: JSContext, b: JSFunctionBytecode | null): JSValue {\n const m = b?.module ?? null;\n if (m === null) return JS_ThrowTypeError(ctx, 'import.meta not supported in this context');\n if (m.meta_obj === undefined) {\n const meta = JS_NewObjectProto(ctx, null);\n if (JS_IsException(meta)) return meta;\n const id = mname(ctx, m);\n JS_DefinePropertyValueStr(ctx, meta, 'url', m.url ?? id, JS_PROP_C_W_E);\n const resolve = JS_NewCFunction(ctx, (c, _t, argv) => {\n const spec = JS_ToString(c, argv[0]);\n if (JS_IsException(spec)) return spec;\n try {\n return js_resolve_specifier(c, spec as string, id, {});\n } catch (e) {\n return JS_Throw(c, caught(c, e));\n }\n }, 'resolve', 1);\n JS_DefinePropertyValueStr(ctx, meta, 'resolve', resolve, JS_PROP_C_W_E);\n m.meta_obj = meta;\n }\n return m.meta_obj;\n}\n\nhooks.js_module_compiled = js_module_compiled;\nhooks.js_dynamic_import = js_dynamic_import;\nhooks.js_import_meta = js_import_meta;\nhooks.js_module_eval_function = js_module_eval_function;\n"]}
package/dist/parser.js CHANGED
@@ -890,9 +890,13 @@ function js_parse_number(s, p) {
890
890
  if (last_was_sep)
891
891
  return [js_parse_error_pos(s, p, 'invalid number literal'), p];
892
892
  let is_bigint = false;
893
+ /* a fraction or an exponent (decimal literals only) rules out the BigInt suffix; the digits
894
+ themselves are not inspected, since 'e' is a hex digit */
895
+ let is_float = false;
893
896
  if (radix === 10 && !is_legacy_octal) {
894
897
  /* fraction and exponent */
895
898
  if (buf.charCodeAt(p) === 46 /* . */) {
899
+ is_float = true;
896
900
  text += '.';
897
901
  p++;
898
902
  last_was_sep = false;
@@ -949,6 +953,7 @@ function js_parse_number(s, p) {
949
953
  if (last_was_sep)
950
954
  return [js_parse_error_pos(s, q, 'invalid number literal'), q];
951
955
  text += etext;
956
+ is_float = true;
952
957
  p = q;
953
958
  }
954
959
  else {
@@ -959,7 +964,7 @@ function js_parse_number(s, p) {
959
964
  else if (ndigits === 0) {
960
965
  return [js_parse_error_pos(s, start, 'invalid number literal'), p];
961
966
  }
962
- if (buf.charCodeAt(p) === 110 /* n */ && !is_legacy_octal && !text.includes('.') && !/e/i.test(text)) {
967
+ if (buf.charCodeAt(p) === 110 /* n */ && !is_legacy_octal && !is_float) {
963
968
  is_bigint = true;
964
969
  p++;
965
970
  }
@@ -4474,7 +4479,8 @@ function js_parse_property_name(s, out, allow_method, allow_var, allow_private)
4474
4479
  else if (tv(s) === 91 /* [ */) {
4475
4480
  if (next_token(s))
4476
4481
  return -1;
4477
- if (js_parse_expr(s))
4482
+ /* ComputedPropertyName: [ AssignmentExpression ] (a comma expression is a syntax error) */
4483
+ if (js_parse_assign_expr(s))
4478
4484
  return -1;
4479
4485
  if (js_parse_expect(s, 93))
4480
4486
  return -1;
@@ -5552,6 +5558,9 @@ function js_parse_postfix_expr(s, parse_flags) {
5552
5558
  let has_optional_chain = false;
5553
5559
  let action = 'none';
5554
5560
  if (tv(s) === -89 /* TOK.QUESTION_MARK_DOT */) {
5561
+ /* the callee of `new` cannot contain an optional chain (`new a?.b()`) */
5562
+ if ((parse_flags & PF_POSTFIX_CALL) === 0)
5563
+ return js_parse_error(s, 'new keyword cannot be used with an optional chain');
5555
5564
  op_token_ptr = s.token.ptr;
5556
5565
  /* optional chaining */
5557
5566
  if (next_token(s))
@@ -6810,6 +6819,8 @@ function js_parse_var(s, parse_flags, tok, export_flag) {
6810
6819
  if (export_flag && add_local_export(s, name))
6811
6820
  return -1;
6812
6821
  if (tv(s) === 61 /* = */) {
6822
+ /* an error storing the value is reported at the '=' (upstream 14a1536) */
6823
+ const source_ptr = s.token.ptr;
6813
6824
  if (next_token(s))
6814
6825
  return -1;
6815
6826
  if (need_var_reference(s, tok)) {
@@ -6823,12 +6834,14 @@ function js_parse_var(s, parse_flags, tok, export_flag) {
6823
6834
  if (js_parse_assign_expr2(s, parse_flags))
6824
6835
  return -1;
6825
6836
  set_object_name(s, name);
6837
+ emit_source_pos(s, source_ptr);
6826
6838
  put_lvalue(s, lv, 0 /* PutLValueEnum.PUT_LVALUE_NOKEEP */, false);
6827
6839
  }
6828
6840
  else {
6829
6841
  if (js_parse_assign_expr2(s, parse_flags))
6830
6842
  return -1;
6831
6843
  set_object_name(s, name);
6844
+ emit_source_pos(s, source_ptr);
6832
6845
  emit_op(s, (tok === -55 /* TOK.CONST */ || tok === -47 /* TOK.LET */) ? 191 /* OP.scope_put_var_init */ : 187 /* OP.scope_put_var */);
6833
6846
  emit_atom(s, name);
6834
6847
  emit_u16(s, fd.scope_level);
@@ -7006,8 +7019,7 @@ function js_parse_for_in_of(s, label_name, is_async) {
7006
7019
  }
7007
7020
  }
7008
7021
  if (token_is_pseudo_keyword(s, JS_ATOM_of)) {
7009
- break_entry.has_iterator = is_for_of = true;
7010
- break_entry.drop_count += 2;
7022
+ is_for_of = true;
7011
7023
  if (has_initializer)
7012
7024
  return js_parse_error(s, "a declaration in the head of a for-of loop can't have an initializer");
7013
7025
  }
@@ -7034,6 +7046,10 @@ function js_parse_for_in_of(s, label_name, is_async) {
7034
7046
  /* close the scope after having evaluated the expression so that the TDZ values are in the closures */
7035
7047
  close_scopes(s, fd.scope_level, block_scope_level);
7036
7048
  if (is_for_of) {
7049
+ /* set has_iterator after the iterable expression is parsed so that a yield in the expression
7050
+ does not try to close a not-yet-created iterator */
7051
+ break_entry.has_iterator = true;
7052
+ break_entry.drop_count += 2;
7037
7053
  if (is_async)
7038
7054
  emit_op(s, 128 /* OP.for_await_of_start */);
7039
7055
  else
@@ -9087,7 +9103,7 @@ function js_parse_module_export_name(s, out) {
9087
9103
  let atom;
9088
9104
  if (tv(s) === -127 /* TOK.STRING */) {
9089
9105
  if (!is_well_formed_string(s.token.str)) {
9090
- js_parse_error(s, 'invalid module export name');
9106
+ js_parse_error(s, 'contains unpaired surrogate');
9091
9107
  return JS_ATOM_NULL;
9092
9108
  }
9093
9109
  atom = JS_NewAtom(s.ctx, s.token.str);
@@ -9131,21 +9147,22 @@ function js_parse_with_clause(s, out) {
9131
9147
  return -1;
9132
9148
  const attrs = Object.create(null);
9133
9149
  while (tv(s) !== 125) {
9150
+ const key_token_ptr = s.token.ptr;
9134
9151
  let key;
9135
9152
  if (tv(s) === -127 /* TOK.STRING */)
9136
9153
  key = s.token.str;
9137
9154
  else if (token_is_ident_or_keyword(tv(s)) || token_is_ident(tv(s)))
9138
9155
  key = JS_AtomGetStr(s.ctx, s.token.atom);
9139
9156
  else
9140
- return js_parse_error(s, 'identifier or string expected');
9141
- if (Object.prototype.hasOwnProperty.call(attrs, key))
9142
- return js_parse_error(s, `duplicate import attribute '${key}'`);
9157
+ return js_parse_error(s, 'identifier expected');
9143
9158
  if (next_token(s))
9144
9159
  return -1;
9145
9160
  if (js_parse_expect(s, 58))
9146
9161
  return -1;
9147
9162
  if (tv(s) !== -127 /* TOK.STRING */)
9148
- return js_parse_error(s, 'string expected');
9163
+ return js_parse_error_pos(s, key_token_ptr, 'string expected');
9164
+ if (Object.prototype.hasOwnProperty.call(attrs, key))
9165
+ return js_parse_error(s, 'duplicate with key');
9149
9166
  attrs[key] = s.token.str;
9150
9167
  if (next_token(s))
9151
9168
  return -1;