convert <cedar component>.vue file into JSON object then convert to markdown file
@param {String} file -- file path of raw Vue component file
@param {Object} info -- package.json
422780
function docsBuild(file, info) {
  console.log(`Processing file: ${file}\n`)
  const vueObj = vueDocgen.parse(file)

  let compDataObj = {
    "api": {},
    "version": '',
  }

  // calculate associated component names and paths
  const vueCompName = path.basename(file,'.vue')
  const vueCompDir = path.dirname(file)
  const vueCompFilePath = vueCompDir + path.sep + vueCompName
  const BASE_VERSION = '0.0.0'
  let latestMdDoc = null, latestMdVer = BASE_VERSION

  // Determine version of current raw vue component based on its associated package.json file
  const currentDir = path.dirname(file) + path.sep
  const readmeFilePath = `${currentDir}README.md`
  const examplesFilePath = `${currentDir}EXAMPLES.md`
  const compDataHistoryFilePath = `${currentDir}build${path.sep}component-data.json`
  let compDataHistory = {"name": `${vueCompName}`, "versions": []}
  const currentVer = info.version
  compDataObj.version = currentVer

  // create data objects for component properties, events, methods, and slots
  const apiProm = new Promise((resolve, reject) => { resolve(buildAPIs(vueObj)) })
  .then( api => { 
    console.log(`Completed API data object for ${vueCompName}\n`)
    console.log(`${util.inspect(api)}`)
    Object.assign(compDataObj.api, api) 
  })
  .catch( err => { console.log(`Error while trying to create API objects:\n${err}`) })

  // After all promises complete, add new component data object to history of component
  // If current version is in history array, replace that element with current 
  Promise.all([apiProm])
  .then(() => {
    let currVersionIdx = -1
    currVersionIdx = compDataHistory.versions.findIndex((element) => {
      return element.version === compDataObj.version
    })
    currVersionIdx == -1 ? 
      compDataHistory.versions.unshift(compDataObj) :
      compDataHistory.versions[currVersionIdx] = compDataObj

    return fs.outputJSON(compDataHistoryFilePath, compDataHistory, {spaces: '\t'})
  })
  .catch( err => {
    console.log(`Problem saving component history for ${vueCompName}:\n${err}`)
    process.exit(1)
  })
}
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;
}
1246319
function(filesArr) {
		// 读取package.json，将里面内容生成头信息
		var data = fs.readFileSync('./package.json', 'utf8');
		var packageObj = JSON.parse( data );

		var headerStr = '/** \r\n';
			headerStr += ' * ' + packageObj.name + ' v' + packageObj.version + '\r\n';
			headerStr += ' * ' + packageObj.description + '\r\n';
			headerStr += ' * author : ' + packageObj.author + '\r\n';
			headerStr += ' * homepage : ' + packageObj.homepage + '\r\n';
			headerStr += ' * bugs : ' + packageObj.bugs.url + '\r\n';
			headerStr += ' **/ \r\n';


		for (var i = 0; i < filesArr.length; i++){
			var filePath = filesArr[i]
			var data = fs.readFileSync(filePath, 'utf8');
			data = headerStr  + data;
			fs.writeFileSync(filePath, data);
		}
	}
283634
function (file) {
      var result = getRawData(file), type = JSZip.utils.getTypeOf(result);
      if (type === "string") {
         if (!file.options.binary) {
            // unicode text !
            // unicode string => binary string is a painful process, check if we can avoid it.
            if (JSZip.support.uint8array && typeof TextEncoder === "function") {
               return TextEncoder("utf-8").encode(result);
            }
            if (JSZip.support.nodebuffer) {
               return new Buffer(result, "utf-8");
            }
         }
         return file.asBinary();
      }
      return result;
   }
