@teambit/react 0.0.777 → 0.0.780
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.
- package/apps/web/react.application.ts +3 -0
- package/artifacts/__bit_junit.xml +6 -0
- package/artifacts/env-template/public/22.df5dcfd6ec82b80f43f1.js +43 -0
- package/artifacts/env-template/public/{peers.9e37920084e4feaffe21.js → 244.40a7c02382995372607b.js} +8 -8
- package/artifacts/env-template/public/{830.js → 970.c5cde96c68e8fb444a24.js} +94 -92
- package/artifacts/env-template/public/assets-manifest.json +16 -14
- package/artifacts/env-template/public/{compositions.9d5376d2bee8aea2628c.js → compositions.7f9b3c1d5594a2b8356d.js} +2 -2
- package/artifacts/env-template/public/compositions.html +1 -1
- package/artifacts/env-template/public/overview.9f2f451ee3e901539ae2.js +1 -0
- package/artifacts/env-template/public/overview.html +1 -1
- package/artifacts/env-template/public/peers.a454763fe05a7215f7c5.js +1 -0
- package/artifacts/env-template/public/preview-root.f0685d3de3c57905ba12.js +5 -0
- package/artifacts/env-template/public/static/css/{830.c01819bb.css → 970.c0eadd42.css} +1 -1
- package/artifacts/preview/teambit_react_react-preview.js +1 -1
- package/{compositions-1656732493790.js → compositions-1657039361770.js} +0 -1
- package/dist/apps/web/react.application.js +4 -1
- package/dist/apps/web/react.application.js.map +1 -1
- package/dist/react.env.js +12 -1
- package/dist/react.env.js.map +1 -1
- package/dist/templates/react-hook/files/index-file.js +1 -1
- package/dist/templates/react-hook/files/index-file.js.map +1 -1
- package/dist/templates/react-hook/files/index-file.spec.d.ts +1 -0
- package/dist/templates/react-hook/files/index-file.spec.js +41 -0
- package/dist/templates/react-hook/files/index-file.spec.js.map +1 -0
- package/dist/webpack/webpack.config.base.js +0 -3
- package/dist/webpack/webpack.config.base.js.map +1 -1
- package/dist/webpack/webpack.config.env.template.d.ts +2 -0
- package/dist/webpack/webpack.config.env.template.js +22 -0
- package/dist/webpack/webpack.config.env.template.js.map +1 -0
- package/{overview-1656732493790.js → overview-1657039361770.js} +0 -1
- package/package-tar/teambit-react-0.0.780.tgz +0 -0
- package/package.json +34 -34
- package/peers-link.12da65a556b208dcb44e12e06e145839e9b3df37.js +26 -0
- package/{preview-1656732493790.js → preview-1657039361770.js} +3 -3
- package/templates/react-hook/files/index-file.spec.ts +23 -0
- package/templates/react-hook/files/index-file.ts +1 -1
- package/webpack/webpack.config.base.ts +0 -4
- package/webpack/webpack.config.env.template.ts +15 -0
- package/artifacts/env-template/public/22.js +0 -43
- package/artifacts/env-template/public/overview.dc55bfaf3c3f448d6251.js +0 -1
- package/artifacts/env-template/public/preview-root.3e2209e9ea4939581c1a.js +0 -5
- package/package-tar/teambit-react-0.0.777.tgz +0 -0
|
@@ -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},62096:(__unused_webpack_module,exports2,__webpack_require__2)=>{"use strict";var __bit_component={id:"teambit.react/react@0.0.777",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__.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});var react_docs_namespaceObject={};__webpack_require__.r(react_docs_namespaceObject),__webpack_require__.d(react_docs_namespaceObject,{default:()=>MDXContent});var react_composition=__webpack_require__(62096),external_React_=__webpack_require__(63804),external_MdxJsReact_=__webpack_require__(85057),external_TeambitMdxUiMdxScopeContext_=__webpack_require__(58459),dist=__webpack_require__(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,external_MdxJsReact_.mdx)(MDXLayout,_extends({},layoutProps,props,{components,mdxType:"MDXLayout"}),(0,external_MdxJsReact_.mdx)(external_TeambitMdxUiMdxScopeContext_.MDXScopeProvider,{components:{ReactOverview:dist.ZP},mdxType:"MDXScopeProvider"},(0,external_MdxJsReact_.mdx)(dist.ZP,{mdxType:"ReactOverview"})))}MDXContent.isMDXComponent=!0;const compositions=[react_composition],overview=[react_docs_namespaceObject]})(),__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},67780:(__unused_webpack_module,exports2,__webpack_require__2)=>{"use strict";var __bit_component={id:"teambit.react/react@0.0.780",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__.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});var react_docs_namespaceObject={};__webpack_require__.r(react_docs_namespaceObject),__webpack_require__.d(react_docs_namespaceObject,{default:()=>MDXContent});var react_composition=__webpack_require__(67780),external_React_=__webpack_require__(63804),external_MdxJsReact_=__webpack_require__(85057),external_TeambitMdxUiMdxScopeContext_=__webpack_require__(58459),dist=__webpack_require__(55906),_excluded=["components"];function _extends(){return _extends=Object.assign?Object.assign.bind():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,external_MdxJsReact_.mdx)(MDXLayout,_extends({},layoutProps,props,{components,mdxType:"MDXLayout"}),(0,external_MdxJsReact_.mdx)(external_TeambitMdxUiMdxScopeContext_.MDXScopeProvider,{components:{ReactOverview:dist.ZP},mdxType:"MDXScopeProvider"},(0,external_MdxJsReact_.mdx)(dist.ZP,{mdxType:"ReactOverview"})))}MDXContent.isMDXComponent=!0;const compositions=[react_composition],overview=[react_docs_namespaceObject]})(),__webpack_exports__})()});
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
|
|
2
2
|
import { linkModules } from '/home/circleci/bit/bit/node_modules/@teambit/preview/dist/preview.preview.runtime.js';
|
|
3
|
-
import harmony from '/home/circleci/bit/bit/node_modules/@teambit/harmony/dist/index.js';
|
|
4
3
|
import * as mainModule from '/home/circleci/bit/bit/node_modules/@teambit/react/dist/mount.js';
|
|
5
4
|
|
|
6
5
|
|
|
@@ -172,7 +172,10 @@ class ReactApp {
|
|
|
172
172
|
const devServer = this.reactEnv.getDevServer(devServerContext, [configMutator => configMutator.addTopLevel('devServer', {
|
|
173
173
|
historyApiFallback: {
|
|
174
174
|
index: '/index.html',
|
|
175
|
-
disableDotRule: true
|
|
175
|
+
disableDotRule: true,
|
|
176
|
+
headers: {
|
|
177
|
+
'Access-Control-Allow-Headers': '*'
|
|
178
|
+
}
|
|
176
179
|
}
|
|
177
180
|
}), configMutator => {
|
|
178
181
|
if (!configMutator.raw.output) configMutator.raw.output = {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["ReactApp","constructor","name","entry","portRange","reactEnv","prerender","bundler","devServer","transformers","deploy","favicon","isPrerendering","TerserPlugin","extractComments","terserOptions","parse","ecma","compress","warnings","comparisons","inline","mangle","safari10","output","comments","ascii_only","minify","esbuildMinify","run","context","from","to","port","Port","getPort","listen","devServerContext","getDevServerContext","getDevServer","configMutator","addTopLevel","historyApiFallback","index","disableDotRule","raw","publicPath","build","htmlConfig","title","templateContent","html","Object","assign","getBundler","bundleResult","computeResults","publicDir","getPublicDir","artifactsDir","dir","getDefaultBundler","capsule","env","outputPath","join","path","distDir","getCompiler","entries","map","require","resolve","basename","staticDir","bundlerContext","targets","components","component","hostDependencies","getPeers","aliasHostDependencies","rootPath","metaData","initiator","envId","id","defaultTransformer","config","addPlugin","prerenderPlugin","optimization","minimizer","remove","push","getESBuildConfig","applicationType","getPeerDependenciesList"],"sources":["react.application.ts"],"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 { prerenderPlugin } from './plugins';\nimport { ReactAppBuildResult } from './react-build-result';\nimport { ReactAppPrerenderOptions } from './react-app-options';\nimport { html } from '../../webpack';\nimport { ReactDeployContext } from '.';\nimport { computeResults } from './compute-results';\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 prerender?: ReactAppPrerenderOptions,\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\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 = await 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 (configMutator) => {\n if (!configMutator.raw.output) configMutator.raw.output = {};\n configMutator.raw.output.publicPath = '/';\n\n return configMutator;\n },\n ...this.transformers,\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 const bundleResult = await bundler.run();\n\n return computeResults(bundleResult, { publicDir: `${this.getPublicDir(context.artifactsDir)}/${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(context.artifactsDir);\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 hostDependencies: await this.getPeers(),\n aliasHostDependencies: true,\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.prerender) config.addPlugin(prerenderPlugin(this.prerender));\n if (config.raw.optimization?.minimizer) {\n remove(config.raw.optimization?.minimizer, (minimizer) => {\n return minimizer.constructor.name === 'TerserPlugin';\n });\n\n config.raw.optimization?.minimizer.push(this.getESBuildConfig());\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 private getESBuildConfig = (isPrerendering = this.prerender) => {\n // We don't want to use esbuild in case of prerendering since the headless browser puppeteer doesn't support\n // the output of esbuild\n\n if (isPrerendering) {\n return 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 }\n return 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 private getPublicDir(artifactsDir: string) {\n return join(artifactsDir, this.applicationType, this.name);\n }\n\n private async getDevServerContext(context: AppContext): Promise<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 hostDependencies: await this.getPeers(),\n aliasHostDependencies: true,\n });\n }\n\n private getPeers(): Promise<string[]> {\n return this.reactEnv.getPeerDependenciesList();\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAGA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAGA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAGA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAEA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAEO,MAAMA,QAAN,CAAsC;EAC3CC,WAAW,CACAC,IADA,EAEAC,KAFA,EAGAC,SAHA,EAIDC,QAJC,EAKAC,SALA,EAMAC,OANA,EAOAC,SAPA,EAQAC,YAAwC,GAAG,EAR3C,EASAC,MATA,EAUAC,OAVA,EAWT;IAAA,KAVST,IAUT,GAVSA,IAUT;IAAA,KATSC,KAST,GATSA,KAST;IAAA,KARSC,SAQT,GARSA,SAQT;IAAA,KAPQC,QAOR,GAPQA,QAOR;IAAA,KANSC,SAMT,GANSA,SAMT;IAAA,KALSC,OAKT,GALSA,OAKT;IAA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,CAAcvB,OAAd,EAAuB;MAC5B3B,KAAK,EAAE,KAAKA,KADgB;MAE5B+E,QAAQ,EAAE,EAFkB;MAG5BpC,UAAU,EAAG,UAAS,KAAK5C,IAAK,EAHJ;MAI5B+C,KAAK,EAAE,KAAK/C,IAJgB;MAK5BS,OAAO,EAAE,KAAKA,OALc;MAM5BoE,gBAAgB,EAAE,MAAM,KAAKC,QAAL,EANI;MAO5BC,qBAAqB,EAAE;IAPK,CAAvB,CAAP;EASD;;EAEOD,QAAQ,GAAsB;IACpC,OAAO,KAAK3E,QAAL,CAAc4F,uBAAd,EAAP;EACD;;AAtL0C"}
|
|
1
|
+
{"version":3,"names":["ReactApp","constructor","name","entry","portRange","reactEnv","prerender","bundler","devServer","transformers","deploy","favicon","isPrerendering","TerserPlugin","extractComments","terserOptions","parse","ecma","compress","warnings","comparisons","inline","mangle","safari10","output","comments","ascii_only","minify","esbuildMinify","run","context","from","to","port","Port","getPort","listen","devServerContext","getDevServerContext","getDevServer","configMutator","addTopLevel","historyApiFallback","index","disableDotRule","headers","raw","publicPath","build","htmlConfig","title","templateContent","html","Object","assign","getBundler","bundleResult","computeResults","publicDir","getPublicDir","artifactsDir","dir","getDefaultBundler","capsule","env","outputPath","join","path","distDir","getCompiler","entries","map","require","resolve","basename","staticDir","bundlerContext","targets","components","component","hostDependencies","getPeers","aliasHostDependencies","rootPath","metaData","initiator","envId","id","defaultTransformer","config","addPlugin","prerenderPlugin","optimization","minimizer","remove","push","getESBuildConfig","applicationType","getPeerDependenciesList"],"sources":["react.application.ts"],"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 { prerenderPlugin } from './plugins';\nimport { ReactAppBuildResult } from './react-build-result';\nimport { ReactAppPrerenderOptions } from './react-app-options';\nimport { html } from '../../webpack';\nimport { ReactDeployContext } from '.';\nimport { computeResults } from './compute-results';\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 prerender?: ReactAppPrerenderOptions,\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\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 = await 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 headers: {\n 'Access-Control-Allow-Headers': '*',\n },\n },\n }),\n (configMutator) => {\n if (!configMutator.raw.output) configMutator.raw.output = {};\n configMutator.raw.output.publicPath = '/';\n\n return configMutator;\n },\n ...this.transformers,\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 const bundleResult = await bundler.run();\n\n return computeResults(bundleResult, { publicDir: `${this.getPublicDir(context.artifactsDir)}/${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(context.artifactsDir);\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 hostDependencies: await this.getPeers(),\n aliasHostDependencies: true,\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.prerender) config.addPlugin(prerenderPlugin(this.prerender));\n if (config.raw.optimization?.minimizer) {\n remove(config.raw.optimization?.minimizer, (minimizer) => {\n return minimizer.constructor.name === 'TerserPlugin';\n });\n\n config.raw.optimization?.minimizer.push(this.getESBuildConfig());\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 private getESBuildConfig = (isPrerendering = this.prerender) => {\n // We don't want to use esbuild in case of prerendering since the headless browser puppeteer doesn't support\n // the output of esbuild\n\n if (isPrerendering) {\n return 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 }\n return 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 private getPublicDir(artifactsDir: string) {\n return join(artifactsDir, this.applicationType, this.name);\n }\n\n private async getDevServerContext(context: AppContext): Promise<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 hostDependencies: await this.getPeers(),\n aliasHostDependencies: true,\n });\n }\n\n private getPeers(): Promise<string[]> {\n return this.reactEnv.getPeerDependenciesList();\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAGA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAGA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAGA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAEA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAEO,MAAMA,QAAN,CAAsC;EAC3CC,WAAW,CACAC,IADA,EAEAC,KAFA,EAGAC,SAHA,EAIDC,QAJC,EAKAC,SALA,EAMAC,OANA,EAOAC,SAPA,EAQAC,YAAwC,GAAG,EAR3C,EASAC,MATA,EAUAC,OAVA,EAWT;IAAA,KAVST,IAUT,GAVSA,IAUT;IAAA,KATSC,KAST,GATSA,KAST;IAAA,KARSC,SAQT,GARSA,SAQT;IAAA,KAPQC,QAOR,GAPQA,QA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B,EAAyC,KAAK/F,IAA9C,CAAP;EACD;;EAEgC,MAAnBoC,mBAAmB,CAACR,OAAD,EAAiD;IAChF,OAAOuB,MAAM,CAACC,MAAP,CAAcxB,OAAd,EAAuB;MAC5B3B,KAAK,EAAE,KAAKA,KADgB;MAE5BgF,QAAQ,EAAE,EAFkB;MAG5BpC,UAAU,EAAG,UAAS,KAAK7C,IAAK,EAHJ;MAI5BgD,KAAK,EAAE,KAAKhD,IAJgB;MAK5BS,OAAO,EAAE,KAAKA,OALc;MAM5BqE,gBAAgB,EAAE,MAAM,KAAKC,QAAL,EANI;MAO5BC,qBAAqB,EAAE;IAPK,CAAvB,CAAP;EASD;;EAEOD,QAAQ,GAAsB;IACpC,OAAO,KAAK5E,QAAL,CAAc6F,uBAAd,EAAP;EACD;;AAzL0C"}
|
package/dist/react.env.js
CHANGED
|
@@ -145,6 +145,16 @@ function _webpackConfigEnv() {
|
|
|
145
145
|
return data;
|
|
146
146
|
}
|
|
147
147
|
|
|
148
|
+
function _webpackConfigEnv2() {
|
|
149
|
+
const data = require("./webpack/webpack.config.env.template");
|
|
150
|
+
|
|
151
|
+
_webpackConfigEnv2 = function () {
|
|
152
|
+
return data;
|
|
153
|
+
};
|
|
154
|
+
|
|
155
|
+
return data;
|
|
156
|
+
}
|
|
157
|
+
|
|
148
158
|
function _webpackConfigComponent() {
|
|
149
159
|
const data = _interopRequireDefault(require("./webpack/webpack.config.component.prod"));
|
|
150
160
|
|
|
@@ -423,9 +433,10 @@ class ReactEnv {
|
|
|
423
433
|
async createTemplateWebpackBundler(context, transformers = []) {
|
|
424
434
|
const baseConfig = (0, _webpackConfig().default)(!context.development);
|
|
425
435
|
const baseProdConfig = (0, _webpackConfigBase().default)(context.development);
|
|
436
|
+
const templateConfig = (0, _webpackConfigEnv2().templateWebpackConfigFactory)();
|
|
426
437
|
|
|
427
438
|
const defaultTransformer = configMutator => {
|
|
428
|
-
const merged = configMutator.merge([baseConfig, baseProdConfig]);
|
|
439
|
+
const merged = configMutator.merge([baseConfig, baseProdConfig, templateConfig]);
|
|
429
440
|
return merged;
|
|
430
441
|
};
|
|
431
442
|
|
package/dist/react.env.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["ReactEnvType","defaultTsConfig","require","buildTsConfig","eslintConfig","prettierConfig","ReactEnv","constructor","jestAspect","tsAspect","compiler","webpack","workspace","pkg","tester","config","eslint","prettier","dependencyResolver","logger","compilerAspectId","getTsConfig","targetTsConfig","merge","getBuildTsConfig","getCjsJestTester","jestConfigPath","jestModulePath","pathToSource","pathNormalizeToLinux","__dirname","replace","defaultConfig","join","createTester","resolve","getEsmJestTester","getTester","getTsCompilerOptions","mode","tsconfig","cloneDeep","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","tmpdir","Math","random","slice","outputFileSync","JSON","stringify","getDevEnvId","ReactAspect","getSchemaExtractor","createSchemaExtractor","getDevServer","baseConfig","basePreviewConfigFactory","envDevConfig","envPreviewDevConfigFactory","componentDevConfig","componentPreviewDevConfigFactory","merged","createDevServer","getBundler","createComponentsWebpackBundler","development","baseProdConfig","basePreviewProdConfigFactory","componentProdConfig","componentPreviewProdConfigFactory","mergedTransformers","createWebpackBundler","createTemplateWebpackBundler","createBundler","getPeerDependenciesList","getPeerDependenciesListFromEnv","getAdditionalHostDependencies","getDocsTemplate","getMounter","getPreviewConfig","strategyName","splitComponentBundle","getPackageJsonProps","getCjsPackageJsonProps","getEsmPackageJsonProps","getNpmIgnore","CAPSULE_ARTIFACTS_DIR","getDependencies","dependencies","react","devDependencies","peerDependencies","getBuildPipe","modifiers","tsModifier","getCompilerTask","module","task","getBuildPipeWithoutCompiler","pipeWithoutCompiler","filter","aspectId","getEsmCompilerTask","tsCompiler","createTask","getCjsCompilerTask","__getDescriptor","type"],"sources":["react.env.ts"],"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 { DependencyResolverMain } from '@teambit/dependency-resolver';\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';\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 dependencyResolver: DependencyResolverMain,\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\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, ...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 baseConfig = basePreviewConfigFactory(!context.development);\n const baseProdConfig = basePreviewProdConfigFactory(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, ...transformers];\n return this.createWebpackBundler(context, mergedTransformers);\n }\n\n async createTemplateWebpackBundler(\n context: BundlerContext,\n transformers: WebpackConfigTransformer[] = []\n ): Promise<Bundler> {\n const baseConfig = basePreviewConfigFactory(!context.development);\n const baseProdConfig = basePreviewProdConfigFactory(context.development);\n\n const defaultTransformer: WebpackConfigTransformer = (configMutator) => {\n const merged = configMutator.merge([baseConfig, baseProdConfig]);\n return merged;\n };\n const mergedTransformers = [defaultTransformer, ...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 getPeerDependenciesList() {\n return this.dependencyResolver.getPeerDependenciesListFromEnv(this);\n }\n\n getAdditionalHostDependencies(): string[] {\n return ['@teambit/mdx.ui.mdx-scope-context', '@mdx-js/react', '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"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAE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AS,WAAT,sCAAAA,SAAS,CAAEC,UAAX,kFAAuBE,MAAvB,KAAiCzF,qBAApE,CAAD,EAA0E,KAAKlC,MAAL,CAAY4H,IAAtF,CAAP;EACD;EAED;AACF;AACA;AACA;AACA;;;EACEC,2BAA2B,GAAgB;IACzC,MAAMC,mBAAmB,GAAG,KAAKP,YAAL,GAAoBQ,MAApB,CAA4BH,IAAD,IAAUA,IAAI,CAACI,QAAL,KAAkB,KAAK1H,gBAA5D,CAA5B;IACA,OAAOwH,mBAAP;EACD;EAED;AACF;AACA;AACA;AACA;AACA;;;EACEG,kBAAkB,CAACjG,YAAmC,GAAG,EAAvC,EAA2CC,QAAQ,GAAGC,qBAAtD,EAA0D;IAC1E,MAAMgG,UAAU,GAAG,KAAK7F,gBAAL,CAAsB,OAAtB,EAA+BL,YAA/B,EAA6CC,QAA7C,CAAnB;IACA,OAAO,KAAKrC,QAAL,CAAcuI,UAAd,CAAyB,YAAzB,EAAuCD,UAAvC,CAAP;EACD;EAED;AACF;AACA;AACA;AACA;AACA;;;EACEE,kBAAkB,CAACpG,YAAmC,GAAG,EAAvC,EAA2CC,QAAQ,GAAGC,qBAAtD,EAA0D;IAC1E,MAAMgG,UAAU,GAAG,KAAKnG,gBAAL,CAAsB,OAAtB,EAA+BC,YAA/B,EAA6CC,QAA7C,CAAnB;IACA,OAAO,KAAKrC,QAAL,CAAcuI,UAAd,CAAyB,YAAzB,EAAuCD,UAAvC,CAAP;EACD;;EAEOR,eAAe,CAAC1F,YAAmC,GAAG,EAAvC,EAA2CC,QAAQ,GAAGC,qBAAtD,EAA0D;IAC/E,OAAO,KAAKkG,kBAAL,CAAwBpG,YAAxB,EAAsCC,QAAtC,CAAP;EACD;;EAEoB,MAAfoG,eAAe,GAAG;IACtB,OAAO;MACLC,IAAI,EAAEpJ;IADD,CAAP;EAGD;;AAzZH"}
|
|
1
|
+
{"version":3,"names":["ReactEnvType","defaultTsConfig","require","buildTsConfig","eslintConfig","prettierConfig","ReactEnv","constructor","jestAspect","tsAspect","compiler","webpack","workspace","pkg","tester","config","eslint","prettier","dependencyResolver","logger","compilerAspectId","getTsConfig","targetTsConfig","merge","getBuildTsConfig","getCjsJestTester","jestConfigPath","jestModulePath","pathToSource","pathNormalizeToLinux","__dirname","replace","defaultConfig","join","createTester","resolve","getEsmJestTester","getTester","getTsCompilerOptions","mode","tsconfig","cloneDeep","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","tmpdir","Math","random","slice","outputFileSync","JSON","stringify","getDevEnvId","ReactAspect","getSchemaExtractor","createSchemaExtractor","getDevServer","baseConfig","basePreviewConfigFactory","envDevConfig","envPreviewDevConfigFactory","componentDevConfig","componentPreviewDevConfigFactory","merged","createDevServer","getBundler","createComponentsWebpackBundler","development","baseProdConfig","basePreviewProdConfigFactory","componentProdConfig","componentPreviewProdConfigFactory","mergedTransformers","createWebpackBundler","createTemplateWebpackBundler","templateConfig","templateWebpackConfigFactory","createBundler","getPeerDependenciesList","getPeerDependenciesListFromEnv","getAdditionalHostDependencies","getDocsTemplate","getMounter","getPreviewConfig","strategyName","splitComponentBundle","getPackageJsonProps","getCjsPackageJsonProps","getEsmPackageJsonProps","getNpmIgnore","CAPSULE_ARTIFACTS_DIR","getDependencies","dependencies","react","devDependencies","peerDependencies","getBuildPipe","modifiers","tsModifier","getCompilerTask","module","task","getBuildPipeWithoutCompiler","pipeWithoutCompiler","filter","aspectId","getEsmCompilerTask","tsCompiler","createTask","getCjsCompilerTask","__getDescriptor","type"],"sources":["react.env.ts"],"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 { DependencyResolverMain } from '@teambit/dependency-resolver';\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';\nimport { templateWebpackConfigFactory } from './webpack/webpack.config.env.template';\n\n// webpack configs for components only\nimport componentPreviewProdConfigFactory from './webpack/webpack.config.component.prod';\nimport componentPreviewDevConfigFactory from './webpack/webpack.config.component.dev';\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 dependencyResolver: DependencyResolverMain,\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\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, ...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 baseConfig = basePreviewConfigFactory(!context.development);\n const baseProdConfig = basePreviewProdConfigFactory(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, ...transformers];\n return this.createWebpackBundler(context, mergedTransformers);\n }\n\n async createTemplateWebpackBundler(\n context: BundlerContext,\n transformers: WebpackConfigTransformer[] = []\n ): Promise<Bundler> {\n const baseConfig = basePreviewConfigFactory(!context.development);\n const baseProdConfig = basePreviewProdConfigFactory(context.development);\n const templateConfig = templateWebpackConfigFactory();\n\n const defaultTransformer: WebpackConfigTransformer = (configMutator) => {\n const merged = configMutator.merge([baseConfig, baseProdConfig, templateConfig]);\n return merged;\n };\n const mergedTransformers = [defaultTransformer, ...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 getPeerDependenciesList() {\n return this.dependencyResolver.getPeerDependenciesListFromEnv(this);\n }\n\n getAdditionalHostDependencies(): string[] {\n return ['@teambit/mdx.ui.mdx-scope-context', '@mdx-js/react', '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"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAEA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAA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context","name","nameCamelCase","Name","relativePath","content"],"sources":["index-file.ts"],"sourcesContent":["import { ComponentContext } from '@teambit/generator';\n\nexport const indexFile = (context: ComponentContext) => {\n const { name, nameCamelCase: Name } = context;\n\n return {\n relativePath: 'index.ts',\n content: `export { ${Name} } from './${name}';\n`,\n };\n};\n"],"mappings":";;;;;;;AAEO,MAAMA,SAAS,GAAIC,OAAD,IAA+B;EACtD,MAAM;IAAEC,IAAF;IAAQC,aAAa,EAAEC;EAAvB,IAAgCH,OAAtC;EAEA,OAAO;IACLI,YAAY,EAAE,UADT;IAELC,OAAO,EAAG,YAAWF,IAAK,cAAaF,IAAK;AAChD;EAHS,CAAP;AAKD,CARM"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
function _componentId() {
|
|
4
|
+
const data = require("@teambit/component-id");
|
|
5
|
+
|
|
6
|
+
_componentId = function () {
|
|
7
|
+
return data;
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
return data;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
function _indexFile() {
|
|
14
|
+
const data = require("./index-file");
|
|
15
|
+
|
|
16
|
+
_indexFile = function () {
|
|
17
|
+
return data;
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
return data;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
// react hook convention is `useX` (lowercase "use")
|
|
24
|
+
// it is required to enable hook-specific linting rules
|
|
25
|
+
const useFoobarSnapshot = `export { useFooBar } from './use-foo-bar';
|
|
26
|
+
`; // trailing line break
|
|
27
|
+
|
|
28
|
+
describe('templates: react-hook, index-file', () => {
|
|
29
|
+
it('should match snapshot', () => {
|
|
30
|
+
const ctx = {
|
|
31
|
+
name: 'use-foo-bar',
|
|
32
|
+
namePascalCase: 'UseFooBar',
|
|
33
|
+
nameCamelCase: 'useFooBar',
|
|
34
|
+
componentId: _componentId().ComponentID.fromString('baz.qux/use/foo/bar')
|
|
35
|
+
};
|
|
36
|
+
const result = (0, _indexFile().indexFile)(ctx);
|
|
37
|
+
expect(result.content).toEqual(useFoobarSnapshot);
|
|
38
|
+
});
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
//# sourceMappingURL=index-file.spec.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["useFoobarSnapshot","describe","it","ctx","name","namePascalCase","nameCamelCase","componentId","ComponentID","fromString","result","indexFile","expect","content","toEqual"],"sources":["index-file.spec.ts"],"sourcesContent":["import { ComponentID } from '@teambit/component-id';\nimport type { ComponentContext } from '@teambit/generator';\nimport { indexFile } from './index-file';\n\n// react hook convention is `useX` (lowercase \"use\")\n// it is required to enable hook-specific linting rules\nconst useFoobarSnapshot = `export { useFooBar } from './use-foo-bar';\n`; // trailing line break\n\ndescribe('templates: react-hook, index-file', () => {\n it('should match snapshot', () => {\n const ctx: ComponentContext = {\n name: 'use-foo-bar',\n namePascalCase: 'UseFooBar',\n nameCamelCase: 'useFooBar',\n componentId: ComponentID.fromString('baz.qux/use/foo/bar'),\n };\n\n const result = indexFile(ctx);\n\n expect(result.content).toEqual(useFoobarSnapshot);\n });\n});\n"],"mappings":";;AAAA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAEA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAEA;AACA;AACA,MAAMA,iBAAiB,GAAI;AAC3B,CADA,C,CACG;;AAEHC,QAAQ,CAAC,mCAAD,EAAsC,MAAM;EAClDC,EAAE,CAAC,uBAAD,EAA0B,MAAM;IAChC,MAAMC,GAAqB,GAAG;MAC5BC,IAAI,EAAE,aADsB;MAE5BC,cAAc,EAAE,WAFY;MAG5BC,aAAa,EAAE,WAHa;MAI5BC,WAAW,EAAEC,0BAAA,CAAYC,UAAZ,CAAuB,qBAAvB;IAJe,CAA9B;IAOA,MAAMC,MAAM,GAAG,IAAAC,sBAAA,EAAUR,GAAV,CAAf;IAEAS,MAAM,CAACF,MAAM,CAACG,OAAR,CAAN,CAAuBC,OAAvB,CAA+Bd,iBAA/B;EACD,CAXC,CAAF;AAYD,CAbO,CAAR"}
|
|
@@ -139,9 +139,6 @@ function _default(isEnvProduction = false) {
|
|
|
139
139
|
alias: _objectSpread({
|
|
140
140
|
'react/jsx-dev-runtime': require.resolve('react/jsx-dev-runtime.js'),
|
|
141
141
|
'react/jsx-runtime': require.resolve('react/jsx-runtime.js'),
|
|
142
|
-
// Support React Native Web
|
|
143
|
-
// https://www.smashingmagazine.com/2016/08/a-glimpse-into-the-future-with-react-native-for-web/
|
|
144
|
-
// TODO: @uri please remember to remove after publishing evangelist and base-ui
|
|
145
142
|
'react-dom/server': require.resolve('react-dom/server')
|
|
146
143
|
}, isEnvProductionProfile && {
|
|
147
144
|
'react-dom$': 'react-dom/profiling',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["styleLoaderPath","require","resolve","moduleFileExtensions","shouldUseSourceMap","process","env","GENERATE_SOURCEMAP","imageInlineSizeLimit","parseInt","IMAGE_INLINE_SIZE_LIMIT","isEnvProduction","isEnvProductionProfile","argv","includes","baseStyleLoadersOptions","injectingLoader","MiniCssExtractPlugin","loader","cssLoaderPath","postCssLoaderPath","postCssConfig","extensions","map","ext","alias","module","strictExportPresence","rules","test","fullySpecified","oneOf","stylesRegexps","cssNoModulesRegex","use","generateStyleLoaders","merge","cssLoaderOpts","importLoaders","sourceMap","sideEffects","exclude","options","babelrc","configFile","customize","presets","cacheDirectory","cacheCompression","compact","cssModuleRegex","modules","getLocalIdent","getCSSModuleLocalIdent","sassNoModuleRegex","preProcessOptions","resolveUrlLoaderPath","preProcessorPath","sassModuleRegex","lessNoModuleRegex","lessModuleRegex","type","parser","dataUrlCondition","maxSize","generator","filename","dependency","not","titleProp","ref","plugins","chunkFilename","IgnorePlugin","resourceRegExp","contextRegExp","filter","Boolean","performance"],"sources":["webpack.config.base.ts"],"sourcesContent":["import { merge } from 'lodash';\nimport 'style-loader';\nimport MiniCssExtractPlugin from 'mini-css-extract-plugin';\nimport getCSSModuleLocalIdent from 'react-dev-utils/getCSSModuleLocalIdent';\nimport { Configuration, IgnorePlugin } from 'webpack';\nimport * as stylesRegexps from '@teambit/webpack.modules.style-regexps';\nimport { generateStyleLoaders } from '@teambit/webpack.modules.generate-style-loaders';\nimport { postCssConfig } from './postcss.config';\n// Make sure the bit-react-transformer is a dependency\n// TODO: remove it once we can set policy from component to component then set it via the component.json\nimport '@teambit/react.babel.bit-react-transformer';\n// Make sure the mdx-loader is a dependency\nimport '@teambit/mdx.modules.mdx-loader';\n\nconst styleLoaderPath = require.resolve('style-loader');\n\nconst moduleFileExtensions = [\n 'web.mjs',\n 'mjs',\n 'web.js',\n 'js',\n 'cjs',\n 'web.ts',\n 'ts',\n 'web.tsx',\n 'tsx',\n 'json',\n 'web.jsx',\n 'jsx',\n 'mdx',\n 'md',\n];\n\n// Source maps are resource heavy and can cause out of memory issue for large source files.\nconst shouldUseSourceMap = process.env.GENERATE_SOURCEMAP !== 'false';\n\nconst imageInlineSizeLimit = parseInt(process.env.IMAGE_INLINE_SIZE_LIMIT || '10000');\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 (isEnvProduction = false): Configuration {\n // Variable used for enabling profiling in Production\n // passed into alias object. Uses a flag if passed into the build command\n const isEnvProductionProfile = process.argv.includes('--profile');\n\n const baseStyleLoadersOptions = {\n injectingLoader: isEnvProduction ? MiniCssExtractPlugin.loader : styleLoaderPath,\n cssLoaderPath: require.resolve('css-loader'),\n postCssLoaderPath: require.resolve('postcss-loader'),\n postCssConfig,\n };\n\n // We will provide `paths.publicUrlOrPath` to our app\n // as %PUBLIC_URL% in `index.html` and `process.env.PUBLIC_URL` in JavaScript.\n // Omit trailing slash as %PUBLIC_URL%/xyz looks better than %PUBLIC_URL%xyz.\n // Get environment variables to inject into our app.\n // const env = getClientEnvironment(publicUrlOrPath.slice(0, -1));\n\n return {\n // TODO: make the dev tool according to shouldUseSourceMap and isEnvProduction\n // devtool: 'inline-source-map',\n resolve: {\n // These are the reasonable defaults supported by the Node ecosystem.\n // We also include JSX as a common component filename extension to support\n // some tools, although we do not recommend using it, see:\n // https://github.com/facebook/create-react-app/issues/290\n // `web` extension prefixes have been added for better support\n // for React Native Web.\n extensions: moduleFileExtensions.map((ext) => `.${ext}`),\n\n alias: {\n 'react/jsx-dev-runtime': require.resolve('react/jsx-dev-runtime.js'),\n 'react/jsx-runtime': require.resolve('react/jsx-runtime.js'),\n // Support React Native Web\n // https://www.smashingmagazine.com/2016/08/a-glimpse-into-the-future-with-react-native-for-web/\n // TODO: @uri please remember to remove after publishing evangelist and base-ui\n\n 'react-dom/server': require.resolve('react-dom/server'),\n // Allows for better profiling with ReactDevTools\n ...(isEnvProductionProfile && {\n 'react-dom$': 'react-dom/profiling',\n 'scheduler/tracing': 'scheduler/tracing-profiling',\n }),\n },\n },\n module: {\n strictExportPresence: true,\n rules: [\n {\n test: /\\.m?js/,\n resolve: {\n fullySpecified: false,\n },\n },\n {\n // \"oneOf\" will traverse all following loaders until one will\n // match the requirements. When no loader matches it will fall\n // back to the \"file\" loader at the end of the loader list.\n oneOf: [\n // \"postcss\" loader applies autoprefixer to our CSS.\n // \"css\" loader resolves paths in CSS and adds assets as dependencies.\n // \"style\" loader turns CSS into JS modules that inject <style> tags.\n // In production, we use MiniCSSExtractPlugin to extract that CSS\n // to a file, but in development \"style\" loader enables hot editing\n // of CSS.\n // By default we support CSS Modules with the extension .module.css\n {\n test: stylesRegexps.cssNoModulesRegex,\n use: generateStyleLoaders(\n merge({}, baseStyleLoadersOptions, {\n cssLoaderOpts: {\n importLoaders: 1,\n sourceMap: isEnvProduction || shouldUseSourceMap,\n },\n })\n ),\n // Don't consider CSS imports dead code even if the\n // containing package claims to have no side effects.\n // Remove this when webpack adds a warning or an error for this.\n // See https://github.com/webpack/webpack/issues/6571\n sideEffects: true,\n },\n\n // Process application JS with Babel.\n // The preset includes JSX, Flow, TypeScript, and some ESnext features.\n {\n test: /\\.(js|mjs|jsx|ts|tsx)$/,\n exclude: [/node_modules/, /\\/dist\\//],\n // consider: limit loader to files only in a capsule that has bitid in package.json\n // descriptionData: { componentId: ComponentID.isValidObject },\n // // or\n // include: capsulePaths\n loader: require.resolve('babel-loader'),\n options: {\n babelrc: false,\n configFile: false,\n customize: require.resolve('babel-preset-react-app/webpack-overrides'),\n presets: [require.resolve('@babel/preset-react')],\n // This is a feature of `babel-loader` for webpack (not Babel itself).\n // It enables caching results in ./node_modules/.cache/babel-loader/\n // directory for faster rebuilds.\n cacheDirectory: true,\n // See #6846 for context on why cacheCompression is disabled\n cacheCompression: false,\n compact: isEnvProduction,\n },\n },\n // Process any JS outside of the app with Babel.\n // Unlike the application JS, we only compile the standard ES features.\n // Probably not needed in our use case\n // {\n // test: /\\.(js|mjs)$/,\n // exclude: /@babel(?:\\/|\\\\{1,2})runtime/,\n // loader: require.resolve('babel-loader'),\n // options: {\n // babelrc: false,\n // configFile: false,\n // compact: false,\n // presets: [[require.resolve('babel-preset-react-app/dependencies'), { helpers: true }]],\n // cacheDirectory: true,\n // // See #6846 for context on why cacheCompression is disabled\n // cacheCompression: false,\n\n // // Babel sourcemaps are needed for debugging into node_modules\n // // code. Without the options below, debuggers like VSCode\n // // show incorrect code and set breakpoints on the wrong lines.\n // sourceMaps: shouldUseSourceMap,\n // inputSourceMap: shouldUseSourceMap,\n // },\n // },\n // MDX support (move to the mdx aspect and extend from there)\n {\n test: /\\.mdx?$/,\n exclude: [/node_modules/],\n use: [\n {\n loader: require.resolve('babel-loader'),\n options: {\n babelrc: false,\n configFile: false,\n presets: [require.resolve('@babel/preset-react'), require.resolve('@babel/preset-env')],\n },\n },\n {\n loader: require.resolve('@teambit/mdx.modules.mdx-loader'),\n },\n ],\n },\n // Adds support for CSS Modules (https://github.com/css-modules/css-modules)\n // using the extension .module.css\n {\n test: stylesRegexps.cssModuleRegex,\n use: generateStyleLoaders(\n merge({}, baseStyleLoadersOptions, {\n cssLoaderOpts: {\n importLoaders: 1,\n sourceMap: isEnvProduction || shouldUseSourceMap,\n modules: {\n getLocalIdent: getCSSModuleLocalIdent,\n },\n },\n shouldUseSourceMap: isEnvProduction || shouldUseSourceMap,\n })\n ),\n },\n // Opt-in support for SASS (using .scss or .sass extensions).\n // By default we support SASS Modules with the\n // extensions .module.scss or .module.sass\n {\n test: stylesRegexps.sassNoModuleRegex,\n use: generateStyleLoaders(\n merge({}, baseStyleLoadersOptions, {\n cssLoaderOpts: {\n importLoaders: 3,\n sourceMap: isEnvProduction || shouldUseSourceMap,\n },\n shouldUseSourceMap: isEnvProduction || shouldUseSourceMap,\n preProcessOptions: {\n resolveUrlLoaderPath: require.resolve('resolve-url-loader'),\n preProcessorPath: require.resolve('sass-loader'),\n },\n })\n ),\n // Don't consider CSS imports dead code even if the\n // containing package claims to have no side effects.\n // Remove this when webpack adds a warning or an error for this.\n // See https://github.com/webpack/webpack/issues/6571\n sideEffects: true,\n },\n // Adds support for CSS Modules, but using SASS\n // using the extension .module.scss or .module.sass\n {\n test: stylesRegexps.sassModuleRegex,\n use: generateStyleLoaders(\n merge({}, baseStyleLoadersOptions, {\n cssLoaderOpts: {\n importLoaders: 3,\n sourceMap: isEnvProduction || shouldUseSourceMap,\n modules: {\n getLocalIdent: getCSSModuleLocalIdent,\n },\n },\n shouldUseSourceMap: isEnvProduction || shouldUseSourceMap,\n preProcessOptions: {\n resolveUrlLoaderPath: require.resolve('resolve-url-loader'),\n preProcessorPath: require.resolve('sass-loader'),\n },\n })\n ),\n },\n {\n test: stylesRegexps.lessNoModuleRegex,\n use: generateStyleLoaders(\n merge({}, baseStyleLoadersOptions, {\n cssLoaderOpts: {\n importLoaders: 1,\n sourceMap: isEnvProduction || shouldUseSourceMap,\n },\n shouldUseSourceMap: isEnvProduction || shouldUseSourceMap,\n preProcessOptions: {\n resolveUrlLoaderPath: require.resolve('resolve-url-loader'),\n preProcessorPath: require.resolve('less-loader'),\n },\n })\n ),\n // Don't consider CSS imports dead code even if the\n // containing package claims to have no side effects.\n // Remove this when webpack adds a warning or an error for this.\n // See https://github.com/webpack/webpack/issues/6571\n sideEffects: true,\n },\n {\n test: stylesRegexps.lessModuleRegex,\n use: generateStyleLoaders(\n merge({}, baseStyleLoadersOptions, {\n cssLoaderOpts: {\n importLoaders: 1,\n sourceMap: isEnvProduction || shouldUseSourceMap,\n modules: {\n getLocalIdent: getCSSModuleLocalIdent,\n },\n },\n shouldUseSourceMap: isEnvProduction || shouldUseSourceMap,\n preProcessOptions: {\n resolveUrlLoaderPath: require.resolve('resolve-url-loader'),\n preProcessorPath: require.resolve('less-loader'),\n },\n })\n ),\n },\n {\n test: [/\\.bmp$/, /\\.gif$/, /\\.jpe?g$/, /\\.png$/],\n type: 'asset',\n parser: {\n dataUrlCondition: {\n maxSize: imageInlineSizeLimit,\n },\n },\n generator: {\n filename: 'static/images/[hash][ext][query]',\n },\n },\n {\n // loads svg as both inlineUrl and react component, like:\n // import starUrl, { ReactComponent as StarIcon } from './star.svg';\n // (remove when there is native support for both opitons from webpack5 / svgr)\n test: /\\.svg$/,\n oneOf: [\n {\n dependency: { not: ['url'] }, // exclude new URL calls\n use: [\n {\n loader: require.resolve('@svgr/webpack'),\n options: { titleProp: true, ref: true },\n },\n require.resolve('new-url-loader'),\n ],\n },\n {\n type: 'asset', // export a data URI or emit a separate file\n },\n ],\n },\n {\n test: /\\.(woff(2)?|ttf|eot|svg)(\\?v=\\d+\\.\\d+\\.\\d+)?$/,\n type: 'asset',\n generator: {\n filename: 'static/fonts/[hash][ext][query]',\n },\n },\n\n // \"file\" loader makes sure those assets get served by WebpackDevServer.\n // When you `import` an asset, you get its (virtual) filename.\n // In production, they would get copied to the `build` folder.\n // This loader doesn't use a \"test\" so it will catch all modules\n // that fall through the other loaders.\n {\n // Exclude `js` files to keep \"css\" loader working as it injects\n // its runtime that would otherwise be processed through \"file\" loader.\n // Also exclude `html` and `json` extensions so they get processed\n // by webpacks internal loaders.\n exclude: [/\\.(js|mjs|cjs|jsx|ts|tsx)$/, /\\.html$/, /\\.mdx?/, /\\.json$/, /\\.css$/],\n generator: {\n filename: 'static/[hash][ext][query]',\n },\n type: 'asset',\n },\n // ** STOP ** Are you adding a new loader?\n // Make sure to add the new loader(s) before the \"type:asset\" loader.\n ],\n },\n ],\n },\n // @ts-ignore\n plugins: [\n isEnvProduction &&\n new MiniCssExtractPlugin({\n // Options similar to the same options in webpackOptions.output\n // both options are optional\n filename: 'static/css/[name].[contenthash:8].css',\n chunkFilename: 'static/css/[name].[contenthash:8].chunk.css',\n }),\n // Moment.js is an extremely popular library that bundles large locale files\n // by default due to how webpack interprets its code. This is a practical\n // solution that requires the user to opt into importing specific locales.\n // https://github.com/jmblog/how-to-optimize-momentjs-with-webpack\n // You can remove this if you don't use Moment.js:\n new IgnorePlugin({\n resourceRegExp: /^\\.\\/locale$/,\n contextRegExp: /moment$/,\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"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAGA;;AAEA;;;;;;;;;;AAEA,MAAMA,eAAe,GAAGC,OAAO,CAACC,OAAR,CAAgB,cAAhB,CAAxB;;AAEA,MAAMC,oBAAoB,GAAG,CAC3B,SAD2B,EAE3B,KAF2B,EAG3B,QAH2B,EAI3B,IAJ2B,EAK3B,KAL2B,EAM3B,QAN2B,EAO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,CAPK;IAFD,CA3BH;IAuSL;IACAU,OAAO,EAAE,CACP5D,eAAe,IACb,KAAIM,+BAAJ,EAAyB;MACvB;MACA;MACAiD,QAAQ,EAAE,uCAHa;MAIvBM,aAAa,EAAE;IAJQ,CAAzB,CAFK,EAQP;IACA;IACA;IACA;IACA;IACA,KAAIC,uBAAJ,EAAiB;MACfC,cAAc,EAAE,cADD;MAEfC,aAAa,EAAE;IAFA,CAAjB,CAbO,EAiBPC,MAjBO,CAiBAC,OAjBA,CAxSJ;IA0TL;IACA;IACAC,WAAW,EAAE;EA5TR,CAAP;AA8TD"}
|
|
1
|
+
{"version":3,"names":["styleLoaderPath","require","resolve","moduleFileExtensions","shouldUseSourceMap","process","env","GENERATE_SOURCEMAP","imageInlineSizeLimit","parseInt","IMAGE_INLINE_SIZE_LIMIT","isEnvProduction","isEnvProductionProfile","argv","includes","baseStyleLoadersOptions","injectingLoader","MiniCssExtractPlugin","loader","cssLoaderPath","postCssLoaderPath","postCssConfig","extensions","map","ext","alias","module","strictExportPresence","rules","test","fullySpecified","oneOf","stylesRegexps","cssNoModulesRegex","use","generateStyleLoaders","merge","cssLoaderOpts","importLoaders","sourceMap","sideEffects","exclude","options","babelrc","configFile","customize","presets","cacheDirectory","cacheCompression","compact","cssModuleRegex","modules","getLocalIdent","getCSSModuleLocalIdent","sassNoModuleRegex","preProcessOptions","resolveUrlLoaderPath","preProcessorPath","sassModuleRegex","lessNoModuleRegex","lessModuleRegex","type","parser","dataUrlCondition","maxSize","generator","filename","dependency","not","titleProp","ref","plugins","chunkFilename","IgnorePlugin","resourceRegExp","contextRegExp","filter","Boolean","performance"],"sources":["webpack.config.base.ts"],"sourcesContent":["import { merge } from 'lodash';\nimport 'style-loader';\nimport MiniCssExtractPlugin from 'mini-css-extract-plugin';\nimport getCSSModuleLocalIdent from 'react-dev-utils/getCSSModuleLocalIdent';\nimport { Configuration, IgnorePlugin } from 'webpack';\nimport * as stylesRegexps from '@teambit/webpack.modules.style-regexps';\nimport { generateStyleLoaders } from '@teambit/webpack.modules.generate-style-loaders';\nimport { postCssConfig } from './postcss.config';\n// Make sure the bit-react-transformer is a dependency\n// TODO: remove it once we can set policy from component to component then set it via the component.json\nimport '@teambit/react.babel.bit-react-transformer';\n// Make sure the mdx-loader is a dependency\nimport '@teambit/mdx.modules.mdx-loader';\n\nconst styleLoaderPath = require.resolve('style-loader');\n\nconst moduleFileExtensions = [\n 'web.mjs',\n 'mjs',\n 'web.js',\n 'js',\n 'cjs',\n 'web.ts',\n 'ts',\n 'web.tsx',\n 'tsx',\n 'json',\n 'web.jsx',\n 'jsx',\n 'mdx',\n 'md',\n];\n\n// Source maps are resource heavy and can cause out of memory issue for large source files.\nconst shouldUseSourceMap = process.env.GENERATE_SOURCEMAP !== 'false';\n\nconst imageInlineSizeLimit = parseInt(process.env.IMAGE_INLINE_SIZE_LIMIT || '10000');\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 (isEnvProduction = false): Configuration {\n // Variable used for enabling profiling in Production\n // passed into alias object. Uses a flag if passed into the build command\n const isEnvProductionProfile = process.argv.includes('--profile');\n\n const baseStyleLoadersOptions = {\n injectingLoader: isEnvProduction ? MiniCssExtractPlugin.loader : styleLoaderPath,\n cssLoaderPath: require.resolve('css-loader'),\n postCssLoaderPath: require.resolve('postcss-loader'),\n postCssConfig,\n };\n\n // We will provide `paths.publicUrlOrPath` to our app\n // as %PUBLIC_URL% in `index.html` and `process.env.PUBLIC_URL` in JavaScript.\n // Omit trailing slash as %PUBLIC_URL%/xyz looks better than %PUBLIC_URL%xyz.\n // Get environment variables to inject into our app.\n // const env = getClientEnvironment(publicUrlOrPath.slice(0, -1));\n\n return {\n // TODO: make the dev tool according to shouldUseSourceMap and isEnvProduction\n // devtool: 'inline-source-map',\n resolve: {\n // These are the reasonable defaults supported by the Node ecosystem.\n // We also include JSX as a common component filename extension to support\n // some tools, although we do not recommend using it, see:\n // https://github.com/facebook/create-react-app/issues/290\n // `web` extension prefixes have been added for better support\n // for React Native Web.\n extensions: moduleFileExtensions.map((ext) => `.${ext}`),\n\n alias: {\n 'react/jsx-dev-runtime': require.resolve('react/jsx-dev-runtime.js'),\n 'react/jsx-runtime': require.resolve('react/jsx-runtime.js'),\n 'react-dom/server': require.resolve('react-dom/server'),\n // Allows for better profiling with ReactDevTools\n ...(isEnvProductionProfile && {\n 'react-dom$': 'react-dom/profiling',\n 'scheduler/tracing': 'scheduler/tracing-profiling',\n }),\n },\n },\n module: {\n strictExportPresence: true,\n rules: [\n {\n test: /\\.m?js/,\n resolve: {\n fullySpecified: false,\n },\n },\n {\n // \"oneOf\" will traverse all following loaders until one will\n // match the requirements. When no loader matches it will fall\n // back to the \"file\" loader at the end of the loader list.\n oneOf: [\n // \"postcss\" loader applies autoprefixer to our CSS.\n // \"css\" loader resolves paths in CSS and adds assets as dependencies.\n // \"style\" loader turns CSS into JS modules that inject <style> tags.\n // In production, we use MiniCSSExtractPlugin to extract that CSS\n // to a file, but in development \"style\" loader enables hot editing\n // of CSS.\n // By default we support CSS Modules with the extension .module.css\n {\n test: stylesRegexps.cssNoModulesRegex,\n use: generateStyleLoaders(\n merge({}, baseStyleLoadersOptions, {\n cssLoaderOpts: {\n importLoaders: 1,\n sourceMap: isEnvProduction || shouldUseSourceMap,\n },\n })\n ),\n // Don't consider CSS imports dead code even if the\n // containing package claims to have no side effects.\n // Remove this when webpack adds a warning or an error for this.\n // See https://github.com/webpack/webpack/issues/6571\n sideEffects: true,\n },\n\n // Process application JS with Babel.\n // The preset includes JSX, Flow, TypeScript, and some ESnext features.\n {\n test: /\\.(js|mjs|jsx|ts|tsx)$/,\n exclude: [/node_modules/, /\\/dist\\//],\n // consider: limit loader to files only in a capsule that has bitid in package.json\n // descriptionData: { componentId: ComponentID.isValidObject },\n // // or\n // include: capsulePaths\n loader: require.resolve('babel-loader'),\n options: {\n babelrc: false,\n configFile: false,\n customize: require.resolve('babel-preset-react-app/webpack-overrides'),\n presets: [require.resolve('@babel/preset-react')],\n // This is a feature of `babel-loader` for webpack (not Babel itself).\n // It enables caching results in ./node_modules/.cache/babel-loader/\n // directory for faster rebuilds.\n cacheDirectory: true,\n // See #6846 for context on why cacheCompression is disabled\n cacheCompression: false,\n compact: isEnvProduction,\n },\n },\n // Process any JS outside of the app with Babel.\n // Unlike the application JS, we only compile the standard ES features.\n // Probably not needed in our use case\n // {\n // test: /\\.(js|mjs)$/,\n // exclude: /@babel(?:\\/|\\\\{1,2})runtime/,\n // loader: require.resolve('babel-loader'),\n // options: {\n // babelrc: false,\n // configFile: false,\n // compact: false,\n // presets: [[require.resolve('babel-preset-react-app/dependencies'), { helpers: true }]],\n // cacheDirectory: true,\n // // See #6846 for context on why cacheCompression is disabled\n // cacheCompression: false,\n\n // // Babel sourcemaps are needed for debugging into node_modules\n // // code. Without the options below, debuggers like VSCode\n // // show incorrect code and set breakpoints on the wrong lines.\n // sourceMaps: shouldUseSourceMap,\n // inputSourceMap: shouldUseSourceMap,\n // },\n // },\n // MDX support (move to the mdx aspect and extend from there)\n {\n test: /\\.mdx?$/,\n exclude: [/node_modules/],\n use: [\n {\n loader: require.resolve('babel-loader'),\n options: {\n babelrc: false,\n configFile: false,\n presets: [require.resolve('@babel/preset-react'), require.resolve('@babel/preset-env')],\n },\n },\n {\n loader: require.resolve('@teambit/mdx.modules.mdx-loader'),\n },\n ],\n },\n // Adds support for CSS Modules (https://github.com/css-modules/css-modules)\n // using the extension .module.css\n {\n test: stylesRegexps.cssModuleRegex,\n use: generateStyleLoaders(\n merge({}, baseStyleLoadersOptions, {\n cssLoaderOpts: {\n importLoaders: 1,\n sourceMap: isEnvProduction || shouldUseSourceMap,\n modules: {\n getLocalIdent: getCSSModuleLocalIdent,\n },\n },\n shouldUseSourceMap: isEnvProduction || shouldUseSourceMap,\n })\n ),\n },\n // Opt-in support for SASS (using .scss or .sass extensions).\n // By default we support SASS Modules with the\n // extensions .module.scss or .module.sass\n {\n test: stylesRegexps.sassNoModuleRegex,\n use: generateStyleLoaders(\n merge({}, baseStyleLoadersOptions, {\n cssLoaderOpts: {\n importLoaders: 3,\n sourceMap: isEnvProduction || shouldUseSourceMap,\n },\n shouldUseSourceMap: isEnvProduction || shouldUseSourceMap,\n preProcessOptions: {\n resolveUrlLoaderPath: require.resolve('resolve-url-loader'),\n preProcessorPath: require.resolve('sass-loader'),\n },\n })\n ),\n // Don't consider CSS imports dead code even if the\n // containing package claims to have no side effects.\n // Remove this when webpack adds a warning or an error for this.\n // See https://github.com/webpack/webpack/issues/6571\n sideEffects: true,\n },\n // Adds support for CSS Modules, but using SASS\n // using the extension .module.scss or .module.sass\n {\n test: stylesRegexps.sassModuleRegex,\n use: generateStyleLoaders(\n merge({}, baseStyleLoadersOptions, {\n cssLoaderOpts: {\n importLoaders: 3,\n sourceMap: isEnvProduction || shouldUseSourceMap,\n modules: {\n getLocalIdent: getCSSModuleLocalIdent,\n },\n },\n shouldUseSourceMap: isEnvProduction || shouldUseSourceMap,\n preProcessOptions: {\n resolveUrlLoaderPath: require.resolve('resolve-url-loader'),\n preProcessorPath: require.resolve('sass-loader'),\n },\n })\n ),\n },\n {\n test: stylesRegexps.lessNoModuleRegex,\n use: generateStyleLoaders(\n merge({}, baseStyleLoadersOptions, {\n cssLoaderOpts: {\n importLoaders: 1,\n sourceMap: isEnvProduction || shouldUseSourceMap,\n },\n shouldUseSourceMap: isEnvProduction || shouldUseSourceMap,\n preProcessOptions: {\n resolveUrlLoaderPath: require.resolve('resolve-url-loader'),\n preProcessorPath: require.resolve('less-loader'),\n },\n })\n ),\n // Don't consider CSS imports dead code even if the\n // containing package claims to have no side effects.\n // Remove this when webpack adds a warning or an error for this.\n // See https://github.com/webpack/webpack/issues/6571\n sideEffects: true,\n },\n {\n test: stylesRegexps.lessModuleRegex,\n use: generateStyleLoaders(\n merge({}, baseStyleLoadersOptions, {\n cssLoaderOpts: {\n importLoaders: 1,\n sourceMap: isEnvProduction || shouldUseSourceMap,\n modules: {\n getLocalIdent: getCSSModuleLocalIdent,\n },\n },\n shouldUseSourceMap: isEnvProduction || shouldUseSourceMap,\n preProcessOptions: {\n resolveUrlLoaderPath: require.resolve('resolve-url-loader'),\n preProcessorPath: require.resolve('less-loader'),\n },\n })\n ),\n },\n {\n test: [/\\.bmp$/, /\\.gif$/, /\\.jpe?g$/, /\\.png$/],\n type: 'asset',\n parser: {\n dataUrlCondition: {\n maxSize: imageInlineSizeLimit,\n },\n },\n generator: {\n filename: 'static/images/[hash][ext][query]',\n },\n },\n {\n // loads svg as both inlineUrl and react component, like:\n // import starUrl, { ReactComponent as StarIcon } from './star.svg';\n // (remove when there is native support for both opitons from webpack5 / svgr)\n test: /\\.svg$/,\n oneOf: [\n {\n dependency: { not: ['url'] }, // exclude new URL calls\n use: [\n {\n loader: require.resolve('@svgr/webpack'),\n options: { titleProp: true, ref: true },\n },\n require.resolve('new-url-loader'),\n ],\n },\n {\n type: 'asset', // export a data URI or emit a separate file\n },\n ],\n },\n {\n test: /\\.(woff(2)?|ttf|eot|svg)(\\?v=\\d+\\.\\d+\\.\\d+)?$/,\n type: 'asset',\n generator: {\n filename: 'static/fonts/[hash][ext][query]',\n },\n },\n\n // \"file\" loader makes sure those assets get served by WebpackDevServer.\n // When you `import` an asset, you get its (virtual) filename.\n // In production, they would get copied to the `build` folder.\n // This loader doesn't use a \"test\" so it will catch all modules\n // that fall through the other loaders.\n {\n // Exclude `js` files to keep \"css\" loader working as it injects\n // its runtime that would otherwise be processed through \"file\" loader.\n // Also exclude `html` and `json` extensions so they get processed\n // by webpacks internal loaders.\n exclude: [/\\.(js|mjs|cjs|jsx|ts|tsx)$/, /\\.html$/, /\\.mdx?/, /\\.json$/, /\\.css$/],\n generator: {\n filename: 'static/[hash][ext][query]',\n },\n type: 'asset',\n },\n // ** STOP ** Are you adding a new loader?\n // Make sure to add the new loader(s) before the \"type:asset\" loader.\n ],\n },\n ],\n },\n // @ts-ignore\n plugins: [\n isEnvProduction &&\n new MiniCssExtractPlugin({\n // Options similar to the same options in webpackOptions.output\n // both options are optional\n filename: 'static/css/[name].[contenthash:8].css',\n chunkFilename: 'static/css/[name].[contenthash:8].chunk.css',\n }),\n // Moment.js is an extremely popular library that bundles large locale files\n // by default due to how webpack interprets its code. This is a practical\n // solution that requires the user to opt into importing specific locales.\n // https://github.com/jmblog/how-to-optimize-momentjs-with-webpack\n // You can remove this if you don't use Moment.js:\n new IgnorePlugin({\n resourceRegExp: /^\\.\\/locale$/,\n contextRegExp: /moment$/,\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"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAGA;;AAEA;;;;;;;;;;AAEA,MAAMA,eAAe,GAAGC,OAAO,CAACC,OAAR,CAAgB,cAAhB,CAAxB;;AAEA,MAAMC,oBAAoB,GAAG,CAC3B,SAD2B,EAE3B,KAF2B,EAG3B,QAH2B,EAI3B,IAJ2B,EAK3B,KAL2B,EAM3B,QAN2B,EAO3B,IAP2B,EAQ3B,SAR2B,EAS3B,KAT2B,EAU3B,MAV2B,EAW3B,SAX2B,EAY3B,KAZ2B,EAa3B,KAb2B,EAc3B,IAd2B,CAA7B,C,CAiBA;;AACA,MAAMC,kBAAkB,GAAGC,OAAO,CAACC,GAAR,CAAYC,kBAAZ,KAAmC,OAA9D;AAEA,MAAMC,oBAAoB,GAAGC,QAAQ,CAACJ,OAAO,CAACC,GAAR,CAAYI,uBAAZ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