@teambit/react 0.0.728 → 0.0.731

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (30) hide show
  1. package/artifacts/env-template/public/{408.js → 307.js} +2 -2
  2. package/artifacts/env-template/public/793.js +8 -8
  3. package/artifacts/env-template/public/assets-manifest.json +12 -12
  4. package/artifacts/env-template/public/{compositions.0973f62782905e7f2e42.js → compositions.6b3cf159178bfea8b56c.js} +1 -1
  5. package/artifacts/env-template/public/compositions.html +1 -1
  6. package/artifacts/env-template/public/{overview.90cd56f5e8c809801a8f.js → overview.9a0b0150a1f48864ff88.js} +1 -1
  7. package/artifacts/env-template/public/overview.html +1 -1
  8. package/artifacts/env-template/public/peers.dbfbae2daf17fd0c329d.js +1 -0
  9. package/artifacts/env-template/public/{preview-root.2d7ec96d11a4573d2e83.js → preview-root.2c1fef139790a3bc64be.js} +1 -1
  10. package/artifacts/env-template/public/service-worker.js +1 -1
  11. package/artifacts/env-template/public/static/css/793.52d87d5e.css +1 -0
  12. package/artifacts/preview/teambit_react_react-preview.js +2 -2
  13. package/{compositions-1652153159767.js → compositions-1652498684867.js} +0 -0
  14. package/dist/react.env.d.ts +3 -1
  15. package/dist/react.env.js +5 -4
  16. package/dist/react.env.js.map +1 -1
  17. package/dist/react.main.runtime.d.ts +4 -2
  18. package/dist/react.main.runtime.js +14 -3
  19. package/dist/react.main.runtime.js.map +1 -1
  20. package/dist/webpack/transformers.d.ts +2 -1
  21. package/dist/webpack/transformers.js +51 -2
  22. package/dist/webpack/transformers.js.map +1 -1
  23. package/{overview-1652153159767.js → overview-1652498684867.js} +0 -0
  24. package/package-tar/teambit-react-0.0.731.tgz +0 -0
  25. package/package.json +33 -30
  26. package/{preview-1652153159767.js → preview-1652498684867.js} +2 -2
  27. package/webpack/transformers.ts +36 -2
  28. package/artifacts/env-template/public/peers.b1e5a815a97146071b4a.js +0 -1
  29. package/artifacts/env-template/public/static/css/793.008a2d27.css +0 -1
  30. package/package-tar/teambit-react-0.0.728.tgz +0 -0
