UNPKG

@fastly/js-compute

Version:

JavaScript SDK and CLI for building JavaScript applications on [Fastly Compute](https://www.fastly.com/products/edge-compute/serverless).

41 lines (40 loc) 1.7 kB
#!/usr/bin/env node import { parseInputs } from '../parseInputs.js'; import { printHelp, printVersion } from '../printHelp.js'; import { addSdkMetadataField } from '../addSdkMetadataField.js'; import { readConfigFileAndCliArguments } from '../config.js'; const argv = await readConfigFileAndCliArguments(process.argv.slice(2)); const parsedInputs = await parseInputs(argv); if (parsedInputs === 'version') { await printVersion(); } else if (parsedInputs === 'help') { await printHelp(); } else { const { enableAOT, aotCache, enableHttpCache, enableExperimentalHighResolutionTimeMethods, moduleMode, bundle, enableStackTraces, excludeSources, debugIntermediateFilesDir, wasmEngine, wevalBin, input, output, env, } = parsedInputs; // 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('../compileApplicationToWasm.js'); await compileApplicationToWasm({ input, output, wasmEngine, enableHttpCache, enableExperimentalHighResolutionTimeMethods, enableAOT, aotCache, enableStackTraces, excludeSources, debugIntermediateFilesDir, wevalBin, moduleMode, doBundle: bundle, env, }); await addSdkMetadataField(output, enableAOT); }