@standardagents/code-web 0.14.1-branch.9e48e914.7f688d → 0.14.1-branch.9e48e914.eb6e4d

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 (35) hide show
  1. package/dist/build.json +1 -1
  2. package/dist/manifest.json +1 -1
  3. package/dist/manifest.sig +1 -1
  4. package/dist/pkg/standard_web.d.ts +5 -5
  5. package/dist/pkg/standard_web.js +20 -20
  6. package/dist/pkg/standard_web_bg.wasm +0 -0
  7. package/dist/pkg/standard_web_bg.wasm.d.ts +5 -5
  8. package/dist/plugins/clock-cells/clock_cells.core.wasm +0 -0
  9. package/dist/plugins/clock-cells/clock_cells.wasm +0 -0
  10. package/dist/plugins/clock-cells/standard-plugin.json +11 -0
  11. package/dist/plugins/host/transpile.js +51 -0
  12. package/dist/plugins/host/ui-jspi.js +11726 -0
  13. package/dist/plugins/host/ui.core2.wasm +0 -0
  14. package/dist/plugins/host/ui.core3.wasm +0 -0
  15. package/dist/plugins/host/ui.js +11560 -0
  16. package/dist/plugins/host/world.js +171 -0
  17. package/dist/plugins/jco/cli.js +141 -0
  18. package/dist/plugins/jco/common.js +16 -0
  19. package/dist/plugins/jco/config.js +7 -0
  20. package/dist/plugins/jco/environment.js +24 -0
  21. package/dist/plugins/jco/filesystem.js +339 -0
  22. package/dist/plugins/jco/in-memory-filesystem.js +620 -0
  23. package/dist/plugins/jco/io.js +366 -0
  24. package/dist/plugins/jco/js-component-bindgen-component.core.wasm +0 -0
  25. package/dist/plugins/jco/js-component-bindgen-component.core2.wasm +0 -0
  26. package/dist/plugins/jco/js-component-bindgen-component.js +14272 -0
  27. package/dist/plugins/jco/opfs-filesystem.js +245 -0
  28. package/dist/plugins/jco/random.js +51 -0
  29. package/dist/plugins/plasma-pixels/plasma_pixels.core.wasm +0 -0
  30. package/dist/plugins/plasma-pixels/plasma_pixels.wasm +0 -0
  31. package/dist/plugins/plasma-pixels/standard-plugin.json +11 -0
  32. package/dist/plugins/runtime.js +835 -0
  33. package/dist/plugins/samples.json +81 -0
  34. package/dist/plugins/worker.js +410 -0
  35. package/package.json +1 -1
