1
1
#! /usr/bin/env node
2
2
3
3
import { program , Option } from 'commander' ;
4
- import { componentize } from " ./componentize.js" ;
4
+ import { componentize , DEFAULT_FEATURES } from ' ./componentize.js' ;
5
5
import { writeFile } from 'node:fs/promises' ;
6
6
import { resolve } from 'node:path' ;
7
7
8
- export async function componentizeCmd ( jsSource , opts ) {
9
- const { component } = await componentize ( {
8
+ export async function componentizeCmd ( jsSource , opts ) {
9
+ const { component } = await componentize ( {
10
10
sourcePath : jsSource ,
11
11
witPath : resolve ( opts . wit ) ,
12
12
worldName : opts . worldName ,
@@ -30,20 +30,29 @@ program
30
30
. option ( '-n, --world-name <name>' , 'WIT world to build' )
31
31
. option ( '--runtime-args <string>' , 'arguments to pass to the runtime' )
32
32
. option ( '--aot' , 'enable AOT compilation' )
33
- . addOption ( new Option ( '-d, --disable <feature...>' , 'disable WASI features' ) . choices ( [ 'stdio' , 'random' , 'clocks' , 'http' ] ) )
34
- . option ( '--preview2-adapter <adapter>' , 'provide a custom preview2 adapter path' )
33
+ . addOption (
34
+ new Option ( '-d, --disable <feature...>' , 'disable WASI features' ) . choices (
35
+ DEFAULT_FEATURES ,
36
+ ) ,
37
+ )
38
+ . option (
39
+ '--preview2-adapter <adapter>' ,
40
+ 'provide a custom preview2 adapter path' ,
41
+ )
35
42
. option ( '--use-debug-build' , 'use a debug build of StarlingMonkey' )
36
43
. option ( '--debug-bindings' , 'enable debug logging for bindings generation' )
37
- . option ( '--enable-wizer-logging' , 'enable debug logging for calls in the generated component' )
44
+ . option (
45
+ '--enable-wizer-logging' ,
46
+ 'enable debug logging for calls in the generated component' ,
47
+ )
38
48
. requiredOption ( '-o, --out <out>' , 'output component file' )
39
49
. action ( asyncAction ( componentizeCmd ) ) ;
40
50
41
-
42
51
program . showHelpAfterError ( ) ;
43
52
44
53
program . parse ( ) ;
45
54
46
- function asyncAction ( cmd ) {
55
+ function asyncAction ( cmd ) {
47
56
return function ( ) {
48
57
const args = [ ...arguments ] ;
49
58
( async ( ) => {
0 commit comments