Call into the merge_js module to merge the js files
    and minify the code.
167245
def _merge_js(input_file, input_dir, output_file):
    
    from studio.lib.buildjs import merge_js
    merge_js.main(input_file, input_dir, output_file)
705160
function buildJs() {
  const jsFiles = config.jsCoreFiles;
  config.componentPaths.forEach(component => {
    jsFiles.push(path.join(component, '*.js'));
    jsFiles.push(path.join(component, '**/*.js'));
  });

  gutil.log("building js files...");

  const jsBuildStream = gulp.src(jsFiles)
  .pipe(filterNonCodeFiles())
  .pipe(utils.buildNgMaterialDefinition())
  .pipe(plumber())
  .pipe(ngAnnotate())
  .pipe(utils.addJsWrapper(true));

  const jsProcess = series(jsBuildStream, themeBuildStream())
  .pipe(concat('angular-material.js'))
  .pipe(BUILD_MODE.transform())
  .pipe(insert.prepend(config.banner))
  .pipe(insert.append(';window.ngMaterial={version:{full: "' + VERSION + '"}};'))
  .pipe(gulp.dest(config.outputDir))
  .pipe(gulpif(!IS_DEV, uglify({output: {comments: 'some'}})))
  .pipe(rename({extname: '.min.js'}))
  .pipe(gulp.dest(config.outputDir));

  return series(jsProcess, deployMaterialMocks());

  // Deploy the `angular-material-mocks.js` file to the `dist` directory
  function deployMaterialMocks() {
    return gulp.src(config.mockFiles)
    .pipe(gulp.dest(config.outputDir));
  }
}
12242
def add_javascripts(self, *js_files):
        """"""
        # create the script tag if don't exists
        if self.main_soup.script is None:
            script_tag = self.main_soup.new_tag('script')
            self.main_soup.body.append(script_tag)

        for js_file in js_files:
            self.main_soup.script.append(self._text_file(js_file))
1196898
def combine_files(joinfile, sourcefiles, client):
    
    from mediasync.conf import msettings

    joinfile = joinfile.strip('/')

    if joinfile.endswith('.css'):
        dirname = msettings['CSS_PATH'].strip('/')
        separator = '\n'
    elif joinfile.endswith('.js'):
        dirname = msettings['JS_PATH'].strip('/')
        separator = ';\n'
    else:
        # By-pass this file since we only join CSS and JS.
        return None

    buffer = cStringIO.StringIO()

    for sourcefile in sourcefiles:
        sourcepath = os.path.join(client.media_root, dirname, sourcefile)
        if os.path.isfile(sourcepath):
            f = open(sourcepath)
            buffer.write(f.read())
            f.close()
            buffer.write(separator)

    filedata = buffer.getvalue()
    buffer.close()
    return (filedata, dirname)
224259
def process_scripts (out)
      out.gsub /(<script\b[^>]*?>([\s\S]*?)<\/script>)\s*/i do
        js = $2
        m = $1.gsub /^<script\s([^>]+)>/i do |m|
          attrs(m, 'script', true)
        end
        begin
          js_compressed = HtmlPress.js_compressor js, @options[:js_minifier_options]
          m.gsub!(">#{js}<\/script>", ">#{js_compressed}<\/script>")
        rescue MultiJs::ParseError => e
          log e.message
        end
        reserve m
      end
    end
1125843
function() {
        var that = this;
        var args = slice.call(arguments);

        each(args, function(arg) {
            var id = that.alias(arg);
            var type = fileType(id);
            var isComp = fileComponents(id);
            var res = {
                id: id
            };
            type = type === 'css' && isComp ? 'compcss' : (type === 'js' && isComp ? 'compjs' : type);

            that.push.apply(that, settings.deps[id]);

            if ((type === 'css') || (type === 'js') || (type === 'compcss') || (type === 'compjs')) {
                (that.depends[type] || (that.depends[type] = [])).push(res);
                ++that.length;
            }
        });
    }