package/dist/build.json CHANGED
@@ -1 +1 @@
1
- {"schema":1,"commit":"7f688d2cd4822828138eabe9bc560532b24a2ed1","version":"0.14.1-branch.9e48e914.7f688d"}
1
+ {"schema":1,"commit":"eb6e4da282e68fa628587f836a43f73a9bcad7f6","version":"0.14.1-branch.9e48e914.eb6e4d"}
@@ -1 +1 @@
1
- {"schema":4,"format":"standard-npm-web-target-v1","repository":"standardagents/code-rs","commit":"7f688d2cd4822828138eabe9bc560532b24a2ed1","version":"0.14.1-branch.9e48e914.7f688d","target":"wasm32-unknown-unknown","signing":{"algorithm":"ed25519","keyId":"team-2026-1","platformCodeSignature":"ed25519-only"},"files":[{"path":"build.json","size":107,"sha256":"94076b147127b474592f2c0a08ff43fbb19e3c31d49a1f8fcdac4fd916d00d27"},{"path":"fonts/JetBrainsMonoNerdFontMono-Bold.ttf","size":2473884,"sha256":"5bdd4a873f3cd32f882d2c55545089123926e27707d5880fc9eaf84eb01b6686"},{"path":"fonts/JetBrainsMonoNerdFontMono-BoldItalic.ttf","size":2475144,"sha256":"d931df2928b3216892d35980cddcad9edade1b9c9cd2e09a6c2937139f474742"},{"path":"fonts/JetBrainsMonoNerdFontMono-Italic.ttf","size":2472232,"sha256":"ccd88b36d325e6a905edc8dd3f2522718d9690d9bed3fbb4684c7e746c34f846"},{"path":"fonts/JetBrainsMonoNerdFontMono-Regular.ttf","size":2470116,"sha256":"f01031f40e48dc29e1112e6b0b0450a2c6cd097f3f35cfff05c55cb311f8034c"},{"path":"licenses/JetBrainsMono-OFL.txt","size":4413,"sha256":"add1f8a9fd7ff33c923114eede3a6fb5a6254dc5b59f031fa59feed8a4f0938a"},{"path":"licenses/NerdFonts-MIT.txt","size":1456,"sha256":"b880baeed54757299e39e404743837a8f4d375828cab87b46ac55126160b237d"},{"path":"licenses/jco-transpile.txt","size":12243,"sha256":"268872b9816f90fd8e85db5a28d33f8150ebb8dd016653fb39ef1f94f2686bc5"},{"path":"pkg/standard_web.d.ts","size":9053,"sha256":"23c7cc901e353c9dd4604e4ae826f22d4e354b0da4a3de285ff35ba68110ab49"},{"path":"pkg/standard_web.js","size":68334,"sha256":"b6d74c9a8ae1529717754beabe12edeff6df85f0d8c421af97d6bed2004e98bb"},{"path":"pkg/standard_web_bg.wasm","size":7860499,"sha256":"6e8983c717aaf93c8246b229570b6160847105120e321c841cf08bc545f0f1a6"},{"path":"pkg/standard_web_bg.wasm.d.ts","size":3187,"sha256":"b4d47eb696e37da5c9c5ccb2ba8bd308e4da891df52473420fd132440ea26597"}]}
1
+ {"schema":4,"format":"standard-npm-web-target-v1","repository":"standardagents/code-rs","commit":"eb6e4da282e68fa628587f836a43f73a9bcad7f6","version":"0.14.1-branch.9e48e914.eb6e4d","target":"wasm32-unknown-unknown","signing":{"algorithm":"ed25519","keyId":"team-2026-1","platformCodeSignature":"ed25519-only"},"files":[{"path":"build.json","size":107,"sha256":"6f2db130e8ff4ac2cca6cf82cd7d9a96b419ef378d6aba978575d14afb7b8817"},{"path":"fonts/JetBrainsMonoNerdFontMono-Bold.ttf","size":2473884,"sha256":"5bdd4a873f3cd32f882d2c55545089123926e27707d5880fc9eaf84eb01b6686"},{"path":"fonts/JetBrainsMonoNerdFontMono-BoldItalic.ttf","size":2475144,"sha256":"d931df2928b3216892d35980cddcad9edade1b9c9cd2e09a6c2937139f474742"},{"path":"fonts/JetBrainsMonoNerdFontMono-Italic.ttf","size":2472232,"sha256":"ccd88b36d325e6a905edc8dd3f2522718d9690d9bed3fbb4684c7e746c34f846"},{"path":"fonts/JetBrainsMonoNerdFontMono-Regular.ttf","size":2470116,"sha256":"f01031f40e48dc29e1112e6b0b0450a2c6cd097f3f35cfff05c55cb311f8034c"},{"path":"licenses/JetBrainsMono-OFL.txt","size":4413,"sha256":"add1f8a9fd7ff33c923114eede3a6fb5a6254dc5b59f031fa59feed8a4f0938a"},{"path":"licenses/NerdFonts-MIT.txt","size":1456,"sha256":"b880baeed54757299e39e404743837a8f4d375828cab87b46ac55126160b237d"},{"path":"licenses/jco-transpile.txt","size":12243,"sha256":"268872b9816f90fd8e85db5a28d33f8150ebb8dd016653fb39ef1f94f2686bc5"},{"path":"pkg/standard_web.d.ts","size":9053,"sha256":"9556c88a1b962dadb01c25454a06cfc572dbf06da8cd7b0970422708230fa301"},{"path":"pkg/standard_web.js","size":68334,"sha256":"87be836bc2feba827f6874d7e17ce0b95dded9105f938a87fe63a29f41b4e577"},{"path":"pkg/standard_web_bg.wasm","size":7873162,"sha256":"bd4c3eb20e05f747d9857a8a67e5c2794cb17963aa7c2941e00a62efdfdb3325"},{"path":"pkg/standard_web_bg.wasm.d.ts","size":3187,"sha256":"7bddca841f7bd1626b7d2b9f1f70249a4a8834ccc0b2377b77ed2d52e5608072"},{"path":"plugins/clock-cells/clock_cells.core.wasm","size":65661,"sha256":"1780be63f31703b2815393a2673878267440d307b178fa4171822ab1f2576ad6"},{"path":"plugins/clock-cells/clock_cells.wasm","size":68789,"sha256":"95f376de28eadb794733a276aca47a79cb157d46711aa03c2e6c53dedc6b307f"},{"path":"plugins/clock-cells/standard-plugin.json","size":230,"sha256":"c0a02a1257bf24af47d1fab5d0dabd74882ec8d7dd07977ec95f15caf406515c"},{"path":"plugins/host/transpile.js","size":2231,"sha256":"b020345ecc9845373583a2e74ea640e8ff2e5cf89429ba3a18dcbd35aa6a3231"},{"path":"plugins/host/ui-jspi.js","size":384619,"sha256":"5f8969a2c27efafe617ff8bf7772059935652639afc61a92701840b2fb8cea1b"},{"path":"plugins/host/ui.core2.wasm","size":700,"sha256":"82831edc739efb216ac7d923025461fa5fca9a8fe4517dfbe84313a3aa67b962"},{"path":"plugins/host/ui.core3.wasm","size":521,"sha256":"24eb45b7db909f78431c1b595599c5f42c4364f6f30fe9f4c2ceed8fa416849a"},{"path":"plugins/host/ui.js","size":379704,"sha256":"1bfd9c4bd5142e300869c60cb0292f136da240ce1b0ed459c99073e9bb418c60"},{"path":"plugins/host/world.js","size":7681,"sha256":"57c4ba6ac774dd9208ebaa62ca6e093e9e9f8e2c301a67e083d12eb93131f1e0"},{"path":"plugins/jco/cli.js","size":3928,"sha256":"1be414c1be5805417b721d522e20effa58ceb25c6079b930130204974476bc0a"},{"path":"plugins/jco/common.js","size":608,"sha256":"13f126e02c3d50f82a49b132837aa588600fc907321141d535e7c4a7e7ee0290"},{"path":"plugins/jco/config.js","size":112,"sha256":"40c60a11b1841f461436b11a2ff3318feac4a496bb18a0688a3980e15cff181d"},{"path":"plugins/jco/environment.js","size":463,"sha256":"4b9daf18432ded5e09367ead23abcb5e85bb49ae6fa3b25bc24b8d6ddc7bf1e1"},{"path":"plugins/jco/filesystem.js","size":11099,"sha256":"40b57ec8c13c4d7966e29741cf01ddfa3e66aa94c6179d5aadaa4a0b0233ca67"},{"path":"plugins/jco/in-memory-filesystem.js","size":21314,"sha256":"0872da9d62b2a9d3653a30bc56d0065ce2730752411c9a7b39facbbaf8315441"},{"path":"plugins/jco/io.js","size":10836,"sha256":"fd078daff36bf8fa68c03c8de3c06e54b74a62207838f076d8e48c603879606e"},{"path":"plugins/jco/js-component-bindgen-component.core.wasm","size":3479967,"sha256":"aa0681475ab02fa5a9ad05aa1ce5e700f9f8da0a9986b973c968545ad4816fa2"},{"path":"plugins/jco/js-component-bindgen-component.core2.wasm","size":14120,"sha256":"280fbf3d86c902fbf15419b9f95cf92b50778514d50bc0c06c11d3ae012296f6"},{"path":"plugins/jco/js-component-bindgen-component.js","size":452801,"sha256":"6932aca804a3cdeff51c3e747080cea640646b8c08a37c263f204a52447a096c"},{"path":"plugins/jco/opfs-filesystem.js","size":8949,"sha256":"fe98f84947ec9ae9f0a7e1ad6fa88148c44b4801ac7e48d4d17d0ee3814a48d8"},{"path":"plugins/jco/random.js","size":1942,"sha256":"0f70a30c6e57f3b253e3a8c13c6b8b01947e40596266df8406d31bd7989f27cd"},{"path":"plugins/plasma-pixels/plasma_pixels.core.wasm","size":36299,"sha256":"2f413b012ee43ecd5a677379b52a4d2dfcde7b99899596af24350397dcf89fc2"},{"path":"plugins/plasma-pixels/plasma_pixels.wasm","size":39427,"sha256":"a4c304fd46e2efc088f6bca6e90998ac57a6bb155f1484ddd84aaf464db2ef62"},{"path":"plugins/plasma-pixels/standard-plugin.json","size":216,"sha256":"5f1b94853aaa5fd6103d458e391452325e8fd537ad22bf5e1eb439106dc56de1"},{"path":"plugins/runtime.js","size":32365,"sha256":"99bd37cb826652ac3108dd4f90db67df5b8e7bd1788750082733bb5b85b7316e"},{"path":"plugins/samples.json","size":2116,"sha256":"7c405e46e90e1ff3e55721a7c7cd716a6bbcbd7d063897cda72c82f7ef295994"},{"path":"plugins/worker.js","size":14736,"sha256":"1390889126305ec59ba230f8a56cd867b47bf7a7f670e1bf2479931eeb529851"}]}
package/dist/manifest.sig CHANGED
@@ -1 +1 @@
1
- snyznkt/yVI4zHLNLEAh8WdajeGrQ0m5BhqRn8pcYH5rcKIIL7J0AfH5a0nRW9K4uNRK4JPEyuZp9huJX3EWAQ==
1
+ t+vJFhbr6+UP6iNFjt+lyo7bry89ZtSh+qEJsTofrJKTad3w9uqLt0i3w3xP6lqTsQvQUwv6HfV24/YmSBPbAA==
@@ -157,11 +157,11 @@ export interface InitOutput {
157
157
  readonly session_take_clipboard: (a: number, b: number) => void;
158
158
  readonly session_wheel: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number) => void;
