@bytecodealliance/jco 1.25.1 → 1.26.0

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 (70) hide show
  1. package/README.md +27 -4
  2. package/dist/api.d.ts +6 -0
  3. package/dist/api.d.ts.map +1 -0
  4. package/{src → dist}/api.js +2 -12
  5. package/dist/api.js.map +1 -0
  6. package/dist/browser.d.ts +5 -0
  7. package/dist/browser.d.ts.map +1 -0
  8. package/dist/browser.js +12 -0
  9. package/dist/browser.js.map +1 -0
  10. package/dist/bundle.d.ts +42 -0
  11. package/dist/bundle.d.ts.map +1 -0
  12. package/dist/bundle.js +124 -0
  13. package/dist/bundle.js.map +1 -0
  14. package/dist/cmd/componentize.d.ts +34 -0
  15. package/dist/cmd/componentize.d.ts.map +1 -0
  16. package/dist/cmd/componentize.js +243 -0
  17. package/dist/cmd/componentize.js.map +1 -0
  18. package/{types → dist}/cmd/opt.d.ts +17 -12
  19. package/dist/cmd/opt.d.ts.map +1 -0
  20. package/{src → dist}/cmd/opt.js +53 -87
  21. package/dist/cmd/opt.js.map +1 -0
  22. package/dist/cmd/run.d.ts +3 -0
  23. package/dist/cmd/run.d.ts.map +1 -0
  24. package/{src → dist}/cmd/run.js +24 -54
  25. package/dist/cmd/run.js.map +1 -0
  26. package/dist/cmd/transpile.d.ts +48 -0
  27. package/dist/cmd/transpile.d.ts.map +1 -0
  28. package/{src → dist}/cmd/transpile.js +1 -36
  29. package/dist/cmd/transpile.js.map +1 -0
  30. package/{types → dist}/cmd/types.d.ts +21 -22
  31. package/dist/cmd/types.d.ts.map +1 -0
  32. package/{src → dist}/cmd/types.js +27 -51
  33. package/dist/cmd/types.js.map +1 -0
  34. package/dist/cmd/wasm-tools.d.ts +8 -0
  35. package/dist/cmd/wasm-tools.d.ts.map +1 -0
  36. package/{src → dist}/cmd/wasm-tools.js +28 -42
  37. package/dist/cmd/wasm-tools.js.map +1 -0
  38. package/{types → dist}/common.d.ts +27 -25
  39. package/dist/common.d.ts.map +1 -0
  40. package/{src → dist}/common.js +19 -44
  41. package/dist/common.js.map +1 -0
  42. package/{types → dist}/jco.d.ts.map +1 -1
  43. package/{src → dist}/jco.js +74 -149
  44. package/dist/jco.js.map +1 -0
  45. package/dist/ora-shim.d.ts +9 -0
  46. package/dist/ora-shim.d.ts.map +1 -0
  47. package/dist/ora-shim.js +10 -0
  48. package/dist/ora-shim.js.map +1 -0
  49. package/package.json +22 -22
  50. package/src/browser.js +0 -18
  51. package/src/cmd/componentize.js +0 -170
  52. package/src/ora-shim.js +0 -9
  53. package/types/api.d.ts +0 -6
  54. package/types/api.d.ts.map +0 -1
  55. package/types/browser.d.ts +0 -4
  56. package/types/browser.d.ts.map +0 -1
  57. package/types/cmd/componentize.d.ts +0 -2
  58. package/types/cmd/componentize.d.ts.map +0 -1
  59. package/types/cmd/opt.d.ts.map +0 -1
  60. package/types/cmd/run.d.ts +0 -3
  61. package/types/cmd/run.d.ts.map +0 -1
  62. package/types/cmd/transpile.d.ts +0 -72
  63. package/types/cmd/transpile.d.ts.map +0 -1
  64. package/types/cmd/types.d.ts.map +0 -1
  65. package/types/cmd/wasm-tools.d.ts +0 -8
  66. package/types/cmd/wasm-tools.d.ts.map +0 -1
  67. package/types/common.d.ts.map +0 -1
  68. package/types/ora-shim.d.ts +0 -8
  69. package/types/ora-shim.d.ts.map +0 -1
  70. /package/{types → dist}/jco.d.ts +0 -0
@@ -5,9 +5,7 @@ import { spawn } from "node:child_process";
5
5
  import { argv0 } from "node:process";
6
6
  import { platform } from "node:process";
7
7
  import * as nodeUtils from "node:util";
8
-
9
8
  export const isWindows = platform === "win32";
