@teambit/react 0.0.691 → 0.0.694

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 (37) hide show
  1. package/apps/web/react.application.ts +17 -0
  2. package/artifacts/env-template/public/283.js +34 -1
  3. package/artifacts/env-template/public/569.js +74 -0
  4. package/artifacts/env-template/public/677.js +4 -1
  5. package/artifacts/env-template/public/747.js +30 -0
  6. package/artifacts/env-template/public/750.js +86 -2
  7. package/artifacts/env-template/public/793.js +752 -16
  8. package/artifacts/env-template/public/assets-manifest.json +17 -17
  9. package/artifacts/env-template/public/compositions.2a8ba84c17aa03cbdd9d.js +1 -0
  10. package/artifacts/env-template/public/compositions.html +1 -1
  11. package/artifacts/env-template/public/overview.c7c244a3a8bbfec26757.js +5 -0
  12. package/artifacts/env-template/public/overview.html +1 -1
  13. package/artifacts/env-template/public/peers.b1e5a815a97146071b4a.js +1 -0
  14. package/artifacts/env-template/public/preview-root.36d217e87edeb331bd4e.js +1 -0
  15. package/artifacts/env-template/public/runtime.js +1 -1
  16. package/artifacts/env-template/public/service-worker.js +1 -1
  17. package/artifacts/env-template/public/static/css/793.2d42cfc4.css +1 -0
  18. package/artifacts/env-template/public/static/css/{previewRoot.1262db93.css → previewRoot.a16607da.css} +1 -1
  19. package/artifacts/preview/teambit_react_react-preview.js +11 -1
  20. package/{compositions-1648386827284.js → compositions-1648659683881.js} +0 -0
  21. package/dist/apps/web/react.application.js +39 -0
  22. package/dist/apps/web/react.application.js.map +1 -1
  23. package/dist/webpack/webpack.config.base.prod.js +52 -37
  24. package/dist/webpack/webpack.config.base.prod.js.map +1 -1
  25. package/{overview-1648386827284.js → overview-1648659683881.js} +0 -0
  26. package/package-tar/teambit-react-0.0.694.tgz +0 -0
  27. package/package.json +33 -31
  28. package/{preview-1648386827284.js → preview-1648659683881.js} +2 -2
  29. package/webpack/webpack.config.base.prod.ts +50 -34
  30. package/artifacts/env-template/public/420.js +0 -1
  31. package/artifacts/env-template/public/934.js +0 -1
  32. package/artifacts/env-template/public/compositions.a2c81bb414bb03918d09.js +0 -1
  33. package/artifacts/env-template/public/overview.b2a3c1f5a7bff688b748.js +0 -1
  34. package/artifacts/env-template/public/peers.f0c76108cfe204de95bd.js +0 -1
  35. package/artifacts/env-template/public/preview-root.a1f71de58f10102ed2c6.js +0 -1
  36. package/artifacts/env-template/public/static/css/793.253dc893.css +0 -1
  37. package/package-tar/teambit-react-0.0.691.tgz +0 -0