1256212
def add_JSscript(self, js_script, js_loc):
        
        if js_loc == 'head':
            self.jscript_head_flag = True
            if self.jscript_head:
                self.jscript_head = self.jscript_head + '\n' +  js_script
            else:
                self.jscript_head = js_script
        elif js_loc == 'end':
            self.jscript_end_flag = True
            if self.jscript_end:
                self.jscript_end = self.jscript_end + '\n' +  js_script
            else:
                self.jscript_end = js_script
        else:
            raise OptionTypeError("Not An Accepted script location: %s, either 'head' or 'end'" 
                                % js_loc)
206062
function getMinifiedJSFiles(files) {
  var minifiedFiles = [];
  files.forEach(function(path) {
    minifiedFiles.push('<%- project.uglify %>/' + path.replace('.js', '.min.js').replace('/<%= originalPluginName %>/', ''));
  });
  return minifiedFiles;
}
13556
def merge(docset, filename="", linenr=0)
      docs = docset[:comment]
      code = process_code(docset[:tagname], docset[:code])

      h = {
        :tagname => docset[:tagname],
        :name => docs[:name] || code[:name] || "",
        :autodetected => code[:autodetected] || {},
        :files => [{:filename => filename, :linenr => linenr}],
      }

      general_merge(h, docs, code)
      invoke_merge_in_member_tag(h, docs, code)

      # Needs to be calculated last, as it relies on the existance of
      # :name, :static and :tagname fields.
      h[:id] = JsDuck::Class.member_id(h)

      h
    end
1312767
def install_js():
    ''' 

    '''
    target_jsdir = join(SERVER, 'static', 'js')
    target_cssdir = join(SERVER, 'static', 'css')
    target_tslibdir = join(SERVER, 'static', 'lib')

    STATIC_ASSETS = [
        join(JS,  'bokeh.js'),
        join(JS,  'bokeh.min.js'),
        join(CSS, 'bokeh.css'),
        join(CSS, 'bokeh.min.css'),
    ]
    if not all(exists(a) for a in STATIC_ASSETS):
        print(BOKEHJS_INSTALL_FAIL)
        sys.exit(1)

    if exists(target_jsdir):
        shutil.rmtree(target_jsdir)
    shutil.copytree(JS, target_jsdir)

    if exists(target_cssdir):
        shutil.rmtree(target_cssdir)
    shutil.copytree(CSS, target_cssdir)

    if exists(target_tslibdir):
        shutil.rmtree(target_tslibdir)
    if exists(TSLIB):
        # keep in sync with bokehjs/src/compiler/compile.ts
        lib = {
            "lib.es5.d.ts",
            "lib.dom.d.ts",
            "lib.es2015.core.d.ts",
            "lib.es2015.promise.d.ts",
            "lib.es2015.symbol.d.ts",
            "lib.es2015.iterable.d.ts",
        }
        shutil.copytree(TSLIB, target_tslibdir, ignore=lambda _, files: [ f for f in files if f not in lib ])
392350
function minification(minifyConfig, minifyTargets, compiler) {
  // NOTE: The minifyTargets array is used to handle recursion state,
  // therefore it is passed as an argument, otherwise it would be
  // reset each time the function is called, due to its recursion.
  var source, sources, target = minifyTargets.shift();
  if (target) {
    sources = minifyConfig[target];
    if (!Array.isArray(sources)) sources = [sources];
    sources.forEach(function(item) {
      compiler.getSource(item, target, 'minify');
    });
    compiler.exec(function(err, compiled) {
      if (err) throw err;
      else {
        var ext = assetUtil.getExt(target);
        target = app.fullPath(app.paths.public + target);
        switch (ext) {
          case 'css':
            source = cleancss.minify(compiled.join('\n')).styles;
            instance.writeFile(target, source);
            app.debug("Asset Compiler: Minified CSS: " + app.relPath(target));
            break;
          case 'js':
            source = minifyJS(compiled.join('\n'));
            instance.writeFile(target, source);
            app.debug("Asset Compiler: Minified JavaScript: " + app.relPath(target));
            break;
          default:
            throw new Error("Asset Compiler: Extension not supported: " + target);
        }
        minification(minifyConfig, minifyTargets, compiler);
      }
    });
  } else {
    instance.config.minify = minifyConfig; // Set new config once minification is done
    app.emit('asset_compiler_minify_complete'); // Runs even without targets to minify
  }
}
774106
protected function minifyDirectToOutput($js, $options)
	{
		$this->initialize($js, $options);
		$this->loop();
		$this->clean();
	}