@@ -1,4 +1,4 @@
1
- (function(root,factory){typeof exports=="object"&&typeof module=="object"?module.exports=factory():typeof define=="function"&&define.amd?define([],factory):typeof exports=="object"?exports["teambit.react/react-preview"]=factory():root["teambit.react/react-preview"]=factory()})(self,function(){return(()=>{var __webpack_modules__={88244:module2=>{function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}module2.exports=_interopRequireDefault},10401:(__unused_webpack_module,__webpack_exports__2,__webpack_require__2)=>{"use strict";__webpack_require__2.r(__webpack_exports__2),__webpack_require__2.d(__webpack_exports__2,{default:()=>MDXContent});var react__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__2(63804),react__WEBPACK_IMPORTED_MODULE_0___default=__webpack_require__2.n(react__WEBPACK_IMPORTED_MODULE_0__),_mdx_js_react__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__2(85057),_mdx_js_react__WEBPACK_IMPORTED_MODULE_1___default=__webpack_require__2.n(_mdx_js_react__WEBPACK_IMPORTED_MODULE_1__),_teambit_mdx_ui_mdx_scope_context__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__2(58459),_teambit_mdx_ui_mdx_scope_context__WEBPACK_IMPORTED_MODULE_2___default=__webpack_require__2.n(_teambit_mdx_ui_mdx_scope_context__WEBPACK_IMPORTED_MODULE_2__),_teambit_react_content_react_overview__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__2(55906),_excluded=["components"];function _extends(){return _extends=Object.assign||function(target){for(var i=1;i<arguments.length;i++){var source=arguments[i];for(var key in source)Object.prototype.hasOwnProperty.call(source,key)&&(target[key]=source[key])}return target},_extends.apply(this,arguments)}function _objectWithoutProperties(source,excluded){if(source==null)return{};var target=_objectWithoutPropertiesLoose(source,excluded),key,i;if(Object.getOwnPropertySymbols){var sourceSymbolKeys=Object.getOwnPropertySymbols(source);for(i=0;i<sourceSymbolKeys.length;i++)key=sourceSymbolKeys[i],!(excluded.indexOf(key)>=0)&&(!Object.prototype.propertyIsEnumerable.call(source,key)||(target[key]=source[key]))}return target}function _objectWithoutPropertiesLoose(source,excluded){if(source==null)return{};var target={},sourceKeys=Object.keys(source),key,i;for(i=0;i<sourceKeys.length;i++)key=sourceKeys[i],!(excluded.indexOf(key)>=0)&&(target[key]=source[key]);return target}var layoutProps={},MDXLayout="wrapper";function MDXContent(_ref){var components=_ref.components,props=_objectWithoutProperties(_ref,_excluded);return(0,_mdx_js_react__WEBPACK_IMPORTED_MODULE_1__.mdx)(MDXLayout,_extends({},layoutProps,props,{components,mdxType:"MDXLayout"}),(0,_mdx_js_react__WEBPACK_IMPORTED_MODULE_1__.mdx)(_teambit_mdx_ui_mdx_scope_context__WEBPACK_IMPORTED_MODULE_2__.MDXScopeProvider,{components:{ReactOverview:_teambit_react_content_react_overview__WEBPACK_IMPORTED_MODULE_3__.ZP},mdxType:"MDXScopeProvider"},(0,_mdx_js_react__WEBPACK_IMPORTED_MODULE_1__.mdx)(_teambit_react_content_react_overview__WEBPACK_IMPORTED_MODULE_3__.ZP,{mdxType:"ReactOverview"})))}MDXContent.isMDXComponent=!0},55906:(__unused_webpack_module,exports2,__webpack_require__2)=>{"use strict";var __webpack_unused_export__,__bit_component={id:"teambit.react/content/react-overview@1.95.0",homepage:"https://bit.dev/teambit/react/content/react-overview",exported:!0};__webpack_unused_export__={value:!0},__webpack_unused_export__={enumerable:!0,get:function(){return _reactOverview.default}},Object.defineProperty(exports2,"ZP",{enumerable:!0,get:function(){return _reactOverview.default}});var _reactOverview=_interopRequireDefault(__webpack_require__2(2664));function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}_interopRequireDefault.__bit_component=__bit_component},2664:(__unused_webpack_module,exports2,__webpack_require__2)=>{"use strict";var __bit_component={id:"teambit.react/content/react-overview@1.95.0",homepage:"https://bit.dev/teambit/react/content/react-overview",exported:!0};Object.defineProperty(exports2,"__esModule",{value:!0}),exports2.default=MDXContent;var _react=_interopRequireDefault(__webpack_require__2(63804)),_react2=__webpack_require__2(85057),_mdxUi=__webpack_require__2(58459),_excluded=["components"];function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}_interopRequireDefault.__bit_component=__bit_component;function _extends(){return _extends=Object.assign||function(target){for(var i=1;i<arguments.length;i++){var source=arguments[i];for(var key in source)Object.prototype.hasOwnProperty.call(source,key)&&(target[key]=source[key])}return target},_extends.apply(this,arguments)}_extends.__bit_component=__bit_component;function _objectWithoutProperties(source,excluded){if(source==null)return{};var target=_objectWithoutPropertiesLoose(source,excluded),key,i;if(Object.getOwnPropertySymbols){var sourceSymbolKeys=Object.getOwnPropertySymbols(source);for(i=0;i<sourceSymbolKeys.length;i++)key=sourceSymbolKeys[i],!(excluded.indexOf(key)>=0)&&(!Object.prototype.propertyIsEnumerable.call(source,key)||(target[key]=source[key]))}return target}_objectWithoutProperties.__bit_component=__bit_component;function _objectWithoutPropertiesLoose(source,excluded){if(source==null)return{};var target={},sourceKeys=Object.keys(source),key,i;for(i=0;i<sourceKeys.length;i++)key=sourceKeys[i],!(excluded.indexOf(key)>=0)&&(target[key]=source[key]);return target}_objectWithoutPropertiesLoose.__bit_component=__bit_component;var layoutProps={},MDXLayout="wrapper";function MDXContent(_ref){var components=_ref.components,props=_objectWithoutProperties(_ref,_excluded);return(0,_react2.mdx)(MDXLayout,_extends({},layoutProps,props,{components,mdxType:"MDXLayout"}),(0,_react2.mdx)(_mdxUi.MDXScopeProvider,{components:{},mdxType:"MDXScopeProvider"},(0,_react2.mdx)("h1",null,"React Overview"),(0,_react2.mdx)("p",null,`React is teambit's Component Development Environment (Env) for React.
1
+ (function(root,factory){typeof exports=="object"&&typeof module=="object"?module.exports=factory():typeof define=="function"&&define.amd?define([],factory):typeof exports=="object"?exports["teambit.react/react-preview"]=factory():root["teambit.react/react-preview"]=factory()})(self,function(){return(()=>{var __webpack_modules__={88244:module2=>{function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}module2.exports=_interopRequireDefault},23869:(__unused_webpack_module,__webpack_exports__2,__webpack_require__2)=>{"use strict";__webpack_require__2.r(__webpack_exports__2),__webpack_require__2.d(__webpack_exports__2,{default:()=>MDXContent});var react__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__2(63804),react__WEBPACK_IMPORTED_MODULE_0___default=__webpack_require__2.n(react__WEBPACK_IMPORTED_MODULE_0__),_mdx_js_react__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__2(85057),_mdx_js_react__WEBPACK_IMPORTED_MODULE_1___default=__webpack_require__2.n(_mdx_js_react__WEBPACK_IMPORTED_MODULE_1__),_teambit_mdx_ui_mdx_scope_context__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__2(58459),_teambit_mdx_ui_mdx_scope_context__WEBPACK_IMPORTED_MODULE_2___default=__webpack_require__2.n(_teambit_mdx_ui_mdx_scope_context__WEBPACK_IMPORTED_MODULE_2__),_teambit_react_content_react_overview__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__2(55906),_excluded=["components"];function _extends(){return _extends=Object.assign||function(target){for(var i=1;i<arguments.length;i++){var source=arguments[i];for(var key in source)Object.prototype.hasOwnProperty.call(source,key)&&(target[key]=source[key])}return target},_extends.apply(this,arguments)}function _objectWithoutProperties(source,excluded){if(source==null)return{};var target=_objectWithoutPropertiesLoose(source,excluded),key,i;if(Object.getOwnPropertySymbols){var sourceSymbolKeys=Object.getOwnPropertySymbols(source);for(i=0;i<sourceSymbolKeys.length;i++)key=sourceSymbolKeys[i],!(excluded.indexOf(key)>=0)&&(!Object.prototype.propertyIsEnumerable.call(source,key)||(target[key]=source[key]))}return target}function _objectWithoutPropertiesLoose(source,excluded){if(source==null)return{};var target={},sourceKeys=Object.keys(source),key,i;for(i=0;i<sourceKeys.length;i++)key=sourceKeys[i],!(excluded.indexOf(key)>=0)&&(target[key]=source[key]);return target}var layoutProps={},MDXLayout="wrapper";function MDXContent(_ref){var components=_ref.components,props=_objectWithoutProperties(_ref,_excluded);return(0,_mdx_js_react__WEBPACK_IMPORTED_MODULE_1__.mdx)(MDXLayout,_extends({},layoutProps,props,{components,mdxType:"MDXLayout"}),(0,_mdx_js_react__WEBPACK_IMPORTED_MODULE_1__.mdx)(_teambit_mdx_ui_mdx_scope_context__WEBPACK_IMPORTED_MODULE_2__.MDXScopeProvider,{components:{ReactOverview:_teambit_react_content_react_overview__WEBPACK_IMPORTED_MODULE_3__.ZP},mdxType:"MDXScopeProvider"},(0,_mdx_js_react__WEBPACK_IMPORTED_MODULE_1__.mdx)(_teambit_react_content_react_overview__WEBPACK_IMPORTED_MODULE_3__.ZP,{mdxType:"ReactOverview"})))}MDXContent.isMDXComponent=!0},55906:(__unused_webpack_module,exports2,__webpack_require__2)=>{"use strict";var __webpack_unused_export__,__bit_component={id:"teambit.react/content/react-overview@1.95.0",homepage:"https://bit.dev/teambit/react/content/react-overview",exported:!0};__webpack_unused_export__={value:!0},__webpack_unused_export__={enumerable:!0,get:function(){return _reactOverview.default}},Object.defineProperty(exports2,"ZP",{enumerable:!0,get:function(){return _reactOverview.default}});var _reactOverview=_interopRequireDefault(__webpack_require__2(2664));function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}_interopRequireDefault.__bit_component=__bit_component},2664:(__unused_webpack_module,exports2,__webpack_require__2)=>{"use strict";var __bit_component={id:"teambit.react/content/react-overview@1.95.0",homepage:"https://bit.dev/teambit/react/content/react-overview",exported:!0};Object.defineProperty(exports2,"__esModule",{value:!0}),exports2.default=MDXContent;var _react=_interopRequireDefault(__webpack_require__2(63804)),_react2=__webpack_require__2(85057),_mdxUi=__webpack_require__2(58459),_excluded=["components"];function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}_interopRequireDefault.__bit_component=__bit_component;function _extends(){return _extends=Object.assign||function(target){for(var i=1;i<arguments.length;i++){var source=arguments[i];for(var key in source)Object.prototype.hasOwnProperty.call(source,key)&&(target[key]=source[key])}return target},_extends.apply(this,arguments)}_extends.__bit_component=__bit_component;function _objectWithoutProperties(source,excluded){if(source==null)return{};var target=_objectWithoutPropertiesLoose(source,excluded),key,i;if(Object.getOwnPropertySymbols){var sourceSymbolKeys=Object.getOwnPropertySymbols(source);for(i=0;i<sourceSymbolKeys.length;i++)key=sourceSymbolKeys[i],!(excluded.indexOf(key)>=0)&&(!Object.prototype.propertyIsEnumerable.call(source,key)||(target[key]=source[key]))}return target}_objectWithoutProperties.__bit_component=__bit_component;function _objectWithoutPropertiesLoose(source,excluded){if(source==null)return{};var target={},sourceKeys=Object.keys(source),key,i;for(i=0;i<sourceKeys.length;i++)key=sourceKeys[i],!(excluded.indexOf(key)>=0)&&(target[key]=source[key]);return target}_objectWithoutPropertiesLoose.__bit_component=__bit_component;var layoutProps={},MDXLayout="wrapper";function MDXContent(_ref){var components=_ref.components,props=_objectWithoutProperties(_ref,_excluded);return(0,_react2.mdx)(MDXLayout,_extends({},layoutProps,props,{components,mdxType:"MDXLayout"}),(0,_react2.mdx)(_mdxUi.MDXScopeProvider,{components:{},mdxType:"MDXScopeProvider"},(0,_react2.mdx)("h1",null,"React Overview"),(0,_react2.mdx)("p",null,`React is teambit's Component Development Environment (Env) for React.
2
2
  It enables you to quickly set up a dev environment that follows best practices for React component development.`),(0,_react2.mdx)("p",null,"React can also be used as a good starting point for your own customized Env as it provides a comprehensive API that makes it easy to extend."),(0,_react2.mdx)("h2",null,"Using the React env"),(0,_react2.mdx)("p",null,"To use React Env, apply it on the relevant ",(0,_react2.mdx)("a",{parentName:"p",href:"/docs/workspace/variants"},"variants")," (component selections) in your ",(0,_react2.mdx)("a",{parentName:"p",href:"/docs/workspace/workspace-configuration"},"Workspace config"),":"),(0,_react2.mdx)("pre",null,(0,_react2.mdx)("code",{parentName:"pre",className:"language-json",metastring:'title="workspace.jsonc"',title:'"workspace.jsonc"'},`{
3
3
  "teambit.workspace/variants": {
4
4
  "{ui/**}": {
@@ -8,4 +8,4 @@ It enables you to quickly set up a dev environment that follows best practices f
8
8
  }
9
9
  `)),(0,_react2.mdx)("h2",null,"Creating Components"),(0,_react2.mdx)("p",null,"React env provides a set of component templates that can be used to speed-up and standardize your component development:"),(0,_react2.mdx)("p",null,"To list all available templates:"),(0,_react2.mdx)("pre",null,(0,_react2.mdx)("code",{parentName:"pre",className:"language-bash"},`bit templates
10
10
  `)),(0,_react2.mdx)("ul",null,(0,_react2.mdx)("li",{parentName:"ul"},(0,_react2.mdx)("inlineCode",{parentName:"li"},"react")," a basic React UI component."),(0,_react2.mdx)("li",{parentName:"ul"},(0,_react2.mdx)("inlineCode",{parentName:"li"},"react-context")," a react context component."),(0,_react2.mdx)("li",{parentName:"ul"},(0,_react2.mdx)("inlineCode",{parentName:"li"},"react-hook")," a react hook component."),(0,_react2.mdx)("li",{parentName:"ul"},(0,_react2.mdx)("inlineCode",{parentName:"li"},"mdx-component")," an MDX component."),(0,_react2.mdx)("li",{parentName:"ul"},(0,_react2.mdx)("inlineCode",{parentName:"li"},"react-component-js")," a basic React component in JS."),(0,_react2.mdx)("li",{parentName:"ul"},(0,_react2.mdx)("inlineCode",{parentName:"li"},"react-env")," boilerplate for a customized environment configuration.")),(0,_react2.mdx)("p",null,"Use any of these templates with the ",(0,_react2.mdx)("inlineCode",{parentName:"p"},"bit create")," command:"),(0,_react2.mdx)("pre",null,(0,_react2.mdx)("code",{parentName:"pre",className:"language-bash"},`bit create react ui/my-welcome
11
- `)),(0,_react2.mdx)("h2",null,"Development services and configurations"),(0,_react2.mdx)("p",null,"The table below lists ",(0,_react2.mdx)("a",{parentName:"p",href:"/dev-services/dev-services-overview"},"dev services")," that are provided by the React env. Each service handles a specific component development operation. Each is implemented by the React env, using a specific set of configurations."),(0,_react2.mdx)("p",null,"To customize and extend the React env, ",(0,_react2.mdx)("a",{parentName:"p",href:"/envs/pre-configured-envs/react/extending-react#using-your-own-react-env-extension"},"create you own React env extension"),". You can replace the Aspects used by the env, or override their configurations (use the links provided in the 'customization' column)."),(0,_react2.mdx)("table",null,(0,_react2.mdx)("thead",{parentName:"table"},(0,_react2.mdx)("tr",{parentName:"thead"},(0,_react2.mdx)("th",{parentName:"tr",align:null},"Service"),(0,_react2.mdx)("th",{parentName:"tr",align:null},"Aspect"),(0,_react2.mdx)("th",{parentName:"tr",align:null},"Default config"),(0,_react2.mdx)("th",{parentName:"tr",align:null},"Customization"))),(0,_react2.mdx)("tbody",{parentName:"table"},(0,_react2.mdx)("tr",{parentName:"tbody"},(0,_react2.mdx)("td",{parentName:"tr",align:null},(0,_react2.mdx)("a",{parentName:"td",href:"/docs/dev-services/compiler/compiler-overview"},"Compiler")),(0,_react2.mdx)("td",{parentName:"tr",align:null},(0,_react2.mdx)("a",{parentName:"td",href:"https://bit.dev/teambit/typescript/typescript"},"TypeScript")),(0,_react2.mdx)("td",{parentName:"tr",align:null},(0,_react2.mdx)("a",{parentName:"td",href:"https://bit.dev/teambit/react/react/~code/typescript/tsconfig.json"},"tsconfig.json")),(0,_react2.mdx)("td",{parentName:"tr",align:null},"\u2022 ",(0,_react2.mdx)("a",{parentName:"td",href:"/frameworks/react/config-react-tools#typescript"},"TS compilation config")," ",(0,_react2.mdx)("br",null)," \u2022 ",(0,_react2.mdx)("a",{parentName:"td",href:"/docs/dev-services/compiler/configure-env-with-compiler"},"Replace compiler"))),(0,_react2.mdx)("tr",{parentName:"tbody"},(0,_react2.mdx)("td",{parentName:"tr",align:null},(0,_react2.mdx)("a",{parentName:"td",href:"/tester/overview"},"Tester")),(0,_react2.mdx)("td",{parentName:"tr",align:null},(0,_react2.mdx)("a",{parentName:"td",href:"https://bit.dev/teambit/defender/jest"},"Jest")),(0,_react2.mdx)("td",{parentName:"tr",align:null},(0,_react2.mdx)("a",{parentName:"td",href:"https://bit.dev/teambit/react/react/~code/jest/jest.config.js"},"jest.config.js")),(0,_react2.mdx)("td",{parentName:"tr",align:null},"\u2022 ",(0,_react2.mdx)("a",{parentName:"td",href:"/frameworks/react/config-react-tools#jest"},"Jest config")," ",(0,_react2.mdx)("br",null)," \u2022 ",(0,_react2.mdx)("a",{parentName:"td",href:"/dev-services/tester/configure-env-with-tester"},"Replace Tester"))),(0,_react2.mdx)("tr",{parentName:"tbody"},(0,_react2.mdx)("td",{parentName:"tr",align:null},(0,_react2.mdx)("a",{parentName:"td",href:"/linter/overview"},"Linting")),(0,_react2.mdx)("td",{parentName:"tr",align:null},(0,_react2.mdx)("a",{parentName:"td",href:"https://bit.dev/teambit/defender/eslint"},"ESLint")),(0,_react2.mdx)("td",{parentName:"tr",align:null},(0,_react2.mdx)("a",{parentName:"td",href:"https://bit.dev/teambit/react/react/~code/eslint/eslintrc.ts"},"eslintrc.ts")),(0,_react2.mdx)("td",{parentName:"tr",align:null},"\u2022 ",(0,_react2.mdx)("a",{parentName:"td",href:"/frameworks/react/config-react-tools#eslint"},"ESLint Config")," ",(0,_react2.mdx)("br",null)," \u2022 ",(0,_react2.mdx)("a",{parentName:"td",href:"/dev-services/linter/configure-env-with-linter"},"Replace Linter"))),(0,_react2.mdx)("tr",{parentName:"tbody"},(0,_react2.mdx)("td",{parentName:"tr",align:null},(0,_react2.mdx)("a",{parentName:"td",href:"/formatter/overview"},"Formatter")),(0,_react2.mdx)("td",{parentName:"tr",align:null},(0,_react2.mdx)("a",{parentName:"td",href:"https://bit.dev/teambit/defender/prettier"},"Prettier")),(0,_react2.mdx)("td",{parentName:"tr",align:null},(0,_react2.mdx)("a",{parentName:"td",href:"https://bit.dev/teambit/react/react/~code/prettier/prettier.config.js"},"prettier.config.ts")),(0,_react2.mdx)("td",{parentName:"tr",align:null},"\u2022 ",(0,_react2.mdx)("a",{parentName:"td",href:"/frameworks/react/config-react-tools#prettier"},"Prettier config")," ",(0,_react2.mdx)("br",null)," \u2022 ",(0,_react2.mdx)("a",{parentName:"td",href:"/dev-services/formatter/configure-env-with-formatter"},"Replace Formatter"))),(0,_react2.mdx)("tr",{parentName:"tbody"},(0,_react2.mdx)("td",{parentName:"tr",align:null},"DevServer"),(0,_react2.mdx)("td",{parentName:"tr",align:null},(0,_react2.mdx)("a",{parentName:"td",href:"https://bit.dev/teambit/webpack/webpack"},"Webpack")),(0,_react2.mdx)("td",{parentName:"tr",align:null},(0,_react2.mdx)("a",{parentName:"td",href:"https://bit.dev/teambit/react/react/~code/webpack/webpack.config.preview.dev.ts"},"webpack.config.preview.dev.ts")),(0,_react2.mdx)("td",{parentName:"tr",align:null},"\u2022 Webpack config (for bundling in the workspace)")),(0,_react2.mdx)("tr",{parentName:"tbody"},(0,_react2.mdx)("td",{parentName:"tr",align:null},(0,_react2.mdx)("a",{parentName:"td",href:"/docs/dev-services/preview/overview"},"Preview")),(0,_react2.mdx)("td",{parentName:"tr",align:null},"-"),(0,_react2.mdx)("td",{parentName:"tr",align:null}),(0,_react2.mdx)("td",{parentName:"tr",align:null},"\u2022 ",(0,_react2.mdx)("a",{parentName:"td",href:"/dev-services/preview/register-custom-preview"},"Add preview"))),(0,_react2.mdx)("tr",{parentName:"tbody"},(0,_react2.mdx)("td",{parentName:"tr",align:null},(0,_react2.mdx)("a",{parentName:"td",href:"/docs/packages/packages-overview"},"Package")),(0,_react2.mdx)("td",{parentName:"tr",align:null},"-"),(0,_react2.mdx)("td",{parentName:"tr",align:null},"See the ",(0,_react2.mdx)("a",{parentName:"td",href:"https://bit.dev/teambit/typescript/typescript/~code/typescript.main.runtime.ts"},"TypeScript Aspect")," config"),(0,_react2.mdx)("td",{parentName:"tr",align:null},"\u2022 ",(0,_react2.mdx)("a",{parentName:"td",href:"/packages/managing-package-json#set-configuration-from-an-env"},"Add Env package config")," ",(0,_react2.mdx)("br",null)," \u2022 TypeScript's package config")),(0,_react2.mdx)("tr",{parentName:"tbody"},(0,_react2.mdx)("td",{parentName:"tr",align:null},"Bundler"),(0,_react2.mdx)("td",{parentName:"tr",align:null},(0,_react2.mdx)("a",{parentName:"td",href:"https://bit.dev/teambit/webpack/webpack"},"Webpack")),(0,_react2.mdx)("td",{parentName:"tr",align:null},(0,_react2.mdx)("a",{parentName:"td",href:"https://bit.dev/teambit/react/react/~code/webpack/webpack.config.preview.ts"},"webpack.config.preview.ts")),(0,_react2.mdx)("td",{parentName:"tr",align:null},"\u2022 Webpack config (for bundling during build)")),(0,_react2.mdx)("tr",{parentName:"tbody"},(0,_react2.mdx)("td",{parentName:"tr",align:null},(0,_react2.mdx)("a",{parentName:"td",href:"/docs/dev-services/docs/docs-overview"},"Documentation")),(0,_react2.mdx)("td",{parentName:"tr",align:null},"-"),(0,_react2.mdx)("td",{parentName:"tr",align:null},(0,_react2.mdx)("a",{parentName:"td",href:"https://bit.dev/teambit/react/react/~code/docs/index.tsx"},"Docs template")),(0,_react2.mdx)("td",{parentName:"tr",align:null},(0,_react2.mdx)("a",{parentName:"td",href:"/docs/dev-services/docs/docs-templates"},"Replace docs template"))),(0,_react2.mdx)("tr",{parentName:"tbody"},(0,_react2.mdx)("td",{parentName:"tr",align:null},(0,_react2.mdx)("a",{parentName:"td",href:"http://localhost:3000/docs/dev-services/builder/builder-overview"},"Builder")),(0,_react2.mdx)("td",{parentName:"tr",align:null},"-"),(0,_react2.mdx)("td",{parentName:"tr",align:null},(0,_react2.mdx)("a",{parentName:"td",href:"http://localhost:3000/docs/dev-services/builder/builder-overview"},"Build pipeline")),(0,_react2.mdx)("td",{parentName:"tr",align:null},(0,_react2.mdx)("a",{parentName:"td",href:"/dev-services/builder/build-pipelines"},"Build pipelines"))),(0,_react2.mdx)("tr",{parentName:"tbody"},(0,_react2.mdx)("td",{parentName:"tr",align:null},(0,_react2.mdx)("a",{parentName:"td",href:"/dependencies/dependencies-overview"},"Dependencies")),(0,_react2.mdx)("td",{parentName:"tr",align:null},"-"),(0,_react2.mdx)("td",{parentName:"tr",align:null},(0,_react2.mdx)("a",{parentName:"td",href:"https://bit.dev/teambit/react/react/~code/react.env.ts"},"Env-dependencies")),(0,_react2.mdx)("td",{parentName:"tr",align:null},(0,_react2.mdx)("a",{parentName:"td",href:"/dependencies/configuring-dependencies#configuring-dependencies-from-an-env"},"Env dependencies"))),(0,_react2.mdx)("tr",{parentName:"tbody"},(0,_react2.mdx)("td",{parentName:"tr",align:null},(0,_react2.mdx)("a",{parentName:"td",href:"/docs/dev-services/generator/generator-overview"},"Generator")),(0,_react2.mdx)("td",{parentName:"tr",align:null},"-"),(0,_react2.mdx)("td",{parentName:"tr",align:null},(0,_react2.mdx)("a",{parentName:"td",href:"https://bit.dev/teambit/react/react/~code/templates/react-component.ts"},"React templates")),(0,_react2.mdx)("td",{parentName:"tr",align:null},(0,_react2.mdx)("a",{parentName:"td",href:""},"Add a component template"))))),(0,_react2.mdx)("h3",null,"Default React versions"),(0,_react2.mdx)("p",null,"By default, the React env sets the following dependency versions for components using it:"),(0,_react2.mdx)("ul",null,(0,_react2.mdx)("li",{parentName:"ul"},(0,_react2.mdx)("strong",{parentName:"li"},"react")," (peer dependency): ",(0,_react2.mdx)("inlineCode",{parentName:"li"},"^16.8.0 || ^17.0.0")),(0,_react2.mdx)("li",{parentName:"ul"},(0,_react2.mdx)("strong",{parentName:"li"},"react-dom")," (peer dependency): ",(0,_react2.mdx)("inlineCode",{parentName:"li"},"^16.8.0 || ^17.0.0")),(0,_react2.mdx)("li",{parentName:"ul"},(0,_react2.mdx)("strong",{parentName:"li"},"@types/react"),": ",(0,_react2.mdx)("inlineCode",{parentName:"li"},"^17.0.8")),(0,_react2.mdx)("li",{parentName:"ul"},(0,_react2.mdx)("strong",{parentName:"li"},"@types/react-dom"),": ",(0,_react2.mdx)("inlineCode",{parentName:"li"},"^17.0.5")))))}MDXContent.__bit_component=__bit_component,MDXContent.isMDXComponent=!0},72942:(__unused_webpack_module,exports2,__webpack_require__2)=>{"use strict";var __bit_component={id:"teambit.react/react@0.0.728",homepage:"https://bit.dev/teambit/react/react",exported:!0},_interopRequireDefault=__webpack_require__2(88244);Object.defineProperty(exports2,"__esModule",{value:!0}),exports2.Logo=void 0;function _react(){const data=_interopRequireDefault(__webpack_require__2(63804));return _react=function(){return data},data}_react.__bit_component=__bit_component;const Logo=()=>_react().default.createElement("div",{style:{height:"100%",display:"flex",justifyContent:"center"}},_react().default.createElement("img",{style:{width:70},src:"https://static.bit.dev/extensions-icons/react.svg"}));Logo.__bit_component=__bit_component,exports2.Logo=Logo},85057:module2=>{"use strict";module2.exports=MdxJsReact},63804:module2=>{"use strict";module2.exports=React},58459:module2=>{"use strict";module2.exports=TeambitMdxUiMdxScopeContext}},__webpack_module_cache__={};function __webpack_require__(moduleId){var cachedModule=__webpack_module_cache__[moduleId];if(cachedModule!==void 0)return cachedModule.exports;var module2=__webpack_module_cache__[moduleId]={exports:{}};return __webpack_modules__[moduleId](module2,module2.exports,__webpack_require__),module2.exports}__webpack_require__.n=module2=>{var getter=module2&&module2.__esModule?()=>module2.default:()=>module2;return __webpack_require__.d(getter,{a:getter}),getter},__webpack_require__.d=(exports2,definition)=>{for(var key in definition)__webpack_require__.o(definition,key)&&!__webpack_require__.o(exports2,key)&&Object.defineProperty(exports2,key,{enumerable:!0,get:definition[key]})},__webpack_require__.o=(obj,prop)=>Object.prototype.hasOwnProperty.call(obj,prop),__webpack_require__.r=exports2=>{typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(exports2,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(exports2,"__esModule",{value:!0})};var __webpack_exports__={};return(()=>{"use strict";__webpack_require__.r(__webpack_exports__),__webpack_require__.d(__webpack_exports__,{compositions:()=>compositions,overview:()=>overview});const compositions=[__webpack_require__(72942)],overview=[__webpack_require__(10401)]})(),__webpack_exports__})()});
11
+ `)),(0,_react2.mdx)("h2",null,"Development services and configurations"),(0,_react2.mdx)("p",null,"The table below lists ",(0,_react2.mdx)("a",{parentName:"p",href:"/dev-services/dev-services-overview"},"dev services")," that are provided by the React env. Each service handles a specific component development operation. Each is implemented by the React env, using a specific set of configurations."),(0,_react2.mdx)("p",null,"To customize and extend the React env, ",(0,_react2.mdx)("a",{parentName:"p",href:"/envs/pre-configured-envs/react/extending-react#using-your-own-react-env-extension"},"create you own React env extension"),". You can replace the Aspects used by the env, or override their configurations (use the links provided in the 'customization' column)."),(0,_react2.mdx)("table",null,(0,_react2.mdx)("thead",{parentName:"table"},(0,_react2.mdx)("tr",{parentName:"thead"},(0,_react2.mdx)("th",{parentName:"tr",align:null},"Service"),(0,_react2.mdx)("th",{parentName:"tr",align:null},"Aspect"),(0,_react2.mdx)("th",{parentName:"tr",align:null},"Default config"),(0,_react2.mdx)("th",{parentName:"tr",align:null},"Customization"))),(0,_react2.mdx)("tbody",{parentName:"table"},(0,_react2.mdx)("tr",{parentName:"tbody"},(0,_react2.mdx)("td",{parentName:"tr",align:null},(0,_react2.mdx)("a",{parentName:"td",href:"/docs/dev-services/compiler/compiler-overview"},"Compiler")),(0,_react2.mdx)("td",{parentName:"tr",align:null},(0,_react2.mdx)("a",{parentName:"td",href:"https://bit.dev/teambit/typescript/typescript"},"TypeScript")),(0,_react2.mdx)("td",{parentName:"tr",align:null},(0,_react2.mdx)("a",{parentName:"td",href:"https://bit.dev/teambit/react/react/~code/typescript/tsconfig.json"},"tsconfig.json")),(0,_react2.mdx)("td",{parentName:"tr",align:null},"\u2022 ",(0,_react2.mdx)("a",{parentName:"td",href:"/frameworks/react/config-react-tools#typescript"},"TS compilation config")," ",(0,_react2.mdx)("br",null)," \u2022 ",(0,_react2.mdx)("a",{parentName:"td",href:"/docs/dev-services/compiler/configure-env-with-compiler"},"Replace compiler"))),(0,_react2.mdx)("tr",{parentName:"tbody"},(0,_react2.mdx)("td",{parentName:"tr",align:null},(0,_react2.mdx)("a",{parentName:"td",href:"/tester/overview"},"Tester")),(0,_react2.mdx)("td",{parentName:"tr",align:null},(0,_react2.mdx)("a",{parentName:"td",href:"https://bit.dev/teambit/defender/jest"},"Jest")),(0,_react2.mdx)("td",{parentName:"tr",align:null},(0,_react2.mdx)("a",{parentName:"td",href:"https://bit.dev/teambit/react/react/~code/jest/jest.config.js"},"jest.config.js")),(0,_react2.mdx)("td",{parentName:"tr",align:null},"\u2022 ",(0,_react2.mdx)("a",{parentName:"td",href:"/frameworks/react/config-react-tools#jest"},"Jest config")," ",(0,_react2.mdx)("br",null)," \u2022 ",(0,_react2.mdx)("a",{parentName:"td",href:"/dev-services/tester/configure-env-with-tester"},"Replace Tester"))),(0,_react2.mdx)("tr",{parentName:"tbody"},(0,_react2.mdx)("td",{parentName:"tr",align:null},(0,_react2.mdx)("a",{parentName:"td",href:"/linter/overview"},"Linting")),(0,_react2.mdx)("td",{parentName:"tr",align:null},(0,_react2.mdx)("a",{parentName:"td",href:"https://bit.dev/teambit/defender/eslint"},"ESLint")),(0,_react2.mdx)("td",{parentName:"tr",align:null},(0,_react2.mdx)("a",{parentName:"td",href:"https://bit.dev/teambit/react/react/~code/eslint/eslintrc.ts"},"eslintrc.ts")),(0,_react2.mdx)("td",{parentName:"tr",align:null},"\u2022 ",(0,_react2.mdx)("a",{parentName:"td",href:"/frameworks/react/config-react-tools#eslint"},"ESLint Config")," ",(0,_react2.mdx)("br",null)," \u2022 ",(0,_react2.mdx)("a",{parentName:"td",href:"/dev-services/linter/configure-env-with-linter"},"Replace Linter"))),(0,_react2.mdx)("tr",{parentName:"tbody"},(0,_react2.mdx)("td",{parentName:"tr",align:null},(0,_react2.mdx)("a",{parentName:"td",href:"/formatter/overview"},"Formatter")),(0,_react2.mdx)("td",{parentName:"tr",align:null},(0,_react2.mdx)("a",{parentName:"td",href:"https://bit.dev/teambit/defender/prettier"},"Prettier")),(0,_react2.mdx)("td",{parentName:"tr",align:null},(0,_react2.mdx)("a",{parentName:"td",href:"https://bit.dev/teambit/react/react/~code/prettier/prettier.config.js"},"prettier.config.ts")),(0,_react2.mdx)("td",{parentName:"tr",align:null},"\u2022 ",(0,_react2.mdx)("a",{parentName:"td",href:"/frameworks/react/config-react-tools#prettier"},"Prettier config")," ",(0,_react2.mdx)("br",null)," \u2022 ",(0,_react2.mdx)("a",{parentName:"td",href:"/dev-services/formatter/configure-env-with-formatter"},"Replace Formatter"))),(0,_react2.mdx)("tr",{parentName:"tbody"},(0,_react2.mdx)("td",{parentName:"tr",align:null},"DevServer"),(0,_react2.mdx)("td",{parentName:"tr",align:null},(0,_react2.mdx)("a",{parentName:"td",href:"https://bit.dev/teambit/webpack/webpack"},"Webpack")),(0,_react2.mdx)("td",{parentName:"tr",align:null},(0,_react2.mdx)("a",{parentName:"td",href:"https://bit.dev/teambit/react/react/~code/webpack/webpack.config.preview.dev.ts"},"webpack.config.preview.dev.ts")),(0,_react2.mdx)("td",{parentName:"tr",align:null},"\u2022 Webpack config (for bundling in the workspace)")),(0,_react2.mdx)("tr",{parentName:"tbody"},(0,_react2.mdx)("td",{parentName:"tr",align:null},(0,_react2.mdx)("a",{parentName:"td",href:"/docs/dev-services/preview/overview"},"Preview")),(0,_react2.mdx)("td",{parentName:"tr",align:null},"-"),(0,_react2.mdx)("td",{parentName:"tr",align:null}),(0,_react2.mdx)("td",{parentName:"tr",align:null},"\u2022 ",(0,_react2.mdx)("a",{parentName:"td",href:"/dev-services/preview/register-custom-preview"},"Add preview"))),(0,_react2.mdx)("tr",{parentName:"tbody"},(0,_react2.mdx)("td",{parentName:"tr",align:null},(0,_react2.mdx)("a",{parentName:"td",href:"/docs/packages/packages-overview"},"Package")),(0,_react2.mdx)("td",{parentName:"tr",align:null},"-"),(0,_react2.mdx)("td",{parentName:"tr",align:null},"See the ",(0,_react2.mdx)("a",{parentName:"td",href:"https://bit.dev/teambit/typescript/typescript/~code/typescript.main.runtime.ts"},"TypeScript Aspect")," config"),(0,_react2.mdx)("td",{parentName:"tr",align:null},"\u2022 ",(0,_react2.mdx)("a",{parentName:"td",href:"/packages/managing-package-json#set-configuration-from-an-env"},"Add Env package config")," ",(0,_react2.mdx)("br",null)," \u2022 TypeScript's package config")),(0,_react2.mdx)("tr",{parentName:"tbody"},(0,_react2.mdx)("td",{parentName:"tr",align:null},"Bundler"),(0,_react2.mdx)("td",{parentName:"tr",align:null},(0,_react2.mdx)("a",{parentName:"td",href:"https://bit.dev/teambit/webpack/webpack"},"Webpack")),(0,_react2.mdx)("td",{parentName:"tr",align:null},(0,_react2.mdx)("a",{parentName:"td",href:"https://bit.dev/teambit/react/react/~code/webpack/webpack.config.preview.ts"},"webpack.config.preview.ts")),(0,_react2.mdx)("td",{parentName:"tr",align:null},"\u2022 Webpack config (for bundling during build)")),(0,_react2.mdx)("tr",{parentName:"tbody"},(0,_react2.mdx)("td",{parentName:"tr",align:null},(0,_react2.mdx)("a",{parentName:"td",href:"/docs/dev-services/docs/docs-overview"},"Documentation")),(0,_react2.mdx)("td",{parentName:"tr",align:null},"-"),(0,_react2.mdx)("td",{parentName:"tr",align:null},(0,_react2.mdx)("a",{parentName:"td",href:"https://bit.dev/teambit/react/react/~code/docs/index.tsx"},"Docs template")),(0,_react2.mdx)("td",{parentName:"tr",align:null},(0,_react2.mdx)("a",{parentName:"td",href:"/docs/dev-services/docs/docs-templates"},"Replace docs template"))),(0,_react2.mdx)("tr",{parentName:"tbody"},(0,_react2.mdx)("td",{parentName:"tr",align:null},(0,_react2.mdx)("a",{parentName:"td",href:"http://localhost:3000/docs/dev-services/builder/builder-overview"},"Builder")),(0,_react2.mdx)("td",{parentName:"tr",align:null},"-"),(0,_react2.mdx)("td",{parentName:"tr",align:null},(0,_react2.mdx)("a",{parentName:"td",href:"http://localhost:3000/docs/dev-services/builder/builder-overview"},"Build pipeline")),(0,_react2.mdx)("td",{parentName:"tr",align:null},(0,_react2.mdx)("a",{parentName:"td",href:"/dev-services/builder/build-pipelines"},"Build pipelines"))),(0,_react2.mdx)("tr",{parentName:"tbody"},(0,_react2.mdx)("td",{parentName:"tr",align:null},(0,_react2.mdx)("a",{parentName:"td",href:"/dependencies/dependencies-overview"},"Dependencies")),(0,_react2.mdx)("td",{parentName:"tr",align:null},"-"),(0,_react2.mdx)("td",{parentName:"tr",align:null},(0,_react2.mdx)("a",{parentName:"td",href:"https://bit.dev/teambit/react/react/~code/react.env.ts"},"Env-dependencies")),(0,_react2.mdx)("td",{parentName:"tr",align:null},(0,_react2.mdx)("a",{parentName:"td",href:"/dependencies/configuring-dependencies#configuring-dependencies-from-an-env"},"Env dependencies"))),(0,_react2.mdx)("tr",{parentName:"tbody"},(0,_react2.mdx)("td",{parentName:"tr",align:null},(0,_react2.mdx)("a",{parentName:"td",href:"/docs/dev-services/generator/generator-overview"},"Generator")),(0,_react2.mdx)("td",{parentName:"tr",align:null},"-"),(0,_react2.mdx)("td",{parentName:"tr",align:null},(0,_react2.mdx)("a",{parentName:"td",href:"https://bit.dev/teambit/react/react/~code/templates/react-component.ts"},"React templates")),(0,_react2.mdx)("td",{parentName:"tr",align:null},(0,_react2.mdx)("a",{parentName:"td",href:""},"Add a component template"))))),(0,_react2.mdx)("h3",null,"Default React versions"),(0,_react2.mdx)("p",null,"By default, the React env sets the following dependency versions for components using it:"),(0,_react2.mdx)("ul",null,(0,_react2.mdx)("li",{parentName:"ul"},(0,_react2.mdx)("strong",{parentName:"li"},"react")," (peer dependency): ",(0,_react2.mdx)("inlineCode",{parentName:"li"},"^16.8.0 || ^17.0.0")),(0,_react2.mdx)("li",{parentName:"ul"},(0,_react2.mdx)("strong",{parentName:"li"},"react-dom")," (peer dependency): ",(0,_react2.mdx)("inlineCode",{parentName:"li"},"^16.8.0 || ^17.0.0")),(0,_react2.mdx)("li",{parentName:"ul"},(0,_react2.mdx)("strong",{parentName:"li"},"@types/react"),": ",(0,_react2.mdx)("inlineCode",{parentName:"li"},"^17.0.8")),(0,_react2.mdx)("li",{parentName:"ul"},(0,_react2.mdx)("strong",{parentName:"li"},"@types/react-dom"),": ",(0,_react2.mdx)("inlineCode",{parentName:"li"},"^17.0.5")))))}MDXContent.__bit_component=__bit_component,MDXContent.isMDXComponent=!0},58635:(__unused_webpack_module,exports2,__webpack_require__2)=>{"use strict";var __bit_component={id:"teambit.react/react@0.0.731",homepage:"https://bit.dev/teambit/react/react",exported:!0},_interopRequireDefault=__webpack_require__2(88244);Object.defineProperty(exports2,"__esModule",{value:!0}),exports2.Logo=void 0;function _react(){const data=_interopRequireDefault(__webpack_require__2(63804));return _react=function(){return data},data}_react.__bit_component=__bit_component;const Logo=()=>_react().default.createElement("div",{style:{height:"100%",display:"flex",justifyContent:"center"}},_react().default.createElement("img",{style:{width:70},src:"https://static.bit.dev/extensions-icons/react.svg"}));Logo.__bit_component=__bit_component,exports2.Logo=Logo},85057:module2=>{"use strict";module2.exports=MdxJsReact},63804:module2=>{"use strict";module2.exports=React},58459:module2=>{"use strict";module2.exports=TeambitMdxUiMdxScopeContext}},__webpack_module_cache__={};function __webpack_require__(moduleId){var cachedModule=__webpack_module_cache__[moduleId];if(cachedModule!==void 0)return cachedModule.exports;var module2=__webpack_module_cache__[moduleId]={exports:{}};return __webpack_modules__[moduleId](module2,module2.exports,__webpack_require__),module2.exports}__webpack_require__.n=module2=>{var getter=module2&&module2.__esModule?()=>module2.default:()=>module2;return __webpack_require__.d(getter,{a:getter}),getter},__webpack_require__.d=(exports2,definition)=>{for(var key in definition)__webpack_require__.o(definition,key)&&!__webpack_require__.o(exports2,key)&&Object.defineProperty(exports2,key,{enumerable:!0,get:definition[key]})},__webpack_require__.o=(obj,prop)=>Object.prototype.hasOwnProperty.call(obj,prop),__webpack_require__.r=exports2=>{typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(exports2,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(exports2,"__esModule",{value:!0})};var __webpack_exports__={};return(()=>{"use strict";__webpack_require__.r(__webpack_exports__),__webpack_require__.d(__webpack_exports__,{compositions:()=>compositions,overview:()=>overview});const compositions=[__webpack_require__(58635)],overview=[__webpack_require__(23869)]})(),__webpack_exports__})()});
@@ -14,6 +14,7 @@ import { PrettierConfigTransformer, PrettierMain } from '@teambit/prettier';
14
14
  import { Linter, LinterContext } from '@teambit/linter';
