Default source parser for css source

@param {Object}   ctx
Cssy context object with source

@param {Function} done
Async callback
519627
function parseCss (ctx, done) {
  var result
  try {
    result = postcss()
      .process(ctx.src, {
        map: {
          sourcesContent: true,
          annotation: false,
          prev: ctx.map
        },
        from: ctx.filename
      })
    ctx.src = result.css
    ctx.map = result.map.toJSON()
    done(null, ctx)
  } catch (e) {
    var msg = e.message
    var ext = extname(ctx.filename).slice(1).toLowerCase()
    if (ext !== 'css') {
      msg += ' (Try to use appropriate parser for ' + ext + ')'
    }
    done(new Error(msg))
  }
}
688674
async function compileContext(target, contextOptions) {
	const context = await getContext(target, contextOptions)

	return async function (data/** @param {object} */) {
		return context.map(data)
	}
}
1069102
function createCSS(lessFile, styledirs) {
	styledirs = styledirs || [];
	//add the file's directory to the styledirs so that relative paths for @imports work
	styledirs.push(lessFile.substr(0, lessFile.lastIndexOf('/')));
	var data = fs.readFileSync(lessFile);
	var parser = new(less.Parser)({
		// Specify search paths for @import directives. Combine with these common defaults
		paths: styledirs.concat(['.', './css']),
    // ensure we always use sync methods to avoid issue with @import in grunt
    syncImport: true
	});
	parser.parse(data.toString(), function(e, tree) {
		if (e) throw new Error ('Error parsing LESS file: ' + lessFile + '\n Cause: ' + e.message + '\n');
		var cssFile = lessFile.substr(0, lessFile.lastIndexOf('.')) + '.css';
		fs.writeFileSync(cssFile, tree.toCSS({
			compress: true
		}));
		log('created CSS file: ' + cssFile);
	});
}
351512
function generateStylesheets(done) {
			// Convert codepoints to array of strings
			var codepoints = [];
			_.each(o.glyphs, function(name) {
				codepoints.push(o.codepoints[name].toString(16));
			});
			o.codepoints = codepoints;

			// Prepage glyph names to use as CSS classes
			o.glyphs = _.map(o.glyphs, classnameize);

			o.stylesheets.sort(function(a, b) {
				return a === 'css' ? 1 : -1;
			}).forEach(generateStylesheet);

			done();
		}
669667
function(ctx, source) {
		var type, $ul,
			tree = ctx.tree,
			$container = ctx.widget.element,
			dfd,
			// calling context for root node
			rootCtx = $.extend({}, ctx, {node: this.rootNode});

		if(tree.rootNode.children){
			this.treeClear(ctx);
		}
		source = source || this.options.source;

		if(!source){
			type = $container.data("type") || "html";
			switch(type){
			case "html":
				$ul = $container.find(">ul:first");
				$ul.addClass("ui-fancytree-source ui-helper-hidden");
				source = $.ui.fancytree.parseHtml($ul);
				// allow to init tree.data.foo from <ul data-foo=''>
				this.data = $.extend(this.data, _getElementDataAsDict($ul));
				break;
			case "json":
	//            $().addClass("ui-helper-hidden");
				source = $.parseJSON($container.text());
				if(source.children){
					if(source.title){tree.title = source.title;}
					source = source.children;
				}
				break;
			default:
				$.error("Invalid data-type: " + type);
			}
		}else if(typeof source === "string"){
			// TODO: source is an element ID
			_raiseNotImplemented();
		}

		// $container.addClass("ui-widget ui-widget-content ui-corner-all");
		// Trigger fancytreeinit after nodes have been loaded
		dfd = this.nodeLoadChildren(rootCtx, source).done(function(){
			tree.render();
			if( ctx.options.selectMode === 3 ){
				tree.rootNode.fixSelection3FromEndNodes();
			}
			tree._triggerTreeEvent("init", true);
		}).fail(function(){
			tree.render();
			tree._triggerTreeEvent("init", false);
		});
		return dfd;
	}
