@palbase/web 3.0.0 → 4.0.1

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 (45) hide show
  1. package/dist/_mls-wasm.cjs +32 -0
  2. package/dist/_mls-wasm.cjs.map +1 -0
  3. package/dist/_mls-wasm.js +11 -0
  4. package/dist/_mls-wasm.js.map +1 -0
  5. package/dist/{analytics-facade-BOxQ8IP2.d.cts → analytics-facade-DwOtlXPP.d.cts} +5 -87
  6. package/dist/{analytics-facade-yfMJ69vw.d.ts → analytics-facade-Nk6J9Ncm.d.ts} +5 -87
  7. package/dist/{chunk-S7NAY3MW.js → chunk-NXEPAEF5.js} +1 -8
  8. package/dist/{chunk-S7NAY3MW.js.map → chunk-NXEPAEF5.js.map} +1 -1
  9. package/dist/chunk-PZ5AY32C.js +10 -0
  10. package/dist/chunk-PZ5AY32C.js.map +1 -0
  11. package/dist/{chunk-3HVTEZ7N.js → chunk-TGDS6VMT.js} +51 -36
  12. package/dist/chunk-TGDS6VMT.js.map +1 -0
  13. package/dist/gen/cli.js +2 -1
  14. package/dist/gen/cli.js.map +1 -1
  15. package/dist/index.cjs +59 -37
  16. package/dist/index.cjs.map +1 -1
  17. package/dist/index.d.cts +3 -4
  18. package/dist/index.d.ts +3 -4
  19. package/dist/index.js +3 -2
  20. package/dist/internal.cjs +56 -34
  21. package/dist/internal.cjs.map +1 -1
  22. package/dist/internal.d.cts +4 -16
  23. package/dist/internal.d.ts +4 -16
  24. package/dist/internal.js +3 -2
  25. package/dist/next/client.cjs +56 -34
  26. package/dist/next/client.cjs.map +1 -1
  27. package/dist/next/client.js +3 -2
  28. package/dist/next/client.js.map +1 -1
  29. package/dist/next/index.cjs +46 -34
  30. package/dist/next/index.cjs.map +1 -1
  31. package/dist/next/index.d.cts +2 -3
  32. package/dist/next/index.d.ts +2 -3
  33. package/dist/next/index.js +3 -2
  34. package/dist/next/index.js.map +1 -1
  35. package/dist/{pb-B3h3NIPE.d.cts → pb-C9v5dEO6.d.cts} +1 -1
  36. package/dist/{pb-QRISxPd1.d.ts → pb-FG_nV7NR.d.ts} +1 -1
  37. package/dist/react/index.cjs +1 -1
  38. package/dist/react/index.cjs.map +1 -1
  39. package/dist/react/index.d.cts +1 -2
  40. package/dist/react/index.d.ts +1 -2
  41. package/dist/react/index.js +3 -2
  42. package/dist/react/index.js.map +1 -1
  43. package/package.json +9 -2
  44. package/dist/chunk-3HVTEZ7N.js.map +0 -1
  45. package/dist/pkg/palbe_mls_bg.wasm +0 -0
@@ -6,8 +6,9 @@ import {
6
6
  import {
7
7
  __configure,
8
8
  getRuntime
9
- } from "../chunk-3HVTEZ7N.js";
10
- import "../chunk-S7NAY3MW.js";
9
+ } from "../chunk-TGDS6VMT.js";
10
+ import "../chunk-NXEPAEF5.js";
11
+ import "../chunk-PZ5AY32C.js";
11
12
 
12
13
  // src/next/client.ts
