11#! /usr/bin/env node
22
33import { program , Option } from 'commander' ;
4- import { componentize } from " ./componentize.js" ;
4+ import { componentize , DEFAULT_FEATURES } from ' ./componentize.js' ;
55import { writeFile } from 'node:fs/promises' ;
66import { resolve } from 'node:path' ;
77
8- export async function componentizeCmd ( jsSource , opts ) {
9- const { component } = await componentize ( {
8+ export async function componentizeCmd ( jsSource , opts ) {
9+ const { component } = await componentize ( {
1010 sourcePath : jsSource ,
1111 witPath : resolve ( opts . wit ) ,
1212 worldName : opts . worldName ,
@@ -30,20 +30,29 @@ program
3030 . option ( '-n, --world-name <name>' , 'WIT world to build' )
3131 . option ( '--runtime-args <string>' , 'arguments to pass to the runtime' )
3232 . 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+ )
3542 . option ( '--use-debug-build' , 'use a debug build of StarlingMonkey' )
3643 . 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+ )
3848 . requiredOption ( '-o, --out <out>' , 'output component file' )
3949 . action ( asyncAction ( componentizeCmd ) ) ;
4050
41-
4251program . showHelpAfterError ( ) ;
4352
4453program . parse ( ) ;
4554
46- function asyncAction ( cmd ) {
55+ function asyncAction ( cmd ) {
4756 return function ( ) {
4857 const args = [ ...arguments ] ;
4958 ( async ( ) => {
0 commit comments