894563
function () {
                        //noinspection JSReferencingMutableVariableFromClosure
                        res.push({
                            combine: 1,
                            path: prefix + currentComboUrls.join(comboSep) + suffix,
                            mods: currentComboMods
                        });
                    }
568882
function wrap(err, js) {
		if (err) { return next(err); }

		var deps = exports.dependencies(id, js), params = [], undef = '';

		// make sure require, exports, and module are properly passed into the factory
		if (/\brequire\b/.test(js)) { params.push('require'); }
		if (/\bexports\b/.test(js)) { params.push('exports'); }
		if (/\bmodule\b/.test(js)) { params.push('module'); }

		// make sure code follows the `exports` path instead of `define` path once wrapped
		if (/\bdefine\.amd\b/.test(js)) { undef = 'var define;'; }

		if (deps.length) {
			deps = ',' + JSON.stringify(params.concat(deps));
		} else if (params.length) {
			params = [ 'require', 'exports', 'module' ];
		}

		js = 'define(' + JSON.stringify(id) + deps + ',function(' + params + ')' +
				'{' + js + '\n' + undef + '}' + // rely on hoisting for define
			');\n';
		next(null, js);
	}
542651
def merge(self):
        """"""
        temp_dir = self.temp_dir
        app_dir = self.application.directory
        for root, dirs, files in os.walk(temp_dir):
            for directory in dirs:
                directory = os.path.join(root, directory)
                directory = directory.replace(temp_dir, app_dir, 1)
                try:
                    os.mkdir(directory)
                except OSError:
                    pass
            for file in files:
                source = os.path.join(root, file)
                target = source.replace(temp_dir, app_dir, 1)
                relative_target = target.replace(app_dir, '.')
                action = 'r'
                if (
                    os.path.exists(target)
                    and not filecmp.cmp(source, target, shallow=False)
                    and os.stat(target).st_size > 0
                ):
                    # target exists, is not empty, and does not
                    # match source
                    if target.endswith('__init__.py'):
                        # default merge __init__.py files
                        # if non-empty, these should only
                        # contain imports from submoduiles
                        action = 'm'
                    elif target.endswith('base.py'):
                        # default skip base.py files
                        # these should be extended by the developer
                        action = 's'
                    else:
                        default = 'm'
                        action = click.prompt(
                            style.prompt(
                                '%s already exists, '
                                '[r]eplace, [s]kip, or [m]erge?' % (
                                    relative_target
                                ),
                            ),
                            default=style.default(default)
                        ) if self.interactive else default
                        action = click.unstyle(action).lower()
                        if action not in {'r', 'm', 's'}:
                            action = default

                if action == 's':
                    self.stdout.write(
                        '? %s' % style.white(relative_target),
                        fg='yellow'
                    )
                    continue
                if action == 'r':
                    with open(source, 'r') as source_file:
                        with open(target, 'w') as target_file:
                            target_file.write(source_file.read())
                    self.stdout.write(
                        style.green(
                            '+ %s' % style.white(relative_target)
                        )
                    )
                if action == 'm':
                    with open(target, 'r') as target_file:
                        with open(source, 'r') as source_file:
                            merged = merge(
                                target_file.read(),
                                source_file.read()
                            )
                    with open(target, 'w') as target_file:
                        target_file.write(merged)

                    self.stdout.write(
                        style.yellow('> %s' % style.white(relative_target))
                    )
294062
function srcFiles() {
         return removeDuplicates(configFiles().concat(libFiles()).concat(modelFiles()).concat(srcDataFiles()).concat(codeFiles()));
     }
343489
function compile(code, options) {
        var output;
        options = options || {};
        options.requireModule = options.requireModule || requireModule;
        var ast = parse(code, options.modules || [], options);
        if (options.readableNames) {
            ast = optimizeHygiene(ast);
        }
        if (options.ast) {
            return ast;
        }
        if (options.sourceMap) {
            output = codegen.generate(ast, _.extend({
                comment: true,
                sourceMap: options.filename,
                sourceMapWithCode: true
            }, options.escodegen));
            return {
                code: output.code,
                sourceMap: output.map.toString()
            };
        }
        return { code: codegen.generate(ast, _.extend({ comment: true }, options.escodegen)) };
    }