@teambit/ui 1.0.196 → 1.0.198
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/artifacts/__bit_junit.xml +1 -1
- package/artifacts/preview/teambit_ui_foundation_ui-preview.js +1 -1
- package/artifacts/schema.json +7 -7
- package/artifacts/ui-bundle/scope/public/bit/index.html +1 -1
- package/artifacts/ui-bundle/scope/public/bit/service-worker.js +1 -1
- package/artifacts/ui-bundle/scope/public/bit/ssr/service-worker.js.map +1 -1
- package/dist/{preview-1710559018008.js → preview-1710731787614.js} +2 -2
- package/dist/start.cmd.js +1 -1
- package/dist/start.cmd.js.map +1 -1
- package/package.json +12 -12
- package/start.cmd.tsx +2 -2
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
2
|
<testsuites tests="0" failures="0" errors="0" skipped="0">
|
|
3
|
-
<testsuite name="teambit.ui-foundation/ui@1.0.
|
|
3
|
+
<testsuite name="teambit.ui-foundation/ui@1.0.198" tests="0" failures="0" errors="0" skipped="0"/>
|
|
4
4
|
</testsuites>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports["teambit.ui-foundation/ui-preview"]=t():e["teambit.ui-foundation/ui-preview"]=t()}(self,(()=>(()=>{"use strict";var e={
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports["teambit.ui-foundation/ui-preview"]=t():e["teambit.ui-foundation/ui-preview"]=t()}(self,(()=>(()=>{"use strict";var e={70853:(e,t,n)=>{var r={id:"teambit.ui-foundation/ui@1.0.198",homepage:"https://bit.cloud/teambit/ui-foundation/ui",exported:!0};function o(){const e=a(n(41594));return o=function(){return e},e}function a(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0}),t.Logo=void 0,o.__bit_component=r,a.__bit_component=r;const i=()=>o().default.createElement("div",{style:{height:"100%",display:"flex",justifyContent:"center"}},o().default.createElement("img",{style:{width:70},src:"https://static.bit.dev/extensions-icons/ui.svg"}));i.__bit_component=r,t.Logo=i},41594:e=>{e.exports=React}},t={};function n(r){var o=t[r];if(void 0!==o)return o.exports;var a=t[r]={exports:{}};return e[r](a,a.exports,n),a.exports}n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},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 r={};return(()=>{n.r(r),n.d(r,{compositions:()=>p,compositions_metadata:()=>u,overview:()=>m});var e={};n.r(e),n.d(e,{default:()=>c});var t=n(70853);n(41594);const o=MdxJsReact,a=TeambitMdxUiMdxScopeContext;var i=["components"];function s(){return s=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},s.apply(this,arguments)}var l={},d="wrapper";function c(e){var t=e.components,n=function(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},a=Object.keys(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}(e,i);return(0,o.mdx)(d,s({},l,n,{components:t,mdxType:"MDXLayout"}),(0,o.mdx)(a.MDXScopeProvider,{components:{},mdxType:"MDXScopeProvider"},(0,o.mdx)("h2",null,"Server-side rendering"),(0,o.mdx)("p",null,"Server side rendering (or SSR) is done in the following form:"),(0,o.mdx)("pre",null,(0,o.mdx)("code",{parentName:"pre",className:"language-tsx"},"/** at server: */\nconst dom = ReactDom.renderToString(<MountPoint>{app}</MountPoint>);\nconst assets = { headers, scripts, ... };\nconst html = ReactDom.renderStaticMarkup(<Html assets={assets}/>);\nHtml.fillContent(html, dom);\nsend(html);\n\n/** at client: */\nReactDom.render(app, mountPoint);\n // or .hydrate()\n")),(0,o.mdx)("p",null,"We can then enrich the page with hooks:"),(0,o.mdx)("pre",null,(0,o.mdx)("code",{parentName:"pre",className:"language-tsx"},"/** at server: */\nlet context = hooks.serverInit();\nconst app = (\n <hooks.reactContext value={context}>\n <App />\n </hooks.reactContext>\n);\n\ncontext = hooks.onBeforeRender(app, context);\nconst dom = ...\n\nconst assets = hooks.serialize(context);\nconst html = ...\nsend(html);\n\n/** at client: */\nconst parsed = hooks.deserialize();\nconst context = hooks.browserInit(parsed);\nconst app = (\n <hooks.reactContext value={context}>\n <App />\n </hooks.reactContext>\n)\n\nhooks.onBeforeHydrate(app, context);\n\nconst ref = ReactDom.render(app, mountPoint);\n\nhooks.onHydrate(ref, context);\n")),(0,o.mdx)("p",null,"The rendering flow will ensure that the rendering Context will be unique per request, and separate between aspects."),(0,o.mdx)("h3",null,"Hiding elements before JS execution"),(0,o.mdx)("p",null,"Certain items look bad in the static HTML, and only get decent after JS executes. Tooltips are a notable example. They take up space in the DOM and only hide once their react code runs.",(0,o.mdx)("br",{parentName:"p"}),"\n","For these cases, use the convenience class ",(0,o.mdx)("inlineCode",{parentName:"p"},"--ssr-hidden"),". Add this to any misbehaving elements, and it will hide them using ",(0,o.mdx)("inlineCode",{parentName:"p"},"display: none")," until reactDom.render() is complete."),(0,o.mdx)("h3",null,".rehydrate vs .render()"),(0,o.mdx)("p",null,".rehydrate() attach a React virtual dom to a mount point, without asserting the virtual-dom matches the actual dom.",(0,o.mdx)("br",{parentName:"p"}),"\n",".render() updates the mount point to match the react virtual dom."),(0,o.mdx)("p",null,"On paper, ",(0,o.mdx)("inlineCode",{parentName:"p"},".rehydrate()")," should be the preferred option, with better performance.",(0,o.mdx)("br",{parentName:"p"}),"\n","In practice, ",(0,o.mdx)("inlineCode",{parentName:"p"},".render()"),' is backward compatible to React 15, and will know to "hydrate" according to the ',(0,o.mdx)("inlineCode",{parentName:"p"},"data-reactroot")," attribute on the mount point, with similar performance, and without revalidating the DOM.",(0,o.mdx)("br",{parentName:"p"}),"\n","ReactDOM will also show warnings in dev mode about mismatch between ssr dom and the client side dom."),(0,o.mdx)("h3",null,"Best practices"),(0,o.mdx)("ul",null,(0,o.mdx)("li",{parentName:"ul"},"Use ReactContext instead of trying to mutate ",(0,o.mdx)("inlineCode",{parentName:"li"},"App"),"."),(0,o.mdx)("li",{parentName:"ul"},"Use existing context object."),(0,o.mdx)("li",{parentName:"ul"},"Do not use other Aspects' context object."),(0,o.mdx)("li",{parentName:"ul"},"Try to keep process symmetrical between server and client;")),(0,o.mdx)("h4",null,"Example: Server side GraphQL"),(0,o.mdx)("p",null,"Graphql adds extra instructions to pre-fetch queries on the server:"),(0,o.mdx)("pre",null,(0,o.mdx)("code",{parentName:"pre",className:"language-tsx"}," // .registerRenderHooks() ?\n.registerRenderLifecycle({\n serverInit: ({ browser }) => {\n const { cookie } = browser;\n return { client: new Client(GQL_INTERNAL, { cookie }) };\n },\n beforeRender: ({ client }, app) => {\n await getDataFromTree(app);\n },\n serialize: ({ client }, app) => {\n return { json: JSON.stringify(client.extract()) };\n },\n deserialize: (raw) => {\n return { state: JSON.parse(raw) };\n },\n browserInit: ({ state }) => {\n return { client: new GraphqlClient(GQL_EXTERNAL, { cache: state })}\n },\n ReactContext: ({state, children}) =>\n <GqlContext client={state.client}>{children}</GqlContext>\n});\n")),(0,o.mdx)("h4",null,"Example: Server side Styled-components"),(0,o.mdx)("p",null,"StyledComponents extracts css from page, and adds it to the ",(0,o.mdx)("inlineCode",{parentName:"p"},"<head/>"),":"),(0,o.mdx)("pre",null,(0,o.mdx)("code",{parentName:"pre",className:"language-tsx"},".registerRenderLifecycle({\n init: () => {\n return { sheet: new ServerStyleSheet() };\n },\n serialize: (app, { sheet }) => {\n return { styles: sheet.getStyleTags() };\n };\n ReactContext: ({state, children}) =>\n <StyleSheetManager sheet={state.sheet}>{children}</StyleSheetManager>\n});\n"))))}c.isMDXComponent=!0;const p=[t],m=[e],u={compositions:[{displayName:"Logo",identifier:"Logo"}]}})(),r})()));
|
package/artifacts/schema.json
CHANGED
|
@@ -258,7 +258,7 @@
|
|
|
258
258
|
"_legacy": {
|
|
259
259
|
"scope": "teambit.ui-foundation",
|
|
260
260
|
"name": "ui",
|
|
261
|
-
"version": "1.0.
|
|
261
|
+
"version": "1.0.198"
|
|
262
262
|
},
|
|
263
263
|
"_scope": "teambit.ui-foundation"
|
|
264
264
|
}
|
|
@@ -770,7 +770,7 @@
|
|
|
770
770
|
"_legacy": {
|
|
771
771
|
"scope": "teambit.ui-foundation",
|
|
772
772
|
"name": "ui",
|
|
773
|
-
"version": "1.0.
|
|
773
|
+
"version": "1.0.198"
|
|
774
774
|
},
|
|
775
775
|
"_scope": "teambit.ui-foundation"
|
|
776
776
|
}
|
|
@@ -4944,7 +4944,7 @@
|
|
|
4944
4944
|
"_legacy": {
|
|
4945
4945
|
"scope": "teambit.ui-foundation",
|
|
4946
4946
|
"name": "ui",
|
|
4947
|
-
"version": "1.0.
|
|
4947
|
+
"version": "1.0.198"
|
|
4948
4948
|
},
|
|
4949
4949
|
"_scope": "teambit.ui-foundation"
|
|
4950
4950
|
}
|
|
@@ -5290,7 +5290,7 @@
|
|
|
5290
5290
|
"_legacy": {
|
|
5291
5291
|
"scope": "teambit.ui-foundation",
|
|
5292
5292
|
"name": "ui",
|
|
5293
|
-
"version": "1.0.
|
|
5293
|
+
"version": "1.0.198"
|
|
5294
5294
|
},
|
|
5295
5295
|
"_scope": "teambit.ui-foundation"
|
|
5296
5296
|
}
|
|
@@ -5910,7 +5910,7 @@
|
|
|
5910
5910
|
"_legacy": {
|
|
5911
5911
|
"scope": "teambit.ui-foundation",
|
|
5912
5912
|
"name": "ui",
|
|
5913
|
-
"version": "1.0.
|
|
5913
|
+
"version": "1.0.198"
|
|
5914
5914
|
},
|
|
5915
5915
|
"_scope": "teambit.ui-foundation"
|
|
5916
5916
|
}
|
|
@@ -11567,7 +11567,7 @@
|
|
|
11567
11567
|
"_legacy": {
|
|
11568
11568
|
"scope": "teambit.ui-foundation",
|
|
11569
11569
|
"name": "ui",
|
|
11570
|
-
"version": "1.0.
|
|
11570
|
+
"version": "1.0.198"
|
|
11571
11571
|
},
|
|
11572
11572
|
"_scope": "teambit.ui-foundation"
|
|
11573
11573
|
}
|
|
@@ -11582,7 +11582,7 @@
|
|
|
11582
11582
|
"componentId": {
|
|
11583
11583
|
"scope": "teambit.ui-foundation",
|
|
11584
11584
|
"name": "ui",
|
|
11585
|
-
"version": "1.0.
|
|
11585
|
+
"version": "1.0.198"
|
|
11586
11586
|
},
|
|
11587
11587
|
"taggedModuleExports": []
|
|
11588
11588
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
<!doctype html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>bit-local-
|
|
1
|
+
<!doctype html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>bit-local-6428rb3x</title><script>try{window.__REACT_DEVTOOLS_GLOBAL_HOOK__=window.parent.__REACT_DEVTOOLS_GLOBAL_HOOK__}catch{}</script><script defer="defer" src="/static/js/runtime-main.43d12281.js"></script><script defer="defer" src="/static/js/804.e878608f.js"></script><script defer="defer" src="/static/js/main.f8469d55.js"></script><link href="/static/css/804.4c207176.css" rel="stylesheet"></head><body><div id="root"></div></body></html>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
if(!self.define){const e=e=>{"require"!==e&&(e+=".js");let s=Promise.resolve();return r[e]||(s=new Promise((async s=>{if("document"in self){const r=document.createElement("script");r.src=e,document.head.appendChild(r),r.onload=s}else importScripts(e),s()}))),s.then((()=>{if(!r[e])throw new Error(`Module ${e} didn’t register its module`);return r[e]}))},s=(s,r)=>{Promise.all(s.map(e)).then((e=>r(1===e.length?e[0]:e)))},r={require:Promise.resolve(s)};self.define=(s,i,t)=>{r[s]||(r[s]=Promise.resolve().then((()=>{let r={};const n={uri:location.origin+s.slice(1)};return Promise.all(i.map((s=>{switch(s){case"exports":return r;case"module":return n;default:return e(s)}}))).then((e=>{const s=t(...e);return r.default||(r.default=s),r}))})))}}define("./service-worker.js",["./workbox-1bc97e8b"],(function(e){"use strict";self.addEventListener("message",(e=>{e.data&&"SKIP_WAITING"===e.data.type&&self.skipWaiting()})),e.clientsClaim(),e.precacheAndRoute([{url:"/index.html",revision:"
|
|
1
|
+
if(!self.define){const e=e=>{"require"!==e&&(e+=".js");let s=Promise.resolve();return r[e]||(s=new Promise((async s=>{if("document"in self){const r=document.createElement("script");r.src=e,document.head.appendChild(r),r.onload=s}else importScripts(e),s()}))),s.then((()=>{if(!r[e])throw new Error(`Module ${e} didn’t register its module`);return r[e]}))},s=(s,r)=>{Promise.all(s.map(e)).then((e=>r(1===e.length?e[0]:e)))},r={require:Promise.resolve(s)};self.define=(s,i,t)=>{r[s]||(r[s]=Promise.resolve().then((()=>{let r={};const n={uri:location.origin+s.slice(1)};return Promise.all(i.map((s=>{switch(s){case"exports":return r;case"module":return n;default:return e(s)}}))).then((e=>{const s=t(...e);return r.default||(r.default=s),r}))})))}}define("./service-worker.js",["./workbox-1bc97e8b"],(function(e){"use strict";self.addEventListener("message",(e=>{e.data&&"SKIP_WAITING"===e.data.type&&self.skipWaiting()})),e.clientsClaim(),e.precacheAndRoute([{url:"/index.html",revision:"b4cc5bd4d2bef28677e17302be5fdaa6"},{url:"/static/css/804.4c207176.css",revision:null},{url:"/static/fonts/ade705761eb7e702770d.ttf",revision:null},{url:"/static/js/804.e878608f.js.LICENSE.txt",revision:"aeb96ab8550d7551961008bf135f0f71"},{url:"/static/js/main.f8469d55.js",revision:null},{url:"/static/js/runtime-main.43d12281.js",revision:null}],{}),e.registerRoute(new e.NavigationRoute(e.createHandlerBoundToURL("public/index.html"),{denylist:[/^\/_/,/\/[^/?]+\.[^/]+$/]}))}));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"service-worker.js","sources":["../../../../tmp/
|
|
1
|
+
{"version":3,"file":"service-worker.js","sources":["../../../../tmp/0d07344af475635353ff5cf6732655eb/service-worker.js"],"sourcesContent":["import {clientsClaim as workbox_core_clientsClaim} from '/home/circleci/bit/bit/node_modules/.pnpm/workbox-core@6.2.4/node_modules/workbox-core/clientsClaim.mjs';\nimport {precacheAndRoute as workbox_precaching_precacheAndRoute} from '/home/circleci/bit/bit/node_modules/.pnpm/workbox-precaching@6.2.4/node_modules/workbox-precaching/precacheAndRoute.mjs';\nimport {registerRoute as workbox_routing_registerRoute} from '/home/circleci/bit/bit/node_modules/.pnpm/workbox-routing@6.2.4/node_modules/workbox-routing/registerRoute.mjs';\nimport {NavigationRoute as workbox_routing_NavigationRoute} from '/home/circleci/bit/bit/node_modules/.pnpm/workbox-routing@6.2.4/node_modules/workbox-routing/NavigationRoute.mjs';\nimport {createHandlerBoundToURL as workbox_precaching_createHandlerBoundToURL} from '/home/circleci/bit/bit/node_modules/.pnpm/workbox-precaching@6.2.4/node_modules/workbox-precaching/createHandlerBoundToURL.mjs';/**\n * Welcome to your Workbox-powered service worker!\n *\n * You'll need to register this file in your web app.\n * See https://goo.gl/nhQhGp\n *\n * The rest of the code is auto-generated. Please don't update this file\n * directly; instead, make changes to your Workbox build configuration\n * and re-run your build process.\n * See https://goo.gl/2aRDsh\n */\n\n\n\n\n\n\n\n\nself.addEventListener('message', (event) => {\n if (event.data && event.data.type === 'SKIP_WAITING') {\n self.skipWaiting();\n }\n});\n\nworkbox_core_clientsClaim();\n\n\n/**\n * The precacheAndRoute() method efficiently caches and responds to\n * requests for URLs in the manifest.\n * See https://goo.gl/S9QRab\n */\nworkbox_precaching_precacheAndRoute([\n {\n \"url\": \"/public/ssr/static/css/main.921e91f2.css\",\n \"revision\": null\n },\n {\n \"url\": \"/public/ssr/static/fonts/ade705761eb7e702770d.ttf\",\n \"revision\": null\n }\n], {});\n\nworkbox_routing_registerRoute(new workbox_routing_NavigationRoute(workbox_precaching_createHandlerBoundToURL(\"public/index.html\"), {\n \n denylist: [/^\\/_/,/\\/[^/?]+\\.[^/]+$/],\n}));\n\n\n\n\n\n\n"],"names":["self","addEventListener","event","data","type","skipWaiting","workbox_core_clientsClaim","workbox_precaching_precacheAndRoute","url","revision","workbox","registerRoute","workbox_routing_NavigationRoute","NavigationRoute","workbox_precaching_createHandlerBoundToURL","denylist"],"mappings":"szBAuBAA,KAAKC,iBAAiB,WAAYC,IAC5BA,EAAMC,MAA4B,iBAApBD,EAAMC,KAAKC,MAC3BJ,KAAKK,aACP,IAGFC,EAAAA,eAQAC,EAAAA,iBAAoC,CAClC,CACEC,IAAO,2CACPC,SAAY,MAEd,CACED,IAAO,oDACPC,SAAY,OAEb,CAAE,GAEwBC,EAAAC,cAAC,IAAIC,EAA+BC,gBAACC,0BAA2C,qBAAsB,CAEjIC,SAAU,CAAC,OAAO"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.ui-foundation_ui@1.0.
|
|
2
|
-
import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.ui-foundation_ui@1.0.
|
|
1
|
+
import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.ui-foundation_ui@1.0.198/dist/ui.composition.js';
|
|
2
|
+
import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.ui-foundation_ui@1.0.198/dist/ui.docs.mdx';
|
|
3
3
|
|
|
4
4
|
export const compositions = [compositions_0];
|
|
5
5
|
export const overview = [overview_0];
|
package/dist/start.cmd.js
CHANGED
|
@@ -86,11 +86,11 @@ class StartCmd {
|
|
|
86
86
|
verbose
|
|
87
87
|
});
|
|
88
88
|
uiServer.then(async server => {
|
|
89
|
-
if (!server.buildOptions?.launchBrowserOnStart) return undefined;
|
|
90
89
|
const url = this.ui.publicUrl || server.fullUrl;
|
|
91
90
|
spinnies.succeed('ui-server', {
|
|
92
91
|
text: `UI server is ready at ${_chalk().default.cyan(url)}`
|
|
93
92
|
});
|
|
93
|
+
if (!server.buildOptions?.launchBrowserOnStart) return undefined;
|
|
94
94
|
await server.whenReady;
|
|
95
95
|
const name = server.getName();
|
|
96
96
|
const message = _chalk().default.green(`You can now view '${_chalk().default.cyan(name)}' components in the browser.
|
package/dist/start.cmd.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_bitError","data","require","_constants","_openBrowser","_interopRequireDefault","_chalk","obj","__esModule","default","_defineProperty","key","value","_toPropertyKey","Object","defineProperty","enumerable","configurable","writable","t","i","_toPrimitive","String","r","e","Symbol","toPrimitive","call","TypeError","Number","StartCmd","constructor","ui","logger","name","description","COMPONENT_PATTERN_HELP","wait","userPattern","dev","port","rebuild","verbose","noBrowser","skipCompilation","skipUiBuild","uiRootName","uiRootAspectIdOrName","spinnies","multiSpinner","isHostAvailable","BitError","appName","getUiName","invokePreStart","off","add","text","uiServer","createRuntime","pattern","then","server","
|
|
1
|
+
{"version":3,"names":["_bitError","data","require","_constants","_openBrowser","_interopRequireDefault","_chalk","obj","__esModule","default","_defineProperty","key","value","_toPropertyKey","Object","defineProperty","enumerable","configurable","writable","t","i","_toPrimitive","String","r","e","Symbol","toPrimitive","call","TypeError","Number","StartCmd","constructor","ui","logger","name","description","COMPONENT_PATTERN_HELP","wait","userPattern","dev","port","rebuild","verbose","noBrowser","skipCompilation","skipUiBuild","uiRootName","uiRootAspectIdOrName","spinnies","multiSpinner","isHostAvailable","BitError","appName","getUiName","invokePreStart","off","add","text","uiServer","createRuntime","pattern","then","server","url","publicUrl","fullUrl","succeed","chalk","cyan","buildOptions","launchBrowserOnStart","undefined","whenReady","getName","message","green","status","openBrowser","catch","error","invokeOnStart","clearConsole","exports"],"sources":["start.cmd.tsx"],"sourcesContent":["import { BitError } from '@teambit/bit-error';\nimport { Command, CommandOptions } from '@teambit/cli';\nimport { COMPONENT_PATTERN_HELP } from '@teambit/legacy/dist/constants';\nimport { Logger } from '@teambit/logger';\nimport openBrowser from 'react-dev-utils/openBrowser';\nimport chalk from 'chalk';\nimport type { UiMain } from './ui.main.runtime';\n\ntype StartArgs = [userPattern: string];\ntype StartFlags = {\n dev: boolean;\n port: string;\n rebuild: boolean;\n verbose: boolean;\n noBrowser: boolean;\n skipCompilation: boolean;\n skipUiBuild: boolean;\n uiRootName: string;\n};\n\nexport class StartCmd implements Command {\n name = 'start [component-pattern]';\n description = 'run the ui/development server';\n arguments = [\n {\n name: 'component-pattern',\n description: COMPONENT_PATTERN_HELP,\n },\n ];\n alias = 'c';\n group = 'development';\n options = [\n ['d', 'dev', 'start UI server in dev mode.'],\n ['p', 'port [port-number]', 'port of the UI server.'],\n [\n 'r',\n 'rebuild',\n 'rebuild the UI (useful e.g. when updating the workspace UI - can use the dev flag for HMR in this case)',\n ],\n ['', 'skip-ui-build', 'skip building UI'],\n ['v', 'verbose', 'show verbose output for inspection and prints stack trace'],\n ['n', 'no-browser', 'do not automatically open browser when ready'],\n ['', 'skip-compilation', 'skip the auto-compilation before starting the web-server'],\n [\n 'u',\n 'ui-root-name [type]',\n 'name of the ui root to use, e.g. \"teambit.scope/scope\" or \"teambit.workspace/workspace\"',\n ],\n ] as CommandOptions;\n\n constructor(\n /**\n * access to the extension instance.\n */\n private ui: UiMain,\n\n private logger: Logger\n ) {}\n\n async wait(\n [userPattern]: StartArgs,\n {\n dev,\n port,\n rebuild,\n verbose,\n noBrowser,\n skipCompilation,\n skipUiBuild,\n uiRootName: uiRootAspectIdOrName,\n }: StartFlags\n ) {\n const spinnies = this.logger.multiSpinner;\n\n if (!this.ui.isHostAvailable()) {\n throw new BitError(\n `bit start can only be run inside a bit workspace or a bit scope - please ensure you are running the command in the correct directory`\n );\n }\n const appName = this.ui.getUiName(uiRootAspectIdOrName);\n await this.ui.invokePreStart({ skipCompilation });\n this.logger.off();\n spinnies.add('ui-server', { text: `Starting UI server for ${appName}` });\n\n const uiServer = this.ui.createRuntime({\n uiRootAspectIdOrName,\n skipUiBuild,\n pattern: userPattern,\n dev,\n port: +port,\n rebuild,\n verbose,\n });\n\n uiServer\n .then(async (server) => {\n const url = this.ui.publicUrl || server.fullUrl;\n spinnies.succeed('ui-server', { text: `UI server is ready at ${chalk.cyan(url)}` });\n if (!server.buildOptions?.launchBrowserOnStart) return undefined;\n\n await server.whenReady;\n const name = server.getName();\n const message = chalk.green(`You can now view '${chalk.cyan(name)}' components in the browser.\nBit server is running on ${chalk.cyan(url)}`);\n spinnies.add('summary', { text: message, status: 'non-spinnable' });\n if (!noBrowser) {\n openBrowser(url);\n }\n return undefined;\n })\n .catch((error) => this.logger.error(error));\n\n // DO NOT CHANGE THIS - this meant to be an async hook.\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n this.ui.invokeOnStart();\n this.ui.clearConsole();\n }\n}\n"],"mappings":";;;;;;AAAA,SAAAA,UAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,SAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAE,WAAA;EAAA,MAAAF,IAAA,GAAAC,OAAA;EAAAC,UAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAG,aAAA;EAAA,MAAAH,IAAA,GAAAI,sBAAA,CAAAH,OAAA;EAAAE,YAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA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QAAA,GAAAA,QAAA","ignoreList":[]}
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@teambit/ui",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.198",
|
|
4
4
|
"homepage": "https://bit.cloud/teambit/ui-foundation/ui",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"componentId": {
|
|
7
7
|
"scope": "teambit.ui-foundation",
|
|
8
8
|
"name": "ui",
|
|
9
|
-
"version": "1.0.
|
|
9
|
+
"version": "1.0.198"
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"chalk": "2.4.2",
|
|
@@ -57,24 +57,24 @@
|
|
|
57
57
|
"@teambit/design.themes.theme-toggler": "0.1.3",
|
|
58
58
|
"@teambit/design.ui.tooltip": "0.0.361",
|
|
59
59
|
"@teambit/ui-foundation.ui.global-loader": "0.0.502",
|
|
60
|
-
"@teambit/builder": "1.0.
|
|
61
|
-
"@teambit/isolator": "1.0.
|
|
60
|
+
"@teambit/builder": "1.0.198",
|
|
61
|
+
"@teambit/isolator": "1.0.198",
|
|
62
62
|
"@teambit/logger": "0.0.950",
|
|
63
63
|
"@teambit/cli": "0.0.857",
|
|
64
|
-
"@teambit/aspect-loader": "1.0.
|
|
65
|
-
"@teambit/bundler": "1.0.
|
|
66
|
-
"@teambit/component": "1.0.
|
|
64
|
+
"@teambit/aspect-loader": "1.0.198",
|
|
65
|
+
"@teambit/bundler": "1.0.198",
|
|
66
|
+
"@teambit/component": "1.0.198",
|
|
67
67
|
"@teambit/express": "0.0.956",
|
|
68
|
-
"@teambit/graphql": "1.0.
|
|
68
|
+
"@teambit/graphql": "1.0.198",
|
|
69
69
|
"@teambit/toolbox.network.get-port": "1.0.6",
|
|
70
|
-
"@teambit/aspect": "1.0.
|
|
70
|
+
"@teambit/aspect": "1.0.198",
|
|
71
71
|
"@teambit/cache": "0.0.950",
|
|
72
72
|
"@teambit/harmony.modules.harmony-root-generator": "0.0.4",
|
|
73
|
-
"@teambit/pubsub": "1.0.
|
|
74
|
-
"@teambit/react-router": "1.0.
|
|
73
|
+
"@teambit/pubsub": "1.0.198",
|
|
74
|
+
"@teambit/react-router": "1.0.198",
|
|
75
75
|
"@teambit/webpack.modules.generate-style-loaders": "1.0.11",
|
|
76
76
|
"@teambit/webpack.modules.style-regexps": "1.0.6",
|
|
77
|
-
"@teambit/webpack": "1.0.
|
|
77
|
+
"@teambit/webpack": "1.0.198"
|
|
78
78
|
},
|
|
79
79
|
"devDependencies": {
|
|
80
80
|
"@types/react-dev-utils": "9.0.10",
|
package/start.cmd.tsx
CHANGED
|
@@ -94,10 +94,10 @@ export class StartCmd implements Command {
|
|
|
94
94
|
|
|
95
95
|
uiServer
|
|
96
96
|
.then(async (server) => {
|
|
97
|
-
if (!server.buildOptions?.launchBrowserOnStart) return undefined;
|
|
98
97
|
const url = this.ui.publicUrl || server.fullUrl;
|
|
99
|
-
|
|
100
98
|
spinnies.succeed('ui-server', { text: `UI server is ready at ${chalk.cyan(url)}` });
|
|
99
|
+
if (!server.buildOptions?.launchBrowserOnStart) return undefined;
|
|
100
|
+
|
|
101
101
|
await server.whenReady;
|
|
102
102
|
const name = server.getName();
|
|
103
103
|
const message = chalk.green(`You can now view '${chalk.cyan(name)}' components in the browser.
|