"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.HtmlMain = void 0;
function _lodash() {
  const data = require("lodash");
  _lodash = function () {
    return data;
  };
  return data;
}
function _cli() {
  const data = require("@teambit/cli");
  _cli = function () {
    return data;
  };
  return data;
}
function _envs() {
  const data = require("@teambit/envs");
  _envs = function () {
    return data;
  };
  return data;
}
function _react() {
  const data = require("@teambit/react");
  _react = function () {
    return data;
  };
  return data;
}
function _html() {
  const data = require("./html.aspect");
  _html = function () {
    return data;
  };
  return data;
}
function _html2() {
  const data = require("./html.env");
  _html2 = function () {
    return data;
  };
  return data;
}
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
class HtmlMain {
  constructor(react, htmlEnv, envs) {
    this.react = react;
    this.htmlEnv = htmlEnv;
    this.envs = envs;
    /**
     * @deprecated use useTypescript()
     * override the TS config of the environment.
     */
    _defineProperty(this, "overrideTsConfig", this.react.overrideTsConfig.bind(this.react));
    /**
     * override the jest config of the environment.
     */
    _defineProperty(this, "overrideJestConfig", this.react.overrideJestConfig.bind(this.react));
    /**
     * override the env build pipeline.
     */
    _defineProperty(this, "overrideBuildPipe", this.react.overrideBuildPipe.bind(this.react));
    /**
     * override the env compilers list.
     */
    _defineProperty(this, "overrideCompiler", this.react.overrideCompiler.bind(this.react));
    /**
     * override the env compilers tasks in the build pipe.
     */
    _defineProperty(this, "overrideCompilerTasks", this.react.overrideCompilerTasks.bind(this.react));
    /**
     * @deprecated use useTypescript()
     * override the build ts config.
     */
    _defineProperty(this, "overrideBuildTsConfig", this.react.overrideBuildTsConfig.bind(this.react));
    /**
     * override package json properties.
     */
    _defineProperty(this, "overridePackageJsonProps", this.react.overridePackageJsonProps.bind(this.react));
    /**
     * override the env's typescript config for both dev and build time.
     * Replaces both overrideTsConfig (devConfig) and overrideBuildTsConfig (buildConfig)
     */
    _defineProperty(this, "useTypescript", this.react.useTypescript.bind(this.react));
    /**
     * override the env's dev server and preview webpack configurations.
     * Replaces both overrideDevServerConfig and overridePreviewConfig
     */
    _defineProperty(this, "useWebpack", this.react.useWebpack.bind(this.react));
    /**
     * An API to mutate the prettier config
     */
    _defineProperty(this, "usePrettier", this.react.usePrettier.bind(this.react));
    /**
     * An API to mutate the eslint config
     */
    _defineProperty(this, "useEslint", this.react.useEslint.bind(this.react));
  }
  /**
   * override the dependency configuration of the component environment.
   */
  overrideDependencies(dependencyPolicy) {
    return this.envs.override({
      getDependencies: () => (0, _lodash().merge)(this.htmlEnv.getDependencies(), dependencyPolicy)
    });
  }

  /**
   * create a new composition of the html environment.
   */
  compose(transformers, targetEnv = {}) {
    return this.envs.compose(this.envs.merge(targetEnv, this.htmlEnv), transformers);
  }
  static async provider([envs, react])
  // config,
  // slots,
  // harmony: Harmony
  {
    const htmlEnv = envs.merge(new (_html2().HtmlEnv)(), react.reactEnv);
    envs.registerEnv(htmlEnv);
    // if (generator) {
    // const envContext = new EnvContext(ComponentID.fromString(ReactAspect.id), loggerAspect, workerMain, harmony);
    // generator.registerComponentTemplate(getTemplates(envContext));
    // }

    return new HtmlMain(react, htmlEnv, envs);
  }
}
exports.HtmlMain = HtmlMain;
_defineProperty(HtmlMain, "slots", []);
_defineProperty(HtmlMain, "dependencies", [_envs().EnvsAspect, _react().ReactAspect]);
_defineProperty(HtmlMain, "runtime", _cli().MainRuntime);
_html().HtmlAspect.addRuntime(HtmlMain);

//# sourceMappingURL=html.main.runtime.js.map