159732
function format(file, contents) {
  let linter = new tslint.Linter({ fix: true });
  let config = tslint.Configuration.findConfiguration(
    path.resolve(__dirname, '..', 'tslint.json'),
    __filename
  );
  linter.lint(file, contents, config.results);
  let result = linter.getResult();

  if (result.fixes.length === 0) {
    fs.writeFileSync(file, contents, { encoding: 'utf8' });
  }
}
396629
function writeFile(file, content) {
    fs.writeFileSync(file, content);
    files.push(path.relative(app.components.get('path'), file));
}
964721
function parseApiFile(file) {
  const jsDocRegex = /\/\*\*([\s\S]*?)\*\//gm;
  const fileContent = fs.readFileSync(file, { encoding: 'utf8' });
  const ext = path.extname(file);
  const yaml = [];
  const jsDocComments = [];

  if (ext === '.yaml' || ext === '.yml') {
    yaml.push(jsYaml.safeLoad(fileContent));
  } else {
    const regexResults = fileContent.match(jsDocRegex);
    if (regexResults) {
      for (let i = 0; i < regexResults.length; i += 1) {
        const jsDocComment = doctrine.parse(regexResults[i], { unwrap: true });
        jsDocComments.push(jsDocComment);
      }
    }
  }

  return {
    yaml,
    jsdoc: jsDocComments,
  };
}
937248
function (changes) {
    return new FileInfo({
      src: changes && changes.src !== undefined ? changes.src : this.src,
      resolved: changes && changes.resolved !== undefined ? changes.resolved : this.resolved,
      base: changes && changes.base !== undefined ? changes.base : this.base,
      dest: changes && changes.dest !== undefined ? changes.dest : this.dest,
      destBase: changes && changes.destBase !== undefined ? changes.destBase : this.destBase,
      watch: changes && changes.watch !== undefined ? changes.watch : this.watch
    })
  }
1319305
function(file, opts) {
	if (util.isObject(file) || util.isArray(file)) {
		return file;
	}

	var options = util.extend({
		asText: false, // true, false, 'pretty'
		javascript: false, // true, false
		scope: '', // directory to look for initial file
		variables: {
			// contains a key->value object with variables to @extends
		}
	}, opts);

	file = util.template(file, options.variables);

	/*****************************************************************************
	*  Initialize
	*****************************************************************************/

	var file_path;

	// If the file path is absolute use it
	// If not then prepend the current scope of the previous file.
	if (path.resolve(file) === path.normalize(file)) {
		file_path = path.normalize(file);
	}
	else {
		file_path = path.normalize(
			options.scope ? options.scope + '/' + file : file
		);
	}
	var class_json = parseFile(file_path, options);

	// Stores JSON objects of files that have to be merged together:
	// ["a", "b"]
	var file_list = util.isArray(class_json[indicators.EXTENDS]) ?
		class_json[indicators.EXTENDS] :
		class_json[indicators.EXTENDS] != null ?
			[ class_json[indicators.EXTENDS] ] :
			[];

	// Delete @extends from base_json to avoid infinitive recursion
	delete class_json[indicators.EXTENDS];

	// Push class_json to the path list:
	file_list.push(class_json);
	/*****************************************************************************
	*  Merge file by file
	*****************************************************************************/

	// default config for each file required:
	// set asText = false so we get an object returned
	// set scope = file's directory so there can be relative references
	var json_config = util.defaults({
		asText: false,
		scope: path.dirname(file_path),

		// _as is a hack so that we know its we are calling the function recursive
		_as: ANTI_SANITIZER
	}, options);

	// super_json is our output, start by containing first file in array
	var super_json = fromFile(file_list.shift(), json_config);

	// TODO: Figure out when to sanitize super_json hopefully we don't have to
	//   santize all returns. I'm not sure about this, and I'm not sure if we
	//   can even sanitize super_json when we return it.
	//   Is super_json used by anyone recursively?

	while (file_list.length) {
		var json = fromFile(file_list.shift(), json_config);

		merge(super_json, json);
	}

	// If this file is called from the outside eg json_merger.from...
	//   File('file_which_doesnt_extends_another_file.json')
	//   we need to sanitize the file and remove all indicators
	if (options._as != ANTI_SANITIZER) {
		super_json = util.sanitizeValue(super_json);
	}

	/*****************************************************************************
	*  Return super_json
	*****************************************************************************/
	if (options.asText) {
		return stringify(super_json, options);
	}
	else {
		return super_json;
	}
}
27876
function (infos, name) {
    name = name || 'jsdoc.json';

    var firstFile = null;
    var readme = null;

    var wp = new Parser(infos);

    var bufferFiles = function(file, enc, next){
      if (file.isNull()) return; // ignore
      if (file.isStream()) return this.emit('error', new PluginError('gulp-jsdoc',  'Streaming not supported'));

      // Store firstFile to get a base and cwd later on
      if (!firstFile)
        firstFile = file;

      if (/[.]js$/i.test(file.path))
        wp.parse(file);
      else if(/readme(?:[.]md)?$/i.test(file.path))
        readme = marked(file.contents.toString('utf8'));

      next();
    };

    var endStream = function(conclude){
      // Nothing? Exit right away
      if (!firstFile){
        conclude();
        return;
      }

      var data;
      try{
        data = JSON.stringify(wp.complete(), null, 2);
        // data = parser(options, filemap));
      }catch(e){
        return this.emit('error', new PluginError('gulp-jsdoc',
          'Oooooh! Failed parsing with jsdoc. What did you do?! ' + e));
      }

      // Pump-up the generated output
      var vinyl = new File({
        cwd: firstFile.cwd,
        base: firstFile.base,
        path: path.join(firstFile.base, name),
        contents: new Buffer(data)
      });

      // Possibly stack-up the readme, if there was any in the first place
      vinyl.readme = readme;

      // Add that to the stream...
      this.push(vinyl);

      conclude();
    };

    // That's it for the parser
    return through2.obj(bufferFiles, endStream);
  }