159
159
  readonly start: () => void;
160
- readonly __wasm_bindgen_func_elem_11030: (a: number, b: number, c: number, d: number) => void;
161
- readonly __wasm_bindgen_func_elem_11032: (a: number, b: number, c: number, d: number) => void;
162
- readonly __wasm_bindgen_func_elem_541: (a: number, b: number, c: number) => void;
163
- readonly __wasm_bindgen_func_elem_541_2: (a: number, b: number, c: number) => void;
164
- readonly __wasm_bindgen_func_elem_541_3: (a: number, b: number, c: number) => void;
160
+ readonly __wasm_bindgen_func_elem_11055: (a: number, b: number, c: number, d: number) => void;
161
+ readonly __wasm_bindgen_func_elem_11057: (a: number, b: number, c: number, d: number) => void;
162
+ readonly __wasm_bindgen_func_elem_485: (a: number, b: number, c: number) => void;
163
+ readonly __wasm_bindgen_func_elem_485_2: (a: number, b: number, c: number) => void;
164
+ readonly __wasm_bindgen_func_elem_485_3: (a: number, b: number, c: number) => void;
165
165
  readonly __wbindgen_export: (a: number, b: number) => number;
166
166
  readonly __wbindgen_export2: (a: number, b: number, c: number, d: number) => number;