1010510
function(opts, done) {
    if (typeof opts !== 'object') {
      done = opts;
      opts = null;
    }
    validateCallback(done);
    this.parse(opts);
    this.renderCSS(done);
    return this;
  }
1255923
function(done) {
    this.async = true;
    var self = this;

    function finish(err, file) {
      var hasCallback = (typeof done === 'function');
      if (err && !hasCallback) return self.emit('error', err);
      if (err) return done(err);
      done(null, file);
    }

    if (this.data) {
      this.createFile(this.file, this.uri, this.file, this.data, finish).parse(finish);
    } else {
      this.resolve(this.file, this.cwd, function(err, file) {
        if (err) return finish(err);
        file.parse(finish);
      });
    }

    return this;
  }
1183715
function CSSPluginBase(compileCSS) {
  this.compileCSS = compileCSS;

  this.translate = function(load, opts) {
    var loader = this;
    if (loader.builder && loader.buildCSS === false) {
      load.metadata.build = false;
      return;
    }

    var path = this._nodeRequire && this._nodeRequire('path');

    return Promise.resolve(compileCSS.call(loader, load.source, load.address, load.metadata.loaderOptions || {}))
    .then(function(result) {
      load.metadata.style = result.css;
      load.metadata.styleSourceMap = result.map;
      if (result.moduleFormat)
        load.metadata.format = result.moduleFormat;
      return result.moduleSource || '';
    });
  };
}
1145346
function webpackGetCodeOnDone (compiler, done) {
	if (!(compiler instanceof Compiler)) {
		throw new Error(`Expected compiler to be an instance of 'Compiler'`)
	}

	const outputFs = compiler.outputFileSystem
	const outputPath = compiler.outputPath

	installSourceMapSupport(outputFs)

	let compiledCode
	let error = false

	compiler.plugin('done', stats => {
		error = false
		// Server compilation errors need to be propagated to the client.
		if (stats.compilation.errors.length) {
			error = stats.compilation.errors[0]
			return
		}
		const filename = getFilename(stats, outputPath, 'main')
		const buffer = outputFs.readFileSync(filename)

		try {
			compiledCode = getCompiled(filename, buffer)
		} catch (ex) {
			error = ex
		}

		if (compiledCode) {
			done(compiledCode)
		} else {
			throw new Error(
				`webpack-get-code-on-done: Compiled code is 'undefined'. Please check latest changes that may produced this error. ${error}`
			)
		}
	})
}
377044
function (url, baseDir, done) {
  resolve(url, {
    basedir: baseDir,
    extensions: [ '.scss', '.sass', '.css' ],
    pathFilter: function (pkg, absPath, relativePath) {
      var globbedPath = buildSassGlob(absPath);
      var paths = glob.sync(globbedPath);
      var resolvedPath = paths && paths[0];
      if (resolvedPath) {
        return path.join(path.dirname(relativePath), path.basename(resolvedPath));
      }
    }
  }, function (err, file) {
    if (err) return done(err);

    // Strip the extension so .css gets evaluated properly as .scss
    file = file.replace(/\.(js|(sa|sc|c)ss)$/, '');
    done(null, file);
  });
}
831726
function() {
    var parser, source;
    source = this.source();
    if (source == null) {
      return;
    }
    parser = this.parser();
    if (parser != null) {
      return parser(source);
    } else {
      return source;
    }
  }
