code: function saveAsAssets(
    bundle: RamBundleInfo,
    options: OutputOptions,
    log: (...args: Array<string>) => void,
  ): Promise<mixed> {
    const {
      bundleOutput,
      bundleEncoding: encoding,
      sourcemapOutput,
      sourcemapSourcesRoot,
    } = options;
  
    log('start');
    const {startupModules, lazyModules} = bundle;
    log('finish');
    const startupCode = joinModules(startupModules);
  
    log('Writing bundle output to:', bundleOutput);
    const modulesDir = path.join(path.dirname(bundleOutput), MODULES_DIR);
    const writeUnbundle = createDir(modulesDir).then(
      // create the modules directory first
      () =>
        Promise.all([
          writeModules(lazyModules, modulesDir, encoding),
          writeFile(bundleOutput, startupCode, encoding),
          writeMagicFlagFile(modulesDir),
        ]),
    );
    writeUnbundle.then(() => log('Done writing unbundle output'));
  
    if (sourcemapOutput) {
      const sourceMap = buildSourcemapWithMetadata({
        fixWrapperOffset: true,
        lazyModules: lazyModules.concat(),
        moduleGroups: null,
        startupModules: startupModules.concat(),
      });
      if (sourcemapSourcesRoot !== undefined) {
        relativizeSourceMapInline(sourceMap, sourcemapSourcesRoot);
      }
      const wroteSourceMap = writeSourceMap(
        sourcemapOutput,
        JSON.stringify(sourceMap),
        log,
      );
  
      return Promise.all([writeUnbundle, wroteSourceMap]);
    } else {
      return writeUnbundle;
    }
  }
docs: Saves all JS modules of an app as single files
  The startup code (prelude, polyfills etc.) are written to the file
  designated by the `bundleOuput` option.
  All other modules go into a 'js-modules' folder that in the same parent
  directory as the startup file.