<commit_before>_ = require 'underscore'
fs = require 'fs-extra'
path = require 'path'
requirejs = require 'requirejs'
async = require 'async'
css = require 'css'
fstream = require 'fstream'
manifestLoader = require('./manifest')

compile =
  # TODO: make compile command return compiled gadget manifest
  command: (dir, options = {}, callback = ->) =>
    src = path.resolve dir
    dest = if options.out then path.resolve(options.out) else "#{src}/dist"
    manifestLoader.readManifest dir, (err, manifest) ->
      if err then return callback(err)

      # No need to do anything for iframe gadgets
      if manifest.launcher == 'iframe' || manifest.defaultConfig?.__launcher == 'iframe'
        return compile.simplyCopyFilesToDist src, callback

      options = _.extend _.clone(options), { src, dest, manifest }

      config =<commit_msg>Allow both iframe and component launcher to pass through<commit_after>_ = require 'underscore'
fs = require 'fs-extra'
path = require 'path'
requirejs = require 'requirejs'
async = require 'async'
css = require 'css'
fstream = require 'fstream'
manifestLoader = require('./manifest')

compile =
  # TODO: make compile command return compiled gadget manifest
  command: (dir, options = {}, callback = ->) =>
    src = path.resolve dir
    dest = if options.out then path.resolve(options.out) else "#{src}/dist"
    manifestLoader.readManifest dir, (err, manifest) ->
      if err then return callback(err)

      # No need to do anything for iframe or component gadgets
      doNothingLaunchers = ['iframe', 'component']
      if manifest.launcher in doNothingLaunchers || manifest.defaultConfig?.__launcher in doNothingLaunchers
        return compile.simplyCopyFilesToDist src, callback

      options = _.extend _.clone(options), { src, dest, manifest }

      config =
{'fraction_non_alphanumeric': 0.10909090909090909, 'fraction_numerical': 0.0, 'mean_word_length': 3.79155672823219, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '873552', 'n_tokens_mistral': 518, 'n_tokens_neox': 498, 'n_words': 173}