167
167
  readonly __wbindgen_export3: (a: number) => void;
@@ -899,7 +899,7 @@ function __wbg_get_imports() {
899
899
  const a = state0.a;
900
900
  state0.a = 0;
901
901
  try {
902
- return __wasm_bindgen_func_elem_11032(a, state0.b, arg0, arg1);
902
+ return __wasm_bindgen_func_elem_11057(a, state0.b, arg0, arg1);
903
903
  } finally {
904
904
  state0.a = a;
905
905
  }
@@ -941,7 +941,7 @@ function __wbg_get_imports() {
941
941
  const a = state0.a;
942
942
  state0.a = 0;
943
943
  try {
944
- return __wasm_bindgen_func_elem_11032(a, state0.b, arg0, arg1);
944
+ return __wasm_bindgen_func_elem_11057(a, state0.b, arg0, arg1);
945
945
  } finally {
946
946
  state0.a = a;
947
947
  }
@@ -1268,23 +1268,23 @@ function __wbg_get_imports() {
1268
1268
  return ret;
1269
1269
  },
1270
1270
  __wbindgen_cast_0000000000000001: function(arg0, arg1) {
1271
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 1270, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
1272
- const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_11030);
1271
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 1277, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
1272
+ const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_11055);
1273
1273
  return addHeapObject(ret);
1274
1274
  },