778204
function parse_cs_xml(data, opts, rels, wb, themes, styles) {
	if(!data) return data;
	/* 18.3.1.12 chartsheet CT_ChartSheet */
	if(!rels) rels = {'!id':{}};
	var s = {'!type':"chart", '!chart':null, '!rel':""};
	var m;

	/* 18.3.1.36 drawing CT_Drawing */
	if((m = data.match(/drawing r:id="(.*?)"/))) s['!rel'] = m[1];

	if(rels['!id'][s['!rel']]) s['!chart'] = rels['!id'][s['!rel']];
	return s;
}
672633
function(source, syntax, parser) {
    syntax = syntax || 'scss';
    source = ignoreBlock.removeIgnoredBlocks(source);

    var blocks;
    if (parser === 'postcss') {
      blocks = postcssParser.splitCodeAndCommentBlocks(source);
    } else {
      // Suits all the syntaxes
      blocks = scssParser.splitCodeAndCommentBlocks(source, syntax);
    }
    return blocks;
  }
119424
function preprocessor (css, options) {
  if (typeof css !== 'string') {
    throw new Error('sourdough-preprocessor: did not receive a String')
  }

  options = options || {}
  options.parser = sugarss

  var browserConfig = options.browsers || [
    'Explorer >= 9',
    'last 5 Chrome versions',
    'last 2 Firefox versions',
    'last 2 Safari versions',
    'last 2 iOS versions',
    'Android 4'
  ]

  var post = postcss()

  // Transform .css files to sss syntax
  function cssToSss (css, file) {
    if (path.extname(file) === '.css') {
      return postcss().process(css, { stringifier: sugarss }).then(function (result) {
        return result.css
      })
    } else {
      return css
    }
  }

  // Plugins
  post.use(importer({ transform: cssToSss, root: options.root, onImport: options.onImport }))
  post.use(customProperties())
  post.use(customMedia())
  post.use(mediaRanges())
  post.use(customSelectors())
  post.use(calc())
  post.use(colorFunctions())
  post.use(nested())
  post.use(autoprefixer(browserConfig))

  return post.process(css, options)
}
1045610
function(done) {
                var source = __dirname + '/background.js';
                var dest = self.dir + '/background.js';

                fs.readFile(source, 'utf8', function(err, background) {
                    if (err) return done(err);

                    // Make background.js connect with the websocket server on
                    // this port
                    background = background.replace('$PORT', self.port);
                    fs.writeFile(dest, background, done);
                });
            }
314493
function (done) {
        glob(path.join(__dirname, "*.ejs"), function (err, files) {
            if (err) {
                return done(err);
            }

            var templates = {};

            async.forEach(files, function (file, done) {
                fs.readFile(file, "utf8", function (err, data) {
                    if (err) {
                        return done(err);
                    } else {
                        templates[path.basename(file, ".ejs")] = _.template(data);
                        done();
                    }
                });
            }, function (err) {
                if (err) {
                    return done(err);
                }

                done(null, templates);
            });
        });
    }
1120023
function (ctx, next) {
        var plugins = []
        var config = process.cssy.config

        ctx.imports = []

        var parseImportPlugin = postcss.plugin('cssy-parse-imports', function () {
          return function (styles) {
            styles.walkAtRules(function (atRule) {
              if (atRule.name !== 'import') {
                return
              }
              if (/^url\(|:\/\//.test(atRule.params)) {
                return // Absolute
              }
              ctx.imports.push(parseImport(atRule.params))
              atRule.remove()
            })
          }
        })

        if (ctx.config.import) {
          plugins.push(parseImportPlugin)
        }

        if (config.minify) {
          plugins.push(cssnano(extend({}, (typeof config.minify === 'object')
            ? config.minify : DEFAULT_MINIFY_OPTIONS)))
        }
        postcss(plugins)
          .process(ctx.src, {
            from: ctx.filename,
            to: ctx.filename + '.map',
            map: {
              prev: ctx.map,
              inline: config.sourcemap
            }
          })
          .then(function (result) {
            ctx.src = result.css
            if (config.sourcemap) {
              // TODO: Dig sourcemap, dig more.
              ctx.src += '\n/*# sourceURL=' + ctx.filename + '.output*/'
            }
            ctx.map = result.map
            next(null, ctx)
          })

        next(null, ctx)
      }