15
15
  import { Formatter, FormatterContext } from '@teambit/formatter';
16
16
  import { SchemaExtractor } from '@teambit/schema';
17
+ import { Logger } from '@teambit/logger';
17
18
  import { ReactMainConfig } from './react.main.runtime';
18
19
  export declare const ReactEnvType = "react";
19
20
  declare type CompilerMode = 'build' | 'dev';
@@ -55,6 +56,7 @@ export declare class ReactEnv implements TesterEnv, CompilerEnv, LinterEnv, DevE
55
56
  private config;
56
57
  private eslint;
57
58
  private prettier;
59
+ private logger;
58
60
  private compilerAspectId;
59
61
  constructor(
60
62
  /**
@@ -84,7 +86,7 @@ export declare class ReactEnv implements TesterEnv, CompilerEnv, LinterEnv, DevE
84
86
  /**
85
87
  * tester extension
86
88
  */
87
- tester: TesterMain, config: ReactMainConfig, eslint: ESLintMain, prettier: PrettierMain, compilerAspectId: string);
89
+ tester: TesterMain, config: ReactMainConfig, eslint: ESLintMain, prettier: PrettierMain, logger: Logger, compilerAspectId: string);
88
90
  getTsConfig(targetTsConfig?: TsConfigSourceFile): TsConfigSourceFile;
89
91
  getBuildTsConfig(targetTsConfig?: TsConfigSourceFile): TsConfigSourceFile;
90
92
  /**
package/dist/react.env.js CHANGED
@@ -223,7 +223,7 @@ class ReactEnv {
223
223
  /**
224
224
  * tester extension
225
225
  */