1275
1275
  __wbindgen_cast_0000000000000002: function(arg0, arg1) {
1276
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("CloseEvent")], shim_idx: 179, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
1277
- const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_541);
1276
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("CloseEvent")], shim_idx: 265, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
1277
+ const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_485);
1278
1278
  return addHeapObject(ret);
1279
1279
  },
1280
1280
  __wbindgen_cast_0000000000000003: function(arg0, arg1) {
1281
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("Event")], shim_idx: 179, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
1282
- const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_541_2);
1281
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("Event")], shim_idx: 265, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
1282
+ const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_485_2);
1283
1283
  return addHeapObject(ret);
1284
1284
  },
1285
1285
  __wbindgen_cast_0000000000000004: function(arg0, arg1) {
1286
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("MessageEvent")], shim_idx: 179, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
1287
- const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_541_3);
1286
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("MessageEvent")], shim_idx: 265, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
1287
+ const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_485_3);
1288
1288
  return addHeapObject(ret);
1289
1289
  },
1290
1290
  __wbindgen_cast_0000000000000005: function(arg0, arg1) {
@@ -1311,22 +1311,22 @@ function __wbg_get_imports() {
1311
1311
  };
1312
1312
  }
1313
1313
 
1314
- function __wasm_bindgen_func_elem_541(arg0, arg1, arg2) {
1315
- wasm.__wasm_bindgen_func_elem_541(arg0, arg1, addHeapObject(arg2));
1314
+ function __wasm_bindgen_func_elem_485(arg0, arg1, arg2) {
1315
+ wasm.__wasm_bindgen_func_elem_485(arg0, arg1, addHeapObject(arg2));
1316
1316
  }
1317
1317
 
1318
- function __wasm_bindgen_func_elem_541_2(arg0, arg1, arg2) {
1319
- wasm.__wasm_bindgen_func_elem_541_2(arg0, arg1, addHeapObject(arg2));
1318
+ function __wasm_bindgen_func_elem_485_2(arg0, arg1, arg2) {
1319
+ wasm.__wasm_bindgen_func_elem_485_2(arg0, arg1, addHeapObject(arg2));
1320
1320
  }
1321
1321
 
1322
- function __wasm_bindgen_func_elem_541_3(arg0, arg1, arg2) {
1323
- wasm.__wasm_bindgen_func_elem_541_3(arg0, arg1, addHeapObject(arg2));
1322
+ function __wasm_bindgen_func_elem_485_3(arg0, arg1, arg2) {
1323
+ wasm.__wasm_bindgen_func_elem_485_3(arg0, arg1, addHeapObject(arg2));
1324
1324
  }
1325
1325
 
1326
- function __wasm_bindgen_func_elem_11030(arg0, arg1, arg2) {
1326
+ function __wasm_bindgen_func_elem_11055(arg0, arg1, arg2) {
1327
1327
  try {
1328
1328
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1329
- wasm.__wasm_bindgen_func_elem_11030(retptr, arg0, arg1, addHeapObject(arg2));
1329
+ wasm.__wasm_bindgen_func_elem_11055(retptr, arg0, arg1, addHeapObject(arg2));
1330
1330
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1331
1331
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1332
1332
  if (r1) {
@@ -1337,8 +1337,8 @@ function __wasm_bindgen_func_elem_11030(arg0, arg1, arg2) {
1337
1337
  }
1338
1338
  }
1339
1339
 
1340
- function __wasm_bindgen_func_elem_11032(arg0, arg1, arg2, arg3) {
1341
- wasm.__wasm_bindgen_func_elem_11032(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
1340
+ function __wasm_bindgen_func_elem_11057(arg0, arg1, arg2, arg3) {
1341
+ wasm.__wasm_bindgen_func_elem_11057(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
1342
1342
  }
1343
1343
 
1344
1344
 
Binary file
@@ -27,11 +27,11 @@ export const session_start_plugins: (a: number, b: number, c: number, d: number,
27
27
  export const session_take_clipboard: (a: number, b: number) => void;
28
28
  export const session_wheel: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number) => void;
29
29
  export const start: () => void;
30
- export const __wasm_bindgen_func_elem_11030: (a: number, b: number, c: number, d: number) => void;
31
- export const __wasm_bindgen_func_elem_11032: (a: number, b: number, c: number, d: number) => void;
32
- export const __wasm_bindgen_func_elem_541: (a: number, b: number, c: number) => void;
33
- export const __wasm_bindgen_func_elem_541_2: (a: number, b: number, c: number) => void;
34
- export const __wasm_bindgen_func_elem_541_3: (a: number, b: number, c: number) => void;
30
+ export const __wasm_bindgen_func_elem_11055: (a: number, b: number, c: number, d: number) => void;
31
+ export const __wasm_bindgen_func_elem_11057: (a: number, b: number, c: number, d: number) => void;
32
+ export const __wasm_bindgen_func_elem_485: (a: number, b: number, c: number) => void;
33
+ export const __wasm_bindgen_func_elem_485_2: (a: number, b: number, c: number) => void;
34
+ export const __wasm_bindgen_func_elem_485_3: (a: number, b: number, c: number) => void;
35
35
  export const __wbindgen_export: (a: number, b: number) => number;
36
36
  export const __wbindgen_export2: (a: number, b: number, c: number, d: number) => number;
37
37
  export const __wbindgen_export3: (a: number) => void;
@@ -0,0 +1,11 @@
1
+ {
2
+ "apiVersion": 2,
3
+ "kind": "ui",
4
+ "id": "clock-cells",
5
+ "version": "0.1.0",
6
+ "module": "clock_cells.wasm",
7
+ "surfaces": [
8
+ { "id": "card", "anchor": "sidebar.card", "model": "cells", "height": 2 }
9
+ ],
10
+ "grants": {}
11
+ }
@@ -0,0 +1,51 @@
1
+ // The trusted transpile step, run in the viewer (docs/plugin-runtime.md,
2
+ // "The browser runtime"): jco's transpiler, the same pinned version the
3
+ // build uses, splits a plugin's verified component into its core modules,
4
+ // and the viewer keeps only the one that exports the world. jco's generated
5
+ // JavaScript for the component is discarded unread: the only glue that ever
6
+ // runs is the viewer's own reference glue (world.js).
7
+ //
8
+ // The build runs the same function in Node on the sample plugins, so a
9
+ // sample and an account package reach a Worker the same way.
10
+ import { ACCOUNT_IMPORTS, selectMain } from './world.js'
11
+
12
+ /** jco's `generate` options: sync instantiation, core modules as files. */
13
+ export const GENERATE_OPTIONS = Object.freeze({
14
+ name: 'plugin',
15
+ noTypescript: true,
16
+ instantiation: { tag: 'sync' },
17
+ map: [],
18
+ noNodejsCompat: true,
19
+ base64Cutoff: 0,
20
+ tlaCompat: false,
21
+ validLiftingOptimization: false,
22
+ tracing: false,
23
+ noComponentErrorWrapping: true,
24
+ })
25
+
26
+ const WORLD_PACKAGE = 'standard:plugin/'
27
+ const CORE_FILE = /\.core\d*\.wasm$/
28
+
29
+ /**
30
+ * The plugin's world core module, from its component's bytes. `generate`
31
+ * is jco's (`js-component-bindgen-component.js`). Throws when jco refuses
32
+ * the component, when it imports an interface outside `standard:plugin`,
33
+ * or when no single core module exports the world.
34
+ */
35
+ export async function extractMain(component, generate) {
36
+ let generated
37
+ try {
38
+ generated = generate(component instanceof Uint8Array ? component : new Uint8Array(component), GENERATE_OPTIONS)
39
+ } catch (error) {
40
+ throw new Error(`jco refused the component: ${error?.payload ?? error?.message ?? error}`)
41
+ }
42
+ const outside = generated.imports.filter(name => !name.startsWith(WORLD_PACKAGE))
43
+ if (outside.length) throw new Error(`the component imports outside the ui-plugin world: ${outside.join(', ')}`)
44
+ const cores = generated.files.filter(([name]) => CORE_FILE.test(name)).map(([, bytes]) => bytes)
45
+ const modules = await Promise.all(cores.map(bytes => WebAssembly.compile(bytes)))
46
+ const main = selectMain(modules)
47
+ return cores[modules.indexOf(main)]
48
+ }
49
+
50
+ /** The account-backed imports in the async form jco takes. */
51
+ export const JSPI_IMPORTS = ACCOUNT_IMPORTS