@@ -1 +1,11 @@
1
- !function(e,t){"object"===typeof exports&&"object"===typeof module?module.exports=t():"function"===typeof define&&define.amd?define([],t):"object"===typeof exports?exports["teambit.react/react-preview"]=t():e["teambit.react/react-preview"]=t()}(self,(function(){return(()=>{var e={88244:e=>{e.exports=function(e){return e&&e.__esModule?e:{default:e}}},56155:(e,t,a)=>{"use strict";a.r(t),a.d(t,{default:()=>l});a(63804);var n=a(85057),r=a(58459),d=a(55906),i=["components"];function m(){return m=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var n in a)Object.prototype.hasOwnProperty.call(a,n)&&(e[n]=a[n])}return e},m.apply(this,arguments)}function o(e,t){if(null==e)return{};var a,n,r=function(e,t){if(null==e)return{};var a,n,r={},d=Object.keys(e);for(n=0;n<d.length;n++)a=d[n],t.indexOf(a)>=0||(r[a]=e[a]);return r}(e,t);if(Object.getOwnPropertySymbols){var d=Object.getOwnPropertySymbols(e);for(n=0;n<d.length;n++)a=d[n],t.indexOf(a)>=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(r[a]=e[a])}return r}var p={};function l(e){var t=e.components,a=o(e,i);return(0,n.mdx)("wrapper",m({},p,a,{components:t,mdxType:"MDXLayout"}),(0,n.mdx)(r.MDXScopeProvider,{components:{ReactOverview:d.ZP},mdxType:"MDXScopeProvider"},(0,n.mdx)(d.ZP,{mdxType:"ReactOverview"})))}l.isMDXComponent=!0},55906:(e,t,a)=>{"use strict";Object.defineProperty(t,"ZP",{enumerable:!0,get:function(){return n.default}});var n=r(a(2664));function r(e){return e&&e.__esModule?e:{default:e}}r.__bit_component={id:"teambit.react/content/react-overview@1.95.0",homepage:"https://bit.dev/teambit/react/content/react-overview",exported:!0}},2664:(e,t,a)=>{"use strict";var n={id:"teambit.react/content/react-overview@1.95.0",homepage:"https://bit.dev/teambit/react/content/react-overview",exported:!0};Object.defineProperty(t,"__esModule",{value:!0}),t.default=s;m(a(63804));var r=a(85057),d=a(58459),i=["components"];function m(e){return e&&e.__esModule?e:{default:e}}function o(){return o=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var n in a)Object.prototype.hasOwnProperty.call(a,n)&&(e[n]=a[n])}return e},o.apply(this,arguments)}function p(e,t){if(null==e)return{};var a,n,r=l(e,t);if(Object.getOwnPropertySymbols){var d=Object.getOwnPropertySymbols(e);for(n=0;n<d.length;n++)a=d[n],t.indexOf(a)>=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(r[a]=e[a])}return r}function l(e,t){if(null==e)return{};var a,n,r={},d=Object.keys(e);for(n=0;n<d.length;n++)a=d[n],t.indexOf(a)>=0||(r[a]=e[a]);return r}m.__bit_component=n,o.__bit_component=n,p.__bit_component=n,l.__bit_component=n;var c={};function s(e){var t=e.components,a=p(e,i);return(0,r.mdx)("wrapper",o({},c,a,{components:t,mdxType:"MDXLayout"}),(0,r.mdx)(d.MDXScopeProvider,{components:{},mdxType:"MDXScopeProvider"},(0,r.mdx)("h1",null,"React Overview"),(0,r.mdx)("p",null,"React is teambit's Component Development Environment (Env) for React.\nIt enables you to quickly set up a dev environment that follows best practices for React component development."),(0,r.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,r.mdx)("h2",null,"Using the React env"),(0,r.mdx)("p",null,"To use React Env, apply it on the relevant ",(0,r.mdx)("a",{parentName:"p",href:"/docs/workspace/variants"},"variants")," (component selections) in your ",(0,r.mdx)("a",{parentName:"p",href:"/docs/workspace/workspace-configuration"},"Workspace config"),":"),(0,r.mdx)("pre",null,(0,r.mdx)("code",{parentName:"pre",className:"language-json",metastring:'title="workspace.jsonc"',title:'"workspace.jsonc"'},'{\n "teambit.workspace/variants": {\n "{ui/**}": {\n "teambit.react/react": {}\n }\n }\n}\n')),(0,r.mdx)("h2",null,"Creating Components"),(0,r.mdx)("p",null,"React env provides a set of component templates that can be used to speed-up and standardize your component development:"),(0,r.mdx)("p",null,"To list all available templates:"),(0,r.mdx)("pre",null,(0,r.mdx)("code",{parentName:"pre",className:"language-bash"},"bit templates\n")),(0,r.mdx)("ul",null,(0,r.mdx)("li",{parentName:"ul"},(0,r.mdx)("inlineCode",{parentName:"li"},"react")," a basic React UI component."),(0,r.mdx)("li",{parentName:"ul"},(0,r.mdx)("inlineCode",{parentName:"li"},"react-context")," a react context component."),(0,r.mdx)("li",{parentName:"ul"},(0,r.mdx)("inlineCode",{parentName:"li"},"react-hook")," a react hook component."),(0,r.mdx)("li",{parentName:"ul"},(0,r.mdx)("inlineCode",{parentName:"li"},"mdx-component")," an MDX component."),(0,r.mdx)("li",{parentName:"ul"},(0,r.mdx)("inlineCode",{parentName:"li"},"react-component-js")," a basic React component in JS."),(0,r.mdx)("li",{parentName:"ul"},(0,r.mdx)("inlineCode",{parentName:"li"},"react-env")," boilerplate for a customized environment configuration.")),(0,r.mdx)("p",null,"Use any of these templates with the ",(0,r.mdx)("inlineCode",{parentName:"p"},"bit create")," command:"),(0,r.mdx)("pre",null,(0,r.mdx)("code",{parentName:"pre",className:"language-bash"},"bit create react ui/my-welcome\n")),(0,r.mdx)("h2",null,"Development services and configurations"),(0,r.mdx)("p",null,"The table below lists ",(0,r.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,r.mdx)("p",null,"To customize and extend the React env, ",(0,r.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,r.mdx)("table",null,(0,r.mdx)("thead",{parentName:"table"},(0,r.mdx)("tr",{parentName:"thead"},(0,r.mdx)("th",{parentName:"tr",align:null},"Service"),(0,r.mdx)("th",{parentName:"tr",align:null},"Aspect"),(0,r.mdx)("th",{parentName:"tr",align:null},"Default config"),(0,r.mdx)("th",{parentName:"tr",align:null},"Customization"))),(0,r.mdx)("tbody",{parentName:"table"},(0,r.mdx)("tr",{parentName:"tbody"},(0,r.mdx)("td",{parentName:"tr",align:null},(0,r.mdx)("a",{parentName:"td",href:"/docs/dev-services/compiler/compiler-overview"},"Compiler")),(0,r.mdx)("td",{parentName:"tr",align:null},(0,r.mdx)("a",{parentName:"td",href:"https://bit.dev/teambit/typescript/typescript"},"TypeScript")),(0,r.mdx)("td",{parentName:"tr",align:null},(0,r.mdx)("a",{parentName:"td",href:"https://bit.dev/teambit/react/react/~code/typescript/tsconfig.json"},"tsconfig.json")),(0,r.mdx)("td",{parentName:"tr",align:null},"\u2022 ",(0,r.mdx)("a",{parentName:"td",href:"/frameworks/react/config-react-tools#typescript"},"TS compilation config")," ",(0,r.mdx)("br",null)," \u2022 ",(0,r.mdx)("a",{parentName:"td",href:"/docs/dev-services/compiler/configure-env-with-compiler"},"Replace compiler"))),(0,r.mdx)("tr",{parentName:"tbody"},(0,r.mdx)("td",{parentName:"tr",align:null},(0,r.mdx)("a",{parentName:"td",href:"/tester/overview"},"Tester")),(0,r.mdx)("td",{parentName:"tr",align:null},(0,r.mdx)("a",{parentName:"td",href:"https://bit.dev/teambit/defender/jest"},"Jest")),(0,r.mdx)("td",{parentName:"tr",align:null},(0,r.mdx)("a",{parentName:"td",href:"https://bit.dev/teambit/react/react/~code/jest/jest.config.js"},"jest.config.js")),(0,r.mdx)("td",{parentName:"tr",align:null},"\u2022 ",(0,r.mdx)("a",{parentName:"td",href:"/frameworks/react/config-react-tools#jest"},"Jest config")," ",(0,r.mdx)("br",null)," \u2022 ",(0,r.mdx)("a",{parentName:"td",href:"/dev-services/tester/configure-env-with-tester"},"Replace Tester"))),(0,r.mdx)("tr",{parentName:"tbody"},(0,r.mdx)("td",{parentName:"tr",align:null},(0,r.mdx)("a",{parentName:"td",href:"/linter/overview"},"Linting")),(0,r.mdx)("td",{parentName:"tr",align:null},(0,r.mdx)("a",{parentName:"td",href:"https://bit.dev/teambit/defender/eslint"},"ESLint")),(0,r.mdx)("td",{parentName:"tr",align:null},(0,r.mdx)("a",{parentName:"td",href:"https://bit.dev/teambit/react/react/~code/eslint/eslintrc.ts"},"eslintrc.ts")),(0,r.mdx)("td",{parentName:"tr",align:null},"\u2022 ",(0,r.mdx)("a",{parentName:"td",href:"/frameworks/react/config-react-tools#eslint"},"ESLint Config")," ",(0,r.mdx)("br",null)," \u2022 ",(0,r.mdx)("a",{parentName:"td",href:"/dev-services/linter/configure-env-with-linter"},"Replace Linter"))),(0,r.mdx)("tr",{parentName:"tbody"},(0,r.mdx)("td",{parentName:"tr",align:null},(0,r.mdx)("a",{parentName:"td",href:"/formatter/overview"},"Formatter")),(0,r.mdx)("td",{parentName:"tr",align:null},(0,r.mdx)("a",{parentName:"td",href:"https://bit.dev/teambit/defender/prettier"},"Prettier")),(0,r.mdx)("td",{parentName:"tr",align:null},(0,r.mdx)("a",{parentName:"td",href:"https://bit.dev/teambit/react/react/~code/prettier/prettier.config.js"},"prettier.config.ts")),(0,r.mdx)("td",{parentName:"tr",align:null},"\u2022 ",(0,r.mdx)("a",{parentName:"td",href:"/frameworks/react/config-react-tools#prettier"},"Prettier config")," ",(0,r.mdx)("br",null)," \u2022 ",(0,r.mdx)("a",{parentName:"td",href:"/dev-services/formatter/configure-env-with-formatter"},"Replace Formatter"))),(0,r.mdx)("tr",{parentName:"tbody"},(0,r.mdx)("td",{parentName:"tr",align:null},"DevServer"),(0,r.mdx)("td",{parentName:"tr",align:null},(0,r.mdx)("a",{parentName:"td",href:"https://bit.dev/teambit/webpack/webpack"},"Webpack")),(0,r.mdx)("td",{parentName:"tr",align:null},(0,r.mdx)("a",{parentName:"td",href:"https://bit.dev/teambit/react/react/~code/webpack/webpack.config.preview.dev.ts"},"webpack.config.preview.dev.ts")),(0,r.mdx)("td",{parentName:"tr",align:null},"\u2022 Webpack config (for bundling in the workspace)")),(0,r.mdx)("tr",{parentName:"tbody"},(0,r.mdx)("td",{parentName:"tr",align:null},(0,r.mdx)("a",{parentName:"td",href:"/docs/dev-services/preview/overview"},"Preview")),(0,r.mdx)("td",{parentName:"tr",align:null},"-"),(0,r.mdx)("td",{parentName:"tr",align:null}),(0,r.mdx)("td",{parentName:"tr",align:null},"\u2022 ",(0,r.mdx)("a",{parentName:"td",href:"/dev-services/preview/register-custom-preview"},"Add preview"))),(0,r.mdx)("tr",{parentName:"tbody"},(0,r.mdx)("td",{parentName:"tr",align:null},(0,r.mdx)("a",{parentName:"td",href:"/docs/packages/packages-overview"},"Package")),(0,r.mdx)("td",{parentName:"tr",align:null},"-"),(0,r.mdx)("td",{parentName:"tr",align:null},"See the ",(0,r.mdx)("a",{parentName:"td",href:"https://bit.dev/teambit/typescript/typescript/~code/typescript.main.runtime.ts"},"TypeScript Aspect")," config"),(0,r.mdx)("td",{parentName:"tr",align:null},"\u2022 ",(0,r.mdx)("a",{parentName:"td",href:"/packages/managing-package-json#set-configuration-from-an-env"},"Add Env package config")," ",(0,r.mdx)("br",null)," \u2022 TypeScript's package config")),(0,r.mdx)("tr",{parentName:"tbody"},(0,r.mdx)("td",{parentName:"tr",align:null},"Bundler"),(0,r.mdx)("td",{parentName:"tr",align:null},(0,r.mdx)("a",{parentName:"td",href:"https://bit.dev/teambit/webpack/webpack"},"Webpack")),(0,r.mdx)("td",{parentName:"tr",align:null},(0,r.mdx)("a",{parentName:"td",href:"https://bit.dev/teambit/react/react/~code/webpack/webpack.config.preview.ts"},"webpack.config.preview.ts")),(0,r.mdx)("td",{parentName:"tr",align:null},"\u2022 Webpack config (for bundling during build)")),(0,r.mdx)("tr",{parentName:"tbody"},(0,r.mdx)("td",{parentName:"tr",align:null},(0,r.mdx)("a",{parentName:"td",href:"/docs/dev-services/docs/docs-overview"},"Documentation")),(0,r.mdx)("td",{parentName:"tr",align:null},"-"),(0,r.mdx)("td",{parentName:"tr",align:null},(0,r.mdx)("a",{parentName:"td",href:"https://bit.dev/teambit/react/react/~code/docs/index.tsx"},"Docs template")),(0,r.mdx)("td",{parentName:"tr",align:null},(0,r.mdx)("a",{parentName:"td",href:"/docs/dev-services/docs/docs-templates"},"Replace docs template"))),(0,r.mdx)("tr",{parentName:"tbody"},(0,r.mdx)("td",{parentName:"tr",align:null},(0,r.mdx)("a",{parentName:"td",href:"http://localhost:3000/docs/dev-services/builder/builder-overview"},"Builder")),(0,r.mdx)("td",{parentName:"tr",align:null},"-"),(0,r.mdx)("td",{parentName:"tr",align:null},(0,r.mdx)("a",{parentName:"td",href:"http://localhost:3000/docs/dev-services/builder/builder-overview"},"Build pipeline")),(0,r.mdx)("td",{parentName:"tr",align:null},(0,r.mdx)("a",{parentName:"td",href:"/dev-services/builder/build-pipelines"},"Build pipelines"))),(0,r.mdx)("tr",{parentName:"tbody"},(0,r.mdx)("td",{parentName:"tr",align:null},(0,r.mdx)("a",{parentName:"td",href:"/dependencies/dependencies-overview"},"Dependencies")),(0,r.mdx)("td",{parentName:"tr",align:null},"-"),(0,r.mdx)("td",{parentName:"tr",align:null},(0,r.mdx)("a",{parentName:"td",href:"https://bit.dev/teambit/react/react/~code/react.env.ts"},"Env-dependencies")),(0,r.mdx)("td",{parentName:"tr",align:null},(0,r.mdx)("a",{parentName:"td",href:"/dependencies/configuring-dependencies#configuring-dependencies-from-an-env"},"Env dependencies"))),(0,r.mdx)("tr",{parentName:"tbody"},(0,r.mdx)("td",{parentName:"tr",align:null},(0,r.mdx)("a",{parentName:"td",href:"/docs/dev-services/generator/generator-overview"},"Generator")),(0,r.mdx)("td",{parentName:"tr",align:null},"-"),(0,r.mdx)("td",{parentName:"tr",align:null},(0,r.mdx)("a",{parentName:"td",href:"https://bit.dev/teambit/react/react/~code/templates/react-component.ts"},"React templates")),(0,r.mdx)("td",{parentName:"tr",align:null},(0,r.mdx)("a",{parentName:"td",href:""},"Add a component template"))))),(0,r.mdx)("h3",null,"Default React versions"),(0,r.mdx)("p",null,"By default, the React env sets the following dependency versions for components using it:"),(0,r.mdx)("ul",null,(0,r.mdx)("li",{parentName:"ul"},(0,r.mdx)("strong",{parentName:"li"},"react")," (peer dependency): ",(0,r.mdx)("inlineCode",{parentName:"li"},"^16.8.0 || ^17.0.0")),(0,r.mdx)("li",{parentName:"ul"},(0,r.mdx)("strong",{parentName:"li"},"react-dom")," (peer dependency): ",(0,r.mdx)("inlineCode",{parentName:"li"},"^16.8.0 || ^17.0.0")),(0,r.mdx)("li",{parentName:"ul"},(0,r.mdx)("strong",{parentName:"li"},"@types/react"),": ",(0,r.mdx)("inlineCode",{parentName:"li"},"^17.0.8")),(0,r.mdx)("li",{parentName:"ul"},(0,r.mdx)("strong",{parentName:"li"},"@types/react-dom"),": ",(0,r.mdx)("inlineCode",{parentName:"li"},"^17.0.5")))))}s.__bit_component=n,s.isMDXComponent=!0},90955:(e,t,a)=>{"use strict";var n={id:"teambit.react/react@0.0.691",homepage:"https://bit.dev/teambit/react/react",exported:!0},r=a(88244);function d(){const e=r(a(63804));return d=function(){return e},e}Object.defineProperty(t,"__esModule",{value:!0}),t.Logo=void 0,d.__bit_component=n;const i=()=>d().default.createElement("div",{style:{height:"100%",display:"flex",justifyContent:"center"}},d().default.createElement("img",{style:{width:70},src:"https://static.bit.dev/extensions-icons/react.svg"}));i.__bit_component=n,t.Logo=i},85057:e=>{"use strict";e.exports=MdxJsReact},63804:e=>{"use strict";e.exports=React},58459:e=>{"use strict";e.exports=TeambitMdxUiMdxScopeContext}},t={};function a(n){var r=t[n];if(void 0!==r)return r.exports;var d=t[n]={exports:{}};return e[n](d,d.exports,a),d.exports}a.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return a.d(t,{a:t}),t},a.d=(e,t)=>{for(var n in t)a.o(t,n)&&!a.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},a.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),a.r=e=>{"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var n={};return(()=>{"use strict";a.r(n),a.d(n,{compositions:()=>e,overview:()=>t});const e=[a(90955)],t=[a(56155)]})(),n})()}));
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},52290:(__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
+ 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
+ "teambit.workspace/variants": {
4
+ "{ui/**}": {
5
+ "teambit.react/react": {}
6
+ }
7
+ }
8
+ }
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
+ `)),(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},19888:(__unused_webpack_module,exports2,__webpack_require__2)=>{"use strict";var __bit_component={id:"teambit.react/react@0.0.694",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__(19888)],overview=[__webpack_require__(52290)]})(),__webpack_exports__})()});
@@ -41,6 +41,26 @@ function _toolboxNetwork() {
41
41
  return data;
42
42
  }
43
43
 
44
+ function _lodash() {
45
+ const data = require("lodash");
46
+
47
+ _lodash = function () {
48
+ return data;
49
+ };
50
+
51
+ return data;
52
+ }
53
+
54
+ function _terserWebpackPlugin() {
55
+ const data = _interopRequireDefault(require("terser-webpack-plugin"));
56
+
57
+ _terserWebpackPlugin = function () {
58
+ return data;
59
+ };
60
+
61
+ return data;
62
+ }
63
+
44
64
  function _plugins() {
45
65
  const data = require("./plugins");
46
66
 
@@ -154,11 +174,30 @@ class ReactApp {
154
174
  });
155
175
 
156
176
  const defaultTransformer = configMutator => {
177
+ var _config$raw$optimizat;
178
+
157
179
  const config = configMutator.addTopLevel('output', {
158
180
  path: staticDir,
159
181
  publicPath: `/`
160
182
  });
161
183
  if (this.prerenderRoutes) config.addPlugin((0, _plugins().prerenderSPAPlugin)(this.prerenderRoutes, staticDir));
184
+
185
+ if ((_config$raw$optimizat = config.raw.optimization) !== null && _config$raw$optimizat !== void 0 && _config$raw$optimizat.minimizer) {
186
+ var _config$raw$optimizat2, _config$raw$optimizat3;
187
+
188
+ (0, _lodash().remove)((_config$raw$optimizat2 = config.raw.optimization) === null || _config$raw$optimizat2 === void 0 ? void 0 : _config$raw$optimizat2.minimizer, minimizer => {
189
+ return minimizer.constructor.name === 'TerserPlugin';
190
+ });
191
+ (_config$raw$optimizat3 = config.raw.optimization) === null || _config$raw$optimizat3 === void 0 ? void 0 : _config$raw$optimizat3.minimizer.push(new (_terserWebpackPlugin().default)({
192
+ minify: _terserWebpackPlugin().default.esbuildMinify,
193
+ // `terserOptions` options will be passed to `esbuild`
194
+ // Link to options - https://esbuild.github.io/api/#minify
195
+ terserOptions: {
196
+ minify: true
197
+ }
198
+ }));
199
+ }
200
+
162
201
  return config;
163
202
  };
164
203
 
@@ -1 +1 @@
1
- {"version":3,"sources":["react.application.ts"],"names":["ReactApp","constructor","name","entry","portRange","reactEnv","prerenderRoutes","bundler","devServer","transformers","deploy","favicon","run","context","from","to","port","Port","getPort","listen","devServerContext","getDevServerContext","getDevServer","configMutator","addTopLevel","historyApiFallback","index","disableDotRule","raw","output","publicPath","build","htmlConfig","title","templateContent","minify","Object","assign","html","getBundler","publicDir","getPublicDir","dir","getDefaultBundler","capsule","env","outputPath","path","distDir","getCompiler","entries","map","require","resolve","staticDir","bundlerContext","targets","components","component","rootPath","metaData","initiator","envId","id","defaultTransformer","config","addPlugin","applicationType"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAGA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAGA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAEA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAGO,MAAMA,QAAN,CAAsC;AAC3CC,EAAAA,WAAW,CACAC,IADA,EAEAC,KAFA,EAGAC,SAHA,EAIDC,QAJC,EAKAC,eALA,EAMAC,OANA,EAOAC,SAPA,EAQAC,YARA,EASAC,MATA,EAUAC,OAVA,EAWT;AAAA,SAVST,IAUT,GAVSA,IAUT;AAAA,SATSC,KAST,GATSA,KAST;AAAA,SARSC,SAQT,GARSA,SAQT;AAAA,SAPQC,QAOR,GAPQA,QAOR;AAAA,SANSC,eAMT,GANSA,eAMT;AAAA,SALSC,OAKT,GALSA,OAKT;AAAA,SAJSC,SAIT,GAJSA,SAIT;AAAA,SAHSC,YAGT,GAHSA,YAGT;AAAA,SAFSC,MAET,GAFSA,MAET;AAAA,SADSC,OACT,GADSA,OACT;AAAA,6DACyB,iBADzB;AAAA,iDAEa,QAFb;AAAE;;AAGK,QAAHC,G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;AA/G0C","sourcesContent":["import { join, basename } from 'path';\nimport { Application, AppContext, AppBuildContext } from '@teambit/application';\nimport { Bundler, DevServer, BundlerContext, DevServerContext, BundlerHtmlConfig } from '@teambit/bundler';\nimport { Port } from '@teambit/toolbox.network.get-port';\nimport { WebpackConfigTransformer } from '@teambit/webpack';\nimport { ReactEnv } from '../../react.env';\nimport { prerenderSPAPlugin } from './plugins';\nimport { ReactAppBuildResult } from './react-build-result';\nimport { html } from '../../webpack';\nimport { ReactDeployContext } from '.';\n\nexport class ReactApp implements Application {\n constructor(\n readonly name: string,\n readonly entry: string[],\n readonly portRange: number[],\n private reactEnv: ReactEnv,\n readonly prerenderRoutes?: string[],\n readonly bundler?: Bundler,\n readonly devServer?: DevServer,\n readonly transformers?: WebpackConfigTransformer[],\n readonly deploy?: (context: ReactDeployContext) => Promise<void>,\n readonly favicon?: string\n ) {}\n readonly applicationType = 'react-common-js';\n readonly dir = 'public';\n async run(context: AppContext): Promise<number> {\n const [from, to] = this.portRange;\n const port = await Port.getPort(from, to);\n if (this.devServer) {\n await this.devServer.listen(port);\n return port;\n }\n const devServerContext = this.getDevServerContext(context);\n const devServer = this.reactEnv.getDevServer(devServerContext, [\n (configMutator) => {\n configMutator.addTopLevel('devServer', {\n historyApiFallback: {\n index: '/index.html',\n disableDotRule: true,\n },\n });\n\n if (!configMutator.raw.output) configMutator.raw.output = {};\n configMutator.raw.output.publicPath = '/';\n\n return configMutator;\n },\n ]);\n await devServer.listen(port);\n return port;\n }\n\n async build(context: AppBuildContext): Promise<ReactAppBuildResult> {\n const htmlConfig: BundlerHtmlConfig[] = [\n {\n title: context.name,\n templateContent: html(context.name),\n minify: false,\n favicon: this.favicon,\n // filename: ''.html`,\n },\n ];\n Object.assign(context, {\n html: htmlConfig,\n });\n const bundler = await this.getBundler(context);\n await bundler.run();\n return { publicDir: `${this.getPublicDir()}/${this.dir}` };\n }\n\n private getBundler(context: AppBuildContext) {\n if (this.bundler) return this.bundler;\n return this.getDefaultBundler(context);\n }\n private async getDefaultBundler(context: AppBuildContext) {\n const { capsule } = context;\n const reactEnv: ReactEnv = context.env;\n const publicDir = this.getPublicDir();\n const outputPath = join(capsule.path, publicDir);\n const { distDir } = reactEnv.getCompiler();\n const entries = this.entry.map((entry) => require.resolve(`${capsule.path}/${distDir}/${basename(entry)}`));\n const staticDir = join(outputPath, this.dir);\n\n const bundlerContext: BundlerContext = Object.assign(context, {\n targets: [\n {\n components: [capsule?.component],\n entries,\n outputPath,\n },\n ],\n entry: [],\n rootPath: '/',\n metaData: {\n initiator: `building app: ${context.name}`,\n envId: context.id,\n },\n });\n\n const defaultTransformer: WebpackConfigTransformer = (configMutator) => {\n const config = configMutator.addTopLevel('output', { path: staticDir, publicPath: `/` });\n if (this.prerenderRoutes) config.addPlugin(prerenderSPAPlugin(this.prerenderRoutes, staticDir));\n return config;\n };\n const transformers = [defaultTransformer, ...(this.transformers ?? [])];\n const bundler: Bundler = await reactEnv.getBundler(bundlerContext, transformers);\n return bundler;\n }\n\n private getPublicDir() {\n return join(this.applicationType, this.name);\n }\n\n private getDevServerContext(context: AppContext): DevServerContext {\n return Object.assign(context, {\n entry: this.entry,\n rootPath: '',\n publicPath: `public/${this.name}`,\n title: this.name,\n favicon: this.favicon,\n });\n }\n}\n"]}
1
+ {"version":3,"sources":["react.application.ts"],"names":["ReactApp","constructor","name","entry","portRange","reactEnv","prerenderRoutes","bundler","devServer","transformers","deploy","favicon","run","context","from","to","port","Port","getPort","listen","devServerContext","getDevServerContext","getDevServer","configMutator","addTopLevel","historyApiFallback","index","disableDotRule","raw","output","publicPath","build","htmlConfig","title","templateContent","minify","Object","assign","html","getBundler","publicDir","getPublicDir","dir","getDefaultBundler","capsule","env","outputPath","path","distDir","getCompiler","entries","map","require","resolve","staticDir","bundlerContext","targets","components","component","rootPath","metaData","initiator","envId","id","defaultTransformer","config","addPlugin","optimization","minimizer","push","TerserPlugin","esbuildMinify","terserOptions","applicationType"],"mappings":";;;;;;;;;;;;;;;;;;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5B+B,MAAAA,KAAK,EAAE,KAAK/B,IAJgB;AAK5BS,MAAAA,OAAO,EAAE,KAAKA;AALc,KAAvB,CAAP;AAOD;;AA9H0C","sourcesContent":["import { join, basename } from 'path';\nimport { Application, AppContext, AppBuildContext } from '@teambit/application';\nimport { Bundler, DevServer, BundlerContext, DevServerContext, BundlerHtmlConfig } from '@teambit/bundler';\nimport { Port } from '@teambit/toolbox.network.get-port';\nimport { remove } from 'lodash';\nimport TerserPlugin from 'terser-webpack-plugin';\nimport { WebpackConfigTransformer } from '@teambit/webpack';\nimport { ReactEnv } from '../../react.env';\nimport { prerenderSPAPlugin } from './plugins';\nimport { ReactAppBuildResult } from './react-build-result';\nimport { html } from '../../webpack';\nimport { ReactDeployContext } from '.';\n\nexport class ReactApp implements Application {\n constructor(\n readonly name: string,\n readonly entry: string[],\n readonly portRange: number[],\n private reactEnv: ReactEnv,\n readonly prerenderRoutes?: string[],\n readonly bundler?: Bundler,\n readonly devServer?: DevServer,\n readonly transformers?: WebpackConfigTransformer[],\n readonly deploy?: (context: ReactDeployContext) => Promise<void>,\n readonly favicon?: string\n ) {}\n readonly applicationType = 'react-common-js';\n readonly dir = 'public';\n async run(context: AppContext): Promise<number> {\n const [from, to] = this.portRange;\n const port = await Port.getPort(from, to);\n if (this.devServer) {\n await this.devServer.listen(port);\n return port;\n }\n const devServerContext = this.getDevServerContext(context);\n const devServer = this.reactEnv.getDevServer(devServerContext, [\n (configMutator) => {\n configMutator.addTopLevel('devServer', {\n historyApiFallback: {\n index: '/index.html',\n disableDotRule: true,\n },\n });\n\n if (!configMutator.raw.output) configMutator.raw.output = {};\n configMutator.raw.output.publicPath = '/';\n\n return configMutator;\n },\n ]);\n await devServer.listen(port);\n return port;\n }\n\n async build(context: AppBuildContext): Promise<ReactAppBuildResult> {\n const htmlConfig: BundlerHtmlConfig[] = [\n {\n title: context.name,\n templateContent: html(context.name),\n minify: false,\n favicon: this.favicon,\n // filename: ''.html`,\n },\n ];\n Object.assign(context, {\n html: htmlConfig,\n });\n const bundler = await this.getBundler(context);\n await bundler.run();\n return { publicDir: `${this.getPublicDir()}/${this.dir}` };\n }\n\n private getBundler(context: AppBuildContext) {\n if (this.bundler) return this.bundler;\n return this.getDefaultBundler(context);\n }\n private async getDefaultBundler(context: AppBuildContext) {\n const { capsule } = context;\n const reactEnv: ReactEnv = context.env;\n const publicDir = this.getPublicDir();\n const outputPath = join(capsule.path, publicDir);\n const { distDir } = reactEnv.getCompiler();\n const entries = this.entry.map((entry) => require.resolve(`${capsule.path}/${distDir}/${basename(entry)}`));\n const staticDir = join(outputPath, this.dir);\n\n const bundlerContext: BundlerContext = Object.assign(context, {\n targets: [\n {\n components: [capsule?.component],\n entries,\n outputPath,\n },\n ],\n entry: [],\n rootPath: '/',\n metaData: {\n initiator: `building app: ${context.name}`,\n envId: context.id,\n },\n });\n\n const defaultTransformer: WebpackConfigTransformer = (configMutator) => {\n const config = configMutator.addTopLevel('output', { path: staticDir, publicPath: `/` });\n if (this.prerenderRoutes) config.addPlugin(prerenderSPAPlugin(this.prerenderRoutes, staticDir));\n if (config.raw.optimization?.minimizer) {\n remove(config.raw.optimization?.minimizer, (minimizer) => {\n return minimizer.constructor.name === 'TerserPlugin';\n });\n config.raw.optimization?.minimizer.push(\n new TerserPlugin({\n minify: TerserPlugin.esbuildMinify,\n // `terserOptions` options will be passed to `esbuild`\n // Link to options - https://esbuild.github.io/api/#minify\n terserOptions: {\n minify: true,\n },\n })\n );\n }\n return config;\n };\n const transformers = [defaultTransformer, ...(this.transformers ?? [])];\n const bundler: Bundler = await reactEnv.getBundler(bundlerContext, transformers);\n return bundler;\n }\n\n private getPublicDir() {\n return join(this.applicationType, this.name);\n }\n\n private getDevServerContext(context: AppContext): DevServerContext {\n return Object.assign(context, {\n entry: this.entry,\n rootPath: '',\n publicPath: `public/${this.name}`,\n title: this.name,\n favicon: this.favicon,\n });\n }\n}\n"]}
@@ -73,44 +73,59 @@ function _default(externalizePeer, peers, dev) {
73
73
  };
