Extend 'File' with new behaviour
@param {Class} File
@param {Object} utils
@returns {Class}
557228
function define (File, utils) {
  const { debug, error, strong } = utils.cnsl;

  return class STYLUSFile extends File {
    /**
     * Constructor
     * @param {String} id
     * @param {String} filepath
     * @param {Object} options
     *  - {Object} caches
     *  - {Object} fileExtensions
     *  - {Function} fileFactory
     *  - {Object} globalAliases
     *  - {Array} npmModulepaths
     *  - {Object} pluginOptions
     *  - {Object} runtimeOptions
     */
    constructor (id, filepath, options) {
      super(id, filepath, options);

      this.workflows.writeable = WORKFLOW_WRITEABLE;
    }

    /**
     * Compile file contents
     * @param {Object} buildOptions
     *  - {Boolean} batch
     *  - {Boolean} bootstrap
     *  - {Boolean} boilerplate
     *  - {Boolean} browser
     *  - {Boolean} bundle
     *  - {Boolean} compress
     *  - {Array} ignoredFiles
     *  - {Boolean} helpers
     *  - {Boolean} watchOnly
     * @param {Function} fn(err)
     */
    compile (buildOptions, fn) {
      const style = stylus(this.content)
        .set('filename', this.relpath)
        // Gather all source directories
        .set('paths', this.options.fileCache.getDirs());

      if (this.hasMaps) style.set('sourcemap', { comment: false });
      if (this.options.pluginOptions.stylus) {
        for (const option in this.options.pluginOptions.stylus) {
          style.set(option, this.options.pluginOptions.stylus[option]);
        }
      }

      style.render((err, css) => {
        if (err) {
          if (!this.options.runtimeOptions.watch) return fn(err);
          error(err, 4, false);
        }

        this.setContent(css);
        if (style.sourcemap) this.setMap(style.sourcemap);
        debug(`compile: ${strong(this.relpath)}`, 4);
        fn();
      });
    }
  };
}
596981
function File(file, options) {
  file = file || {};
  this.file = file;
  this.options = file.options || options || {};
  this.type = this.file.type;
  this.origPath = file.origPath;

  // Record path change
  var history = file.path ? [file.path] : file.history;
  this.history = history || [];

  this.cwd = file.cwd || process.cwd();
  this.base = file.base || this.cwd;

  // Stat = files stats object
  this.stat = file.stat || null;
  this._isFile = true;
}
115633
private File checkFile(File file) {
		final String extension = getExtension(file.getName()).toLowerCase(Locale.getDefault());
		if (!Arrays.asList(extensions).contains(extension)) {
			// En lecture, vérifie le format du fichier sélectionné.
			//			if (openOrSave) {
			//				final StringBuilder sb = new StringBuilder(
			//						"L'extension du fichier sélectionné n'est pas un format d'image accepté");
			//				sb.append(" (");
			//				for (final Iterator<String> it = Arrays.asList(extensions).iterator(); it.hasNext();) {
			//					sb.append(it.next());
			//					if (it.hasNext()) {
			//						sb.append(", ");
			//					}
			//				}
			//				sb.append(')');
			//				throw new IOException(sb.toString());
			//			}
			// si pas d'extension ou extension inconnue, on prend png par défaut
			return new File(file.getPath() + ".png");
		}

		return file;
	}
