@teambit/workspace 1.0.124 → 1.0.125

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.
@@ -51,5 +51,5 @@
51
51
  transform-origin: center center;
52
52
  }
53
53
 
54
- .image_fullWidth__h\+0Zo{width:100%}
55
- .image_center__0U4ZR{margin-left:auto;margin-right:auto}
54
+ .image_fullWidth__5D9Bi{width:100%}
55
+ .image_center__O0WvC{margin-left:auto;margin-right:auto}
@@ -1,2 +1,2 @@
1
1
  /*! For license information please see teambit_workspace_workspace-preview.js.LICENSE.txt */
2
- !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports["teambit.workspace/workspace-preview"]=t():e["teambit.workspace/workspace-preview"]=t()}(self,(()=>(()=>{var e={5576:(e,t)=>{var n;!function(){"use strict";var o={}.hasOwnProperty;function r(){for(var e=[],t=0;t<arguments.length;t++){var n=arguments[t];if(n){var a=typeof n;if("string"===a||"number"===a)e.push(n);else if(Array.isArray(n)&&n.length){var i=r.apply(null,n);i&&e.push(i)}else if("object"===a)for(var s in n)o.call(n,s)&&n[s]&&e.push(s)}}return e.join(" ")}e.exports?(r.default=r,e.exports=r):void 0===(n=function(){return r}.apply(t,[]))||(e.exports=n)}()},61844:()=>{!function(){if("undefined"!=typeof window&&"undefined"!=typeof document&&"undefined"!=typeof HTMLElement){var e=!1;try{var t=document.createElement("div");t.addEventListener("focus",(function(e){e.preventDefault(),e.stopPropagation()}),!0),t.focus(Object.defineProperty({},"preventScroll",{get:function(){e=!0}}))}catch(e){}void 0!==HTMLElement.prototype.nativeFocus||e||(HTMLElement.prototype.nativeFocus=HTMLElement.prototype.focus,HTMLElement.prototype.focus=function(e){var t=window.scrollY||window.pageYOffset;this.nativeFocus(),e&&e.preventScroll&&setTimeout((function(){window.scroll(window.scrollX||window.pageXOffset,t)}),0)})}}()},23826:(e,t)=>{var n;!function(){"use strict";var o={}.hasOwnProperty;function r(){for(var e=[],t=0;t<arguments.length;t++){var n=arguments[t];if(n){var a=typeof n;if("string"===a||"number"===a)e.push(n);else if(Array.isArray(n)){if(n.length){var i=r.apply(null,n);i&&e.push(i)}}else if("object"===a)if(n.toString===Object.prototype.toString)for(var s in n)o.call(n,s)&&n[s]&&e.push(s);else e.push(n.toString())}}return e.join(" ")}e.exports?(r.default=r,e.exports=r):void 0===(n=function(){return r}.apply(t,[]))||(e.exports=n)}()},42209:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isNavigator=t.isBrowser=t.off=t.on=t.noop=void 0,t.noop=function(){},t.on=function(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];e&&e.addEventListener&&e.addEventListener.apply(e,t)},t.off=function(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];e&&e.removeEventListener&&e.removeEventListener.apply(e,t)},t.isBrowser="undefined"!=typeof window,t.isNavigator="undefined"!=typeof navigator},82816:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=n(87363);t.default=function(e){o.useEffect(e,[])}},79919:(e,t,n)=>{"use strict";var o=n(87363),r=n(42209),a=r.isBrowser?window:null,i=function(e){return!!e.addEventListener},s=function(e){return!!e.on};t.Z=function(e,t,n,c){void 0===n&&(n=a),o.useEffect((function(){if(t&&n)return i(n)?r.on(n,e,t,c):s(n)&&n.on(e,t,c),function(){i(n)?r.off(n,e,t,c):s(n)&&n.off(e,t,c)}}),[e,t,n,JSON.stringify(c)])}},83172:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=n(78655),r=n(87363),a=o.__importDefault(n(24373));t.default=function(e){var t=r.useRef(0),n=r.useState(e),o=n[0],i=n[1],s=r.useCallback((function(e){cancelAnimationFrame(t.current),t.current=requestAnimationFrame((function(){i(e)}))}),[]);return a.default((function(){cancelAnimationFrame(t.current)})),[o,s]}},24373:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=n(78655),r=n(87363),a=o.__importDefault(n(82816));t.default=function(e){var t=r.useRef(e);t.current=e,a.default((function(){return function(){return t.current()}}))}},73498:(e,t,n)=>{"use strict";var o=n(78655),r=n(87363),a=o.__importDefault(n(83172)),i=n(42209);t.Z=function(e,t){void 0===e&&(e=1/0),void 0===t&&(t=1/0);var n=a.default({width:i.isBrowser?window.innerWidth:e,height:i.isBrowser?window.innerHeight:t}),o=n[0],s=n[1];return r.useEffect((function(){if(i.isBrowser){var e=function(){s({width:window.innerWidth,height:window.innerHeight})};return i.on(window,"resize",e),function(){i.off(window,"resize",e)}}}),[]),o}},93566:(e,t,n)=>{"use strict";var o={id:"teambit.workspace/workspace@1.0.124",homepage:"https://bit.cloud/teambit/workspace/workspace",exported:!0};function r(){const e=a(n(87363));return r=function(){return e},e}function a(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0}),t.Logo=void 0,r.__bit_component=o,a.__bit_component=o;const i=()=>r().default.createElement("div",{style:{height:"100%",display:"flex",justifyContent:"center"}},r().default.createElement("img",{style:{width:70},src:"https://static.bit.dev/extensions-icons/workspace.svg"}));i.__bit_component=o,t.Logo=i},40979:function(e,t,n){"use strict";var o=this&&this.__rest||function(e,t){var n={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(n[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(o=Object.getOwnPropertySymbols(e);r<o.length;r++)t.indexOf(o[r])<0&&Object.prototype.propertyIsEnumerable.call(e,o[r])&&(n[o[r]]=e[o[r]])}return n},r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.BaseImage=void 0;const a=r(n(87363)),i=r(n(5576)),s=r(n(78846));function c(e){var{alt:t,className:n,fullWidth:r}=e,c=o(e,["alt","className","fullWidth"]);return a.default.createElement("img",Object.assign({"data-bit-id":"teambit.base-ui/elements/image",alt:t},c,{className:i.default(s.default.image,r&&s.default.fullWidth,n)}))}c.__bit_component={id:"teambit.base-ui/elements/image@1.0.0",homepage:"https://bit.dev/teambit/base-ui/elements/image",exported:!0},t.BaseImage=c},91618:function(e,t,n){"use strict";var o=this&&this.__createBinding||(Object.create?function(e,t,n,o){void 0===o&&(o=n),Object.defineProperty(e,o,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,o){void 0===o&&(o=n),e[o]=t[n]}),r=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||o(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),r(n(40979),t)},87845:(e,t,n)=>{"use strict";n.r(t),n.d(t,{Image:()=>y});var o=n(87363),r=n.n(o),a=n(23826),i=n.n(a);n(61844);const s=ReactDom;var c=n(79919),l=n(73498),p=n(78655),u=function(e){return e+"ms"},d={getBoundingClientRect:function(){return{height:0,left:0,top:0,width:0}},style:{transform:null}},m=(0,o.memo)((function(e){var t=e.children,n=e.closeText,a=void 0===n?"Unzoom Image":n,i=e.onUnload,m=e.onLoad,f=e.overlayBgColorEnd,h=void 0===f?"rgba(255, 255, 255, 0.95)":f,y=e.overlayBgColorStart,v=void 0===y?"rgba(255, 255, 255, 0)":y,g=e.parentRef,w=e.portalEl,b=void 0===w?document.body:w,x=e.scrollableEl,_=void 0===x?window:x,O=e.transitionDuration,k=void 0===O?300:O,j=e.zoomMargin,N=void 0===j?0:j,S=e.zoomZindex,E=void 0===S?2147483647:S,P=(0,o.useRef)(null),C=(0,o.useState)(0)[1],T=(0,o.useState)(!1),M=T[0],D=T[1],I=(0,o.useState)(!1),z=I[0],B=I[1],R=(0,l.Z)(),A=R.width,L=R.height,W=(0,o.useCallback)((function(e){e.preventDefault(),B(!0)}),[]),F=(0,o.useCallback)((function(e){"Escape"!==e.key&&27!==e.keyCode||(e.stopPropagation(),B(!0))}),[]),Z=(0,o.useCallback)((function(){C((function(e){return e+1})),z||B(!0)}),[z]);(0,c.Z)("keydown",F,document),(0,c.Z)("scroll",Z,_),(0,o.useEffect)((function(){D(!0),m(),P.current&&P.current.focus({preventScroll:!0})}),[m]),(0,o.useEffect)((function(){var e=z?setTimeout(i,k):null;return function(){e&&clearTimeout(e)}}),[z,i,k]);var H=g.current||d,U=H.getBoundingClientRect(),X=U.height,Y=U.left,G=U.top,q=U.width,V=function(e){var t=e.isLoaded,n=e.isUnloading,o=e.overlayBgColorEnd,r=e.zoomZindex,a={backgroundColor:e.overlayBgColorStart,transitionDuration:u(e.transitionDuration),zIndex:r};return t&&!n&&(a.backgroundColor=o),a}({isLoaded:M,isUnloading:z,overlayBgColorEnd:h,overlayBgColorStart:v,transitionDuration:k,zoomZindex:E}),$=function(e){var t=e.height,n=e.innerHeight,o=e.innerWidth,r=e.isLoaded,a=e.isUnloading,i=e.left,s=e.originalTransform,c=e.top,l=e.transitionDuration,d=e.width,m=e.zoomMargin,f=u(l);if(!r||a){var h=(0,p.__spreadArrays)(["scale(1)","translate(0, 0)"],s?[s]:[]).join(" ");return{height:t,left:i,top:c,transform:h,WebkitTransform:h,transitionDuration:f,width:d}}var y=function(e){var t=e.zoomMargin,n=e.innerWidth/(e.width+t),o=e.innerHeight/(e.height+t);return Math.min(n,o)}({height:t,innerWidth:o,innerHeight:n,width:d,zoomMargin:m}),v=(o/2-(i+d/2))/y,g=(n/2-(c+t/2))/y,w=(0,p.__spreadArrays)(["scale("+y+")","translate("+v+"px, "+g+"px)"],s?[s]:[]).join(" ");return{height:t,left:i,top:c,transform:w,WebkitTransform:w,transitionDuration:f,width:d}}({height:X,isLoaded:M,innerHeight:L,innerWidth:A,isUnloading:z,left:Y,originalTransform:H.style.transform,top:G,transitionDuration:k,width:q,zoomMargin:N});return(0,s.createPortal)(r().createElement("div",{"aria-modal":!0,"data-rmiz-overlay":!0,role:"dialog",style:V},r().createElement("div",{"data-rmiz-modal-content":!0,style:$},t),r().createElement("button",{"aria-label":a,"data-rmiz-btn-close":!0,onClick:W,ref:P})),b)}));const f=(0,o.memo)((function(e){var t=e.children,n=e.closeText,a=void 0===n?"Unzoom image":n,i=e.overlayBgColorEnd,s=void 0===i?"rgba(255, 255, 255, 0.95)":i,c=e.overlayBgColorStart,l=void 0===c?"rgba(255, 255, 255, 0)":c,p=e.portalEl,u=e.openText,d=void 0===u?"Zoom image":u,f=e.scrollableEl,h=e.transitionDuration,y=void 0===h?300:h,v=e.wrapElement,g=void 0===v?"div":v,w=e.wrapStyle,b=e.zoomMargin,x=void 0===b?0:b,_=e.zoomZindex,O=void 0===_?2147483647:_,k=(0,o.useState)(!1),j=k[0],N=k[1],S=(0,o.useState)(!1),E=S[0],P=S[1],C=(0,o.useRef)(null),T=(0,o.useRef)(null),M=(0,o.useCallback)((function(e){j||(e.preventDefault(),N(!0))}),[j]),D=(0,o.useCallback)((function(){P(!0)}),[]),I=(0,o.useCallback)((function(){N(!1),P(!1),T.current&&T.current.focus({preventScroll:!0})}),[]),z=j&&E?"hidden":"visible";return r().createElement(o.StrictMode,null,r().createElement(g,{"data-rmiz-wrap":z,ref:C,style:w},t,r().createElement("button",{"aria-label":d,"data-rmiz-btn-open":!0,onClick:M,ref:T}),"undefined"!=typeof window&&j&&r().createElement(m,{closeText:a,onLoad:D,onUnload:I,overlayBgColorEnd:s,overlayBgColorStart:l,parentRef:C,portalEl:p,scrollableEl:f,transitionDuration:y,zoomMargin:x,zoomZindex:O},t)))}));var h=n(91618);const y=e=>{var{center:t=!0,width:n,alt:o,src:a,className:s}=e,c=function(e,t){var n={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(n[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(o=Object.getOwnPropertySymbols(e);r<o.length;r++)t.indexOf(o[r])<0&&Object.prototype.propertyIsEnumerable.call(e,o[r])&&(n[o[r]]=e[o[r]])}return n}(e,["center","width","alt","src","className"]);return r().createElement("div",{style:{width:n||"100%"},className:i()(t&&"image_center__0U4ZR",s)},r().createElement(f,null,r().createElement(h.BaseImage,Object.assign({fullWidth:!0,alt:o,src:a},c))))};y.__bit_component={id:"teambit.docs/ui/zoomable-image@1.95.0",homepage:"https://bit.dev/teambit/docs/ui/zoomable-image",exported:!0}},43348:(e,t,n)=>{"use strict";Object.defineProperty(t,"ZP",{enumerable:!0,get:function(){return o.default}});var o=r(n(35433));function r(e){return e&&e.__esModule?e:{default:e}}r.__bit_component={id:"teambit.workspace/content/workspace-overview@1.95.0",homepage:"https://bit.dev/teambit/workspace/content/workspace-overview",exported:!0}},35433:(e,t,n)=>{"use strict";var o={id:"teambit.workspace/content/workspace-overview@1.95.0",homepage:"https://bit.dev/teambit/workspace/content/workspace-overview",exported:!0};Object.defineProperty(t,"__esModule",{value:!0}),t.default=v,u(n(87363));var r=n(40040),a=n(70500),i=n(87845),s=u(n(32874)),c=u(n(84085)),l=u(n(64268)),p=["components"];function u(e){return e&&e.__esModule?e:{default:e}}function d(){return d=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},d.apply(this,arguments)}function m(e,t){if(null==e)return{};var n,o,r=f(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(o=0;o<a.length;o++)n=a[o],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function f(e,t){if(null==e)return{};var n,o,r={},a=Object.keys(e);for(o=0;o<a.length;o++)n=a[o],t.indexOf(n)>=0||(r[n]=e[n]);return r}u.__bit_component=o,d.__bit_component=o,m.__bit_component=o,f.__bit_component=o;var h={},y="wrapper";function v(e){var t=e.components,n=m(e,p);return(0,r.mdx)(y,d({},h,n,{components:t,mdxType:"MDXLayout"}),(0,r.mdx)(a.MDXScopeProvider,{components:{Image:i.Image,wsScreenshot:s.default,looseComponents:c.default,multiRepo:l.default},mdxType:"MDXScopeProvider"},(0,r.mdx)("h1",null,"Workspace Overview"),(0,r.mdx)("p",null,"You can use the Bit workspace to either create, use or import components, make changes to them, and export these changes back.\nWorkspaces are tech-agnonstic and allow development of components of all kinds. They can be used by a single developer maintaining few components, exist on top of\nexisting repositories or shared as a Workspace component."),(0,r.mdx)(i.Image,{src:c.default,width:"85%",mdxType:"Image"}),(0,r.mdx)("p",null,"Get started and generate a demo workspace:"),(0,r.mdx)("pre",null,(0,r.mdx)("code",{parentName:"pre",className:"language-bash"},"bit new react demo\n")),(0,r.mdx)("h2",null,"Component development server"),(0,r.mdx)("p",null,"All components in your workspace are rendered and presented on a local development server. To start it, run the following command:"),(0,r.mdx)("pre",null,(0,r.mdx)("code",{parentName:"pre",className:"language-sh"},"bit start\n")),(0,r.mdx)(i.Image,{src:s.default,width:"80%",mdxType:"Image"}),(0,r.mdx)("h2",null,"Simple, scalable dev experience"),(0,r.mdx)("p",null,"Keeping a similar dev-experience across workspaces allows you to jump in and out from codebases. When you don't need to deal with a per-project setup or learn the workflow commands/scripts you simply focus on the code."),(0,r.mdx)("p",null,"Simple dev experience means you can ",(0,r.mdx)("strong",{parentName:"p"},"easily onboard")," yourself to a workspace, thanks to:"),(0,r.mdx)("ul",null,(0,r.mdx)("li",{parentName:"ul"},(0,r.mdx)("strong",{parentName:"li"},"Use the same commands")," - Regardless of the tooling and configs used in a workspace, you use the same commands (",(0,r.mdx)("inlineCode",{parentName:"li"},"compile"),", ",(0,r.mdx)("inlineCode",{parentName:"li"},"test"),", etc) and get similarly structured outputs."),(0,r.mdx)("li",{parentName:"ul"},(0,r.mdx)("strong",{parentName:"li"},"Minimal configuration")," - Most of the configuration and setup is automated. No need to define per-component dependencies and no additional files needed to change a component's build pipeline."),(0,r.mdx)("li",{parentName:"ul"},(0,r.mdx)("strong",{parentName:"li"},"Templates and standards")," - Create new components with templates and apply your formatting, linting, compilation and testing standards with a single policy."),(0,r.mdx)("li",{parentName:"ul"},(0,r.mdx)("strong",{parentName:"li"},"Components are directories")," - Each ",(0,r.mdx)("a",{parentName:"li",href:"docs/workspace/component-directory"},"component in your workspace is a directory")," so relevant files, assets and tests available in a single place.")),(0,r.mdx)("p",null,"This makes it easy to scale the amount of components in a workspace, scale the amount of workspaces and even scale the amount of developers!"),(0,r.mdx)("h2",null,"Composition of components"),(0,r.mdx)("p",null,'The workspace is a container for the components. You get a monolithic-like developer experience and ability to refactor many components in a single place. In this "container" a component manages its own implementation, history and config (',(0,r.mdx)("a",{parentName:"p",href:"/docs/components/component-overview"},"read more"),").",(0,r.mdx)("br",{parentName:"p"}),"\n","This allows you to be flexible with how you structure a workspace and its contents. For example, you can ",(0,r.mdx)("a",{parentName:"p",href:"/docs/components/importing-components"},"import a component"),":"),(0,r.mdx)("pre",null,(0,r.mdx)("code",{parentName:"pre",className:"language-bash"},"bit import teambit.community/ui/graph/bubble-graph\n")),(0,r.mdx)("p",null,"Bit adds the new component to the list of components in the workspace, pulls down the complete revision history, configs and dependencies. Now you can do local modifications, see the component when running ",(0,r.mdx)("inlineCode",{parentName:"p"},"bit start"),", and maintain it as if you implemented it in your own workspace."),(0,r.mdx)("p",null,"In the same sense you can ",(0,r.mdx)("inlineCode",{parentName:"p"},"export")," and even ",(0,r.mdx)("inlineCode",{parentName:"p"},"eject")," any of your components from a workspace, and more it to another one. So if you started with building all components in the same place, you are not locked to that decision."),(0,r.mdx)(i.Image,{src:l.default,width:"85%",mdxType:"Image"}),(0,r.mdx)("h3",null,"Personalize your workspace"),(0,r.mdx)("p",null,"With composability in mind you can personalize your workspace on a per-feature basis or on the work you are currently focus on. You can start your flow by using ",(0,r.mdx)("inlineCode",{parentName:"p"},"bit import")," and fetch all required components, starting to modify and work on them as needed.",(0,r.mdx)("br",{parentName:"p"}),"\n","When done, you can version and eject unneeded components. Instead of you working in the boundaries of your workspace, have the workspace fit to your current work."),(0,r.mdx)("h2",null,"Configuration-less"),(0,r.mdx)("p",null,"Regardless of the amount of components you have in your workspace, and how different they may be in their configuration, it only requires two files to manage components."),(0,r.mdx)("ul",null,(0,r.mdx)("li",{parentName:"ul"},(0,r.mdx)("inlineCode",{parentName:"li"},"workspace.jsonc")," - Contains the configuration policy for all components in the workspace."),(0,r.mdx)("li",{parentName:"ul"},(0,r.mdx)("inlineCode",{parentName:"li"},".bitmap")," - Maps Bit components to their corresponding location (dir) in the workspace.")),(0,r.mdx)("p",null,"With both these files you track where each component is located and can apply configuration from a centralized location according to various ",(0,r.mdx)("a",{parentName:"p",href:"/docs/workspace/variants"},(0,r.mdx)("inlineCode",{parentName:"a"},"variant"))," rules. The workspace then calculates the configuration to apply on a per-component basis."),(0,r.mdx)("p",null,"The end result is a clean workspace where you have a minimal amount of configuration files, no matter how many components you have and their variants."),(0,r.mdx)("h2",null,"Any dev environment, any framework"),(0,r.mdx)("p",null,"Angular modules, React components, Node modules or any other type of components you might need are rendered with the same ",(0,r.mdx)("a",{parentName:"p",href:"docs/workspace/workspace-ui"},"workspace UI"),", compiled by the same ",(0,r.mdx)("inlineCode",{parentName:"p"},"compile")," command, etc.",(0,r.mdx)("br",{parentName:"p"}),"\n","You can maintain components of different types and frameworks in a Bit workspace, as each component has it's own configured ",(0,r.mdx)("a",{parentName:"p",href:"/docs/envs/envs-overview"},"Component Development Environment"),", which the workspace use to run various workflows."),(0,r.mdx)("h2",null,"Components in the workspace"),(0,r.mdx)("p",null,"A Bit Workspace manages many components. It aims to create symmetry between component naming and the directory structure."),(0,r.mdx)("pre",null,(0,r.mdx)("code",{parentName:"pre",className:"language-sh"},"├── cart\n│   ├── purchase-summary\n│   └── shopping-cart\n└── design\n ├── ui\n │   ├── button\n │   └── card // for example, the corresponding component ID: my-org.design/ui/button\n └── theme\n ├── color-pallet\n └── theme-context\n")),(0,r.mdx)("div",{className:"admonition admonition-tip alert alert--success"},(0,r.mdx)("div",{parentName:"div",className:"admonition-heading"},(0,r.mdx)("h5",{parentName:"div"},(0,r.mdx)("span",{parentName:"h5",className:"admonition-icon"},(0,r.mdx)("svg",{parentName:"span",xmlns:"http://www.w3.org/2000/svg",width:"12",height:"16",viewBox:"0 0 12 16"},(0,r.mdx)("path",{parentName:"svg",fillRule:"evenodd",d:"M6.5 0C3.48 0 1 2.19 1 5c0 .92.55 2.25 1 3 1.34 2.25 1.78 2.78 2 4v1h5v-1c.22-1.22.66-1.75 2-4 .45-.75 1-2.08 1-3 0-2.81-2.48-5-5.5-5zm3.64 7.48c-.25.44-.47.8-.67 1.11-.86 1.41-1.25 2.06-1.45 3.23-.02.05-.02.11-.02.17H5c0-.06 0-.13-.02-.17-.2-1.17-.59-1.83-1.45-3.23-.2-.31-.42-.67-.67-1.11C2.44 6.78 2 5.65 2 5c0-2.2 2.02-4 4.5-4 1.22 0 2.36.42 3.22 1.19C10.55 2.94 11 3.94 11 5c0 .66-.44 1.78-.86 2.48zM4 14h5c-.23 1.14-1.3 2-2.5 2s-2.27-.86-2.5-2z"}))),"The structure is not rigid. You can sort components however you see fit.")),(0,r.mdx)("div",{parentName:"div",className:"admonition-content"})),(0,r.mdx)("p",null,"For each component Bit generates a link in the root ",(0,r.mdx)("inlineCode",{parentName:"p"},"node_modules")," directory according to the component ID. It contains the compiled output of a component."),(0,r.mdx)("pre",null,(0,r.mdx)("code",{parentName:"pre",className:"language-bash"},"└── node_modules\n └── @my-org\n └── my-scope.ui.card\n")),(0,r.mdx)("p",null,"Use these modules when consuming one component in another, even in the same workspace."),(0,r.mdx)("pre",null,(0,r.mdx)("code",{parentName:"pre",className:"language-jsx"},"import { Card } from '@my-org/my-scope.ui.card';\n")),(0,r.mdx)("div",{className:"admonition admonition-info alert alert--info"},(0,r.mdx)("div",{parentName:"div",className:"admonition-heading"},(0,r.mdx)("h5",{parentName:"div"},(0,r.mdx)("span",{parentName:"h5",className:"admonition-icon"},(0,r.mdx)("svg",{parentName:"span",xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"},(0,r.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"}))),"Absolute import statements decouple a component from the project's file structure.")),(0,r.mdx)("div",{parentName:"div",className:"admonition-content"})),(0,r.mdx)("h2",null,"Dependency Policy"),(0,r.mdx)("p",null,"The workspace dependency policy defines how external dependencies are installed and in which version. You may apply complex setups to have multiple versions of a dependency installed to fit different components. It allows you to determine where you want to adopt to a new version and which components should still use past versions."),(0,r.mdx)("p",null,"In your workspace you also have a ",(0,r.mdx)("a",{parentName:"p",href:"/docs/dependencies/dependencies-overview"},"dependency resolver")," that uses the policy to determine the type of dependency on a per-component basis.",(0,r.mdx)("br",{parentName:"p"}),"\n","Types of dependencies, like ",(0,r.mdx)("inlineCode",{parentName:"p"},"dependency")," and ",(0,r.mdx)("inlineCode",{parentName:"p"},"devDependency")," are contextual for each component. Meaning that according to where a component ",(0,r.mdx)("inlineCode",{parentName:"p"},"import"),"s a dependency, it will be set with the corresponding type. For example, a dependency only used in a test file will set as a ",(0,r.mdx)("inlineCode",{parentName:"p"},"devDependency")," for that specific component."),(0,r.mdx)("h2",null,"Performance"),(0,r.mdx)("p",null,"Bit workspace is optimized for quick and snappy feedback loop on code changes. It leaves the tough work of ensuring de-coupling and isolation to a more robust CI flow."),(0,r.mdx)("p",null,"To optimize performance even further any time you change a component Bit find which components are affected by the change. Bit then build your modified components and their affected dependents."),(0,r.mdx)("h2",null,"Integrate to existing codebases"),(0,r.mdx)("p",null,"Bit is a build tool that allows you to manage independent components. You may create a Bit workspace in a fresh directory or initialize one as part of an existing repository.",(0,r.mdx)("br",{parentName:"p"}),"\n","You can get started working on independent components alongside projects built with ",(0,r.mdx)("a",{parentName:"p",href:"https://angular.io/tutorial/toh-pt0"},"Angular"),", ",(0,r.mdx)("a",{parentName:"p",href:"https://create-react-app.dev"},"CRA")," and even ",(0,r.mdx)("a",{parentName:"p",href:"https://lerna.js.org"},"Lerna"),"."),(0,r.mdx)("p",null,(0,r.mdx)("inlineCode",{parentName:"p"},"cd")," to a pre-existing repository and run:"),(0,r.mdx)("pre",null,(0,r.mdx)("code",{parentName:"pre",className:"language-bash"},"bit init\n")),(0,r.mdx)("p",null,"From here you may use any Bit command and flow to build independent components and integrate them into your application.")))}v.__bit_component=o,v.isMDXComponent=!0},78846:(e,t,n)=>{"use strict";n.r(t),n.d(t,{default:()=>o});const o={fullWidth:"image_fullWidth__h+0Zo"}},84085:(e,t,n)=>{"use strict";e.exports=n.p+"static/images/b40d450de296e275550f.png"},64268:(e,t,n)=>{"use strict";e.exports=n.p+"static/images/2f046646df38433e90d7.png"},32874:(e,t,n)=>{"use strict";e.exports=n.p+"static/images/cb67fb802479e2710016.png"},40040:e=>{"use strict";e.exports=MdxJsReact},87363:e=>{"use strict";e.exports=React},70500:e=>{"use strict";e.exports=TeambitMdxUiMdxScopeContext},78655:(e,t,n)=>{"use strict";n.r(t),n.d(t,{__addDisposableResource:()=>I,__assign:()=>a,__asyncDelegator:()=>j,__asyncGenerator:()=>k,__asyncValues:()=>N,__await:()=>O,__awaiter:()=>f,__classPrivateFieldGet:()=>T,__classPrivateFieldIn:()=>D,__classPrivateFieldSet:()=>M,__createBinding:()=>y,__decorate:()=>s,__disposeResources:()=>B,__esDecorate:()=>l,__exportStar:()=>v,__extends:()=>r,__generator:()=>h,__importDefault:()=>C,__importStar:()=>P,__makeTemplateObject:()=>S,__metadata:()=>m,__param:()=>c,__propKey:()=>u,__read:()=>w,__rest:()=>i,__runInitializers:()=>p,__setFunctionName:()=>d,__spread:()=>b,__spreadArray:()=>_,__spreadArrays:()=>x,__values:()=>g,default:()=>R});var o=function(e,t){return o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},o(e,t)};function r(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}o(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var a=function(){return a=Object.assign||function(e){for(var t,n=1,o=arguments.length;n<o;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e},a.apply(this,arguments)};function i(e,t){var n={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(n[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(o=Object.getOwnPropertySymbols(e);r<o.length;r++)t.indexOf(o[r])<0&&Object.prototype.propertyIsEnumerable.call(e,o[r])&&(n[o[r]]=e[o[r]])}return n}function s(e,t,n,o){var r,a=arguments.length,i=a<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,n):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)i=Reflect.decorate(e,t,n,o);else for(var s=e.length-1;s>=0;s--)(r=e[s])&&(i=(a<3?r(i):a>3?r(t,n,i):r(t,n))||i);return a>3&&i&&Object.defineProperty(t,n,i),i}function c(e,t){return function(n,o){t(n,o,e)}}function l(e,t,n,o,r,a){function i(e){if(void 0!==e&&"function"!=typeof e)throw new TypeError("Function expected");return e}for(var s,c=o.kind,l="getter"===c?"get":"setter"===c?"set":"value",p=!t&&e?o.static?e:e.prototype:null,u=t||(p?Object.getOwnPropertyDescriptor(p,o.name):{}),d=!1,m=n.length-1;m>=0;m--){var f={};for(var h in o)f[h]="access"===h?{}:o[h];for(var h in o.access)f.access[h]=o.access[h];f.addInitializer=function(e){if(d)throw new TypeError("Cannot add initializers after decoration has completed");a.push(i(e||null))};var y=(0,n[m])("accessor"===c?{get:u.get,set:u.set}:u[l],f);if("accessor"===c){if(void 0===y)continue;if(null===y||"object"!=typeof y)throw new TypeError("Object expected");(s=i(y.get))&&(u.get=s),(s=i(y.set))&&(u.set=s),(s=i(y.init))&&r.unshift(s)}else(s=i(y))&&("field"===c?r.unshift(s):u[l]=s)}p&&Object.defineProperty(p,o.name,u),d=!0}function p(e,t,n){for(var o=arguments.length>2,r=0;r<t.length;r++)n=o?t[r].call(e,n):t[r].call(e);return o?n:void 0}function u(e){return"symbol"==typeof e?e:"".concat(e)}function d(e,t,n){return"symbol"==typeof t&&(t=t.description?"[".concat(t.description,"]"):""),Object.defineProperty(e,"name",{configurable:!0,value:n?"".concat(n," ",t):t})}function m(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)}function f(e,t,n,o){return new(n||(n=Promise))((function(r,a){function i(e){try{c(o.next(e))}catch(e){a(e)}}function s(e){try{c(o.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(i,s)}c((o=o.apply(e,t||[])).next())}))}function h(e,t){var n,o,r,a,i={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return a={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function s(s){return function(c){return function(s){if(n)throw new TypeError("Generator is already executing.");for(;a&&(a=0,s[0]&&(i=0)),i;)try{if(n=1,o&&(r=2&s[0]?o.return:s[0]?o.throw||((r=o.return)&&r.call(o),0):o.next)&&!(r=r.call(o,s[1])).done)return r;switch(o=0,r&&(s=[2&s[0],r.value]),s[0]){case 0:case 1:r=s;break;case 4:return i.label++,{value:s[1],done:!1};case 5:i.label++,o=s[1],s=[0];continue;case 7:s=i.ops.pop(),i.trys.pop();continue;default:if(!((r=(r=i.trys).length>0&&r[r.length-1])||6!==s[0]&&2!==s[0])){i=0;continue}if(3===s[0]&&(!r||s[1]>r[0]&&s[1]<r[3])){i.label=s[1];break}if(6===s[0]&&i.label<r[1]){i.label=r[1],r=s;break}if(r&&i.label<r[2]){i.label=r[2],i.ops.push(s);break}r[2]&&i.ops.pop(),i.trys.pop();continue}s=t.call(e,i)}catch(e){s=[6,e],o=0}finally{n=r=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,c])}}}var y=Object.create?function(e,t,n,o){void 0===o&&(o=n);var r=Object.getOwnPropertyDescriptor(t,n);r&&!("get"in r?!t.__esModule:r.writable||r.configurable)||(r={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,o,r)}:function(e,t,n,o){void 0===o&&(o=n),e[o]=t[n]};function v(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||y(t,e,n)}function g(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],o=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&o>=e.length&&(e=void 0),{value:e&&e[o++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function w(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var o,r,a=n.call(e),i=[];try{for(;(void 0===t||t-- >0)&&!(o=a.next()).done;)i.push(o.value)}catch(e){r={error:e}}finally{try{o&&!o.done&&(n=a.return)&&n.call(a)}finally{if(r)throw r.error}}return i}function b(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(w(arguments[t]));return e}function x(){for(var e=0,t=0,n=arguments.length;t<n;t++)e+=arguments[t].length;var o=Array(e),r=0;for(t=0;t<n;t++)for(var a=arguments[t],i=0,s=a.length;i<s;i++,r++)o[r]=a[i];return o}function _(e,t,n){if(n||2===arguments.length)for(var o,r=0,a=t.length;r<a;r++)!o&&r in t||(o||(o=Array.prototype.slice.call(t,0,r)),o[r]=t[r]);return e.concat(o||Array.prototype.slice.call(t))}function O(e){return this instanceof O?(this.v=e,this):new O(e)}function k(e,t,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var o,r=n.apply(e,t||[]),a=[];return o={},i("next"),i("throw"),i("return"),o[Symbol.asyncIterator]=function(){return this},o;function i(e){r[e]&&(o[e]=function(t){return new Promise((function(n,o){a.push([e,t,n,o])>1||s(e,t)}))})}function s(e,t){try{(n=r[e](t)).value instanceof O?Promise.resolve(n.value.v).then(c,l):p(a[0][2],n)}catch(e){p(a[0][3],e)}var n}function c(e){s("next",e)}function l(e){s("throw",e)}function p(e,t){e(t),a.shift(),a.length&&s(a[0][0],a[0][1])}}function j(e){var t,n;return t={},o("next"),o("throw",(function(e){throw e})),o("return"),t[Symbol.iterator]=function(){return this},t;function o(o,r){t[o]=e[o]?function(t){return(n=!n)?{value:O(e[o](t)),done:!1}:r?r(t):t}:r}}function N(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,n=e[Symbol.asyncIterator];return n?n.call(e):(e=g(e),t={},o("next"),o("throw"),o("return"),t[Symbol.asyncIterator]=function(){return this},t);function o(n){t[n]=e[n]&&function(t){return new Promise((function(o,r){!function(e,t,n,o){Promise.resolve(o).then((function(t){e({value:t,done:n})}),t)}(o,r,(t=e[n](t)).done,t.value)}))}}}function S(e,t){return Object.defineProperty?Object.defineProperty(e,"raw",{value:t}):e.raw=t,e}var E=Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t};function P(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&y(t,e,n);return E(t,e),t}function C(e){return e&&e.__esModule?e:{default:e}}function T(e,t,n,o){if("a"===n&&!o)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!o:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?o:"a"===n?o.call(e):o?o.value:t.get(e)}function M(e,t,n,o,r){if("m"===o)throw new TypeError("Private method is not writable");if("a"===o&&!r)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===o?r.call(e,n):r?r.value=n:t.set(e,n),n}function D(e,t){if(null===t||"object"!=typeof t&&"function"!=typeof t)throw new TypeError("Cannot use 'in' operator on non-object");return"function"==typeof e?t===e:e.has(t)}function I(e,t,n){if(null!=t){if("object"!=typeof t&&"function"!=typeof t)throw new TypeError("Object expected.");var o;if(n){if(!Symbol.asyncDispose)throw new TypeError("Symbol.asyncDispose is not defined.");o=t[Symbol.asyncDispose]}if(void 0===o){if(!Symbol.dispose)throw new TypeError("Symbol.dispose is not defined.");o=t[Symbol.dispose]}if("function"!=typeof o)throw new TypeError("Object not disposable.");e.stack.push({value:t,dispose:o,async:n})}else n&&e.stack.push({async:!0});return t}var z="function"==typeof SuppressedError?SuppressedError:function(e,t,n){var o=new Error(n);return o.name="SuppressedError",o.error=e,o.suppressed=t,o};function B(e){function t(t){e.error=e.hasError?new z(t,e.error,"An error was suppressed during disposal."):t,e.hasError=!0}return function n(){for(;e.stack.length;){var o=e.stack.pop();try{var r=o.dispose&&o.dispose.call(o.value);if(o.async)return Promise.resolve(r).then(n,(function(e){return t(e),n()}))}catch(e){t(e)}}if(e.hasError)throw e.error}()}const R={__extends:r,__assign:a,__rest:i,__decorate:s,__param:c,__metadata:m,__awaiter:f,__generator:h,__createBinding:y,__exportStar:v,__values:g,__read:w,__spread:b,__spreadArrays:x,__spreadArray:_,__await:O,__asyncGenerator:k,__asyncDelegator:j,__asyncValues:N,__makeTemplateObject:S,__importStar:P,__importDefault:C,__classPrivateFieldGet:T,__classPrivateFieldSet:M,__classPrivateFieldIn:D,__addDisposableResource:I,__disposeResources:B}}},t={};function n(o){var r=t[o];if(void 0!==r)return r.exports;var a=t[o]={exports:{}};return e[o].call(a.exports,a,a.exports,n),a.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var o in t)n.o(t,o)&&!n.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},(()=>{var e;n.g.importScripts&&(e=n.g.location+"");var t=n.g.document;if(!e&&t&&(t.currentScript&&(e=t.currentScript.src),!e)){var o=t.getElementsByTagName("script");if(o.length)for(var r=o.length-1;r>-1&&!e;)e=o[r--].src}if(!e)throw new Error("Automatic publicPath is not supported in this browser");e=e.replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),n.p=e})();var o={};return(()=>{"use strict";n.r(o),n.d(o,{compositions:()=>d,compositions_metadata:()=>f,overview:()=>m});var e={};n.r(e),n.d(e,{default:()=>u});var t=n(93566),r=(n(87363),n(40040)),a=n(70500),i=n(43348),s=["components"];function c(){return c=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},c.apply(this,arguments)}var l={},p="wrapper";function u(e){var t=e.components,n=function(e,t){if(null==e)return{};var n,o,r=function(e,t){if(null==e)return{};var n,o,r={},a=Object.keys(e);for(o=0;o<a.length;o++)n=a[o],t.indexOf(n)>=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(o=0;o<a.length;o++)n=a[o],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}(e,s);return(0,r.mdx)(p,c({},l,n,{components:t,mdxType:"MDXLayout"}),(0,r.mdx)(a.MDXScopeProvider,{components:{WorkspaceOverview:i.ZP},mdxType:"MDXScopeProvider"},(0,r.mdx)(i.ZP,{mdxType:"WorkspaceOverview"})))}u.isMDXComponent=!0;const d=[t],m=[e],f={compositions:[{displayName:"Logo",identifier:"Logo"}]}})(),o})()));
2
+ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports["teambit.workspace/workspace-preview"]=t():e["teambit.workspace/workspace-preview"]=t()}(self,(()=>(()=>{var e={5576:(e,t)=>{var n;!function(){"use strict";var o={}.hasOwnProperty;function r(){for(var e=[],t=0;t<arguments.length;t++){var n=arguments[t];if(n){var a=typeof n;if("string"===a||"number"===a)e.push(n);else if(Array.isArray(n)&&n.length){var i=r.apply(null,n);i&&e.push(i)}else if("object"===a)for(var s in n)o.call(n,s)&&n[s]&&e.push(s)}}return e.join(" ")}e.exports?(r.default=r,e.exports=r):void 0===(n=function(){return r}.apply(t,[]))||(e.exports=n)}()},61844:()=>{!function(){if("undefined"!=typeof window&&"undefined"!=typeof document&&"undefined"!=typeof HTMLElement){var e=!1;try{var t=document.createElement("div");t.addEventListener("focus",(function(e){e.preventDefault(),e.stopPropagation()}),!0),t.focus(Object.defineProperty({},"preventScroll",{get:function(){e=!0}}))}catch(e){}void 0!==HTMLElement.prototype.nativeFocus||e||(HTMLElement.prototype.nativeFocus=HTMLElement.prototype.focus,HTMLElement.prototype.focus=function(e){var t=window.scrollY||window.pageYOffset;this.nativeFocus(),e&&e.preventScroll&&setTimeout((function(){window.scroll(window.scrollX||window.pageXOffset,t)}),0)})}}()},32929:(e,t)=>{var n;!function(){"use strict";var o={}.hasOwnProperty;function r(){for(var e=[],t=0;t<arguments.length;t++){var n=arguments[t];if(n){var a=typeof n;if("string"===a||"number"===a)e.push(n);else if(Array.isArray(n)){if(n.length){var i=r.apply(null,n);i&&e.push(i)}}else if("object"===a)if(n.toString===Object.prototype.toString)for(var s in n)o.call(n,s)&&n[s]&&e.push(s);else e.push(n.toString())}}return e.join(" ")}e.exports?(r.default=r,e.exports=r):void 0===(n=function(){return r}.apply(t,[]))||(e.exports=n)}()},40596:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isNavigator=t.isBrowser=t.off=t.on=t.noop=void 0,t.noop=function(){},t.on=function(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];e&&e.addEventListener&&e.addEventListener.apply(e,t)},t.off=function(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];e&&e.removeEventListener&&e.removeEventListener.apply(e,t)},t.isBrowser="undefined"!=typeof window,t.isNavigator="undefined"!=typeof navigator},96614:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=n(87363);t.default=function(e){o.useEffect(e,[])}},82383:(e,t,n)=>{"use strict";var o=n(87363),r=n(40596),a=r.isBrowser?window:null,i=function(e){return!!e.addEventListener},s=function(e){return!!e.on};t.Z=function(e,t,n,c){void 0===n&&(n=a),o.useEffect((function(){if(t&&n)return i(n)?r.on(n,e,t,c):s(n)&&n.on(e,t,c),function(){i(n)?r.off(n,e,t,c):s(n)&&n.off(e,t,c)}}),[e,t,n,JSON.stringify(c)])}},5783:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=n(78655),r=n(87363),a=o.__importDefault(n(88519));t.default=function(e){var t=r.useRef(0),n=r.useState(e),o=n[0],i=n[1],s=r.useCallback((function(e){cancelAnimationFrame(t.current),t.current=requestAnimationFrame((function(){i(e)}))}),[]);return a.default((function(){cancelAnimationFrame(t.current)})),[o,s]}},88519:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=n(78655),r=n(87363),a=o.__importDefault(n(96614));t.default=function(e){var t=r.useRef(e);t.current=e,a.default((function(){return function(){return t.current()}}))}},59021:(e,t,n)=>{"use strict";var o=n(78655),r=n(87363),a=o.__importDefault(n(5783)),i=n(40596);t.Z=function(e,t){void 0===e&&(e=1/0),void 0===t&&(t=1/0);var n=a.default({width:i.isBrowser?window.innerWidth:e,height:i.isBrowser?window.innerHeight:t}),o=n[0],s=n[1];return r.useEffect((function(){if(i.isBrowser){var e=function(){s({width:window.innerWidth,height:window.innerHeight})};return i.on(window,"resize",e),function(){i.off(window,"resize",e)}}}),[]),o}},51302:(e,t,n)=>{"use strict";var o={id:"teambit.workspace/workspace@1.0.125",homepage:"https://bit.cloud/teambit/workspace/workspace",exported:!0};function r(){const e=a(n(87363));return r=function(){return e},e}function a(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0}),t.Logo=void 0,r.__bit_component=o,a.__bit_component=o;const i=()=>r().default.createElement("div",{style:{height:"100%",display:"flex",justifyContent:"center"}},r().default.createElement("img",{style:{width:70},src:"https://static.bit.dev/extensions-icons/workspace.svg"}));i.__bit_component=o,t.Logo=i},42930:function(e,t,n){"use strict";var o=this&&this.__rest||function(e,t){var n={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(n[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(o=Object.getOwnPropertySymbols(e);r<o.length;r++)t.indexOf(o[r])<0&&Object.prototype.propertyIsEnumerable.call(e,o[r])&&(n[o[r]]=e[o[r]])}return n},r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.BaseImage=void 0;const a=r(n(87363)),i=r(n(5576)),s=r(n(73858));function c(e){var{alt:t,className:n,fullWidth:r}=e,c=o(e,["alt","className","fullWidth"]);return a.default.createElement("img",Object.assign({"data-bit-id":"teambit.base-ui/elements/image",alt:t},c,{className:i.default(s.default.image,r&&s.default.fullWidth,n)}))}c.__bit_component={id:"teambit.base-ui/elements/image@1.0.0",homepage:"https://bit.dev/teambit/base-ui/elements/image",exported:!0},t.BaseImage=c},46204:function(e,t,n){"use strict";var o=this&&this.__createBinding||(Object.create?function(e,t,n,o){void 0===o&&(o=n),Object.defineProperty(e,o,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,o){void 0===o&&(o=n),e[o]=t[n]}),r=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||o(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),r(n(42930),t)},22758:(e,t,n)=>{"use strict";n.r(t),n.d(t,{Image:()=>y});var o=n(87363),r=n.n(o),a=n(32929),i=n.n(a);n(61844);const s=ReactDom;var c=n(82383),l=n(59021),p=n(78655),u=function(e){return e+"ms"},d={getBoundingClientRect:function(){return{height:0,left:0,top:0,width:0}},style:{transform:null}},m=(0,o.memo)((function(e){var t=e.children,n=e.closeText,a=void 0===n?"Unzoom Image":n,i=e.onUnload,m=e.onLoad,f=e.overlayBgColorEnd,h=void 0===f?"rgba(255, 255, 255, 0.95)":f,y=e.overlayBgColorStart,v=void 0===y?"rgba(255, 255, 255, 0)":y,g=e.parentRef,w=e.portalEl,b=void 0===w?document.body:w,x=e.scrollableEl,_=void 0===x?window:x,O=e.transitionDuration,k=void 0===O?300:O,j=e.zoomMargin,N=void 0===j?0:j,S=e.zoomZindex,E=void 0===S?2147483647:S,P=(0,o.useRef)(null),C=(0,o.useState)(0)[1],T=(0,o.useState)(!1),M=T[0],D=T[1],I=(0,o.useState)(!1),z=I[0],B=I[1],R=(0,l.Z)(),A=R.width,W=R.height,L=(0,o.useCallback)((function(e){e.preventDefault(),B(!0)}),[]),F=(0,o.useCallback)((function(e){"Escape"!==e.key&&27!==e.keyCode||(e.stopPropagation(),B(!0))}),[]),H=(0,o.useCallback)((function(){C((function(e){return e+1})),z||B(!0)}),[z]);(0,c.Z)("keydown",F,document),(0,c.Z)("scroll",H,_),(0,o.useEffect)((function(){D(!0),m(),P.current&&P.current.focus({preventScroll:!0})}),[m]),(0,o.useEffect)((function(){var e=z?setTimeout(i,k):null;return function(){e&&clearTimeout(e)}}),[z,i,k]);var Z=g.current||d,U=Z.getBoundingClientRect(),X=U.height,Y=U.left,G=U.top,q=U.width,V=function(e){var t=e.isLoaded,n=e.isUnloading,o=e.overlayBgColorEnd,r=e.zoomZindex,a={backgroundColor:e.overlayBgColorStart,transitionDuration:u(e.transitionDuration),zIndex:r};return t&&!n&&(a.backgroundColor=o),a}({isLoaded:M,isUnloading:z,overlayBgColorEnd:h,overlayBgColorStart:v,transitionDuration:k,zoomZindex:E}),$=function(e){var t=e.height,n=e.innerHeight,o=e.innerWidth,r=e.isLoaded,a=e.isUnloading,i=e.left,s=e.originalTransform,c=e.top,l=e.transitionDuration,d=e.width,m=e.zoomMargin,f=u(l);if(!r||a){var h=(0,p.__spreadArrays)(["scale(1)","translate(0, 0)"],s?[s]:[]).join(" ");return{height:t,left:i,top:c,transform:h,WebkitTransform:h,transitionDuration:f,width:d}}var y=function(e){var t=e.zoomMargin,n=e.innerWidth/(e.width+t),o=e.innerHeight/(e.height+t);return Math.min(n,o)}({height:t,innerWidth:o,innerHeight:n,width:d,zoomMargin:m}),v=(o/2-(i+d/2))/y,g=(n/2-(c+t/2))/y,w=(0,p.__spreadArrays)(["scale("+y+")","translate("+v+"px, "+g+"px)"],s?[s]:[]).join(" ");return{height:t,left:i,top:c,transform:w,WebkitTransform:w,transitionDuration:f,width:d}}({height:X,isLoaded:M,innerHeight:W,innerWidth:A,isUnloading:z,left:Y,originalTransform:Z.style.transform,top:G,transitionDuration:k,width:q,zoomMargin:N});return(0,s.createPortal)(r().createElement("div",{"aria-modal":!0,"data-rmiz-overlay":!0,role:"dialog",style:V},r().createElement("div",{"data-rmiz-modal-content":!0,style:$},t),r().createElement("button",{"aria-label":a,"data-rmiz-btn-close":!0,onClick:L,ref:P})),b)}));const f=(0,o.memo)((function(e){var t=e.children,n=e.closeText,a=void 0===n?"Unzoom image":n,i=e.overlayBgColorEnd,s=void 0===i?"rgba(255, 255, 255, 0.95)":i,c=e.overlayBgColorStart,l=void 0===c?"rgba(255, 255, 255, 0)":c,p=e.portalEl,u=e.openText,d=void 0===u?"Zoom image":u,f=e.scrollableEl,h=e.transitionDuration,y=void 0===h?300:h,v=e.wrapElement,g=void 0===v?"div":v,w=e.wrapStyle,b=e.zoomMargin,x=void 0===b?0:b,_=e.zoomZindex,O=void 0===_?2147483647:_,k=(0,o.useState)(!1),j=k[0],N=k[1],S=(0,o.useState)(!1),E=S[0],P=S[1],C=(0,o.useRef)(null),T=(0,o.useRef)(null),M=(0,o.useCallback)((function(e){j||(e.preventDefault(),N(!0))}),[j]),D=(0,o.useCallback)((function(){P(!0)}),[]),I=(0,o.useCallback)((function(){N(!1),P(!1),T.current&&T.current.focus({preventScroll:!0})}),[]),z=j&&E?"hidden":"visible";return r().createElement(o.StrictMode,null,r().createElement(g,{"data-rmiz-wrap":z,ref:C,style:w},t,r().createElement("button",{"aria-label":d,"data-rmiz-btn-open":!0,onClick:M,ref:T}),"undefined"!=typeof window&&j&&r().createElement(m,{closeText:a,onLoad:D,onUnload:I,overlayBgColorEnd:s,overlayBgColorStart:l,parentRef:C,portalEl:p,scrollableEl:f,transitionDuration:y,zoomMargin:x,zoomZindex:O},t)))}));var h=n(46204);const y=e=>{var{center:t=!0,width:n,alt:o,src:a,className:s}=e,c=function(e,t){var n={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(n[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(o=Object.getOwnPropertySymbols(e);r<o.length;r++)t.indexOf(o[r])<0&&Object.prototype.propertyIsEnumerable.call(e,o[r])&&(n[o[r]]=e[o[r]])}return n}(e,["center","width","alt","src","className"]);return r().createElement("div",{style:{width:n||"100%"},className:i()(t&&"image_center__O0WvC",s)},r().createElement(f,null,r().createElement(h.BaseImage,Object.assign({fullWidth:!0,alt:o,src:a},c))))};y.__bit_component={id:"teambit.docs/ui/zoomable-image@1.95.0",homepage:"https://bit.dev/teambit/docs/ui/zoomable-image",exported:!0}},11913:(e,t,n)=>{"use strict";Object.defineProperty(t,"ZP",{enumerable:!0,get:function(){return o.default}});var o=r(n(14890));function r(e){return e&&e.__esModule?e:{default:e}}r.__bit_component={id:"teambit.workspace/content/workspace-overview@1.95.0",homepage:"https://bit.dev/teambit/workspace/content/workspace-overview",exported:!0}},14890:(e,t,n)=>{"use strict";var o={id:"teambit.workspace/content/workspace-overview@1.95.0",homepage:"https://bit.dev/teambit/workspace/content/workspace-overview",exported:!0};Object.defineProperty(t,"__esModule",{value:!0}),t.default=v,u(n(87363));var r=n(40040),a=n(70500),i=n(22758),s=u(n(53917)),c=u(n(5102)),l=u(n(2498)),p=["components"];function u(e){return e&&e.__esModule?e:{default:e}}function d(){return d=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},d.apply(this,arguments)}function m(e,t){if(null==e)return{};var n,o,r=f(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(o=0;o<a.length;o++)n=a[o],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function f(e,t){if(null==e)return{};var n,o,r={},a=Object.keys(e);for(o=0;o<a.length;o++)n=a[o],t.indexOf(n)>=0||(r[n]=e[n]);return r}u.__bit_component=o,d.__bit_component=o,m.__bit_component=o,f.__bit_component=o;var h={},y="wrapper";function v(e){var t=e.components,n=m(e,p);return(0,r.mdx)(y,d({},h,n,{components:t,mdxType:"MDXLayout"}),(0,r.mdx)(a.MDXScopeProvider,{components:{Image:i.Image,wsScreenshot:s.default,looseComponents:c.default,multiRepo:l.default},mdxType:"MDXScopeProvider"},(0,r.mdx)("h1",null,"Workspace Overview"),(0,r.mdx)("p",null,"You can use the Bit workspace to either create, use or import components, make changes to them, and export these changes back.\nWorkspaces are tech-agnonstic and allow development of components of all kinds. They can be used by a single developer maintaining few components, exist on top of\nexisting repositories or shared as a Workspace component."),(0,r.mdx)(i.Image,{src:c.default,width:"85%",mdxType:"Image"}),(0,r.mdx)("p",null,"Get started and generate a demo workspace:"),(0,r.mdx)("pre",null,(0,r.mdx)("code",{parentName:"pre",className:"language-bash"},"bit new react demo\n")),(0,r.mdx)("h2",null,"Component development server"),(0,r.mdx)("p",null,"All components in your workspace are rendered and presented on a local development server. To start it, run the following command:"),(0,r.mdx)("pre",null,(0,r.mdx)("code",{parentName:"pre",className:"language-sh"},"bit start\n")),(0,r.mdx)(i.Image,{src:s.default,width:"80%",mdxType:"Image"}),(0,r.mdx)("h2",null,"Simple, scalable dev experience"),(0,r.mdx)("p",null,"Keeping a similar dev-experience across workspaces allows you to jump in and out from codebases. When you don't need to deal with a per-project setup or learn the workflow commands/scripts you simply focus on the code."),(0,r.mdx)("p",null,"Simple dev experience means you can ",(0,r.mdx)("strong",{parentName:"p"},"easily onboard")," yourself to a workspace, thanks to:"),(0,r.mdx)("ul",null,(0,r.mdx)("li",{parentName:"ul"},(0,r.mdx)("strong",{parentName:"li"},"Use the same commands")," - Regardless of the tooling and configs used in a workspace, you use the same commands (",(0,r.mdx)("inlineCode",{parentName:"li"},"compile"),", ",(0,r.mdx)("inlineCode",{parentName:"li"},"test"),", etc) and get similarly structured outputs."),(0,r.mdx)("li",{parentName:"ul"},(0,r.mdx)("strong",{parentName:"li"},"Minimal configuration")," - Most of the configuration and setup is automated. No need to define per-component dependencies and no additional files needed to change a component's build pipeline."),(0,r.mdx)("li",{parentName:"ul"},(0,r.mdx)("strong",{parentName:"li"},"Templates and standards")," - Create new components with templates and apply your formatting, linting, compilation and testing standards with a single policy."),(0,r.mdx)("li",{parentName:"ul"},(0,r.mdx)("strong",{parentName:"li"},"Components are directories")," - Each ",(0,r.mdx)("a",{parentName:"li",href:"docs/workspace/component-directory"},"component in your workspace is a directory")," so relevant files, assets and tests available in a single place.")),(0,r.mdx)("p",null,"This makes it easy to scale the amount of components in a workspace, scale the amount of workspaces and even scale the amount of developers!"),(0,r.mdx)("h2",null,"Composition of components"),(0,r.mdx)("p",null,'The workspace is a container for the components. You get a monolithic-like developer experience and ability to refactor many components in a single place. In this "container" a component manages its own implementation, history and config (',(0,r.mdx)("a",{parentName:"p",href:"/docs/components/component-overview"},"read more"),").",(0,r.mdx)("br",{parentName:"p"}),"\n","This allows you to be flexible with how you structure a workspace and its contents. For example, you can ",(0,r.mdx)("a",{parentName:"p",href:"/docs/components/importing-components"},"import a component"),":"),(0,r.mdx)("pre",null,(0,r.mdx)("code",{parentName:"pre",className:"language-bash"},"bit import teambit.community/ui/graph/bubble-graph\n")),(0,r.mdx)("p",null,"Bit adds the new component to the list of components in the workspace, pulls down the complete revision history, configs and dependencies. Now you can do local modifications, see the component when running ",(0,r.mdx)("inlineCode",{parentName:"p"},"bit start"),", and maintain it as if you implemented it in your own workspace."),(0,r.mdx)("p",null,"In the same sense you can ",(0,r.mdx)("inlineCode",{parentName:"p"},"export")," and even ",(0,r.mdx)("inlineCode",{parentName:"p"},"eject")," any of your components from a workspace, and more it to another one. So if you started with building all components in the same place, you are not locked to that decision."),(0,r.mdx)(i.Image,{src:l.default,width:"85%",mdxType:"Image"}),(0,r.mdx)("h3",null,"Personalize your workspace"),(0,r.mdx)("p",null,"With composability in mind you can personalize your workspace on a per-feature basis or on the work you are currently focus on. You can start your flow by using ",(0,r.mdx)("inlineCode",{parentName:"p"},"bit import")," and fetch all required components, starting to modify and work on them as needed.",(0,r.mdx)("br",{parentName:"p"}),"\n","When done, you can version and eject unneeded components. Instead of you working in the boundaries of your workspace, have the workspace fit to your current work."),(0,r.mdx)("h2",null,"Configuration-less"),(0,r.mdx)("p",null,"Regardless of the amount of components you have in your workspace, and how different they may be in their configuration, it only requires two files to manage components."),(0,r.mdx)("ul",null,(0,r.mdx)("li",{parentName:"ul"},(0,r.mdx)("inlineCode",{parentName:"li"},"workspace.jsonc")," - Contains the configuration policy for all components in the workspace."),(0,r.mdx)("li",{parentName:"ul"},(0,r.mdx)("inlineCode",{parentName:"li"},".bitmap")," - Maps Bit components to their corresponding location (dir) in the workspace.")),(0,r.mdx)("p",null,"With both these files you track where each component is located and can apply configuration from a centralized location according to various ",(0,r.mdx)("a",{parentName:"p",href:"/docs/workspace/variants"},(0,r.mdx)("inlineCode",{parentName:"a"},"variant"))," rules. The workspace then calculates the configuration to apply on a per-component basis."),(0,r.mdx)("p",null,"The end result is a clean workspace where you have a minimal amount of configuration files, no matter how many components you have and their variants."),(0,r.mdx)("h2",null,"Any dev environment, any framework"),(0,r.mdx)("p",null,"Angular modules, React components, Node modules or any other type of components you might need are rendered with the same ",(0,r.mdx)("a",{parentName:"p",href:"docs/workspace/workspace-ui"},"workspace UI"),", compiled by the same ",(0,r.mdx)("inlineCode",{parentName:"p"},"compile")," command, etc.",(0,r.mdx)("br",{parentName:"p"}),"\n","You can maintain components of different types and frameworks in a Bit workspace, as each component has it's own configured ",(0,r.mdx)("a",{parentName:"p",href:"/docs/envs/envs-overview"},"Component Development Environment"),", which the workspace use to run various workflows."),(0,r.mdx)("h2",null,"Components in the workspace"),(0,r.mdx)("p",null,"A Bit Workspace manages many components. It aims to create symmetry between component naming and the directory structure."),(0,r.mdx)("pre",null,(0,r.mdx)("code",{parentName:"pre",className:"language-sh"},"├── cart\n│   ├── purchase-summary\n│   └── shopping-cart\n└── design\n ├── ui\n │   ├── button\n │   └── card // for example, the corresponding component ID: my-org.design/ui/button\n └── theme\n ├── color-pallet\n └── theme-context\n")),(0,r.mdx)("div",{className:"admonition admonition-tip alert alert--success"},(0,r.mdx)("div",{parentName:"div",className:"admonition-heading"},(0,r.mdx)("h5",{parentName:"div"},(0,r.mdx)("span",{parentName:"h5",className:"admonition-icon"},(0,r.mdx)("svg",{parentName:"span",xmlns:"http://www.w3.org/2000/svg",width:"12",height:"16",viewBox:"0 0 12 16"},(0,r.mdx)("path",{parentName:"svg",fillRule:"evenodd",d:"M6.5 0C3.48 0 1 2.19 1 5c0 .92.55 2.25 1 3 1.34 2.25 1.78 2.78 2 4v1h5v-1c.22-1.22.66-1.75 2-4 .45-.75 1-2.08 1-3 0-2.81-2.48-5-5.5-5zm3.64 7.48c-.25.44-.47.8-.67 1.11-.86 1.41-1.25 2.06-1.45 3.23-.02.05-.02.11-.02.17H5c0-.06 0-.13-.02-.17-.2-1.17-.59-1.83-1.45-3.23-.2-.31-.42-.67-.67-1.11C2.44 6.78 2 5.65 2 5c0-2.2 2.02-4 4.5-4 1.22 0 2.36.42 3.22 1.19C10.55 2.94 11 3.94 11 5c0 .66-.44 1.78-.86 2.48zM4 14h5c-.23 1.14-1.3 2-2.5 2s-2.27-.86-2.5-2z"}))),"The structure is not rigid. You can sort components however you see fit.")),(0,r.mdx)("div",{parentName:"div",className:"admonition-content"})),(0,r.mdx)("p",null,"For each component Bit generates a link in the root ",(0,r.mdx)("inlineCode",{parentName:"p"},"node_modules")," directory according to the component ID. It contains the compiled output of a component."),(0,r.mdx)("pre",null,(0,r.mdx)("code",{parentName:"pre",className:"language-bash"},"└── node_modules\n └── @my-org\n └── my-scope.ui.card\n")),(0,r.mdx)("p",null,"Use these modules when consuming one component in another, even in the same workspace."),(0,r.mdx)("pre",null,(0,r.mdx)("code",{parentName:"pre",className:"language-jsx"},"import { Card } from '@my-org/my-scope.ui.card';\n")),(0,r.mdx)("div",{className:"admonition admonition-info alert alert--info"},(0,r.mdx)("div",{parentName:"div",className:"admonition-heading"},(0,r.mdx)("h5",{parentName:"div"},(0,r.mdx)("span",{parentName:"h5",className:"admonition-icon"},(0,r.mdx)("svg",{parentName:"span",xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"},(0,r.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"}))),"Absolute import statements decouple a component from the project's file structure.")),(0,r.mdx)("div",{parentName:"div",className:"admonition-content"})),(0,r.mdx)("h2",null,"Dependency Policy"),(0,r.mdx)("p",null,"The workspace dependency policy defines how external dependencies are installed and in which version. You may apply complex setups to have multiple versions of a dependency installed to fit different components. It allows you to determine where you want to adopt to a new version and which components should still use past versions."),(0,r.mdx)("p",null,"In your workspace you also have a ",(0,r.mdx)("a",{parentName:"p",href:"/docs/dependencies/dependencies-overview"},"dependency resolver")," that uses the policy to determine the type of dependency on a per-component basis.",(0,r.mdx)("br",{parentName:"p"}),"\n","Types of dependencies, like ",(0,r.mdx)("inlineCode",{parentName:"p"},"dependency")," and ",(0,r.mdx)("inlineCode",{parentName:"p"},"devDependency")," are contextual for each component. Meaning that according to where a component ",(0,r.mdx)("inlineCode",{parentName:"p"},"import"),"s a dependency, it will be set with the corresponding type. For example, a dependency only used in a test file will set as a ",(0,r.mdx)("inlineCode",{parentName:"p"},"devDependency")," for that specific component."),(0,r.mdx)("h2",null,"Performance"),(0,r.mdx)("p",null,"Bit workspace is optimized for quick and snappy feedback loop on code changes. It leaves the tough work of ensuring de-coupling and isolation to a more robust CI flow."),(0,r.mdx)("p",null,"To optimize performance even further any time you change a component Bit find which components are affected by the change. Bit then build your modified components and their affected dependents."),(0,r.mdx)("h2",null,"Integrate to existing codebases"),(0,r.mdx)("p",null,"Bit is a build tool that allows you to manage independent components. You may create a Bit workspace in a fresh directory or initialize one as part of an existing repository.",(0,r.mdx)("br",{parentName:"p"}),"\n","You can get started working on independent components alongside projects built with ",(0,r.mdx)("a",{parentName:"p",href:"https://angular.io/tutorial/toh-pt0"},"Angular"),", ",(0,r.mdx)("a",{parentName:"p",href:"https://create-react-app.dev"},"CRA")," and even ",(0,r.mdx)("a",{parentName:"p",href:"https://lerna.js.org"},"Lerna"),"."),(0,r.mdx)("p",null,(0,r.mdx)("inlineCode",{parentName:"p"},"cd")," to a pre-existing repository and run:"),(0,r.mdx)("pre",null,(0,r.mdx)("code",{parentName:"pre",className:"language-bash"},"bit init\n")),(0,r.mdx)("p",null,"From here you may use any Bit command and flow to build independent components and integrate them into your application.")))}v.__bit_component=o,v.isMDXComponent=!0},73858:(e,t,n)=>{"use strict";n.r(t),n.d(t,{default:()=>o});const o={fullWidth:"image_fullWidth__5D9Bi"}},5102:(e,t,n)=>{"use strict";e.exports=n.p+"static/images/b40d450de296e275550f.png"},2498:(e,t,n)=>{"use strict";e.exports=n.p+"static/images/2f046646df38433e90d7.png"},53917:(e,t,n)=>{"use strict";e.exports=n.p+"static/images/cb67fb802479e2710016.png"},40040:e=>{"use strict";e.exports=MdxJsReact},87363:e=>{"use strict";e.exports=React},70500:e=>{"use strict";e.exports=TeambitMdxUiMdxScopeContext},78655:(e,t,n)=>{"use strict";n.r(t),n.d(t,{__addDisposableResource:()=>I,__assign:()=>a,__asyncDelegator:()=>j,__asyncGenerator:()=>k,__asyncValues:()=>N,__await:()=>O,__awaiter:()=>f,__classPrivateFieldGet:()=>T,__classPrivateFieldIn:()=>D,__classPrivateFieldSet:()=>M,__createBinding:()=>y,__decorate:()=>s,__disposeResources:()=>B,__esDecorate:()=>l,__exportStar:()=>v,__extends:()=>r,__generator:()=>h,__importDefault:()=>C,__importStar:()=>P,__makeTemplateObject:()=>S,__metadata:()=>m,__param:()=>c,__propKey:()=>u,__read:()=>w,__rest:()=>i,__runInitializers:()=>p,__setFunctionName:()=>d,__spread:()=>b,__spreadArray:()=>_,__spreadArrays:()=>x,__values:()=>g,default:()=>R});var o=function(e,t){return o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},o(e,t)};function r(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}o(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var a=function(){return a=Object.assign||function(e){for(var t,n=1,o=arguments.length;n<o;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e},a.apply(this,arguments)};function i(e,t){var n={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(n[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(o=Object.getOwnPropertySymbols(e);r<o.length;r++)t.indexOf(o[r])<0&&Object.prototype.propertyIsEnumerable.call(e,o[r])&&(n[o[r]]=e[o[r]])}return n}function s(e,t,n,o){var r,a=arguments.length,i=a<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,n):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)i=Reflect.decorate(e,t,n,o);else for(var s=e.length-1;s>=0;s--)(r=e[s])&&(i=(a<3?r(i):a>3?r(t,n,i):r(t,n))||i);return a>3&&i&&Object.defineProperty(t,n,i),i}function c(e,t){return function(n,o){t(n,o,e)}}function l(e,t,n,o,r,a){function i(e){if(void 0!==e&&"function"!=typeof e)throw new TypeError("Function expected");return e}for(var s,c=o.kind,l="getter"===c?"get":"setter"===c?"set":"value",p=!t&&e?o.static?e:e.prototype:null,u=t||(p?Object.getOwnPropertyDescriptor(p,o.name):{}),d=!1,m=n.length-1;m>=0;m--){var f={};for(var h in o)f[h]="access"===h?{}:o[h];for(var h in o.access)f.access[h]=o.access[h];f.addInitializer=function(e){if(d)throw new TypeError("Cannot add initializers after decoration has completed");a.push(i(e||null))};var y=(0,n[m])("accessor"===c?{get:u.get,set:u.set}:u[l],f);if("accessor"===c){if(void 0===y)continue;if(null===y||"object"!=typeof y)throw new TypeError("Object expected");(s=i(y.get))&&(u.get=s),(s=i(y.set))&&(u.set=s),(s=i(y.init))&&r.unshift(s)}else(s=i(y))&&("field"===c?r.unshift(s):u[l]=s)}p&&Object.defineProperty(p,o.name,u),d=!0}function p(e,t,n){for(var o=arguments.length>2,r=0;r<t.length;r++)n=o?t[r].call(e,n):t[r].call(e);return o?n:void 0}function u(e){return"symbol"==typeof e?e:"".concat(e)}function d(e,t,n){return"symbol"==typeof t&&(t=t.description?"[".concat(t.description,"]"):""),Object.defineProperty(e,"name",{configurable:!0,value:n?"".concat(n," ",t):t})}function m(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)}function f(e,t,n,o){return new(n||(n=Promise))((function(r,a){function i(e){try{c(o.next(e))}catch(e){a(e)}}function s(e){try{c(o.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(i,s)}c((o=o.apply(e,t||[])).next())}))}function h(e,t){var n,o,r,a,i={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return a={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function s(s){return function(c){return function(s){if(n)throw new TypeError("Generator is already executing.");for(;a&&(a=0,s[0]&&(i=0)),i;)try{if(n=1,o&&(r=2&s[0]?o.return:s[0]?o.throw||((r=o.return)&&r.call(o),0):o.next)&&!(r=r.call(o,s[1])).done)return r;switch(o=0,r&&(s=[2&s[0],r.value]),s[0]){case 0:case 1:r=s;break;case 4:return i.label++,{value:s[1],done:!1};case 5:i.label++,o=s[1],s=[0];continue;case 7:s=i.ops.pop(),i.trys.pop();continue;default:if(!((r=(r=i.trys).length>0&&r[r.length-1])||6!==s[0]&&2!==s[0])){i=0;continue}if(3===s[0]&&(!r||s[1]>r[0]&&s[1]<r[3])){i.label=s[1];break}if(6===s[0]&&i.label<r[1]){i.label=r[1],r=s;break}if(r&&i.label<r[2]){i.label=r[2],i.ops.push(s);break}r[2]&&i.ops.pop(),i.trys.pop();continue}s=t.call(e,i)}catch(e){s=[6,e],o=0}finally{n=r=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,c])}}}var y=Object.create?function(e,t,n,o){void 0===o&&(o=n);var r=Object.getOwnPropertyDescriptor(t,n);r&&!("get"in r?!t.__esModule:r.writable||r.configurable)||(r={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,o,r)}:function(e,t,n,o){void 0===o&&(o=n),e[o]=t[n]};function v(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||y(t,e,n)}function g(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],o=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&o>=e.length&&(e=void 0),{value:e&&e[o++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function w(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var o,r,a=n.call(e),i=[];try{for(;(void 0===t||t-- >0)&&!(o=a.next()).done;)i.push(o.value)}catch(e){r={error:e}}finally{try{o&&!o.done&&(n=a.return)&&n.call(a)}finally{if(r)throw r.error}}return i}function b(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(w(arguments[t]));return e}function x(){for(var e=0,t=0,n=arguments.length;t<n;t++)e+=arguments[t].length;var o=Array(e),r=0;for(t=0;t<n;t++)for(var a=arguments[t],i=0,s=a.length;i<s;i++,r++)o[r]=a[i];return o}function _(e,t,n){if(n||2===arguments.length)for(var o,r=0,a=t.length;r<a;r++)!o&&r in t||(o||(o=Array.prototype.slice.call(t,0,r)),o[r]=t[r]);return e.concat(o||Array.prototype.slice.call(t))}function O(e){return this instanceof O?(this.v=e,this):new O(e)}function k(e,t,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var o,r=n.apply(e,t||[]),a=[];return o={},i("next"),i("throw"),i("return"),o[Symbol.asyncIterator]=function(){return this},o;function i(e){r[e]&&(o[e]=function(t){return new Promise((function(n,o){a.push([e,t,n,o])>1||s(e,t)}))})}function s(e,t){try{(n=r[e](t)).value instanceof O?Promise.resolve(n.value.v).then(c,l):p(a[0][2],n)}catch(e){p(a[0][3],e)}var n}function c(e){s("next",e)}function l(e){s("throw",e)}function p(e,t){e(t),a.shift(),a.length&&s(a[0][0],a[0][1])}}function j(e){var t,n;return t={},o("next"),o("throw",(function(e){throw e})),o("return"),t[Symbol.iterator]=function(){return this},t;function o(o,r){t[o]=e[o]?function(t){return(n=!n)?{value:O(e[o](t)),done:!1}:r?r(t):t}:r}}function N(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,n=e[Symbol.asyncIterator];return n?n.call(e):(e=g(e),t={},o("next"),o("throw"),o("return"),t[Symbol.asyncIterator]=function(){return this},t);function o(n){t[n]=e[n]&&function(t){return new Promise((function(o,r){!function(e,t,n,o){Promise.resolve(o).then((function(t){e({value:t,done:n})}),t)}(o,r,(t=e[n](t)).done,t.value)}))}}}function S(e,t){return Object.defineProperty?Object.defineProperty(e,"raw",{value:t}):e.raw=t,e}var E=Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t};function P(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&y(t,e,n);return E(t,e),t}function C(e){return e&&e.__esModule?e:{default:e}}function T(e,t,n,o){if("a"===n&&!o)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!o:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?o:"a"===n?o.call(e):o?o.value:t.get(e)}function M(e,t,n,o,r){if("m"===o)throw new TypeError("Private method is not writable");if("a"===o&&!r)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===o?r.call(e,n):r?r.value=n:t.set(e,n),n}function D(e,t){if(null===t||"object"!=typeof t&&"function"!=typeof t)throw new TypeError("Cannot use 'in' operator on non-object");return"function"==typeof e?t===e:e.has(t)}function I(e,t,n){if(null!=t){if("object"!=typeof t&&"function"!=typeof t)throw new TypeError("Object expected.");var o;if(n){if(!Symbol.asyncDispose)throw new TypeError("Symbol.asyncDispose is not defined.");o=t[Symbol.asyncDispose]}if(void 0===o){if(!Symbol.dispose)throw new TypeError("Symbol.dispose is not defined.");o=t[Symbol.dispose]}if("function"!=typeof o)throw new TypeError("Object not disposable.");e.stack.push({value:t,dispose:o,async:n})}else n&&e.stack.push({async:!0});return t}var z="function"==typeof SuppressedError?SuppressedError:function(e,t,n){var o=new Error(n);return o.name="SuppressedError",o.error=e,o.suppressed=t,o};function B(e){function t(t){e.error=e.hasError?new z(t,e.error,"An error was suppressed during disposal."):t,e.hasError=!0}return function n(){for(;e.stack.length;){var o=e.stack.pop();try{var r=o.dispose&&o.dispose.call(o.value);if(o.async)return Promise.resolve(r).then(n,(function(e){return t(e),n()}))}catch(e){t(e)}}if(e.hasError)throw e.error}()}const R={__extends:r,__assign:a,__rest:i,__decorate:s,__param:c,__metadata:m,__awaiter:f,__generator:h,__createBinding:y,__exportStar:v,__values:g,__read:w,__spread:b,__spreadArrays:x,__spreadArray:_,__await:O,__asyncGenerator:k,__asyncDelegator:j,__asyncValues:N,__makeTemplateObject:S,__importStar:P,__importDefault:C,__classPrivateFieldGet:T,__classPrivateFieldSet:M,__classPrivateFieldIn:D,__addDisposableResource:I,__disposeResources:B}}},t={};function n(o){var r=t[o];if(void 0!==r)return r.exports;var a=t[o]={exports:{}};return e[o].call(a.exports,a,a.exports,n),a.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var o in t)n.o(t,o)&&!n.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},(()=>{var e;n.g.importScripts&&(e=n.g.location+"");var t=n.g.document;if(!e&&t&&(t.currentScript&&(e=t.currentScript.src),!e)){var o=t.getElementsByTagName("script");if(o.length)for(var r=o.length-1;r>-1&&!e;)e=o[r--].src}if(!e)throw new Error("Automatic publicPath is not supported in this browser");e=e.replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),n.p=e})();var o={};return(()=>{"use strict";n.r(o),n.d(o,{compositions:()=>d,compositions_metadata:()=>f,overview:()=>m});var e={};n.r(e),n.d(e,{default:()=>u});var t=n(51302),r=(n(87363),n(40040)),a=n(70500),i=n(11913),s=["components"];function c(){return c=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},c.apply(this,arguments)}var l={},p="wrapper";function u(e){var t=e.components,n=function(e,t){if(null==e)return{};var n,o,r=function(e,t){if(null==e)return{};var n,o,r={},a=Object.keys(e);for(o=0;o<a.length;o++)n=a[o],t.indexOf(n)>=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(o=0;o<a.length;o++)n=a[o],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}(e,s);return(0,r.mdx)(p,c({},l,n,{components:t,mdxType:"MDXLayout"}),(0,r.mdx)(a.MDXScopeProvider,{components:{WorkspaceOverview:i.ZP},mdxType:"MDXScopeProvider"},(0,r.mdx)(i.ZP,{mdxType:"WorkspaceOverview"})))}u.isMDXComponent=!0;const d=[t],m=[e],f={compositions:[{displayName:"Logo",identifier:"Logo"}]}})(),o})()));
@@ -1,5 +1,5 @@
1
- import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.workspace_workspace@1.0.124/dist/workspace.composition.js';
2
- import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.workspace_workspace@1.0.124/dist/workspace.docs.mdx';
1
+ import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.workspace_workspace@1.0.125/dist/workspace.composition.js';
2
+ import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.workspace_workspace@1.0.125/dist/workspace.docs.mdx';
3
3
 
4
4
  export const compositions = [compositions_0];
5
5
  export const overview = [overview_0];
@@ -0,0 +1,38 @@
1
+ import { ComponentID } from '@teambit/component-id';
2
+ import { Consumer } from '@teambit/legacy/dist/consumer';
3
+ import { Workspace } from '..';
4
+ export type ComponentStatusLegacy = {
5
+ modified: boolean;
6
+ newlyCreated: boolean;
7
+ deleted: boolean;
8
+ staged: boolean;
9
+ notExist: boolean;
10
+ missingFromScope: boolean;
11
+ };
12
+ export type ComponentStatusResult = {
13
+ id: ComponentID;
14
+ status: ComponentStatusLegacy;
15
+ };
16
+ export declare class ComponentStatusLoader {
17
+ private workspace;
18
+ private _componentsStatusCache;
19
+ constructor(workspace: Workspace);
20
+ get consumer(): Consumer;
21
+ getManyComponentsStatuses(ids: ComponentID[]): Promise<ComponentStatusResult[]>;
22
+ /**
23
+ * Get a component status by ID. Return a ComponentStatus object.
24
+ * Keep in mind that a result can be a partial object of ComponentStatus, e.g. { notExist: true }.
25
+ * Each one of the ComponentStatus properties can be undefined, true or false.
26
+ * As a result, in order to check whether a component is not modified use (status.modified === false).
27
+ * Don't use (!status.modified) because a component may not exist and the status.modified will be undefined.
28
+ *
29
+ * The status may have 'true' for several properties. For example, a component can be staged and modified at the
30
+ * same time.
31
+ *
32
+ * The result is cached per ID and can be called several times with no penalties.
33
+ */
34
+ getComponentStatusById(id: ComponentID): Promise<ComponentStatusLegacy>;
35
+ private getStatus;
36
+ clearOneComponentCache(id: ComponentID): void;
37
+ clearCache(): void;
38
+ }
@@ -0,0 +1,189 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.ComponentStatusLoader = void 0;
7
+ function _pMapSeries() {
8
+ const data = _interopRequireDefault(require("p-map-series"));
9
+ _pMapSeries = function () {
10
+ return data;
11
+ };
12
+ return data;
13
+ }
14
+ function _componentId() {
15
+ const data = require("@teambit/component-id");
16
+ _componentId = function () {
17
+ return data;
18
+ };
19
+ return data;
20
+ }
21
+ function _bitError() {
22
+ const data = require("@teambit/bit-error");
23
+ _bitError = function () {
24
+ return data;
25
+ };
26
+ return data;
27
+ }
28
+ function _modelComponent() {
29
+ const data = require("@teambit/legacy/dist/scope/models/model-component");
30
+ _modelComponent = function () {
31
+ return data;
32
+ };
33
+ return data;
34
+ }
35
+ function _constants() {
36
+ const data = require("@teambit/legacy/dist/constants");
37
+ _constants = function () {
38
+ return data;
39
+ };
40
+ return data;
41
+ }
42
+ function _exceptions() {
43
+ const data = require("@teambit/legacy/dist/consumer/bit-map/exceptions");
44
+ _exceptions = function () {
45
+ return data;
46
+ };
47
+ return data;
48
+ }
49
+ function _componentsPendingImport() {
50
+ const data = _interopRequireDefault(require("@teambit/legacy/dist/consumer/component-ops/exceptions/components-pending-import"));
51
+ _componentsPendingImport = function () {
52
+ return data;
53
+ };
54
+ return data;
55
+ }
56
+ function _componentNotFoundInPath() {
57
+ const data = _interopRequireDefault(require("@teambit/legacy/dist/consumer/component/exceptions/component-not-found-in-path"));
58
+ _componentNotFoundInPath = function () {
59
+ return data;
60
+ };
61
+ return data;
62
+ }
63
+ function _missingFilesFromComponent() {
64
+ const data = _interopRequireDefault(require("@teambit/legacy/dist/consumer/component/exceptions/missing-files-from-component"));
65
+ _missingFilesFromComponent = function () {
66
+ return data;
67
+ };
68
+ return data;
69
+ }
70
+ function _componentOutOfSync() {
71
+ const data = _interopRequireDefault(require("@teambit/legacy/dist/consumer/exceptions/component-out-of-sync"));
72
+ _componentOutOfSync = function () {
73
+ return data;
74
+ };
75
+ return data;
76
+ }
77
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
78
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
79
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : String(i); }
80
+ 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); }
81
+ class ComponentStatusLoader {
82
+ // cache loaded components
83
+ constructor(workspace) {
84
+ this.workspace = workspace;
85
+ _defineProperty(this, "_componentsStatusCache", {});
86
+ }
87
+ get consumer() {
88
+ return this.workspace.consumer;
89
+ }
90
+ async getManyComponentsStatuses(ids) {
91
+ const results = [];
92
+ await (0, _pMapSeries().default)(ids, async id => {
93
+ const status = await this.getComponentStatusById(id);
94
+ results.push({
95
+ id,
96
+ status
97
+ });
98
+ });
99
+ return results;
100
+ }
101
+
102
+ /**
103
+ * Get a component status by ID. Return a ComponentStatus object.
104
+ * Keep in mind that a result can be a partial object of ComponentStatus, e.g. { notExist: true }.
105
+ * Each one of the ComponentStatus properties can be undefined, true or false.
106
+ * As a result, in order to check whether a component is not modified use (status.modified === false).
107
+ * Don't use (!status.modified) because a component may not exist and the status.modified will be undefined.
108
+ *
109
+ * The status may have 'true' for several properties. For example, a component can be staged and modified at the
110
+ * same time.
111
+ *
112
+ * The result is cached per ID and can be called several times with no penalties.
113
+ */
114
+ async getComponentStatusById(id) {
115
+ if (!this._componentsStatusCache[id.toString()]) {
116
+ this._componentsStatusCache[id.toString()] = await this.getStatus(id);
117
+ }
118
+ return this._componentsStatusCache[id.toString()];
119
+ }
120
+ async getStatus(id) {
121
+ // @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!
122
+ const status = {};
123
+ const componentFromModel = await this.consumer.scope.getModelComponentIfExist(id);
124
+ let componentFromFileSystem;
125
+ try {
126
+ // change to 'latest' before loading from FS. don't change to null, otherwise, it'll cause
127
+ // loadOne to not find model component as it assumes there is no version
128
+ // also, don't leave the id as is, otherwise, it'll cause issues with import --merge, when
129
+ // imported version is bigger than .bitmap, it won't find it and will consider as deleted
130
+ const {
131
+ components,
132
+ removedComponents
133
+ } = await this.consumer.loadComponents(new (_componentId().ComponentIdList)(id.changeVersion(_constants().LATEST)));
134
+ if (removedComponents.length) {
135
+ status.deleted = true;
136
+ return status;
137
+ }
138
+ componentFromFileSystem = components[0];
139
+ } catch (err) {
140
+ if (err instanceof _missingFilesFromComponent().default || err instanceof _componentNotFoundInPath().default || err instanceof _exceptions().MissingBitMapComponent) {
141
+ // the file/s have been deleted or the component doesn't exist in bit.map file
142
+ if (componentFromModel) status.deleted = true;else status.notExist = true;
143
+ return status;
144
+ }
145
+ if (err instanceof _componentsPendingImport().default) {
146
+ status.missingFromScope;
147
+ return status;
148
+ }
149
+ throw err;
150
+ }
151
+ if (!componentFromModel) {
152
+ status.newlyCreated = true;
153
+ return status;
154
+ }
155
+ if (componentFromModel.getHeadRegardlessOfLaneAsTagOrHash(true) === _modelComponent().VERSION_ZERO) {
156
+ status.newlyCreated = true;
157
+ return status;
158
+ }
159
+ const lane = await this.consumer.getCurrentLaneObject();
160
+ await componentFromModel.setDivergeData(this.consumer.scope.objects);
161
+ status.staged = await componentFromModel.isLocallyChanged(this.consumer.scope.objects, lane);
162
+ const versionFromFs = componentFromFileSystem.id.version;
163
+ const idStr = id.toString();
164
+ if (!componentFromFileSystem.id.hasVersion()) {
165
+ throw new (_componentOutOfSync().default)(idStr);
166
+ }
167
+ // TODO: instead of doing that like this we should use:
168
+ // const versionFromModel = await componentFromModel.loadVersion(versionFromFs, this.consumer.scope.objects);
169
+ // it looks like it's exactly the same code but it's not working from some reason
170
+ const versionRef = componentFromModel.getRef(versionFromFs);
171
+ if (!versionRef) throw new (_bitError().BitError)(`version ${versionFromFs} was not found in ${idStr}`);
172
+ const versionFromModel = await this.consumer.scope.getObject(versionRef.hash);
173
+ if (!versionFromModel) {
174
+ throw new (_bitError().BitError)(`failed loading version ${versionFromFs} of ${idStr} from the scope`);
175
+ }
176
+ // @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!
177
+ status.modified = await this.consumer.isComponentModified(versionFromModel, componentFromFileSystem);
178
+ return status;
179
+ }
180
+ clearOneComponentCache(id) {
181
+ delete this._componentsStatusCache[id.toString()];
182
+ }
183
+ clearCache() {
184
+ this._componentsStatusCache = {};
185
+ }
186
+ }
187
+ exports.ComponentStatusLoader = ComponentStatusLoader;
188
+
189
+ //# sourceMappingURL=component-status-loader.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_pMapSeries","data","_interopRequireDefault","require","_componentId","_bitError","_modelComponent","_constants","_exceptions","_componentsPendingImport","_componentNotFoundInPath","_missingFilesFromComponent","_componentOutOfSync","obj","__esModule","default","_defineProperty","key","value","_toPropertyKey","Object","defineProperty","enumerable","configurable","writable","t","i","_toPrimitive","String","r","e","Symbol","toPrimitive","call","TypeError","Number","ComponentStatusLoader","constructor","workspace","consumer","getManyComponentsStatuses","ids","results","mapSeries","id","status","getComponentStatusById","push","_componentsStatusCache","toString","getStatus","componentFromModel","scope","getModelComponentIfExist","componentFromFileSystem","components","removedComponents","loadComponents","ComponentIdList","changeVersion","LATEST","length","deleted","err","MissingFilesFromComponent","ComponentNotFoundInPath","MissingBitMapComponent","notExist","ComponentsPendingImport","missingFromScope","newlyCreated","getHeadRegardlessOfLaneAsTagOrHash","VERSION_ZERO","lane","getCurrentLaneObject","setDivergeData","objects","staged","isLocallyChanged","versionFromFs","version","idStr","hasVersion","ComponentOutOfSync","versionRef","getRef","BitError","versionFromModel","getObject","hash","modified","isComponentModified","clearOneComponentCache","clearCache","exports"],"sources":["component-status-loader.ts"],"sourcesContent":["import mapSeries from 'p-map-series';\nimport { ComponentID, ComponentIdList } from '@teambit/component-id';\nimport { BitError } from '@teambit/bit-error';\nimport { VERSION_ZERO } from '@teambit/legacy/dist/scope/models/model-component';\nimport { Consumer } from '@teambit/legacy/dist/consumer';\nimport { LATEST } from '@teambit/legacy/dist/constants';\nimport { ModelComponent } from '@teambit/legacy/dist/scope/models';\nimport { MissingBitMapComponent } from '@teambit/legacy/dist/consumer/bit-map/exceptions';\nimport ComponentsPendingImport from '@teambit/legacy/dist/consumer/component-ops/exceptions/components-pending-import';\nimport ComponentNotFoundInPath from '@teambit/legacy/dist/consumer/component/exceptions/component-not-found-in-path';\nimport MissingFilesFromComponent from '@teambit/legacy/dist/consumer/component/exceptions/missing-files-from-component';\nimport ComponentOutOfSync from '@teambit/legacy/dist/consumer/exceptions/component-out-of-sync';\nimport { Workspace } from '..';\n\nexport type ComponentStatusLegacy = {\n modified: boolean;\n newlyCreated: boolean;\n deleted: boolean;\n staged: boolean;\n notExist: boolean;\n missingFromScope: boolean;\n};\n\nexport type ComponentStatusResult = { id: ComponentID; status: ComponentStatusLegacy };\n\nexport class ComponentStatusLoader {\n private _componentsStatusCache: Record<string, any> = {}; // cache loaded components\n constructor(private workspace: Workspace) {}\n\n get consumer(): Consumer {\n return this.workspace.consumer;\n }\n\n async getManyComponentsStatuses(ids: ComponentID[]): Promise<ComponentStatusResult[]> {\n const results: ComponentStatusResult[] = [];\n await mapSeries(ids, async (id) => {\n const status = await this.getComponentStatusById(id);\n results.push({ id, status });\n });\n return results;\n }\n\n /**\n * Get a component status by ID. Return a ComponentStatus object.\n * Keep in mind that a result can be a partial object of ComponentStatus, e.g. { notExist: true }.\n * Each one of the ComponentStatus properties can be undefined, true or false.\n * As a result, in order to check whether a component is not modified use (status.modified === false).\n * Don't use (!status.modified) because a component may not exist and the status.modified will be undefined.\n *\n * The status may have 'true' for several properties. For example, a component can be staged and modified at the\n * same time.\n *\n * The result is cached per ID and can be called several times with no penalties.\n */\n async getComponentStatusById(id: ComponentID): Promise<ComponentStatusLegacy> {\n if (!this._componentsStatusCache[id.toString()]) {\n this._componentsStatusCache[id.toString()] = await this.getStatus(id);\n }\n return this._componentsStatusCache[id.toString()];\n }\n\n private async getStatus(id: ComponentID) {\n // @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!\n const status: ComponentStatusLegacy = {};\n const componentFromModel: ModelComponent | undefined = await this.consumer.scope.getModelComponentIfExist(id);\n let componentFromFileSystem;\n try {\n // change to 'latest' before loading from FS. don't change to null, otherwise, it'll cause\n // loadOne to not find model component as it assumes there is no version\n // also, don't leave the id as is, otherwise, it'll cause issues with import --merge, when\n // imported version is bigger than .bitmap, it won't find it and will consider as deleted\n const { components, removedComponents } = await this.consumer.loadComponents(\n new ComponentIdList(id.changeVersion(LATEST))\n );\n if (removedComponents.length) {\n status.deleted = true;\n return status;\n }\n componentFromFileSystem = components[0];\n } catch (err: any) {\n if (\n err instanceof MissingFilesFromComponent ||\n err instanceof ComponentNotFoundInPath ||\n err instanceof MissingBitMapComponent\n ) {\n // the file/s have been deleted or the component doesn't exist in bit.map file\n if (componentFromModel) status.deleted = true;\n else status.notExist = true;\n return status;\n }\n if (err instanceof ComponentsPendingImport) {\n status.missingFromScope;\n return status;\n }\n throw err;\n }\n if (!componentFromModel) {\n status.newlyCreated = true;\n return status;\n }\n if (componentFromModel.getHeadRegardlessOfLaneAsTagOrHash(true) === VERSION_ZERO) {\n status.newlyCreated = true;\n return status;\n }\n\n const lane = await this.consumer.getCurrentLaneObject();\n await componentFromModel.setDivergeData(this.consumer.scope.objects);\n status.staged = await componentFromModel.isLocallyChanged(this.consumer.scope.objects, lane);\n const versionFromFs = componentFromFileSystem.id.version;\n const idStr = id.toString();\n if (!componentFromFileSystem.id.hasVersion()) {\n throw new ComponentOutOfSync(idStr);\n }\n // TODO: instead of doing that like this we should use:\n // const versionFromModel = await componentFromModel.loadVersion(versionFromFs, this.consumer.scope.objects);\n // it looks like it's exactly the same code but it's not working from some reason\n const versionRef = componentFromModel.getRef(versionFromFs);\n if (!versionRef) throw new BitError(`version ${versionFromFs} was not found in ${idStr}`);\n const versionFromModel = await this.consumer.scope.getObject(versionRef.hash);\n if (!versionFromModel) {\n throw new BitError(`failed loading version ${versionFromFs} of ${idStr} from the scope`);\n }\n // @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!\n status.modified = await this.consumer.isComponentModified(versionFromModel, componentFromFileSystem);\n return status;\n }\n\n clearOneComponentCache(id: ComponentID) {\n delete this._componentsStatusCache[id.toString()];\n }\n\n clearCache() {\n this._componentsStatusCache = {};\n }\n}\n"],"mappings":"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"}
@@ -1,4 +1,4 @@
1
- import { ComponentStatus as LegacyComponentStatus } from '@teambit/legacy/dist/consumer/component-ops/component-status-loader';
1
+ import { ComponentStatusLegacy } from './component-status-loader';
2
2
  export type ModifyInfo = {
3
3
  hasModifiedFiles: boolean;
4
4
  hasModifiedDependencies: boolean;
@@ -71,5 +71,5 @@ export declare class ComponentStatus {
71
71
  * the component is not authored and not imported.
72
72
  */
73
73
  nested?: boolean);
74
- static fromLegacy(status: LegacyComponentStatus, hasModifiedDependencies: boolean, isOutdated: boolean): ComponentStatus;
74
+ static fromLegacy(status: ComponentStatusLegacy, hasModifiedDependencies: boolean, isOutdated: boolean): ComponentStatus;
75
75
  }
@@ -1 +1 @@
1
- {"version":3,"names":["ComponentStatus","constructor","modifyInfo","isNew","isDeleted","isStaged","isInWorkspace","isInScope","isOutdated","nested","fromLegacy","status","hasModifiedDependencies","modify","hasModifiedFiles","modified","newlyCreated","deleted","staged","notExist","missingFromScope","exports"],"sources":["component-status.ts"],"sourcesContent":["import { ComponentStatus as LegacyComponentStatus } from '@teambit/legacy/dist/consumer/component-ops/component-status-loader';\n\nexport type ModifyInfo = {\n hasModifiedFiles: boolean;\n hasModifiedDependencies: boolean;\n};\n\nexport class ComponentStatus {\n constructor(\n /**\n * is the component modified.\n */\n readonly modifyInfo: ModifyInfo,\n\n /**\n * is the new component new.\n */\n readonly isNew: boolean,\n\n /**\n * is the component deleted from the workspace.\n */\n readonly isDeleted: boolean,\n\n /**\n * is the component staged.\n */\n readonly isStaged: boolean,\n\n /**\n * does the component exists in the workspace.\n */\n readonly isInWorkspace: boolean,\n\n /**\n * does the component exists in the scope.\n */\n readonly isInScope: boolean,\n\n /**\n * does the component is outdated (pending for update).\n */\n readonly isOutdated: boolean,\n\n /**\n * @deprecated this was relevant for legacy only. can be deleted if it's not used elsewhere\n * the component is not authored and not imported.\n */\n readonly nested?: boolean\n ) {}\n\n static fromLegacy(status: LegacyComponentStatus, hasModifiedDependencies: boolean, isOutdated: boolean) {\n const modify: ModifyInfo = {\n hasModifiedFiles: !!status.modified,\n hasModifiedDependencies,\n };\n return new ComponentStatus(\n modify,\n !!status.newlyCreated,\n !!status.deleted,\n !!status.staged,\n !status.notExist,\n !status.missingFromScope,\n isOutdated\n );\n }\n}\n"],"mappings":";;;;;;AAOO,MAAMA,eAAe,CAAC;EAC3BC,WAAWA;EACT;AACJ;AACA;EACaC,UAAsB;EAE/B;AACJ;AACA;EACaC,KAAc;EAEvB;AACJ;AACA;EACaC,SAAkB;EAE3B;AACJ;AACA;EACaC,QAAiB;EAE1B;AACJ;AACA;EACaC,aAAsB;EAE/B;AACJ;AACA;EACaC,SAAkB;EAE3B;AACJ;AACA;EACaC,UAAmB;EAE5B;AACJ;AACA;AACA;EACaC,MAAgB,EACzB;IAAA,KArCSP,UAAsB,GAAtBA,UAAsB;IAAA,KAKtBC,KAAc,GAAdA,KAAc;IAAA,KAKdC,SAAkB,GAAlBA,SAAkB;IAAA,KAKlBC,QAAiB,GAAjBA,QAAiB;IAAA,KAKjBC,aAAsB,GAAtBA,aAAsB;IAAA,KAKtBC,SAAkB,GAAlBA,SAAkB;IAAA,KAKlBC,UAAmB,GAAnBA,UAAmB;IAAA,KAMnBC,MAAgB,GAAhBA,MAAgB;EACxB;EAEH,OAAOC,UAAUA,CAACC,MAA6B,EAAEC,uBAAgC,EAAEJ,UAAmB,EAAE;IACtG,MAAMK,MAAkB,GAAG;MACzBC,gBAAgB,EAAE,CAAC,CAACH,MAAM,CAACI,QAAQ;MACnCH;IACF,CAAC;IACD,OAAO,IAAIZ,eAAe,CACxBa,MAAM,EACN,CAAC,CAACF,MAAM,CAACK,YAAY,EACrB,CAAC,CAACL,MAAM,CAACM,OAAO,EAChB,CAAC,CAACN,MAAM,CAACO,MAAM,EACf,CAACP,MAAM,CAACQ,QAAQ,EAChB,CAACR,MAAM,CAACS,gBAAgB,EACxBZ,UACF,CAAC;EACH;AACF;AAACa,OAAA,CAAArB,eAAA,GAAAA,eAAA"}
1
+ {"version":3,"names":["ComponentStatus","constructor","modifyInfo","isNew","isDeleted","isStaged","isInWorkspace","isInScope","isOutdated","nested","fromLegacy","status","hasModifiedDependencies","modify","hasModifiedFiles","modified","newlyCreated","deleted","staged","notExist","missingFromScope","exports"],"sources":["component-status.ts"],"sourcesContent":["import { ComponentStatusLegacy } from './component-status-loader';\n\nexport type ModifyInfo = {\n hasModifiedFiles: boolean;\n hasModifiedDependencies: boolean;\n};\n\nexport class ComponentStatus {\n constructor(\n /**\n * is the component modified.\n */\n readonly modifyInfo: ModifyInfo,\n\n /**\n * is the new component new.\n */\n readonly isNew: boolean,\n\n /**\n * is the component deleted from the workspace.\n */\n readonly isDeleted: boolean,\n\n /**\n * is the component staged.\n */\n readonly isStaged: boolean,\n\n /**\n * does the component exists in the workspace.\n */\n readonly isInWorkspace: boolean,\n\n /**\n * does the component exists in the scope.\n */\n readonly isInScope: boolean,\n\n /**\n * does the component is outdated (pending for update).\n */\n readonly isOutdated: boolean,\n\n /**\n * @deprecated this was relevant for legacy only. can be deleted if it's not used elsewhere\n * the component is not authored and not imported.\n */\n readonly nested?: boolean\n ) {}\n\n static fromLegacy(status: ComponentStatusLegacy, hasModifiedDependencies: boolean, isOutdated: boolean) {\n const modify: ModifyInfo = {\n hasModifiedFiles: !!status.modified,\n hasModifiedDependencies,\n };\n return new ComponentStatus(\n modify,\n !!status.newlyCreated,\n !!status.deleted,\n !!status.staged,\n !status.notExist,\n !status.missingFromScope,\n isOutdated\n );\n }\n}\n"],"mappings":";;;;;;AAOO,MAAMA,eAAe,CAAC;EAC3BC,WAAWA;EACT;AACJ;AACA;EACaC,UAAsB;EAE/B;AACJ;AACA;EACaC,KAAc;EAEvB;AACJ;AACA;EACaC,SAAkB;EAE3B;AACJ;AACA;EACaC,QAAiB;EAE1B;AACJ;AACA;EACaC,aAAsB;EAE/B;AACJ;AACA;EACaC,SAAkB;EAE3B;AACJ;AACA;EACaC,UAAmB;EAE5B;AACJ;AACA;AACA;EACaC,MAAgB,EACzB;IAAA,KArCSP,UAAsB,GAAtBA,UAAsB;IAAA,KAKtBC,KAAc,GAAdA,KAAc;IAAA,KAKdC,SAAkB,GAAlBA,SAAkB;IAAA,KAKlBC,QAAiB,GAAjBA,QAAiB;IAAA,KAKjBC,aAAsB,GAAtBA,aAAsB;IAAA,KAKtBC,SAAkB,GAAlBA,SAAkB;IAAA,KAKlBC,UAAmB,GAAnBA,UAAmB;IAAA,KAMnBC,MAAgB,GAAhBA,MAAgB;EACxB;EAEH,OAAOC,UAAUA,CAACC,MAA6B,EAAEC,uBAAgC,EAAEJ,UAAmB,EAAE;IACtG,MAAMK,MAAkB,GAAG;MACzBC,gBAAgB,EAAE,CAAC,CAACH,MAAM,CAACI,QAAQ;MACnCH;IACF,CAAC;IACD,OAAO,IAAIZ,eAAe,CACxBa,MAAM,EACN,CAAC,CAACF,MAAM,CAACK,YAAY,EACrB,CAAC,CAACL,MAAM,CAACM,OAAO,EAChB,CAAC,CAACN,MAAM,CAACO,MAAM,EACf,CAACP,MAAM,CAACQ,QAAQ,EAChB,CAACR,MAAM,CAACS,gBAAgB,EACxBZ,UACF,CAAC;EACH;AACF;AAACa,OAAA,CAAArB,eAAA,GAAAA,eAAA"}
@@ -30,7 +30,7 @@ import { ComponentConfigFile } from './component-config-file';
30
30
  import { OnComponentAdd, OnComponentChange, OnComponentEventResult, OnComponentLoad, OnComponentRemove } from './on-component-events';
31
31
  import { WorkspaceExtConfig } from './types';
32
32
  import { ComponentStatus } from './workspace-component/component-status';
33
- import { OnAspectsResolve, OnAspectsResolveSlot, OnBitmapChange, OnBitmapChangeSlot, OnComponentAddSlot, OnComponentChangeSlot, OnComponentLoadSlot, OnComponentRemoveSlot, OnRootAspectAdded, OnRootAspectAddedSlot } from './workspace.provider';
33
+ import { OnAspectsResolve, OnAspectsResolveSlot, OnBitmapChange, OnBitmapChangeSlot, OnWorkspaceConfigChange, OnWorkspaceConfigChangeSlot, OnComponentAddSlot, OnComponentChangeSlot, OnComponentLoadSlot, OnComponentRemoveSlot, OnRootAspectAdded, OnRootAspectAddedSlot } from './workspace.provider';
34
34
  import { ComponentLoadOptions, WorkspaceComponentLoader } from './workspace-component/workspace-component-loader';
35
35
  import { ShouldLoadFunc } from './build-graph-from-fs';
36
36
  import { BitMap } from './bit-map';
@@ -39,6 +39,7 @@ import { AspectPackage, GetConfiguredUserAspectsPackagesOptions, WorkspaceAspect
39
39
  import { MergeConflictFile } from './merge-conflict-file';
40
40
  import { CompFiles } from './workspace-component/comp-files';
41
41
  import { Filter } from './filter';
42
+ import { ComponentStatusLegacy, ComponentStatusResult } from './workspace-component/component-status-loader';
42
43
  export type EjectConfResult = {
43
44
  configPath: string;
44
45
  };
@@ -106,11 +107,13 @@ export declare class Workspace implements ComponentFactory {
106
107
  private onRootAspectAddedSlot;
107
108
  private graphql;
108
109
  private onBitmapChangeSlot;
110
+ private onWorkspaceConfigChangeSlot;
109
111
  private warnedAboutMisconfiguredEnvs;
110
112
  priority: boolean;
111
113
  owner?: string;
112
114
  componentsScopeDirsMap: ComponentScopeDirMap;
113
115
  componentLoader: WorkspaceComponentLoader;
116
+ private componentStatusLoader;
114
117
  bitMap: BitMap;
115
118
  /**
116
119
  * Indicate that we are now running installation process
@@ -160,7 +163,7 @@ export declare class Workspace implements ComponentFactory {
160
163
  /**
161
164
  * on component add slot.
162
165
  */
163
- onComponentAddSlot: OnComponentAddSlot, onComponentRemoveSlot: OnComponentRemoveSlot, onAspectsResolveSlot: OnAspectsResolveSlot, onRootAspectAddedSlot: OnRootAspectAddedSlot, graphql: GraphqlMain, onBitmapChangeSlot: OnBitmapChangeSlot);
166
+ onComponentAddSlot: OnComponentAddSlot, onComponentRemoveSlot: OnComponentRemoveSlot, onAspectsResolveSlot: OnAspectsResolveSlot, onRootAspectAddedSlot: OnRootAspectAddedSlot, graphql: GraphqlMain, onBitmapChangeSlot: OnBitmapChangeSlot, onWorkspaceConfigChangeSlot: OnWorkspaceConfigChangeSlot);
164
167
  private validateConfig;
165
168
  /**
166
169
  * root path of the Workspace.
@@ -174,6 +177,7 @@ export declare class Workspace implements ComponentFactory {
174
177
  registerOnComponentAdd(onComponentAddFunc: OnComponentAdd): this;
175
178
  registerOnComponentRemove(onComponentRemoveFunc: OnComponentRemove): this;
176
179
  registerOnBitmapChange(OnBitmapChangeFunc: OnBitmapChange): this;
180
+ registerOnWorkspaceConfigChange(onWorkspaceConfigChangeFunc: OnWorkspaceConfigChange): void;
177
181
  registerOnAspectsResolve(onAspectsResolveFunc: OnAspectsResolve): this;
178
182
  registerOnRootAspectAdded(onRootAspectAddedFunc: OnRootAspectAdded): this;
179
183
  /**
@@ -182,6 +186,7 @@ export declare class Workspace implements ComponentFactory {
182
186
  */
183
187
  get name(): string;
184
188
  get icon(): string;
189
+ listAutoTagPendingComponentIds(): Promise<ComponentID[]>;
185
190
  hasModifiedDependencies(component: Component): Promise<boolean>;
186
191
  /**
187
192
  * get Component issues
@@ -233,7 +238,7 @@ export declare class Workspace implements ComponentFactory {
233
238
  /**
234
239
  * list all modified components in the workspace.
235
240
  */
236
- modified(): Promise<Component[]>;
241
+ modified(loadOpts?: ComponentLoadOptions): Promise<Component[]>;
237
242
  /**
238
243
  * list all new components in the workspace.
239
244
  */
@@ -287,8 +292,7 @@ export declare class Workspace implements ComponentFactory {
287
292
  triggerOnComponentRemove(id: ComponentID): Promise<OnComponentEventResult[]>;
288
293
  triggerOnBitmapChange(): Promise<void>;
289
294
  /**
290
- * if needed, add a slot to let other aspects react to this event.
291
- * currently, the purpose is to reload the workspace config when it changes, so entries like "defaultScope" are updated.
295
+ * the purpose is mostly to reload the workspace config when it changes, so entries like "defaultScope" are updated.
292
296
  * it also updates the DependencyResolver config. I couldn't find a good way to update all aspects in workspace.jsonc.
293
297
  */
294
298
  triggerOnWorkspaceConfigChange(): Promise<void>;
@@ -526,5 +530,7 @@ export declare class Workspace implements ComponentFactory {
526
530
  getInjectedDirs(component: Component): Promise<string[]>;
527
531
  getAutoDetectOverrides(configuredExtensions: ExtensionDataList, id: ComponentID, legacyFiles: SourceFile[]): Promise<import("@teambit/legacy/dist/consumer/config/component-overrides").DependenciesOverridesData>;
528
532
  getAutoDetectConfigMerge(id: ComponentID): import("@teambit/legacy/dist/consumer/config/component-overrides").DependenciesOverridesData;
533
+ getManyComponentsStatuses(ids: ComponentID[]): Promise<ComponentStatusResult[]>;
534
+ getComponentStatusById(id: ComponentID): Promise<ComponentStatusLegacy>;
529
535
  }
530
536
  export default Workspace;