experimental-worker.cjs 846 B

1234567891011121314151617181920212223242526272829303132
  1. const [major, minor] = process.versions.node.split(".").map(Number);
  2. if (major < 12 || major === 12 && minor < 3) {
  3. throw new Error("@babel/eslint-parser/experimental-worker requires Node.js >= 12.3.0");
  4. }
  5. const {
  6. normalizeESLintConfig
  7. } = require("./configuration.cjs");
  8. const analyzeScope = require("./analyze-scope.cjs");
  9. const baseParse = require("./parse.cjs");
  10. const {
  11. WorkerClient
  12. } = require("./client.cjs");
  13. const client = new WorkerClient();
  14. exports.parseForESLint = function (code, options = {}) {
  15. const normalizedOptions = normalizeESLintConfig(options);
  16. const ast = baseParse(code, normalizedOptions, client);
  17. const scopeManager = analyzeScope(ast, normalizedOptions, client);
  18. return {
  19. ast,
  20. scopeManager,
  21. visitorKeys: client.getVisitorKeys()
  22. };
  23. };
  24. //# sourceMappingURL=experimental-worker.cjs.map