Extend 'JSFile' with new behaviour
@param {Class} JSFile
@param {Object} utils
@returns {Class}
487563
function define(JSFile, utils) {
  return class JSXFile extends JSFile {
    /**
     * Parse 'content' for dependency references
     * @param {String} content
     * @returns {Array}
     */
    parseDependencyReferences(content) {
      const references = super.parseDependencyReferences(content);

      references[0].push({ context: "require('react')", match: 'react', id: 'react' });

      return references;
    }

    /**
     * Transpile file contents
     * @param {Object} buildOptions
     *  - {Boolean} batch
     *  - {Boolean} bootstrap
     *  - {Boolean} boilerplate
     *  - {Boolean} browser
     *  - {Boolean} bundle
     *  - {Boolean} compress
     *  - {Boolean} helpers
     *  - {Array} ignoredFiles
     *  - {Boolean} import
     *  - {Boolean} watchOnly
     * @param {Function} fn(err)
     */
    transpile(buildOptions, fn) {
      super.transpile(buildOptions, (err) => {
        if (err) return fn && fn();
        this.prependContent("var React = $m['react'].exports;");
        fn();
      });
    }
  };
}
1345955
private function setJavascriptFileCDNjQuery($jsFileName)
    {
        $jQueryPosition     = strpos($jsFileName, 'jquery-');
        $jQueryMajorVersion = substr($jsFileName, 7, 1);
        if (($jQueryPosition !== false) && is_numeric($jQueryMajorVersion) && (substr($jsFileName, -7) == '.min.js')) {
            return [
                true,
                $this->sCloundFlareUrl . 'jquery/' . $this->getCmpltVers($jsFileName, 'jquery-') . '/jquery.min.js',
                '<script>window.jQuery || document.write(\'<script src="' . $this->sanitizeString($jsFileName)
                . '">\x3C/script>\')</script>',
            ];
        }
        return null;
    }
862487
function( cssFileUrl )
		{
			if ( this.$.createStyleSheet )
				this.$.createStyleSheet( cssFileUrl );
			else
			{
				var link = new CKEDITOR.dom.element( 'link' );
				link.setAttributes(
					{
						rel		:'stylesheet',
						type	: 'text/css',
						href	: cssFileUrl
					});

				this.getHead().append( link );
			}
		}
1333831
function requireJSPath(file, extension) {
	return path.join(path.dirname(file), path.basename(file, extension)).replace(/\\/g, '/');
}
1349274
function extend(src, props) {
		props = props || {};
		var p;
		for (p in src) {
			if (src.hasOwnProperty(p)) {
				if (!props.hasOwnProperty(p)) {
					props[p] = src[p];
				}
			}
		}
		return props;
	}
967954
def utils(
        ctx,
        filepath=None,
        jsonld=False,
        discover=False,
):
    
    verbose = ctx.obj['VERBOSE']
    sTime = ctx.obj['STIME']
    print_opts = {
        'labels': verbose,
    }
    DONE_ACTION = False

    if jsonld:
        if not filepath:
            click.secho(
                "What do you want to test? Please specify a valid JSONLD source.",
                fg='red')
        else:
            filepath = filepath[0]
            action_jsonld_playground(filepath, verbose)
            DONE_ACTION = True
    elif discover:
        DONE_ACTION = True
        action_webimport()
    else:
        click.secho("You haven't specified any utils command.")
        click.echo(ctx.get_help())

    if DONE_ACTION:
        eTime = time.time()
        tTime = eTime - sTime
        printDebug("\n-----------\n" + "Time:	   %0.2fs" % tTime, "comment")
179143
function addJSIndent(file, t) {
    var addIndent = '  ';
    var filepath = file.path.replace(/\\/g, '/');
    if (
      filepath.endsWith('/global/js/wrap_start.js') ||
      filepath.endsWith('/global/js/wrap_end.js')
    ) {
      addIndent = '';
    }

    if (addIndent !== '') {
      var fileLines = fs.readFileSync(file.path).toString().split('\n');
      var newFileContents = '';
      $.each(fileLines, function (i, fileLine) {
        newFileContents +=
          (fileLine ? addIndent : '') +
          fileLine +
          (i === fileLines.length ? '' : '\n');
      });

      file.contents = new Buffer(newFileContents);
    }
  }
762100
public function addAssets($cssFiles, $jsFiles, $basePath = null, $baseUrl = null)
    {
        $this->additionalAssets[] = array(
            'base_path' => $basePath,
            'base_url' => $baseUrl,
            'css' => (array) $cssFiles,
            'js' => (array) $jsFiles
        );
        return $this;
    }
