@@ -4,88 +4,108 @@ interface ComponentizeOptions {
4
4
*
5
5
* This file must be a valid JavaScript module, and can import other modules using relative paths.
6
6
*/
7
- sourcePath : string ,
7
+ sourcePath : string ;
8
8
/**
9
- * Use a debug build
10
- * Note that the debug build only includes the names section only for size optimization, and not DWARF
11
- * debugging sections, due to a lack of support in Node.js for these debugging workflows currently.
9
+ * Path to WIT file or folder
12
10
*/
13
- debugBuild ?: boolean ,
11
+ witPath ?: string ;
12
+ /**
13
+ * Target world name for componentization
14
+ */
15
+ worldName ?: string ;
14
16
/**
15
17
* Path to custom ComponentizeJS engine build to use
16
18
*/
17
- engine ?: string ,
19
+ engine ?: string ;
18
20
/**
19
21
* Path to custom weval cache to use
20
22
*/
21
- aotCache ?: string ,
23
+ aotCache ?: string ;
22
24
/**
23
25
* Enable AoT using weval
24
26
*/
25
- enableAot ?: boolean ,
27
+ enableAot ?: boolean ;
26
28
/**
27
29
* Use a pre-existing path to the `weval` binary, if present
28
30
*/
29
- wevalBin ?: string ,
31
+ wevalBin ?: string ;
30
32
/**
31
33
* Use a pre-existing path to the `wizer` binary, if present
32
34
*/
33
- wizerBin ?: string ,
35
+ wizerBin ?: string ;
34
36
/**
35
37
* Path to custom Preview2 Adapter
36
38
*/
37
- preview2Adapter ?: string ,
38
- /**
39
- * Path to WIT file or folder
40
- */
41
- witPath ?: string ,
42
- /**
43
- * Target world name for componentization
44
- */
45
- worldName ?: string ,
39
+ preview2Adapter ?: string ;
46
40
/**
47
41
* Disable WASI features in the base engine
48
42
* Disabling all features results in a pure component with no WASI dependence
49
- *
43
+ *
50
44
* - stdio: console.log(), console.error and errors are provided to stderr
51
45
* - random: Math.random() and crypto.randomBytes()
52
46
* - clocks: Date.now(), performance.now()
53
47
* - http: fetch() support
54
- *
48
+ *
55
49
*/
56
- disableFeatures ?: ( 'stdio' | 'random' | 'clocks' | 'http' ) [ ] ,
50
+ disableFeatures ?: ( 'stdio' | 'random' | 'clocks' | 'http' | 'fetch-event' ) [ ] ;
57
51
/**
58
52
* Enable WASI features in the base engine
59
53
* (no experimental subsystems currently supported)
60
54
*/
61
- enableFeatures ?: [ ] ,
55
+ enableFeatures ?: [ ] ;
62
56
/**
63
57
* Pass environment variables to the spawned Wizer or Weval Process
64
58
* If set to true, all host environment variables are passed
65
59
* To pass only a subset, provide an object with the desired variables
66
60
*/
67
- env ?: boolean | Record < string , string > ,
61
+ env ?: boolean | Record < string , string > ;
68
62
/**
69
63
* Runtime arguments to provide to the StarlingMonkey engine initialization
70
64
* (see https://github.com/bytecodealliance/StarlingMonkey/blob/main/include/config-parser.h)
71
65
*/
72
- runtimeArgs ?: string ,
66
+ runtimeArgs ?: string ;
67
+ /**
68
+ * Use a debug build
69
+ * Note that the debug build only includes the names section only for size optimization, and not DWARF
70
+ * debugging sections, due to a lack of support in Node.js for these debugging workflows currently.
71
+ */
72
+ debugBuild ?: boolean ;
73
+ /**
74
+ * Debug options
75
+ */
76
+ debug ?: {
77
+ /** Whether to enable bindings-specific debugging */
78
+ bindings ?: boolean ;
79
+ /** Path to debug bindings to use */
80
+ bindingsDir ?: string ;
81
+ /** Whether to enable binary-specific debugging */
82
+ binary ?: boolean ;
83
+ /** Path to the binary that was output */
84
+ binaryPath ?: string ;
85
+ /** Whether to enable wizer logging */
86
+ wizerLogging : false ;
87
+ } ;
73
88
}
74
89
75
90
/**
76
91
* Componentize a JavaScript module to a WebAssembly component
77
92
*
78
93
* @param opts Componentize options
79
94
*/
80
- export function componentize ( opts : ComponentizeOptions ) : Promise < ComponentizeOutput >
95
+ export function componentize (
96
+ opts : ComponentizeOptions ,
97
+ ) : Promise < ComponentizeOutput > ;
81
98
82
99
/**
83
100
* @deprecated Use `componentize(opts)` instead
84
101
*
85
102
* @param source Source code of JavaScript module to componentize
86
103
* @param opts Componentize options
87
104
*/
88
- export function componentize ( source : string , opts : ComponentizeOptions ) : Promise < ComponentizeOutput >
105
+ export function componentize (
106
+ source : string ,
107
+ opts : ComponentizeOptions ,
108
+ ) : Promise < ComponentizeOutput > ;
89
109
90
110
/**
91
111
* @deprecated Use `componentize(opts)` instead
@@ -94,20 +114,37 @@ export function componentize(source: string, opts: ComponentizeOptions): Promise
94
114
* @param witWorld Inline WIT string to componentize to
95
115
* @param opts Componentize options
96
116
*/
97
- export function componentize ( source : string , witWorld : string , opts ?: ComponentizeOptions ) : Promise < ComponentizeOutput >
117
+ export function componentize (
118
+ source : string ,
119
+ witWorld : string ,
120
+ opts ?: ComponentizeOptions ,
121
+ ) : Promise < ComponentizeOutput > ;
98
122
99
123
interface ComponentizeOutput {
100
124
/**
101
125
* Component binary
102
126
*/
103
- component : Uint8Array ,
127
+ component : Uint8Array ;
104
128
/**
105
129
* Used guest imports in JavaScript (excluding those from StarlingMonkey engine)
106
130
*/
107
- imports : [ [ string , string ] ] [ ]
131
+ imports : [ [ string , string ] ] [ ] ;
132
+ /**
133
+ * Debugging output (only present if enabled)
134
+ */
135
+ debug ?: {
136
+ /** Whether bindings debugging was enabled */
137
+ bindings ?: boolean ;
138
+ /** Work directory used during processing */
139
+ workDir ?: string ;
140
+ /** Whether binary debugging was enabled */
141
+ binary ?: boolean ;
142
+ /** Path to the produced binary */
143
+ binaryPath ?: string ;
144
+ } ;
108
145
}
109
146
110
147
/**
111
148
* ComponentizeJS version string
112
149
*/
113
- export const version : string
150
+ export const version : string ;
0 commit comments