Compiles a single file

@param {string} filePath
@param {boolean} isDebug
@param {UglifyTaskOptions} options
@returns {*}
181301
function compileSingleFile (filePath, isDebug, options)
{
    var outputPath = "./" + path.dirname(filePath).replace(/(^|\/)assets\/js/, "$1public/js");
    var uglifyOptions = {};

    gulpUtil.log(gulpUtil.colors.blue("Uglify"), pathHelper.makeRelative(filePath), " -> ", pathHelper.makeRelative(outputPath) + "/" + path.basename(filePath));

    if (options.lint)
    {
        jsHintHelper.lintFile(filePath);
    }

    if (isDebug)
    {
        uglifyOptions.compress = false;
        uglifyOptions.preserveComments = "all";
    }

    return gulp.src(filePath)
        .pipe(plumber())
        .pipe(uglify(uglifyOptions))
        .pipe(gulp.dest(outputPath));
}
138459
function (filePath)
		{
			if (typeof arguments[1]=='function')
				var cb = arguments[1];

			if (typeof arguments[2]=='function')
				var cb = arguments[2];

			var binary = typeof arguments[1]=='boolean' ? arguments[1] : false,
				realPath = this.instanceOf('wnModule')?this.modulePath+filePath:filePath,
				cmd = !cb ? 'readFileSync' : 'readFile';

			try {
				var _cb = cb ? function (err,file) {
					cb&&cb(!err ? ((binary===true) ? file : file.toString()) : false);
				} : null,
				file = fs[cmd](realPath,_cb);
			} catch (e)
			{
				if (_cb)
					cb&&cb(false);
				else
					return false;
			}
			return (file ? (binary===true) ? file : file.toString() : false);
		}