789153
function md2html( file ){
  file = file.substr( file.length - 3 ) === '.md' ? file : file + '.md'; // add extension if need be

  var md;
  try{
    md = fs.readFileSync('./md/' + file, 'utf8');
  } catch(e){
    throw 'A markdown file named `' + file + '` was referenced but could not be read';
  }

  // var html = converter.makeHtml( md );
  //var html = mdConvertor( md );
  var html = marked( md, {
    highlight: function(code, lang){
      var ret;

      if( lang ){
        ret = hljs.highlight(lang, code).value;
      } else {
        ret = hljs.highlightAuto(code).value;
      }

      return ret;
      
    },

    renderer: mdRend
  } );


  return html;
}
1076968
function(file) {
        var self = this;

        return new Promise(function(resolve) {
            fs.readFileAsync(file, 'utf-8')
                .then(function(content) {
                    return self._parseFile(file, content);
                })
                .then(function(ast) {
                    return self._getConfig(file, ast);
                })
                .then(function(config) {
                    self._modules = self._modules.concat(config);

                    resolve(config);
                });
        });
    }
285598
function writeJSON(file, json){
	var s = file.split(".");
	if (s.length > 0) {
		var ext = s[s.length - 1];
		if (ext != "json"){
			file = file + ".json";
		}
	}
  fs.writeFileSync(file, JSON.stringify(json));
}
830740
void writeJsFileToJsDir(TypeElement element, ElementVisitor visitor, String packagePath, String fn, String dir) {
		if (null != dir) {
			try (Writer w = fws.getFileObjectWriter(dir + File.separatorChar + "srvs", packagePath + "." + fn)) {
				messager.printMessage(Diagnostic.Kind.MANDATORY_WARNING, " javascript generation class : " + element + " to : " + dir);
				element.accept(visitor, w);
			} catch (IOException ioe) {
				messager.printMessage(Diagnostic.Kind.MANDATORY_WARNING, " FAILED TO CREATE : " + packagePath + "." + fn);
			}
		}
	}
457563
function File(file) {
  this.cache = new Map();
  this.history = [];
  this.pattern = file.pattern;
  this.recurse = file.recurse;
  this.dirname = file.dirname;
  this.segment = file.segment;
  this.path = file.path;
  this.orig = file.path;
}
217296
function load(file, options) {
	if (options.cache && rr.cache['tpl!' + file]) {
		return Promise.resolve(rr.cache['tpl!' + file]);
	}

	return fs.readFileAsync(file, 'utf8').then(function (template) {
		return utils.wrap(Ractive.parse(template, options), options);
	}).then(function (template) {
		var basePath = path.relative(options.settings.views, path.dirname(file));
		var cOptions = utils.buildOptions(options, null, true);
		cOptions.template = template;

		return Promise.join(utils.buildComponentsRegistry(cOptions), utils.buildPartialsRegistry(basePath, cOptions), function (components, partials) {
			cOptions.components = components;
			cOptions.partials = partials;
			options.components = {};
			options.partials = {};

			var Component = Ractive.extend(cOptions);

			if (options.cache) {
				rr.cache['tpl!' + file] = Component;
			}

			return Component;
		});
	});
}
201535
def json(directory)
      path = File.join(directory, 'elm-package.json')
      JSON.parse(File.read(path))
    rescue JSON::ParserError
      warn "Invalid JSON in file: #{path.bold}"
    rescue Errno::ENOENT
      warn "Could not find file: #{path.bold}"
    end