base.js 994 B

123456789101112131415161718192021222324252627282930313233343536
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", {
  3. value: true
  4. });
  5. exports.default = void 0;
  6. class BaseParser {
  7. constructor() {
  8. this.sawUnambiguousESM = false;
  9. this.ambiguousScriptDifferentAst = false;
  10. }
  11. hasPlugin(pluginConfig) {
  12. if (typeof pluginConfig === "string") {
  13. return this.plugins.has(pluginConfig);
  14. } else {
  15. const [pluginName, pluginOptions] = pluginConfig;
  16. if (!this.hasPlugin(pluginName)) {
  17. return false;
  18. }
  19. const actualOptions = this.plugins.get(pluginName);
  20. for (const key of Object.keys(pluginOptions)) {
  21. if ((actualOptions == null ? void 0 : actualOptions[key]) !== pluginOptions[key]) {
  22. return false;
  23. }
  24. }
  25. return true;
  26. }
  27. }
  28. getPluginOption(plugin, name) {
  29. var _this$plugins$get;
  30. return (_this$plugins$get = this.plugins.get(plugin)) == null ? void 0 : _this$plugins$get[name];
  31. }
  32. }
  33. exports.default = BaseParser;
  34. //# sourceMappingURL=base.js.map