@bytecodealliance/jco 1.15.3 → 1.15.4

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.
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bytecodealliance/jco",
3
- "version": "1.15.3",
3
+ "version": "1.15.4",
4
4
  "description": "JavaScript tooling for working with WebAssembly Components",
5
5
  "homepage": "https://github.com/bytecodealliance/jco#readme",
6
6
  "author": "Guy Bedford",
@@ -86,12 +86,13 @@
86
86
  "@typescript-eslint/parser": "^8.39.1",
87
87
  "commitlint": "^19.8.1",
88
88
  "conventional-changelog-conventionalcommits": "^9.1.0",
89
- "eslint": "^9.33.0",
89
+ "eslint": "^9.39.1",
90
90
  "mime": "^4.0.7",
91
91
  "puppeteer": "^24.16.2",
92
92
  "semver": "^7.7.1",
93
93
  "smol-toml": "^1.4.2",
94
94
  "typescript": "^5.9.2",
95
+ "vite": "^7.1.5",
95
96
  "vitest": "^3.2.4",
96
97
  "which": "^2.0.2"
97
98
  }
package/src/cmd/opt.js CHANGED
@@ -2,7 +2,7 @@ import { writeFile } from 'node:fs/promises';
2
2
 
3
3
  import { $init, tools } from '../../obj/wasm-tools.js';
4
4
  const { metadataShow, print } = tools;
5
- import { fileURLToPath } from 'url';
5
+ import { fileURLToPath } from 'node:url';
6
6
  import {
7
7
  readFile,
8
8
  sizeStr,
@@ -1,5 +1,9 @@
1
+ import type { Command } from 'commander';
2
+
1
3
  export function types(witPath: any, opts: any): Promise<void>;
4
+
2
5
  export function guestTypes(witPath: any, opts: any): Promise<void>;
6
+
3
7
  /**
4
8
  * @param {string} witPath
5
9
  * @param {{
@@ -30,7 +34,45 @@ export function typesComponent(witPath: string, opts: {
30
34
  }): Promise<{
31
35
  [filename: string]: Uint8Array;
32
36
  }>;
33
- export function transpile(componentPath: any, opts: any, program: any): Promise<void>;
37
+
38
+
39
+ export function transpile(
40
+ componentPath: string,
41
+ opts: TranspilationOptions,
42
+ program: Command,
43
+ ): Promise<TranspilationResult>;
44
+
45
+ type TranspilationOptions = {
46
+ name: string;
47
+ instantiation?: 'async' | 'sync';
48
+ importBindings?: 'js' | 'optimized' | 'hybrid' | 'direct-optimized';
49
+ map?: Record<string, string>;
50
+ asyncMode?: string;
51
+ asyncImports?: string[];
52
+ asyncExports?: string[];
53
+ asyncWasiImports?: string[];
54
+ asyncWasiExports?: string[];
55
+ validLiftingOptimization?: boolean;
56
+ tracing?: boolean;
57
+ nodejsCompat?: boolean;
58
+ tlaCompat?: boolean;
59
+ base64Cutoff?: boolean;
60
+ js?: boolean;
61
+ minify?: boolean;
62
+ optimize?: boolean;
63
+ namespacedExports?: boolean;
64
+ outDir?: string;
65
+ multiMemory?: boolean;
66
+ experimentalIdlImports?: boolean;
67
+ optArgs?: string[];
68
+ };
69
+
70
+ type TranspilationResult = {
71
+ files: FileBytes;
72
+ imports: string[];
73
+ exports: [string, 'function' | 'instance'][];
74
+ };
75
+
34
76
  /**
35
77
  *
36
78
  * @param {Uint8Array} component
@@ -3,7 +3,7 @@
3
3
  import { extname, basename, resolve } from 'node:path';
4
4
 
5
5
  import { minify } from 'terser';
6
- import { fileURLToPath } from 'url';
6
+ import { fileURLToPath } from 'node:url';
7
7
 
8
8
  import { optimizeComponent } from './opt.js';
9
9
 
package/src/common.js CHANGED
@@ -240,7 +240,7 @@ export async function resolveDefaultWITPath(witPath) {
240
240
  }
241
241
 
242
242
  /**
243
- * Partial polyfill for 'node:utils' `styleText()`
243
+ * Partial polyfill for 'node:util' `styleText()`
244
244
  *
245
245
  * @param {string | string[]} styles - styles to apply to the given text
246
246
  * @param {string} text - text that should be styled
package/src/jco.js CHANGED
@@ -25,7 +25,7 @@ program
25
25
  )
26
26
  .usage('<command> [options]')
27
27
  .enablePositionalOptions()
28
- .version('1.15.3');
28
+ .version('1.15.4');
29
29
 
30
30
  function myParseInt(value) {
31
31
  return parseInt(value, 10);
package/types/common.d.ts CHANGED
@@ -55,7 +55,7 @@ export function writeFiles(files: Record<string, string>, summaryTitle: boolean)
55
55
  */
56
56
  export function resolveDefaultWITPath(witPath?: string | undefined): Promise<string>;
57
57
  /**
58
- * Partial polyfill for 'node:utils' `styleText()`
58
+ * Partial polyfill for 'node:util' `styleText()`
59
59
  *
60
60
  * @param {string | string[]} styles - styles to apply to the given text
61
61
  * @param {string} text - text that should be styled