@teambit/compiler 1.0.281 → 1.0.283
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/artifacts/__bit_junit.xml +1 -1
- package/artifacts/preview/teambit_compilation_compiler-preview.js +1 -1
- package/artifacts/schema.json +7 -7
- package/dist/compiler.cmd.js +2 -2
- package/dist/compiler.cmd.js.map +1 -1
- package/dist/compiler.composition.js +1 -1
- package/dist/compiler.composition.js.map +1 -1
- package/dist/compiler.main.runtime.js +2 -2
- package/dist/compiler.main.runtime.js.map +1 -1
- package/dist/compiler.service.js +2 -2
- package/dist/compiler.service.js.map +1 -1
- package/dist/compiler.task.js +2 -2
- package/dist/compiler.task.js.map +1 -1
- package/dist/events/compiler-error.js +1 -1
- package/dist/events/compiler-error.js.map +1 -1
- package/dist/exceptions/dist-artifact-not-found.js.map +1 -1
- package/dist/output-formatter.js +1 -1
- package/dist/output-formatter.js.map +1 -1
- package/dist/{preview-1716434516635.js → preview-1716607230882.js} +2 -2
- package/dist/templates/compiler/files/aspect-file.js.map +1 -1
- package/dist/templates/compiler/files/compiler-file.js.map +1 -1
- package/dist/templates/compiler/files/index-file.js.map +1 -1
- package/dist/templates/compiler/files/main-runtime-file.js.map +1 -1
- package/dist/templates/compiler/index.js.map +1 -1
- package/dist/workspace-compiler.js +1 -1
- package/dist/workspace-compiler.js.map +1 -1
- package/package.json +15 -15
|
@@ -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.
|
|
3
|
+
<testsuite name="teambit.compilation/compiler@1.0.283" 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={87086:(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=c(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 c(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,c.__bit_component=o;var d={},s="wrapper";function u(e){var n=e.components,t=l(e,a);return(0,i.mdx)(s,m({},d,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},88600:(e,n,t)=>{Object.defineProperty(n,"Ay",{enumerable:!0,get:function(){return o.default}});var o=i(t(87086));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}},38388:(e,n,t)=>{var o={id:"teambit.compilation/compiler@1.0.281",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={};return(()=>{t.r(o),t.d(o,{compositions:()=>s,compositions_metadata:()=>f,overview:()=>u});var e={};t.r(e),t.d(e,{default:()=>d});var n=t(38388),i=(t(41594),t(5016)),r=t(65682),a=t(88600),p=["components"];function m(){return m=Object.assign?Object.assign.bind():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)}var l={},c="wrapper";function d(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(Object.prototype.hasOwnProperty.call(e,o)){if(n.indexOf(o)>=0)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.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(i[t]=e[t])}return i}(e,p);return(0,i.mdx)(c,m({},l,t,{components:n,mdxType:"MDXLayout"}),(0,i.mdx)(r.MDXScopeProvider,{components:{CompilerOverview:a.Ay},mdxType:"MDXScopeProvider"},(0,i.mdx)(a.Ay,{mdxType:"CompilerOverview"})))}d.isMDXComponent=!0;const s=[n],u=[e],f={compositions:[{displayName:"Logo",identifier:"Logo"}]}})(),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={87086:(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},88600:(e,n,t)=>{Object.defineProperty(n,"Ay",{enumerable:!0,get:function(){return o.default}});var o=i(t(87086));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}},73618:(e,n,t)=>{var o={id:"teambit.compilation/compiler@1.0.283",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={};return(()=>{t.r(o),t.d(o,{compositions:()=>s,compositions_metadata:()=>f,overview:()=>u});var e={};t.r(e),t.d(e,{default:()=>c});var n=t(73618),i=(t(41594),t(5016)),r=t(65682),a=t(88600),p=["components"];function m(){return m=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},m.apply(null,arguments)}var l={},d="wrapper";function c(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.indexOf(o)>=0)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.indexOf(t)>=0||{}.propertyIsEnumerable.call(e,t)&&(i[t]=e[t])}return i}(e,p);return(0,i.mdx)(d,m({},l,t,{components:n,mdxType:"MDXLayout"}),(0,i.mdx)(r.MDXScopeProvider,{components:{CompilerOverview:a.Ay},mdxType:"MDXScopeProvider"},(0,i.mdx)(a.Ay,{mdxType:"CompilerOverview"})))}c.isMDXComponent=!0;const s=[n],u=[e],f={compositions:[{displayName:"Logo",identifier:"Logo"}]}})(),o})()));
|
package/artifacts/schema.json
CHANGED
|
@@ -1704,7 +1704,7 @@
|
|
|
1704
1704
|
"_legacy": {
|
|
1705
1705
|
"scope": "teambit.compilation",
|
|
1706
1706
|
"name": "compiler",
|
|
1707
|
-
"version": "1.0.
|
|
1707
|
+
"version": "1.0.283"
|
|
1708
1708
|
},
|
|
1709
1709
|
"_scope": "teambit.compilation"
|
|
1710
1710
|
}
|
|
@@ -2964,7 +2964,7 @@
|
|
|
2964
2964
|
"_legacy": {
|
|
2965
2965
|
"scope": "teambit.compilation",
|
|
2966
2966
|
"name": "compiler",
|
|
2967
|
-
"version": "1.0.
|
|
2967
|
+
"version": "1.0.283"
|
|
2968
2968
|
},
|
|
2969
2969
|
"_scope": "teambit.compilation"
|
|
2970
2970
|
}
|
|
@@ -3587,7 +3587,7 @@
|
|
|
3587
3587
|
"_legacy": {
|
|
3588
3588
|
"scope": "teambit.compilation",
|
|
3589
3589
|
"name": "compiler",
|
|
3590
|
-
"version": "1.0.
|
|
3590
|
+
"version": "1.0.283"
|
|
3591
3591
|
},
|
|
3592
3592
|
"_scope": "teambit.compilation"
|
|
3593
3593
|
}
|
|
@@ -5305,7 +5305,7 @@
|
|
|
5305
5305
|
"_legacy": {
|
|
5306
5306
|
"scope": "teambit.compilation",
|
|
5307
5307
|
"name": "compiler",
|
|
5308
|
-
"version": "1.0.
|
|
5308
|
+
"version": "1.0.283"
|
|
5309
5309
|
},
|
|
5310
5310
|
"_scope": "teambit.compilation"
|
|
5311
5311
|
}
|
|
@@ -7003,7 +7003,7 @@
|
|
|
7003
7003
|
"_legacy": {
|
|
7004
7004
|
"scope": "teambit.compilation",
|
|
7005
7005
|
"name": "compiler",
|
|
7006
|
-
"version": "1.0.
|
|
7006
|
+
"version": "1.0.283"
|
|
7007
7007
|
},
|
|
7008
7008
|
"_scope": "teambit.compilation"
|
|
7009
7009
|
}
|
|
@@ -7150,7 +7150,7 @@
|
|
|
7150
7150
|
"_legacy": {
|
|
7151
7151
|
"scope": "teambit.compilation",
|
|
7152
7152
|
"name": "compiler",
|
|
7153
|
-
"version": "1.0.
|
|
7153
|
+
"version": "1.0.283"
|
|
7154
7154
|
},
|
|
7155
7155
|
"_scope": "teambit.compilation"
|
|
7156
7156
|
}
|
|
@@ -7223,7 +7223,7 @@
|
|
|
7223
7223
|
"componentId": {
|
|
7224
7224
|
"scope": "teambit.compilation",
|
|
7225
7225
|
"name": "compiler",
|
|
7226
|
-
"version": "1.0.
|
|
7226
|
+
"version": "1.0.283"
|
|
7227
7227
|
},
|
|
7228
7228
|
"taggedModuleExports": []
|
|
7229
7229
|
}
|
package/dist/compiler.cmd.js
CHANGED
|
@@ -39,10 +39,10 @@ function _types() {
|
|
|
39
39
|
};
|
|
40
40
|
return data;
|
|
41
41
|
}
|
|
42
|
-
function _interopRequireDefault(
|
|
42
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
43
43
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
44
44
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
45
|
-
function _defineProperty(
|
|
45
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
46
46
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
47
47
|
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
48
48
|
class CompileCmd {
|
package/dist/compiler.cmd.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_logger","data","require","_chalk","_interopRequireDefault","_prettyTime","_outputFormatter","_types","obj","__esModule","default","ownKeys","e","r","t","Object","keys","getOwnPropertySymbols","o","filter","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","arguments","length","forEach","_defineProperty","getOwnPropertyDescriptors","defineProperties","defineProperty","key","value","_toPropertyKey","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","CompileCmd","constructor","compile","logger","pubsub","name","description","report","components","compilerOptions","startTimestamp","process","hrtime","setStatusLine","outputString","results","compileComponents","initiator","CompilationInitiator","CmdReport","compileTimeLength","chalk","underline","formatCompileResults","verbose","getStatusLine","clearStatusLine","code","getExitCode","json","deleteDistDir","compileResults","CmdJson","failedComponents","componentsStatus","component","errors","getSummaryIcon","Logger","successSymbol","red","yellow","numberOfComponents","numberOfFailingComponents","numberOfSuccessfulComponents","icon","summaryLine","prettyTime","exports"],"sources":["compiler.cmd.ts"],"sourcesContent":["import { Command, CommandOptions } from '@teambit/cli';\nimport { Logger } from '@teambit/logger';\nimport type { PubsubMain } from '@teambit/pubsub';\nimport chalk from 'chalk';\nimport prettyTime from 'pretty-time';\nimport { formatCompileResults } from './output-formatter';\nimport { WorkspaceCompiler, CompileOptions, BuildResult } from './workspace-compiler';\nimport { CompilationInitiator } from './types';\n\nexport class CompileCmd implements Command {\n name = 'compile [component-names...]';\n description = 'compile components in the workspace';\n helpUrl = 'reference/compiling/compiler-overview';\n arguments = [\n {\n name: 'component-names...',\n description: 'a list of component names or component IDs (defaults to all components)',\n },\n ];\n alias = '';\n group = 'development';\n options = [\n ['c', 'changed', 'compile only new and modified components'],\n ['v', 'verbose', 'show more data, such as, dist paths'],\n ['j', 'json', 'return the compile results in json format'],\n ['d', 'delete-dist-dir', 'delete existing dist folder before writing new compiled files'],\n ] as CommandOptions;\n\n constructor(private compile: WorkspaceCompiler, private logger: Logger, private pubsub: PubsubMain) {}\n\n async report([components = []]: [string[]], compilerOptions: CompileOptions) {\n const startTimestamp = process.hrtime();\n this.logger.setStatusLine('Compiling your components, hold tight.');\n\n let outputString = '';\n const results = await this.compile.compileComponents(components, {\n ...compilerOptions,\n initiator: CompilationInitiator.CmdReport,\n });\n const compileTimeLength = process.hrtime(startTimestamp);\n\n outputString += '\\n';\n outputString += ` ${chalk.underline('STATUS')}\\t${chalk.underline('COMPONENT ID')}\\n`;\n outputString += formatCompileResults(results, !!compilerOptions.verbose);\n outputString += '\\n';\n\n outputString += this.getStatusLine(results, compileTimeLength);\n\n this.logger.clearStatusLine();\n\n return {\n data: outputString,\n code: this.getExitCode(results),\n };\n }\n\n async json([components]: [string[]], compilerOptions: CompileOptions) {\n compilerOptions.deleteDistDir = true;\n // @ts-ignore\n const compileResults = await this.compile.compileComponents(components, {\n ...compilerOptions,\n initiator: CompilationInitiator.CmdJson,\n });\n return {\n data: compileResults,\n // @todo: fix the code once compile is ready.\n code: 0,\n };\n }\n\n private failedComponents(componentsStatus: BuildResult[]): BuildResult[] {\n return componentsStatus.filter((component) => component.errors.length);\n }\n\n private getSummaryIcon(componentsStatus: BuildResult[]) {\n switch (this.failedComponents(componentsStatus).length) {\n case 0:\n return Logger.successSymbol();\n case componentsStatus.length:\n return chalk.red('✗');\n default:\n return chalk.yellow('⍻');\n }\n }\n\n private getExitCode(componentsStatus: BuildResult[]) {\n return this.failedComponents(componentsStatus).length ? 1 : 0;\n }\n\n private getStatusLine(componentsStatus: BuildResult[], compileTimeLength) {\n const numberOfComponents = componentsStatus.length;\n const numberOfFailingComponents = this.failedComponents(componentsStatus).length;\n const numberOfSuccessfulComponents = componentsStatus.filter((component) => !component.errors.length).length;\n\n const icon = this.getSummaryIcon(componentsStatus);\n const summaryLine = numberOfFailingComponents\n ? `${icon} ${numberOfFailingComponents}/${numberOfComponents} components failed to compile.`\n : `${icon} ${numberOfSuccessfulComponents}/${numberOfComponents} components compiled successfully.`;\n\n return `${summaryLine}\\nFinished. (${prettyTime(compileTimeLength)})`;\n }\n}\n"],"mappings":";;;;;;AACA,SAAAA,QAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,OAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,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AAgB,CAAC,CAACrD,MAAM,GAAG,CAAC,GAAG,CAAC;EAC/D;EAEQ4C,aAAaA,CAACS,gBAA+B,EAAEd,iBAAiB,EAAE;IACxE,MAAMsB,kBAAkB,GAAGR,gBAAgB,CAACrD,MAAM;IAClD,MAAM8D,yBAAyB,GAAG,IAAI,CAACV,gBAAgB,CAACC,gBAAgB,CAAC,CAACrD,MAAM;IAChF,MAAM+D,4BAA4B,GAAGV,gBAAgB,CAAC5D,MAAM,CAAE6D,SAAS,IAAK,CAACA,SAAS,CAACC,MAAM,CAACvD,MAAM,CAAC,CAACA,MAAM;IAE5G,MAAMgE,IAAI,GAAG,IAAI,CAACR,cAAc,CAACH,gBAAgB,CAAC;IAClD,MAAMY,WAAW,GAAGH,yBAAyB,GACxC,GAAEE,IAAK,IAAGF,yBAA0B,IAAGD,kBAAmB,gCAA+B,GACzF,GAAEG,IAAK,IAAGD,4BAA6B,IAAGF,kBAAmB,oCAAmC;IAErG,OAAQ,GAAEI,WAAY,gBAAe,IAAAC,qBAAU,EAAC3B,iBAAiB,CAAE,GAAE;EACvE;AACF;AAAC4B,OAAA,CAAAhD,UAAA,GAAAA,UAAA","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_logger","data","require","_chalk","_interopRequireDefault","_prettyTime","_outputFormatter","_types","e","__esModule","default","ownKeys","r","t","Object","keys","getOwnPropertySymbols","o","filter","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","arguments","length","forEach","_defineProperty","getOwnPropertyDescriptors","defineProperties","defineProperty","_toPropertyKey","value","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","CompileCmd","constructor","compile","logger","pubsub","name","description","report","components","compilerOptions","startTimestamp","process","hrtime","setStatusLine","outputString","results","compileComponents","initiator","CompilationInitiator","CmdReport","compileTimeLength","chalk","underline","formatCompileResults","verbose","getStatusLine","clearStatusLine","code","getExitCode","json","deleteDistDir","compileResults","CmdJson","failedComponents","componentsStatus","component","errors","getSummaryIcon","Logger","successSymbol","red","yellow","numberOfComponents","numberOfFailingComponents","numberOfSuccessfulComponents","icon","summaryLine","prettyTime","exports"],"sources":["compiler.cmd.ts"],"sourcesContent":["import { Command, CommandOptions } from '@teambit/cli';\nimport { Logger } from '@teambit/logger';\nimport type { PubsubMain } from '@teambit/pubsub';\nimport chalk from 'chalk';\nimport prettyTime from 'pretty-time';\nimport { formatCompileResults } from './output-formatter';\nimport { WorkspaceCompiler, CompileOptions, BuildResult } from './workspace-compiler';\nimport { CompilationInitiator } from './types';\n\nexport class CompileCmd implements Command {\n name = 'compile [component-names...]';\n description = 'compile components in the workspace';\n helpUrl = 'reference/compiling/compiler-overview';\n arguments = [\n {\n name: 'component-names...',\n description: 'a list of component names or component IDs (defaults to all components)',\n },\n ];\n alias = '';\n group = 'development';\n options = [\n ['c', 'changed', 'compile only new and modified components'],\n ['v', 'verbose', 'show more data, such as, dist paths'],\n ['j', 'json', 'return the compile results in json format'],\n ['d', 'delete-dist-dir', 'delete existing dist folder before writing new compiled files'],\n ] as CommandOptions;\n\n constructor(private compile: WorkspaceCompiler, private logger: Logger, private pubsub: PubsubMain) {}\n\n async report([components = []]: [string[]], compilerOptions: CompileOptions) {\n const startTimestamp = process.hrtime();\n this.logger.setStatusLine('Compiling your components, hold tight.');\n\n let outputString = '';\n const results = await this.compile.compileComponents(components, {\n ...compilerOptions,\n initiator: CompilationInitiator.CmdReport,\n });\n const compileTimeLength = process.hrtime(startTimestamp);\n\n outputString += '\\n';\n outputString += ` ${chalk.underline('STATUS')}\\t${chalk.underline('COMPONENT ID')}\\n`;\n outputString += formatCompileResults(results, !!compilerOptions.verbose);\n outputString += '\\n';\n\n outputString += this.getStatusLine(results, compileTimeLength);\n\n this.logger.clearStatusLine();\n\n return {\n data: outputString,\n code: this.getExitCode(results),\n };\n }\n\n async json([components]: [string[]], compilerOptions: CompileOptions) {\n compilerOptions.deleteDistDir = true;\n // @ts-ignore\n const compileResults = await this.compile.compileComponents(components, {\n ...compilerOptions,\n initiator: CompilationInitiator.CmdJson,\n });\n return {\n data: compileResults,\n // @todo: fix the code once compile is ready.\n code: 0,\n };\n }\n\n private failedComponents(componentsStatus: BuildResult[]): BuildResult[] {\n return componentsStatus.filter((component) => component.errors.length);\n }\n\n private getSummaryIcon(componentsStatus: BuildResult[]) {\n switch (this.failedComponents(componentsStatus).length) {\n case 0:\n return Logger.successSymbol();\n case componentsStatus.length:\n return chalk.red('✗');\n default:\n return chalk.yellow('⍻');\n }\n }\n\n private getExitCode(componentsStatus: BuildResult[]) {\n return this.failedComponents(componentsStatus).length ? 1 : 0;\n }\n\n private getStatusLine(componentsStatus: BuildResult[], compileTimeLength) {\n const numberOfComponents = componentsStatus.length;\n const numberOfFailingComponents = this.failedComponents(componentsStatus).length;\n const numberOfSuccessfulComponents = componentsStatus.filter((component) => !component.errors.length).length;\n\n const icon = this.getSummaryIcon(componentsStatus);\n const summaryLine = numberOfFailingComponents\n ? `${icon} ${numberOfFailingComponents}/${numberOfComponents} components failed to compile.`\n : `${icon} ${numberOfSuccessfulComponents}/${numberOfComponents} components compiled successfully.`;\n\n return `${summaryLine}\\nFinished. (${prettyTime(compileTimeLength)})`;\n }\n}\n"],"mappings":";;;;;;AACA,SAAAA,QAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,OAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAE,OAAA;EAAA,MAAAF,IAAA,GAAAG,sBAAA,CAAAF,OAAA;EAAAC,MAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAI,YAAA;EAAA,MAAAJ,IAAA,GAAAG,sBAAA,CAAAF,OAAA;EAAAG,WAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAK,iBAAA;EAAA,MAAAL,IAAA,GAAAC,OAAA;EAAAI,gBAAA,YA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AM+D,IAAI,GAAG,IAAI,CAACR,cAAc,CAACH,gBAAgB,CAAC;IAClD,MAAMY,WAAW,GAAGH,yBAAyB,GACzC,GAAGE,IAAI,IAAIF,yBAAyB,IAAID,kBAAkB,gCAAgC,GAC1F,GAAGG,IAAI,IAAID,4BAA4B,IAAIF,kBAAkB,oCAAoC;IAErG,OAAO,GAAGI,WAAW,gBAAgB,IAAAC,qBAAU,EAAC3B,iBAAiB,CAAC,GAAG;EACvE;AACF;AAAC4B,OAAA,CAAAhD,UAAA,GAAAA,UAAA","ignoreList":[]}
|
|
@@ -11,7 +11,7 @@ function _react() {
|
|
|
11
11
|
};
|
|
12
12
|
return data;
|
|
13
13
|
}
|
|
14
|
-
function _interopRequireDefault(
|
|
14
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
15
15
|
const Logo = () => /*#__PURE__*/_react().default.createElement("div", {
|
|
16
16
|
style: {
|
|
17
17
|
height: '100%',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_react","data","_interopRequireDefault","require","
|
|
1
|
+
{"version":3,"names":["_react","data","_interopRequireDefault","require","e","__esModule","default","Logo","createElement","style","height","display","justifyContent","width","src","exports"],"sources":["compiler.composition.tsx"],"sourcesContent":["import React from 'react';\n\nexport const Logo = () => (\n <div style={{ height: '100%', display: 'flex', justifyContent: 'center' }}>\n <img style={{ width: 70 }} src=\"https://static.bit.dev/extensions-icons/compiler.svg\" />\n </div>\n);\n"],"mappings":";;;;;;AAAA,SAAAA,OAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,MAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAA0B,SAAAC,uBAAAE,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAEnB,MAAMG,IAAI,GAAGA,CAAA,kBAClBP,MAAA,GAAAM,OAAA,CAAAE,aAAA;EAAKC,KAAK,EAAE;IAAEC,MAAM,EAAE,MAAM;IAAEC,OAAO,EAAE,MAAM;IAAEC,cAAc,EAAE;EAAS;AAAE,gBACxEZ,MAAA,GAAAM,OAAA,CAAAE,aAAA;EAAKC,KAAK,EAAE;IAAEI,KAAK,EAAE;EAAG,CAAE;EAACC,GAAG,EAAC;AAAsD,CAAE,CACpF,CACN;AAACC,OAAA,CAAAR,IAAA,GAAAA,IAAA","ignoreList":[]}
|
|
@@ -179,10 +179,10 @@ function _compiler5() {
|
|
|
179
179
|
};
|
|
180
180
|
return data;
|
|
181
181
|
}
|
|
182
|
-
function _interopRequireDefault(
|
|
182
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
183
183
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
184
184
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
185
|
-
function _defineProperty(
|
|
185
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
186
186
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
187
187
|
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
188
188
|
class CompilerMain {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["path","data","_interopRequireWildcard","require","_fsExtra","_interopRequireDefault","_aspectLoader","_builder","_cli","_componentIssues","_issues","_constants","_watcher","_envs","_dependencyResolver","_logger","_generator","_pubsub","_ui","_workspace","_compiler","_compiler2","_compiler3","_compiler4","_distArtifact","_exceptions","_types","_workspaceCompiler","_compiler5","obj","__esModule","default","_getRequireWildcardCache","e","WeakMap","r","t","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","_defineProperty","key","value","_toPropertyKey","enumerable","configurable","writable","_toPrimitive","Symbol","toPrimitive","TypeError","String","Number","CompilerMain","constructor","pubsub","workspaceCompiler","envs","builder","workspace","dependencyResolver","compilerService","getCompiler","context","compileOnWorkspace","componentsIds","options","initiator","CompilationInitiator","ComponentAdded","compileComponents","createTask","name","compiler","CompilerTask","CompilerAspect","id","getDistPathBySrcPath","component","srcPath","environment","getEnv","env","compilerInstance","getRelativeDistFolder","getOrCalculateEnv","getDistDir","DEFAULT_DIST_DIRNAME","isDistDirExists","packageDir","getComponentPackagePath","distDir","pathToCheck","join","fs","existsSync","getDistsFiles","artifacts","getArtifactsVinylByAspect","length","DistArtifactNotFound","DistArtifact","addMissingDistsIssue","components","issuesToIgnore","includes","IssuesClasses","MissingDists","Promise","all","map","exist","state","issues","getOrCreate","provider","cli","loggerMain","aspectLoader","ui","generator","watcher","logger","createLogger","CompilerService","WorkspaceCompiler","registerService","compilerMain","register","CompileCmd","registerAddComponentsIssues","bind","registerComponentTemplate","compilerTemplate","exports","MainRuntime","CLIAspect","WorkspaceAspect","EnvsAspect","LoggerAspect","PubsubAspect","AspectLoaderAspect","BuilderAspect","UIAspect","GeneratorAspect","DependencyResolverAspect","WatcherAspect","IssuesAspect","addRuntime","_default"],"sources":["compiler.main.runtime.ts"],"sourcesContent":["import * as path from 'path';\nimport fs from 'fs-extra';\nimport { AspectLoaderAspect, AspectLoaderMain } from '@teambit/aspect-loader';\nimport { BuilderAspect, BuilderMain } from '@teambit/builder';\nimport { CLIAspect, CLIMain, MainRuntime } from '@teambit/cli';\nimport { IssuesClasses } from '@teambit/component-issues';\nimport { IssuesAspect, IssuesMain } from '@teambit/issues';\nimport { Component } from '@teambit/component';\nimport { DEFAULT_DIST_DIRNAME } from '@teambit/legacy/dist/constants';\nimport { WatcherAspect, WatcherMain } from '@teambit/watcher';\nimport { EnvsAspect, EnvsMain, ExecutionContext } from '@teambit/envs';\nimport { ComponentID } from '@teambit/component-id';\nimport { DependencyResolverAspect, DependencyResolverMain } from '@teambit/dependency-resolver';\nimport { LoggerAspect, LoggerMain } from '@teambit/logger';\nimport { GeneratorAspect, GeneratorMain } from '@teambit/generator';\nimport { PubsubAspect, PubsubMain } from '@teambit/pubsub';\nimport { UIAspect, UiMain } from '@teambit/ui';\nimport { Workspace, WorkspaceAspect } from '@teambit/workspace';\nimport { CompilerAspect } from './compiler.aspect';\nimport { CompileCmd } from './compiler.cmd';\nimport { CompilerService } from './compiler.service';\nimport { CompilerTask } from './compiler.task';\nimport { DistArtifact } from './dist-artifact';\nimport { DistArtifactNotFound } from './exceptions';\nimport { CompilationInitiator, Compiler } from './types';\nimport { CompileOptions, WorkspaceCompiler } from './workspace-compiler';\nimport { compilerTemplate } from './templates/compiler';\n\nexport class CompilerMain {\n constructor(\n private pubsub: PubsubMain,\n private workspaceCompiler: WorkspaceCompiler,\n private envs: EnvsMain,\n private builder: BuilderMain,\n private workspace: Workspace,\n private dependencyResolver: DependencyResolverMain,\n private compilerService: CompilerService\n ) {}\n\n getCompiler(context: ExecutionContext): Compiler {\n return this.compilerService.getCompiler(context);\n }\n\n /**\n * Run compilation on `bit new` and when new components are imported\n */\n compileOnWorkspace(\n componentsIds: string[] | ComponentID[] | ComponentID[] = [], // when empty, it compiles all\n options: CompileOptions = { initiator: CompilationInitiator.ComponentAdded }\n ) {\n return this.workspaceCompiler.compileComponents(componentsIds, options);\n }\n /**\n * API to create a new compiler task, it facilitates the usage of multiple compilers.\n * with this method you can create any number of compilers and add them to the buildPipeline.\n */\n createTask(name: string, compiler: Compiler): CompilerTask {\n return new CompilerTask(CompilerAspect.id, name, compiler, this.dependencyResolver);\n }\n\n /**\n * find the compiler configured on the workspace and ask for the dist path.\n */\n getDistPathBySrcPath(component: Component, srcPath: string): string | null {\n const environment = this.envs.getEnv(component).env;\n const compilerInstance = environment.getCompiler?.();\n if (!compilerInstance) return null;\n return compilerInstance.getDistPathBySrcPath(srcPath);\n }\n\n /**\n * find the compiler configured on the workspace and ask for the dist folder path.\n */\n getRelativeDistFolder(component: Component): string {\n const environment = this.envs.getOrCalculateEnv(component).env;\n const compilerInstance: Compiler | undefined = environment.getCompiler?.();\n if (!compilerInstance || !compilerInstance.getDistDir) return DEFAULT_DIST_DIRNAME;\n return compilerInstance.getDistDir();\n }\n\n /**\n * Check if the dist folder (in the component package under node_modules) exist\n * @param component\n * @returns\n */\n async isDistDirExists(component: Component): Promise<boolean> {\n const packageDir = await this.workspace.getComponentPackagePath(component);\n const distDir = this.getRelativeDistFolder(component);\n const pathToCheck = path.join(packageDir, distDir);\n return fs.existsSync(pathToCheck);\n }\n\n async getDistsFiles(component: Component): Promise<DistArtifact> {\n const artifacts = await this.builder.getArtifactsVinylByAspect(component, CompilerAspect.id);\n if (!artifacts.length) throw new DistArtifactNotFound(component.id);\n\n return new DistArtifact(artifacts);\n }\n\n async addMissingDistsIssue(components: Component[], issuesToIgnore: string[]): Promise<void> {\n if (issuesToIgnore.includes(IssuesClasses.MissingDists.name)) return;\n await Promise.all(\n components.map(async (component) => {\n const exist = await this.isDistDirExists(component);\n if (!exist) {\n component.state.issues.getOrCreate(IssuesClasses.MissingDists).data = true;\n }\n })\n );\n }\n\n static runtime = MainRuntime;\n\n static dependencies = [\n CLIAspect,\n WorkspaceAspect,\n EnvsAspect,\n LoggerAspect,\n PubsubAspect,\n AspectLoaderAspect,\n BuilderAspect,\n UIAspect,\n GeneratorAspect,\n DependencyResolverAspect,\n WatcherAspect,\n IssuesAspect,\n ];\n\n static async provider([\n cli,\n workspace,\n envs,\n loggerMain,\n pubsub,\n aspectLoader,\n builder,\n ui,\n generator,\n dependencyResolver,\n watcher,\n issues,\n ]: [\n CLIMain,\n Workspace,\n EnvsMain,\n LoggerMain,\n PubsubMain,\n AspectLoaderMain,\n BuilderMain,\n UiMain,\n GeneratorMain,\n DependencyResolverMain,\n WatcherMain,\n IssuesMain\n ]) {\n const logger = loggerMain.createLogger(CompilerAspect.id);\n const compilerService = new CompilerService();\n\n const workspaceCompiler = new WorkspaceCompiler(\n workspace,\n envs,\n pubsub,\n aspectLoader,\n ui,\n logger,\n dependencyResolver,\n watcher\n );\n envs.registerService(compilerService);\n const compilerMain = new CompilerMain(\n pubsub,\n workspaceCompiler,\n envs,\n builder,\n workspace,\n dependencyResolver,\n compilerService\n );\n cli.register(new CompileCmd(workspaceCompiler, logger, pubsub));\n if (issues) {\n issues.registerAddComponentsIssues(compilerMain.addMissingDistsIssue.bind(compilerMain));\n }\n if (generator) generator.registerComponentTemplate([compilerTemplate]);\n\n return compilerMain;\n }\n}\n\nCompilerAspect.addRuntime(CompilerMain);\n\nexport default CompilerMain;\n"],"mappings":";;;;;;AAAA,SAAAA,KAAA;EAAA,MAAAC,IAAA,GAAAC,uBAAA,CAAAC,OAAA;EAAAH,IAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,SAAA;EAAA,MAAAH,IAAA,GAAAI,sBAAA,CAAAF,OAAA;EAAAC,QAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAK,cAAA;EAAA,MAAAL,IAAA,GAAAE,OAAA;EAAAG,aAAA,YAAAA,CAAA;IAAA,OAAAL,I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NkF,kBAAW;AAAA/F,eAAA,CAnFjBa,YAAY,kBAqFD,CACpBmF,gBAAS,EACTC,4BAAe,EACfC,kBAAU,EACVC,sBAAY,EACZC,sBAAY,EACZC,kCAAkB,EAClBC,wBAAa,EACbC,cAAQ,EACRC,4BAAe,EACfC,8CAAwB,EACxBC,wBAAa,EACbC,sBAAY,CACb;AA8DHxE,0BAAc,CAACyE,UAAU,CAAC/F,YAAY,CAAC;AAAC,IAAAgG,QAAA,GAAAf,OAAA,CAAAjH,OAAA,GAEzBgC,YAAY","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["path","data","_interopRequireWildcard","require","_fsExtra","_interopRequireDefault","_aspectLoader","_builder","_cli","_componentIssues","_issues","_constants","_watcher","_envs","_dependencyResolver","_logger","_generator","_pubsub","_ui","_workspace","_compiler","_compiler2","_compiler3","_compiler4","_distArtifact","_exceptions","_types","_workspaceCompiler","_compiler5","e","__esModule","default","_getRequireWildcardCache","WeakMap","r","t","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","_defineProperty","_toPropertyKey","value","enumerable","configurable","writable","_toPrimitive","Symbol","toPrimitive","TypeError","String","Number","CompilerMain","constructor","pubsub","workspaceCompiler","envs","builder","workspace","dependencyResolver","compilerService","getCompiler","context","compileOnWorkspace","componentsIds","options","initiator","CompilationInitiator","ComponentAdded","compileComponents","createTask","name","compiler","CompilerTask","CompilerAspect","id","getDistPathBySrcPath","component","srcPath","environment","getEnv","env","compilerInstance","getRelativeDistFolder","getOrCalculateEnv","getDistDir","DEFAULT_DIST_DIRNAME","isDistDirExists","packageDir","getComponentPackagePath","distDir","pathToCheck","join","fs","existsSync","getDistsFiles","artifacts","getArtifactsVinylByAspect","length","DistArtifactNotFound","DistArtifact","addMissingDistsIssue","components","issuesToIgnore","includes","IssuesClasses","MissingDists","Promise","all","map","exist","state","issues","getOrCreate","provider","cli","loggerMain","aspectLoader","ui","generator","watcher","logger","createLogger","CompilerService","WorkspaceCompiler","registerService","compilerMain","register","CompileCmd","registerAddComponentsIssues","bind","registerComponentTemplate","compilerTemplate","exports","MainRuntime","CLIAspect","WorkspaceAspect","EnvsAspect","LoggerAspect","PubsubAspect","AspectLoaderAspect","BuilderAspect","UIAspect","GeneratorAspect","DependencyResolverAspect","WatcherAspect","IssuesAspect","addRuntime","_default"],"sources":["compiler.main.runtime.ts"],"sourcesContent":["import * as path from 'path';\nimport fs from 'fs-extra';\nimport { AspectLoaderAspect, AspectLoaderMain } from '@teambit/aspect-loader';\nimport { BuilderAspect, BuilderMain } from '@teambit/builder';\nimport { CLIAspect, CLIMain, MainRuntime } from '@teambit/cli';\nimport { IssuesClasses } from '@teambit/component-issues';\nimport { IssuesAspect, IssuesMain } from '@teambit/issues';\nimport { Component } from '@teambit/component';\nimport { DEFAULT_DIST_DIRNAME } from '@teambit/legacy/dist/constants';\nimport { WatcherAspect, WatcherMain } from '@teambit/watcher';\nimport { EnvsAspect, EnvsMain, ExecutionContext } from '@teambit/envs';\nimport { ComponentID } from '@teambit/component-id';\nimport { DependencyResolverAspect, DependencyResolverMain } from '@teambit/dependency-resolver';\nimport { LoggerAspect, LoggerMain } from '@teambit/logger';\nimport { GeneratorAspect, GeneratorMain } from '@teambit/generator';\nimport { PubsubAspect, PubsubMain } from '@teambit/pubsub';\nimport { UIAspect, UiMain } from '@teambit/ui';\nimport { Workspace, WorkspaceAspect } from '@teambit/workspace';\nimport { CompilerAspect } from './compiler.aspect';\nimport { CompileCmd } from './compiler.cmd';\nimport { CompilerService } from './compiler.service';\nimport { CompilerTask } from './compiler.task';\nimport { DistArtifact } from './dist-artifact';\nimport { DistArtifactNotFound } from './exceptions';\nimport { CompilationInitiator, Compiler } from './types';\nimport { CompileOptions, WorkspaceCompiler } from './workspace-compiler';\nimport { compilerTemplate } from './templates/compiler';\n\nexport class CompilerMain {\n constructor(\n private pubsub: PubsubMain,\n private workspaceCompiler: WorkspaceCompiler,\n private envs: EnvsMain,\n private builder: BuilderMain,\n private workspace: Workspace,\n private dependencyResolver: DependencyResolverMain,\n private compilerService: CompilerService\n ) {}\n\n getCompiler(context: ExecutionContext): Compiler {\n return this.compilerService.getCompiler(context);\n }\n\n /**\n * Run compilation on `bit new` and when new components are imported\n */\n compileOnWorkspace(\n componentsIds: string[] | ComponentID[] | ComponentID[] = [], // when empty, it compiles all\n options: CompileOptions = { initiator: CompilationInitiator.ComponentAdded }\n ) {\n return this.workspaceCompiler.compileComponents(componentsIds, options);\n }\n /**\n * API to create a new compiler task, it facilitates the usage of multiple compilers.\n * with this method you can create any number of compilers and add them to the buildPipeline.\n */\n createTask(name: string, compiler: Compiler): CompilerTask {\n return new CompilerTask(CompilerAspect.id, name, compiler, this.dependencyResolver);\n }\n\n /**\n * find the compiler configured on the workspace and ask for the dist path.\n */\n getDistPathBySrcPath(component: Component, srcPath: string): string | null {\n const environment = this.envs.getEnv(component).env;\n const compilerInstance = environment.getCompiler?.();\n if (!compilerInstance) return null;\n return compilerInstance.getDistPathBySrcPath(srcPath);\n }\n\n /**\n * find the compiler configured on the workspace and ask for the dist folder path.\n */\n getRelativeDistFolder(component: Component): string {\n const environment = this.envs.getOrCalculateEnv(component).env;\n const compilerInstance: Compiler | undefined = environment.getCompiler?.();\n if (!compilerInstance || !compilerInstance.getDistDir) return DEFAULT_DIST_DIRNAME;\n return compilerInstance.getDistDir();\n }\n\n /**\n * Check if the dist folder (in the component package under node_modules) exist\n * @param component\n * @returns\n */\n async isDistDirExists(component: Component): Promise<boolean> {\n const packageDir = await this.workspace.getComponentPackagePath(component);\n const distDir = this.getRelativeDistFolder(component);\n const pathToCheck = path.join(packageDir, distDir);\n return fs.existsSync(pathToCheck);\n }\n\n async getDistsFiles(component: Component): Promise<DistArtifact> {\n const artifacts = await this.builder.getArtifactsVinylByAspect(component, CompilerAspect.id);\n if (!artifacts.length) throw new DistArtifactNotFound(component.id);\n\n return new DistArtifact(artifacts);\n }\n\n async addMissingDistsIssue(components: Component[], issuesToIgnore: string[]): Promise<void> {\n if (issuesToIgnore.includes(IssuesClasses.MissingDists.name)) return;\n await Promise.all(\n components.map(async (component) => {\n const exist = await this.isDistDirExists(component);\n if (!exist) {\n component.state.issues.getOrCreate(IssuesClasses.MissingDists).data = true;\n }\n })\n );\n }\n\n static runtime = MainRuntime;\n\n static dependencies = [\n CLIAspect,\n WorkspaceAspect,\n EnvsAspect,\n LoggerAspect,\n PubsubAspect,\n AspectLoaderAspect,\n BuilderAspect,\n UIAspect,\n GeneratorAspect,\n DependencyResolverAspect,\n WatcherAspect,\n IssuesAspect,\n ];\n\n static async provider([\n cli,\n workspace,\n envs,\n loggerMain,\n pubsub,\n aspectLoader,\n builder,\n ui,\n generator,\n dependencyResolver,\n watcher,\n issues,\n ]: [\n CLIMain,\n Workspace,\n EnvsMain,\n LoggerMain,\n PubsubMain,\n AspectLoaderMain,\n BuilderMain,\n UiMain,\n GeneratorMain,\n DependencyResolverMain,\n WatcherMain,\n IssuesMain\n ]) {\n const logger = loggerMain.createLogger(CompilerAspect.id);\n const compilerService = new CompilerService();\n\n const workspaceCompiler = new WorkspaceCompiler(\n workspace,\n envs,\n pubsub,\n aspectLoader,\n ui,\n logger,\n dependencyResolver,\n watcher\n );\n envs.registerService(compilerService);\n const compilerMain = new CompilerMain(\n pubsub,\n workspaceCompiler,\n envs,\n builder,\n workspace,\n dependencyResolver,\n compilerService\n );\n cli.register(new CompileCmd(workspaceCompiler, logger, pubsub));\n if (issues) {\n issues.registerAddComponentsIssues(compilerMain.addMissingDistsIssue.bind(compilerMain));\n }\n if (generator) generator.registerComponentTemplate([compilerTemplate]);\n\n return compilerMain;\n }\n}\n\nCompilerAspect.addRuntime(CompilerMain);\n\nexport default CompilerMain;\n"],"mappings":";;;;;;AAAA,SAAAA,KAAA;EAAA,MAAAC,IAAA,GAAAC,uBAAA,CAAAC,OAAA;EAAAH,IAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,SAAA;E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,CAAC,CAAC;IAC1F;IACA,IAAIP,SAAS,EAAEA,SAAS,CAACY,yBAAyB,CAAC,CAACC,6BAAgB,CAAC,CAAC;IAEtE,OAAON,YAAY;EACrB;AACF;AAACO,OAAA,CAAAjF,YAAA,GAAAA,YAAA;AAAAZ,eAAA,CA9JYY,YAAY,aAmFNkF,kBAAW;AAAA9F,eAAA,CAnFjBY,YAAY,kBAqFD,CACpBmF,gBAAS,EACTC,4BAAe,EACfC,kBAAU,EACVC,sBAAY,EACZC,sBAAY,EACZC,kCAAkB,EAClBC,wBAAa,EACbC,cAAQ,EACRC,4BAAe,EACfC,8CAAwB,EACxBC,wBAAa,EACbC,sBAAY,CACb;AA8DHxE,0BAAc,CAACyE,UAAU,CAAC/F,YAAY,CAAC;AAAC,IAAAgG,QAAA,GAAAf,OAAA,CAAA/G,OAAA,GAEzB8B,YAAY","ignoreList":[]}
|
package/dist/compiler.service.js
CHANGED
|
@@ -18,8 +18,8 @@ function _cliHighlight() {
|
|
|
18
18
|
};
|
|
19
19
|
return data;
|
|
20
20
|
}
|
|
21
|
-
function _interopRequireDefault(
|
|
22
|
-
function _defineProperty(
|
|
21
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
22
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
23
23
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
24
24
|
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
25
25
|
class CompilerService {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_chalk","data","_interopRequireDefault","require","_cliHighlight","
|
|
1
|
+
{"version":3,"names":["_chalk","data","_interopRequireDefault","require","_cliHighlight","e","__esModule","default","_defineProperty","r","t","_toPropertyKey","Object","defineProperty","value","enumerable","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","CompilerService","constructor","getCompiler","context","compiler","env","render","descriptor","getDescriptor","name","chalk","green","id","displayName","version","configLabel","configObj","config","highlight","language","ignoreIllegals","transform","undefined","icon","displayConfig","exports"],"sources":["compiler.service.ts"],"sourcesContent":["import { EnvService, EnvDefinition, Env, EnvContext, ServiceTransformationMap, ExecutionContext } from '@teambit/envs';\nimport chalk from 'chalk';\nimport highlight from 'cli-highlight';\nimport { Compiler } from './types';\n\nexport type CompilerDescriptor = {\n id: string;\n icon?: string;\n config?: string;\n};\n\ntype CompilerTransformationMap = ServiceTransformationMap & {\n getCompiler: () => Compiler;\n};\n\nexport class CompilerService implements EnvService<{}, CompilerDescriptor> {\n name = 'Compile';\n\n getCompiler(context: ExecutionContext): Compiler {\n const compiler: Compiler = context.env.getCompiler();\n return compiler;\n }\n\n render(env: EnvDefinition) {\n const descriptor = this.getDescriptor(env);\n const name = `${chalk.green('configured compiler:')} ${descriptor?.id} (${descriptor?.displayName} @ ${\n descriptor?.version\n })`;\n const configLabel = chalk.green('compiler config:');\n const configObj = descriptor?.config\n ? highlight(descriptor?.config, { language: 'json', ignoreIllegals: true })\n : '';\n return `${name}\\n${configLabel}\\n${configObj}`;\n }\n\n transform(env: Env, context: EnvContext): CompilerTransformationMap | undefined {\n // Old env\n if (!env?.compiler) return undefined;\n return {\n getCompiler: () => env.compiler()(context),\n };\n }\n\n getDescriptor(env: EnvDefinition) {\n if (!env.env.getCompiler) return undefined;\n const compiler = env.env.getCompiler();\n\n return {\n id: compiler.id,\n icon: compiler.icon,\n config: compiler.displayConfig ? compiler.displayConfig() : undefined,\n version: compiler.version ? compiler.version() : '?',\n displayName: compiler.displayName ? compiler.displayName : '?',\n };\n }\n}\n"],"mappings":";;;;;;AACA,SAAAA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,OAAO,GAAGV,QAAQ,CAACU,OAAO,CAAC,CAAC,GAAG,GAAG;MACpDD,WAAW,EAAET,QAAQ,CAACS,WAAW,GAAGT,QAAQ,CAACS,WAAW,GAAG;IAC7D,CAAC;EACH;AACF;AAACY,OAAA,CAAAzB,eAAA,GAAAA,eAAA","ignoreList":[]}
|
package/dist/compiler.task.js
CHANGED
|
@@ -32,8 +32,8 @@ function _compiler() {
|
|
|
32
32
|
};
|
|
33
33
|
return data;
|
|
34
34
|
}
|
|
35
|
-
function _interopRequireDefault(
|
|
36
|
-
function _defineProperty(
|
|
35
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
36
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
37
37
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
38
38
|
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
39
39
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_toolboxFs","data","require","_fsExtra","_interopRequireDefault","_path","_compiler","
|
|
1
|
+
{"version":3,"names":["_toolboxFs","data","require","_fsExtra","_interopRequireDefault","_path","_compiler","e","__esModule","default","_defineProperty","r","t","_toPropertyKey","Object","defineProperty","value","enumerable","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","CompilerTask","constructor","aspectId","name","compilerInstance","dependencyResolver","artifactName","description","preBuild","context","Promise","all","capsuleNetwork","seedersCapsules","map","capsule","copyNonSupportedFiles","execute","buildResults","build","_hardLinkBuildArtifactsOnCapsules","relCompDir","path","relative","capsulesRootDir","replace","injectedDirs","getInjectedDirs","getPackageName","component","hardLinkDirectory","injectedDir","join","postBuild","tasksResults","compiler","shouldCopyNonSupportedFiles","filesystem","files","file","isFileSupported","content","contents","fs","outputFile","distDir","from","options","CompilerAspect","id","depResolve","getAspect","exports"],"sources":["compiler.task.ts"],"sourcesContent":["import { BuildContext, BuiltTaskResult, BuildTask, TaskResultsList } from '@teambit/builder';\nimport { Capsule } from '@teambit/isolator';\nimport { hardLinkDirectory } from '@teambit/toolbox.fs.hard-link-directory';\nimport { EnvContext, EnvHandler } from '@teambit/envs';\nimport { DependencyResolverMain } from '@teambit/dependency-resolver';\nimport fs from 'fs-extra';\nimport path from 'path';\nimport { Compiler } from './types';\nimport { CompilerAspect } from './compiler.aspect';\n\nexport type CompilerTaskOptions = {\n /**\n * instance of compiler to use.\n */\n compiler: EnvHandler<Compiler>;\n\n /**\n * name of compiler task\n */\n name?: string;\n};\n\n/**\n * compiler build task. Allows to compile components during component build.\n */\nexport class CompilerTask implements BuildTask {\n readonly description = 'compile components';\n constructor(\n readonly aspectId: string,\n readonly name: string,\n private compilerInstance: Compiler,\n private dependencyResolver: DependencyResolverMain\n ) {\n if (compilerInstance.artifactName) {\n this.description += ` for artifact ${compilerInstance.artifactName}`;\n }\n }\n\n async preBuild(context: BuildContext) {\n await Promise.all(\n context.capsuleNetwork.seedersCapsules.map((capsule) =>\n this.copyNonSupportedFiles(capsule, this.compilerInstance)\n )\n );\n if (!this.compilerInstance.preBuild) return;\n await this.compilerInstance.preBuild(context);\n }\n\n async execute(context: BuildContext): Promise<BuiltTaskResult> {\n const buildResults = await this.compilerInstance.build(context);\n await this._hardLinkBuildArtifactsOnCapsules(context);\n return buildResults;\n }\n\n /**\n * This function hard links the compiled artifacts to the `node_modules` of other component capsules.\n * For instance, if we have a `button` component that is a dependency of the `card` component,\n * then the `dist` folder of the `button` component will be copied to `<card_capsule>/node_modules/button/dist`.\n */\n private async _hardLinkBuildArtifactsOnCapsules(context: BuildContext): Promise<void> {\n await Promise.all(\n context.capsuleNetwork.seedersCapsules.map(async (capsule) => {\n const relCompDir = path.relative(context.capsuleNetwork.capsulesRootDir, capsule.path).replace(/\\\\/g, '/');\n const injectedDirs = await this.dependencyResolver.getInjectedDirs(\n context.capsuleNetwork.capsulesRootDir,\n relCompDir,\n this.dependencyResolver.getPackageName(capsule.component)\n );\n return hardLinkDirectory(\n capsule.path,\n injectedDirs.map((injectedDir) => path.join(context.capsuleNetwork.capsulesRootDir, injectedDir))\n );\n })\n );\n }\n\n async postBuild?(context: BuildContext, tasksResults: TaskResultsList): Promise<void> {\n if (!this.compilerInstance.postBuild) return;\n await this.compilerInstance.postBuild(context, tasksResults);\n }\n\n async copyNonSupportedFiles(capsule: Capsule, compiler: Compiler) {\n if (!compiler.shouldCopyNonSupportedFiles) {\n return;\n }\n const component = capsule.component;\n await Promise.all(\n component.filesystem.files.map(async (file) => {\n if (compiler.isFileSupported(file.path)) return;\n const content = file.contents;\n await fs.outputFile(path.join(capsule.path, compiler.distDir, file.relative), content);\n })\n );\n }\n\n static from(options: CompilerTaskOptions) {\n return (context: EnvContext) => {\n const aspectId = CompilerAspect.id;\n const name = options.name || 'compiler-task';\n const depResolve = context.getAspect<any>('teambit.dependencies/dependency-resolver');\n return new CompilerTask(aspectId, name, options.compiler(context), depResolve);\n };\n }\n}\n"],"mappings":";;;;;;AAEA,SAAAA,WAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,UAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAGA,SAAAE,SAAA;EAAA,MAAAF,IAAA,GAAAG,sBAAA,CAAAF,OAAA;EAAAC,QAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAI,MAAA;EAAA,MAAAJ,IAAA,GAAAG,sBAAA,CAAAF,OAAA;EAAAG,KAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,I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AAO,IAAInD,YAAY,CAACE,QAAQ,EAAEC,IAAI,EAAE4C,OAAO,CAACZ,QAAQ,CAAC1B,OAAO,CAAC,EAAEyC,UAAU,CAAC;IAChF,CAAC;EACH;AACF;AAACE,OAAA,CAAApD,YAAA,GAAAA,YAAA","ignoreList":[]}
|
|
@@ -11,7 +11,7 @@ function _pubsub() {
|
|
|
11
11
|
};
|
|
12
12
|
return data;
|
|
13
13
|
}
|
|
14
|
-
function _defineProperty(
|
|
14
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
15
15
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
16
16
|
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } /* eslint-disable max-classes-per-file */
|
|
17
17
|
class CompilerErrorEventData {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_pubsub","data","require","_defineProperty","
|
|
1
|
+
{"version":3,"names":["_pubsub","data","require","_defineProperty","e","r","t","_toPropertyKey","Object","defineProperty","value","enumerable","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","CompilerErrorEventData","constructor","error","CompilerErrorEvent","BitBaseEvent","timestamp","Date","now","TYPE","exports"],"sources":["compiler-error.ts"],"sourcesContent":["/* eslint-disable max-classes-per-file */\nimport { BitBaseEvent } from '@teambit/pubsub';\n\nclass CompilerErrorEventData {\n constructor(readonly error: any) {}\n}\n\nexport class CompilerErrorEvent extends BitBaseEvent<CompilerErrorEventData> {\n static readonly TYPE = 'compiler-error';\n\n constructor(readonly error, readonly timestamp = Date.now()) {\n super(CompilerErrorEvent.TYPE, '0.0.1',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IAAC,KADnEA,KAAK,GAALA,KAAK;IAAA,KAAWG,SAAS,GAATA,SAAS;EAE9C;AACF;AAACI,OAAA,CAAAN,kBAAA,GAAAA,kBAAA;AAAAtB,eAAA,CANYsB,kBAAkB,UACN,gBAAgB","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_bitError","data","require","DistArtifactNotFound","BitError","constructor","componentId","toString","exports"],"sources":["dist-artifact-not-found.ts"],"sourcesContent":["import { ComponentID } from '@teambit/component';\nimport { BitError } from '@teambit/bit-error';\n\nexport class DistArtifactNotFound extends BitError {\n constructor(readonly componentId: ComponentID) {\n super(`dist artifact for component ${componentId.toString()} was not found`);\n }\n}\n"],"mappings":";;;;;;AACA,SAAAA,UAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,SAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEO,MAAME,oBAAoB,SAASC,oBAAQ,CAAC;EACjDC,WAAWA,CAAUC,WAAwB,EAAE;IAC7C,KAAK,
|
|
1
|
+
{"version":3,"names":["_bitError","data","require","DistArtifactNotFound","BitError","constructor","componentId","toString","exports"],"sources":["dist-artifact-not-found.ts"],"sourcesContent":["import { ComponentID } from '@teambit/component';\nimport { BitError } from '@teambit/bit-error';\n\nexport class DistArtifactNotFound extends BitError {\n constructor(readonly componentId: ComponentID) {\n super(`dist artifact for component ${componentId.toString()} was not found`);\n }\n}\n"],"mappings":";;;;;;AACA,SAAAA,UAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,SAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEO,MAAME,oBAAoB,SAASC,oBAAQ,CAAC;EACjDC,WAAWA,CAAUC,WAAwB,EAAE;IAC7C,KAAK,CAAC,+BAA+BA,WAAW,CAACC,QAAQ,CAAC,CAAC,gBAAgB,CAAC;IAAC,KAD1DD,WAAwB,GAAxBA,WAAwB;EAE7C;AACF;AAACE,OAAA,CAAAL,oBAAA,GAAAA,oBAAA","ignoreList":[]}
|
package/dist/output-formatter.js
CHANGED
|
@@ -18,7 +18,7 @@ function _logger() {
|
|
|
18
18
|
};
|
|
19
19
|
return data;
|
|
20
20
|
}
|
|
21
|
-
function _interopRequireDefault(
|
|
21
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
22
22
|
const formatCompileResults = (compileResults, verbose) => compileResults.map(componentResult => ({
|
|
23
23
|
componentId: componentResult.component,
|
|
24
24
|
files: componentResult.buildResults,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_chalk","data","_interopRequireDefault","require","_logger","
|
|
1
|
+
{"version":3,"names":["_chalk","data","_interopRequireDefault","require","_logger","e","__esModule","default","formatCompileResults","compileResults","verbose","map","componentResult","componentId","component","files","buildResults","status","errors","length","icon","chalk","red","Logger","successSymbol","reduce","outputString","result","fileList","file","exports"],"sources":["output-formatter.ts"],"sourcesContent":["import chalk from 'chalk';\nimport { Logger } from '@teambit/logger';\nimport { BuildResult } from './workspace-compiler';\n\nexport const formatCompileResults = (compileResults: BuildResult[], verbose: boolean) =>\n compileResults\n .map((componentResult: BuildResult) => ({\n componentId: componentResult.component,\n files: componentResult.buildResults,\n status: componentResult.errors.length ? 'FAILURE' : 'SUCCESS',\n icon: componentResult.errors.length ? chalk.red('✗') : Logger.successSymbol(),\n }))\n .reduce((outputString, result) => {\n outputString += `${result.icon} ${result.status}\\t${result.componentId}`;\n if (verbose) {\n outputString += ':';\n outputString += result?.files?.reduce((fileList, file) => `${fileList}\\t\\t - ${file}\\n`, '\\n');\n }\n outputString += '\\n';\n return outputString;\n }, '');\n"],"mappings":";;;;;;AAAA,SAAAA,OAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,MAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA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|
-
import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.compilation_compiler@1.0.
|
|
1
|
+
import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.compilation_compiler@1.0.283/dist/compiler.composition.js';
|
|
2
|
+
import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.compilation_compiler@1.0.283/dist/compiler.docs.mdx';
|
|
3
3
|
|
|
4
4
|
export const compositions = [compositions_0];
|
|
5
5
|
export const overview = [overview_0];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["aspectFile","namePascalCase","componentId"],"sources":["aspect-file.ts"],"sourcesContent":["import { ComponentContext } from '@teambit/generator';\n\nexport function aspectFile({ namePascalCase, componentId }: ComponentContext) {\n return `import { Aspect } from '@teambit/harmony';\n\nexport const ${namePascalCase}Aspect = Aspect.create({\n id: '${componentId}',\n});\n `;\n}\n"],"mappings":";;;;;;AAEO,SAASA,UAAUA,CAAC;EAAEC,cAAc;EAAEC;AAA8B,CAAC,EAAE;EAC5E,
|
|
1
|
+
{"version":3,"names":["aspectFile","namePascalCase","componentId"],"sources":["aspect-file.ts"],"sourcesContent":["import { ComponentContext } from '@teambit/generator';\n\nexport function aspectFile({ namePascalCase, componentId }: ComponentContext) {\n return `import { Aspect } from '@teambit/harmony';\n\nexport const ${namePascalCase}Aspect = Aspect.create({\n id: '${componentId}',\n});\n `;\n}\n"],"mappings":";;;;;;AAEO,SAASA,UAAUA,CAAC;EAAEC,cAAc;EAAEC;AAA8B,CAAC,EAAE;EAC5E,OAAO;AACT;AACA,eAAeD,cAAc;AAC7B,SAASC,WAAW;AACpB;AACA,GAAG;AACH","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["compilerFile","namePascalCase"],"sources":["compiler-file.ts"],"sourcesContent":["import { ComponentContext } from '@teambit/generator';\n\nexport function compilerFile({ namePascalCase }: ComponentContext) {\n return `import {\n BuildContext,\n BuiltTaskResult,\n ComponentResult,\n} from '@teambit/builder';\nimport {\n Compiler,\n CompilerMain,\n TranspileFileParams,\n TranspileFileOutput,\n} from '@teambit/compiler';\n\nexport class ${namePascalCase} implements Compiler {\n\n constructor(readonly id: string, readonly distDir, private compiler: CompilerMain) {}\n\n /**\n * Detemines whether unsupported files (such as assets)\n * should be copied by Compiler aspect into the 'dist' directory\n */\n shouldCopyNonSupportedFiles = true;\n\n /* The name of the compiler being used. For example, TypeScript, Babel, etc. */\n displayName = '';\n\n /* The version of the compiler being used. For example '1.0.0' */\n version(): string {};\n\n /**\n * Use this for compilation in the workspace.\n * This will compile one file content at a time (alternatively, use 'transpileComponent') */\n transpileFile( fileContent: string, transpileFileParams: TranspileFileParams): TranspileFileOutput {}\n\n\n async build(context: BuildContext): Promise<BuiltTaskResult> {\n let componentsResults: ComponentResult[] = [];\n return {\n /* Sets the files to persist as the Component's artifacts,\n and describes them. */\n artifacts: [\n {\n generatedBy: this.id,\n name: 'compilation output',\n globPatterns: [\\`\\${this.distDir}/**\\`],\n },\n ],\n componentsResults,\n };\n }\n\n /* This is optional but recommended.\n Not using it will require consumers of your compiler to use two APIs and have two depndencies\n to their Envs - your compiler\n */\n createTask() {\n return this.compiler.createTask('${namePascalCase}', this);\n }\n\n /**\n * Given a source file, return its parallel in the dists. e.g. index.ts => dist/index.js.\n * Needed by aspects such as Pkg to determine the main prop.\n */\n getDistPathBySrcPath(srcPath: string): string {}\n\n /**\n * Returns a boolean indicating whether a file is supported by the compiler or not.\n * For example, this API is used by Compiler aspect to copy unsupported files to the dist directory.\n */\n isFileSupported(filePath: string): boolean {}\n}\n `;\n}\n"],"mappings":";;;;;;AAEO,SAASA,YAAYA,CAAC;EAAEC;AAAiC,CAAC,EAAE;EACjE,
|
|
1
|
+
{"version":3,"names":["compilerFile","namePascalCase"],"sources":["compiler-file.ts"],"sourcesContent":["import { ComponentContext } from '@teambit/generator';\n\nexport function compilerFile({ namePascalCase }: ComponentContext) {\n return `import {\n BuildContext,\n BuiltTaskResult,\n ComponentResult,\n} from '@teambit/builder';\nimport {\n Compiler,\n CompilerMain,\n TranspileFileParams,\n TranspileFileOutput,\n} from '@teambit/compiler';\n\nexport class ${namePascalCase} implements Compiler {\n\n constructor(readonly id: string, readonly distDir, private compiler: CompilerMain) {}\n\n /**\n * Detemines whether unsupported files (such as assets)\n * should be copied by Compiler aspect into the 'dist' directory\n */\n shouldCopyNonSupportedFiles = true;\n\n /* The name of the compiler being used. For example, TypeScript, Babel, etc. */\n displayName = '';\n\n /* The version of the compiler being used. For example '1.0.0' */\n version(): string {};\n\n /**\n * Use this for compilation in the workspace.\n * This will compile one file content at a time (alternatively, use 'transpileComponent') */\n transpileFile( fileContent: string, transpileFileParams: TranspileFileParams): TranspileFileOutput {}\n\n\n async build(context: BuildContext): Promise<BuiltTaskResult> {\n let componentsResults: ComponentResult[] = [];\n return {\n /* Sets the files to persist as the Component's artifacts,\n and describes them. */\n artifacts: [\n {\n generatedBy: this.id,\n name: 'compilation output',\n globPatterns: [\\`\\${this.distDir}/**\\`],\n },\n ],\n componentsResults,\n };\n }\n\n /* This is optional but recommended.\n Not using it will require consumers of your compiler to use two APIs and have two depndencies\n to their Envs - your compiler\n */\n createTask() {\n return this.compiler.createTask('${namePascalCase}', this);\n }\n\n /**\n * Given a source file, return its parallel in the dists. e.g. index.ts => dist/index.js.\n * Needed by aspects such as Pkg to determine the main prop.\n */\n getDistPathBySrcPath(srcPath: string): string {}\n\n /**\n * Returns a boolean indicating whether a file is supported by the compiler or not.\n * For example, this API is used by Compiler aspect to copy unsupported files to the dist directory.\n */\n isFileSupported(filePath: string): boolean {}\n}\n `;\n}\n"],"mappings":";;;;;;AAEO,SAASA,YAAYA,CAAC;EAAEC;AAAiC,CAAC,EAAE;EACjE,OAAO;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAeA,cAAc;AAC7B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2CAA2CA,cAAc;AACzD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["indexFile","namePascalCase","name"],"sources":["index-file.ts"],"sourcesContent":["import { ComponentContext } from '@teambit/generator';\n\nexport function indexFile({ namePascalCase, name }: ComponentContext) {\n return `import { ${namePascalCase}Aspect } from './${name}.aspect';\n\nexport type { ${namePascalCase}Main } from './${name}.main.runtime';\nexport default ${namePascalCase}Aspect;\nexport { ${namePascalCase}Aspect };\n`;\n}\n"],"mappings":";;;;;;AAEO,SAASA,SAASA,CAAC;EAAEC,cAAc;EAAEC;AAAuB,CAAC,EAAE;EACpE,
|
|
1
|
+
{"version":3,"names":["indexFile","namePascalCase","name"],"sources":["index-file.ts"],"sourcesContent":["import { ComponentContext } from '@teambit/generator';\n\nexport function indexFile({ namePascalCase, name }: ComponentContext) {\n return `import { ${namePascalCase}Aspect } from './${name}.aspect';\n\nexport type { ${namePascalCase}Main } from './${name}.main.runtime';\nexport default ${namePascalCase}Aspect;\nexport { ${namePascalCase}Aspect };\n`;\n}\n"],"mappings":";;;;;;AAEO,SAASA,SAASA,CAAC;EAAEC,cAAc;EAAEC;AAAuB,CAAC,EAAE;EACpE,OAAO,YAAYD,cAAc,oBAAoBC,IAAI;AAC3D;AACA,gBAAgBD,cAAc,kBAAkBC,IAAI;AACpD,iBAAiBD,cAAc;AAC/B,WAAWA,cAAc;AACzB,CAAC;AACD","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["mainRuntimeFile","name","namePascalCase"],"sources":["main-runtime-file.ts"],"sourcesContent":["import { ComponentContext } from '@teambit/generator';\n\nexport function mainRuntimeFile({ name, namePascalCase }: ComponentContext) {\n return `import { MainRuntime } from '@teambit/cli';\nimport { CompilerAspect, CompilerMain } from '@teambit/compiler';\nimport { ${namePascalCase} } from './${name}.compiler';\nimport { ${namePascalCase}Aspect } from './${name}.aspect';\n\nexport class ${namePascalCase}Main {\n constructor(private compiler: CompilerMain) {}\n\n static slots = [];\n static dependencies = [CompilerAspect];\n static runtime = MainRuntime;\n\n distDir = 'dist';\n\n /* Set the main property of the component's package with\n the relative output path for the main file */\n getPackageJsonProps() {\n return {\n main: '\\${this.distDir}/{main}.js',\n };\n }\n\n createCompiler(): ${namePascalCase} {\n return new ${namePascalCase}(${namePascalCase}Aspect.id, this.distDir, this.compiler);\n }\n\n static async provider([compiler]: [CompilerMain]) {\n return new ${namePascalCase}Main(compiler);\n }\n}\n\n${namePascalCase}Aspect.addRuntime(${namePascalCase}Main);\n`;\n}\n"],"mappings":";;;;;;AAEO,SAASA,eAAeA,CAAC;EAAEC,IAAI;EAAEC;AAAiC,CAAC,EAAE;EAC1E,
|
|
1
|
+
{"version":3,"names":["mainRuntimeFile","name","namePascalCase"],"sources":["main-runtime-file.ts"],"sourcesContent":["import { ComponentContext } from '@teambit/generator';\n\nexport function mainRuntimeFile({ name, namePascalCase }: ComponentContext) {\n return `import { MainRuntime } from '@teambit/cli';\nimport { CompilerAspect, CompilerMain } from '@teambit/compiler';\nimport { ${namePascalCase} } from './${name}.compiler';\nimport { ${namePascalCase}Aspect } from './${name}.aspect';\n\nexport class ${namePascalCase}Main {\n constructor(private compiler: CompilerMain) {}\n\n static slots = [];\n static dependencies = [CompilerAspect];\n static runtime = MainRuntime;\n\n distDir = 'dist';\n\n /* Set the main property of the component's package with\n the relative output path for the main file */\n getPackageJsonProps() {\n return {\n main: '\\${this.distDir}/{main}.js',\n };\n }\n\n createCompiler(): ${namePascalCase} {\n return new ${namePascalCase}(${namePascalCase}Aspect.id, this.distDir, this.compiler);\n }\n\n static async provider([compiler]: [CompilerMain]) {\n return new ${namePascalCase}Main(compiler);\n }\n}\n\n${namePascalCase}Aspect.addRuntime(${namePascalCase}Main);\n`;\n}\n"],"mappings":";;;;;;AAEO,SAASA,eAAeA,CAAC;EAAEC,IAAI;EAAEC;AAAiC,CAAC,EAAE;EAC1E,OAAO;AACT;AACA,WAAWA,cAAc,cAAcD,IAAI;AAC3C,WAAWC,cAAc,oBAAoBD,IAAI;AACjD;AACA,eAAeC,cAAc;AAC7B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sBAAsBA,cAAc;AACpC,iBAAiBA,cAAc,IAAIA,cAAc;AACjD;AACA;AACA;AACA,iBAAiBA,cAAc;AAC/B;AACA;AACA;AACA,EAAEA,cAAc,qBAAqBA,cAAc;AACnD,CAAC;AACD","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_indexFile","data","require","_aspectFile","_mainRuntimeFile","_compilerFile","compilerTemplate","exports","name","description","hidden","generateFiles","context","relativePath","content","indexFile","isMain","aspectFile","compilerFile","mainRuntimeFile"],"sources":["index.ts"],"sourcesContent":["import { ComponentContext, ComponentTemplate } from '@teambit/generator';\nimport { indexFile } from './files/index-file';\nimport { aspectFile } from './files/aspect-file';\nimport { mainRuntimeFile } from './files/main-runtime-file';\nimport { compilerFile } from './files/compiler-file';\n\nexport const compilerTemplate: ComponentTemplate = {\n name: 'compiler',\n description: 'A compiler implementation',\n hidden: true,\n generateFiles: (context: ComponentContext) => {\n return [\n {\n relativePath: 'index.ts',\n content: indexFile(context),\n isMain: true,\n },\n {\n relativePath: `${context.name}.aspect.ts`,\n content: aspectFile(context),\n },\n {\n relativePath: `${context.name}.compiler.ts`,\n content: compilerFile(context),\n },\n {\n relativePath: `${context.name}.main.runtime.ts`,\n content: mainRuntimeFile(context),\n },\n ];\n },\n};\n"],"mappings":";;;;;;AACA,SAAAA,WAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,UAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAE,YAAA;EAAA,MAAAF,IAAA,GAAAC,OAAA;EAAAC,WAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,iBAAA;EAAA,MAAAH,IAAA,GAAAC,OAAA;EAAAE,gBAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAI,cAAA;EAAA,MAAAJ,IAAA,GAAAC,OAAA;EAAAG,aAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEO,MAAMK,gBAAmC,GAAAC,OAAA,CAAAD,gBAAA,GAAG;EACjDE,IAAI,EAAE,UAAU;EAChBC,WAAW,EAAE,2BAA2B;EACxCC,MAAM,EAAE,IAAI;EACZC,aAAa,EAAGC,OAAyB,IAAK;IAC5C,OAAO,CACL;MACEC,YAAY,EAAE,UAAU;MACxBC,OAAO,EAAE,IAAAC,sBAAS,EAACH,OAAO,CAAC;MAC3BI,MAAM,EAAE;IACV,CAAC,EACD;MACEH,YAAY,
|
|
1
|
+
{"version":3,"names":["_indexFile","data","require","_aspectFile","_mainRuntimeFile","_compilerFile","compilerTemplate","exports","name","description","hidden","generateFiles","context","relativePath","content","indexFile","isMain","aspectFile","compilerFile","mainRuntimeFile"],"sources":["index.ts"],"sourcesContent":["import { ComponentContext, ComponentTemplate } from '@teambit/generator';\nimport { indexFile } from './files/index-file';\nimport { aspectFile } from './files/aspect-file';\nimport { mainRuntimeFile } from './files/main-runtime-file';\nimport { compilerFile } from './files/compiler-file';\n\nexport const compilerTemplate: ComponentTemplate = {\n name: 'compiler',\n description: 'A compiler implementation',\n hidden: true,\n generateFiles: (context: ComponentContext) => {\n return [\n {\n relativePath: 'index.ts',\n content: indexFile(context),\n isMain: true,\n },\n {\n relativePath: `${context.name}.aspect.ts`,\n content: aspectFile(context),\n },\n {\n relativePath: `${context.name}.compiler.ts`,\n content: compilerFile(context),\n },\n {\n relativePath: `${context.name}.main.runtime.ts`,\n content: mainRuntimeFile(context),\n },\n ];\n },\n};\n"],"mappings":";;;;;;AACA,SAAAA,WAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,UAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAE,YAAA;EAAA,MAAAF,IAAA,GAAAC,OAAA;EAAAC,WAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,iBAAA;EAAA,MAAAH,IAAA,GAAAC,OAAA;EAAAE,gBAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAI,cAAA;EAAA,MAAAJ,IAAA,GAAAC,OAAA;EAAAG,aAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEO,MAAMK,gBAAmC,GAAAC,OAAA,CAAAD,gBAAA,GAAG;EACjDE,IAAI,EAAE,UAAU;EAChBC,WAAW,EAAE,2BAA2B;EACxCC,MAAM,EAAE,IAAI;EACZC,aAAa,EAAGC,OAAyB,IAAK;IAC5C,OAAO,CACL;MACEC,YAAY,EAAE,UAAU;MACxBC,OAAO,EAAE,IAAAC,sBAAS,EAACH,OAAO,CAAC;MAC3BI,MAAM,EAAE;IACV,CAAC,EACD;MACEH,YAAY,EAAE,GAAGD,OAAO,CAACJ,IAAI,YAAY;MACzCM,OAAO,EAAE,IAAAG,wBAAU,EAACL,OAAO;IAC7B,CAAC,EACD;MACEC,YAAY,EAAE,GAAGD,OAAO,CAACJ,IAAI,cAAc;MAC3CM,OAAO,EAAE,IAAAI,4BAAY,EAACN,OAAO;IAC/B,CAAC,EACD;MACEC,YAAY,EAAE,GAAGD,OAAO,CAACJ,IAAI,kBAAkB;MAC/CM,OAAO,EAAE,IAAAK,kCAAe,EAACP,OAAO;IAClC,CAAC,CACF;EACH;AACF,CAAC","ignoreList":[]}
|
|
@@ -123,7 +123,7 @@ function _types() {
|
|
|
123
123
|
};
|
|
124
124
|
return data;
|
|
125
125
|
}
|
|
126
|
-
function _interopRequireDefault(
|
|
126
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
127
127
|
/* eslint-disable max-classes-per-file */
|
|
128
128
|
|
|
129
129
|
class ComponentCompiler {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_pMapSeries","data","_interopRequireDefault","require","_workspace","_path","_chalk","_logger","_loader","_constants","_sources","_dataToPersist","_workspaceModules","_componentIdToPackageName","_removePath","_bitRoots","_lodash","_compiler","_events","_types","obj","__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","linkComponents","linkToNodeModulesByComponents","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","readBitRootsDir","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","code","AspectLoadFail","watchOpts","undefined","removedFiles","Boolean","removeLinksFromNodeModules","ComponentChanged","results","formatCompileResults","componentIds","preCompile","start","Date","now","PreWatch","end","consoleSuccess","componentsIds","OutsideWorkspaceError","getIdsToCompile","getManyOpts","loadSeedersAsAspects","components","getMany","grouped","groupByIsEnv","envsResults","runCompileComponents","otherResults","other","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 { 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 } from '@teambit/legacy/dist/consumer/component/sources';\nimport DataToPersist from '@teambit/legacy/dist/consumer/component/sources/data-to-persist';\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 componentIdToPackageName from '@teambit/legacy/dist/utils/bit/component-id-to-package-name';\nimport RemovePath from '@teambit/legacy/dist/consumer/component/sources/remove-path';\nimport { UiMain } from '@teambit/ui';\nimport { readBitRootsDir } from '@teambit/bit-roots';\nimport { groupBy, uniq } from 'lodash';\nimport type { PreStartOpts } from '@teambit/ui';\nimport { PathOsBasedAbsolute, PathOsBasedRelative } from '@teambit/legacy/dist/utils/path';\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 linkComponents = options.linkComponents ?? true;\n if (linkComponents) {\n await linkToNodeModulesByComponents([this.component], this.workspace);\n }\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 readBitRootsDir(this.workspace.path);\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 }, id: ComponentID): Promise<boolean> {\n if (err.code && err.code === 'MODULE_NOT_FOUND' && this.workspace) {\n await this.compileComponents([id.toString()], { initiator: CompilationInitiator.AspectLoadFail }, true);\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 ): 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 const getManyOpts =\n options.initiator === CompilationInitiator.AspectLoadFail ? { loadSeedersAsAspects: false } : undefined;\n const components = await this.workspace.getMany(componentIds, getManyOpts);\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 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 `${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,GA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EAAC;EAC3D,MAAMC,kCAAkC,GAAGA,CAAA,KAAM;IAC/C,OAAOJ,WAAW,CAAClI,YAAY,CAACX,GAAG,CAAE8C,QAAQ,IAAM,SAAQA,QAAS,EAAC,CAAC,CAACpB,IAAI,CAAC,IAAI,CAAC;EACnF,CAAC;EAED,OAAQ,GAAEoH,KAAM;AAClB,IAAII,gBAAM,CAACC,aAAa,CAAC,CAAE,YAAWN,WAAW,CAAC5K,SAAU;AAC5D,IAAIkH,OAAO,GAAI,GAAE8D,kCAAkC,CAAC,CAAE,IAAG,GAAG,EAAG,EAAC;AAChE","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_pMapSeries","data","_interopRequireDefault","require","_workspace","_path","_chalk","_logger","_loader","_constants","_sources","_dataToPersist","_workspaceModules","_componentIdToPackageName","_removePath","_bitRoots","_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","linkComponents","linkToNodeModulesByComponents","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","readBitRootsDir","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","code","AspectLoadFail","watchOpts","undefined","removedFiles","Boolean","removeLinksFromNodeModules","ComponentChanged","results","formatCompileResults","componentIds","preCompile","start","Date","now","PreWatch","end","consoleSuccess","componentsIds","OutsideWorkspaceError","getIdsToCompile","getManyOpts","loadSeedersAsAspects","components","getMany","grouped","groupByIsEnv","envsResults","runCompileComponents","otherResults","other","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 { 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 } from '@teambit/legacy/dist/consumer/component/sources';\nimport DataToPersist from '@teambit/legacy/dist/consumer/component/sources/data-to-persist';\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 componentIdToPackageName from '@teambit/legacy/dist/utils/bit/component-id-to-package-name';\nimport RemovePath from '@teambit/legacy/dist/consumer/component/sources/remove-path';\nimport { UiMain } from '@teambit/ui';\nimport { readBitRootsDir } from '@teambit/bit-roots';\nimport { groupBy, uniq } from 'lodash';\nimport type { PreStartOpts } from '@teambit/ui';\nimport { PathOsBasedAbsolute, PathOsBasedRelative } from '@teambit/legacy/dist/utils/path';\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 linkComponents = options.linkComponents ?? true;\n if (linkComponents) {\n await linkToNodeModulesByComponents([this.component], this.workspace);\n }\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 readBitRootsDir(this.workspace.path);\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 }, id: ComponentID): Promise<boolean> {\n if (err.code && err.code === 'MODULE_NOT_FOUND' && this.workspace) {\n await this.compileComponents([id.toString()], { initiator: CompilationInitiator.AspectLoadFail }, true);\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 ): 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 const getManyOpts =\n options.initiator === CompilationInitiator.AspectLoadFail ? { loadSeedersAsAspects: false } : undefined;\n const components = await this.workspace.getMany(componentIds, getManyOpts);\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 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 `${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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AGA,CAAA,KAAM;IAC/C,OAAOJ,WAAW,CAAClI,YAAY,CAACX,GAAG,CAAE8C,QAAQ,IAAK,SAASA,QAAQ,EAAE,CAAC,CAACpB,IAAI,CAAC,IAAI,CAAC;EACnF,CAAC;EAED,OAAO,GAAGoH,KAAK;AACjB,IAAII,gBAAM,CAACC,aAAa,CAAC,CAAC,YAAYN,WAAW,CAAC5K,SAAS;AAC3D,IAAIkH,OAAO,GAAG,GAAG8D,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.
|
|
3
|
+
"version": "1.0.283",
|
|
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.
|
|
9
|
+
"version": "1.0.283"
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"chalk": "2.4.2",
|
|
@@ -19,23 +19,23 @@
|
|
|
19
19
|
"@teambit/component-id": "1.2.0",
|
|
20
20
|
"@teambit/bit-roots": "0.0.133",
|
|
21
21
|
"@teambit/bit-error": "0.0.404",
|
|
22
|
-
"@teambit/envs": "1.0.
|
|
22
|
+
"@teambit/envs": "1.0.283",
|
|
23
23
|
"@teambit/cli": "0.0.865",
|
|
24
24
|
"@teambit/logger": "0.0.958",
|
|
25
|
-
"@teambit/pubsub": "1.0.
|
|
26
|
-
"@teambit/aspect-loader": "1.0.
|
|
27
|
-
"@teambit/builder": "1.0.
|
|
25
|
+
"@teambit/pubsub": "1.0.283",
|
|
26
|
+
"@teambit/aspect-loader": "1.0.283",
|
|
27
|
+
"@teambit/builder": "1.0.283",
|
|
28
28
|
"@teambit/component-issues": "0.0.149",
|
|
29
|
-
"@teambit/component": "1.0.
|
|
30
|
-
"@teambit/dependency-resolver": "1.0.
|
|
31
|
-
"@teambit/generator": "1.0.
|
|
32
|
-
"@teambit/issues": "1.0.
|
|
33
|
-
"@teambit/ui": "1.0.
|
|
34
|
-
"@teambit/watcher": "1.0.
|
|
35
|
-
"@teambit/workspace": "1.0.
|
|
36
|
-
"@teambit/isolator": "1.0.
|
|
29
|
+
"@teambit/component": "1.0.283",
|
|
30
|
+
"@teambit/dependency-resolver": "1.0.283",
|
|
31
|
+
"@teambit/generator": "1.0.284",
|
|
32
|
+
"@teambit/issues": "1.0.283",
|
|
33
|
+
"@teambit/ui": "1.0.283",
|
|
34
|
+
"@teambit/watcher": "1.0.283",
|
|
35
|
+
"@teambit/workspace": "1.0.283",
|
|
36
|
+
"@teambit/isolator": "1.0.283",
|
|
37
37
|
"@teambit/toolbox.fs.hard-link-directory": "0.0.21",
|
|
38
|
-
"@teambit/multi-compiler": "1.0.
|
|
38
|
+
"@teambit/multi-compiler": "1.0.283",
|
|
39
39
|
"@teambit/workspace.modules.node-modules-linker": "0.0.173"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|