585023
function open (path, delimiter = '\r\n') {

  const self = this;
  const flags = 'r+';

  return new Promise((resolve, reject) => {
    // Open file for reading and writing. An exception occurs if the file does not exist.
    fs.open(path, flags, (error, fd) => {
      if (error) {
        reject(error);
        return;
      }

      try {
        let promise = self.term(path, delimiter, fd);
        resolve(promise);
      } catch (termError) {
        reject(termError);
      }
    });
  });
}
1105438
function define(File, utils) {
  return class JSFile extends File {
    /**
     * Constructor
     * @param {String} id
     * @param {String} filepath
     * @param {Object} options
     *  - {Boolean} browser
     *  - {Function} buildFactory
     *  - {FileCache} fileCache
     *  - {Object} fileExtensions
     *  - {Function} fileFactory
     *  - {Number} level
     *  - {Array} npmModulepaths
     *  - {Object} pluginOptions
     *  - {ResolverCache} resolverCache
     *  - {Object} runtimeOptions
     *  - {String} webroot
     */
    constructor(id, filepath, options) {
      super(id, filepath, 'js', options);

      /* set via super call:
      this.isBuddyBuilt = false;
      this.isBuilt = false;
      */
      this.workflows.standard = WORKFLOW_STANDARD;
      this.workflows.inlineable = WORKFLOW_INLINEABLE;
      this.workflows.writeable = WORKFLOW_WRITEABLE;

      this.depth = 0;
      this.dynamicDependencyReferences = [];
      this.isCircularDependency = false;
      this.isNpmModule = this.options.npmModulepaths
        ? this.options.npmModulepaths.some(modulepath => this.filepath.includes(modulepath))
        : false;
      // Transpile all non-npm modules unless module looks like es6
      RE_TRANSPILE.lastIndex = 0;
      this.shouldTranspile = this.isNpmModule ? RE_TRANSPILE.test(this.content) : true;
      this.transpiledContent = '';
      this.transpiledFingerprint = '';
      this.transpiledMap = null;
    }

    /**
     * Retrieve flattened dependency tree
     * @returns {Array}
     */
    getAllDependencies() {
      if (!this.allDependencies) {
        this.allDependencies = sort(this);
      }

      const filteredDependencies = this.getAllDependencyReferences()
        .filter(reference => {
          return (
            !reference.isIgnored &&
            reference.file &&
            !reference.file.isLocked &&
            reference.file.type != 'json' &&
            this.allDependencies.includes(reference.file)
          );
        })
        .map(reference => reference.file);

      return this.allDependencies.filter(dependency => filteredDependencies.includes(dependency));
    }

    /**
     * Add dynamic 'dependencies'
     * @param {Array} dependencies
     */
    addDynamicDependencies(dependencies) {
      const { fileFactory } = this.options;
      const resolveOptions = {
        browser: this.options.browser,
        cache: this.options.resolverCache,
        fileExtensions: this.options.fileExtensions
      };

      dependencies.forEach(dependency => {
        const filepath = resolve(this.filepath, dependency.id, resolveOptions);

        // Unable to resolve filepath or create instance
        if (filepath === '') {
          warn(`dynamic import ${strong(dependency.id)} for ${strong(this.relpath)} not found`, this.options.level);
          return;
        }

        const file = (dependency.file = fileFactory(filepath, this.options));

        this.dynamicDependencyReferences.push(dependency);
        if (this.options.buildFactory) this.options.buildFactory(filepath, `${file.idSafe}-%hash%.${file.extension}`);
      });
    }

    /**
     * Read file content
     * @returns {String|Buffer}
     */
    readFileContent() {
      let content = super.readFileContent();

      this.isBuddyBuilt = RE_BUDDY_BUILT.test(content);
      this.isBuilt = RE_UMD_BUILT.test(content);

      if (this.isBuilt) content = flattenUMD(content, `$m['${this.id}']`);
      if (this.isBuddyBuilt) content = concat.unwrap(content, this.id);

      return content;
    }

    /**
     * Hash 'content'
     * @param {Boolean} forWrite
     * @returns {String}
     */
    hashContent(forWrite = false) {
      return forWrite
        ? md5(
            // TODO: add header
            [this, ...this.getAllDependencies()]
              .reduce((contents, file) => {
                contents.push(file.content);
                // Include hashes of dynamic builds which are not yet inlined
                if (file.dynamicDependencyReferences.length > 0) {
                  contents.push(...file.dynamicDependencyReferences.map(ref => ref.file.writeHash));
                }
                return contents;
              }, [])
              .join('')
          )
        : md5(this.content || this.fileContent);
    }

    /**
     * Read and store 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)
     */
    load(buildOptions, fn) {
      super.load(buildOptions, err => {
        if (err) return fn && fn();

        RE_STRICT.lastIndex = 0;
        if (buildOptions && buildOptions.bundle && RE_STRICT.test(this.content)) {
          this.setContent(this.content.replace(RE_STRICT, ''));
        }

        if (fn) fn();
      });
    }

    /**
     * Parse file contents for dependency references
     * @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)
     * @returns {null}
     */
    parse(buildOptions, fn) {
      if (
        this.isBuddyBuilt ||
        this.isBuilt ||
        // Don't parse input file dependencies if not bundling
        (!buildOptions.bundle && this.isDependency)
      ) {
        return fn();
      }

      const [requires, imports, dynamicImports] = this.parseDependencyReferences(this.content);

      this.addDynamicDependencies(dynamicImports);
      super.addDependencies(requires.concat(imports), buildOptions);

      debug(`parse: ${strong(this.relpath)}`, 4);
      fn();
    }

    /**
     * Parse 'content' for dependency references
     * @param {String} content
     * @returns {Array}
     */
    parseDependencyReferences(content) {
      return parse(content);
    }

    /**
     * Compile file contents [no-op]
     * @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)
     */
    compile(buildOptions, fn) {
      debug(`compile: ${strong(this.relpath)}`, 4);
      fn();
    }

    /**
     * Replace process.env references with values
     * @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)
     * @returns {null}
     */
    replaceEnvironment(buildOptions, fn) {
      if (this.isBuddyBuilt || this.isBuilt) return fn();
      // Force on server when compressed/deploy
      this.setContent(replaceEnvironment(this.content, buildOptions.compress ? true : buildOptions.browser));
      debug(`replace environment vars: ${strong(this.relpath)}`, 4);
      fn();
    }

    /**
     * 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)
     * @returns {null}
     */
    transpile(buildOptions, fn) {
      if (this.isBuddyBuilt || this.isBuilt) {
        this.transpiledContent = this.content;
        if (this.hasMaps) this.transpiledMap = sourceMap.clone(this.map);
        return fn();
      }

      const babelOptions = this.options.pluginOptions.babel;
      const babelOptionsFingerprint = this.options.pluginOptions.babelFingerprint;
      const fingerprintableBuildOptions = Object.assign({}, buildOptions);

      delete fingerprintableBuildOptions.ignoredFiles;

      const buildOptionsFingerprint = md5(JSON.stringify(fingerprintableBuildOptions));
      const moduleString = `$m['${this.id}']`;
      let plugins = babelOptions.plugins.slice();
      let optionsFingerprint = babelOptionsFingerprint;

      if (!this.shouldTranspile) {
        plugins = [];
        optionsFingerprint = '';
      }
      // Flatten if bundling
      if (buildOptions.bundle) {
        const data = {
          // Do not replace 'module.exports' for writeable Node files
          replace: buildOptions.browser ? true : !this.isWriteable(buildOptions.batch),
          source: {
            moduleExports: moduleString,
            namespace: `${this.idSafe}__`
          }
        };

        plugins.push([babelPluginTransformFlatten, data]);
        optionsFingerprint += md5(`${data.replace}`);
      }

      const contentFingerprint = md5(JSON.stringify(this.content));
      const options = Object.assign({}, babelOptions, {
        babelrc: false,
        filename: this.relUrl,
        plugins,
        sourceMaps: this.hasMaps,
        sourceFileName: this.hasMaps ? this.relUrl : null
      });
      const transpiledFingerprint = `${contentFingerprint}:${optionsFingerprint}:${buildOptionsFingerprint}`;

      // Skip transpile if same fingerprint as previous
      if (transpiledFingerprint == this.transpiledFingerprint && this.transpiledContent) {
        this.content = this.transpiledContent;
        this.map = this.transpiledMap;
      } else {
        try {
          if (this.hasMaps) options.inputSourceMap = this.map.toJSON();
          const { code: content, map } = transpile(this.content, options);

          this.transpiledContent = content;
          this.setContent(content);
          if (map) {
            this.setMap(map);
            this.transpiledMap = sourceMap.clone(this.map);
          }
          debug(`transpile: ${strong(this.relpath)}`, 4);
        } catch (err) {
          if (this.options.runtimeOptions.watch) {
            error(err, 4, false);
          } else {
            fn(err);
          }
        }
      }

      this.transpiledFingerprint = transpiledFingerprint;

      fn();
    }

    /**
     * Inline json/disabled dependency content
     * @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)
     */
    inline(buildOptions, fn) {
      [...this.getAllDependencies(), this].forEach(file => {
        if (file.isBuddyBuilt || file.isBuilt) return;
        file.setContent(inline(file.content, file.dependencyReferences, buildOptions.browser));
        debug(`inline: ${strong(file.relpath)}`, 4);
      });
      fn();
    }

    /**
     * Reparse transpiled file contents to account for possibly removed dependencies
     * @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)
     * @returns {null}
     */
    reparse(buildOptions, fn) {
      if (this.isDummy) return fn();

      [this, ...this.getAllDependencies()].forEach(file => {
        if (file.isBuddyBuilt || file.isBuilt) return;

        const [requires, imports, dynamicImports] = this.parseDependencyReferences(file.content);
        const referencesById = file.dependencyReferences.reduce((referencesById, dependency) => {
          referencesById[dependency.id] = dependency;
          return referencesById;
        }, {});
        const dynamicReferencesById = file.dynamicDependencyReferences.reduce((dynamicReferencesById, dependency) => {
          dynamicReferencesById[dependency.id] = dependency;
          return dynamicReferencesById;
        }, {});

        file.allDependencies = null;
        file.allDependencyReferences = null;
        file.dependencies = [];
        file.dependencyReferences = [];
        file.dynamicDependencyReferences = [];

        requires.concat(imports).forEach(dependency => {
          const originalReference = referencesById[dependency.id];

          // Can only have fewer not more references, so compare to original collection and reuse props
          if (originalReference) {
            dependency.isDisabled = originalReference.isDisabled;
            dependency.isIgnored = originalReference.isIgnored;
            file.dependencyReferences.push(dependency);
            if (originalReference.file) {
              dependency.file = originalReference.file;
              dependency.file.depth = 0;
              dependency.file.isCircularDependency = false;
              file.dependencies.push(dependency.file);
            }
          }
        });
        dynamicImports.forEach(dependency => {
          const originalReference = dynamicReferencesById[dependency.id];

          if (originalReference) {
            dependency.file = originalReference.file;
            file.dynamicDependencyReferences.push(dependency);
          }
        });

        debug(`reparse: ${strong(file.relpath)}`, 4);
      });
      fn();
    }

    /**
     * Replace relative dependency references with fully resolved
     * @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)
     */
    rewriteDirnameFilename(buildOptions, fn) {
      [...this.getAllDependencies(), this].forEach(file => {
        if (file.isBuddyBuilt) return;
        file.setContent(rewriteDirnameFilename(file.content, path.dirname(this.writepath), file.filepath));
        debug(`replace __dirname/__filename references: ${strong(file.relpath)}`, 4);
      });
      fn();
    }

    /**
     * Replace relative dependency references with fully resolved
     * @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)
     */
    replaceReferences(buildOptions, fn) {
      [...this.getAllDependencies(), this].forEach(file => {
        if (file.isBuddyBuilt || file.isBuilt) return;
        file.setContent(replaceReferences(file.content, file.dependencyReferences));
        debug(`replace dependency references: ${strong(file.relpath)}`, 4);
      });
      fn();
    }

    /**
     * Replace dynamic dependency references with fully resolved
     * @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)
     */
    replaceDynamicReferences(buildOptions, fn) {
      [this, ...this.getAllDependencies()].forEach(file => {
        if (file.isBuilt) return;
        file.setContent(replaceDynamicReferences(file.content, buildOptions.browser, file.dynamicDependencyReferences));
        debug(`replace dynamic dependency references: ${strong(file.relpath)}`, 4);
      });
      fn();
    }

    /**
     * Concatenate 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)
     */
    concat(buildOptions, fn) {
      concat(this, HEADER, buildOptions);
      debug(`concat: ${strong(this.relpath)}`, 4);
      fn();
    }

    /**
     * Rollback to transpiled state
     */
    rollback() {
      this.content = this.transpiledContent;
      this.map = this.transpiledMap;
    }

    /**
     * Reset content
     * @param {Boolean} hard
     */
    reset(hard) {
      super.reset(hard);
      this.depth = 0;
      this.dynamicDependencyReferences = [];
      this.isCircularDependency = false;
      if (hard) {
        this.transpiledContent = '';
        this.transpiledFingerprint = '';
        this.transpiledMap = null;
      }
    }
  };
}
282904
function renameFileExtension( file, toExt ) {
	return file.replace( new RegExp( path.extname( file ) + "$" ), toExt );
}
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();
      });
    }
  };
}
6029
function(file) {
        if (require.alias && require.alias[file]) {
            file = require.alias[file];
        }

        var module = {
            exports: {},
            file: file
        };

        file = require.resolve(this && this.file ? this.file : './', file);

        var requireFunc = require.bind({
            file: file
        });

        if (window.require.cache[file]) {
            if (window.require.cache[file].obj) {
                return window.require.cache[file].obj;
            }

            window.require.cache[file].fn(module, module.exports, requireFunc);
            window.require.cache[file].obj = module.exports;
            return window.require.cache[file].obj;
        }

        if (!window.require.autoload || (window.require.autoload && file.charAt(0) !== '.')) {
            throw new Error('Module ' + file + ' not found!');
        }

        var remoteFile = location.protocol
            .concat('//', location.host)
            .concat(file.substr(1));
        
        var xhr = new XMLHttpRequest();
        xhr.open('GET', remoteFile, false);
        xhr.send();
        if (xhr.status !== 200) {
            throw new Error('Could not load module "' + file + '"! Response error: ' +
                xhr.status + ' ' + xhr.statusText);
        }
        var source = xhr.responseText;

        var fn;
        try {
            //jshint evil:true
            fn = eval('(function(module, exports, require) {\n' +
                (/\.json$/.test(file) ? 'module.exports = ' : '') +
                source + '\n})\n\n//# sourceURL=' + file);
        }
        catch (err) {
            throw new Error(err + ' in ' + file);
        }

        fn(module, module.exports, require.bind(requireFunc));
        window.require.cache[file] = {
            fn: fn,
            calls: 1,
            obj: module.exports,
            loaded: true
        };

        return window.require.cache[file].obj;
    }