10
-
11
9
  export const ASYNC_WASI_IMPORTS = [
12
10
  "wasi:io/poll#poll",
13
11
  "wasi:io/poll#[method]pollable.block",
@@ -18,14 +16,10 @@ export const ASYNC_WASI_IMPORTS = [
18
16
  "wasi:io/streams#[method]output-stream.blocking-write-zeroes-and-flush",
19
17
  "wasi:io/streams#[method]output-stream.blocking-splice",
20
18
  ];
21
-
22
19
  export const ASYNC_WASI_EXPORTS = ["wasi:cli/run#run", "wasi:http/incoming-handler#handle"];
23
-
24
20
  export const DEFAULT_ASYNC_MODE = "sync";
25
-
26
21
  /** Path of WIT files by default when one is not specified */
27
22
  export const DEFAULT_WIT_PATH = "./wit";
28
-
29
23
  let _showSpinner = false;
30
24
  export function setShowSpinner(val) {
31
25
  _showSpinner = val;
@@ -35,7 +29,6 @@ export function getShowSpinner() {
35
29
  _showSpinner = false;
36
30
  return showSpinner;
37
31
  }
38
-
39
32
  export function sizeStr(num) {
40
33
  num /= 1024;
41
34
  if (num < 1000) {
@@ -45,14 +38,16 @@ export function sizeStr(num) {
45
38
  if (num < 1000) {
46
39
  return `${fixedDigitDisplay(num, 4)} MiB`;
47
40
  }
41
+ num /= 1024;
42
+ return `${fixedDigitDisplay(num, 4)} GiB`;
48
43
  }
49
-
50
44
  export function fixedDigitDisplay(num, maxChars) {
51
45
  const significantDigits = String(num).split(".")[0].length;
52
46
  let str;
53
47
  if (significantDigits >= maxChars - 1) {
54
48
  str = String(Math.round(num));
55
- } else {
49
+ }
50
+ else {
56
51
  const decimalPlaces = maxChars - significantDigits - 1;
57
52
  const rounding = 10 ** decimalPlaces;
58
53
  str = String(Math.round(num * rounding) / rounding);
@@ -62,7 +57,6 @@ export function fixedDigitDisplay(num, maxChars) {
62
57
  }
63
58
  return " ".repeat(maxChars - str.length) + str;
64
59
  }
65
-
66
60
  /**
67
61
  * Generate tabular output
68
62
  *
@@ -74,16 +68,14 @@ export function table(rows, align = []) {
74
68
  if (rows.length === 0) {
75
69
  return "";
76
70
  }
77
- const colLens = rows.reduce(
78
- (maxLens, cur) => maxLens.map((len, i) => Math.max(len, cur[i].length)),
79
- rows[0].map((cell) => cell.length),
80
- );
71
+ const colLens = rows.reduce((maxLens, cur) => maxLens.map((len, i) => Math.max(len, cur[i].length)), rows[0].map((cell) => cell.length));
81
72
  let outTable = "";
82
73
  for (const row of rows) {
83
74
  for (const [i, cell] of row.entries()) {
84
75
  if (align[i] === "right") {
85
76
  outTable += " ".repeat(colLens[i] - cell.length) + cell;
86
- } else {
77
+ }
78
+ else {
87
79
  outTable += cell + " ".repeat(colLens[i] - cell.length);
88
80
  }
89
81
  }
@@ -91,7 +83,6 @@ export function table(rows, align = []) {
91
83
  }
92
84
  return outTable;
93
85
  }
94
-
95
86
  /**
96
87
  * Securely creates a temporary directory and returns its path.
97
88
  *
@@ -102,23 +93,15 @@ export function table(rows, align = []) {
102
93
  export async function getTmpDir() {
103
94
  return await mkdtemp(normalize(tmpdir() + sep));
104
95
  }
105
-
106
- /**
107
- * Read a given file, throwing a formatted error if one occurs
108
- *
109
- * @param {string} filePath - path to teh file to read
110
- * @param {encoding} encoding - file encoding
111
- * @returns {Promise<Buffer>} A promise that resolves to the contents of the file
112
- */
113
96
  async function readFileCli(filePath, encoding) {
114
97
  try {
115
98
  return await readFile(filePath, encoding);
116
- } catch {
117
- throw `Unable to read file ${styleText("bold", filePath)}`;
99
+ }
100
+ catch {
101
+ throw `Unable to read file ${styleText("bold", String(filePath))}`;
118
102
  }
119
103
  }
120
104
  export { readFileCli as readFile };
121
-
122
105
  /**
123
106
  * Spawn a command that processes a given wasm binary bytes with some
124
107
  * command.
@@ -140,13 +123,10 @@ export async function spawnIOTmp(cmd, inputWasmBytes, args) {
140
123
  try {
141
124
  const inFile = resolve(tmpDir, "in.wasm");
142
125
  let outFile = resolve(tmpDir, "out.wasm");
143
-
144
126
  await writeFile(inFile, inputWasmBytes);
145
-
146
127
  const cp = spawn(argv0, [cmd, inFile, ...args, outFile], {
147
128
  stdio: "pipe",
148
129
  });
149
-
150
130
  let stderr = "";
151
131
  const p = new Promise((resolve, reject) => {
152
132
  cp.stderr.on("data", (data) => (stderr += data.toString()));
@@ -156,20 +136,20 @@ export async function spawnIOTmp(cmd, inputWasmBytes, args) {
156
136
  cp.on("exit", (code) => {
157
137
  if (code === 0) {
158
138
  resolve();
159
- } else {
139
+ }
140
+ else {
160
141
  reject(stderr);
161
142
  }
162
143
  });
163
144
  });
164
-
165
145
  await p;
166
146
  var output = await readFile(outFile);
167
147
  return output;
168
- } finally {
148
+ }
149
+ finally {
169
150
  await rm(tmpDir, { recursive: true });
170
151
  }
171
152
  }
172
-
173
153
  /**
174
154
  * Given an object that has file names as keys and file contents as values,
175
155
  * write out the files to a their locations.
@@ -182,16 +162,13 @@ export async function spawnIOTmp(cmd, inputWasmBytes, args) {
182
162
  *
183
163
  */
184
164
  export async function writeFiles(files, summaryTitle) {
185
- await Promise.all(
186
- Object.entries(files).map(async ([filePath, contents]) => {
187
- await mkdir(dirname(filePath), { recursive: true });
188
- await writeFile(filePath, contents);
189
- }),
190
- );
165
+ await Promise.all(Object.entries(files).map(async ([filePath, contents]) => {
166
+ await mkdir(dirname(filePath), { recursive: true });
167
+ await writeFile(filePath, contents);
168
+ }));
191
169
  if (!summaryTitle) {
192
170
  return;
193
171
  }
194
-
195
172
  let rows = Object.entries(files).map(([name, source]) => [
196
173
  ` - ${styleText("italic", name)} `,
197
174
  `${styleText(["black", "italic"], sizeStr(source.length))}`,
@@ -201,7 +178,6 @@ export async function writeFiles(files, summaryTitle) {
201
178
 
202
179
  ${table(rows)}`);
203
180
  }
204
-
205
181
  /**
206
182
  * Resolve the deafult WIT path, given a possibly
207
183
  *
@@ -212,7 +188,6 @@ export async function resolveDefaultWITPath(witPath) {
212
188
  if (witPath) {
213
189
  return witPath;
214
190
  }
215
-
216
191
  // Use a default/standard current-folder WIT directory (wit) if we can find it
217
192
  const witDirExists = await stat(DEFAULT_WIT_PATH)
218
193
  .then((p) => p.isDirectory())
@@ -224,7 +199,6 @@ export async function resolveDefaultWITPath(witPath) {
224
199
  console.error(`no WIT directory specified, using detected WIT directory @ [${DEFAULT_WIT_PATH}]`);
225
200
  return witPath;
226
201
  }
227
-
228
202
  /**
229
203
  * Partial polyfill for 'node:util' `styleText()`
230
204
  *
@@ -238,3 +212,4 @@ export function styleText(styles, text) {
238
212
  }
239
213
  return text;
240
214
  }
215
+ //# sourceMappingURL=common.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"common.js","sourceRoot":"","sources":["../src/common.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,GAAG,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC7D,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACjC,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,EAAE,EAAE,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AACjF,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAC3C,OAAO,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AACrC,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AACxC,OAAO,KAAK,SAAS,MAAM,WAAW,CAAC;AAEvC,MAAM,CAAC,MAAM,SAAS,GAAG,QAAQ,KAAK,OAAO,CAAC;AAE9C,MAAM,CAAC,MAAM,kBAAkB,GAAG;IAC9B,mBAAmB;IACnB,qCAAqC;IACrC,oDAAoD;IACpD,oDAAoD;IACpD,sDAAsD;IACtD,gEAAgE;IAChE,uEAAuE;IACvE,uDAAuD;CAC1D,CAAC;AAEF,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,kBAAkB,EAAE,mCAAmC,CAAC,CAAC;AAE5F,MAAM,CAAC,MAAM,kBAAkB,GAAG,MAAM,CAAC;AAEzC,6DAA6D;AAC7D,MAAM,CAAC,MAAM,gBAAgB,GAAG,OAAO,CAAC;AAExC,IAAI,YAAY,GAAG,KAAK,CAAC;AACzB,MAAM,UAAU,cAAc,CAAC,GAAY;IACvC,YAAY,GAAG,GAAG,CAAC;AACvB,CAAC;AACD,MAAM,UAAU,cAAc;IAC1B,MAAM,WAAW,GAAG,YAAY,CAAC;IACjC,YAAY,GAAG,KAAK,CAAC;IACrB,OAAO,WAAW,CAAC;AACvB,CAAC;AAED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O,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE;KAC9D,CAAC,CAAC;IACH,OAAO,CAAC,GAAG,CAAC;IACZ,SAAS,CAAC,MAAM,EAAE,YAAY,GAAG,GAAG,CAAC;;EAEvC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;AACjB,CAAC;AAED;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,qBAAqB,CAAC,OAAgB;IACxD,IAAI,OAAO,EAAE,CAAC;QACV,OAAO,OAAO,CAAC;IACnB,CAAC;IAED,8EAA8E;IAC9E,MAAM,YAAY,GAAG,MAAM,IAAI,CAAC,gBAAgB,CAAC;SAC5C,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC;SAC5B,KAAK,CAAC,GAAG,EAAE,CAAC,KAAK,CAAC,CAAC;IACxB,IAAI,CAAC,YAAY,EAAE,CAAC;QAChB,MAAM,IAAI,KAAK,CAAC,0EAA0E,CAAC,CAAC;IAChG,CAAC;IACD,OAAO,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAC;IACpC,OAAO,CAAC,KAAK,CAAC,+DAA+D,gBAAgB,GAAG,CAAC,CAAC;IAClG,OAAO,OAAO,CAAC;AACnB,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,SAAS,CAAC,MAAiD,EAAE,IAAY;IACrF,IAAI,SAAS,CAAC,SAAS,EAAE,CAAC;QACtB,OAAO,SAAS,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;IAC7C,CAAC;IACD,OAAO,IAAI,CAAC;AAChB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"jco.d.ts","sourceRoot":"","sources":["../src/jco.js"],"names":[],"mappings":""}
1
+ {"version":3,"file":"jco.d.ts","sourceRoot":"","sources":["../src/jco.ts"],"names":[],"mappings":""}
@@ -1,36 +1,21 @@
1
1
  #!/usr/bin/env node
2
-
3
2
  import { program, Option } from "commander";
4
-
5
3
  import { opt } from "./cmd/opt.js";
6
4
  import { transpileCmd } from "./cmd/transpile.js";
7
5
  import { types, guestTypes } from "./cmd/types.js";
8
6
  import { run as runCmd, serve as serveCmd } from "./cmd/run.js";
9
- import {
10
- parse,
11
- print,
12
- componentNew,
13
- componentEmbed,
14
- metadataAdd,
15
- metadataShow,
16
- componentWit,
17
- } from "./cmd/wasm-tools.js";
7
+ import { parse, print, componentNew, componentEmbed, metadataAdd, metadataShow, componentWit, } from "./cmd/wasm-tools.js";
18
8
  import { componentize } from "./cmd/componentize.js";
19
9
  import { styleText } from "./common.js";
20
-
21
10
  program
22
11
  .name("jco")
23
- .description(
24
- `${styleText("bold", "jco - WebAssembly JS Component Tools")}\n JS Component Transpilation Bindgen & Wasm Tools for JS`,
25
- )
12
+ .description(`${styleText("bold", "jco - WebAssembly JS Component Tools")}\n JS Component Transpilation Bindgen & Wasm Tools for JS`)
26
13
  .usage("<command> [options]")
27
14
  .enablePositionalOptions()
28
- .version("1.25.1");
29
-
15
+ .version("1.26.0");
30
16
  function myParseInt(value) {
31
17
  return parseInt(value, 10);
32
18
  }
33
-
34
19
  /**
35
20
  * Option parsing that allows for collecting repeated arguments
36
21
  *
@@ -40,37 +25,38 @@ function myParseInt(value) {
40
25
  function collectOptions(value, previous) {
41
26
  return previous.concat([value]);
42
27
  }
43
-
44
28
  /** Choices for features (enabling/disabling) */
45
29
  const FEATURE_CHOICES = ["clocks", "http", "random", "stdio", "fetch-event", "all"];
46
-
47
30
  program
48
31
  .command("componentize")
49
- .description("Create a component from a JavaScript module")
50
- .usage("<js-source> --wit wit-world.wit -o <component-path>")
51
- .argument("<js-source>", "JS source file to build")
32
+ .description("Create a component from a JavaScript or TypeScript module")
33
+ .usage("<source> --wit wit-world.wit -o <component-path>")
34
+ .argument("<source>", "JavaScript or TypeScript source file to build")
52
35
  .requiredOption("-w, --wit <path>", "WIT path to build with")
53
36
  .option("-n, --world-name <name>", "WIT world to build")
54
37
  .option("--aot", "Enable Weval AOT compilation of JS")
55
38
  .option("--aot-min-stack-size-bytes <number>", "Set the min stack size to be used during AOT")
56
39
  .option("--weval-bin <path>", "Specify a custom weval binary to use")
40
+ .option("--wizer-bin <path>", "Specify a custom wizer binary to use")
57
41
  .addOption(new Option("-d, --disable <feature...>", "disable WASI features").choices(FEATURE_CHOICES))
58
42
  .addOption(new Option("--enable <feature...>", "enable WASI features").choices(FEATURE_CHOICES))
59
43
  .option("--debug", "configure jco for debug (e.g. disable all features except stdio, etc)")
60
44
  .option("--preview2-adapter <adapter>", "provide a custom preview2 adapter path")
45
+ .addOption(new Option("--backend <backend>", "componentization backend")
46
+ .choices(["starlingmonkey", "sm", "quickjs", "qjs"])
47
+ .default("starlingmonkey"))
48
+ .option("--backend-qjs-disable-async", "disable async (enable the 'sync' option) when buliding with componentize-qjs")
61
49
  .option("--debug-starlingmonkey-build", "use a debug build of StarlingMonkey")
62
- .option("--engine <path>", "use a specific StarlingMonkey build")
50
+ .option("--engine <path>", "use a specific StarlingMonkey build (StarlingMonkey backend only)")
51
+ .option("--bundle", "bundle source and its dependencies before componentization (automatic for TypeScript)")
52
+ .option("--bundle-config <path>", "merge a Rolldown configuration module into the component bundle")
63
53
  .requiredOption("-o, --out <out>", "output component file")
64
54
  .option("--debug-bindings", "Output debug bindings and metadata during componentization (by default to stderr)")
65
55
  .option("--debug-bindings-dir <dir>", "Directory to which to output generated bindings and metadata")
66
- .option(
67
- "--debug-binary",
68
- "Output binary (without component metadata) created during componentization (by default to tmp dir)",
69
- )
56
+ .option("--debug-binary", "Output binary (without component metadata) created during componentization (by default to tmp dir)")
70
57
  .option("--debug-binary-path <path>", "Path to which to write the generated debug binary")
71
58
  .option("--debug-enable-wizer-logging", "Enable wizer call debugging")
72
59
  .action(asyncAction(componentize));
73
-
74
60
  program
75
61
  .command("transpile")
76
62
  .description("Transpile a WebAssembly Component to JS + core Wasm for JavaScript execution")
@@ -81,57 +67,34 @@ program
81
67
  .option("-m, --minify", "minify the JS output (--optimize / opt cmd still required)")
82
68
  .option("-O, --optimize", `optimize the component first (use -- and arguments to wasm-opt)`)
83
69
  .option("--no-typescript", "do not output TypeScript .d.ts types")
84
- .option(
85
- "--valid-lifting-optimization",
86
- "optimize component binary validations assuming all lifted values are valid",
87
- )
88
- .addOption(
89
- new Option("--import-bindings [mode]", "bindings mode for imports")
90
- .choices(["js", "optimized", "hybrid", "direct-optimized"])
91
- .preset("js"),
92
- )
93
- .addOption(
94
- new Option("--async-mode [mode]", "EXPERIMENTAL: use async imports and exports")
95
- .choices(["sync", "jspi"])
96
- .preset("sync"),
97
- )
70
+ .option("--valid-lifting-optimization", "optimize component binary validations assuming all lifted values are valid")
71
+ .addOption(new Option("--import-bindings [mode]", "bindings mode for imports")
72
+ .choices(["js", "optimized", "hybrid", "direct-optimized"])
73
+ .preset("js"))
74
+ .addOption(new Option("--async-mode [mode]", "EXPERIMENTAL: use async imports and exports")
75
+ .choices(["sync", "jspi"])
76
+ .preset("sync"))
98
77
  .option("--async-wasi-imports", "EXPERIMENTAL: async component imports from WASI interfaces")
99
78
  .option("--async-wasi-exports", "EXPERIMENTAL: async component exports from WASI interfaces")
100
- .option(
101
- "--async-imports <imports...>",
102
- 'EXPERIMENTAL: async component imports (examples: "wasi:io/poll@0.2.0#poll", "wasi:io/poll#[method]pollable.block")',
103
- )
104
- .option(
105
- "--async-exports <exports...>",
106
- 'EXPERIMENTAL: async component exports (examples: "wasi:cli/run@#run", "handle")',
107
- )
79
+ .option("--async-imports <imports...>", 'EXPERIMENTAL: async component imports (examples: "wasi:io/poll@0.2.0#poll", "wasi:io/poll#[method]pollable.block")')
80
+ .option("--async-exports <exports...>", 'EXPERIMENTAL: async component exports (examples: "wasi:cli/run@#run", "handle")')
108
81
  .option("--tracing", "emit `tracing` calls on function entry/exit")
109
- .option(
110
- "-b, --base64-cutoff <bytes>",
111
- "set the byte size under which core Wasm binaries will be inlined as base64",
112
- myParseInt,
113
- )
114
- .option(
115
- "--tla-compat",
116
- "enables compatibility for JS environments without top-level await support via an async $init promise export",
117
- )
82
+ .option("-b, --base64-cutoff <bytes>", "set the byte size under which core Wasm binaries will be inlined as base64", myParseInt)
83
+ .option("--tla-compat", "enables compatibility for JS environments without top-level await support via an async $init promise export")
118
84
  .option("--no-nodejs-compat", "disables compatibility in Node.js without a fetch global")
119
85
  .option("-M, --map <mappings...>", "specifier=./output custom mappings for the component imports")
120
86
  .option("--no-wasi-shim", "disable automatic rewriting of WASI imports to use @bytecodealliance/preview2-shim")
121
87
  .option("--stub", "generate a stub implementation from a WIT file directly")
122
88
  .option("--js", "output JS instead of core WebAssembly")
123
- .addOption(
124
- new Option("-I, --instantiation [mode]", "output for custom module instantiation")
125
- .choices(["async", "sync"])
126
- .preset("async"),
127
- )
89
+ .addOption(new Option("-I, --instantiation [mode]", "output for custom module instantiation")
90
+ .choices(["async", "sync"])
91
+ .preset("async"))
128
92
  .option("-q, --quiet", "disable output summary")
129
93
  .option("--no-namespaced-exports", "disable namespaced exports for typescript compatibility")
130
94
  .option("--multi-memory", "optimized output for Wasm multi-memory")
131
95
  .option("--strict", "generate bindings with strict type checking")
132
96
  .allowExcessArguments(true)
133
97
  .action(asyncAction(transpileCmd));
134
-
135
98
  program
136
99
  .command("types")
137
100
  .description("Generate types for the given WIT")
@@ -141,33 +104,22 @@ program
141
104
  .option("-n, --world-name <world>", "WIT world to generate types for")
142
105
  .option("-o, --out-dir <out-dir>", "output directory")
143
106
  .option("--tla-compat", "generates types for the TLA compat output with an async $init promise export")
144
- .addOption(
145
- new Option("-I, --instantiation [mode]", "type output for custom module instantiation")
146
- .choices(["async", "sync"])
147
- .preset("async"),
148
- )
149
- .addOption(
150
- new Option("--async-mode [mode]", "EXPERIMENTAL: use async imports and exports")
151
- .choices(["sync", "jspi"])
152
- .preset("sync"),
153
- )
107
+ .addOption(new Option("-I, --instantiation [mode]", "type output for custom module instantiation")
108
+ .choices(["async", "sync"])
109
+ .preset("async"))
110
+ .addOption(new Option("--async-mode [mode]", "EXPERIMENTAL: use async imports and exports")
111
+ .choices(["sync", "jspi"])
112
+ .preset("sync"))
154
113
  .option("--async-wasi-imports", "EXPERIMENTAL: async component imports from WASI interfaces")
155
114
  .option("--async-wasi-exports", "EXPERIMENTAL: async component exports from WASI interfaces")
156
- .option(
157
- "--async-imports <imports...>",
158
- 'EXPERIMENTAL: async component imports (examples: "wasi:io/poll@0.2.0#poll", "wasi:io/poll#[method]pollable.block")',
159
- )
160
- .option(
161
- "--async-exports <exports...>",
162
- 'EXPERIMENTAL: async component exports (examples: "ns:pkg/iface#func", "wasi:cli/run@0.2.3#run", "handle")',
163
- )
115
+ .option("--async-imports <imports...>", 'EXPERIMENTAL: async component imports (examples: "wasi:io/poll@0.2.0#poll", "wasi:io/poll#[method]pollable.block")')
116
+ .option("--async-exports <exports...>", 'EXPERIMENTAL: async component exports (examples: "ns:pkg/iface#func", "wasi:cli/run@0.2.3#run", "handle")')
164
117
  .option("-q, --quiet", "disable output summary")
165
118
  .option("--feature <feature>", "enable one specific WIT feature (repeatable)", collectOptions, [])
166
119
  .option("--all-features", "enable all features")
167
120
  .option("--wasm-opt-bin <path-to-wasm-opt>', 'wasm-opt binary path (default: 'binaryen/bin/wasm-opt')")
168
121
  .option("--strict", "generate bindings with strict type checking")
169
122
  .action(asyncAction(types));
170
-
171
123
  program
172
124
  .command("guest-types")
173
125
  .description("(experimental) Generate guest types for the given WIT")
@@ -179,18 +131,12 @@ program
179
131
  .option("-q, --quiet", "disable output summary")
180
132
  .option("--feature <feature>", "enable one specific WIT feature (repeatable)", collectOptions, [])
181
133
  .option("--all-features", "enable all features")
182
- .option(
183
- "--async-exports <exports...>",
184
- 'EXPERIMENTAL: generate async exports (examples: "ns:pkg/iface#func", "wasi:cli/run@0.2.3#run", "handle")',
185
- )
186
- .addOption(
187
- new Option("--async-mode [mode]", "EXPERIMENTAL: use async imports and exports")
188
- .choices(["sync", "jspi"])
189
- .preset("sync"),
190
- )
134
+ .option("--async-exports <exports...>", 'EXPERIMENTAL: generate async exports (examples: "ns:pkg/iface#func", "wasi:cli/run@0.2.3#run", "handle")')
135
+ .addOption(new Option("--async-mode [mode]", "EXPERIMENTAL: use async imports and exports")
136
+ .choices(["sync", "jspi"])
137
+ .preset("sync"))
191
138
  .option("--strict", "generate bindings with strict type checking")
192
139
  .action(asyncAction(guestTypes));
193
-
194
140
  program
195
141
  .command("run")
196
142
  .description("Run a WASI Command component")
@@ -201,28 +147,21 @@ program
201
147
  .argument("<command>", "WASI command binary to run")
202
148
  .option("--jco-dir <dir>", "Instead of using a temporary dir, set the output directory for the run command")
203
149
  .option("--jco-trace", "Enable call tracing")
204
- .option(
205
- "--jco-import <module>",
206
- "Custom module to import before the run executes to support custom environment setup",
207
- )
150
+ .option("--jco-import <module>", "Custom module to import before the run executes to support custom environment setup")
208
151
  .option("--jco-map <mappings...>", "specifier=./output custom mappings for the component imports")
209
- .addOption(
210
- new Option("--jco-import-bindings [mode]", "bindings mode for imports")
211
- .choices(["js", "optimized", "hybrid", "direct-optimized"])
212
- .preset("js"),
213
- )
152
+ .addOption(new Option("--jco-import-bindings [mode]", "bindings mode for imports")
153
+ .choices(["js", "optimized", "hybrid", "direct-optimized"])
154
+ .preset("js"))
214
155
  .argument("[args...]", "Any CLI arguments for the component")
215
- .action(
216
- asyncAction(async function run(cmd, args, opts, command) {
217
- // specially only allow help option in first position
218
- if (cmd === "--help" || cmd === "-h") {
219
- command.help();
220
- } else {
221
- return runCmd(cmd, args, opts);
222
- }
223
- }),
224
- );
225
-
156
+ .action(asyncAction(async function run(cmd, args, opts, command) {
157
+ // specially only allow help option in first position
158
+ if (cmd === "--help" || cmd === "-h") {
159
+ command.help();
160
+ }
161
+ else {
162
+ return runCmd(cmd, args, opts);
163
+ }
164
+ }));
226
165
  program
227
166
  .command("serve")
228
167
  .description("Serve a WASI HTTP component")
@@ -235,28 +174,21 @@ program
235
174
  .option("--host <host>")
236
175
  .option("--jco-dir <dir>", "Instead of using a temporary dir, set the output directory for the transpiled code")
237
176
  .option("--jco-trace", "Enable call tracing")
238
- .option(
239
- "--jco-import <module>",
240
- "Custom module to import before the server executes to support custom environment setup",
241
- )
242
- .addOption(
243
- new Option("--jco-import-bindings [mode]", "bindings mode for imports")
244
- .choices(["js", "optimized", "hybrid", "direct-optimized"])
245
- .preset("js"),
246
- )
177
+ .option("--jco-import <module>", "Custom module to import before the server executes to support custom environment setup")
178
+ .addOption(new Option("--jco-import-bindings [mode]", "bindings mode for imports")
179
+ .choices(["js", "optimized", "hybrid", "direct-optimized"])
180
+ .preset("js"))
247
181
  .option("--jco-map <mappings...>", "specifier=./output custom mappings for the component imports")
248
182
  .argument("[args...]", "Any CLI arguments for the component")
249
- .action(
250
- asyncAction(async function serve(cmd, args, opts, command) {
251
- // specially only allow help option in first position
252
- if (cmd === "--help" || cmd === "-h") {
253
- command.help();
254
- } else {
255
- return serveCmd(cmd, args, opts);
256
- }
257
- }),
258
- );
259
-
183
+ .action(asyncAction(async function serve(cmd, args, opts, command) {
184
+ // specially only allow help option in first position
185
+ if (cmd === "--help" || cmd === "-h") {
186
+ command.help();
187
+ }
188
+ else {
189
+ return serveCmd(cmd, args, opts);
190
+ }
191
+ }));
260
192
  program
261
193
  .command("opt")
262
194
  .description("optimizes a Wasm component, including running wasm-opt Binaryen optimizations")
@@ -268,7 +200,6 @@ program
268
200
  .option("--wasm-opt-bin <path-to-wasm-opt>', 'wasm-opt binary path (default: 'binaryen/bin/wasm-opt')")
269
201
  .allowExcessArguments(true)
270
202
  .action(asyncAction(opt));
271
-
272
203
  program
273
204
  .command("wit")
274
205
  .description("extract the WIT from a WebAssembly Component [wasm-tools component wit]")
@@ -276,21 +207,18 @@ program
276
207
  .option("-d, --document <name>", "WIT document of a package to print")
277
208
  .option("-o, --output <output-file>", "WIT output file path")
278
209
  .action(asyncAction(componentWit));
279
-
280
210
  program
281
211
  .command("print")
282
212
  .description("print the WebAssembly WAT text for a binary file [wasm-tools print]")
283
213
  .argument("<input>", "input file to process")
284
214
  .option("-o, --output <output-file>", "output file path")
285
215
  .action(asyncAction(print));
286
-
287
216
  program
288
217
  .command("metadata-show")
289
218
  .description("extract the producer metadata for a Wasm binary [wasm-tools metadata show]")
290
219
  .argument("[module]", "Wasm component or core module filepath")
291
220
  .option("--json", "output component metadata as JSON")
292
221
  .action(asyncAction(metadataShow));
293
-
294
222
  program
295
223
  .command("metadata-add")
296
224
  .description("add producer metadata for a Wasm binary [wasm-tools metadata add]")
@@ -298,14 +226,12 @@ program
298
226
  .requiredOption("-m, --metadata <metadata...>", "field=name[@version] producer metadata to add with the embedding")
299
227
  .requiredOption("-o, --output <output-file>", "output binary path")
300
228
  .action(asyncAction(metadataAdd));
301
-
302
229
  program
303
230
  .command("parse")
304
231
  .description("parses the Wasm text format into a binary file [wasm-tools parse]")
305
232
  .argument("<input>", "input file to process")
306
233
  .requiredOption("-o, --output <output-file>", "output binary file path")
307
234
  .action(asyncAction(parse));
308
-
309
235
  program
310
236
  .command("new")
311
237
  .description("create a WebAssembly component adapted from a component core Wasm [wasm-tools component new]")
@@ -316,7 +242,6 @@ program
316
242
  .option("--wasi-reactor", "build with the WASI Reactor adapter")
317
243
  .option("--wasi-command", "build with the WASI Command adapter")
318
244
  .action(asyncAction(componentNew));
319
-
320
245
  program
321
246
  .command("embed")
322
247
  .description("embed the component typing section into a core Wasm module [wasm-tools component embed]")
@@ -328,22 +253,21 @@ program
328
253
  .option("-n, --world-name <world-name>", "world name to embed")
329
254
  .option("-m, --metadata <metadata...>", "field=name[@version] producer metadata to add with the embedding")
330
255
  .action(asyncAction(componentEmbed));
331
-
332
256
  program.showHelpAfterError();
333
-
334
257
  program.parse();
335
-
336
258
  function asyncAction(cmd) {
337
- return function () {
338
- const args = [...arguments];
259
+ return function (...actionArgs) {
260
+ const args = actionArgs;
339
261
  (async () => {
340
262
  try {
341
263
  await cmd.apply(null, args);
342
- } catch (e) {
264
+ }
265
+ catch (e) {
343
266
  process.stdout.write(`(jco ${cmd.name}) `);
344
267
  if (typeof e === "string") {
345
268
  console.error(`${styleText(["red", "bold"], "Error")}: ${e}\n`);
346
- } else {
269
+ }
270
+ else {
347
271
  console.error(e);
348
272
  }
349
273
  process.exit(1);
@@ -351,3 +275,4 @@ function asyncAction(cmd) {
351
275
  })();
352
276
  };
353
277
  }
278
+ //# sourceMappingURL=jco.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"jco.js","sourceRoot":"","sources":["../src/jco.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAE5C,OAAO,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AACnC,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AACnD,OAAO,EAAE,GAAG,IAAI,MAAM,EAAE,KAAK,IAAI,QAAQ,EAAE,MAAM,cAAc,CAAC;AAChE,OAAO,EACH,KAAK,EACL,KAAK,EACL,YAAY,EACZ,cAAc,EACd,WAAW,EACX,YAAY,EACZ,YAAY,GACf,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACrD,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC,OAAO;KACF,IAAI,CAAC,KAAK,CAAC;KACX,WAAW,CACR,GAAG,SAAS,CAAC,MAAM,EAAE,sCAAsC,CAAC,gEAAgE,CAC/H;KACA,KAAK,CAAC,qBAAqB,CAAC;KAC5B,uBAAuB,EAAE;KACzB,OAAO,CAAC,QAAQ,CAAC,CAAC;AAEvB,SAAS,UAAU,CAAC,KAAa;IAC7B,OAAO,QAAQ,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;AAC/B,CAAC;AAED;;;;;GAKG;AACH,SAAS,cAAc,CAAC,KAAa,EAAE,QAAkB;IACrD,OAAO,QAAQ,CAAC,MAAM,CAAC,CAAC,KAAK,CAAC,CAAC,CA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kB,EAAE,CAAC;AAE7B,OAAO,CAAC,KAAK,EAAE,CAAC;AAEhB,SAAS,WAAW,CAAC,GAAgC;IACjD,OAAO,UAAU,GAAG,UAAiB;QACjC,MAAM,IAAI,GAAG,UAAU,CAAC;QACxB,CAAC,KAAK,IAAI,EAAE;YACR,IAAI,CAAC;gBACD,MAAM,GAAG,CAAC,KAAK,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;YAChC,CAAC;YAAC,OAAO,CAAC,EAAE,CAAC;gBACT,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,QAAQ,GAAG,CAAC,IAAI,IAAI,CAAC,CAAC;gBAC3C,IAAI,OAAO,CAAC,KAAK,QAAQ,EAAE,CAAC;oBACxB,OAAO,CAAC,KAAK,CAAC,GAAG,SAAS,CAAC,CAAC,KAAK,EAAE,MAAM,CAAC,EAAE,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;gBACpE,CAAC;qBAAM,CAAC;oBACJ,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;gBACrB,CAAC;gBACD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;YACpB,CAAC;QACL,CAAC,CAAC,EAAE,CAAC;IACT,CAAC,CAAC;AACN,CAAC"}
@@ -0,0 +1,9 @@
1
+ /** Browser shim for Ora */
2
+ export default function ora(_options?: unknown): Ora;
3
+ declare class Ora {
4
+ text: string;
5
+ start(): void;
6
+ stop(): void;
7
+ }
8
+ export {};
9
+ //# sourceMappingURL=ora-shim.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ora-shim.d.ts","sourceRoot":"","sources":["../src/ora-shim.ts"],"names":[],"mappings":"AAAA,2BAA2B;AAC3B,MAAM,CAAC,OAAO,UAAU,GAAG,CAAC,QAAQ,CAAC,EAAE,OAAO,OAE7C;AAED,cAAM,GAAG;IACL,IAAI,SAAM;IACV,KAAK;IACL,IAAI;CACP"}