( opts, _deprecatedWitWorldOrOpts = undefined, _deprecatedOpts = undefined, )
| 64 | export const DEFAULT_FEATURES = ['stdio', 'random', 'clocks', 'http', 'fetch-event']; |
| 65 | |
| 66 | export async function componentize( |
| 67 | opts, |
| 68 | _deprecatedWitWorldOrOpts = undefined, |
| 69 | _deprecatedOpts = undefined, |
| 70 | ) { |
| 71 | let useOriginalSourceFile = true; |
| 72 | let jsSource; |
| 73 | |
| 74 | // Handle the two old signatures |
| 75 | // (jsSource, witWorld, opts?) |
| 76 | // (jsSource, opts) |
| 77 | if (typeof opts === 'string') { |
| 78 | jsSource = opts; |
| 79 | useOriginalSourceFile = false; |
| 80 | if (typeof _deprecatedWitWorldOrOpts === 'string') { |
| 81 | opts = _deprecatedOpts || {}; |
| 82 | opts.witWorld = _deprecatedWitWorldOrOpts; |
| 83 | } else { |
| 84 | if (typeof _deprecatedWitWorldOrOpts !== 'object') { |
| 85 | throw new Error( |
| 86 | `componentize: second argument must be an object or a string, but is ${typeof _deprecatedWitWorldOrOpts}`, |
| 87 | ); |
| 88 | } |
| 89 | opts = _deprecatedWitWorldOrOpts; |
| 90 | } |
| 91 | } |
| 92 | |
| 93 | // Prepare a working directory for use during componentization |
| 94 | const { sourcesDir, baseDir: workDir } = await prepWorkDir(); |
| 95 | |
| 96 | let { |
| 97 | sourceName = 'source.js', |
| 98 | sourcePath = maybeWindowsPath(join(sourcesDir, sourceName)), |
| 99 | preview2Adapter = preview1AdapterReactorPath(), |
| 100 | witPath, |
| 101 | witWorld, |
| 102 | worldName, |
| 103 | disableFeatures = [], |
| 104 | enableFeatures = [], |
| 105 | |
| 106 | debug = { ...DEFAULT_DEBUG_SETTINGS }, |
| 107 | debugBuild = false, |
| 108 | debugBindings = false, |
| 109 | enableWizerLogging = false, |
| 110 | |
| 111 | runtimeArgs, |
| 112 | |
| 113 | aotCache = DEFAULT_AOT_CACHE, |
| 114 | } = opts; |
| 115 | |
| 116 | debugBindings = debugBindings || debug?.bindings; |
| 117 | debugBuild = debugBuild || debug?.build; |
| 118 | enableWizerLogging = enableWizerLogging || debug?.enableWizerLogging; |
| 119 | |
| 120 | // Determine the path to the StarlingMonkey binary |
| 121 | const engine = getEnginePath(opts); |
| 122 | |
| 123 | // Determine the default features that should be included |
no test coverage detected