839211
public static File addFileExtension(File file, String extension) {
		return new File(file.getAbsolutePath() + "." + extension);
	}
130629
function( file ) {
                if ( !(file instanceof WUFile) ) {
    
                    if ( !(file instanceof File) ) {
                        if ( !this._ruid ) {
                            throw new Error('Can\'t add external files.');
                        }
                        file = new File( this._ruid, file );
                    }
    
                    file = new WUFile( file );
                }
    
                return file;
            }
1016205
function(file) {
    var path = fis.util.realpath(file);
    if (path) {
      this.deps[path] = fis.util.mtime(path).getTime();
    } else {
      fis.log.warning('unable to add dependency file[' + file + ']: No such file.');
    }
    return this;
  }
265229
function(file, args) {
    return new Promise(function(resolve, reject) {
      var child = spawn(file, args, { stdio: 'inherit' });
      child.on('error', reject);
      child.on('close', resolve);
    });
  }
433451
def with_file_utils(&block)
      Module.new do
        include Mustermann::FileUtils
        define_method(:f, &block)
        private(:f)
        extend self
      end
    end
875601
function ( file ) {
			var resolved;
			var expanded = grunt.file.expand( file )[0];

			if ( !expanded ) {
				resolved = require.resolve( file );

			} else {
				resolved = "./" + expanded;
			}

			return resolved;
		}
