generateOutputData = (source, params, options) => {
  const defaults = {
    outputFile: undefined,
    outputFormat: 'stl',
    inputFile: '',
    version: '',
    addMetaData: true,
    generateParts: false
  }
  options = Object.assign({}, defaults, options)
  const { outputFormat, inputFile, inputFormat, generateParts } = options

  options.filename = inputFile // for deserializers

  const inputPath = isAbsolute(inputFile) ? inputFile : resolve(process.cwd(), inputFile)

  // setup support for require-ing files with .jscad, .stl etc extensions
  registerAllExtensions(fs, require)

  return new Promise((resolve, reject) => {
    let deserializer = deserializers[inputFormat]
    if (!deserializer) {
      if (inputFormat === 'jscad' || inputFormat === 'js') {
        deserializer = (options, source) => source
      } else {
        reject(new Error(`unsuported input format ${inputFormat}`))
      }
    }

    // convert any inputs
    const prevsource = source
    const deserializerOptions = Object.assign({}, params, options)
    source = deserializer(deserializerOptions, source)
    const useFakeFs = (source !== prevsource) // conversion, so use a fake file system when rebuilding

    if (outputFormat === 'jscad' || outputFormat === 'js') {
      resolve(source)
    } else {
      //    } else if ((inputFormat === 'jscad' || inputFormat === 'js') &&
      //               outputFormat !== 'jscad' && outputFormat !== 'js') {
      try {
        const solids = rebuildGeometryCli({ mainPath: inputPath, parameterValues: params, useFakeFs, source })
        resolve(solids)
      } catch (error) {
        reject(error)
      }
    }
  })
    .then((solids) => {
      const serializerOptions = Object.assign({ format: outputFormat }, params)
      if (generateParts) {
        const blobs = []
        for (let i = 0; i < solids.length; i++) {
          blobs.push(solidsAsBlob(solids[i], serializerOptions))
        }
        return blobs
      }
      return solidsAsBlob(solids, serializerOptions)
    })
}
generate output data from source
@param {String} source the original source
@param {Object} params hash of parameters to pass to main function
@param {String} options
@return a Promise with the output data