134565
function BundleFile() {

  var location = getTempFileName('.browserify.js');

  function write(content) {
    fs.writeFileSync(location, content);
  }

  function exists() {
    return fs.existsSync(location);
  }

  function remove() {
    if (exists()) {
      fs.unlinkSync(location);
    }
  }

  function touch() {
    if (!exists()) {
      write('');
    }
  }


  // API

  this.touch = touch;

  this.update = write;
  this.remove = remove;

  this.location = location;
}
159352
function jslintFile(file, extraArgs) {
    return readConf(homeDir, {})
        .then(function (homeConf) {
            if (Array.isArray(file)) {
                return file.reduce(function (prom, file) {
                    return prom.then(function (oldReport) {
                        return jslintFile(file, extraArgs)
                            .then(function (newReport) {
                                return oldReport.concat(newReport);
                            });
                    });
                }, Promise.resolve([]));
            }
            return readFile(file, "utf8")
                .then(function (data) {
                    const opts = (
                        typeof extraArgs === "object" && extraArgs !== null
                    )
                        ? extraArgs
                        : {};
                    const projectDir = opts.projectDir || process.cwd();
                    return readConf(projectDir, path.dirname(file), homeConf)
                        .then(function (conf) {
                            const newConf = Object.assign(
                                {},
                                conf,
                                opts.options
                            );
                            const lines = Array.isArray(data)
                                ? data
                                : data.split(/\n|\r\n?/);
                            const sb = opts.shaBang
                                ? lines[0].startsWith("#!")
                                    ? [""].concat(lines.slice(1))
                                    : lines
                                : lines;
                            const report = {
                                pathname: file,
                                report: jslint(sb, newConf, opts.globals)
                            };

                            return typeof opts.callback === "function"
                                ? opts.callback(report)
                                : report;
                        });
                });
        });
}
269135
function lintFiles(files) {

    const eslint = new CLIEngine()

    const report = eslint.executeOnFiles(files)

    return {
        text: friendlyFormatter(report.results),
        errorCount: report.errorCount,
    }

}
1299490
public static function AppendJS($sFilenameJS){
            $oThis = self::CreateInstanceIfNotExists();

            if(file_exists($sFilenameJS))
                $oThis->aJS[] = file_get_contents($sFilenameJS);
        }
1158755
function replaceFilePlaceholders(oFile, aReplacementRules) {
  // parse file
  const sRaw = oFile.contents.toString('utf8')
  const sUpdatedFile = aReplacementRules.reduce((oResult, oRule) => {
    return oResult.replace(oRule.identifier, oRule.content)
  }, sRaw)

  // update new raw content
  oFile.contents = new Buffer(sUpdatedFile)

  // return updated file
  return oFile
}
348682
function(callback) {
			fs.appendFileSync(outputFile,";(function(root,factory){\r\n")
			fs.appendFileSync(outputFile,"    if (typeof define === 'function' && define.amd) {\r\n")
			fs.appendFileSync(outputFile,"        define([], factory);\r\n")
			fs.appendFileSync(outputFile,"    } else if (typeof exports === 'object') {\r\n")
			fs.appendFileSync(outputFile,"        module.exports = factory();\r\n")
			fs.appendFileSync(outputFile,"    } else {\r\n")
			fs.appendFileSync(outputFile,"        if (typeof root === 'undefined' || root !== Object(root)) {\r\n")
			fs.appendFileSync(outputFile,"            throw new Error('puglatizer: window does not exist or is not an object');\r\n")
			fs.appendFileSync(outputFile,"        }\r\n")
			fs.appendFileSync(outputFile,"        root.puglatizer = factory();\r\n")
			fs.appendFileSync(outputFile,"    }\r\n")
			fs.appendFileSync(outputFile,"}(this, function () {\r\n")
			fs.appendFileSync(outputFile,"    function pug_classes_object(val) { var classString = '', padding = ''; for (var key in val) { if (key && val[key] && pug_has_own_property.call(val, key)) { var classString = classString + padding + key; var padding = ' '; } } return classString; }")
			fs.appendFileSync(outputFile,"    function pug_classes_array(val, escaping) { var classString = '', className, padding = '', escapeEnabled = Array.isArray(escaping); for (var i = 0; i < val.length; i++) { var className = pug_classes(val[i]); if (!className) continue; escapeEnabled && escaping[i] && (className = pug_escape(className)); var classString = classString + padding + className; var padding = ' '; } return classString; }")
			fs.appendFileSync(outputFile,"    " + minify.js(pug.runtime.merge.toString()) + '\r\n')
			fs.appendFileSync(outputFile,"    " + minify.js(pug.runtime.classes.toString()) + '\r\n')
			fs.appendFileSync(outputFile,"    " + minify.js(pug.runtime.style.toString()) + '\r\n')
			fs.appendFileSync(outputFile,"    " + minify.js(pug.runtime.attr.toString()) + '\r\n')
			fs.appendFileSync(outputFile,"    " + minify.js(pug.runtime.attrs.toString()) + '\r\n')
			fs.appendFileSync(outputFile,"    " + minify.js(pug.runtime.escape.toString()).replace('pug_match_html','(/[\"&<>]/)') + '\r\n')
			fs.appendFileSync(outputFile,"    " + minify.js(pug.runtime.rethrow.toString()) + '\r\n')
			fs.appendFileSync(outputFile,"    var pug = {\r\n")
			fs.appendFileSync(outputFile,"    	merge:" + minify.js(pug.runtime.merge.toString()) + ',\r\n')
			fs.appendFileSync(outputFile,"    	classes:" + minify.js(pug.runtime.classes.toString()) + ',\r\n')
			fs.appendFileSync(outputFile,"    	style:" + minify.js(pug.runtime.style.toString()) + ',\r\n')
			fs.appendFileSync(outputFile,"    	attr:" + minify.js(pug.runtime.attr.toString()) + ',\r\n')
			fs.appendFileSync(outputFile,"    	attrs:" + minify.js(pug.runtime.attrs.toString()) + ',\r\n')
			fs.appendFileSync(outputFile,"    	escape:" + minify.js(pug.runtime.escape.toString()).replace('pug_match_html','(/[\"&<>]/)') + ',\r\n')
			fs.appendFileSync(outputFile,"    	rethrow:" + minify.js(pug.runtime.rethrow.toString()) + '\r\n')
			fs.appendFileSync(outputFile,"    }\r\n")
			fs.appendFileSync(outputFile,"\r\n")
			fs.appendFileSync(outputFile,'    var puglatizer = {}')
			fs.appendFileSync(outputFile,"\r\n")
			return callback()
		}