74
74
  const optimization = dev ? undefined : {
75
75
  minimize: true,
76
- minimizer: [// This is only used in production mode
77
- new (_terserWebpackPlugin().default)({
78
- extractComments: false,
76
+ minimizer: [new (_terserWebpackPlugin().default)({
77
+ minify: _terserWebpackPlugin().default.esbuildMinify,
78
+ // `terserOptions` options will be passed to `esbuild`
79
+ // Link to options - https://esbuild.github.io/api/#minify
80
+ // Note: the `minify` options is true by default (and override other `minify*` options), so if you want to disable the `minifyIdentifiers` option (or other `minify*` options) please use:
79
81
  terserOptions: {
80
- parse: {
81
- // We want terser to parse ecma 8 code. However, we don't want it
82
- // to apply any minification steps that turns valid ecma 5 code
83
- // into invalid ecma 5 code. This is why the 'compress' and 'output'
84
- // sections only apply transformations that are ecma 5 safe
85
- // https://github.com/facebook/create-react-app/pull/4234
86
- ecma: 8
87
- },
88
- compress: {
89
- ecma: 5,
90
- warnings: false,
91
- // Disabled because of an issue with Uglify breaking seemingly valid code:
92
- // https://github.com/facebook/create-react-app/issues/2376
93
- // Pending further investigation:
94
- // https://github.com/mishoo/UglifyJS2/issues/2011
95
- comparisons: false,
96
- // Disabled because of an issue with Terser breaking valid code:
97
- // https://github.com/facebook/create-react-app/issues/5250
98
- // Pending further investigation:
99
- // https://github.com/terser-js/terser/issues/120
100
- inline: 2
101
- },
102
- mangle: {
103
- safari10: true
104
- },
105
- output: {
106
- ecma: 5,
107
- comments: false,
108
- // Turned on because emoji and regex is not minified properly using default
109
- // https://github.com/facebook/create-react-app/issues/2488
110
- ascii_only: true
111
- }
112
- }
113
- }), new (_cssMinimizerWebpackPlugin().default)({
82
+ minify: false,
83
+ minifyWhitespace: true,
84
+ // We don't want to minify identifiers to enable easier debugging on remote scopes when there are preview issues
85
+ minifyIdentifiers: false,
86
+ // minifyIdentifiers: true,
87
+ minifySyntax: true
88
+ } // terserOptions: {},
89
+
90
+ }), // This is only used in production mode
91
+ // new TerserPlugin({
92
+ // extractComments: false,
93
+ // terserOptions: {
94
+ // parse: {
95
+ // // We want terser to parse ecma 8 code. However, we don't want it
96
+ // // to apply any minification steps that turns valid ecma 5 code
97
+ // // into invalid ecma 5 code. This is why the 'compress' and 'output'
98
+ // // sections only apply transformations that are ecma 5 safe
99
+ // // https://github.com/facebook/create-react-app/pull/4234
100
+ // ecma: 8,
101
+ // },
102
+ // compress: {
103
+ // ecma: 5,
104
+ // warnings: false,
105
+ // // Disabled because of an issue with Uglify breaking seemingly valid code:
106
+ // // https://github.com/facebook/create-react-app/issues/2376
107
+ // // Pending further investigation:
108
+ // // https://github.com/mishoo/UglifyJS2/issues/2011
109
+ // comparisons: false,
110
+ // // Disabled because of an issue with Terser breaking valid code:
111
+ // // https://github.com/facebook/create-react-app/issues/5250
112
+ // // Pending further investigation:
113
+ // // https://github.com/terser-js/terser/issues/120
114
+ // inline: 2,
115
+ // },
116
+ // mangle: {
117
+ // safari10: true,
118
+ // },
119
+ // output: {
120
+ // ecma: 5,
121
+ // comments: false,
122
+ // // Turned on because emoji and regex is not minified properly using default
123
+ // // https://github.com/facebook/create-react-app/issues/2488
124
+ // ascii_only: true,
125
+ // },
126
+ // },
127
+ // }),
128
+ new (_cssMinimizerWebpackPlugin().default)({
114
129
  minimizerOptions: {
115
130
  preset: ['default', {
116
131
  minifyFontValues: {
@@ -1 +1 @@
1
- {"version":3,"sources":["webpack.config.base.prod.ts"],"names":["externalizePeer","peers","dev","externals","undefined","exposedRules","module","rules","optimization","minimize","minimizer","TerserPlugin","extractComments","terserOptions","parse","ecma","compress","warnings","comparisons","inline","mangle","safari10","output","comments","ascii_only","CssMinimizerPlugin","minimizerOptions","preset","minifyFontValues","removeQuotes","plugins","WorkboxWebpackPlugin","GenerateSW","clientsClaim","exclude","navigateFallback","navigateFallbackDenylist","RegExp","filter","Boolean","performance"],"mappings":";;;;;;;;;;;;;AAAA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;A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,UAAAA,gBAAgB,EAAE;AAAEC,YAAAA,YAAY,EAAE;AAAhB;AADpB,SAFM;AADQ;AADG,KAAvB,CAvCS,CAFb,CAoDE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAhEF,GAFJ;AAqEA,SAAO;AACLvB,IAAAA,MADK;AAELH,IAAAA,SAFK;AAGLK,IAAAA,YAHK;AAKLsB,IAAAA,OAAO,EAAE,CACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAIC,gCAAqBC,UAAzB,EAAoC;AAClCC,MAAAA,YAAY,EAAE,IADoB;AAElCC,MAAAA,OAAO,EAAE,CAAC,QAAD,EAAW,uBAAX,CAFyB;AAGlC;AACAC,MAAAA,gBAAgB,EAAE,mBAJgB;AAKlCC,MAAAA,wBAAwB,EAAE,CACxB;AACA,UAAIC,MAAJ,CAAW,KAAX,CAFwB,EAGxB;AACA;AACA;AACA;AACA,UAAIA,MAAJ,CAAW,kBAAX,CAPwB;AALQ,KAApC,CAzBO,EAwCPC,MAxCO,CAwCAC,OAxCA,CALJ;AA8CL;AACA;AACAC,IAAAA,WAAW,EAAE;AAhDR,GAAP;AAkDD","sourcesContent":["import WorkboxWebpackPlugin from 'workbox-webpack-plugin';\nimport CssMinimizerPlugin from 'css-minimizer-webpack-plugin';\nimport TerserPlugin from 'terser-webpack-plugin';\nimport { Configuration } from 'webpack';\nimport { getExternals } from './get-externals';\nimport { getExposedRules } from './get-exposed-rules';\n// import { WebpackManifestPlugin } from 'webpack-manifest-plugin';\n\n// This is the production and development configuration.\n// It is focused on developer experience, fast rebuilds, and a minimal bundle.\n// eslint-disable-next-line complexity\nexport default function (externalizePeer: boolean, peers: string[], dev?: boolean): Configuration {\n const externals = externalizePeer ? (getExternals(peers) as any) : undefined;\n const exposedRules = externalizePeer ? undefined : getExposedRules(peers);\n\n const module = externalizePeer\n ? undefined\n : {\n rules: exposedRules,\n };\n\n const optimization = dev\n ? undefined\n : {\n minimize: true,\n minimizer: [\n // This is only used in production mode\n new TerserPlugin({\n extractComments: false,\n terserOptions: {\n parse: {\n // We want terser to parse ecma 8 code. However, we don't want it\n // to apply any minification steps that turns valid ecma 5 code\n // into invalid ecma 5 code. This is why the 'compress' and 'output'\n // sections only apply transformations that are ecma 5 safe\n // https://github.com/facebook/create-react-app/pull/4234\n ecma: 8,\n },\n compress: {\n ecma: 5,\n warnings: false,\n // Disabled because of an issue with Uglify breaking seemingly valid code:\n // https://github.com/facebook/create-react-app/issues/2376\n // Pending further investigation:\n // https://github.com/mishoo/UglifyJS2/issues/2011\n comparisons: false,\n // Disabled because of an issue with Terser breaking valid code:\n // https://github.com/facebook/create-react-app/issues/5250\n // Pending further investigation:\n // https://github.com/terser-js/terser/issues/120\n inline: 2,\n },\n mangle: {\n safari10: true,\n },\n output: {\n ecma: 5,\n comments: false,\n // Turned on because emoji and regex is not minified properly using default\n // https://github.com/facebook/create-react-app/issues/2488\n ascii_only: true,\n },\n },\n }),\n new CssMinimizerPlugin({\n minimizerOptions: {\n preset: [\n 'default',\n {\n minifyFontValues: { removeQuotes: false },\n },\n ],\n },\n }),\n ],\n // Automatically split vendor and commons\n // https://twitter.com/wSokra/status/969633336732905474\n // https://medium.com/webpack/webpack-4-code-splitting-chunk-graph-and-the-splitchunks-optimization-be739a861366\n // splitChunks: {\n // chunks: 'all',\n // name: false,\n // },\n // Keep the runtime chunk separated to enable long term caching\n // https://twitter.com/wSokra/status/969679223278505985\n // https://github.com/facebook/create-react-app/issues/5358\n // runtimeChunk: {\n // name: (entrypoint) => `runtime-${entrypoint.name}`,\n // },\n };\n\n return {\n module,\n externals,\n optimization,\n\n plugins: [\n // Generate an asset manifest file with the following content:\n // - \"files\" key: Mapping of all asset filenames to their corresponding\n // output file so that tools can pick it up without having to parse\n // `index.html`\n // can be used to reconstruct the HTML if necessary\n // new WebpackManifestPlugin({\n // fileName: 'asset-manifest.json',\n // publicPath: 'public',\n // generate: (seed, files, entrypoints) => {\n // const manifestFiles = files.reduce((manifest, file) => {\n // manifest[file.name] = file.path;\n // return manifest;\n // }, seed);\n // const entrypointFiles = entrypoints.main.filter((fileName) => !fileName.endsWith('.map'));\n\n // // @ts-ignore - https://github.com/shellscape/webpack-manifest-plugin/issues/276\n // return {\n // files: manifestFiles,\n // entrypoints: entrypointFiles,\n // } as Record<string, string>;\n // },\n // }),\n // Generate a service worker script that will precache, and keep up to date,\n // the HTML & assets that are part of the webpack build.\n new WorkboxWebpackPlugin.GenerateSW({\n clientsClaim: true,\n exclude: [/\\.map$/, /asset-manifest\\.json$/],\n // importWorkboxFrom: 'cdn',\n navigateFallback: 'public/index.html',\n navigateFallbackDenylist: [\n // Exclude URLs starting with /_, as they're likely an API call\n new RegExp('^/_'),\n // Exclude any URLs whose last part seems to be a file extension\n // as they're likely a resource and not a SPA route.\n // URLs containing a \"?\" character won't be blacklisted as they're likely\n // a route with query params (e.g. auth callbacks).\n new RegExp('/[^/?]+\\\\.[^/]+$'),\n ],\n }),\n ].filter(Boolean),\n // Turn off performance processing because we utilize\n // our own hints via the FileSizeReporter\n performance: false,\n };\n}\n"]}
1
+ {"version":3,"sources":["webpack.config.base.prod.ts"],"names":["externalizePeer","peers","dev","externals","undefined","exposedRules","module","rules","optimization","minimize","minimizer","TerserPlugin","minify","esbuildMinify","terserOptions","minifyWhitespace","minifyIdentifiers","minifySyntax","CssMinimizerPlugin","minimizerOptions","preset","minifyFontValues","removeQuotes","plugins","WorkboxWebpackPlugin","GenerateSW","clientsClaim","exclude","navigateFallback","navigateFallbackDenylist","RegExp","filter","Boolean","performance"],"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;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hFF,GAFJ;AAqFA,SAAO;AACLhB,IAAAA,MADK;AAELH,IAAAA,SAFK;AAGLK,IAAAA,YAHK;AAKLe,IAAAA,OAAO,EAAE,CACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAIC,gCAAqBC,UAAzB,EAAoC;AAClCC,MAAAA,YAAY,EAAE,IADoB;AAElCC,MAAAA,OAAO,EAAE,CAAC,QAAD,EAAW,uBAAX,CAFyB;AAGlC;AACAC,MAAAA,gBAAgB,EAAE,mBAJgB;AAKlCC,MAAAA,wBAAwB,EAAE,CACxB;AACA,UAAIC,MAAJ,CAAW,KAAX,CAFwB,EAGxB;AACA;AACA;AACA;AACA,UAAIA,MAAJ,CAAW,kBAAX,CAPwB;AALQ,KAApC,CAzBO,EAwCPC,MAxCO,CAwCAC,OAxCA,CALJ;AA8CL;AACA;AACAC,IAAAA,WAAW,EAAE;AAhDR,GAAP;AAkDD","sourcesContent":["import WorkboxWebpackPlugin from 'workbox-webpack-plugin';\nimport CssMinimizerPlugin from 'css-minimizer-webpack-plugin';\nimport TerserPlugin from 'terser-webpack-plugin';\nimport { Configuration } from 'webpack';\nimport { getExternals } from './get-externals';\nimport { getExposedRules } from './get-exposed-rules';\n// import { WebpackManifestPlugin } from 'webpack-manifest-plugin';\n\n// This is the production and development configuration.\n// It is focused on developer experience, fast rebuilds, and a minimal bundle.\n// eslint-disable-next-line complexity\nexport default function (externalizePeer: boolean, peers: string[], dev?: boolean): Configuration {\n const externals = externalizePeer ? (getExternals(peers) as any) : undefined;\n const exposedRules = externalizePeer ? undefined : getExposedRules(peers);\n\n const module = externalizePeer\n ? undefined\n : {\n rules: exposedRules,\n };\n\n const optimization = dev\n ? undefined\n : {\n minimize: true,\n minimizer: [\n new TerserPlugin({\n minify: TerserPlugin.esbuildMinify,\n // `terserOptions` options will be passed to `esbuild`\n // Link to options - https://esbuild.github.io/api/#minify\n // Note: the `minify` options is true by default (and override other `minify*` options), so if you want to disable the `minifyIdentifiers` option (or other `minify*` options) please use:\n terserOptions: {\n minify: false,\n minifyWhitespace: true,\n // We don't want to minify identifiers to enable easier debugging on remote scopes when there are preview issues\n minifyIdentifiers: false,\n // minifyIdentifiers: true,\n minifySyntax: true,\n },\n // terserOptions: {},\n }),\n\n // This is only used in production mode\n // new TerserPlugin({\n // extractComments: false,\n // terserOptions: {\n // parse: {\n // // We want terser to parse ecma 8 code. However, we don't want it\n // // to apply any minification steps that turns valid ecma 5 code\n // // into invalid ecma 5 code. This is why the 'compress' and 'output'\n // // sections only apply transformations that are ecma 5 safe\n // // https://github.com/facebook/create-react-app/pull/4234\n // ecma: 8,\n // },\n // compress: {\n // ecma: 5,\n // warnings: false,\n // // Disabled because of an issue with Uglify breaking seemingly valid code:\n // // https://github.com/facebook/create-react-app/issues/2376\n // // Pending further investigation:\n // // https://github.com/mishoo/UglifyJS2/issues/2011\n // comparisons: false,\n // // Disabled because of an issue with Terser breaking valid code:\n // // https://github.com/facebook/create-react-app/issues/5250\n // // Pending further investigation:\n // // https://github.com/terser-js/terser/issues/120\n // inline: 2,\n // },\n // mangle: {\n // safari10: true,\n // },\n // output: {\n // ecma: 5,\n // comments: false,\n // // Turned on because emoji and regex is not minified properly using default\n // // https://github.com/facebook/create-react-app/issues/2488\n // ascii_only: true,\n // },\n // },\n // }),\n new CssMinimizerPlugin({\n minimizerOptions: {\n preset: [\n 'default',\n {\n minifyFontValues: { removeQuotes: false },\n },\n ],\n },\n }),\n ],\n // Automatically split vendor and commons\n // https://twitter.com/wSokra/status/969633336732905474\n // https://medium.com/webpack/webpack-4-code-splitting-chunk-graph-and-the-splitchunks-optimization-be739a861366\n // splitChunks: {\n // chunks: 'all',\n // name: false,\n // },\n // Keep the runtime chunk separated to enable long term caching\n // https://twitter.com/wSokra/status/969679223278505985\n // https://github.com/facebook/create-react-app/issues/5358\n // runtimeChunk: {\n // name: (entrypoint) => `runtime-${entrypoint.name}`,\n // },\n };\n\n return {\n module,\n externals,\n optimization,\n\n plugins: [\n // Generate an asset manifest file with the following content:\n // - \"files\" key: Mapping of all asset filenames to their corresponding\n // output file so that tools can pick it up without having to parse\n // `index.html`\n // can be used to reconstruct the HTML if necessary\n // new WebpackManifestPlugin({\n // fileName: 'asset-manifest.json',\n // publicPath: 'public',\n // generate: (seed, files, entrypoints) => {\n // const manifestFiles = files.reduce((manifest, file) => {\n // manifest[file.name] = file.path;\n // return manifest;\n // }, seed);\n // const entrypointFiles = entrypoints.main.filter((fileName) => !fileName.endsWith('.map'));\n\n // // @ts-ignore - https://github.com/shellscape/webpack-manifest-plugin/issues/276\n // return {\n // files: manifestFiles,\n // entrypoints: entrypointFiles,\n // } as Record<string, string>;\n // },\n // }),\n // Generate a service worker script that will precache, and keep up to date,\n // the HTML & assets that are part of the webpack build.\n new WorkboxWebpackPlugin.GenerateSW({\n clientsClaim: true,\n exclude: [/\\.map$/, /asset-manifest\\.json$/],\n // importWorkboxFrom: 'cdn',\n navigateFallback: 'public/index.html',\n navigateFallbackDenylist: [\n // Exclude URLs starting with /_, as they're likely an API call\n new RegExp('^/_'),\n // Exclude any URLs whose last part seems to be a file extension\n // as they're likely a resource and not a SPA route.\n // URLs containing a \"?\" character won't be blacklisted as they're likely\n // a route with query params (e.g. auth callbacks).\n new RegExp('/[^/?]+\\\\.[^/]+$'),\n ],\n }),\n ].filter(Boolean),\n // Turn off performance processing because we utilize\n // our own hints via the FileSizeReporter\n performance: false,\n };\n}\n"]}
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@teambit/react",
3
- "version": "0.0.691",
3
+ "version": "0.0.694",
4
4
  "homepage": "https://bit.dev/teambit/react/react",
5
5
  "main": "dist/index.js",
6
6
  "componentId": {
7
7
  "scope": "teambit.react",
8
8
  "name": "react",
9
- "version": "0.0.691"
9
+ "version": "0.0.694"
10
10
  },
11
11
  "dependencies": {
12
12
  "react-error-boundary": "^3.0.0",
@@ -71,6 +71,7 @@
71
71
  "eslint-plugin-react-hooks": "4.2.0",
72
72
  "eslint-plugin-import": "2.22.1",
73
73
  "eslint-plugin-jest": "24.1.5",
74
+ "esbuild": "0.14.28",
74
75
  "@typescript-eslint/eslint-plugin": "4.30.0",
75
76
  "@typescript-eslint/parser": "4.30.0",
76
77
  "@svgr/webpack": "5.5.0",
@@ -79,39 +80,39 @@
79
80
  "@teambit/react.instructions.react.adding-compositions": "0.0.6",
80
81
  "@teambit/react.instructions.react.adding-tests": "0.0.6",
81
82
  "@teambit/design.ui.pages.standalone-not-found-page": "0.0.356",
82
- "@teambit/preview": "0.0.691",
83
+ "@teambit/preview": "0.0.694",
83
84
  "@teambit/react.ui.error-fallback": "0.0.110",
84
85
  "@teambit/react.ui.loader-fallback": "0.0.89",
85
86
  "@teambit/compositions.ui.hooks.use-composition": "0.0.163",
86
87
  "@teambit/design.ui.input.option-button": "0.0.26",
87
88
  "@teambit/design.ui.tooltip": "0.0.352",
88
- "@teambit/builder": "0.0.691",
89
- "@teambit/bundler": "0.0.691",
90
- "@teambit/compiler": "0.0.691",
89
+ "@teambit/builder": "0.0.694",
90
+ "@teambit/bundler": "0.0.694",
91
+ "@teambit/compiler": "0.0.694",
91
92
  "@teambit/component.modules.component-url": "0.0.124",
92
- "@teambit/component": "0.0.691",
93
- "@teambit/envs": "0.0.691",
94
- "@teambit/eslint": "0.0.691",
95
- "@teambit/formatter": "0.0.242",
96
- "@teambit/jest": "0.0.691",
97
- "@teambit/linter": "0.0.691",
98
- "@teambit/pkg": "0.0.691",
99
- "@teambit/prettier": "0.0.242",
93
+ "@teambit/component": "0.0.694",
94
+ "@teambit/envs": "0.0.694",
95
+ "@teambit/eslint": "0.0.694",
96
+ "@teambit/formatter": "0.0.245",
97
+ "@teambit/jest": "0.0.694",
98
+ "@teambit/linter": "0.0.694",
99
+ "@teambit/pkg": "0.0.694",
100
+ "@teambit/prettier": "0.0.245",
100
101
  "@teambit/react.ui.highlighter.component-metadata.bit-component-meta": "0.0.21",
101
- "@teambit/schema": "0.0.691",
102
- "@teambit/tester": "0.0.691",
103
- "@teambit/typescript": "0.0.691",
104
- "@teambit/webpack": "0.0.691",
105
- "@teambit/workspace": "0.0.691",
106
- "@teambit/application": "0.0.333",
107
- "@teambit/cli": "0.0.463",
108
- "@teambit/dependency-resolver": "0.0.691",
109
- "@teambit/generator": "0.0.691",
110
- "@teambit/graphql": "0.0.691",
111
- "@teambit/react.ui.highlighter-provider": "0.0.185",
112
- "@teambit/compositions": "0.0.691",
113
- "@teambit/ui": "0.0.691",
114
- "@teambit/react.eslint-config-bit-react": "0.0.539",
102
+ "@teambit/schema": "0.0.694",
103
+ "@teambit/tester": "0.0.694",
104
+ "@teambit/typescript": "0.0.694",
105
+ "@teambit/webpack": "0.0.694",
106
+ "@teambit/workspace": "0.0.694",
107
+ "@teambit/application": "0.0.336",
108
+ "@teambit/cli": "0.0.464",
109
+ "@teambit/dependency-resolver": "0.0.694",
110
+ "@teambit/generator": "0.0.694",
111
+ "@teambit/graphql": "0.0.694",
112
+ "@teambit/react.ui.highlighter-provider": "0.0.186",
113
+ "@teambit/compositions": "0.0.694",
114
+ "@teambit/ui": "0.0.694",
115
+ "@teambit/react.eslint-config-bit-react": "0.0.540",
115
116
  "@teambit/webpack.modules.generate-expose-loaders": "0.0.3",
116
117
  "@teambit/webpack.modules.generate-externals": "0.0.3",
117
118
  "@teambit/webpack.modules.config-mutator": "0.0.137",
@@ -121,7 +122,7 @@
121
122
  "@teambit/webpack.modules.style-regexps": "0.0.132",
122
123
  "@teambit/component-id": "0.0.402",
123
124
  "@teambit/toolbox.network.get-port": "0.0.113",
124
- "@teambit/config": "0.0.476"
125
+ "@teambit/config": "0.0.477"
125
126
  },
126
127
  "devDependencies": {
127
128
  "@types/react": "^17.0.8",
@@ -140,7 +141,7 @@
140
141
  "@teambit/react.content.react-overview": "1.95.0"
141
142
  },
142
143
  "peerDependencies": {
143
- "@teambit/legacy": "1.0.241",
144
+ "@teambit/legacy": "1.0.242",
144
145
  "react-dom": "^16.8.0 || ^17.0.0",
145
146
  "react": "^16.8.0 || ^17.0.0"
146
147
  },
@@ -180,6 +181,7 @@
180
181
  "eslint-plugin-react-hooks": "4.2.0",
181
182
  "eslint-plugin-import": "2.22.1",
182
183
  "eslint-plugin-jest": "24.1.5",
184
+ "esbuild": "0.14.28",
183
185
  "@typescript-eslint/eslint-plugin": "4.30.0",
184
186
  "@typescript-eslint/parser": "4.30.0",
185
187
  "@babel/preset-react": "7.13.13",
@@ -202,7 +204,7 @@
202
204
  "@types/jest": "^26.0.0"
203
205
  },
204
206
  "peerDependencies": {
205
- "@teambit/legacy": "1.0.241",
207
+ "@teambit/legacy": "1.0.242",
206
208
  "react-dom": "^16.8.0 || ^17.0.0",
207
209
  "react": "^16.8.0 || ^17.0.0"
208
210
  }
@@ -1,2 +1,2 @@
1
- export const compositions = [require('/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.react_react@0.0.691/dist/react.composition.js')]
2
- export const overview = [require('/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.react_react@0.0.691/dist/react.docs.mdx')]
1
+ export const compositions = [require('/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.react_react@0.0.694/dist/react.composition.js')]
2
+ export const overview = [require('/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.react_react@0.0.694/dist/react.docs.mdx')]