"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.NodeEnvType = exports.NodeEnv = void 0;
function _toolboxPath() {
  const data = require("@teambit/toolbox.path.path");
  _toolboxPath = function () {
    return data;
  };
  return data;
}
function _preview() {
  const data = require("@teambit/preview");
  _preview = function () {
    return data;
  };
  return data;
}
function _path() {
  const data = require("path");
  _path = 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); }
const NodeEnvType = exports.NodeEnvType = 'node';
class NodeEnv {
  constructor(tsAspect, reactAspect) {
    this.tsAspect = tsAspect;
    this.reactAspect = reactAspect;
    _defineProperty(this, "icon", 'https://static.bit.dev/extensions-icons/nodejs.svg');
  }
  getDependencies() {
    return {
      // dependencies: {
      //   react: '-',
      //   'react-dom': '-',
      // },
      devDependencies: {
        // react: '-',
        // 'react-dom': '-',
        '@types/jest': '26.0.20',
        '@types/node': '22.10.5'
      },
      peers: [{
        name: 'react',
        /* the version to be installed and used by the env */
        version: '^17.0.0',
        /* the range of versions this env's components are compatible with */
        supportedRange: '^17.0.0 || ^18.0.0 || ^19.0.0'
      }, {
        name: 'react-dom',
        /* the version to be installed and used by the env */
        version: '^17.0.0',
        /* the range of versions this env's components are compatible with */
        supportedRange: '^17.0.0 || ^18.0.0 || ^19.0.0'
      }]
    };
  }
  getCompiler(transformers = [], tsModule) {
    return this.reactAspect.reactEnv.getTsCjsCompiler('dev', transformers, tsModule);
  }

  /**
   * returns the component build pipeline.
   */
  getBuildPipe(modifiers = {}) {
    var _modifiers$jestModifi;
    const pathToSource = (0, _toolboxPath().pathNormalizeToLinux)(__dirname).replace('/dist', '');
    const jestConfigPath = (modifiers === null || modifiers === void 0 || (_modifiers$jestModifi = modifiers.jestModifier) === null || _modifiers$jestModifi === void 0 || (_modifiers$jestModifi = _modifiers$jestModifi.transformers) === null || _modifiers$jestModifi === void 0 ? void 0 : _modifiers$jestModifi[0]()) || (0, _path().join)(pathToSource, './jest/jest.config.js');
    modifiers.jestModifier = modifiers.jestModifier || {};
    modifiers.jestModifier.transformers = [() => jestConfigPath];
    return this.reactAspect.reactEnv.getBuildPipe(modifiers);
  }

  /**
   * returns a component tester.
   */
  getTester(jestConfigPath, jestModulePath) {
    const config = jestConfigPath || require.resolve('./jest/jest.config');
    return this.reactAspect.reactEnv.createCjsJestTester(config, jestModulePath);
  }
  getPreviewConfig() {
    return {
      strategyName: _preview().COMPONENT_PREVIEW_STRATEGY_NAME,
      splitComponentBundle: false
    };
  }
  getPackageJsonProps() {
    return this.tsAspect.getCjsPackageJsonProps();
  }
  getSchemaExtractor(tsconfig, tsserverPath, contextPath) {
    return this.tsAspect.createSchemaExtractor(this.reactAspect.reactEnv.getTsConfig(tsconfig), tsserverPath, contextPath);
  }
  async __getDescriptor() {
    return {
      type: NodeEnvType
    };
  }
}
exports.NodeEnv = NodeEnv;

//# sourceMappingURL=node.env.js.map