383649
function () {
        log.debug('Generating OVE.js');
        // OVE.js is a combination of client/ove.js client/utils/utils.js and client/utils/constants.js
        let text = fs.readFileSync(path.join(__dirname, '..', 'client', 'ove.js'), Constants.UTF8);
        text += fs.readFileSync(path.join(__dirname, '..', 'client', 'utils', 'utils.js'), Constants.UTF8);
        // Important thing to note here is that the output is minified using UglifyJS. This library
        // only supports ES5. Therefore some newer JS capabilities may not work. And, if there was a
        // newer JS capability used in any of the files included in OVE.js, UglifyJS will produce an
        // empty file. This can be observed by reviewing corresponding errors on the browser.
        return uglify.minify(text
            // Inject constants
            .replace(/\/\/ @CONSTANTS/g, 'var Constants = ' + JSON.stringify(Constants) + ';')
            .replace(Constants.RegExp.Annotation.VERSION, pjson.version)
            .replace(Constants.RegExp.Annotation.LICENSE, pjson.license)
            .replace(Constants.RegExp.Annotation.AUTHOR, pjson.author)
            // Replace all let/const with var for ES5 compliance
            .replace(/(let|const)/g, 'var')
            // Remove all comments matching pattern
            .replace(Constants.RegExp.ES5_COMMENT_PATTERN, ''), { output: { comments: true } }).code;
    }
1106962
function asJSX({attributes, children}, {file: {opts: fileOpts}}, babel) {
  // It's a shame you cannot use evaluate() with JSX
  const string = children[0].node.value
  children[0].replaceWith(
    getReplacement({
      string,
      fileOpts,
      babel,
    }),
  )
  const {
    parentPath: {
      node: {openingElement, closingElement},
    },
  } = children[0]
  openingElement.name.name = 'div'
  closingElement.name.name = 'div'
}
629371
function _makeFileMostRecent(paneId, file) {
        var index,
            entry,
            pane = _getPane(paneId);

        if (!_traversingFileList) {
            pane.makeViewMostRecent(file);

            index = _findFileInMRUList(pane.id, file);

            entry = _makeMRUListEntry(file, pane.id);

            if (index !== -1) {
                _mruList.splice(index, 1);
            }

            if (_findFileInMRUList(pane.id, file) !== -1) {
                console.log(file.fullPath + " duplicated in mru list");
            }

            // add it to the front of the list
            _mruList.unshift(entry);
        }
    }