13
14
  var SESSION_MAX_AGE_S = 2592e3;
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/next/client.ts"],"sourcesContent":["/**\n * '@palbase/web/next/client' — the browser half of the Next.js adapter. This entry\n * must NEVER import 'next' (it runs in plain client bundles); the cookie jar\n * is document.cookie itself, written with the shared codec so the server\n * side (pbServer / middleware / callback) reads the same bytes.\n */\nimport { __configure, getRuntime } from '../internal.js';\nimport type { PersistedSession, SessionStorageAdapter } from '../storage.js';\nimport {\n clearedSessionCookieNames,\n decodeSessionCookies,\n encodeSessionCookies,\n} from './cookie-codec.js';\n\n/** 30 days — the refresh-token TTL (P3 design contract). */\nconst SESSION_MAX_AGE_S = 2_592_000;\n\n// Secure is unconditional, INCLUDING http://localhost: browsers treat\n// localhost as a potentially-trustworthy origin, so document.cookie accepts\n// Secure cookies there — no dev-mode special case needed. KNOWN LIMITATION:\n// plain-http origins OTHER than localhost — e.g. LAN-IP device testing on\n// http://192.168.x.x — are NOT trustworthy, so the browser silently DROPS\n// these Secure cookie writes and the session won't persist; use https (or a\n// localhost tunnel/port-forward) for on-device testing. NOT HttpOnly by\n// design: the browser SDK must read/write the session (Supabase-paradigm\n// tradeoff, documented in the P3 plan).\nconst WRITE_ATTRS = 'Path=/; SameSite=Lax; Secure';\n\n/** Parse document.cookie (\"a=1; b=2\") into a name → raw-value map. */\nfunction cookieJar(): Map<string, string> {\n const jar = new Map<string, string>();\n for (const part of document.cookie.split(';')) {\n const eq = part.indexOf('=');\n if (eq === -1) continue;\n const name = part.slice(0, eq).trim();\n if (name) jar.set(name, part.slice(eq + 1).trim());\n }\n return jar;\n}\n\nfunction deleteCookie(name: string): void {\n // biome-ignore lint/suspicious/noDocumentCookie: SessionStorageAdapter is a SYNC contract; the async Cookie Store API can't back it (and isn't universal).\n document.cookie = `${name}=; ${WRITE_ATTRS}; Max-Age=0`;\n}\n\n/**\n * document.cookie-backed SessionStorageAdapter. `load` returns the EXTENDED\n * PersistedSession (access token + expiry ride along) so hydration adopts\n * the full session without a refresh round-trip.\n */\nexport function cookieSessionStorage(environmentRef: string): SessionStorageAdapter {\n return {\n load(): PersistedSession | null {\n if (typeof document === 'undefined') return null;\n const jar = cookieJar();\n const stored = decodeSessionCookies((name) => jar.get(name), environmentRef);\n if (!stored) return null;\n // A refresh-only save round-trips as a:'' / e:0 — normalize back to\n // the legacy shape so hydration takes the expired-trick path cleanly.\n return stored.accessToken && stored.expiresAt > 0\n ? {\n refreshToken: stored.refreshToken,\n accessToken: stored.accessToken,\n expiresAt: stored.expiresAt,\n }\n : { refreshToken: stored.refreshToken };\n },\n save(session: PersistedSession): void {\n if (typeof document === 'undefined') return;\n const jar = cookieJar();\n // Delete every currently-present session cookie first (stale chunks of\n // a previously-larger session, or a stale base when the new write\n // chunks), then set the new cookie(s).\n for (const name of clearedSessionCookieNames(environmentRef, (n) => jar.has(n))) {\n deleteCookie(name);\n }\n const { set, clear } = encodeSessionCookies(environmentRef, {\n accessToken: session.accessToken ?? '',\n refreshToken: session.refreshToken,\n expiresAt: session.expiresAt ?? 0,\n });\n for (const { name, value } of set) {\n // biome-ignore lint/suspicious/noDocumentCookie: SessionStorageAdapter is a SYNC contract; the async Cookie Store API can't back it (and isn't universal).\n document.cookie = `${name}=${value}; ${WRITE_ATTRS}; Max-Age=${SESSION_MAX_AGE_S}`;\n }\n // Overflow guard (codec contract): delete one-past-the-end so a stale\n // orphan chunk behind a gap can never join a future chunk run.\n for (const name of clear) deleteCookie(name);\n },\n clear(): void {\n if (typeof document === 'undefined') return;\n const jar = cookieJar();\n for (const name of clearedSessionCookieNames(environmentRef, (n) => jar.has(n))) {\n deleteCookie(name);\n }\n },\n };\n}\n\n/**\n * One-liner for a client component/provider: re-configure the already-loaded\n * gen config (palbe.gen.ts must be imported first — throws the guided\n * notConfigured error otherwise) with cookie-backed session storage so the\n * browser and the server share the session. Calling it again simply\n * re-configures (safe, e.g. under fast refresh). When Next evaluates the\n * client component module server-side there is no document — no-op.\n */\nexport function setupPalbeNext(): void {\n if (typeof document === 'undefined') return;\n const config = getRuntime().config;\n __configure({\n ...config,\n storage: cookieSessionStorage(config.environmentRef),\n });\n}\n"],"mappings":";;;;;;;;;;;;AAeA,IAAM,oBAAoB;AAW1B,IAAM,cAAc;AAGpB,SAAS,YAAiC;AACxC,QAAM,MAAM,oBAAI,IAAoB;AACpC,aAAW,QAAQ,SAAS,OAAO,MAAM,GAAG,GAAG;AAC7C,UAAM,KAAK,KAAK,QAAQ,GAAG;AAC3B,QAAI,OAAO,GAAI;AACf,UAAM,OAAO,KAAK,MAAM,GAAG,EAAE,EAAE,KAAK;AACpC,QAAI,KAAM,KAAI,IAAI,MAAM,KAAK,MAAM,KAAK,CAAC,EAAE,KAAK,CAAC;AAAA,EACnD;AACA,SAAO;AACT;AAEA,SAAS,aAAa,MAAoB;AAExC,WAAS,SAAS,GAAG,IAAI,MAAM,WAAW;AAC5C;AAOO,SAAS,qBAAqB,gBAA+C;AAClF,SAAO;AAAA,IACL,OAAgC;AAC9B,UAAI,OAAO,aAAa,YAAa,QAAO;AAC5C,YAAM,MAAM,UAAU;AAC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'@palbase/web/next/client' — the browser half of the Next.js adapter. This entry\n * must NEVER import 'next' (it runs in plain client bundles); the cookie jar\n * is document.cookie itself, written with the shared codec so the server\n * side (pbServer / middleware / callback) reads the same bytes.\n */\nimport { __configure, getRuntime } from '../internal.js';\nimport type { PersistedSession, SessionStorageAdapter } from '../storage.js';\nimport {\n clearedSessionCookieNames,\n decodeSessionCookies,\n encodeSessionCookies,\n} from './cookie-codec.js';\n\n/** 30 days — the refresh-token TTL (P3 design contract). */\nconst SESSION_MAX_AGE_S = 2_592_000;\n\n// Secure is unconditional, INCLUDING http://localhost: browsers treat\n// localhost as a potentially-trustworthy origin, so document.cookie accepts\n// Secure cookies there — no dev-mode special case needed. KNOWN LIMITATION:\n// plain-http origins OTHER than localhost — e.g. LAN-IP device testing on\n// http://192.168.x.x — are NOT trustworthy, so the browser silently DROPS\n// these Secure cookie writes and the session won't persist; use https (or a\n// localhost tunnel/port-forward) for on-device testing. NOT HttpOnly by\n// design: the browser SDK must read/write the session (Supabase-paradigm\n// tradeoff, documented in the P3 plan).\nconst WRITE_ATTRS = 'Path=/; SameSite=Lax; Secure';\n\n/** Parse document.cookie (\"a=1; b=2\") into a name → raw-value map. */\nfunction cookieJar(): Map<string, string> {\n const jar = new Map<string, string>();\n for (const part of document.cookie.split(';')) {\n const eq = part.indexOf('=');\n if (eq === -1) continue;\n const name = part.slice(0, eq).trim();\n if (name) jar.set(name, part.slice(eq + 1).trim());\n }\n return jar;\n}\n\nfunction deleteCookie(name: string): void {\n // biome-ignore lint/suspicious/noDocumentCookie: SessionStorageAdapter is a SYNC contract; the async Cookie Store API can't back it (and isn't universal).\n document.cookie = `${name}=; ${WRITE_ATTRS}; Max-Age=0`;\n}\n\n/**\n * document.cookie-backed SessionStorageAdapter. `load` returns the EXTENDED\n * PersistedSession (access token + expiry ride along) so hydration adopts\n * the full session without a refresh round-trip.\n */\nexport function cookieSessionStorage(environmentRef: string): SessionStorageAdapter {\n return {\n load(): PersistedSession | null {\n if (typeof document === 'undefined') return null;\n const jar = cookieJar();\n const stored = decodeSessionCookies((name) => jar.get(name), environmentRef);\n if (!stored) return null;\n // A refresh-only save round-trips as a:'' / e:0 — normalize back to\n // the legacy shape so hydration takes the expired-trick path cleanly.\n return stored.accessToken && stored.expiresAt > 0\n ? {\n refreshToken: stored.refreshToken,\n accessToken: stored.accessToken,\n expiresAt: stored.expiresAt,\n }\n : { refreshToken: stored.refreshToken };\n },\n save(session: PersistedSession): void {\n if (typeof document === 'undefined') return;\n const jar = cookieJar();\n // Delete every currently-present session cookie first (stale chunks of\n // a previously-larger session, or a stale base when the new write\n // chunks), then set the new cookie(s).\n for (const name of clearedSessionCookieNames(environmentRef, (n) => jar.has(n))) {\n deleteCookie(name);\n }\n const { set, clear } = encodeSessionCookies(environmentRef, {\n accessToken: session.accessToken ?? '',\n refreshToken: session.refreshToken,\n expiresAt: session.expiresAt ?? 0,\n });\n for (const { name, value } of set) {\n // biome-ignore lint/suspicious/noDocumentCookie: SessionStorageAdapter is a SYNC contract; the async Cookie Store API can't back it (and isn't universal).\n document.cookie = `${name}=${value}; ${WRITE_ATTRS}; Max-Age=${SESSION_MAX_AGE_S}`;\n }\n // Overflow guard (codec contract): delete one-past-the-end so a stale\n // orphan chunk behind a gap can never join a future chunk run.\n for (const name of clear) deleteCookie(name);\n },\n clear(): void {\n if (typeof document === 'undefined') return;\n const jar = cookieJar();\n for (const name of clearedSessionCookieNames(environmentRef, (n) => jar.has(n))) {\n deleteCookie(name);\n }\n },\n };\n}\n\n/**\n * One-liner for a client component/provider: re-configure the already-loaded\n * gen config (palbe.gen.ts must be imported first — throws the guided\n * notConfigured error otherwise) with cookie-backed session storage so the\n * browser and the server share the session. Calling it again simply\n * re-configures (safe, e.g. under fast refresh). When Next evaluates the\n * client component module server-side there is no document — no-op.\n */\nexport function setupPalbeNext(): void {\n if (typeof document === 'undefined') return;\n const config = getRuntime().config;\n __configure({\n ...config,\n storage: cookieSessionStorage(config.environmentRef),\n });\n}\n"],"mappings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,KAAK;AAEjC,iBAAS,SAAS,GAAG,IAAI,IAAI,KAAK,KAAK,WAAW,aAAa,iBAAiB;AAAA,MAClF;AAGA,iBAAW,QAAQ,MAAO,cAAa,IAAI;AAAA,IAC7C;AAAA,IACA,QAAc;AACZ,UAAI,OAAO,aAAa,YAAa;AACrC,YAAM,MAAM,UAAU;AACtB,iBAAW,QAAQ,0BAA0B,gBAAgB,CAAC,MAAM,IAAI,IAAI,CAAC,CAAC,GAAG;AAC/E,qBAAa,IAAI;AAAA,MACnB;AAAA,IACF;AAAA,EACF;AACF;AAUO,SAAS,iBAAuB;AACrC,MAAI,OAAO,aAAa,YAAa;AACrC,QAAM,SAAS,WAAW,EAAE;AAC5B,cAAY;AAAA,IACV,GAAG;AAAA,IACH,SAAS,qBAAqB,OAAO,cAAc;AAAA,EACrD,CAAC;AACH;","names":[]}
@@ -1784,19 +1784,29 @@ var PalbeAuth = class {
1784
1784
 
1785
1785
  // src/calls/facade.ts
1786
1786
  var import_livekit_client = require("livekit-client");
1787
- var Call = class {
1787
+ var Call = class _Call {
1788
1788
  id;
1789
1789
  _state = "connecting";
1790
1790
  _participants = /* @__PURE__ */ new Map();
1791
1791
  _listeners = /* @__PURE__ */ new Set();
1792
1792
  _room;
1793
1793
  _keyProvider;
1794
- /** @internal obtain via PalbeCalls.start() / .accept() */
1794
+ // PRIVATE constructor + `@internal` factory: the media-engine types (`Room`,
1795
+ // `ExternalE2EEKeyProvider`) appear ONLY on a private constructor and an
1796
+ // `@internal` static factory, both of which `stripInternal` (set in this
1797
+ // package's tsconfig) removes from the emitted public `.d.ts`. So no engine type
1798
+ // ever reaches the public API surface — the same "no engine type in the public
1799
+ // interface" contract the iOS SDK enforces. Consumers obtain a `Call` only
1800
+ // through `pb.calls.start()` / `.accept()`.
1795
1801
  constructor(callId, room, keyProvider) {
1796
1802
  this.id = callId;
1797
1803
  this._room = room;
1798
1804
  this._keyProvider = keyProvider;
1799
- this._wireRoomEvents();
1805
+ this._wireMediaEvents();
1806
+ }
1807
+ /** @internal — facade-only factory; stripped from the public `.d.ts`. */
1808
+ static _create(callId, room, keyProvider) {
1809
+ return new _Call(callId, room, keyProvider);
1800
1810
  }
1801
1811
  // ─── State ──────────────────────────────────────────────────────────────
1802
1812
  get state() {
@@ -1806,9 +1816,9 @@ var Call = class {
1806
1816
  get participants() {
1807
1817
  return Array.from(this._participants.values());
1808
1818
  }
1809
- get localParticipant() {
1810
- return this._room.localParticipant;
1811
- }
1819
+ // (No `localParticipant` accessor: it would return a raw media-engine participant
1820
+ // object and leak the engine type onto the public API. Local mic/camera control is
1821
+ // exposed engine-agnostically via `mute()` / `setCamera()` below.)
1812
1822
  // ─── Subscribe ──────────────────────────────────────────────────────────
1813
1823
  /**
1814
1824
  * Subscribe to call changes (state + participant updates).
@@ -1832,7 +1842,7 @@ var Call = class {
1832
1842
  /**
1833
1843
  * Set a raw frame encryption key (ArrayBuffer) for this call.
1834
1844
  * Design seam for SP-1.x web-MLS: call this with the MLS exporter secret
1835
- * to enable frame-level E2EE via ExternalE2EEKeyProvider.
1845
+ * to enable frame-level E2EE via the media engine's external key provider.
1836
1846
  *
1837
1847
  * NOTE: The room must have been opened with `e2ee` options for this to take
1838
1848
  * effect. Currently calls connect WITHOUT e2ee — see module docstring.
@@ -1842,7 +1852,7 @@ var Call = class {
1842
1852
  async setMediaKey(key) {
1843
1853
  await this._keyProvider.setKey(key);
1844
1854
  }
1845
- /** Leave the call and disconnect from the LiveKit room. */
1855
+ /** Leave the call and disconnect from the media room. */
1846
1856
  async leave() {
1847
1857
  await this._room.disconnect();
1848
1858
  this._setState("ended");
@@ -1884,7 +1894,7 @@ var Call = class {
1884
1894
  }
1885
1895
  this._emit();
1886
1896
  }
1887
- _wireRoomEvents() {
1897
+ _wireMediaEvents() {
1888
1898
  this._room.on(import_livekit_client.RoomEvent.Connected, () => {
1889
1899
  this._setState("active");
1890
1900
  }).on(
@@ -1925,9 +1935,9 @@ var PalbeCalls = class {
1925
1935
  *
1926
1936
  * @param groupId - Messaging group display-id (`grp_<uuidv7>`)
1927
1937
  * @param media - Which media tracks to publish (default: audio + video)
1928
- * @returns A `Call` in `connecting` state; transitions to `active` once LiveKit connects.
1938
+ * @returns A `Call` in `connecting` state; transitions to `active` once the media room connects.
1929
1939
  *
1930
- * @throws BackendError('network', { code: 'call_service_unavailable' }) if LiveKit SFU is down (503)
1940
+ * @throws BackendError('network', { code: 'call_service_unavailable' }) if the SFU is down (503)
1931
1941
  * @throws BackendError('forbidden', { code: 'not_group_member' }) if the caller is not a member (403)
1932
1942
  * @throws BackendError('conflict', { code: 'call_room_full' }) if the room is full (409)
1933
1943
  */
@@ -1984,7 +1994,7 @@ var PalbeCalls = class {
1984
1994
  adaptiveStream: true,
1985
1995
  dynacast: true
1986
1996
  });
1987
- const call = new Call(callId, room, keyProvider);
1997
+ const call = Call._create(callId, room, keyProvider);
1988
1998
  await room.connect(edgeUrl, token);
1989
1999
  if (media.includes("audio")) {
1990
2000
  await room.localParticipant.setMicrophoneEnabled(true);
@@ -6467,31 +6477,29 @@ function date_now() {
6467
6477
  }
6468
6478
 
6469
6479
  // src/messaging/wasm/loader.ts
6470
- var import_meta = {};
6471
6480
  var GLUE_MODULE = "./palbe_mls_bg.js";
6472
6481
  var SNIPPET_MODULE = "./snippets/mls-rs-core-f99cdecbb456b09c/inline0.js";
6473
6482
  var inflight = null;
6474
6483
  var ready = null;
6475
- async function loadWasmModule() {
6476
- const wasmUrl = new URL("./pkg/palbe_mls_bg.wasm", import_meta.url);
6477
- if (wasmUrl.protocol === "file:") {
6478
- const fsSpecifier = ["node", "fs/promises"].join(":");
6479
- const { readFile } = await import(
6480
- /* webpackIgnore: true */
6481
- fsSpecifier
6482
- );
6483
- const bytes = await readFile(wasmUrl);
6484
- return WebAssembly.compile(bytes);
6484
+ function decodeBase64(encoded) {
6485
+ if (typeof encoded !== "string" || encoded.length === 0 || typeof globalThis.atob !== "function") {
6486
+ throw new Error("palbe-mls WASM asset is invalid");
6485
6487
  }
6486
- const response = await fetch(wasmUrl);
6487
- if (typeof WebAssembly.compileStreaming === "function") {
6488
- try {
6489
- return await WebAssembly.compileStreaming(Promise.resolve(response));
6490
- } catch {
6491
- }
6488
+ let binary;
6489
+ try {
6490
+ binary = globalThis.atob(encoded);
6491
+ } catch {
6492
+ throw new Error("palbe-mls WASM asset is invalid");
6493
+ }
6494
+ const bytes = new Uint8Array(binary.length);
6495
+ for (let index = 0; index < binary.length; index += 1) {
6496
+ bytes[index] = binary.charCodeAt(index);
6492
6497
  }
6493
- const buffer = await response.arrayBuffer();
6494
- return WebAssembly.compile(buffer);
6498
+ return bytes.buffer;
6499
+ }
6500
+ async function loadWasmModule() {
6501
+ const asset = await import("#palbase-mls-wasm");
6502
+ return WebAssembly.compile(decodeBase64(asset.default));
6495
6503
  }
6496
6504
  function buildImports() {
6497
6505
  return {
@@ -6502,7 +6510,7 @@ function buildImports() {
6502
6510
  function initMls() {
6503
6511
  if (ready) return Promise.resolve(ready);
6504
6512
  if (inflight) return inflight;
6505
- inflight = (async () => {
6513
+ const attempt = (async () => {
6506
6514
  const module2 = await loadWasmModule();
6507
6515
  const instance = await WebAssembly.instantiate(module2, buildImports());
6508
6516
  const setWasm = __wbg_set_wasm;
@@ -6521,7 +6529,11 @@ function initMls() {
6521
6529
  ready = g;
6522
6530
  return g;
6523
6531
  })();
6524
- return inflight;
6532
+ inflight = attempt;
6533
+ void attempt.catch(() => {
6534
+ if (inflight === attempt) inflight = null;
6535
+ });
6536
+ return attempt;
6525
6537
  }
6526
6538
  function requireMls() {
6527
6539
  if (!ready) {
@@ -8974,7 +8986,7 @@ function defaultSessionStorage(key) {
8974
8986
  }
8975
8987
 
8976
8988
  // src/version.ts
8977
- var VERSION = "3.0.0";
8989
+ var VERSION = "4.0.1";
8978
8990
 
8979
8991
  // src/runtime.ts
8980
8992
  function buildRuntime(config) {