-
Notifications
You must be signed in to change notification settings - Fork 29
/
Copy pathjs-compute-runtime-cli.js
executable file
·46 lines (43 loc) · 1.27 KB
/
js-compute-runtime-cli.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#!/usr/bin/env node
import { parseInputs } from './src/parseInputs.js';
import { printVersion } from './src/printVersion.js';
import { printHelp } from './src/printHelp.js';
import { addSdkMetadataField } from './src/addSdkMetadataField.js';
const {
enableAOT,
aotCache,
enableExperimentalHighResolutionTimeMethods,
moduleMode,
bundle,
wasmEngine,
input,
output,
version,
help,
} = await parseInputs(process.argv.slice(2));
if (version) {
await printVersion();
} else if (help) {
await printHelp();
} else {
// This is a dynamic import because this import will throw an error
// if it does not have a pre-compiled version of Wizer available in the platform
// running the CLI. In that situation, we would still like the
// js-compute-runtime cli's --version and --help flags to work as
// it could be that the user is using an older version of js-compute-runtime
// and a newer version does not support the platform they are using.
const { compileApplicationToWasm } = await import(
'./src/compileApplicationToWasm.js'
);
await compileApplicationToWasm(
input,
output,
wasmEngine,
enableExperimentalHighResolutionTimeMethods,
enableAOT,
aotCache,
moduleMode,
bundle,
);
await addSdkMetadataField(output, enableAOT);
}