@bytecodealliance/jco 1.17.6 → 1.17.8

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bytecodealliance/jco",
3
- "version": "1.17.6",
3
+ "version": "1.17.8",
4
4
  "description": "JavaScript tooling for working with WebAssembly Components",
5
5
  "keywords": [
6
6
  "Component",
@@ -17,6 +17,7 @@ export function guestTypes(witPath: any, opts: any): Promise<void>;
17
17
  * outDir?: string,
18
18
  * features?: string[] | 'all',
19
19
  * guest?: bool,
20
+ * strict?: bool,
20
21
  * }} opts
21
22
  * @returns {Promise<{ [filename: string]: Uint8Array }>}
22
23
  */
@@ -33,6 +34,7 @@ export function typesComponent(
33
34
  outDir?: string;
34
35
  features?: string[] | "all";
35
36
  guest?: boolean;
37
+ strict?: boolean;
36
38
  },
37
39
  ): Promise<{
38
40
  [filename: string]: Uint8Array;
@@ -153,9 +153,8 @@ export async function transpileComponent(component, opts = {}) {
153
153
  // Let's define `instantiation` from `--instantiation` if it's present.
154
154
  if (opts.instantiation) {
155
155
  instantiation = { tag: opts.instantiation };
156
- }
157
- // Otherwise, if `--js` is present, an `instantiate` function is required.
158
- else if (opts.js) {
156
+ } else if (opts.js) {
157
+ // Otherwise, if `--js` is present, an `instantiate` function is required.
159
158
  instantiation = { tag: "async" };
160
159
  }
161
160
 
@@ -200,6 +199,7 @@ export async function transpileComponent(component, opts = {}) {
200
199
  noNamespacedExports: opts.namespacedExports === false,
201
200
  multiMemory: opts.multiMemory === true,
202
201
  idlImports: opts.experimentalIdlImports === true,
202
+ strict: opts.strict === true,
203
203
  });
204
204
 
205
205
  let outDir = (opts.outDir ?? "").replace(/\\/g, "/");
@@ -13,6 +13,7 @@ export function guestTypes(witPath: any, opts: any): Promise<void>;
13
13
  * outDir?: string,
14
14
  * features?: string[] | 'all',
15
15
  * guest?: bool,
16
+ * strict?: bool,
16
17
  * }} opts
17
18
  * @returns {Promise<{ [filename: string]: Uint8Array }>}
18
19
  */
@@ -29,6 +30,7 @@ export function typesComponent(
29
30
  outDir?: string;
30
31
  features?: string[] | "all";
31
32
  guest?: boolean;
33
+ strict?: boolean;
32
34
  },
33
35
  ): Promise<{
34
36
  [filename: string]: Uint8Array;
package/src/cmd/types.js CHANGED
@@ -140,6 +140,7 @@ export async function typesComponent(witPath, opts) {
140
140
  world: opts.worldName,
141
141
  features,
142
142
  guest: opts.guest ?? false,
143
+ strict: opts.strict === true,
143
144
  asyncMode: asyncModeObj,
144
145
  }).map(([name, file]) => [`${outDir}${name}`, file]);
145
146
  } catch (err) {
package/src/jco.js CHANGED
@@ -25,7 +25,7 @@ program
25
25
  )
26
26
  .usage("<command> [options]")
27
27
  .enablePositionalOptions()
28
- .version("1.16.1");
28
+ .version("1.17.8");
29
29
 
30
30
  function myParseInt(value) {
31
31
  return parseInt(value, 10);
@@ -128,6 +128,7 @@ program
128
128
  .option("-q, --quiet", "disable output summary")
129
129
  .option("--no-namespaced-exports", "disable namespaced exports for typescript compatibility")
130
130
  .option("--multi-memory", "optimized output for Wasm multi-memory")
131
+ .option("--strict", "generate bindings with strict type checking")
131
132
  .allowExcessArguments(true)
132
133
  .action(asyncAction(transpile));
133
134
 
@@ -164,6 +165,7 @@ program
164
165
  .option("--feature <feature>", "enable one specific WIT feature (repeatable)", collectOptions, [])
165
166
  .option("--all-features", "enable all features")
166
167
  .option("--wasm-opt-bin <path-to-wasm-opt>', 'wasm-opt binary path (default: 'binaryen/bin/wasm-opt')")
168
+ .option("--strict", "generate bindings with strict type checking")
167
169
  .action(asyncAction(types));
168
170
 
169
171
  program
@@ -186,6 +188,7 @@ program
186
188
  .choices(["sync", "jspi"])
187
189
  .preset("sync"),
188
190
  )
191
+ .option("--strict", "generate bindings with strict type checking")
189
192
  .action(asyncAction(guestTypes));
190
193
 
191
194
  program