252741
function(src, filepath) {
					/*
					return '// Source: ' + filepath + '\n' +
						src.replace(/##VERSION##/g, '##FOUND##');
					*/
					src = src.replace(/##ID##/g, options.id);
					src = src.replace(/##VERSION##/g, options.version);
					src = src.replace(/##CODEBASE##/g, options.extension.updateUrl);
					return src;
				}
1311557
function(filepath, data){
      filepath = [].concat(filepath);
      var buf=[].concat(filepath);
      function parse(fileId, refUri, data) {
        var filepath = id2Uri(fileId, refUri, data);
        if(!grunt.file.exists(filepath)){ //file not found
          grunt.log.warn('Source file "' + filepath + '" not found.');
          return;
        }
        buf.unshift(filepath);
        if(filepath.indexOf('.css') != -1){ //if depend a css file
          buf.unshift(CSSFILE_HOLDER);
          return;
        }

        var dependencies = parseDependencies(grunt.file.read(filepath));
        if (dependencies.length) {
          var i = dependencies.length;
          while (i--) {
            parse(dependencies[i], filepath, data);
          }
        }
      }
      filepath.forEach(function(filepath){
        var fileContent = grunt.file.read(filepath);
        parseDependencies(fileContent).forEach(function(id){
          parse(id, filepath, data);
        })
      })
      //filter the same file
      return buf.filter(function(value, index, self){
        return self.indexOf(value) === index;
      });
  }
55871
function printFilePath(filePath: string): void {
  const relativeFilePath = filePath
    .replace(process.cwd(), '')
    .replace(/^\//, '')

  const underlinedText = chalk.underline(relativeFilePath)
  console.log(underlinedText)
}
756172
function compile( bundleData, bundleFile, config, callback ) {
	var baseDir = config['path'] || path.dirname(bundleFile);
	var encoder, profileEncoder = [], profileLoader = [], bundleLoader;

	// Compile stages
	var openBundle = function( cb ) {
		return function() {

			// Create encoder
			encoder = new BinaryEncoder(
					bundleFile,
					{
						'name' 			: bundleData['name'],
						'base_dir' 		: baseDir,
						'log'			: config['log'] || 0x00,
						'sparse'		: config['sparse'],
					}
				);

			// Add profiles
			for (var i=0; i<profileEncoder.length; i++) {
				encoder.addProfile( profileEncoder[i] );
			}

			// We are ready
			cb();
		}
	}

	var loadBundles = function( cb ) {
		return function() {
			// Load a bundle by specs
			bundleLoader.addBySpecs( bundleData );
			// Solve dependencies and load resources
			bundleLoader.load( cb );
		}
	}

	var compileExports = function( cb ) {
		return function() {
			// Get the bundle to encode
			var bundle = bundleLoader.bundles[ bundleData['name'] ];

			// Encode resources
			for (var k in bundle.resources) {
				encoder.encode( bundle.resources[k], k );
			}

			// Embed blobs
			for (var k in bundle.blobs) {
				encoder.embedBlob( bundle.blobs[k][0], k, bundle.blobs[k][1] );
			}

			// We are done
			cb();
		}
	}

	var closeBundle = function( cb ) {
		return function() {
			// Close & Complete
			encoder.close();
			cb();
		}
	}

	// Check for profileTable/profileLoader
	if (config['profileEncoder'] || config['profileLoader']) {

		// Check for missing arguments
		if (!config['profileEncoder']) {
			callback( "Got 'profileLoader' but missing 'profileEncoder' in the arguments" );
			return;
		}
		if (!config['profileLoader']) {
			callback( "Got 'profileEncoder' but missing 'profileLoader' in the arguments" );
			return;
		}

		// Fetch
		profileEncoder = config['profileEncoder'];
		profileLoader = config['profileLoader'];

		// Make sure it's array
		if (!(profileEncoder instanceof Array))
			profileEncoder = [ profileEncoder ];
		if (!(profileLoader instanceof Array))
			profileLoader = [ profileLoader ];

	} else {

		// Identify some important information
		var profile = config['profile'] || bundleData['profile'];
		if (!profile) {
			callback( "No jbb profile was specified!");
			return;
		}

		// Make sure it's array
		if (typeof profile === 'string')
			profile = [ profile ];

		// Require
		for (var i=0; i<profile.length; i++) {
			var pname = profile[i];
			if (pname[0] == ".") {
				profileEncoder.push( require( path.join(process.cwd(), pname, '/profile-encode') ) );
				profileLoader.push( require( path.join(process.cwd(), pname, "/profile-loader") ) );
			} else {
				profileEncoder.push( require('jbb-profile-'+pname+'/profile-encode') );
				profileLoader.push( require('jbb-profile-'+pname+"/profile-loader") );
			}
		}

	}

	// Load profile table and compiler helper
	bundleLoader = new BundlesLoader( baseDir );
	for (var i=0; i<profileLoader.length; i++) {
		bundleLoader.addProfileLoader( profileLoader[i] );
	}

	// Chained initialization of profile loaders
	var context = { 'remaining': profileLoader.length }
	var init_callback = (function() {
		if (--this.remaining == 0) {
			openBundle(
				loadBundles(
					compileExports(
						closeBundle( callback || function(){} )
						) 
					) 
			)();
		}
	}).bind(context);

	// Initialize profile compiler with the specs file
	for (var i=0; i<profileLoader.length; i++) {
		if (!profileLoader[i].initialize) {
			init_callback();
		} else {
			profileLoader[i].initialize( init_callback, bundleData );
		}
	}

}
1058814
function(filePath) {
        var ignoredPaths;

        if (this.options.ignore) {
            ignoredPaths = new IgnoredPaths(this.options);
            return ignoredPaths.contains(filePath);
        }

        return false;
    }
1002086
function isPanelHTMLFile(bundleName, filePath) {
	const bundle = module.exports.find(bundleName);
	if (bundle) {
		return bundle.dashboard.panels.some(panel => {
			return panel.path.endsWith(filePath);
		});
	}

	return false;
}
958064
function resolveDependencyPaths(options) {
  function init(items) {
    // Invalid if not Array
    if (Array.isArray(items)) {
      items.forEach((item, idx, items) => {
        const isArray = Array.isArray(item);
        const id = isArray ? item[0] : item;

        // Ignore already resolved
        if ('string' == typeof id) {
          const filepath = dependencies.find(id);

          if (!filepath) return warn(`unable to load plugin ${strong(id)}`, 1);

          if (isArray) {
            item[0] = require(filepath);
          } else {
            items[idx] = require(filepath);
          }
        }
      });
    }
  }

  if (options.plugins) init(options.plugins);
  if (options.presets) init(options.presets);
}
317612
function fileChecks( filepath )
		{
			// check if file exists
			if (!grunt.file.exists(filepath))
			{
				grunt.log.warn('Source file "' + filepath + '" not found');
				return false;
			}

			if(options.checkFilesize)
			{
				// check for size
				var stats = fs.lstatSync( filepath );

				if(stats.size > UNCRITICAL_FILE_SIZE)
				{
					grunt.log.warn('uncritical datauri size (' + filesize(UNCRITICAL_FILE_SIZE) + ') exceeded: ' + filepath + ' (' + filesize(stats.size) + ')');
				}
			}

			return true;
		}
364865
function isFileProcessable(filepath) {
    if (options.fileFilterRegex.length === 0) {
      return true;
    }

    return options.fileFilterRegex.some((regex) => filepath.match(regex) !== null);
  }
732807
function checkSourceFileWorker(node) {
            var links = getNodeLinks(node);
            if (!(links.flags & 1 /* TypeChecked */)) {
                // If skipLibCheck is enabled, skip type checking if file is a declaration file.
                // If skipDefaultLibCheck is enabled, skip type checking if file contains a
                // '/// <reference no-default-lib="true"/>' directive.
                if (compilerOptions.skipLibCheck && node.isDeclarationFile || compilerOptions.skipDefaultLibCheck && node.hasNoDefaultLib) {
                    return;
                }
                // Grammar checking
                checkGrammarSourceFile(node);
                potentialThisCollisions.length = 0;
                deferredNodes = [];
                deferredUnusedIdentifierNodes = produceDiagnostics && noUnusedIdentifiers ? [] : undefined;
                ts.forEach(node.statements, checkSourceElement);
                checkDeferredNodes();
                if (ts.isExternalModule(node)) {
                    registerForUnusedIdentifiersCheck(node);
                }
                if (!node.isDeclarationFile) {
                    checkUnusedIdentifiers();
                }
                deferredNodes = undefined;
                deferredUnusedIdentifierNodes = undefined;
                if (ts.isExternalOrCommonJsModule(node)) {
                    checkExternalModuleExports(node);
                }
                if (potentialThisCollisions.length) {
                    ts.forEach(potentialThisCollisions, checkIfThisIsCapturedInEnclosingScope);
                    potentialThisCollisions.length = 0;
                }
                links.flags |= 1 /* TypeChecked */;
            }
        }
548905
function write(destPath, options) {
  var debug = require('../debug').spawn('write');

  debug(function() { return 'destPath'; });
  debug(function() { return destPath; });

  debug(function() { return 'original options';});
  debug(function() { return options; });

  if (options === undefined && typeof destPath !== 'string') {
    options = destPath;
    destPath = undefined;
  }
  options = options || {};

  // set defaults for options if unset
  if (options.includeContent === undefined) {
    options.includeContent = true;
  }
  if (options.addComment === undefined) {
    options.addComment = true;
  }
  if (options.charset === undefined) {
    options.charset = 'utf8';
  }

  debug(function() { return 'derrived options'; });
  debug(function() { return options; });

  var internals = internalsInit(destPath, options);

  function sourceMapWrite(file, encoding, callback) {
    if (file.isNull() || !file.sourceMap) {
      this.push(file);
      return callback();
    }

    if (file.isStream()) {
      return callback(new Error(utils.PLUGIN_NAME + '-write: Streaming not supported'));
    }

    // fix paths if Windows style paths
    file.sourceMap.file = unixStylePath(file.relative);

    internals.setSourceRoot(file);
    internals.loadContent(file);
    internals.mapSources(file);
    internals.mapDestPath(file, this);

    this.push(file);
    callback();
  }

  return through.obj(sourceMapWrite);
}
985618
function(filepath) {
                        // Construct the destination file path.
                        var dest = path.join(
                            grunt.config('copy.coverage.dest'),
                            path.relative(process.cwd(), filepath)
                        );
                        // Return false if the file exists.
                        return !(grunt.file.exists(dest));
                    }
1157268
function (options) {
    this.matchingJadeFilePath = options.matchingJadeFilePath;
    this.htmlFilePath = options.htmlFilePath;
    this.lastRenderToFile = undefined;
    this.jadeOptions = (typeof options.jadeOptions === 'undefined') ? { pretty: true } : options.jadeOptions;
}
311259
function layoutResource(filePath, config) {

    filePath = filePath || this.page.template;
    var testFilePath = filePath + config.extOut;
    var stat = this.has_file(testFilePath);

    if (stat) {
      return filePath;
    }

  }
1345637
function ruleSync(filePath) {
  var ruleId = path.basename(filePath)
  var result = {}
  var tests = {}
  var description
  var code
  var tags
  var name

  ruleId = ruleId.slice('remark-lint-'.length)
  code = fs.readFileSync(path.join(filePath, 'index.js'), 'utf-8')
  tags = dox.parseComments(code)[0].tags
  description = find(tags, 'fileoverview')
  name = find(tags, 'module')

  /* istanbul ignore if */
  if (name !== ruleId) {
    throw new Error(ruleId + ' has an invalid `@module`: ' + name)
  }

  /* istanbul ignore if */
  if (!description) {
    throw new Error(ruleId + ' is missing a `@fileoverview`')
  }

  description = strip(description)

  result.ruleId = ruleId
  result.description = trim(description)
  result.tests = tests
  result.filePath = filePath

  find
    .all(tags, 'example')
    .map(strip)
    .forEach(check)

  return result

  function check(example) {
    var lines = example.split('\n')
    var value = strip(lines.slice(1).join('\n'))
    var info
    var setting
    var context
    var name

    try {
      info = JSON.parse(lines[0])
    } catch (error) {
      /* istanbul ignore next */
      throw new Error(
        'Could not parse example in ' + ruleId + ':\n' + error.stack
      )
    }

    setting = JSON.stringify(info.setting || true)
    context = tests[setting]
    name = info.name

    if (!context) {
      context = []
      tests[setting] = context
    }

    if (!info.label) {
      context[name] = {
        config: info.config || {},
        setting: setting,
        input: value,
        output: []
      }

      return
    }

    /* istanbul ignore if */
    if (info.label !== 'input' && info.label !== 'output') {
      throw new Error(
        'Expected `input` or `ouput` for `label` in ' +
          ruleId +
          ', not `' +
          info.label +
          '`'
      )
    }

    if (!context[name]) {
      context[name] = {config: info.config || {}}
    }

    context[name].setting = setting

    if (info.label === 'output') {
      value = value.split('\n')
    }

    context[name][info.label] = value
  }
}