parser.js 332 B

123456789101112131415161718
  1. "use strict";
  2. const getSyntax = require("./get-syntax");
  3. const patch = require("./patch-postcss");
  4. function parser (source, lang, opts) {
  5. patch();
  6. const syntax = getSyntax(lang, opts);
  7. const root = syntax.parse(source, opts);
  8. root.source.syntax = syntax;
  9. root.source.lang = lang;
  10. return root;
  11. }
  12. module.exports = parser;