226
- tester, config, eslint, prettier, compilerAspectId) {
226
+ tester, config, eslint, prettier, logger, compilerAspectId) {
227
227
  this.jestAspect = jestAspect;
228
228
  this.tsAspect = tsAspect;
229
229
  this.compiler = compiler;
@@ -234,6 +234,7 @@ class ReactEnv {
234
234
  this.config = config;
235
235
  this.eslint = eslint;
236
236
  this.prettier = prettier;
237
+ this.logger = logger;
237
238
  this.compilerAspectId = compilerAspectId;
238
239
  (0, _defineProperty2().default)(this, "icon", 'https://static.bit.dev/extensions-icons/react.svg');
239
240
  }
@@ -402,7 +403,7 @@ class ReactEnv {
402
403
  const envDevConfig = (0, _webpackConfigEnv().default)(context.id);
403
404
  const componentDevConfig = (0, _webpackConfigComponent2().default)(this.workspace.path, context.id);
404
405
  const peers = this.getAllHostDependencies();
405
- const peerAliasesTransformer = (0, _transformers().generateAddAliasesFromPeersTransformer)(peers);
406
+ const peerAliasesTransformer = (0, _transformers().generateAddAliasesFromPeersTransformer)(peers, this.logger);
406
407
 
407
408
  const defaultTransformer = configMutator => {
408
409
  const merged = configMutator.merge([baseConfig, envDevConfig, componentDevConfig]);
@@ -418,7 +419,7 @@ class ReactEnv {
418
419
 
419
420
  async createComponentsWebpackBundler(context, transformers = []) {
420
421
  const peers = this.getAllHostDependencies();
421
- const peerAliasesTransformer = (0, _transformers().generateAddAliasesFromPeersTransformer)(peers);
422
+ const peerAliasesTransformer = (0, _transformers().generateAddAliasesFromPeersTransformer)(peers, this.logger);
422
423
  const baseConfig = (0, _webpackConfig().default)(!context.development);
423
424
  const baseProdConfig = (0, _webpackConfigBase().default)(Boolean(context.externalizePeer), peers, context.development);
424
425
  const componentProdConfig = (0, _webpackConfigComponent().default)();
@@ -434,7 +435,7 @@ class ReactEnv {
434
435
 
435
436
  async createTemplateWebpackBundler(context, transformers = []) {
436
437
  const peers = this.getAllHostDependencies();
437
- const peerAliasesTransformer = (0, _transformers().generateAddAliasesFromPeersTransformer)(peers);
438
+ const peerAliasesTransformer = (0, _transformers().generateAddAliasesFromPeersTransformer)(peers, this.logger);
438
439
  const baseConfig = (0, _webpackConfig().default)(!context.development);
439
440
  const baseProdConfig = (0, _webpackConfigBase().default)(Boolean(context.externalizePeer), peers, context.development);
440
441
 
@@ -1 +1 @@
1
- {"version":3,"sources":["react.env.ts"],"names":["ReactEnvType","defaultTsConfig","require","buildTsConfig","eslintConfig","prettierConfig","ReactEnv","constructor","jestAspect","tsAspect","compiler","webpack","workspace","pkg","tester","config","eslint","prettier","compilerAspectId","getTsConfig","targetTsConfig","getBuildTsConfig","getCjsJestTester","jestConfigPath","jestModulePath","pathToSource","__dirname","replace","defaultConfig","createTester","resolve","getEsmJestTester","getTester","getTsCompilerOptions","mode","tsconfig","compileJs","compileJsx","types","getTsCjsCompiler","transformers","tsModule","ts","tsCompileOptions","createCjsCompiler","getTsEsmCompiler","createEsmCompiler","getCompiler","getLinter","context","defaultTransformer","configMutator","addExtensionTypes","allTransformers","createLinter","pluginPath","getFormatter","createFormatter","getFileMap","components","local","reduce","index","component","state","filesystem","files","forEach","file","path","id","toString","homepage","fullName","ComponentUrl","toUrl","writeFileMap","fileMap","Math","random","slice","JSON","stringify","getDevEnvId","ReactAspect","getSchemaExtractor","createSchemaExtractor","getDevServer","baseConfig","envDevConfig","componentDevConfig","peers","getAllHostDependencies","peerAliasesTransformer","merged","merge","createDevServer","getBundler","createComponentsWebpackBundler","development","baseProdConfig","Boolean","externalizePeer","componentProdConfig","mergedTransformers","createWebpackBundler","createTemplateWebpackBundler","createBundler","envComponentPeers","Object","keys","getDependencies","peerDependencies","additionalHostDeps","getAdditionalHostDependencies","concat","getDocsTemplate","getMounter","getPreviewConfig","strategyName","splitComponentBundle","getPackageJsonProps","getCjsPackageJsonProps","getEsmPackageJsonProps","getNpmIgnore","CAPSULE_ARTIFACTS_DIR","dependencies","react","devDependencies","getBuildPipe","modifiers","tsModifier","getCompilerTask","module","task","getBuildPipeWithoutCompiler","pipeWithoutCompiler","filter","aspectId","getEsmCompilerTask","tsCompiler","createTask","getCjsCompilerTask","__getDescriptor","type"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAEA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AA0BA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAGA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAKA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAGA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAIA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAGA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;A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AAsCC,QAAtC,CAAP;AACD;;AAEoB,QAAfsG,eAAe,GAAG;AACtB,WAAO;AACLC,MAAAA,IAAI,EAAEhJ;AADD,KAAP;AAGD;;AA9ZH","sourcesContent":["import ts, { TsConfigSourceFile } from 'typescript';\nimport { tmpdir } from 'os';\nimport { Component } from '@teambit/component';\nimport { ComponentUrl } from '@teambit/component.modules.component-url';\nimport { BuildTask, CAPSULE_ARTIFACTS_DIR } from '@teambit/builder';\nimport { merge, cloneDeep } from 'lodash';\nimport { Bundler, BundlerContext, DevServer, DevServerContext } from '@teambit/bundler';\nimport { CompilerMain } from '@teambit/compiler';\nimport {\n BuilderEnv,\n CompilerEnv,\n DependenciesEnv,\n DevEnv,\n LinterEnv,\n PackageEnv,\n TesterEnv,\n FormatterEnv,\n PipeServiceModifier,\n PipeServiceModifiersMap,\n} from '@teambit/envs';\nimport { JestMain } from '@teambit/jest';\nimport { PackageJsonProps, PkgMain } from '@teambit/pkg';\nimport { Tester, TesterMain } from '@teambit/tester';\nimport { TsConfigTransformer, TypescriptMain } from '@teambit/typescript';\nimport type { TypeScriptCompilerOptions } from '@teambit/typescript';\nimport { WebpackConfigTransformer, WebpackMain } from '@teambit/webpack';\nimport { Workspace } from '@teambit/workspace';\nimport { ESLintMain, EslintConfigTransformer } from '@teambit/eslint';\nimport { PrettierConfigTransformer, PrettierMain } from '@teambit/prettier';\nimport { Linter, LinterContext } from '@teambit/linter';\nimport { Formatter, FormatterContext } from '@teambit/formatter';\nimport { pathNormalizeToLinux } from '@teambit/legacy/dist/utils';\nimport type { ComponentMeta } from '@teambit/react.ui.highlighter.component-metadata.bit-component-meta';\nimport { SchemaExtractor } from '@teambit/schema';\nimport { join, resolve } from 'path';\nimport { outputFileSync } from 'fs-extra';\n// Makes sure the @teambit/react.ui.docs-app is a dependency\n// TODO: remove this import once we can set policy from component to component with workspace version. Then set it via the component.json\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nimport { ReactMainConfig } from './react.main.runtime';\nimport { ReactAspect } from './react.aspect';\n\n// webpack configs for both components and envs\nimport basePreviewConfigFactory from './webpack/webpack.config.base';\nimport basePreviewProdConfigFactory from './webpack/webpack.config.base.prod';\n\n// webpack configs for envs only\n// import devPreviewConfigFactory from './webpack/webpack.config.preview.dev';\nimport envPreviewDevConfigFactory from './webpack/webpack.config.env.dev';\n\n// webpack configs for components only\nimport componentPreviewProdConfigFactory from './webpack/webpack.config.component.prod';\nimport componentPreviewDevConfigFactory from './webpack/webpack.config.component.dev';\nimport { generateAddAliasesFromPeersTransformer } from './webpack/transformers';\n\nexport const ReactEnvType = 'react';\nconst defaultTsConfig = require('./typescript/tsconfig.json');\nconst buildTsConfig = require('./typescript/tsconfig.build.json');\nconst eslintConfig = require('./eslint/eslintrc');\nconst prettierConfig = require('./prettier/prettier.config.js');\n\n// TODO: move to be taken from the key mode of compiler context\ntype CompilerMode = 'build' | 'dev';\n\ntype GetBuildPipeModifiers = PipeServiceModifiersMap & {\n tsModifier?: PipeServiceModifier;\n};\n\n/**\n * a component environment built for [React](https://reactjs.org) .\n */\nexport class ReactEnv\n implements TesterEnv, CompilerEnv, LinterEnv, DevEnv, BuilderEnv, DependenciesEnv, PackageEnv, FormatterEnv\n{\n constructor(\n /**\n * jest extension\n */\n private jestAspect: JestMain,\n\n /**\n * typescript extension.\n */\n protected tsAspect: TypescriptMain,\n\n /**\n * compiler extension.\n */\n private compiler: CompilerMain,\n\n /**\n * webpack extension.\n */\n private webpack: WebpackMain,\n\n /**\n * workspace extension.\n */\n private workspace: Workspace,\n\n /**\n * pkg extension.\n */\n private pkg: PkgMain,\n\n /**\n * tester extension\n */\n private tester: TesterMain,\n\n private config: ReactMainConfig,\n\n private eslint: ESLintMain,\n\n private prettier: PrettierMain,\n\n private compilerAspectId: string\n ) {}\n\n getTsConfig(targetTsConfig?: TsConfigSourceFile): TsConfigSourceFile {\n return targetTsConfig ? merge({}, defaultTsConfig, targetTsConfig) : defaultTsConfig;\n }\n\n getBuildTsConfig(targetTsConfig?: TsConfigSourceFile): TsConfigSourceFile {\n return targetTsConfig ? merge({}, buildTsConfig, targetTsConfig) : buildTsConfig;\n }\n\n /**\n * Get a jest tester instance with react config and cjs configs\n * @param jestConfigPath\n * @param jestModulePath\n * @returns\n */\n getCjsJestTester(jestConfigPath?: string, jestModulePath?: string): Tester {\n const pathToSource = pathNormalizeToLinux(__dirname).replace('/dist', '');\n const defaultConfig = join(pathToSource, './jest/jest.cjs.config.js');\n const config = jestConfigPath || defaultConfig;\n return this.jestAspect.createTester(config, jestModulePath || require.resolve('jest'));\n }\n\n /**\n * Get a jest tester instance with react config and esm configs\n * @param jestConfigPath\n * @param jestModulePath\n * @returns\n */\n getEsmJestTester(jestConfigPath?: string, jestModulePath?: string): Tester {\n const pathToSource = pathNormalizeToLinux(__dirname).replace('/dist', '');\n const defaultConfig = join(pathToSource, './jest/jest.esm.config.js');\n const config = jestConfigPath || defaultConfig;\n return this.jestAspect.createTester(config, jestModulePath || require.resolve('jest'));\n }\n\n /**\n * returns a component tester.\n */\n getTester(jestConfigPath: string, jestModulePath?: string): Tester {\n // return this.getEsmJestTester(jestConfigPath, jestModulePath);\n return this.getCjsJestTester(jestConfigPath, jestModulePath);\n }\n\n private getTsCompilerOptions(mode: CompilerMode = 'dev'): TypeScriptCompilerOptions {\n const tsconfig = mode === 'dev' ? cloneDeep(defaultTsConfig) : cloneDeep(buildTsConfig);\n const pathToSource = pathNormalizeToLinux(__dirname).replace('/dist/', '/src/');\n const compileJs = true;\n const compileJsx = true;\n return {\n tsconfig,\n // TODO: @david please remove this line and refactor to be something that makes sense.\n types: [resolve(pathToSource, './typescript/style.d.ts'), resolve(pathToSource, './typescript/asset.d.ts')],\n compileJs,\n compileJsx,\n };\n }\n\n /**\n * Get a compiler instance with react config and set it to cjs module\n * @param mode\n * @param transformers\n * @param tsModule\n * @returns\n */\n getTsCjsCompiler(mode: CompilerMode = 'dev', transformers: TsConfigTransformer[] = [], tsModule = ts) {\n const tsCompileOptions = this.getTsCompilerOptions(mode);\n return this.tsAspect.createCjsCompiler(tsCompileOptions, transformers, tsModule);\n }\n\n /**\n * Get a compiler instance with react config and set it to esm module\n * @param mode\n * @param transformers\n * @param tsModule\n * @returns\n */\n getTsEsmCompiler(mode: CompilerMode = 'dev', transformers: TsConfigTransformer[] = [], tsModule = ts) {\n const tsCompileOptions = this.getTsCompilerOptions(mode);\n return this.tsAspect.createEsmCompiler(tsCompileOptions, transformers, tsModule);\n }\n\n getCompiler(transformers: TsConfigTransformer[] = [], tsModule = ts) {\n // return this.getTsEsmCompiler('dev', transformers, tsModule);\n return this.getTsCjsCompiler('dev', transformers, tsModule);\n }\n\n /**\n * returns and configures the component linter.\n */\n getLinter(context: LinterContext, transformers: EslintConfigTransformer[] = []): Linter {\n const defaultTransformer: EslintConfigTransformer = (configMutator) => {\n configMutator.addExtensionTypes(['.md', '.mdx']);\n return configMutator;\n };\n\n const allTransformers = [defaultTransformer, ...transformers];\n\n return this.eslint.createLinter(\n context,\n {\n config: eslintConfig,\n // resolve all plugins from the react environment.\n pluginPath: __dirname,\n },\n allTransformers\n );\n }\n\n /**\n * returns and configures the component formatter.\n */\n getFormatter(context: FormatterContext, transformers: PrettierConfigTransformer[] = []): Formatter {\n return this.prettier.createFormatter(\n context,\n {\n config: prettierConfig,\n },\n transformers\n );\n }\n\n private getFileMap(components: Component[], local = false) {\n return components.reduce<{ [key: string]: ComponentMeta }>((index, component: Component) => {\n component.state.filesystem.files.forEach((file) => {\n index[file.path] = {\n id: component.id.toString(),\n homepage: local ? `/${component.id.fullName}` : ComponentUrl.toUrl(component.id),\n };\n });\n\n return index;\n }, {});\n }\n\n private writeFileMap(components: Component[], local?: boolean) {\n const fileMap = this.getFileMap(components, local);\n const path = join(tmpdir(), `${Math.random().toString(36).slice(2, 11)}.json`);\n outputFileSync(path, JSON.stringify(fileMap));\n return path;\n }\n\n /**\n * required for `bit start`\n */\n getDevEnvId(id?: string) {\n if (typeof id !== 'string') return ReactAspect.id;\n return id || ReactAspect.id;\n }\n\n /**\n * get a schema generator instance configured with the correct tsconfig.\n */\n getSchemaExtractor(tsconfig: TsConfigSourceFile): SchemaExtractor {\n return this.tsAspect.createSchemaExtractor(this.getTsConfig(tsconfig));\n }\n\n /**\n * returns and configures the React component dev server.\n * required for `bit start`\n */\n getDevServer(context: DevServerContext, transformers: WebpackConfigTransformer[] = []): DevServer {\n const baseConfig = basePreviewConfigFactory(false);\n const envDevConfig = envPreviewDevConfigFactory(context.id);\n const componentDevConfig = componentPreviewDevConfigFactory(this.workspace.path, context.id);\n const peers = this.getAllHostDependencies();\n const peerAliasesTransformer = generateAddAliasesFromPeersTransformer(peers);\n\n const defaultTransformer: WebpackConfigTransformer = (configMutator) => {\n const merged = configMutator.merge([baseConfig, envDevConfig, componentDevConfig]);\n return merged;\n };\n\n return this.webpack.createDevServer(context, [defaultTransformer, peerAliasesTransformer, ...transformers]);\n }\n\n async getBundler(context: BundlerContext, transformers: WebpackConfigTransformer[] = []): Promise<Bundler> {\n return this.createComponentsWebpackBundler(context, transformers);\n }\n\n async createComponentsWebpackBundler(\n context: BundlerContext,\n transformers: WebpackConfigTransformer[] = []\n ): Promise<Bundler> {\n const peers = this.getAllHostDependencies();\n const peerAliasesTransformer = generateAddAliasesFromPeersTransformer(peers);\n const baseConfig = basePreviewConfigFactory(!context.development);\n const baseProdConfig = basePreviewProdConfigFactory(Boolean(context.externalizePeer), peers, context.development);\n const componentProdConfig = componentPreviewProdConfigFactory();\n\n const defaultTransformer: WebpackConfigTransformer = (configMutator) => {\n const merged = configMutator.merge([baseConfig, baseProdConfig, componentProdConfig]);\n return merged;\n };\n const mergedTransformers = [defaultTransformer, peerAliasesTransformer, ...transformers];\n return this.createWebpackBundler(context, mergedTransformers);\n }\n\n async createTemplateWebpackBundler(\n context: BundlerContext,\n transformers: WebpackConfigTransformer[] = []\n ): Promise<Bundler> {\n const peers = this.getAllHostDependencies();\n const peerAliasesTransformer = generateAddAliasesFromPeersTransformer(peers);\n const baseConfig = basePreviewConfigFactory(!context.development);\n const baseProdConfig = basePreviewProdConfigFactory(Boolean(context.externalizePeer), peers, context.development);\n\n const defaultTransformer: WebpackConfigTransformer = (configMutator) => {\n const merged = configMutator.merge([baseConfig, baseProdConfig]);\n return merged;\n };\n const mergedTransformers = [defaultTransformer, peerAliasesTransformer, ...transformers];\n return this.createWebpackBundler(context, mergedTransformers);\n }\n\n private async createWebpackBundler(\n context: BundlerContext,\n transformers: WebpackConfigTransformer[] = []\n ): Promise<Bundler> {\n return this.webpack.createBundler(context, transformers);\n }\n\n /**\n * Get the peers configured by the env on the components + the host deps configured by the env\n */\n getAllHostDependencies() {\n const envComponentPeers = Object.keys(this.getDependencies().peerDependencies || {}) || [];\n const additionalHostDeps = this.getAdditionalHostDependencies() || [];\n const peers = envComponentPeers.concat(additionalHostDeps);\n return peers;\n }\n\n getAdditionalHostDependencies(): string[] {\n return ['@teambit/mdx.ui.mdx-scope-context', '@mdx-js/react'];\n }\n\n /**\n * returns a path to a docs template.\n */\n getDocsTemplate() {\n return require.resolve('@teambit/react.ui.docs-app');\n }\n\n icon = 'https://static.bit.dev/extensions-icons/react.svg';\n\n /**\n * returns a paths to a function which mounts a given component to DOM\n */\n getMounter() {\n return require.resolve('./mount');\n }\n\n getPreviewConfig() {\n return {\n strategyName: 'component',\n splitComponentBundle: true,\n };\n }\n\n /**\n * define the package json properties to add to each component.\n */\n getPackageJsonProps(): PackageJsonProps {\n // React compile by default to esm, so uses type module\n // return this.getEsmPackageJsonProps();\n return this.getCjsPackageJsonProps();\n }\n\n /**\n * Get the default package.json props for a cjs component\n * @returns\n */\n getCjsPackageJsonProps(): PackageJsonProps {\n return this.tsAspect.getCjsPackageJsonProps();\n }\n\n /**\n * Get the default package.json props for an esm component\n * @returns\n */\n getEsmPackageJsonProps(): PackageJsonProps {\n return this.tsAspect.getEsmPackageJsonProps();\n }\n\n getNpmIgnore() {\n // ignores only .ts files in the root directory, so d.ts files inside dists are unaffected.\n // without this change, the package has \"index.ts\" file in the root, causing typescript to parse it instead of the\n // d.ts files. (changing the \"types\" prop in the package.json file doesn't help).\n return [`${CAPSULE_ARTIFACTS_DIR}/`];\n }\n\n /**\n * adds dependencies to all configured components.\n */\n getDependencies() {\n return {\n dependencies: {\n react: '-',\n 'react-dom': '-',\n 'core-js': '^3.0.0',\n },\n // TODO: add this only if using ts\n devDependencies: {\n react: '-',\n 'react-dom': '-',\n '@types/mocha': '-',\n '@types/node': '12.20.4',\n '@types/react': '^17.0.8',\n '@types/react-dom': '^17.0.5',\n '@types/jest': '^26.0.0',\n // This is added as dev dep since our jest file transformer uses babel plugins that require this to be installed\n '@babel/runtime': '7.12.18',\n '@types/testing-library__jest-dom': '5.9.5',\n },\n peerDependencies: {\n react: '^16.8.0 || ^17.0.0',\n 'react-dom': '^16.8.0 || ^17.0.0',\n },\n };\n }\n\n /**\n * returns the component build pipeline.\n */\n getBuildPipe(modifiers: GetBuildPipeModifiers = {}): BuildTask[] {\n const transformers: TsConfigTransformer[] =\n (modifiers?.tsModifier?.transformers as any as TsConfigTransformer[]) || [];\n return [this.getCompilerTask(transformers, modifiers?.tsModifier?.module || ts), this.tester.task];\n }\n\n /**\n * Get the react build pipeline without the compilation task.\n * This help in cases you want to only replace the compilation task with something else\n * @returns\n */\n getBuildPipeWithoutCompiler(): BuildTask[] {\n const pipeWithoutCompiler = this.getBuildPipe().filter((task) => task.aspectId !== this.compilerAspectId);\n return pipeWithoutCompiler;\n }\n\n /**\n * Get a compiler task with react config and set to esm module\n * @param transformers\n * @param tsModule\n * @returns\n */\n getEsmCompilerTask(transformers: TsConfigTransformer[] = [], tsModule = ts) {\n const tsCompiler = this.getTsEsmCompiler('build', transformers, tsModule);\n return this.compiler.createTask('TSCompiler', tsCompiler);\n }\n\n /**\n * Get a compiler task with react config and set to cjs module\n * @param transformers\n * @param tsModule\n * @returns\n */\n getCjsCompilerTask(transformers: TsConfigTransformer[] = [], tsModule = ts) {\n const tsCompiler = this.getTsCjsCompiler('build', transformers, tsModule);\n return this.compiler.createTask('TSCompiler', tsCompiler);\n }\n\n private getCompilerTask(transformers: TsConfigTransformer[] = [], tsModule = ts) {\n return this.getCjsCompilerTask(transformers, tsModule);\n }\n\n async __getDescriptor() {\n return {\n type: ReactEnvType,\n };\n }\n}\n"]}
1
+ {"version":3,"sources":["react.env.ts"],"names":["ReactEnvType","defaultTsConfig","require","buildTsConfig","eslintConfig","prettierConfig","ReactEnv","constructor","jestAspect","tsAspect","compiler","webpack","workspace","pkg","tester","config","eslint","prettier","logger","compilerAspectId","getTsConfig","targetTsConfig","getBuildTsConfig","getCjsJestTester","jestConfigPath","jestModulePath","pathToSource","__dirname","replace","defaultConfig","createTester","resolve","getEsmJestTester","getTester","getTsCompilerOptions","mode","tsconfig","compileJs","compileJsx","types","getTsCjsCompiler","transformers","tsModule","ts","tsCompileOptions","createCjsCompiler","getTsEsmCompiler","createEsmCompiler","getCompiler","getLinter","context","defaultTransformer","configMutator","addExtensionTypes","allTransformers","createLinter","pluginPath","getFormatter","createFormatter","getFileMap","components","local","reduce","index","component","state","filesystem","files","forEach","file","path","id","toString","homepage","fullName","ComponentUrl","toUrl","writeFileMap","fileMap","Math","random","slice","JSON","stringify","getDevEnvId","ReactAspect","getSchemaExtractor","createSchemaExtractor","getDevServer","baseConfig","envDevConfig","componentDevConfig","peers","getAllHostDependencies","peerAliasesTransformer","merged","merge","createDevServer","getBundler","createComponentsWebpackBundler","development","baseProdConfig","Boolean","externalizePeer","componentProdConfig","mergedTransformers","createWebpackBundler","createTemplateWebpackBundler","createBundler","envComponentPeers","Object","keys","getDependencies","peerDependencies","additionalHostDeps","getAdditionalHostDependencies","concat","getDocsTemplate","getMounter","getPreviewConfig","strategyName","splitComponentBundle","getPackageJsonProps","getCjsPackageJsonProps","getEsmPackageJsonProps","getNpmIgnore","CAPSULE_ARTIFACTS_DIR","dependencies","react","devDependencies","getBuildPipe","modifiers","tsModifier","getCompilerTask","module","task","getBuildPipeWithoutCompiler","pipeWithoutCompiler","filter","aspectId","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,IAAD,IAAUA,IAAI,CAACI,QAAL,KAAkB,KAAKxH,gBAA5D,CAA5B;AACA,WAAOsH,mBAAP;AACD;AAED;AACF;AACA;AACA;AACA;AACA;;;AACEG,EAAAA,kBAAkB,CAACnG,YAAmC,GAAG,EAAvC,EAA2CC,QAAQ,GAAGC,qBAAtD,EAA0D;AAC1E,UAAMkG,UAAU,GAAG,KAAK/F,gBAAL,CAAsB,OAAtB,EAA+BL,YAA/B,EAA6CC,QAA7C,CAAnB;AACA,WAAO,KAAKhC,QAAL,CAAcoI,UAAd,CAAyB,YAAzB,EAAuCD,UAAvC,CAAP;AACD;AAED;AACF;AACA;AACA;AACA;AACA;;;AACEE,EAAAA,kBAAkB,CAACtG,YAAmC,GAAG,EAAvC,EAA2CC,QAAQ,GAAGC,qBAAtD,EAA0D;AAC1E,UAAMkG,UAAU,GAAG,KAAKrG,gBAAL,CAAsB,OAAtB,EAA+BC,YAA/B,EAA6CC,QAA7C,CAAnB;AACA,WAAO,KAAKhC,QAAL,CAAcoI,UAAd,CAAyB,YAAzB,EAAuCD,UAAvC,CAAP;AACD;;AAEOR,EAAAA,eAAe,CAAC5F,YAAmC,GAAG,EAAvC,EAA2CC,QAAQ,GAAGC,qBAAtD,EAA0D;AAC/E,WAAO,KAAKoG,kBAAL,CAAwBtG,YAAxB,EAAsCC,QAAtC,CAAP;AACD;;AAEoB,QAAfsG,eAAe,GAAG;AACtB,WAAO;AACLC,MAAAA,IAAI,EAAEjJ;AADD,KAAP;AAGD;;AAhaH","sourcesContent":["import ts, { TsConfigSourceFile } from 'typescript';\nimport { tmpdir } from 'os';\nimport { Component } from '@teambit/component';\nimport { ComponentUrl } from '@teambit/component.modules.component-url';\nimport { BuildTask, CAPSULE_ARTIFACTS_DIR } from '@teambit/builder';\nimport { merge, cloneDeep } from 'lodash';\nimport { Bundler, BundlerContext, DevServer, DevServerContext } from '@teambit/bundler';\nimport { CompilerMain } from '@teambit/compiler';\nimport {\n BuilderEnv,\n CompilerEnv,\n DependenciesEnv,\n DevEnv,\n LinterEnv,\n PackageEnv,\n TesterEnv,\n FormatterEnv,\n PipeServiceModifier,\n PipeServiceModifiersMap,\n} from '@teambit/envs';\nimport { JestMain } from '@teambit/jest';\nimport { PackageJsonProps, PkgMain } from '@teambit/pkg';\nimport { Tester, TesterMain } from '@teambit/tester';\nimport { TsConfigTransformer, TypescriptMain } from '@teambit/typescript';\nimport type { TypeScriptCompilerOptions } from '@teambit/typescript';\nimport { WebpackConfigTransformer, WebpackMain } from '@teambit/webpack';\nimport { Workspace } from '@teambit/workspace';\nimport { ESLintMain, EslintConfigTransformer } from '@teambit/eslint';\nimport { PrettierConfigTransformer, PrettierMain } from '@teambit/prettier';\nimport { Linter, LinterContext } from '@teambit/linter';\nimport { Formatter, FormatterContext } from '@teambit/formatter';\nimport { pathNormalizeToLinux } from '@teambit/legacy/dist/utils';\nimport type { ComponentMeta } from '@teambit/react.ui.highlighter.component-metadata.bit-component-meta';\nimport { SchemaExtractor } from '@teambit/schema';\nimport { join, resolve } from 'path';\nimport { outputFileSync } from 'fs-extra';\nimport { Logger } from '@teambit/logger';\n// Makes sure the @teambit/react.ui.docs-app is a dependency\n// TODO: remove this import once we can set policy from component to component with workspace version. Then set it via the component.json\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nimport { ReactMainConfig } from './react.main.runtime';\nimport { ReactAspect } from './react.aspect';\n// webpack configs for both components and envs\nimport basePreviewConfigFactory from './webpack/webpack.config.base';\nimport basePreviewProdConfigFactory from './webpack/webpack.config.base.prod';\n\n// webpack configs for envs only\n// import devPreviewConfigFactory from './webpack/webpack.config.preview.dev';\nimport envPreviewDevConfigFactory from './webpack/webpack.config.env.dev';\n\n// webpack configs for components only\nimport componentPreviewProdConfigFactory from './webpack/webpack.config.component.prod';\nimport componentPreviewDevConfigFactory from './webpack/webpack.config.component.dev';\nimport { generateAddAliasesFromPeersTransformer } from './webpack/transformers';\n\nexport const ReactEnvType = 'react';\nconst defaultTsConfig = require('./typescript/tsconfig.json');\nconst buildTsConfig = require('./typescript/tsconfig.build.json');\nconst eslintConfig = require('./eslint/eslintrc');\nconst prettierConfig = require('./prettier/prettier.config.js');\n\n// TODO: move to be taken from the key mode of compiler context\ntype CompilerMode = 'build' | 'dev';\n\ntype GetBuildPipeModifiers = PipeServiceModifiersMap & {\n tsModifier?: PipeServiceModifier;\n};\n\n/**\n * a component environment built for [React](https://reactjs.org) .\n */\nexport class ReactEnv\n implements TesterEnv, CompilerEnv, LinterEnv, DevEnv, BuilderEnv, DependenciesEnv, PackageEnv, FormatterEnv\n{\n constructor(\n /**\n * jest extension\n */\n private jestAspect: JestMain,\n\n /**\n * typescript extension.\n */\n protected tsAspect: TypescriptMain,\n\n /**\n * compiler extension.\n */\n private compiler: CompilerMain,\n\n /**\n * webpack extension.\n */\n private webpack: WebpackMain,\n\n /**\n * workspace extension.\n */\n private workspace: Workspace,\n\n /**\n * pkg extension.\n */\n private pkg: PkgMain,\n\n /**\n * tester extension\n */\n private tester: TesterMain,\n\n private config: ReactMainConfig,\n\n private eslint: ESLintMain,\n\n private prettier: PrettierMain,\n\n private logger: Logger,\n\n private compilerAspectId: string\n ) {}\n\n getTsConfig(targetTsConfig?: TsConfigSourceFile): TsConfigSourceFile {\n return targetTsConfig ? merge({}, defaultTsConfig, targetTsConfig) : defaultTsConfig;\n }\n\n getBuildTsConfig(targetTsConfig?: TsConfigSourceFile): TsConfigSourceFile {\n return targetTsConfig ? merge({}, buildTsConfig, targetTsConfig) : buildTsConfig;\n }\n\n /**\n * Get a jest tester instance with react config and cjs configs\n * @param jestConfigPath\n * @param jestModulePath\n * @returns\n */\n getCjsJestTester(jestConfigPath?: string, jestModulePath?: string): Tester {\n const pathToSource = pathNormalizeToLinux(__dirname).replace('/dist', '');\n const defaultConfig = join(pathToSource, './jest/jest.cjs.config.js');\n const config = jestConfigPath || defaultConfig;\n return this.jestAspect.createTester(config, jestModulePath || require.resolve('jest'));\n }\n\n /**\n * Get a jest tester instance with react config and esm configs\n * @param jestConfigPath\n * @param jestModulePath\n * @returns\n */\n getEsmJestTester(jestConfigPath?: string, jestModulePath?: string): Tester {\n const pathToSource = pathNormalizeToLinux(__dirname).replace('/dist', '');\n const defaultConfig = join(pathToSource, './jest/jest.esm.config.js');\n const config = jestConfigPath || defaultConfig;\n return this.jestAspect.createTester(config, jestModulePath || require.resolve('jest'));\n }\n\n /**\n * returns a component tester.\n */\n getTester(jestConfigPath: string, jestModulePath?: string): Tester {\n // return this.getEsmJestTester(jestConfigPath, jestModulePath);\n return this.getCjsJestTester(jestConfigPath, jestModulePath);\n }\n\n private getTsCompilerOptions(mode: CompilerMode = 'dev'): TypeScriptCompilerOptions {\n const tsconfig = mode === 'dev' ? cloneDeep(defaultTsConfig) : cloneDeep(buildTsConfig);\n const pathToSource = pathNormalizeToLinux(__dirname).replace('/dist/', '/src/');\n const compileJs = true;\n const compileJsx = true;\n return {\n tsconfig,\n // TODO: @david please remove this line and refactor to be something that makes sense.\n types: [resolve(pathToSource, './typescript/style.d.ts'), resolve(pathToSource, './typescript/asset.d.ts')],\n compileJs,\n compileJsx,\n };\n }\n\n /**\n * Get a compiler instance with react config and set it to cjs module\n * @param mode\n * @param transformers\n * @param tsModule\n * @returns\n */\n getTsCjsCompiler(mode: CompilerMode = 'dev', transformers: TsConfigTransformer[] = [], tsModule = ts) {\n const tsCompileOptions = this.getTsCompilerOptions(mode);\n return this.tsAspect.createCjsCompiler(tsCompileOptions, transformers, tsModule);\n }\n\n /**\n * Get a compiler instance with react config and set it to esm module\n * @param mode\n * @param transformers\n * @param tsModule\n * @returns\n */\n getTsEsmCompiler(mode: CompilerMode = 'dev', transformers: TsConfigTransformer[] = [], tsModule = ts) {\n const tsCompileOptions = this.getTsCompilerOptions(mode);\n return this.tsAspect.createEsmCompiler(tsCompileOptions, transformers, tsModule);\n }\n\n getCompiler(transformers: TsConfigTransformer[] = [], tsModule = ts) {\n // return this.getTsEsmCompiler('dev', transformers, tsModule);\n return this.getTsCjsCompiler('dev', transformers, tsModule);\n }\n\n /**\n * returns and configures the component linter.\n */\n getLinter(context: LinterContext, transformers: EslintConfigTransformer[] = []): Linter {\n const defaultTransformer: EslintConfigTransformer = (configMutator) => {\n configMutator.addExtensionTypes(['.md', '.mdx']);\n return configMutator;\n };\n\n const allTransformers = [defaultTransformer, ...transformers];\n\n return this.eslint.createLinter(\n context,\n {\n config: eslintConfig,\n // resolve all plugins from the react environment.\n pluginPath: __dirname,\n },\n allTransformers\n );\n }\n\n /**\n * returns and configures the component formatter.\n */\n getFormatter(context: FormatterContext, transformers: PrettierConfigTransformer[] = []): Formatter {\n return this.prettier.createFormatter(\n context,\n {\n config: prettierConfig,\n },\n transformers\n );\n }\n\n private getFileMap(components: Component[], local = false) {\n return components.reduce<{ [key: string]: ComponentMeta }>((index, component: Component) => {\n component.state.filesystem.files.forEach((file) => {\n index[file.path] = {\n id: component.id.toString(),\n homepage: local ? `/${component.id.fullName}` : ComponentUrl.toUrl(component.id),\n };\n });\n\n return index;\n }, {});\n }\n\n private writeFileMap(components: Component[], local?: boolean) {\n const fileMap = this.getFileMap(components, local);\n const path = join(tmpdir(), `${Math.random().toString(36).slice(2, 11)}.json`);\n outputFileSync(path, JSON.stringify(fileMap));\n return path;\n }\n\n /**\n * required for `bit start`\n */\n getDevEnvId(id?: string) {\n if (typeof id !== 'string') return ReactAspect.id;\n return id || ReactAspect.id;\n }\n\n /**\n * get a schema generator instance configured with the correct tsconfig.\n */\n getSchemaExtractor(tsconfig: TsConfigSourceFile): SchemaExtractor {\n return this.tsAspect.createSchemaExtractor(this.getTsConfig(tsconfig));\n }\n\n /**\n * returns and configures the React component dev server.\n * required for `bit start`\n */\n getDevServer(context: DevServerContext, transformers: WebpackConfigTransformer[] = []): DevServer {\n const baseConfig = basePreviewConfigFactory(false);\n const envDevConfig = envPreviewDevConfigFactory(context.id);\n const componentDevConfig = componentPreviewDevConfigFactory(this.workspace.path, context.id);\n const peers = this.getAllHostDependencies();\n const peerAliasesTransformer = generateAddAliasesFromPeersTransformer(peers, this.logger);\n\n const defaultTransformer: WebpackConfigTransformer = (configMutator) => {\n const merged = configMutator.merge([baseConfig, envDevConfig, componentDevConfig]);\n return merged;\n };\n\n return this.webpack.createDevServer(context, [defaultTransformer, peerAliasesTransformer, ...transformers]);\n }\n\n async getBundler(context: BundlerContext, transformers: WebpackConfigTransformer[] = []): Promise<Bundler> {\n return this.createComponentsWebpackBundler(context, transformers);\n }\n\n async createComponentsWebpackBundler(\n context: BundlerContext,\n transformers: WebpackConfigTransformer[] = []\n ): Promise<Bundler> {\n const peers = this.getAllHostDependencies();\n const peerAliasesTransformer = generateAddAliasesFromPeersTransformer(peers, this.logger);\n const baseConfig = basePreviewConfigFactory(!context.development);\n const baseProdConfig = basePreviewProdConfigFactory(Boolean(context.externalizePeer), peers, context.development);\n const componentProdConfig = componentPreviewProdConfigFactory();\n\n const defaultTransformer: WebpackConfigTransformer = (configMutator) => {\n const merged = configMutator.merge([baseConfig, baseProdConfig, componentProdConfig]);\n return merged;\n };\n const mergedTransformers = [defaultTransformer, peerAliasesTransformer, ...transformers];\n return this.createWebpackBundler(context, mergedTransformers);\n }\n\n async createTemplateWebpackBundler(\n context: BundlerContext,\n transformers: WebpackConfigTransformer[] = []\n ): Promise<Bundler> {\n const peers = this.getAllHostDependencies();\n const peerAliasesTransformer = generateAddAliasesFromPeersTransformer(peers, this.logger);\n const baseConfig = basePreviewConfigFactory(!context.development);\n const baseProdConfig = basePreviewProdConfigFactory(Boolean(context.externalizePeer), peers, context.development);\n\n const defaultTransformer: WebpackConfigTransformer = (configMutator) => {\n const merged = configMutator.merge([baseConfig, baseProdConfig]);\n return merged;\n };\n const mergedTransformers = [defaultTransformer, peerAliasesTransformer, ...transformers];\n return this.createWebpackBundler(context, mergedTransformers);\n }\n\n private async createWebpackBundler(\n context: BundlerContext,\n transformers: WebpackConfigTransformer[] = []\n ): Promise<Bundler> {\n return this.webpack.createBundler(context, transformers);\n }\n\n /**\n * Get the peers configured by the env on the components + the host deps configured by the env\n */\n getAllHostDependencies() {\n const envComponentPeers = Object.keys(this.getDependencies().peerDependencies || {}) || [];\n const additionalHostDeps = this.getAdditionalHostDependencies() || [];\n const peers = envComponentPeers.concat(additionalHostDeps);\n return peers;\n }\n\n getAdditionalHostDependencies(): string[] {\n return ['@teambit/mdx.ui.mdx-scope-context', '@mdx-js/react'];\n }\n\n /**\n * returns a path to a docs template.\n */\n getDocsTemplate() {\n return require.resolve('@teambit/react.ui.docs-app');\n }\n\n icon = 'https://static.bit.dev/extensions-icons/react.svg';\n\n /**\n * returns a paths to a function which mounts a given component to DOM\n */\n getMounter() {\n return require.resolve('./mount');\n }\n\n getPreviewConfig() {\n return {\n strategyName: 'component',\n splitComponentBundle: true,\n };\n }\n\n /**\n * define the package json properties to add to each component.\n */\n getPackageJsonProps(): PackageJsonProps {\n // React compile by default to esm, so uses type module\n // return this.getEsmPackageJsonProps();\n return this.getCjsPackageJsonProps();\n }\n\n /**\n * Get the default package.json props for a cjs component\n * @returns\n */\n getCjsPackageJsonProps(): PackageJsonProps {\n return this.tsAspect.getCjsPackageJsonProps();\n }\n\n /**\n * Get the default package.json props for an esm component\n * @returns\n */\n getEsmPackageJsonProps(): PackageJsonProps {\n return this.tsAspect.getEsmPackageJsonProps();\n }\n\n getNpmIgnore() {\n // ignores only .ts files in the root directory, so d.ts files inside dists are unaffected.\n // without this change, the package has \"index.ts\" file in the root, causing typescript to parse it instead of the\n // d.ts files. (changing the \"types\" prop in the package.json file doesn't help).\n return [`${CAPSULE_ARTIFACTS_DIR}/`];\n }\n\n /**\n * adds dependencies to all configured components.\n */\n getDependencies() {\n return {\n dependencies: {\n react: '-',\n 'react-dom': '-',\n 'core-js': '^3.0.0',\n },\n // TODO: add this only if using ts\n devDependencies: {\n react: '-',\n 'react-dom': '-',\n '@types/mocha': '-',\n '@types/node': '12.20.4',\n '@types/react': '^17.0.8',\n '@types/react-dom': '^17.0.5',\n '@types/jest': '^26.0.0',\n // This is added as dev dep since our jest file transformer uses babel plugins that require this to be installed\n '@babel/runtime': '7.12.18',\n '@types/testing-library__jest-dom': '5.9.5',\n },\n peerDependencies: {\n react: '^16.8.0 || ^17.0.0',\n 'react-dom': '^16.8.0 || ^17.0.0',\n },\n };\n }\n\n /**\n * returns the component build pipeline.\n */\n getBuildPipe(modifiers: GetBuildPipeModifiers = {}): BuildTask[] {\n const transformers: TsConfigTransformer[] =\n (modifiers?.tsModifier?.transformers as any as TsConfigTransformer[]) || [];\n return [this.getCompilerTask(transformers, modifiers?.tsModifier?.module || ts), this.tester.task];\n }\n\n /**\n * Get the react build pipeline without the compilation task.\n * This help in cases you want to only replace the compilation task with something else\n * @returns\n */\n getBuildPipeWithoutCompiler(): BuildTask[] {\n const pipeWithoutCompiler = this.getBuildPipe().filter((task) => task.aspectId !== this.compilerAspectId);\n return pipeWithoutCompiler;\n }\n\n /**\n * Get a compiler task with react config and set to esm module\n * @param transformers\n * @param tsModule\n * @returns\n */\n getEsmCompilerTask(transformers: TsConfigTransformer[] = [], tsModule = ts) {\n const tsCompiler = this.getTsEsmCompiler('build', transformers, tsModule);\n return this.compiler.createTask('TSCompiler', tsCompiler);\n }\n\n /**\n * Get a compiler task with react config and set to cjs module\n * @param transformers\n * @param tsModule\n * @returns\n */\n getCjsCompilerTask(transformers: TsConfigTransformer[] = [], tsModule = ts) {\n const tsCompiler = this.getTsCjsCompiler('build', transformers, tsModule);\n return this.compiler.createTask('TSCompiler', tsCompiler);\n }\n\n private getCompilerTask(transformers: TsConfigTransformer[] = [], tsModule = ts) {\n return this.getCjsCompilerTask(transformers, tsModule);\n }\n\n async __getDescriptor() {\n return {\n type: ReactEnvType,\n };\n }\n}\n"]}
@@ -13,6 +13,7 @@ import { GeneratorMain } from '@teambit/generator';
13
13
  import { Workspace } from '@teambit/workspace';
14
14
  import { EnvPolicyConfigObject } from '@teambit/dependency-resolver';
15
15
  import { ApplicationMain } from '@teambit/application';
16
+ import { LoggerMain } from '@teambit/logger';
16
17
  import { ESLintMain, EslintConfigTransformer } from '@teambit/eslint';
17
18
  import { PrettierMain, PrettierConfigTransformer } from '@teambit/prettier';
18
19
  import { ReactEnv } from './react.env';
@@ -31,7 +32,8 @@ declare type ReactDeps = [
31
32
  ESLintMain,
32
33
  PrettierMain,
33
34
  ApplicationMain,
34
- GeneratorMain
35
+ GeneratorMain,
36
+ LoggerMain
35
37
  ];
36
38
  export declare type ReactMainConfig = {
37
39
  /**
@@ -174,6 +176,6 @@ export declare class ReactMain {
174
176
  } | null;
175
177
  static runtime: import("@teambit/harmony").RuntimeDefinition;
176
178
  static dependencies: import("@teambit/harmony").Aspect[];
177
- static provider([envs, jestAspect, tsAspect, compiler, webpack, workspace, graphql, pkg, tester, eslint, prettier, application, generator,]: ReactDeps, config: ReactMainConfig): Promise<ReactMain>;
179
+ static provider([envs, jestAspect, tsAspect, compiler, webpack, workspace, graphql, pkg, tester, eslint, prettier, application, generator, loggerMain,]: ReactDeps, config: ReactMainConfig): Promise<ReactMain>;
178
180
  }
179
181
  export {};
@@ -173,6 +173,16 @@ function _application() {
173
173
  return data;
174
174
  }
175
175
 
176
+ function _logger() {
177
+ const data = require("@teambit/logger");
178
+
179
+ _logger = function () {
180
+ return data;
181
+ };
182
+
183
+ return data;
184
+ }
185
+
176
186
  function _eslint() {
177
187
  const data = require("@teambit/eslint");
178
188
 
@@ -564,8 +574,9 @@ class ReactMain {
564
574
  };
565
575
  }
566
576
 
567
- static async provider([envs, jestAspect, tsAspect, compiler, webpack, workspace, graphql, pkg, tester, eslint, prettier, application, generator], config) {
568
- const reactEnv = new (_react2().ReactEnv)(jestAspect, tsAspect, compiler, webpack, workspace, pkg, tester, config, eslint, prettier, _compiler().CompilerAspect.id);
577
+ static async provider([envs, jestAspect, tsAspect, compiler, webpack, workspace, graphql, pkg, tester, eslint, prettier, application, generator, loggerMain], config) {
578
+ const logger = loggerMain.createLogger(_react().ReactAspect.id);
579
+ const reactEnv = new (_react2().ReactEnv)(jestAspect, tsAspect, compiler, webpack, workspace, pkg, tester, config, eslint, prettier, logger, _compiler().CompilerAspect.id);
569
580
  const appType = new (_web().ReactAppType)('react-app', reactEnv);
570
581
  const react = new ReactMain(reactEnv, envs, application, appType);
571
582
  graphql.register((0, _react3().reactSchema)(react));
@@ -580,7 +591,7 @@ class ReactMain {
580
591
 
581
592
  exports.ReactMain = ReactMain;
582
593
  (0, _defineProperty2().default)(ReactMain, "runtime", _cli().MainRuntime);
583
- (0, _defineProperty2().default)(ReactMain, "dependencies", [_envs().EnvsAspect, _jest().JestAspect, _typescript().TypescriptAspect, _compiler().CompilerAspect, _webpack().WebpackAspect, _workspace().WorkspaceAspect, _graphql().GraphqlAspect, _pkg().PkgAspect, _tester().TesterAspect, _eslint().ESLintAspect, _prettier().PrettierAspect, _application().ApplicationAspect, _generator().GeneratorAspect]);
594
+ (0, _defineProperty2().default)(ReactMain, "dependencies", [_envs().EnvsAspect, _jest().JestAspect, _typescript().TypescriptAspect, _compiler().CompilerAspect, _webpack().WebpackAspect, _workspace().WorkspaceAspect, _graphql().GraphqlAspect, _pkg().PkgAspect, _tester().TesterAspect, _eslint().ESLintAspect, _prettier().PrettierAspect, _application().ApplicationAspect, _generator().GeneratorAspect, _logger().LoggerAspect]);
584
595
 
585
596
  _react().ReactAspect.addRuntime(ReactMain);
586
597
 
@@ -1 +1 @@
1
- {"version":3,"sources":["react.main.runtime.ts"],"names":["ReactMain","constructor","reactEnv","envs","application","reactAppType","getReactAppType","name","ReactAppType","registerApp","reactApp","createApp","useTypescript","modifiers","tsModule","ts","overrides","devTransformers","devConfig","getCompiler","buildTransformers","buildConfig","buildPipeModifiers","tsModifier","transformers","module","getBuildPipe","override","overrideTsConfig","tsconfig","compilerOptions","transformer","configMutator","mergeTsConfig","raw","compileJs","compileJsx","types","addTypes","genericCompilerOptions","Object","assign","overrideDocsTemplate","templatePath","getDocsTemplate","overrideBuildTsConfig","useWebpack","devServerTransformers","devServerConfig","getDevServer","context","getDevEnvId","envDefinition","id","previewTransformers","previewConfig","getBundler","useEslint","getLinter","usePrettier","getFormatter","overrideDevServerConfig","config","merge","overridePreviewConfig","overrideMounter","mounterPath","getMounter","compose","targetEnv","overrideJestConfig","jestConfigPath","jestModulePath","getTester","overrideBuildPipe","tasks","overrideCompilerTasks","pipeWithoutCompiler","getBuildPipeWithoutCompiler","overrideDependencies","dependencyPolicy","getDependencies","reactDeps","overrideCompiler","compiler","overrideEslintConfig","overridePackageJsonProps","props","getPackageJsonProps","getDocs","component","docsArray","state","_consumer","docs","abstract","description","filePath","properties","provider","jestAspect","tsAspect","webpack","workspace","graphql","pkg","tester","eslint","prettier","generator","ReactEnv","CompilerAspect","appType","react","register","registerEnv","registerComponentTemplate","componentTemplates","registerWorkspaceTemplate","workspaceTemplates","registerAppType","MainRuntime","EnvsAspect","JestAspect","TypescriptAspect","WebpackAspect","WorkspaceAspect","GraphqlAspect","PkgAspect","TesterAspect","ESLintAspect","PrettierAspect","ApplicationAspect","GeneratorAspect","ReactAspect","addRuntime"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAEA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAGA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAEA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAEA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAEA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAEA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAEA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAEA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;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gBnB/C,MAhBmB,EAiBnB;AACA,UAAM5D,QAAQ,GAAG,KAAI4G,kBAAJ,EACfV,UADe,EAEfC,QAFe,EAGfjB,QAHe,EAIfkB,OAJe,EAKfC,SALe,EAMfE,GANe,EAOfC,MAPe,EAQf5C,MARe,EASf6C,MATe,EAUfC,QAVe,EAWfG,2BAAe1D,EAXA,CAAjB;AAaA,UAAM2D,OAAO,GAAG,KAAIxG,mBAAJ,EAAiB,WAAjB,EAA8BN,QAA9B,CAAhB;AACA,UAAM+G,KAAK,GAAG,IAAIjH,SAAJ,CAAcE,QAAd,EAAwBC,IAAxB,EAA8BC,WAA9B,EAA2C4G,OAA3C,CAAd;AACAR,IAAAA,OAAO,CAACU,QAAR,CAAiB,2BAAYD,KAAZ,CAAjB;AACA9G,IAAAA,IAAI,CAACgH,WAAL,CAAiBjH,QAAjB;AACA2G,IAAAA,SAAS,CAACO,yBAAV,CAAoCC,4BAApC;AACAR,IAAAA,SAAS,CAACS,yBAAV,CAAoCC,4BAApC;AACAnH,IAAAA,WAAW,CAACoH,eAAZ,CAA4BR,OAA5B;AAEA,WAAOC,KAAP;AACD;;AA1VoB;;;gCAAVjH,S,aAiSMyH,kB;gCAjSNzH,S,kBAkSW,CACpB0H,kBADoB,EAEpBC,kBAFoB,EAGpBC,8BAHoB,EAIpBb,0BAJoB,EAKpBc,wBALoB,EAMpBC,4BANoB,EAOpBC,wBAPoB,EAQpBC,gBARoB,EASpBC,sBAToB,EAUpBC,sBAVoB,EAWpBC,0BAXoB,EAYpBC,gCAZoB,EAapBC,4BAboB,C;;AA2DxBC,qBAAYC,UAAZ,CAAuBvI,SAAvB","sourcesContent":["import mergeDeepLeft from 'ramda/src/mergeDeepLeft';\nimport { omit } from 'lodash';\nimport { MainRuntime } from '@teambit/cli';\nimport type { CompilerMain } from '@teambit/compiler';\nimport { CompilerAspect, Compiler } from '@teambit/compiler';\nimport { BuildTask } from '@teambit/builder';\nimport { Component } from '@teambit/component';\nimport { EnvsAspect, EnvsMain, EnvTransformer, Environment } from '@teambit/envs';\nimport type { GraphqlMain } from '@teambit/graphql';\nimport { GraphqlAspect } from '@teambit/graphql';\nimport type { JestMain } from '@teambit/jest';\nimport { JestAspect } from '@teambit/jest';\nimport type { PkgMain, PackageJsonProps } from '@teambit/pkg';\nimport { PkgAspect } from '@teambit/pkg';\nimport type { TesterMain } from '@teambit/tester';\nimport { TesterAspect } from '@teambit/tester';\nimport type { TypescriptMain, TsCompilerOptionsWithoutTsConfig, TsConfigTransformer } from '@teambit/typescript';\nimport { TypescriptAspect } from '@teambit/typescript';\nimport type { WebpackMain, Configuration, WebpackConfigTransformer } from '@teambit/webpack';\nimport { WebpackAspect } from '@teambit/webpack';\nimport { GeneratorAspect, GeneratorMain } from '@teambit/generator';\nimport { Workspace, WorkspaceAspect } from '@teambit/workspace';\nimport { DevServerContext, BundlerContext } from '@teambit/bundler';\nimport { EnvPolicyConfigObject } from '@teambit/dependency-resolver';\nimport ts from 'typescript';\nimport { ApplicationAspect, ApplicationMain } from '@teambit/application';\nimport { FormatterContext } from '@teambit/formatter';\nimport { LinterContext } from '@teambit/linter';\nimport { ESLintMain, ESLintAspect, EslintConfigTransformer } from '@teambit/eslint';\nimport { PrettierMain, PrettierAspect, PrettierConfigTransformer } from '@teambit/prettier';\nimport { ReactAspect } from './react.aspect';\nimport { ReactEnv } from './react.env';\nimport { ReactAppType } from './apps/web';\nimport { reactSchema } from './react.graphql';\nimport { componentTemplates, workspaceTemplates } from './react.templates';\nimport { ReactAppOptions } from './apps/web/react-app-options';\n\ntype ReactDeps = [\n EnvsMain,\n JestMain,\n TypescriptMain,\n CompilerMain,\n WebpackMain,\n Workspace,\n GraphqlMain,\n PkgMain,\n TesterMain,\n ESLintMain,\n PrettierMain,\n ApplicationMain,\n GeneratorMain\n];\n\nexport type ReactMainConfig = {\n /**\n * configure the react env compiler.\n * can be configured to either TypeScript ('ts') or Babel ('babel').\n */\n compiler: 'babel' | 'ts';\n\n /**\n * configure the component tester.\n * can be either Jest ('jest') or Mocha ('mocha')\n */\n tester: 'jest' | 'mocha';\n\n /**\n * version of React to configure.\n */\n reactVersion: string;\n};\n\nexport type UseWebpackModifiers = {\n previewConfig?: WebpackConfigTransformer[];\n devServerConfig?: WebpackConfigTransformer[];\n};\n\nexport type UseTypescriptModifiers = {\n buildConfig?: TsConfigTransformer[];\n devConfig?: TsConfigTransformer[];\n};\n\nexport type UseEslintModifiers = {\n transformers: EslintConfigTransformer[];\n};\nexport type UsePrettierModifiers = {\n transformers: PrettierConfigTransformer[];\n};\n\nexport class ReactMain {\n constructor(\n /**\n * an instance of the React env.\n */\n readonly reactEnv: ReactEnv,\n\n private envs: EnvsMain,\n\n private application: ApplicationMain,\n\n private reactAppType: ReactAppType\n ) {}\n\n readonly env = this.reactEnv;\n\n getReactAppType(name: string) {\n return new ReactAppType(name, this.reactEnv);\n }\n\n /**\n * use this to register apps programmatically.\n */\n async registerApp(reactApp: ReactAppOptions) {\n return this.application.registerApp(await this.reactAppType.createApp(reactApp));\n }\n \n /**\n * override the env's typescript config for both dev and build time.\n * Replaces both overrideTsConfig (devConfig) and overrideBuildTsConfig (buildConfig)\n */\n useTypescript(modifiers?: UseTypescriptModifiers, tsModule: any = ts) {\n const overrides: any = {};\n const devTransformers = modifiers?.devConfig;\n if (devTransformers) {\n overrides.getCompiler = () => this.reactEnv.getCompiler(devTransformers, tsModule);\n }\n const buildTransformers = modifiers?.buildConfig;\n if (buildTransformers) {\n const buildPipeModifiers = {\n tsModifier: {\n transformers: buildTransformers,\n module: tsModule,\n },\n };\n overrides.getBuildPipe = () => this.reactEnv.getBuildPipe(buildPipeModifiers);\n }\n return this.envs.override(overrides);\n }\n\n /**\n * @deprecated use useTypescript()\n * override the TS config of the React environment.\n * @param tsModule typeof `ts` module instance.\n */\n overrideTsConfig(\n tsconfig: Record<string, any> = {},\n compilerOptions: Partial<TsCompilerOptionsWithoutTsConfig> = {},\n tsModule: any = ts\n ) {\n const transformer: TsConfigTransformer = (configMutator) => {\n configMutator.mergeTsConfig(tsconfig);\n configMutator.raw.compileJs = compilerOptions.compileJs ?? configMutator.raw.compileJs;\n configMutator.raw.compileJsx = compilerOptions.compileJsx ?? configMutator.raw.compileJsx;\n if (compilerOptions.types) {\n configMutator.addTypes(compilerOptions.types);\n }\n const genericCompilerOptions = omit(compilerOptions, ['types', 'compileJs', 'compileJsx']);\n configMutator.raw = Object.assign(configMutator.raw, genericCompilerOptions);\n return configMutator;\n };\n // return this.envs.override({\n // getCompiler: () => this.reactEnv.getCompiler([transformer], tsModule),\n // });\n return this.useTypescript({ devConfig: [transformer] }, tsModule);\n }\n\n /**\n * Override the Bit documentation link. See docs: https://bit.dev/docs/docs/doc-templates\n */\n overrideDocsTemplate(templatePath: string) {\n return this.envs.override({\n getDocsTemplate: () => templatePath,\n });\n }\n\n /**\n * @deprecated use useTypescript()\n * override the build tsconfig.\n */\n overrideBuildTsConfig(\n tsconfig: Record<string, any> = {},\n compilerOptions: Partial<TsCompilerOptionsWithoutTsConfig> = {},\n tsModule: any = ts\n ) {\n const transformer: TsConfigTransformer = (configMutator) => {\n configMutator.mergeTsConfig(tsconfig);\n configMutator.raw.compileJs = compilerOptions.compileJs ?? configMutator.raw.compileJs;\n configMutator.raw.compileJsx = compilerOptions.compileJsx ?? configMutator.raw.compileJsx;\n if (compilerOptions.types) {\n configMutator.addTypes(compilerOptions.types);\n }\n const genericCompilerOptions = omit(compilerOptions, ['types', 'compileJs', 'compileJsx']);\n configMutator.raw = Object.assign(configMutator.raw, genericCompilerOptions);\n return configMutator;\n };\n // return this.envs.override({\n // getBuildPipe: () => this.reactEnv.getBuildPipe([transformer], tsModule),\n // });\n return this.useTypescript({ buildConfig: [transformer] }, tsModule);\n }\n\n /**\n * override the env's dev server and preview webpack configurations.\n * Replaces both overrideDevServerConfig and overridePreviewConfig\n */\n useWebpack(modifiers?: UseWebpackModifiers): EnvTransformer {\n const overrides: any = {};\n const devServerTransformers = modifiers?.devServerConfig;\n if (devServerTransformers) {\n overrides.getDevServer = (context: DevServerContext) =>\n this.reactEnv.getDevServer(context, devServerTransformers);\n overrides.getDevEnvId = (context: DevServerContext) => this.reactEnv.getDevEnvId(context.envDefinition.id);\n }\n const previewTransformers = modifiers?.previewConfig;\n if (previewTransformers) {\n overrides.getBundler = (context: BundlerContext) => this.reactEnv.getBundler(context, previewTransformers);\n }\n return this.envs.override(overrides);\n }\n\n /**\n * An API to mutate the prettier config\n * @param modifiers\n * @returns\n */\n useEslint(modifiers?: UseEslintModifiers): EnvTransformer {\n const transformers = modifiers?.transformers || [];\n return this.envs.override({\n getLinter: (context: LinterContext) => this.reactEnv.getLinter(context, transformers),\n });\n }\n\n /**\n * An API to mutate the prettier config\n * @param modifiers\n * @returns\n */\n usePrettier(modifiers?: UsePrettierModifiers): EnvTransformer {\n const transformers = modifiers?.transformers || [];\n return this.envs.override({\n getFormatter: (context: FormatterContext) => this.reactEnv.getFormatter(context, transformers),\n });\n }\n\n /**\n * @deprecated use useWebpack()\n * override the dev server webpack config.\n */\n overrideDevServerConfig(config: Configuration) {\n const transformer: WebpackConfigTransformer = (configMutator) => {\n return configMutator.merge([config]);\n };\n\n return this.envs.override({\n getDevServer: (context: DevServerContext) => this.reactEnv.getDevServer(context, [transformer]),\n getDevEnvId: (context: DevServerContext) => this.reactEnv.getDevEnvId(context.envDefinition.id),\n });\n }\n\n /**\n * @deprecated use useWebpack()\n * override the preview webpack config.\n */\n overridePreviewConfig(config: Configuration) {\n const transformer: WebpackConfigTransformer = (configMutator) => {\n return configMutator.merge([config]);\n };\n return this.envs.override({\n getBundler: (context: BundlerContext) => this.reactEnv.getBundler(context, [transformer]),\n });\n }\n\n overrideMounter(mounterPath: string) {\n return this.envs.override({\n getMounter: () => {\n return mounterPath;\n },\n });\n }\n\n /**\n * create a new composition of the react environment.\n */\n compose(transformers: EnvTransformer[], targetEnv: Environment = {}) {\n return this.envs.compose(this.envs.merge(targetEnv, this.reactEnv), transformers);\n }\n\n /**\n * override the jest configuration.\n * @param jestConfigPath {typeof jest} absolute path to jest.config.json.\n * @param jestModulePath absolute path to jest\n */\n overrideJestConfig(jestConfigPath: string, jestModulePath?: string) {\n return this.envs.override({\n getTester: () => this.reactEnv.getTester(jestConfigPath, jestModulePath),\n });\n }\n\n /**\n * override the build pipeline of the component environment.\n */\n overrideBuildPipe(tasks: BuildTask[]) {\n return this.envs.override({\n getBuildPipe: () => tasks,\n });\n }\n\n /**\n * override the compiler tasks inside the build pipeline of the component environment.\n */\n overrideCompilerTasks(tasks: BuildTask[]) {\n const pipeWithoutCompiler = this.reactEnv.getBuildPipeWithoutCompiler();\n\n return this.envs.override({\n getBuildPipe: () => [...tasks, ...pipeWithoutCompiler],\n });\n }\n\n /**\n * override the dependency configuration of the component environment.\n */\n overrideDependencies(dependencyPolicy: EnvPolicyConfigObject) {\n return this.envs.override({\n getDependencies: async () => {\n const reactDeps = await this.reactEnv.getDependencies();\n return mergeDeepLeft(dependencyPolicy, reactDeps);\n },\n });\n }\n\n /**\n * override the workspace compiler.\n */\n overrideCompiler(compiler: Compiler) {\n return this.envs.override({\n getCompiler: () => {\n return compiler;\n },\n });\n }\n\n /**\n * TODO: @gilad we need to implement this.\n */\n overrideEslintConfig() {}\n\n /**\n * override the package json props of the component environment.\n */\n overridePackageJsonProps(props: PackageJsonProps) {\n return this.envs.override({\n getPackageJsonProps: () => {\n return {\n ...this.reactEnv.getPackageJsonProps(),\n ...props,\n };\n },\n });\n }\n\n /**\n * returns doc adjusted specifically for react components.\n */\n getDocs(component: Component) {\n const docsArray = component.state._consumer.docs;\n if (!docsArray || !docsArray[0]) {\n return null;\n }\n\n const docs = docsArray[0];\n\n return {\n abstract: docs.description,\n filePath: docs.filePath,\n properties: docs.properties,\n };\n }\n\n static runtime = MainRuntime;\n static dependencies = [\n EnvsAspect,\n JestAspect,\n TypescriptAspect,\n CompilerAspect,\n WebpackAspect,\n WorkspaceAspect,\n GraphqlAspect,\n PkgAspect,\n TesterAspect,\n ESLintAspect,\n PrettierAspect,\n ApplicationAspect,\n GeneratorAspect,\n ];\n\n static async provider(\n [\n envs,\n jestAspect,\n tsAspect,\n compiler,\n webpack,\n workspace,\n graphql,\n pkg,\n tester,\n eslint,\n prettier,\n application,\n generator,\n ]: ReactDeps,\n config: ReactMainConfig\n ) {\n const reactEnv = new ReactEnv(\n jestAspect,\n tsAspect,\n compiler,\n webpack,\n workspace,\n pkg,\n tester,\n config,\n eslint,\n prettier,\n CompilerAspect.id\n );\n const appType = new ReactAppType('react-app', reactEnv);\n const react = new ReactMain(reactEnv, envs, application, appType);\n graphql.register(reactSchema(react));\n envs.registerEnv(reactEnv);\n generator.registerComponentTemplate(componentTemplates);\n generator.registerWorkspaceTemplate(workspaceTemplates);\n application.registerAppType(appType);\n\n return react;\n }\n}\n\nReactAspect.addRuntime(ReactMain);\n"]}
1
+ {"version":3,"sources":["react.main.runtime.ts"],"names":["ReactMain","constructor","reactEnv","envs","application","reactAppType","getReactAppType","name","ReactAppType","registerApp","reactApp","createApp","useTypescript","modifiers","tsModule","ts","overrides","devTransformers","devConfig","getCompiler","buildTransformers","buildConfig","buildPipeModifiers","tsModifier","transformers","module","getBuildPipe","override","overrideTsConfig","tsconfig","compilerOptions","transformer","configMutator","mergeTsConfig","raw","compileJs","compileJsx","types","addTypes","genericCompilerOptions","Object","assign","overrideDocsTemplate","templatePath","getDocsTemplate","overrideBuildTsConfig","useWebpack","devServerTransformers","devServerConfig","getDevServer","context","getDevEnvId","envDefinition","id","previewTransformers","previewConfig","getBundler","useEslint","getLinter","usePrettier","getFormatter","overrideDevServerConfig","config","merge","overridePreviewConfig","overrideMounter","mounterPath","getMounter","compose","targetEnv","overrideJestConfig","jestConfigPath","jestModulePath","getTester","overrideBuildPipe","tasks","overrideCompilerTasks","pipeWithoutCompiler","getBuildPipeWithoutCompiler","overrideDependencies","dependencyPolicy","getDependencies","reactDeps","overrideCompiler","compiler","overrideEslintConfig","overridePackageJsonProps","props","getPackageJsonProps","getDocs","component","docsArray","state","_consumer","docs","abstract","description","filePath","properties","provider","jestAspect","tsAspect","webpack","workspace","graphql","pkg","tester","eslint","prettier","generator","loggerMain","logger","createLogger","ReactAspect","ReactEnv","CompilerAspect","appType","react","register","registerEnv","registerComponentTemplate","componentTemplates","registerWorkspaceTemplate","workspaceTemplates","registerAppType","MainRuntime","EnvsAspect","JestAspect","TypescriptAspect","WebpackAspect","WorkspaceAspect","GraphqlAspect","PkgAspect","TesterAspect","ESLintAspect","PrettierAspect","ApplicationAspect","GeneratorAspect","LoggerAspect","addRuntime"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAEA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAGA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAEA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAEA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAEA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAEA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAEA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAEA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAGA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAGA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;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OfC,MAPe,EAQf5C,MARe,EASf6C,MATe,EAUfC,QAVe,EAWfG,MAXe,EAYfI,2BAAe9D,EAZA,CAAjB;AAcA,UAAM+D,OAAO,GAAG,KAAI5G,mBAAJ,EAAiB,WAAjB,EAA8BN,QAA9B,CAAhB;AACA,UAAMmH,KAAK,GAAG,IAAIrH,SAAJ,CAAcE,QAAd,EAAwBC,IAAxB,EAA8BC,WAA9B,EAA2CgH,OAA3C,CAAd;AACAZ,IAAAA,OAAO,CAACc,QAAR,CAAiB,2BAAYD,KAAZ,CAAjB;AACAlH,IAAAA,IAAI,CAACoH,WAAL,CAAiBrH,QAAjB;AACA2G,IAAAA,SAAS,CAACW,yBAAV,CAAoCC,4BAApC;AACAZ,IAAAA,SAAS,CAACa,yBAAV,CAAoCC,4BAApC;AACAvH,IAAAA,WAAW,CAACwH,eAAZ,CAA4BR,OAA5B;AAEA,WAAOC,KAAP;AACD;;AA9VoB;;;gCAAVrH,S,aAiSM6H,kB;gCAjSN7H,S,kBAkSW,CACpB8H,kBADoB,EAEpBC,kBAFoB,EAGpBC,8BAHoB,EAIpBb,0BAJoB,EAKpBc,wBALoB,EAMpBC,4BANoB,EAOpBC,wBAPoB,EAQpBC,gBARoB,EASpBC,sBAToB,EAUpBC,sBAVoB,EAWpBC,0BAXoB,EAYpBC,gCAZoB,EAapBC,4BAboB,EAcpBC,sBAdoB,C;;AA+DxBzB,qBAAY0B,UAAZ,CAAuB3I,SAAvB","sourcesContent":["import mergeDeepLeft from 'ramda/src/mergeDeepLeft';\nimport { omit } from 'lodash';\nimport { MainRuntime } from '@teambit/cli';\nimport type { CompilerMain } from '@teambit/compiler';\nimport { CompilerAspect, Compiler } from '@teambit/compiler';\nimport { BuildTask } from '@teambit/builder';\nimport { Component } from '@teambit/component';\nimport { EnvsAspect, EnvsMain, EnvTransformer, Environment } from '@teambit/envs';\nimport type { GraphqlMain } from '@teambit/graphql';\nimport { GraphqlAspect } from '@teambit/graphql';\nimport type { JestMain } from '@teambit/jest';\nimport { JestAspect } from '@teambit/jest';\nimport type { PkgMain, PackageJsonProps } from '@teambit/pkg';\nimport { PkgAspect } from '@teambit/pkg';\nimport type { TesterMain } from '@teambit/tester';\nimport { TesterAspect } from '@teambit/tester';\nimport type { TypescriptMain, TsCompilerOptionsWithoutTsConfig, TsConfigTransformer } from '@teambit/typescript';\nimport { TypescriptAspect } from '@teambit/typescript';\nimport type { WebpackMain, Configuration, WebpackConfigTransformer } from '@teambit/webpack';\nimport { WebpackAspect } from '@teambit/webpack';\nimport { GeneratorAspect, GeneratorMain } from '@teambit/generator';\nimport { Workspace, WorkspaceAspect } from '@teambit/workspace';\nimport { DevServerContext, BundlerContext } from '@teambit/bundler';\nimport { EnvPolicyConfigObject } from '@teambit/dependency-resolver';\nimport ts from 'typescript';\nimport { ApplicationAspect, ApplicationMain } from '@teambit/application';\nimport { FormatterContext } from '@teambit/formatter';\nimport { LinterContext } from '@teambit/linter';\nimport { LoggerAspect, LoggerMain } from '@teambit/logger';\nimport { ESLintMain, ESLintAspect, EslintConfigTransformer } from '@teambit/eslint';\nimport { PrettierMain, PrettierAspect, PrettierConfigTransformer } from '@teambit/prettier';\nimport { ReactAspect } from './react.aspect';\nimport { ReactEnv } from './react.env';\nimport { ReactAppType } from './apps/web';\nimport { reactSchema } from './react.graphql';\nimport { componentTemplates, workspaceTemplates } from './react.templates';\nimport { ReactAppOptions } from './apps/web/react-app-options';\n\ntype ReactDeps = [\n EnvsMain,\n JestMain,\n TypescriptMain,\n CompilerMain,\n WebpackMain,\n Workspace,\n GraphqlMain,\n PkgMain,\n TesterMain,\n ESLintMain,\n PrettierMain,\n ApplicationMain,\n GeneratorMain,\n LoggerMain\n];\n\nexport type ReactMainConfig = {\n /**\n * configure the react env compiler.\n * can be configured to either TypeScript ('ts') or Babel ('babel').\n */\n compiler: 'babel' | 'ts';\n\n /**\n * configure the component tester.\n * can be either Jest ('jest') or Mocha ('mocha')\n */\n tester: 'jest' | 'mocha';\n\n /**\n * version of React to configure.\n */\n reactVersion: string;\n};\n\nexport type UseWebpackModifiers = {\n previewConfig?: WebpackConfigTransformer[];\n devServerConfig?: WebpackConfigTransformer[];\n};\n\nexport type UseTypescriptModifiers = {\n buildConfig?: TsConfigTransformer[];\n devConfig?: TsConfigTransformer[];\n};\n\nexport type UseEslintModifiers = {\n transformers: EslintConfigTransformer[];\n};\nexport type UsePrettierModifiers = {\n transformers: PrettierConfigTransformer[];\n};\n\nexport class ReactMain {\n constructor(\n /**\n * an instance of the React env.\n */\n readonly reactEnv: ReactEnv,\n\n private envs: EnvsMain,\n\n private application: ApplicationMain,\n\n private reactAppType: ReactAppType\n ) {}\n\n readonly env = this.reactEnv;\n\n getReactAppType(name: string) {\n return new ReactAppType(name, this.reactEnv);\n }\n\n /**\n * use this to register apps programmatically.\n */\n async registerApp(reactApp: ReactAppOptions) {\n return this.application.registerApp(await this.reactAppType.createApp(reactApp));\n }\n\n /**\n * override the env's typescript config for both dev and build time.\n * Replaces both overrideTsConfig (devConfig) and overrideBuildTsConfig (buildConfig)\n */\n useTypescript(modifiers?: UseTypescriptModifiers, tsModule: any = ts) {\n const overrides: any = {};\n const devTransformers = modifiers?.devConfig;\n if (devTransformers) {\n overrides.getCompiler = () => this.reactEnv.getCompiler(devTransformers, tsModule);\n }\n const buildTransformers = modifiers?.buildConfig;\n if (buildTransformers) {\n const buildPipeModifiers = {\n tsModifier: {\n transformers: buildTransformers,\n module: tsModule,\n },\n };\n overrides.getBuildPipe = () => this.reactEnv.getBuildPipe(buildPipeModifiers);\n }\n return this.envs.override(overrides);\n }\n\n /**\n * @deprecated use useTypescript()\n * override the TS config of the React environment.\n * @param tsModule typeof `ts` module instance.\n */\n overrideTsConfig(\n tsconfig: Record<string, any> = {},\n compilerOptions: Partial<TsCompilerOptionsWithoutTsConfig> = {},\n tsModule: any = ts\n ) {\n const transformer: TsConfigTransformer = (configMutator) => {\n configMutator.mergeTsConfig(tsconfig);\n configMutator.raw.compileJs = compilerOptions.compileJs ?? configMutator.raw.compileJs;\n configMutator.raw.compileJsx = compilerOptions.compileJsx ?? configMutator.raw.compileJsx;\n if (compilerOptions.types) {\n configMutator.addTypes(compilerOptions.types);\n }\n const genericCompilerOptions = omit(compilerOptions, ['types', 'compileJs', 'compileJsx']);\n configMutator.raw = Object.assign(configMutator.raw, genericCompilerOptions);\n return configMutator;\n };\n // return this.envs.override({\n // getCompiler: () => this.reactEnv.getCompiler([transformer], tsModule),\n // });\n return this.useTypescript({ devConfig: [transformer] }, tsModule);\n }\n\n /**\n * Override the Bit documentation link. See docs: https://bit.dev/docs/docs/doc-templates\n */\n overrideDocsTemplate(templatePath: string) {\n return this.envs.override({\n getDocsTemplate: () => templatePath,\n });\n }\n\n /**\n * @deprecated use useTypescript()\n * override the build tsconfig.\n */\n overrideBuildTsConfig(\n tsconfig: Record<string, any> = {},\n compilerOptions: Partial<TsCompilerOptionsWithoutTsConfig> = {},\n tsModule: any = ts\n ) {\n const transformer: TsConfigTransformer = (configMutator) => {\n configMutator.mergeTsConfig(tsconfig);\n configMutator.raw.compileJs = compilerOptions.compileJs ?? configMutator.raw.compileJs;\n configMutator.raw.compileJsx = compilerOptions.compileJsx ?? configMutator.raw.compileJsx;\n if (compilerOptions.types) {\n configMutator.addTypes(compilerOptions.types);\n }\n const genericCompilerOptions = omit(compilerOptions, ['types', 'compileJs', 'compileJsx']);\n configMutator.raw = Object.assign(configMutator.raw, genericCompilerOptions);\n return configMutator;\n };\n // return this.envs.override({\n // getBuildPipe: () => this.reactEnv.getBuildPipe([transformer], tsModule),\n // });\n return this.useTypescript({ buildConfig: [transformer] }, tsModule);\n }\n\n /**\n * override the env's dev server and preview webpack configurations.\n * Replaces both overrideDevServerConfig and overridePreviewConfig\n */\n useWebpack(modifiers?: UseWebpackModifiers): EnvTransformer {\n const overrides: any = {};\n const devServerTransformers = modifiers?.devServerConfig;\n if (devServerTransformers) {\n overrides.getDevServer = (context: DevServerContext) =>\n this.reactEnv.getDevServer(context, devServerTransformers);\n overrides.getDevEnvId = (context: DevServerContext) => this.reactEnv.getDevEnvId(context.envDefinition.id);\n }\n const previewTransformers = modifiers?.previewConfig;\n if (previewTransformers) {\n overrides.getBundler = (context: BundlerContext) => this.reactEnv.getBundler(context, previewTransformers);\n }\n return this.envs.override(overrides);\n }\n\n /**\n * An API to mutate the prettier config\n * @param modifiers\n * @returns\n */\n useEslint(modifiers?: UseEslintModifiers): EnvTransformer {\n const transformers = modifiers?.transformers || [];\n return this.envs.override({\n getLinter: (context: LinterContext) => this.reactEnv.getLinter(context, transformers),\n });\n }\n\n /**\n * An API to mutate the prettier config\n * @param modifiers\n * @returns\n */\n usePrettier(modifiers?: UsePrettierModifiers): EnvTransformer {\n const transformers = modifiers?.transformers || [];\n return this.envs.override({\n getFormatter: (context: FormatterContext) => this.reactEnv.getFormatter(context, transformers),\n });\n }\n\n /**\n * @deprecated use useWebpack()\n * override the dev server webpack config.\n */\n overrideDevServerConfig(config: Configuration) {\n const transformer: WebpackConfigTransformer = (configMutator) => {\n return configMutator.merge([config]);\n };\n\n return this.envs.override({\n getDevServer: (context: DevServerContext) => this.reactEnv.getDevServer(context, [transformer]),\n getDevEnvId: (context: DevServerContext) => this.reactEnv.getDevEnvId(context.envDefinition.id),\n });\n }\n\n /**\n * @deprecated use useWebpack()\n * override the preview webpack config.\n */\n overridePreviewConfig(config: Configuration) {\n const transformer: WebpackConfigTransformer = (configMutator) => {\n return configMutator.merge([config]);\n };\n return this.envs.override({\n getBundler: (context: BundlerContext) => this.reactEnv.getBundler(context, [transformer]),\n });\n }\n\n overrideMounter(mounterPath: string) {\n return this.envs.override({\n getMounter: () => {\n return mounterPath;\n },\n });\n }\n\n /**\n * create a new composition of the react environment.\n */\n compose(transformers: EnvTransformer[], targetEnv: Environment = {}) {\n return this.envs.compose(this.envs.merge(targetEnv, this.reactEnv), transformers);\n }\n\n /**\n * override the jest configuration.\n * @param jestConfigPath {typeof jest} absolute path to jest.config.json.\n * @param jestModulePath absolute path to jest\n */\n overrideJestConfig(jestConfigPath: string, jestModulePath?: string) {\n return this.envs.override({\n getTester: () => this.reactEnv.getTester(jestConfigPath, jestModulePath),\n });\n }\n\n /**\n * override the build pipeline of the component environment.\n */\n overrideBuildPipe(tasks: BuildTask[]) {\n return this.envs.override({\n getBuildPipe: () => tasks,\n });\n }\n\n /**\n * override the compiler tasks inside the build pipeline of the component environment.\n */\n overrideCompilerTasks(tasks: BuildTask[]) {\n const pipeWithoutCompiler = this.reactEnv.getBuildPipeWithoutCompiler();\n\n return this.envs.override({\n getBuildPipe: () => [...tasks, ...pipeWithoutCompiler],\n });\n }\n\n /**\n * override the dependency configuration of the component environment.\n */\n overrideDependencies(dependencyPolicy: EnvPolicyConfigObject) {\n return this.envs.override({\n getDependencies: async () => {\n const reactDeps = await this.reactEnv.getDependencies();\n return mergeDeepLeft(dependencyPolicy, reactDeps);\n },\n });\n }\n\n /**\n * override the workspace compiler.\n */\n overrideCompiler(compiler: Compiler) {\n return this.envs.override({\n getCompiler: () => {\n return compiler;\n },\n });\n }\n\n /**\n * TODO: @gilad we need to implement this.\n */\n overrideEslintConfig() {}\n\n /**\n * override the package json props of the component environment.\n */\n overridePackageJsonProps(props: PackageJsonProps) {\n return this.envs.override({\n getPackageJsonProps: () => {\n return {\n ...this.reactEnv.getPackageJsonProps(),\n ...props,\n };\n },\n });\n }\n\n /**\n * returns doc adjusted specifically for react components.\n */\n getDocs(component: Component) {\n const docsArray = component.state._consumer.docs;\n if (!docsArray || !docsArray[0]) {\n return null;\n }\n\n const docs = docsArray[0];\n\n return {\n abstract: docs.description,\n filePath: docs.filePath,\n properties: docs.properties,\n };\n }\n\n static runtime = MainRuntime;\n static dependencies = [\n EnvsAspect,\n JestAspect,\n TypescriptAspect,\n CompilerAspect,\n WebpackAspect,\n WorkspaceAspect,\n GraphqlAspect,\n PkgAspect,\n TesterAspect,\n ESLintAspect,\n PrettierAspect,\n ApplicationAspect,\n GeneratorAspect,\n LoggerAspect,\n ];\n\n static async provider(\n [\n envs,\n jestAspect,\n tsAspect,\n compiler,\n webpack,\n workspace,\n graphql,\n pkg,\n tester,\n eslint,\n prettier,\n application,\n generator,\n loggerMain,\n ]: ReactDeps,\n config: ReactMainConfig\n ) {\n const logger = loggerMain.createLogger(ReactAspect.id);\n const reactEnv = new ReactEnv(\n jestAspect,\n tsAspect,\n compiler,\n webpack,\n workspace,\n pkg,\n tester,\n config,\n eslint,\n prettier,\n logger,\n CompilerAspect.id\n );\n const appType = new ReactAppType('react-app', reactEnv);\n const react = new ReactMain(reactEnv, envs, application, appType);\n graphql.register(reactSchema(react));\n envs.registerEnv(reactEnv);\n generator.registerComponentTemplate(componentTemplates);\n generator.registerWorkspaceTemplate(workspaceTemplates);\n application.registerAppType(appType);\n\n return react;\n }\n}\n\nReactAspect.addRuntime(ReactMain);\n"]}
@@ -1,2 +1,3 @@
1
1
  import { WebpackConfigMutator } from '@teambit/webpack.modules.config-mutator';
2
- export declare function generateAddAliasesFromPeersTransformer(peers: string[]): (config: WebpackConfigMutator) => WebpackConfigMutator;
2
+ import { Logger } from '@teambit/logger';
3
+ export declare function generateAddAliasesFromPeersTransformer(peers: string[], logger: Logger): (config: WebpackConfigMutator) => WebpackConfigMutator;