@teambit/compiler 1.0.395 → 1.0.396

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.
@@ -1,4 +1,4 @@
1
1
  <?xml version="1.0" encoding="UTF-8"?>
2
2
  <testsuites tests="0" failures="0" errors="0" skipped="0">
3
- <testsuite name="teambit.compilation/compiler@1.0.395" tests="0" failures="0" errors="0" skipped="0"/>
3
+ <testsuite name="teambit.compilation/compiler@1.0.396" tests="0" failures="0" errors="0" skipped="0"/>
4
4
  </testsuites>
@@ -1 +1 @@
1
- !function(e,n){"object"==typeof exports&&"object"==typeof module?module.exports=n():"function"==typeof define&&define.amd?define([],n):"object"==typeof exports?exports["teambit.compilation/compiler-preview"]=n():e["teambit.compilation/compiler-preview"]=n()}(self,(()=>(()=>{"use strict";var e={12871:(e,n,t)=>{var o={id:"teambit.compilation/content/compiler-overview@1.95.0",homepage:"https://bit.dev/teambit/compilation/content/compiler-overview",exported:!0};Object.defineProperty(n,"__esModule",{value:!0}),n.default=u,p(t(41594));var i=t(5016),r=t(65682),a=["components"];function p(e){return e&&e.__esModule?e:{default:e}}function m(){return m=Object.assign||function(e){for(var n=1;n<arguments.length;n++){var t=arguments[n];for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}return e},m.apply(this,arguments)}function l(e,n){if(null==e)return{};var t,o,i=d(e,n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(o=0;o<r.length;o++)t=r[o],n.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(i[t]=e[t])}return i}function d(e,n){if(null==e)return{};var t,o,i={},r=Object.keys(e);for(o=0;o<r.length;o++)t=r[o],n.indexOf(t)>=0||(i[t]=e[t]);return i}p.__bit_component=o,m.__bit_component=o,l.__bit_component=o,d.__bit_component=o;var c={},s="wrapper";function u(e){var n=e.components,t=l(e,a);return(0,i.mdx)(s,m({},c,t,{components:n,mdxType:"MDXLayout"}),(0,i.mdx)(r.MDXScopeProvider,{components:{},mdxType:"MDXScopeProvider"},(0,i.mdx)("h1",null,"Compiler overview"),(0,i.mdx)("p",null,"The Compiler aspect provides a single interface for Component compilation, ",(0,i.mdx)("a",{parentName:"p",href:"/"},"during development")," and ",(0,i.mdx)("a",{parentName:"p",href:"/"},"during build"),".\nIt enables you to use the same commands and APIs to compile any Component, regardless of the specific compiler it uses."),(0,i.mdx)("div",{className:"admonition admonition-info alert alert--info"},(0,i.mdx)("div",{parentName:"div",className:"admonition-heading"},(0,i.mdx)("h5",{parentName:"div"},(0,i.mdx)("span",{parentName:"h5",className:"admonition-icon"},(0,i.mdx)("svg",{parentName:"span",xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"},(0,i.mdx)("path",{parentName:"svg",fillRule:"evenodd",d:"M7 2.3c3.14 0 5.7 2.56 5.7 5.7s-2.56 5.7-5.7 5.7A5.71 5.71 0 0 1 1.3 8c0-3.14 2.56-5.7 5.7-5.7zM7 1C3.14 1 0 4.14 0 8s3.14 7 7 7 7-3.14 7-7-3.14-7-7-7zm1 3H6v5h2V4zm0 6H6v2h2v-2z"}))),"info")),(0,i.mdx)("div",{parentName:"div",className:"admonition-content"},(0,i.mdx)("p",{parentName:"div"},"The specific compiler used by a Component (",(0,i.mdx)("a",{parentName:"p",href:"/"},"Babel"),", ",(0,i.mdx)("a",{parentName:"p",href:"/"},"TypeScript"),", and so on) is set by the Component's Env."))),(0,i.mdx)("h2",null,"Compiling during development"),(0,i.mdx)("p",null,"Run the following to compile all your Workspace Components:"),(0,i.mdx)("pre",null,(0,i.mdx)("code",{parentName:"pre",className:"language-bash"},"bit compile\n")),(0,i.mdx)("p",null,"The following output lists the compilation results in a single format:"),(0,i.mdx)("pre",null,(0,i.mdx)("code",{parentName:"pre",className:"language-bash"}," STATUS COMPONENT ID\n✔ SUCCESS apps/bit-dev\n✔ SUCCESS blocks/component/architecture-breakdown\n✔ SUCCESS blocks/footer\n✔ SUCCESS blocks/header\n✔ SUCCESS buttons/button\n✔ SUCCESS content/adding-components\n")),(0,i.mdx)("p",null,"To 'watch' Components for changes, and to auto-compile modified Components, run:"),(0,i.mdx)("pre",null,(0,i.mdx)("code",{parentName:"pre"},"bit watch\n")),(0,i.mdx)("p",null,"The compiled code is written into each Component's corresponding package, in the ",(0,i.mdx)("a",{parentName:"p",href:"/dependencies/node-modules"},(0,i.mdx)("inlineCode",{parentName:"a"},"node_modules")," directory")," of your workspace.\nFor example, the compiled code for ",(0,i.mdx)("inlineCode",{parentName:"p"},"company.scope/ui/text")," will be found in the ",(0,i.mdx)("inlineCode",{parentName:"p"},"./node_modules/@company/scope.ui.text/dist")," directory (inside your workspace)."),(0,i.mdx)("p",null,"To learn more about compilation in the Workspace, see ",(0,i.mdx)("a",{parentName:"p",href:"/"},"'Compiling during development'"),"."),(0,i.mdx)("h2",null,"Compiling during build"),(0,i.mdx)("p",null,"Run the following to compile Components as part of the ",(0,i.mdx)("a",{parentName:"p",href:"/"},"build pipeline")," (which prepares Components for distribution):"),(0,i.mdx)("pre",null,(0,i.mdx)("code",{parentName:"pre",className:"language-bash"},"bit build\n")),(0,i.mdx)("p",null,"The output to the terminal details the specific compilers being used, as well as the Envs that use them:"),(0,i.mdx)("pre",null,(0,i.mdx)("code",{parentName:"pre",className:"language-bash"},'...\n✔ env "teambit.harmony/aspect", task "teambit.compilation/compiler:BabelCompiler (compile components for artifact dist)" has completed successfully in 363ms\n✔ env "teambit.react/react", task "teambit.compilation/compiler:TSCompiler (compile components for artifact dist)" has completed successfully in 1s\n✔ env "teambit.mdx/mdx", task "teambit.compilation/compiler:MDXCompiler (compile components)" has completed successfully in 879ms\n...\nthe build has been completed. total: 19 tasks\n')),(0,i.mdx)("p",null,"The compiled code is written into the ",(0,i.mdx)("a",{parentName:"p",href:"/"},"Component's Capsule"),". Run ",(0,i.mdx)("a",{parentName:"p",href:"/"},(0,i.mdx)("inlineCode",{parentName:"a"},"bit snap"))," or ",(0,i.mdx)("a",{parentName:"p",href:"/"},(0,i.mdx)("inlineCode",{parentName:"a"},"bit tag"))," to execute the build pipeline (as well as other pipelines), and have the compiled code persisted in the ",(0,i.mdx)("a",{parentName:"p",href:"/"},"Component version"),", and included in the ",(0,i.mdx)("a",{parentName:"p",href:"/"},"Component's package"),"."),(0,i.mdx)("p",null,"To learn more about compilation in the Workspace, see ",(0,i.mdx)("a",{parentName:"p",href:"/"},"'Compiling during build'"),"."),(0,i.mdx)("h2",null,"Compilation strategies and standards"),(0,i.mdx)("p",null,"The Compiler aspect does not set specific compilation strategies as these are defined by the ",(0,i.mdx)("a",{parentName:"p",href:"/"},"specific compilers")," themselves (and are often configurable by the Envs that use them)."),(0,i.mdx)("p",null,"However, all official Bit compilers are configured to favor dev experience when compiling during development, and to favor runtime performance and code universality, when compiling for distribution (during build)."),(0,i.mdx)("p",null,"For example, Bit's ",(0,i.mdx)("a",{parentName:"p",href:"/"},"TypeScript compiler")," performs type-checking when compiling during build but skips it when compiling during development.\nThis enables faster compilation and better dev experience."),(0,i.mdx)("p",null,"To examine a Component's specific compiler config, run the following:"),(0,i.mdx)("pre",null,(0,i.mdx)("code",{parentName:"pre"},"bit env get COMPONENT_ID\n")),(0,i.mdx)("p",null,"For example:"),(0,i.mdx)("pre",null,(0,i.mdx)("code",{parentName:"pre"},"bit env get company.demo/ui/card\n")),(0,i.mdx)("p",null,"The output details the Component's env config which includes the compiler config:"),(0,i.mdx)("pre",null,(0,i.mdx)("code",{parentName:"pre",className:"language-bash"},'Environment: teambit.react/react\n...\nteambit.compilation/compiler\n\nconfigured compiler: teambit.typescript/typescript (TypeScript @ 4.4.2)\ncompiler config:\n{\n "compilerOptions": {\n "lib": [\n "es2019",\n "DOM",\n "ES6",\n "DOM.Iterable"\n ],\n "target": "es2015",\n "module": "commonjs",\n "jsx": "react",\n "declaration": true,\n "sourceMap": true,\n "skipLibCheck": true,\n "moduleResolution": "node",\n "esModuleInterop": true,\n "resolveJsonModule": true,\n "outDir": "dist"\n },\n "exclude": [\n "dist"\n ]\n}\n\n')),(0,i.mdx)("h2",null,"Setting a Component with a specific compiler"),(0,i.mdx)("p",null,"Specific compilers are applied on Components via the Components' Envs. For example, the ",(0,i.mdx)("inlineCode",{parentName:"p"},"company.demo/ui/card")," Component examined earlier, is applied with\nthe ",(0,i.mdx)("a",{parentName:"p",href:"/"},"TypeScript")," compiler by its Env, the React Env."),(0,i.mdx)("p",null,"To learn how to use a specific compiler, see ",(0,i.mdx)("a",{parentName:"p",href:"/"},"'Using compilers'"),".")))}u.__bit_component=o,u.isMDXComponent=!0},44645:(e,n,t)=>{Object.defineProperty(n,"Ay",{enumerable:!0,get:function(){return o.default}});var o=i(t(12871));function i(e){return e&&e.__esModule?e:{default:e}}i.__bit_component={id:"teambit.compilation/content/compiler-overview@1.95.0",homepage:"https://bit.dev/teambit/compilation/content/compiler-overview",exported:!0}},34241:(e,n,t)=>{var o={id:"teambit.compilation/compiler@1.0.395",homepage:"https://bit.cloud/teambit/compilation/compiler",exported:!0};function i(){const e=r(t(41594));return i=function(){return e},e}function r(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(n,"__esModule",{value:!0}),n.Logo=void 0,i.__bit_component=o,r.__bit_component=o;const a=()=>i().default.createElement("div",{style:{height:"100%",display:"flex",justifyContent:"center"}},i().default.createElement("img",{style:{width:70},src:"https://static.bit.dev/extensions-icons/compiler.svg"}));a.__bit_component=o,n.Logo=a},5016:e=>{e.exports=MdxJsReact},41594:e=>{e.exports=React},65682:e=>{e.exports=TeambitMdxUiMdxScopeContext}},n={};function t(o){var i=n[o];if(void 0!==i)return i.exports;var r=n[o]={exports:{}};return e[o](r,r.exports,t),r.exports}t.d=(e,n)=>{for(var o in n)t.o(n,o)&&!t.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:n[o]})},t.o=(e,n)=>Object.prototype.hasOwnProperty.call(e,n),t.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var o={};t.r(o),t.d(o,{compositions:()=>f,compositions_metadata:()=>x,overview:()=>h});var i={};t.r(i),t.d(i,{default:()=>u});var r=t(34241),a=(t(41594),t(5016)),p=t(65682),m=t(44645),l=["components"];function d(){return d=Object.assign?Object.assign.bind():function(e){for(var n=1;n<arguments.length;n++){var t=arguments[n];for(var o in t)({}).hasOwnProperty.call(t,o)&&(e[o]=t[o])}return e},d.apply(null,arguments)}var c={},s="wrapper";function u(e){var n=e.components,t=function(e,n){if(null==e)return{};var t,o,i=function(e,n){if(null==e)return{};var t={};for(var o in e)if({}.hasOwnProperty.call(e,o)){if(n.includes(o))continue;t[o]=e[o]}return t}(e,n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(o=0;o<r.length;o++)t=r[o],n.includes(t)||{}.propertyIsEnumerable.call(e,t)&&(i[t]=e[t])}return i}(e,l);return(0,a.mdx)(s,d({},c,t,{components:n,mdxType:"MDXLayout"}),(0,a.mdx)(p.MDXScopeProvider,{components:{CompilerOverview:m.Ay},mdxType:"MDXScopeProvider"},(0,a.mdx)(m.Ay,{mdxType:"CompilerOverview"})))}u.isMDXComponent=!0;const f=[r],h=[i],x={compositions:[{displayName:"Logo",identifier:"Logo"}]};return o})()));
1
+ !function(e,n){"object"==typeof exports&&"object"==typeof module?module.exports=n():"function"==typeof define&&define.amd?define([],n):"object"==typeof exports?exports["teambit.compilation/compiler-preview"]=n():e["teambit.compilation/compiler-preview"]=n()}(self,(()=>(()=>{"use strict";var e={12871:(e,n,t)=>{var o={id:"teambit.compilation/content/compiler-overview@1.95.0",homepage:"https://bit.dev/teambit/compilation/content/compiler-overview",exported:!0};Object.defineProperty(n,"__esModule",{value:!0}),n.default=u,p(t(41594));var i=t(5016),r=t(65682),a=["components"];function p(e){return e&&e.__esModule?e:{default:e}}function m(){return m=Object.assign||function(e){for(var n=1;n<arguments.length;n++){var t=arguments[n];for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}return e},m.apply(this,arguments)}function l(e,n){if(null==e)return{};var t,o,i=d(e,n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(o=0;o<r.length;o++)t=r[o],n.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(i[t]=e[t])}return i}function d(e,n){if(null==e)return{};var t,o,i={},r=Object.keys(e);for(o=0;o<r.length;o++)t=r[o],n.indexOf(t)>=0||(i[t]=e[t]);return i}p.__bit_component=o,m.__bit_component=o,l.__bit_component=o,d.__bit_component=o;var c={},s="wrapper";function u(e){var n=e.components,t=l(e,a);return(0,i.mdx)(s,m({},c,t,{components:n,mdxType:"MDXLayout"}),(0,i.mdx)(r.MDXScopeProvider,{components:{},mdxType:"MDXScopeProvider"},(0,i.mdx)("h1",null,"Compiler overview"),(0,i.mdx)("p",null,"The Compiler aspect provides a single interface for Component compilation, ",(0,i.mdx)("a",{parentName:"p",href:"/"},"during development")," and ",(0,i.mdx)("a",{parentName:"p",href:"/"},"during build"),".\nIt enables you to use the same commands and APIs to compile any Component, regardless of the specific compiler it uses."),(0,i.mdx)("div",{className:"admonition admonition-info alert alert--info"},(0,i.mdx)("div",{parentName:"div",className:"admonition-heading"},(0,i.mdx)("h5",{parentName:"div"},(0,i.mdx)("span",{parentName:"h5",className:"admonition-icon"},(0,i.mdx)("svg",{parentName:"span",xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"},(0,i.mdx)("path",{parentName:"svg",fillRule:"evenodd",d:"M7 2.3c3.14 0 5.7 2.56 5.7 5.7s-2.56 5.7-5.7 5.7A5.71 5.71 0 0 1 1.3 8c0-3.14 2.56-5.7 5.7-5.7zM7 1C3.14 1 0 4.14 0 8s3.14 7 7 7 7-3.14 7-7-3.14-7-7-7zm1 3H6v5h2V4zm0 6H6v2h2v-2z"}))),"info")),(0,i.mdx)("div",{parentName:"div",className:"admonition-content"},(0,i.mdx)("p",{parentName:"div"},"The specific compiler used by a Component (",(0,i.mdx)("a",{parentName:"p",href:"/"},"Babel"),", ",(0,i.mdx)("a",{parentName:"p",href:"/"},"TypeScript"),", and so on) is set by the Component's Env."))),(0,i.mdx)("h2",null,"Compiling during development"),(0,i.mdx)("p",null,"Run the following to compile all your Workspace Components:"),(0,i.mdx)("pre",null,(0,i.mdx)("code",{parentName:"pre",className:"language-bash"},"bit compile\n")),(0,i.mdx)("p",null,"The following output lists the compilation results in a single format:"),(0,i.mdx)("pre",null,(0,i.mdx)("code",{parentName:"pre",className:"language-bash"}," STATUS COMPONENT ID\n✔ SUCCESS apps/bit-dev\n✔ SUCCESS blocks/component/architecture-breakdown\n✔ SUCCESS blocks/footer\n✔ SUCCESS blocks/header\n✔ SUCCESS buttons/button\n✔ SUCCESS content/adding-components\n")),(0,i.mdx)("p",null,"To 'watch' Components for changes, and to auto-compile modified Components, run:"),(0,i.mdx)("pre",null,(0,i.mdx)("code",{parentName:"pre"},"bit watch\n")),(0,i.mdx)("p",null,"The compiled code is written into each Component's corresponding package, in the ",(0,i.mdx)("a",{parentName:"p",href:"/dependencies/node-modules"},(0,i.mdx)("inlineCode",{parentName:"a"},"node_modules")," directory")," of your workspace.\nFor example, the compiled code for ",(0,i.mdx)("inlineCode",{parentName:"p"},"company.scope/ui/text")," will be found in the ",(0,i.mdx)("inlineCode",{parentName:"p"},"./node_modules/@company/scope.ui.text/dist")," directory (inside your workspace)."),(0,i.mdx)("p",null,"To learn more about compilation in the Workspace, see ",(0,i.mdx)("a",{parentName:"p",href:"/"},"'Compiling during development'"),"."),(0,i.mdx)("h2",null,"Compiling during build"),(0,i.mdx)("p",null,"Run the following to compile Components as part of the ",(0,i.mdx)("a",{parentName:"p",href:"/"},"build pipeline")," (which prepares Components for distribution):"),(0,i.mdx)("pre",null,(0,i.mdx)("code",{parentName:"pre",className:"language-bash"},"bit build\n")),(0,i.mdx)("p",null,"The output to the terminal details the specific compilers being used, as well as the Envs that use them:"),(0,i.mdx)("pre",null,(0,i.mdx)("code",{parentName:"pre",className:"language-bash"},'...\n✔ env "teambit.harmony/aspect", task "teambit.compilation/compiler:BabelCompiler (compile components for artifact dist)" has completed successfully in 363ms\n✔ env "teambit.react/react", task "teambit.compilation/compiler:TSCompiler (compile components for artifact dist)" has completed successfully in 1s\n✔ env "teambit.mdx/mdx", task "teambit.compilation/compiler:MDXCompiler (compile components)" has completed successfully in 879ms\n...\nthe build has been completed. total: 19 tasks\n')),(0,i.mdx)("p",null,"The compiled code is written into the ",(0,i.mdx)("a",{parentName:"p",href:"/"},"Component's Capsule"),". Run ",(0,i.mdx)("a",{parentName:"p",href:"/"},(0,i.mdx)("inlineCode",{parentName:"a"},"bit snap"))," or ",(0,i.mdx)("a",{parentName:"p",href:"/"},(0,i.mdx)("inlineCode",{parentName:"a"},"bit tag"))," to execute the build pipeline (as well as other pipelines), and have the compiled code persisted in the ",(0,i.mdx)("a",{parentName:"p",href:"/"},"Component version"),", and included in the ",(0,i.mdx)("a",{parentName:"p",href:"/"},"Component's package"),"."),(0,i.mdx)("p",null,"To learn more about compilation in the Workspace, see ",(0,i.mdx)("a",{parentName:"p",href:"/"},"'Compiling during build'"),"."),(0,i.mdx)("h2",null,"Compilation strategies and standards"),(0,i.mdx)("p",null,"The Compiler aspect does not set specific compilation strategies as these are defined by the ",(0,i.mdx)("a",{parentName:"p",href:"/"},"specific compilers")," themselves (and are often configurable by the Envs that use them)."),(0,i.mdx)("p",null,"However, all official Bit compilers are configured to favor dev experience when compiling during development, and to favor runtime performance and code universality, when compiling for distribution (during build)."),(0,i.mdx)("p",null,"For example, Bit's ",(0,i.mdx)("a",{parentName:"p",href:"/"},"TypeScript compiler")," performs type-checking when compiling during build but skips it when compiling during development.\nThis enables faster compilation and better dev experience."),(0,i.mdx)("p",null,"To examine a Component's specific compiler config, run the following:"),(0,i.mdx)("pre",null,(0,i.mdx)("code",{parentName:"pre"},"bit env get COMPONENT_ID\n")),(0,i.mdx)("p",null,"For example:"),(0,i.mdx)("pre",null,(0,i.mdx)("code",{parentName:"pre"},"bit env get company.demo/ui/card\n")),(0,i.mdx)("p",null,"The output details the Component's env config which includes the compiler config:"),(0,i.mdx)("pre",null,(0,i.mdx)("code",{parentName:"pre",className:"language-bash"},'Environment: teambit.react/react\n...\nteambit.compilation/compiler\n\nconfigured compiler: teambit.typescript/typescript (TypeScript @ 4.4.2)\ncompiler config:\n{\n "compilerOptions": {\n "lib": [\n "es2019",\n "DOM",\n "ES6",\n "DOM.Iterable"\n ],\n "target": "es2015",\n "module": "commonjs",\n "jsx": "react",\n "declaration": true,\n "sourceMap": true,\n "skipLibCheck": true,\n "moduleResolution": "node",\n "esModuleInterop": true,\n "resolveJsonModule": true,\n "outDir": "dist"\n },\n "exclude": [\n "dist"\n ]\n}\n\n')),(0,i.mdx)("h2",null,"Setting a Component with a specific compiler"),(0,i.mdx)("p",null,"Specific compilers are applied on Components via the Components' Envs. For example, the ",(0,i.mdx)("inlineCode",{parentName:"p"},"company.demo/ui/card")," Component examined earlier, is applied with\nthe ",(0,i.mdx)("a",{parentName:"p",href:"/"},"TypeScript")," compiler by its Env, the React Env."),(0,i.mdx)("p",null,"To learn how to use a specific compiler, see ",(0,i.mdx)("a",{parentName:"p",href:"/"},"'Using compilers'"),".")))}u.__bit_component=o,u.isMDXComponent=!0},44645:(e,n,t)=>{Object.defineProperty(n,"Ay",{enumerable:!0,get:function(){return o.default}});var o=i(t(12871));function i(e){return e&&e.__esModule?e:{default:e}}i.__bit_component={id:"teambit.compilation/content/compiler-overview@1.95.0",homepage:"https://bit.dev/teambit/compilation/content/compiler-overview",exported:!0}},39512:(e,n,t)=>{var o={id:"teambit.compilation/compiler@1.0.396",homepage:"https://bit.cloud/teambit/compilation/compiler",exported:!0};function i(){const e=r(t(41594));return i=function(){return e},e}function r(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(n,"__esModule",{value:!0}),n.Logo=void 0,i.__bit_component=o,r.__bit_component=o;const a=()=>i().default.createElement("div",{style:{height:"100%",display:"flex",justifyContent:"center"}},i().default.createElement("img",{style:{width:70},src:"https://static.bit.dev/extensions-icons/compiler.svg"}));a.__bit_component=o,n.Logo=a},5016:e=>{e.exports=MdxJsReact},41594:e=>{e.exports=React},65682:e=>{e.exports=TeambitMdxUiMdxScopeContext}},n={};function t(o){var i=n[o];if(void 0!==i)return i.exports;var r=n[o]={exports:{}};return e[o](r,r.exports,t),r.exports}t.d=(e,n)=>{for(var o in n)t.o(n,o)&&!t.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:n[o]})},t.o=(e,n)=>Object.prototype.hasOwnProperty.call(e,n),t.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var o={};t.r(o),t.d(o,{compositions:()=>f,compositions_metadata:()=>x,overview:()=>h});var i={};t.r(i),t.d(i,{default:()=>u});var r=t(39512),a=(t(41594),t(5016)),p=t(65682),m=t(44645),l=["components"];function d(){return d=Object.assign?Object.assign.bind():function(e){for(var n=1;n<arguments.length;n++){var t=arguments[n];for(var o in t)({}).hasOwnProperty.call(t,o)&&(e[o]=t[o])}return e},d.apply(null,arguments)}var c={},s="wrapper";function u(e){var n=e.components,t=function(e,n){if(null==e)return{};var t,o,i=function(e,n){if(null==e)return{};var t={};for(var o in e)if({}.hasOwnProperty.call(e,o)){if(n.includes(o))continue;t[o]=e[o]}return t}(e,n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(o=0;o<r.length;o++)t=r[o],n.includes(t)||{}.propertyIsEnumerable.call(e,t)&&(i[t]=e[t])}return i}(e,l);return(0,a.mdx)(s,d({},c,t,{components:n,mdxType:"MDXLayout"}),(0,a.mdx)(p.MDXScopeProvider,{components:{CompilerOverview:m.Ay},mdxType:"MDXScopeProvider"},(0,a.mdx)(m.Ay,{mdxType:"CompilerOverview"})))}u.isMDXComponent=!0;const f=[r],h=[i],x={compositions:[{displayName:"Logo",identifier:"Logo"}]};return o})()));
@@ -1614,7 +1614,7 @@
1614
1614
  "_legacy": {
1615
1615
  "scope": "teambit.compilation",
1616
1616
  "name": "compiler",
1617
- "version": "1.0.395"
1617
+ "version": "1.0.396"
1618
1618
  },
1619
1619
  "_scope": "teambit.compilation"
1620
1620
  }
@@ -2867,7 +2867,7 @@
2867
2867
  "_legacy": {
2868
2868
  "scope": "teambit.compilation",
2869
2869
  "name": "compiler",
2870
- "version": "1.0.395"
2870
+ "version": "1.0.396"
2871
2871
  },
2872
2872
  "_scope": "teambit.compilation"
2873
2873
  }
@@ -3494,7 +3494,7 @@
3494
3494
  "_legacy": {
3495
3495
  "scope": "teambit.compilation",
3496
3496
  "name": "compiler",
3497
- "version": "1.0.395"
3497
+ "version": "1.0.396"
3498
3498
  },
3499
3499
  "_scope": "teambit.compilation"
3500
3500
  }
@@ -5122,7 +5122,7 @@
5122
5122
  "_legacy": {
5123
5123
  "scope": "teambit.compilation",
5124
5124
  "name": "compiler",
5125
- "version": "1.0.395"
5125
+ "version": "1.0.396"
5126
5126
  },
5127
5127
  "_scope": "teambit.compilation"
5128
5128
  }
@@ -6818,7 +6818,7 @@
6818
6818
  "_legacy": {
6819
6819
  "scope": "teambit.compilation",
6820
6820
  "name": "compiler",
6821
- "version": "1.0.395"
6821
+ "version": "1.0.396"
6822
6822
  },
6823
6823
  "_scope": "teambit.compilation"
6824
6824
  }
@@ -6964,7 +6964,7 @@
6964
6964
  "_legacy": {
6965
6965
  "scope": "teambit.compilation",
6966
6966
  "name": "compiler",
6967
- "version": "1.0.395"
6967
+ "version": "1.0.396"
6968
6968
  },
6969
6969
  "_scope": "teambit.compilation"
6970
6970
  }
@@ -7037,7 +7037,7 @@
7037
7037
  "componentId": {
7038
7038
  "scope": "teambit.compilation",
7039
7039
  "name": "compiler",
7040
- "version": "1.0.395"
7040
+ "version": "1.0.396"
7041
7041
  },
7042
7042
  "taggedModuleExports": []
7043
7043
  }
@@ -1,5 +1,5 @@
1
- import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.compilation_compiler@1.0.395/dist/compiler.composition.js';
2
- import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.compilation_compiler@1.0.395/dist/compiler.docs.mdx';
1
+ import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.compilation_compiler@1.0.396/dist/compiler.composition.js';
2
+ import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.compilation_compiler@1.0.396/dist/compiler.docs.mdx';
3
3
 
4
4
  export const compositions = [compositions_0];
5
5
  export const overview = [overview_0];
@@ -73,12 +73,24 @@ export declare class WorkspaceCompiler {
73
73
  options: CompileOptions, noThrow?: boolean, componentLoadOptions?: WorkspaceComponentLoadOptions): Promise<BuildResult[]>;
74
74
  private runCompileComponents;
75
75
  /**
76
- * This function get's a list of aspect ids and return them grouped by whether any of them is the env of other from the list
76
+ * This function groups the components to compile into groups by their environment and dependencies.
77
+ * The order of the groups is important, the first group should be compiled first.
78
+ * The order inside the group is not important.
79
+ * The groups are:
80
+ * 1. dependencies of envs of envs.
81
+ * 2. envs of envs.
82
+ * 3. dependencies of envs.
83
+ * 4. envs.
84
+ * 5. the rest.
77
85
  * @param ids
78
86
  */
79
- groupByIsEnv(components: Component[]): {
80
- envs?: Component[];
81
- other?: Component[];
82
- };
87
+ buildGroupsToCompile(components: Component[]): Promise<Array<{
88
+ components: Component[];
89
+ envsOfEnvs?: boolean;
90
+ envs?: boolean;
91
+ depsOfEnvsOfEnvs?: boolean;
92
+ depsOfEnvs?: boolean;
93
+ other?: boolean;
94
+ }>>;
83
95
  private getIdsToCompile;
84
96
  }
@@ -67,6 +67,13 @@ function _workspaceModules() {
67
67
  };
68
68
  return data;
69
69
  }
70
+ function _dependencyResolver() {
71
+ const data = require("@teambit/dependency-resolver");
72
+ _dependencyResolver = function () {
73
+ return data;
74
+ };
75
+ return data;
76
+ }
70
77
  function _pkgModules() {
71
78
  const data = require("@teambit/pkg.modules.component-package-name");
72
79
  _pkgModules = function () {
@@ -308,7 +315,7 @@ class WorkspaceCompiler {
308
315
  const depsIds = deps.getComponentDependencies().map(dep => {
309
316
  return dep.id.toString();
310
317
  });
311
- if (err.code && err.code === 'MODULE_NOT_FOUND' && this.workspace) {
318
+ if ((err.code && (err.code === 'MODULE_NOT_FOUND' || err.code === 'ERR_REQUIRE_ESM') || err.message.includes('import.meta')) && this.workspace) {
312
319
  await this.compileComponents([id.toString(), ...depsIds], {
313
320
  initiator: _types().CompilationInitiator.AspectLoadFail
314
321
  }, true);
@@ -359,14 +366,15 @@ class WorkspaceCompiler {
359
366
  componentLoadOptions.loadSeedersAsAspects = false;
360
367
  }
361
368
  const components = await this.workspace.getMany(componentIds, componentLoadOptions);
362
- const grouped = this.groupByIsEnv(components);
363
- const envsResults = grouped.envs ? await this.runCompileComponents(grouped.envs, options, noThrow) : [];
364
- const otherResults = grouped.other ? await this.runCompileComponents(grouped.other, options, noThrow) : [];
369
+ const grouped = await this.buildGroupsToCompile(components);
370
+ const results = await (0, _pMapSeries().default)(grouped, async group => {
371
+ return this.runCompileComponents(group.components, options, noThrow);
372
+ });
365
373
  const linkComponents = options.linkComponents ?? true;
366
374
  if (linkComponents) {
367
375
  await (0, _workspaceModules().linkToNodeModulesByComponents)(components, this.workspace);
368
376
  }
369
- return [...envsResults, ...otherResults];
377
+ return results.flat();
370
378
  }
371
379
  async runCompileComponents(components, options, noThrow) {
372
380
  const componentsCompilers = [];
@@ -385,16 +393,65 @@ class WorkspaceCompiler {
385
393
  }
386
394
 
387
395
  /**
388
- * This function get's a list of aspect ids and return them grouped by whether any of them is the env of other from the list
396
+ * This function groups the components to compile into groups by their environment and dependencies.
397
+ * The order of the groups is important, the first group should be compiled first.
398
+ * The order inside the group is not important.
399
+ * The groups are:
400
+ * 1. dependencies of envs of envs.
401
+ * 2. envs of envs.
402
+ * 3. dependencies of envs.
403
+ * 4. envs.
404
+ * 5. the rest.
389
405
  * @param ids
390
406
  */
391
- groupByIsEnv(components) {
392
- const envsIds = (0, _lodash().uniq)(components.map(component => this.envs.getEnvId(component)).filter(envId => !this.aspectLoader.isCoreEnv(envId)));
393
- const grouped = (0, _lodash().groupBy)(components, component => {
407
+ async buildGroupsToCompile(components) {
408
+ const envCompIds = await Promise.all(components
409
+ // .map((component) => this.envs.getEnvId(component))
410
+ .map(async component => {
411
+ const envId = await this.envs.calculateEnvId(component);
412
+ return envId.toString();
413
+ }));
414
+ const envsIds = (0, _lodash().uniq)(envCompIds);
415
+ const groupedByIsEnv = (0, _lodash().groupBy)(components, component => {
394
416
  if (envsIds.includes(component.id.toString())) return 'envs';
417
+ if (this.envs.isEnv(component)) return 'envs';
418
+ return 'other';
419
+ });
420
+ const envsOfEnvsCompIds = await Promise.all((groupedByIsEnv.envs || []
421
+ // .map((component) => this.envs.getEnvId(component))
422
+ ).map(async component => (await this.envs.calculateEnvId(component)).toString()));
423
+ const groupedByEnvsOfEnvs = (0, _lodash().groupBy)(groupedByIsEnv.envs, component => {
424
+ if (envsOfEnvsCompIds.includes(component.id.toString())) return 'envsOfEnvs';
425
+ return 'otherEnvs';
426
+ });
427
+ const depsOfEnvsOfEnvsCompLists = (groupedByEnvsOfEnvs.envsOfEnvs || []).map(envComp => this.dependencyResolver.getDependencies(envComp));
428
+ const depsOfEnvsOfEnvsCompIds = _dependencyResolver().DependencyList.merge(depsOfEnvsOfEnvsCompLists).getComponentDependencies().map(dep => dep.id.toString());
429
+ const groupedByIsDepsOfEnvsOfEnvs = (0, _lodash().groupBy)(groupedByIsEnv.other, component => {
430
+ if (depsOfEnvsOfEnvsCompIds.includes(component.id.toString())) return 'depsOfEnvsOfEnvs';
431
+ return 'other';
432
+ });
433
+ const depsOfEnvsCompLists = (groupedByEnvsOfEnvs.otherEnvs || []).map(envComp => this.dependencyResolver.getDependencies(envComp));
434
+ const depsOfEnvsOfCompIds = _dependencyResolver().DependencyList.merge(depsOfEnvsCompLists).getComponentDependencies().map(dep => dep.id.toString());
435
+ const groupedByIsDepsOfEnvs = (0, _lodash().groupBy)(groupedByIsDepsOfEnvsOfEnvs.other, component => {
436
+ if (depsOfEnvsOfCompIds.includes(component.id.toString())) return 'depsOfEnvs';
395
437
  return 'other';
396
438
  });
397
- return grouped;
439
+ return [{
440
+ components: groupedByIsDepsOfEnvsOfEnvs.depsOfEnvsOfEnvs || [],
441
+ depsOfEnvsOfEnvs: true
442
+ }, {
443
+ components: groupedByEnvsOfEnvs.envsOfEnvs || [],
444
+ envsOfEnvs: true
445
+ }, {
446
+ components: groupedByIsDepsOfEnvs.depsOfEnvs || [],
447
+ depsOfEnvs: true
448
+ }, {
449
+ components: groupedByEnvsOfEnvs.otherEnvs || [],
450
+ envs: true
451
+ }, {
452
+ components: groupedByIsDepsOfEnvs.other || [],
453
+ other: true
454
+ }];
398
455
  }
399
456
  async getIdsToCompile(componentsIds, changed = false) {
400
457
  if (componentsIds.length) {
@@ -1 +1 @@
1
- {"version":3,"names":["_pMapSeries","data","_interopRequireDefault","require","_workspace","_path","_chalk","_logger","_loader","_constants","_component","_workspaceModules","_pkgModules","_workspace2","_lodash","_compiler","_events","_types","e","__esModule","default","ComponentCompiler","constructor","pubsub","workspace","component","compilerInstance","compilerId","logger","dependencyResolver","dists","compileErrors","compile","noThrow","options","dataToPersist","deleteDistDir","distDirs","DataToPersist","distDir","removePath","RemovePath","addBasePath","path","persistAllToFS","compilers","canTranspileFile","find","c","transpileFile","canTranspileComponent","transpileComponent","Promise","all","filesystem","files","map","file","compileOneFile","initiator","compileAllFiles","Error","toString","throwOnCompileErrors","addManyFiles","buildResults","distFile","state","_consumer","compiler","loader","succeed","id","errors","length","forEach","errorItem","error","formatError","err","join","pub","CompilerAspect","CompilerErrorEvent","console","message","packageName","componentIdToPackageName","packageDir","distDirName","getDistDir","DEFAULT_DIST_DIRNAME","injectedDirs","getInjectedDirs","dist","rootDirs","readRootComponentsDir","rootComponentsPath","rootDir","relative","componentDir","filePath","isFileSupported","compileResults","contents","push","base","result","Dist","outputPath","Buffer","from","outputText","shouldCopyNonSupportedFiles","filesToCompile","outputDir","getComponentPackagePath","exports","WorkspaceCompiler","envs","aspectLoader","ui","watcher","registerOnComponentChange","onComponentChange","bind","registerOnComponentAdd","onComponentAdd","registerOnPreWatch","onPreWatch","registerPreStart","onPreStart","registerOnAspectLoadErrorSlot","onAspectLoadFail","preStartOpts","skipCompilation","compileComponents","changed","verbose","CompilationInitiator","PreStart","watchScopeInternalFiles","deps","getDependencies","depsIds","getComponentDependencies","dep","code","AspectLoadFail","watchOpts","undefined","removedFiles","Boolean","removeLinksFromNodeModules","ComponentChanged","results","formatCompileResults","componentIds","preCompile","start","Date","now","PreWatch","end","consoleSuccess","componentsIds","componentLoadOptions","OutsideWorkspaceError","getIdsToCompile","loadSeedersAsAspects","components","getMany","grouped","groupByIsEnv","envsResults","runCompileComponents","otherResults","other","linkComponents","linkToNodeModulesByComponents","componentsCompilers","environment","getEnv","env","getCompiler","compilerName","name","warn","resultOnWorkspace","mapSeries","componentCompiler","envsIds","uniq","getEnvId","filter","envId","isCoreEnv","groupBy","includes","resolveMultipleComponentIds","filterIds","getNewAndModifiedIds","listIds","buildResult","title","chalk","underline","verboseComponentFilesArrayToString","Logger","successSymbol"],"sources":["workspace-compiler.ts"],"sourcesContent":["/* eslint-disable max-classes-per-file */\nimport mapSeries from 'p-map-series';\nimport { Component } from '@teambit/component';\nimport { EnvsMain } from '@teambit/envs';\nimport type { PubsubMain } from '@teambit/pubsub';\nimport { SerializableResults, Workspace, OutsideWorkspaceError } from '@teambit/workspace';\nimport type { WorkspaceComponentLoadOptions } from '@teambit/workspace';\nimport { WatcherMain, WatchOptions } from '@teambit/watcher';\nimport path from 'path';\nimport chalk from 'chalk';\nimport { ComponentID } from '@teambit/component-id';\nimport { Logger } from '@teambit/logger';\nimport loader from '@teambit/legacy/dist/cli/loader';\nimport { DEFAULT_DIST_DIRNAME } from '@teambit/legacy/dist/constants';\nimport { AbstractVinyl, Dist, DataToPersist, RemovePath } from '@teambit/component.sources';\nimport {\n linkToNodeModulesByComponents,\n removeLinksFromNodeModules,\n} from '@teambit/workspace.modules.node-modules-linker';\nimport { AspectLoaderMain } from '@teambit/aspect-loader';\nimport { DependencyResolverMain } from '@teambit/dependency-resolver';\nimport { PathOsBasedAbsolute, PathOsBasedRelative } from '@teambit/toolbox.path.path';\nimport { componentIdToPackageName } from '@teambit/pkg.modules.component-package-name';\nimport { UiMain } from '@teambit/ui';\nimport { readRootComponentsDir } from '@teambit/workspace.root-components';\nimport { groupBy, uniq } from 'lodash';\nimport type { PreStartOpts } from '@teambit/ui';\nimport { MultiCompiler } from '@teambit/multi-compiler';\nimport { CompilerAspect } from './compiler.aspect';\nimport { CompilerErrorEvent } from './events';\nimport { Compiler, CompilationInitiator } from './types';\n\nexport type BuildResult = {\n component: string;\n buildResults: string[];\n errors: CompileError[];\n};\n\nexport type CompileOptions = {\n changed?: boolean; // compile only new and modified components\n verbose?: boolean; // show more data, such as, dist paths\n /**\n * whether the dist root dir should be deleted before writing new dists.\n * defaults to true for `bit compile` and false everywhere else, such as `bit watch` and `bit\n * start` to avoid webpack \"EINTR\" error.\n */\n deleteDistDir?: boolean;\n initiator: CompilationInitiator; // describes where the compilation is coming from\n // should we create links in node_modules for the compiled components (default = true)\n // this will link the source files, and create the package.json\n linkComponents?: boolean;\n};\n\nexport type CompileError = { path: string; error: Error };\n\nexport class ComponentCompiler {\n constructor(\n private pubsub: PubsubMain,\n private workspace: Workspace,\n private component: Component,\n private compilerInstance: Compiler,\n private compilerId: string,\n private logger: Logger,\n private dependencyResolver: DependencyResolverMain,\n private dists: Dist[] = [],\n private compileErrors: CompileError[] = []\n ) {}\n\n async compile(noThrow = true, options: CompileOptions): Promise<BuildResult> {\n let dataToPersist;\n const deleteDistDir = options.deleteDistDir ?? this.compilerInstance.deleteDistDir;\n const distDirs = await this.distDirs();\n // delete dist folder before transpilation (because some compilers (like ngPackagr) can generate files there during the compilation process)\n if (deleteDistDir) {\n dataToPersist = new DataToPersist();\n for (const distDir of distDirs) {\n dataToPersist.removePath(new RemovePath(distDir));\n }\n dataToPersist.addBasePath(this.workspace.path);\n await dataToPersist.persistAllToFS();\n }\n\n const compilers: Compiler[] = (this.compilerInstance as MultiCompiler).compilers\n ? (this.compilerInstance as MultiCompiler).compilers\n : [this.compilerInstance];\n const canTranspileFile = compilers.find((c) => c.transpileFile);\n const canTranspileComponent = compilers.find((c) => c.transpileComponent);\n\n if (canTranspileFile) {\n await Promise.all(\n this.component.filesystem.files.map((file: AbstractVinyl) =>\n this.compileOneFile(file, options.initiator, distDirs)\n )\n );\n }\n\n if (canTranspileComponent) {\n await this.compileAllFiles(this.component, options.initiator, distDirs);\n }\n\n if (!canTranspileFile && !canTranspileComponent) {\n throw new Error(\n `compiler ${this.compilerId.toString()} doesn't implement either \"transpileFile\" or \"transpileComponent\" methods`\n );\n }\n this.throwOnCompileErrors(noThrow);\n\n // writing the dists with `component.setDists(dists); component.dists.writeDists` is tricky\n // as it uses other base-paths and doesn't respect the new node-modules base path.\n dataToPersist = new DataToPersist();\n dataToPersist.addManyFiles(this.dists);\n dataToPersist.addBasePath(this.workspace.path);\n await dataToPersist.persistAllToFS();\n const buildResults = this.dists.map((distFile) => distFile.path);\n if (this.component.state._consumer.compiler) loader.succeed();\n\n return { component: this.component.id.toString(), buildResults, errors: this.compileErrors };\n }\n\n private throwOnCompileErrors(noThrow = true) {\n if (this.compileErrors.length) {\n this.compileErrors.forEach((errorItem) => {\n this.logger.error(`compilation error at ${errorItem.path}`, errorItem.error);\n });\n const formatError = (errorItem) => `${errorItem.path}\\n${errorItem.error}`;\n const err = new Error(`compilation failed. see the following errors from the compiler\n${this.compileErrors.map(formatError).join('\\n')}`);\n\n this.pubsub.pub(CompilerAspect.id, new CompilerErrorEvent(err));\n\n if (!noThrow) {\n throw err;\n }\n\n this.logger.console(err.message);\n }\n }\n\n private async distDirs(): Promise<PathOsBasedRelative[]> {\n const packageName = componentIdToPackageName(this.component.state._consumer);\n const packageDir = path.join('node_modules', packageName);\n const distDirName = this.compilerInstance.getDistDir?.() || DEFAULT_DIST_DIRNAME;\n const injectedDirs = await this.getInjectedDirs(packageName);\n return [packageDir, ...injectedDirs].map((dist) => path.join(dist, distDirName));\n }\n\n private async getInjectedDirs(packageName: string): Promise<string[]> {\n const injectedDirs = await this.workspace.getInjectedDirs(this.component);\n if (injectedDirs.length > 0) return injectedDirs;\n\n const rootDirs = await readRootComponentsDir(this.workspace.rootComponentsPath);\n return rootDirs.map((rootDir) => path.relative(this.workspace.path, path.join(rootDir, packageName)));\n }\n\n private get componentDir(): PathOsBasedAbsolute {\n return this.workspace.componentDir(this.component.id);\n }\n\n private async compileOneFile(\n file: AbstractVinyl,\n initiator: CompilationInitiator,\n distDirs: PathOsBasedRelative[]\n ): Promise<void> {\n const options = { componentDir: this.componentDir, filePath: file.relative, initiator };\n const isFileSupported = this.compilerInstance.isFileSupported(file.path);\n let compileResults;\n if (isFileSupported) {\n try {\n compileResults = await this.compilerInstance.transpileFile?.(file.contents.toString(), options);\n } catch (error: any) {\n this.compileErrors.push({ path: file.path, error });\n return;\n }\n }\n for (const base of distDirs) {\n if (isFileSupported && compileResults) {\n this.dists.push(\n ...compileResults.map(\n (result) =>\n new Dist({\n base,\n path: path.join(base, result.outputPath),\n contents: Buffer.from(result.outputText),\n })\n )\n );\n } else if (this.compilerInstance.shouldCopyNonSupportedFiles) {\n // compiler doesn't support this file type. copy the file as is to the dist dir.\n this.dists.push(new Dist({ base, path: path.join(base, file.relative), contents: file.contents }));\n }\n }\n }\n\n private async compileAllFiles(\n component: Component,\n initiator: CompilationInitiator,\n distDirs: PathOsBasedRelative[]\n ): Promise<void> {\n const filesToCompile: AbstractVinyl[] = [];\n for (const base of distDirs) {\n component.filesystem.files.forEach((file: AbstractVinyl) => {\n const isFileSupported = this.compilerInstance.isFileSupported(file.path);\n if (isFileSupported) {\n filesToCompile.push(file);\n } else if (this.compilerInstance.shouldCopyNonSupportedFiles) {\n // compiler doesn't support this file type. copy the file as is to the dist dir.\n this.dists.push(\n new Dist({\n base,\n path: path.join(base, file.relative),\n contents: file.contents,\n })\n );\n }\n });\n }\n\n if (filesToCompile.length) {\n try {\n await this.compilerInstance.transpileComponent?.({\n component,\n componentDir: this.componentDir,\n outputDir: await this.workspace.getComponentPackagePath(component),\n initiator,\n });\n } catch (error: any) {\n this.compileErrors.push({ path: this.componentDir, error });\n }\n }\n }\n}\n\nexport class WorkspaceCompiler {\n constructor(\n private workspace: Workspace,\n private envs: EnvsMain,\n private pubsub: PubsubMain,\n private aspectLoader: AspectLoaderMain,\n private ui: UiMain,\n private logger: Logger,\n private dependencyResolver: DependencyResolverMain,\n private watcher: WatcherMain\n ) {\n if (this.workspace) {\n this.workspace.registerOnComponentChange(this.onComponentChange.bind(this));\n this.workspace.registerOnComponentAdd(this.onComponentAdd.bind(this));\n this.watcher.registerOnPreWatch(this.onPreWatch.bind(this));\n }\n this.ui.registerPreStart(this.onPreStart.bind(this));\n if (this.aspectLoader) {\n this.aspectLoader.registerOnAspectLoadErrorSlot(this.onAspectLoadFail.bind(this));\n }\n }\n\n async onPreStart(preStartOpts: PreStartOpts): Promise<void> {\n if (this.workspace) {\n if (preStartOpts.skipCompilation) {\n return;\n }\n await this.compileComponents([], {\n changed: true,\n verbose: false,\n deleteDistDir: false,\n initiator: CompilationInitiator.PreStart,\n });\n } else {\n await this.watcher.watchScopeInternalFiles();\n }\n }\n\n async onAspectLoadFail(err: Error & { code?: string }, component: Component): Promise<boolean> {\n const id = component.id;\n const deps = this.dependencyResolver.getDependencies(component);\n const depsIds = deps.getComponentDependencies().map((dep) => {\n return dep.id.toString();\n });\n if (err.code && err.code === 'MODULE_NOT_FOUND' && this.workspace) {\n await this.compileComponents(\n [id.toString(), ...depsIds],\n { initiator: CompilationInitiator.AspectLoadFail },\n true\n );\n return true;\n }\n return false;\n }\n\n async onComponentAdd(component: Component, files: string[], watchOpts: WatchOptions) {\n return this.onComponentChange(component, files, undefined, watchOpts);\n }\n\n async onComponentChange(\n component: Component,\n files: string[],\n removedFiles: string[] = [],\n watchOpts: WatchOptions\n ): Promise<SerializableResults | void> {\n if (!watchOpts.compile) return undefined;\n // when files are removed, we need to remove the dist directories and the old symlinks, otherwise, it has\n // symlinks to non-exist files and the dist has stale files\n const deleteDistDir = Boolean(removedFiles?.length);\n if (removedFiles?.length) {\n await removeLinksFromNodeModules(component, this.workspace, removedFiles);\n }\n const buildResults = await this.compileComponents(\n [component.id.toString()],\n { initiator: watchOpts.initiator || CompilationInitiator.ComponentChanged, deleteDistDir },\n true\n );\n return {\n results: buildResults,\n toString() {\n return formatCompileResults(buildResults, watchOpts.verbose);\n },\n };\n }\n\n async onPreWatch(componentIds: ComponentID[], watchOpts: WatchOptions) {\n if (watchOpts.preCompile) {\n const start = Date.now();\n this.logger.console(`compiling ${componentIds.length} components`);\n await this.compileComponents(\n componentIds.map((id) => id),\n { initiator: CompilationInitiator.PreWatch }\n );\n const end = Date.now() - start;\n this.logger.consoleSuccess(`compiled ${componentIds.length} components successfully (${end / 1000} sec)`);\n }\n }\n\n async compileComponents(\n componentsIds: string[] | ComponentID[] | ComponentID[], // when empty, it compiles new+modified (unless options.all is set),\n options: CompileOptions,\n noThrow?: boolean,\n componentLoadOptions: WorkspaceComponentLoadOptions = {}\n ): Promise<BuildResult[]> {\n if (!this.workspace) throw new OutsideWorkspaceError();\n const componentIds = await this.getIdsToCompile(componentsIds, options.changed);\n // In case the aspect failed to load, we want to compile it without try to re-load it again\n if (options.initiator === CompilationInitiator.AspectLoadFail) {\n componentLoadOptions.loadSeedersAsAspects = false;\n }\n const components = await this.workspace.getMany(componentIds, componentLoadOptions);\n const grouped = this.groupByIsEnv(components);\n const envsResults = grouped.envs ? await this.runCompileComponents(grouped.envs, options, noThrow) : [];\n const otherResults = grouped.other ? await this.runCompileComponents(grouped.other, options, noThrow) : [];\n const linkComponents = options.linkComponents ?? true;\n if (linkComponents) {\n await linkToNodeModulesByComponents(components, this.workspace);\n }\n return [...envsResults, ...otherResults];\n }\n\n private async runCompileComponents(\n components: Component[],\n options: CompileOptions,\n noThrow?: boolean\n ): Promise<BuildResult[]> {\n const componentsCompilers: ComponentCompiler[] = [];\n\n components.forEach((c) => {\n const environment = this.envs.getEnv(c).env;\n const compilerInstance = environment.getCompiler?.();\n\n if (compilerInstance) {\n const compilerName = compilerInstance.constructor.name || 'compiler';\n componentsCompilers.push(\n new ComponentCompiler(\n this.pubsub,\n this.workspace,\n c,\n compilerInstance,\n compilerName,\n this.logger,\n this.dependencyResolver\n )\n );\n } else {\n this.logger.warn(`unable to find a compiler instance for ${c.id.toString()}`);\n }\n });\n const resultOnWorkspace = await mapSeries(componentsCompilers, (componentCompiler) =>\n componentCompiler.compile(noThrow, options)\n );\n\n return resultOnWorkspace;\n }\n\n /**\n * This function get's a list of aspect ids and return them grouped by whether any of them is the env of other from the list\n * @param ids\n */\n groupByIsEnv(components: Component[]): { envs?: Component[]; other?: Component[] } {\n const envsIds = uniq(\n components\n .map((component) => this.envs.getEnvId(component))\n .filter((envId) => !this.aspectLoader.isCoreEnv(envId))\n );\n const grouped = groupBy(components, (component) => {\n if (envsIds.includes(component.id.toString())) return 'envs';\n return 'other';\n });\n return grouped as { envs: Component[]; other: Component[] };\n }\n\n private async getIdsToCompile(componentsIds: Array<string | ComponentID>, changed = false): Promise<ComponentID[]> {\n if (componentsIds.length) {\n const componentIds = await this.workspace.resolveMultipleComponentIds(componentsIds);\n return this.workspace.filterIds(componentIds);\n }\n if (changed) {\n return this.workspace.getNewAndModifiedIds();\n }\n return this.workspace.listIds();\n }\n}\n\nfunction formatCompileResults(buildResults: BuildResult[], verbose?: boolean) {\n if (!buildResults.length) return '';\n // this gets called when a file is changed, so the buildResults array always has only one item\n const buildResult = buildResults[0];\n const title = ` ${chalk.underline('STATUS\\tCOMPONENT ID')}`;\n const verboseComponentFilesArrayToString = () => {\n return buildResult.buildResults.map((filePath) => ` \\t - ${filePath}`).join('\\n');\n };\n\n return `${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CAACjL,SAAS,CAACkL,OAAO,CAAC,CAAC;EACjC;AACF;AAACrF,OAAA,CAAAC,iBAAA,GAAAA,iBAAA;AAED,SAASsC,oBAAoBA,CAAC3F,YAA2B,EAAEyE,OAAiB,EAAE;EAC5E,IAAI,CAACzE,YAAY,CAACS,MAAM,EAAE,OAAO,EAAE;EACnC;EACA,MAAMiI,WAAW,GAAG1I,YAAY,CAAC,CAAC,CAAC;EACnC,MAAM2I,KAAK,GAAG,IAAIC,gBAAK,CAACC,SAAS,CAAC,sBAAsB,CAAC,EAAE;EAC3D,MAAMC,kCAAkC,GAAGA,CAAA,KAAM;IAC/C,OAAOJ,WAAW,CAAC1I,YAAY,CAACT,GAAG,CAAE6C,QAAQ,IAAK,SAASA,QAAQ,EAAE,CAAC,CAACrB,IAAI,CAAC,IAAI,CAAC;EACnF,CAAC;EAED,OAAO,GAAG4H,KAAK;AACjB,IAAII,gBAAM,CAACC,aAAa,CAAC,CAAC,YAAYN,WAAW,CAAClL,SAAS;AAC3D,IAAIiH,OAAO,GAAG,GAAGqE,kCAAkC,CAAC,CAAC,IAAI,GAAG,EAAE,EAAE;AAChE","ignoreList":[]}
1
+ {"version":3,"names":["_pMapSeries","data","_interopRequireDefault","require","_workspace","_path","_chalk","_logger","_loader","_constants","_component","_workspaceModules","_dependencyResolver","_pkgModules","_workspace2","_lodash","_compiler","_events","_types","e","__esModule","default","ComponentCompiler","constructor","pubsub","workspace","component","compilerInstance","compilerId","logger","dependencyResolver","dists","compileErrors","compile","noThrow","options","dataToPersist","deleteDistDir","distDirs","DataToPersist","distDir","removePath","RemovePath","addBasePath","path","persistAllToFS","compilers","canTranspileFile","find","c","transpileFile","canTranspileComponent","transpileComponent","Promise","all","filesystem","files","map","file","compileOneFile","initiator","compileAllFiles","Error","toString","throwOnCompileErrors","addManyFiles","buildResults","distFile","state","_consumer","compiler","loader","succeed","id","errors","length","forEach","errorItem","error","formatError","err","join","pub","CompilerAspect","CompilerErrorEvent","console","message","packageName","componentIdToPackageName","packageDir","distDirName","getDistDir","DEFAULT_DIST_DIRNAME","injectedDirs","getInjectedDirs","dist","rootDirs","readRootComponentsDir","rootComponentsPath","rootDir","relative","componentDir","filePath","isFileSupported","compileResults","contents","push","base","result","Dist","outputPath","Buffer","from","outputText","shouldCopyNonSupportedFiles","filesToCompile","outputDir","getComponentPackagePath","exports","WorkspaceCompiler","envs","aspectLoader","ui","watcher","registerOnComponentChange","onComponentChange","bind","registerOnComponentAdd","onComponentAdd","registerOnPreWatch","onPreWatch","registerPreStart","onPreStart","registerOnAspectLoadErrorSlot","onAspectLoadFail","preStartOpts","skipCompilation","compileComponents","changed","verbose","CompilationInitiator","PreStart","watchScopeInternalFiles","deps","getDependencies","depsIds","getComponentDependencies","dep","code","includes","AspectLoadFail","watchOpts","undefined","removedFiles","Boolean","removeLinksFromNodeModules","ComponentChanged","results","formatCompileResults","componentIds","preCompile","start","Date","now","PreWatch","end","consoleSuccess","componentsIds","componentLoadOptions","OutsideWorkspaceError","getIdsToCompile","loadSeedersAsAspects","components","getMany","grouped","buildGroupsToCompile","mapSeries","group","runCompileComponents","linkComponents","linkToNodeModulesByComponents","flat","componentsCompilers","environment","getEnv","env","getCompiler","compilerName","name","warn","resultOnWorkspace","componentCompiler","envCompIds","envId","calculateEnvId","envsIds","uniq","groupedByIsEnv","groupBy","isEnv","envsOfEnvsCompIds","groupedByEnvsOfEnvs","depsOfEnvsOfEnvsCompLists","envsOfEnvs","envComp","depsOfEnvsOfEnvsCompIds","DependencyList","merge","groupedByIsDepsOfEnvsOfEnvs","other","depsOfEnvsCompLists","otherEnvs","depsOfEnvsOfCompIds","groupedByIsDepsOfEnvs","depsOfEnvsOfEnvs","depsOfEnvs","resolveMultipleComponentIds","filterIds","getNewAndModifiedIds","listIds","buildResult","title","chalk","underline","verboseComponentFilesArrayToString","Logger","successSymbol"],"sources":["workspace-compiler.ts"],"sourcesContent":["/* eslint-disable max-classes-per-file */\nimport mapSeries from 'p-map-series';\nimport { Component } from '@teambit/component';\nimport { EnvsMain } from '@teambit/envs';\nimport type { PubsubMain } from '@teambit/pubsub';\nimport { SerializableResults, Workspace, OutsideWorkspaceError } from '@teambit/workspace';\nimport type { WorkspaceComponentLoadOptions } from '@teambit/workspace';\nimport { WatcherMain, WatchOptions } from '@teambit/watcher';\nimport path from 'path';\nimport chalk from 'chalk';\nimport { ComponentID } from '@teambit/component-id';\nimport { Logger } from '@teambit/logger';\nimport loader from '@teambit/legacy/dist/cli/loader';\nimport { DEFAULT_DIST_DIRNAME } from '@teambit/legacy/dist/constants';\nimport { AbstractVinyl, Dist, DataToPersist, RemovePath } from '@teambit/component.sources';\nimport {\n linkToNodeModulesByComponents,\n removeLinksFromNodeModules,\n} from '@teambit/workspace.modules.node-modules-linker';\nimport { AspectLoaderMain } from '@teambit/aspect-loader';\nimport { DependencyList, DependencyResolverMain } from '@teambit/dependency-resolver';\nimport { PathOsBasedAbsolute, PathOsBasedRelative } from '@teambit/toolbox.path.path';\nimport { componentIdToPackageName } from '@teambit/pkg.modules.component-package-name';\nimport { UiMain } from '@teambit/ui';\nimport { readRootComponentsDir } from '@teambit/workspace.root-components';\nimport { groupBy, uniq } from 'lodash';\nimport type { PreStartOpts } from '@teambit/ui';\nimport { MultiCompiler } from '@teambit/multi-compiler';\nimport { CompilerAspect } from './compiler.aspect';\nimport { CompilerErrorEvent } from './events';\nimport { Compiler, CompilationInitiator } from './types';\n\nexport type BuildResult = {\n component: string;\n buildResults: string[];\n errors: CompileError[];\n};\n\nexport type CompileOptions = {\n changed?: boolean; // compile only new and modified components\n verbose?: boolean; // show more data, such as, dist paths\n /**\n * whether the dist root dir should be deleted before writing new dists.\n * defaults to true for `bit compile` and false everywhere else, such as `bit watch` and `bit\n * start` to avoid webpack \"EINTR\" error.\n */\n deleteDistDir?: boolean;\n initiator: CompilationInitiator; // describes where the compilation is coming from\n // should we create links in node_modules for the compiled components (default = true)\n // this will link the source files, and create the package.json\n linkComponents?: boolean;\n};\n\nexport type CompileError = { path: string; error: Error };\n\nexport class ComponentCompiler {\n constructor(\n private pubsub: PubsubMain,\n private workspace: Workspace,\n private component: Component,\n private compilerInstance: Compiler,\n private compilerId: string,\n private logger: Logger,\n private dependencyResolver: DependencyResolverMain,\n private dists: Dist[] = [],\n private compileErrors: CompileError[] = []\n ) {}\n\n async compile(noThrow = true, options: CompileOptions): Promise<BuildResult> {\n let dataToPersist;\n const deleteDistDir = options.deleteDistDir ?? this.compilerInstance.deleteDistDir;\n const distDirs = await this.distDirs();\n // delete dist folder before transpilation (because some compilers (like ngPackagr) can generate files there during the compilation process)\n if (deleteDistDir) {\n dataToPersist = new DataToPersist();\n for (const distDir of distDirs) {\n dataToPersist.removePath(new RemovePath(distDir));\n }\n dataToPersist.addBasePath(this.workspace.path);\n await dataToPersist.persistAllToFS();\n }\n\n const compilers: Compiler[] = (this.compilerInstance as MultiCompiler).compilers\n ? (this.compilerInstance as MultiCompiler).compilers\n : [this.compilerInstance];\n const canTranspileFile = compilers.find((c) => c.transpileFile);\n const canTranspileComponent = compilers.find((c) => c.transpileComponent);\n\n if (canTranspileFile) {\n await Promise.all(\n this.component.filesystem.files.map((file: AbstractVinyl) =>\n this.compileOneFile(file, options.initiator, distDirs)\n )\n );\n }\n\n if (canTranspileComponent) {\n await this.compileAllFiles(this.component, options.initiator, distDirs);\n }\n\n if (!canTranspileFile && !canTranspileComponent) {\n throw new Error(\n `compiler ${this.compilerId.toString()} doesn't implement either \"transpileFile\" or \"transpileComponent\" methods`\n );\n }\n this.throwOnCompileErrors(noThrow);\n\n // writing the dists with `component.setDists(dists); component.dists.writeDists` is tricky\n // as it uses other base-paths and doesn't respect the new node-modules base path.\n dataToPersist = new DataToPersist();\n dataToPersist.addManyFiles(this.dists);\n dataToPersist.addBasePath(this.workspace.path);\n await dataToPersist.persistAllToFS();\n const buildResults = this.dists.map((distFile) => distFile.path);\n if (this.component.state._consumer.compiler) loader.succeed();\n\n return { component: this.component.id.toString(), buildResults, errors: this.compileErrors };\n }\n\n private throwOnCompileErrors(noThrow = true) {\n if (this.compileErrors.length) {\n this.compileErrors.forEach((errorItem) => {\n this.logger.error(`compilation error at ${errorItem.path}`, errorItem.error);\n });\n const formatError = (errorItem) => `${errorItem.path}\\n${errorItem.error}`;\n const err = new Error(`compilation failed. see the following errors from the compiler\n${this.compileErrors.map(formatError).join('\\n')}`);\n\n this.pubsub.pub(CompilerAspect.id, new CompilerErrorEvent(err));\n\n if (!noThrow) {\n throw err;\n }\n\n this.logger.console(err.message);\n }\n }\n\n private async distDirs(): Promise<PathOsBasedRelative[]> {\n const packageName = componentIdToPackageName(this.component.state._consumer);\n const packageDir = path.join('node_modules', packageName);\n const distDirName = this.compilerInstance.getDistDir?.() || DEFAULT_DIST_DIRNAME;\n const injectedDirs = await this.getInjectedDirs(packageName);\n return [packageDir, ...injectedDirs].map((dist) => path.join(dist, distDirName));\n }\n\n private async getInjectedDirs(packageName: string): Promise<string[]> {\n const injectedDirs = await this.workspace.getInjectedDirs(this.component);\n if (injectedDirs.length > 0) return injectedDirs;\n\n const rootDirs = await readRootComponentsDir(this.workspace.rootComponentsPath);\n return rootDirs.map((rootDir) => path.relative(this.workspace.path, path.join(rootDir, packageName)));\n }\n\n private get componentDir(): PathOsBasedAbsolute {\n return this.workspace.componentDir(this.component.id);\n }\n\n private async compileOneFile(\n file: AbstractVinyl,\n initiator: CompilationInitiator,\n distDirs: PathOsBasedRelative[]\n ): Promise<void> {\n const options = { componentDir: this.componentDir, filePath: file.relative, initiator };\n const isFileSupported = this.compilerInstance.isFileSupported(file.path);\n let compileResults;\n if (isFileSupported) {\n try {\n compileResults = await this.compilerInstance.transpileFile?.(file.contents.toString(), options);\n } catch (error: any) {\n this.compileErrors.push({ path: file.path, error });\n return;\n }\n }\n for (const base of distDirs) {\n if (isFileSupported && compileResults) {\n this.dists.push(\n ...compileResults.map(\n (result) =>\n new Dist({\n base,\n path: path.join(base, result.outputPath),\n contents: Buffer.from(result.outputText),\n })\n )\n );\n } else if (this.compilerInstance.shouldCopyNonSupportedFiles) {\n // compiler doesn't support this file type. copy the file as is to the dist dir.\n this.dists.push(new Dist({ base, path: path.join(base, file.relative), contents: file.contents }));\n }\n }\n }\n\n private async compileAllFiles(\n component: Component,\n initiator: CompilationInitiator,\n distDirs: PathOsBasedRelative[]\n ): Promise<void> {\n const filesToCompile: AbstractVinyl[] = [];\n for (const base of distDirs) {\n component.filesystem.files.forEach((file: AbstractVinyl) => {\n const isFileSupported = this.compilerInstance.isFileSupported(file.path);\n if (isFileSupported) {\n filesToCompile.push(file);\n } else if (this.compilerInstance.shouldCopyNonSupportedFiles) {\n // compiler doesn't support this file type. copy the file as is to the dist dir.\n this.dists.push(\n new Dist({\n base,\n path: path.join(base, file.relative),\n contents: file.contents,\n })\n );\n }\n });\n }\n\n if (filesToCompile.length) {\n try {\n await this.compilerInstance.transpileComponent?.({\n component,\n componentDir: this.componentDir,\n outputDir: await this.workspace.getComponentPackagePath(component),\n initiator,\n });\n } catch (error: any) {\n this.compileErrors.push({ path: this.componentDir, error });\n }\n }\n }\n}\n\nexport class WorkspaceCompiler {\n constructor(\n private workspace: Workspace,\n private envs: EnvsMain,\n private pubsub: PubsubMain,\n private aspectLoader: AspectLoaderMain,\n private ui: UiMain,\n private logger: Logger,\n private dependencyResolver: DependencyResolverMain,\n private watcher: WatcherMain\n ) {\n if (this.workspace) {\n this.workspace.registerOnComponentChange(this.onComponentChange.bind(this));\n this.workspace.registerOnComponentAdd(this.onComponentAdd.bind(this));\n this.watcher.registerOnPreWatch(this.onPreWatch.bind(this));\n }\n this.ui.registerPreStart(this.onPreStart.bind(this));\n if (this.aspectLoader) {\n this.aspectLoader.registerOnAspectLoadErrorSlot(this.onAspectLoadFail.bind(this));\n }\n }\n\n async onPreStart(preStartOpts: PreStartOpts): Promise<void> {\n if (this.workspace) {\n if (preStartOpts.skipCompilation) {\n return;\n }\n await this.compileComponents([], {\n changed: true,\n verbose: false,\n deleteDistDir: false,\n initiator: CompilationInitiator.PreStart,\n });\n } else {\n await this.watcher.watchScopeInternalFiles();\n }\n }\n\n async onAspectLoadFail(err: Error & { code?: string }, component: Component): Promise<boolean> {\n const id = component.id;\n const deps = this.dependencyResolver.getDependencies(component);\n const depsIds = deps.getComponentDependencies().map((dep) => {\n return dep.id.toString();\n });\n if (\n ((err.code && (err.code === 'MODULE_NOT_FOUND' || err.code === 'ERR_REQUIRE_ESM')) ||\n err.message.includes('import.meta')) &&\n this.workspace\n ) {\n await this.compileComponents(\n [id.toString(), ...depsIds],\n { initiator: CompilationInitiator.AspectLoadFail },\n true\n );\n return true;\n }\n return false;\n }\n\n async onComponentAdd(component: Component, files: string[], watchOpts: WatchOptions) {\n return this.onComponentChange(component, files, undefined, watchOpts);\n }\n\n async onComponentChange(\n component: Component,\n files: string[],\n removedFiles: string[] = [],\n watchOpts: WatchOptions\n ): Promise<SerializableResults | void> {\n if (!watchOpts.compile) return undefined;\n // when files are removed, we need to remove the dist directories and the old symlinks, otherwise, it has\n // symlinks to non-exist files and the dist has stale files\n const deleteDistDir = Boolean(removedFiles?.length);\n if (removedFiles?.length) {\n await removeLinksFromNodeModules(component, this.workspace, removedFiles);\n }\n const buildResults = await this.compileComponents(\n [component.id.toString()],\n { initiator: watchOpts.initiator || CompilationInitiator.ComponentChanged, deleteDistDir },\n true\n );\n return {\n results: buildResults,\n toString() {\n return formatCompileResults(buildResults, watchOpts.verbose);\n },\n };\n }\n\n async onPreWatch(componentIds: ComponentID[], watchOpts: WatchOptions) {\n if (watchOpts.preCompile) {\n const start = Date.now();\n this.logger.console(`compiling ${componentIds.length} components`);\n await this.compileComponents(\n componentIds.map((id) => id),\n { initiator: CompilationInitiator.PreWatch }\n );\n const end = Date.now() - start;\n this.logger.consoleSuccess(`compiled ${componentIds.length} components successfully (${end / 1000} sec)`);\n }\n }\n\n async compileComponents(\n componentsIds: string[] | ComponentID[] | ComponentID[], // when empty, it compiles new+modified (unless options.all is set),\n options: CompileOptions,\n noThrow?: boolean,\n componentLoadOptions: WorkspaceComponentLoadOptions = {}\n ): Promise<BuildResult[]> {\n if (!this.workspace) throw new OutsideWorkspaceError();\n const componentIds = await this.getIdsToCompile(componentsIds, options.changed);\n // In case the aspect failed to load, we want to compile it without try to re-load it again\n if (options.initiator === CompilationInitiator.AspectLoadFail) {\n componentLoadOptions.loadSeedersAsAspects = false;\n }\n const components = await this.workspace.getMany(componentIds, componentLoadOptions);\n const grouped = await this.buildGroupsToCompile(components);\n\n const results = await mapSeries(grouped, async (group) => {\n return this.runCompileComponents(group.components, options, noThrow);\n });\n const linkComponents = options.linkComponents ?? true;\n if (linkComponents) {\n await linkToNodeModulesByComponents(components, this.workspace);\n }\n return results.flat();\n }\n\n private async runCompileComponents(\n components: Component[],\n options: CompileOptions,\n noThrow?: boolean\n ): Promise<BuildResult[]> {\n const componentsCompilers: ComponentCompiler[] = [];\n\n components.forEach((c) => {\n const environment = this.envs.getEnv(c).env;\n const compilerInstance = environment.getCompiler?.();\n\n if (compilerInstance) {\n const compilerName = compilerInstance.constructor.name || 'compiler';\n componentsCompilers.push(\n new ComponentCompiler(\n this.pubsub,\n this.workspace,\n c,\n compilerInstance,\n compilerName,\n this.logger,\n this.dependencyResolver\n )\n );\n } else {\n this.logger.warn(`unable to find a compiler instance for ${c.id.toString()}`);\n }\n });\n const resultOnWorkspace = await mapSeries(componentsCompilers, (componentCompiler) =>\n componentCompiler.compile(noThrow, options)\n );\n\n return resultOnWorkspace;\n }\n\n /**\n * This function groups the components to compile into groups by their environment and dependencies.\n * The order of the groups is important, the first group should be compiled first.\n * The order inside the group is not important.\n * The groups are:\n * 1. dependencies of envs of envs.\n * 2. envs of envs.\n * 3. dependencies of envs.\n * 4. envs.\n * 5. the rest.\n * @param ids\n */\n async buildGroupsToCompile(components: Component[]): Promise<\n Array<{\n components: Component[];\n envsOfEnvs?: boolean;\n envs?: boolean;\n depsOfEnvsOfEnvs?: boolean;\n depsOfEnvs?: boolean;\n other?: boolean;\n }>\n > {\n const envCompIds = await Promise.all(\n components\n // .map((component) => this.envs.getEnvId(component))\n .map(async (component) => {\n const envId = await this.envs.calculateEnvId(component);\n return envId.toString();\n })\n );\n const envsIds = uniq(envCompIds);\n const groupedByIsEnv = groupBy(components, (component) => {\n if (envsIds.includes(component.id.toString())) return 'envs';\n if (this.envs.isEnv(component)) return 'envs';\n return 'other';\n });\n const envsOfEnvsCompIds = await Promise.all(\n (groupedByIsEnv.envs || [])\n // .map((component) => this.envs.getEnvId(component))\n .map(async (component) => (await this.envs.calculateEnvId(component)).toString())\n );\n const groupedByEnvsOfEnvs = groupBy(groupedByIsEnv.envs, (component) => {\n if (envsOfEnvsCompIds.includes(component.id.toString())) return 'envsOfEnvs';\n return 'otherEnvs';\n });\n const depsOfEnvsOfEnvsCompLists = (groupedByEnvsOfEnvs.envsOfEnvs || []).map((envComp) =>\n this.dependencyResolver.getDependencies(envComp)\n );\n const depsOfEnvsOfEnvsCompIds = DependencyList.merge(depsOfEnvsOfEnvsCompLists)\n .getComponentDependencies()\n .map((dep) => dep.id.toString());\n const groupedByIsDepsOfEnvsOfEnvs = groupBy(groupedByIsEnv.other, (component) => {\n if (depsOfEnvsOfEnvsCompIds.includes(component.id.toString())) return 'depsOfEnvsOfEnvs';\n return 'other';\n });\n const depsOfEnvsCompLists = (groupedByEnvsOfEnvs.otherEnvs || []).map((envComp) =>\n this.dependencyResolver.getDependencies(envComp)\n );\n const depsOfEnvsOfCompIds = DependencyList.merge(depsOfEnvsCompLists)\n .getComponentDependencies()\n .map((dep) => dep.id.toString());\n const groupedByIsDepsOfEnvs = groupBy(groupedByIsDepsOfEnvsOfEnvs.other, (component) => {\n if (depsOfEnvsOfCompIds.includes(component.id.toString())) return 'depsOfEnvs';\n return 'other';\n });\n return [\n {\n components: groupedByIsDepsOfEnvsOfEnvs.depsOfEnvsOfEnvs || [],\n depsOfEnvsOfEnvs: true,\n },\n {\n components: groupedByEnvsOfEnvs.envsOfEnvs || [],\n envsOfEnvs: true,\n },\n {\n components: groupedByIsDepsOfEnvs.depsOfEnvs || [],\n depsOfEnvs: true,\n },\n {\n components: groupedByEnvsOfEnvs.otherEnvs || [],\n envs: true,\n },\n {\n components: groupedByIsDepsOfEnvs.other || [],\n other: true,\n },\n ];\n }\n\n private async getIdsToCompile(componentsIds: Array<string | ComponentID>, changed = false): Promise<ComponentID[]> {\n if (componentsIds.length) {\n const componentIds = await this.workspace.resolveMultipleComponentIds(componentsIds);\n return this.workspace.filterIds(componentIds);\n }\n if (changed) {\n return this.workspace.getNewAndModifiedIds();\n }\n return this.workspace.listIds();\n }\n}\n\nfunction formatCompileResults(buildResults: BuildResult[], verbose?: boolean) {\n if (!buildResults.length) return '';\n // this gets called when a file is changed, so the buildResults array always has only one item\n const buildResult = buildResults[0];\n const title = ` ${chalk.underline('STATUS\\tCOMPONENT ID')}`;\n const verboseComponentFilesArrayToString = () => {\n return buildResult.buildResults.map((filePath) => ` \\t - ${filePath}`).join('\\n');\n };\n\n return `${title}\n ${Logger.successSymbol()}SUCCESS\\t${buildResult.component}\\n\n ${verbose ? `${verboseComponentFilesArrayToString()}\\n` : ''}`;\n}\n"],"mappings":";;;;;;AACA,SAAAA,YAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,WAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAIA,SAAAG,WAAA;EAAA,MAAAH,IAAA,GAAAE,OAAA;EAAAC,UAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAGA,SAAAI,MAAA;EAAA,MAAAJ,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAE,KAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAK,OAAA;EAAA,MAAAL,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAG,MAAA,YAAAA,CAAA;IAAA,OAAAL,IAAA;EAAA;EAAA,OAAAA,I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AAG,GAAGqF,kCAAkC,CAAC,CAAC,IAAI,GAAG,EAAE,EAAE;AAChE","ignoreList":[]}
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@teambit/compiler",
3
- "version": "1.0.395",
3
+ "version": "1.0.396",
4
4
  "homepage": "https://bit.cloud/teambit/compilation/compiler",
5
5
  "main": "dist/index.js",
6
6
  "componentId": {
7
7
  "scope": "teambit.compilation",
8
8
  "name": "compiler",
9
- "version": "1.0.395"
9
+ "version": "1.0.396"
10
10
  },
11
11
  "dependencies": {
12
12
  "chalk": "2.4.2",
@@ -19,27 +19,27 @@
19
19
  "@teambit/component-id": "1.2.0",
20
20
  "@teambit/workspace.root-components": "1.0.0",
21
21
  "@teambit/bit-error": "0.0.404",
22
- "@teambit/envs": "1.0.395",
23
- "@teambit/cli": "0.0.972",
24
- "@teambit/logger": "0.0.1065",
25
- "@teambit/pubsub": "1.0.395",
26
- "@teambit/aspect-loader": "1.0.395",
27
- "@teambit/builder": "1.0.395",
22
+ "@teambit/envs": "1.0.396",
23
+ "@teambit/cli": "0.0.973",
24
+ "@teambit/logger": "0.0.1066",
25
+ "@teambit/pubsub": "1.0.396",
26
+ "@teambit/aspect-loader": "1.0.396",
27
+ "@teambit/builder": "1.0.396",
28
28
  "@teambit/component-issues": "0.0.150",
29
- "@teambit/component": "1.0.395",
30
- "@teambit/dependency-resolver": "1.0.395",
31
- "@teambit/generator": "1.0.396",
32
- "@teambit/issues": "1.0.395",
33
- "@teambit/ui": "1.0.395",
34
- "@teambit/watcher": "1.0.395",
35
- "@teambit/workspace": "1.0.395",
36
- "@teambit/isolator": "1.0.395",
29
+ "@teambit/component": "1.0.396",
30
+ "@teambit/dependency-resolver": "1.0.396",
31
+ "@teambit/generator": "1.0.397",
32
+ "@teambit/issues": "1.0.396",
33
+ "@teambit/ui": "1.0.396",
34
+ "@teambit/watcher": "1.0.396",
35
+ "@teambit/workspace": "1.0.396",
36
+ "@teambit/isolator": "1.0.396",
37
37
  "@teambit/toolbox.fs.hard-link-directory": "0.0.21",
38
- "@teambit/component.sources": "0.0.22",
38
+ "@teambit/component.sources": "0.0.23",
39
39
  "@teambit/toolbox.path.path": "0.0.2",
40
- "@teambit/multi-compiler": "1.0.395",
40
+ "@teambit/multi-compiler": "1.0.396",
41
41
  "@teambit/pkg.modules.component-package-name": "0.0.3",
42
- "@teambit/workspace.modules.node-modules-linker": "0.0.197"
42
+ "@teambit/workspace.modules.node-modules-linker": "0.0.198"
43
43
  },
44
44
  "devDependencies": {
45
45
  "@types/fs-extra": "9.0.7",