129838
function DocFile (file, contents) {
	this.uri = file;
	this.dir = path.dirname(file);
	this.filename = path.basename(file);
	this.name = this.filename.replace(/\.js$/, '');
	this.contents = contents;
	this.comments = [];
	
	this.process();
}
59978
function $file(params, fn) {
    if (params == null) {
        return params;
    }
    let file, encoding;
    if (typeof params === 'string') {
        file = params;
    } else if (Array.isArray(params) && params.length === 2) {
        file = params[0];
        encoding = params[1];
    }
    if (
        typeof file === 'string' &&
        (encoding === undefined || typeof encoding === 'string')
    ) {
        file = fn.$path(file);
        const fs = require('fs');
        if (fs.existsSync(file) && fs.lstatSync(file).isFile()) {
            return fs.readFileSync(file, { encoding });
        }
    }
    throw new Error(
        '$file expects a string or an array with two string elements'
    );
}
69400
function expand(file, root){
    var items = file.orig.src;
    var category = file.dest;
    _debug("Expanding "+category+": ",items,"\n");
    var expanded;
    switch(category){
      case 'meta': //bypass expanding that would break
        expanded = items;
        break;
      case 'head':
      case 'body':
        //expand + retrieve file content
        expanded = grunt.file.expand({cwd:root,nonull:true},items);
        expanded = expanded.map(function(item){
          var filePath = path.join(root,item);
          if(isFile(filePath)){
            return grunt.file.read(filePath,{encoding:'utf8'});
          }
          else{
            _debug("File ",filePath," does not exist");
            return item;
          }
        });
        break;
      default:
        //expand
        expanded = grunt.file.expand({cwd:root,nonull:true},items);
        break;
    }
    
    _debug("Expanded "+category+": ",expanded,"\n");
    return expanded;
  }