@teambit/ui 0.0.802 → 0.0.803
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/dist/index.d.ts +12 -5
- package/dist/index.js.map +1 -1
- package/dist/ssr-middleware/ssr-middleware.d.ts +2 -2
- package/dist/ssr-middleware/ssr-middleware.js +19 -17
- package/dist/ssr-middleware/ssr-middleware.js.map +1 -1
- package/dist/ui-root.d.ts +3 -3
- package/dist/ui-root.js.map +1 -1
- package/dist/ui.main.runtime.js +1 -1
- package/dist/ui.main.runtime.js.map +1 -1
- package/dist/ui.ui.runtime.d.ts +4 -5
- package/dist/ui.ui.runtime.js +27 -17
- package/dist/ui.ui.runtime.js.map +1 -1
- package/package-tar/teambit-ui-0.0.803.tgz +0 -0
- package/package.json +19 -22
- package/{preview-1659151732866.js → preview-1659271062546.js} +2 -2
- package/ssr-middleware/ssr-middleware.ts +14 -15
- package/ui-root.tsx +7 -3
- package/ui.ui.runtime.tsx +21 -18
- package/dist/react-ssr/index.d.ts +0 -5
- package/dist/react-ssr/index.js +0 -23
- package/dist/react-ssr/index.js.map +0 -1
- package/dist/react-ssr/react-ssr.d.ts +0 -21
- package/dist/react-ssr/react-ssr.js +0 -285
- package/dist/react-ssr/react-ssr.js.map +0 -1
- package/dist/react-ssr/render-lifecycle.d.ts +0 -56
- package/dist/react-ssr/render-lifecycle.js +0 -3
- package/dist/react-ssr/render-lifecycle.js.map +0 -1
- package/dist/react-ssr/request-browser.d.ts +0 -56
- package/dist/react-ssr/request-browser.js +0 -3
- package/dist/react-ssr/request-browser.js.map +0 -1
- package/dist/react-ssr/request-server.d.ts +0 -9
- package/dist/react-ssr/request-server.js +0 -3
- package/dist/react-ssr/request-server.js.map +0 -1
- package/dist/react-ssr/ssr-content.d.ts +0 -8
- package/dist/react-ssr/ssr-content.js +0 -3
- package/dist/react-ssr/ssr-content.js.map +0 -1
- package/dist/ssr-middleware/extract-browser-data.d.ts +0 -6
- package/dist/ssr-middleware/extract-browser-data.js +0 -35
- package/dist/ssr-middleware/extract-browser-data.js.map +0 -1
- package/package-tar/teambit-ui-0.0.802.tgz +0 -0
- package/react-ssr/index.ts +0 -6
- package/react-ssr/react-ssr.tsx +0 -183
- package/react-ssr/render-lifecycle.tsx +0 -58
- package/react-ssr/request-browser.ts +0 -55
- package/react-ssr/request-server.ts +0 -10
- package/react-ssr/ssr-content.ts +0 -9
- package/ssr-middleware/extract-browser-data.ts +0 -31
package/dist/index.d.ts
CHANGED
|
@@ -1,14 +1,21 @@
|
|
|
1
|
-
import
|
|
2
|
-
export { UIAspect, UIRuntime, UIAspect as default };
|
|
1
|
+
import type * as SSR from '@teambit/react.rendering.ssr';
|
|
2
|
+
export { UIAspect, UIRuntime, UIAspect as default } from './ui.aspect';
|
|
3
3
|
export * from './events';
|
|
4
4
|
export { UIRoot, PostStartOptions, ProxyEntry } from './ui-root';
|
|
5
5
|
export type { UiMain, PreStartOpts } from './ui.main.runtime';
|
|
6
6
|
export type { UiUI } from './ui.ui.runtime';
|
|
7
7
|
export type { StartPlugin, StartPluginOptions } from './start-plugin';
|
|
8
|
-
export type {
|
|
9
|
-
/** @deprecated - legacy name, use RenderPlugins */
|
|
10
|
-
RenderPlugins as RenderLifecycle, } from './react-ssr';
|
|
8
|
+
export type { SSR };
|
|
11
9
|
export type { UIRootUI, UIRootFactory } from './ui-root.ui';
|
|
12
10
|
export type { UIServer } from './ui-server';
|
|
13
11
|
export { DataQueryResult, useDataQuery } from '@teambit/ui-foundation.ui.hooks.use-data-query';
|
|
14
12
|
export { useMutation } from '@apollo/client';
|
|
13
|
+
export type {
|
|
14
|
+
/** @deprecated - use SSR.BrowserData */
|
|
15
|
+
BrowserData,
|
|
16
|
+
/** @deprecated - use SSR.RenderPlugin */
|
|
17
|
+
RenderPlugin,
|
|
18
|
+
/** @deprecated use SSR.RenderPlugin */
|
|
19
|
+
RenderPlugin as RenderPlugins,
|
|
20
|
+
/** @deprecated use SSR..RenderPlugin */
|
|
21
|
+
RenderPlugin as RenderLifecycle, } from '@teambit/react.rendering.ssr';
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["import type * as SSR from '@teambit/react.rendering.ssr';\n\nexport { UIAspect, UIRuntime, UIAspect as default } from './ui.aspect';\n\nexport * from './events';\nexport { UIRoot, PostStartOptions, ProxyEntry } from './ui-root';\nexport type { UiMain, PreStartOpts } from './ui.main.runtime';\nexport type { UiUI } from './ui.ui.runtime';\nexport type { StartPlugin, StartPluginOptions } from './start-plugin';\nexport type { SSR };\n\nexport type { UIRootUI, UIRootFactory } from './ui-root.ui';\nexport type { UIServer } from './ui-server';\n\n// using `useDataQuery` from this package is deprecated, use `@teambit/ui-foundation.ui.hooks.use-data-query` directly\nexport { DataQueryResult, useDataQuery } from '@teambit/ui-foundation.ui.hooks.use-data-query';\n// temporary. TODO: fix this\nexport { useMutation } from '@apollo/client';\n\n// some types still used by Symphony\nexport type {\n /** @deprecated - use SSR.BrowserData */\n BrowserData,\n /** @deprecated - use SSR.RenderPlugin */\n RenderPlugin,\n /** @deprecated use SSR.RenderPlugin */\n RenderPlugin as RenderPlugins,\n /** @deprecated use SSR..RenderPlugin */\n RenderPlugin as RenderLifecycle,\n} from '@teambit/react.rendering.ssr';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAEA;;AAAA;EAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAUA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAEA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { Request, Response, NextFunction } from 'express';
|
|
2
1
|
import type { Logger } from '@teambit/logger';
|
|
2
|
+
import type { Request, Response, NextFunction } from 'express';
|
|
3
3
|
declare type ssrRenderProps = {
|
|
4
4
|
root: string;
|
|
5
5
|
port: number;
|
|
6
6
|
title: string;
|
|
7
7
|
logger: Logger;
|
|
8
8
|
};
|
|
9
|
-
export declare function createSsrMiddleware({ root, port, title, logger }: ssrRenderProps): Promise<((
|
|
9
|
+
export declare function createSsrMiddleware({ root, port, title, logger }: ssrRenderProps): Promise<((request: Request, response: Response, next: NextFunction) => Promise<void>) | undefined>;
|
|
10
10
|
export {};
|
|
@@ -19,30 +19,30 @@ function _defineProperty2() {
|
|
|
19
19
|
return data;
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
-
function
|
|
23
|
-
const data =
|
|
22
|
+
function _reactRendering() {
|
|
23
|
+
const data = require("@teambit/react.rendering.ssr");
|
|
24
24
|
|
|
25
|
-
|
|
25
|
+
_reactRendering = function () {
|
|
26
26
|
return data;
|
|
27
27
|
};
|
|
28
28
|
|
|
29
29
|
return data;
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
-
function
|
|
33
|
-
const data =
|
|
32
|
+
function _path() {
|
|
33
|
+
const data = _interopRequireDefault(require("path"));
|
|
34
34
|
|
|
35
|
-
|
|
35
|
+
_path = function () {
|
|
36
36
|
return data;
|
|
37
37
|
};
|
|
38
38
|
|
|
39
39
|
return data;
|
|
40
40
|
}
|
|
41
41
|
|
|
42
|
-
function
|
|
43
|
-
const data = require("
|
|
42
|
+
function fs() {
|
|
43
|
+
const data = _interopRequireWildcard(require("fs-extra"));
|
|
44
44
|
|
|
45
|
-
|
|
45
|
+
fs = function () {
|
|
46
46
|
return data;
|
|
47
47
|
};
|
|
48
48
|
|
|
@@ -77,12 +77,12 @@ async function createSsrMiddleware({
|
|
|
77
77
|
title
|
|
78
78
|
});
|
|
79
79
|
|
|
80
|
-
return async function serverRenderMiddleware(
|
|
80
|
+
return async function serverRenderMiddleware(request, response, next) {
|
|
81
81
|
const {
|
|
82
82
|
query,
|
|
83
83
|
url
|
|
84
|
-
} =
|
|
85
|
-
const browser = (0,
|
|
84
|
+
} = request;
|
|
85
|
+
const browser = (0, _reactRendering().browserFromExpress)(request, port);
|
|
86
86
|
|
|
87
87
|
if (denyList.test(url)) {
|
|
88
88
|
logger.debug(`[ssr] skipping static denyList file ${url}`);
|
|
@@ -96,22 +96,24 @@ async function createSsrMiddleware({
|
|
|
96
96
|
return;
|
|
97
97
|
}
|
|
98
98
|
|
|
99
|
-
logger.debug(`[ssr] ${
|
|
99
|
+
logger.debug(`[ssr] ${request.method} ${url}`);
|
|
100
100
|
const server = {
|
|
101
101
|
port,
|
|
102
|
-
request
|
|
103
|
-
response
|
|
102
|
+
request,
|
|
103
|
+
response
|
|
104
104
|
};
|
|
105
105
|
const props = {
|
|
106
106
|
assets,
|
|
107
107
|
browser,
|
|
108
|
+
request,
|
|
109
|
+
response,
|
|
108
110
|
server
|
|
109
111
|
};
|
|
110
112
|
|
|
111
113
|
try {
|
|
112
114
|
const rendered = await render(props);
|
|
113
|
-
|
|
114
|
-
|
|
115
|
+
response.set('Cache-Control', 'no-cache');
|
|
116
|
+
response.send(rendered);
|
|
115
117
|
logger.debug(`[ssr] success '${url}'`);
|
|
116
118
|
} catch (e) {
|
|
117
119
|
logger.error(`[ssr] failed at '${url}'`, e);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["denyList","createSsrMiddleware","root","port","title","logger","runtime","loadRuntime","undefined","render","assets","serverRenderMiddleware","
|
|
1
|
+
{"version":3,"names":["denyList","createSsrMiddleware","root","port","title","logger","runtime","loadRuntime","undefined","render","assets","serverRenderMiddleware","request","response","next","query","url","browser","browserFromExpress","test","debug","rendering","method","server","props","rendered","set","send","e","error","entryFilepath","path","join","fs","existsSync","warn","manifestFilepath","parseManifest","imported","filepath","file","readFile","contents","toString","parsed","JSON","parse","getAssets","process","exit","manifest","css","js","entrypoints","filter","x","endsWith","map"],"sources":["ssr-middleware.ts"],"sourcesContent":["import { browserFromExpress } from '@teambit/react.rendering.ssr';\nimport type { HtmlAssets, SsrSession } from '@teambit/react.rendering.ssr';\nimport type { Logger } from '@teambit/logger';\nimport type { Request, Response, NextFunction } from 'express';\nimport path from 'path';\nimport * as fs from 'fs-extra';\n\nconst denyList = /^\\/favicon.ico$/;\n\ntype ssrRenderProps = {\n root: string;\n port: number;\n title: string;\n logger: Logger;\n};\n\ntype ManifestFile = {\n files?: Record<string, string>;\n entrypoints?: string[];\n};\n\nexport async function createSsrMiddleware({ root, port, title, logger }: ssrRenderProps) {\n const runtime = await loadRuntime(root, { logger });\n if (!runtime) return undefined;\n\n const { render } = runtime;\n const assets = { ...runtime.assets, title };\n\n return async function serverRenderMiddleware(request: Request, response: Response, next: NextFunction) {\n const { query, url } = request;\n\n const browser = browserFromExpress(request, port);\n\n if (denyList.test(url)) {\n logger.debug(`[ssr] skipping static denyList file ${url}`);\n next();\n return;\n }\n\n if (query.rendering === 'client') {\n logger.debug(`[ssr] skipping ${url}`);\n next();\n return;\n }\n\n logger.debug(`[ssr] ${request.method} ${url}`);\n const server = { port, request, response };\n const props: SsrSession = { assets, browser, request, response, server };\n\n try {\n const rendered = await render(props);\n response.set('Cache-Control', 'no-cache');\n response.send(rendered);\n logger.debug(`[ssr] success '${url}'`);\n } catch (e: any) {\n logger.error(`[ssr] failed at '${url}'`, e);\n next();\n }\n };\n}\n\nasync function loadRuntime(root: string, { logger }: { logger: Logger }) {\n let render: (...arg: any[]) => any;\n let assets: HtmlAssets | undefined;\n\n try {\n const entryFilepath = path.join(root, 'ssr', 'index.js');\n if (!fs.existsSync(entryFilepath)) {\n logger.warn(`[ssr] - Skipping setup - failed finding ssr bundle at \"${entryFilepath}\"`);\n return undefined;\n }\n\n const manifestFilepath = path.join(root, 'asset-manifest.json');\n if (!fs.existsSync(manifestFilepath)) {\n logger.warn('[ssr] - Skipping setup (cannot find asset manifest file)');\n return undefined;\n }\n\n assets = await parseManifest(manifestFilepath);\n if (!assets) {\n logger.warn('[ssr] - Skipping setup (failed parsing assets manifest)');\n return undefined;\n }\n\n const imported = await import(entryFilepath);\n render = imported?.render;\n\n if (!render || typeof render !== 'function') {\n logger.warn('[ssr] - index file does not export a render() function. Skipping setup.');\n return undefined;\n }\n } catch (e: any) {\n logger.error(e);\n return undefined;\n }\n\n return {\n render,\n assets,\n };\n}\n\nasync function parseManifest(filepath: string, logger?: Logger) {\n try {\n const file = await fs.readFile(filepath);\n logger?.debug('[ssr] - ✓ aread manifest file');\n const contents = file.toString();\n const parsed: ManifestFile = JSON.parse(contents);\n logger?.debug('[ssr] - ✓ prased manifest file', parsed);\n const assets = getAssets(parsed);\n logger?.debug('[ssr] - ✓ extracted data from manifest file', assets);\n\n return assets;\n } catch (e: any) {\n logger?.error('[ssr] - error parsing asset manifest', e);\n process.exit();\n return undefined;\n }\n}\n\nfunction getAssets(manifest: ManifestFile) {\n const assets: HtmlAssets = { css: [], js: [] };\n\n assets.css = manifest.entrypoints?.filter((x) => x.endsWith('css')).map((x) => path.join('/', x));\n assets.js = manifest.entrypoints?.filter((x) => x.endsWith('js')).map((x) => path.join('/', x));\n\n return assets;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAIA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;;;;;;;;;AAEA,MAAMA,QAAQ,GAAG,iBAAjB;;AAcO,eAAeC,mBAAf,CAAmC;EAAEC,IAAF;EAAQC,IAAR;EAAcC,KAAd;EAAqBC;AAArB,CAAnC,EAAkF;EACvF,MAAMC,OAAO,GAAG,MAAMC,WAAW,CAACL,IAAD,EAAO;IAAEG;EAAF,CAAP,CAAjC;EACA,IAAI,CAACC,OAAL,EAAc,OAAOE,SAAP;EAEd,MAAM;IA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CAAU,GAAV,EAAeuB,CAAf,CAAjE,CAAZ;EAEA,OAAO7C,MAAP;AACD"}
|
package/dist/ui-root.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { AspectDefinition } from '@teambit/aspect-loader';
|
|
2
2
|
import { ComponentDir } from '@teambit/bundler';
|
|
3
|
-
import { Component } from '@teambit/component';
|
|
3
|
+
import { Component, ComponentID, ResolveAspectsOptions } from '@teambit/component';
|
|
4
4
|
import { ProxyConfigArrayItem } from 'webpack-dev-server';
|
|
5
5
|
export interface UIRoot extends ComponentDir {
|
|
6
6
|
/**
|
|
@@ -20,9 +20,9 @@ export interface UIRoot extends ComponentDir {
|
|
|
20
20
|
launchBrowserOnStart?: boolean;
|
|
21
21
|
};
|
|
22
22
|
/**
|
|
23
|
-
* resolve
|
|
23
|
+
* resolve aspects in the UI root. (resolve all if componentIds not provided)
|
|
24
24
|
*/
|
|
25
|
-
resolveAspects(runtimeName: string): Promise<AspectDefinition[]>;
|
|
25
|
+
resolveAspects(runtimeName: string, componentIds?: ComponentID[], opts?: ResolveAspectsOptions): Promise<AspectDefinition[]>;
|
|
26
26
|
/**
|
|
27
27
|
* resolve components from a given pattern.
|
|
28
28
|
*/
|
package/dist/ui-root.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["ui-root.tsx"],"sourcesContent":["import { AspectDefinition } from '@teambit/aspect-loader';\nimport { ComponentDir } from '@teambit/bundler';\nimport { Component } from '@teambit/component';\nimport { ProxyConfigArrayItem } from 'webpack-dev-server';\n\n// TODO: remove this extends \"ComponentDir\", this should be part of the workspace alone since scope\n// would never have componentDir and as it has nothing to do with `UIRoot`.\nexport interface UIRoot extends ComponentDir {\n /**\n * unique name of the ui.\n */\n name: string;\n\n /**\n * path of the ui root.\n */\n path: string;\n\n /**\n * name of the UI root config file.\n */\n configFile: string;\n\n buildOptions?: {\n ssr?: boolean;\n launchBrowserOnStart?: boolean;\n };\n\n /**\n * resolve
|
|
1
|
+
{"version":3,"names":[],"sources":["ui-root.tsx"],"sourcesContent":["import { AspectDefinition } from '@teambit/aspect-loader';\nimport { ComponentDir } from '@teambit/bundler';\nimport { Component, ComponentID, ResolveAspectsOptions } from '@teambit/component';\nimport { ProxyConfigArrayItem } from 'webpack-dev-server';\n\n// TODO: remove this extends \"ComponentDir\", this should be part of the workspace alone since scope\n// would never have componentDir and as it has nothing to do with `UIRoot`.\nexport interface UIRoot extends ComponentDir {\n /**\n * unique name of the ui.\n */\n name: string;\n\n /**\n * path of the ui root.\n */\n path: string;\n\n /**\n * name of the UI root config file.\n */\n configFile: string;\n\n buildOptions?: {\n ssr?: boolean;\n launchBrowserOnStart?: boolean;\n };\n\n /**\n * resolve aspects in the UI root. (resolve all if componentIds not provided)\n */\n resolveAspects(\n runtimeName: string,\n componentIds?: ComponentID[],\n opts?: ResolveAspectsOptions\n ): Promise<AspectDefinition[]>;\n\n /**\n * resolve components from a given pattern.\n */\n resolvePattern?(pattern: string): Promise<Component[]>;\n\n /**\n * listener for when the dev server starts. can be used for running the watcher.\n */\n postStart?(options: PostStartOptions): Promise<void>;\n\n /**\n * determine whether UI should get a priority.\n */\n priority?: boolean;\n}\n\nexport type ProxyEntry = ProxyConfigArrayItem & {\n context: string[]; // limit type to simplify our code. (not required)\n};\n\nexport type PostStartOptions = {\n /**\n * pattern for selecting components in the container.\n */\n pattern?: string;\n};\n"],"mappings":""}
|
package/dist/ui.main.runtime.js
CHANGED
|
@@ -579,7 +579,7 @@ class UiMain {
|
|
|
579
579
|
|
|
580
580
|
async generateRoot(aspectDefs, rootExtensionName, runtimeName = _ui().UIRuntime.name, rootAspect = _ui().UIAspect.id, config) {
|
|
581
581
|
const contents = await (0, _createRoot().createRoot)(aspectDefs, rootExtensionName, rootAspect, runtimeName, config || this.harmony.config.toObject());
|
|
582
|
-
const filepath = (0, _path().resolve)((0, _path().join)(__dirname, `${runtimeName}.root
|
|
582
|
+
const filepath = (0, _path().resolve)((0, _path().join)(__dirname, `${runtimeName}.root.${(0, _utils().sha1)(contents)}.js`));
|
|
583
583
|
if (_fsExtra().default.existsSync(filepath)) return filepath;
|
|
584
584
|
|
|
585
585
|
_fsExtra().default.outputFileSync(filepath, contents);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["UiMain","constructor","pubsub","config","graphql","uiRootSlot","express","preStartSlot","onStartSlot","publicDirOverwriteSlot","buildMethodOverwriteSlot","componentExtension","cache","logger","harmony","startPluginSlot","targetHost","targetPort","uiRoot","UiServerStartedEvent","Date","now","publicDir","overwriteFn","getOverwritePublic","hasDir","startsWith","substring","getUiByName","name","roots","toArray","root","find","build","uiRootName","debug","maybeUiRoot","getUi","UnknownUI","possibleUis","ssr","buildOptions","mainEntry","generateRoot","resolveAspects","UIRuntime","browserConfig","createWebpackConfig","path","ssrConfig","createSsrWebpackConfig","filter","x","compiler","webpack","compilerRun","promisify","run","bind","results","UnknownBuildError","hasErrors","clearConsole","Error","toString","registerStartPlugin","startPlugin","register","initiatePlugins","options","plugins","values","Promise","all","map","plugin","initiate","createRuntime","pattern","dev","port","rebuild","verbose","isHost","setHostPriority","uiServer","UIServer","create","uiRootExtension","ui","startPlugins","addSignalListener","portRange","buildUI","start","pub","UIAspect","id","createUiServerStartedEvent","host","process","on","exit","getPort","selectPort","registerPreStart","preStartFn","registerOnStart","onStartFn","registerBuildUIOverwrite","fn","registerPublicDirOverwrite","getOverwriteBuildFn","buildMethodOverwrite","undefined","overwritePublic","invokePreStart","preStartOpts","promises","invokeOnStart","registerUiRoot","get","uis","length","priority","isHostAvailable","Boolean","getHost","getUiName","createLink","aspectDefs","rootExtensionName","createRoot","runtimeName","rootAspect","contents","toObject","filepath","resolve","join","__dirname","sha1","fs","existsSync","outputFileSync","from","to","usedPorts","Port","set","concat","overwrite","hash","buildIfChanged","buildIfNoBundle","buildUiHash","runtime","aspects","sort","a","b","aspectPath","aspect","runtimePath","force","hashed","console","chalk","cyan","configFile","stdout","write","platform","output","pathExistsSync","publicUrl","provider","cli","loggerMain","proxyGetterSlot","createLogger","StartCmd","UIBuildCmd","MainRuntime","PubsubAspect","CLIAspect","GraphqlAspect","ExpressAspect","ComponentAspect","CacheAspect","LoggerAspect","Slot","withType","addRuntime"],"sources":["ui.main.runtime.ts"],"sourcesContent":["import type { AspectMain } from '@teambit/aspect';\nimport { ComponentType } from 'react';\nimport { AspectDefinition } from '@teambit/aspect-loader';\nimport { CacheAspect, CacheMain } from '@teambit/cache';\nimport { CLIAspect, CLIMain, MainRuntime } from '@teambit/cli';\nimport type { ComponentMain } from '@teambit/component';\nimport { ComponentAspect } from '@teambit/component';\nimport { ExpressAspect, ExpressMain } from '@teambit/express';\nimport type { GraphqlMain } from '@teambit/graphql';\nimport { GraphqlAspect } from '@teambit/graphql';\nimport chalk from 'chalk';\nimport { Slot, SlotRegistry, Harmony } from '@teambit/harmony';\nimport { Logger, LoggerAspect, LoggerMain } from '@teambit/logger';\nimport PubsubAspect, { PubsubMain } from '@teambit/pubsub';\nimport { sha1 } from '@teambit/legacy/dist/utils';\nimport fs from 'fs-extra';\nimport { Port } from '@teambit/toolbox.network.get-port';\nimport { join, resolve } from 'path';\nimport { promisify } from 'util';\nimport webpack from 'webpack';\nimport { UiServerStartedEvent } from './events';\nimport { createRoot } from './create-root';\nimport { UnknownUI, UnknownBuildError } from './exceptions';\nimport { StartCmd } from './start.cmd';\nimport { UIBuildCmd } from './ui-build.cmd';\nimport { UIRoot } from './ui-root';\nimport { UIServer } from './ui-server';\nimport { UIAspect, UIRuntime } from './ui.aspect';\nimport createWebpackConfig from './webpack/webpack.browser.config';\nimport createSsrWebpackConfig from './webpack/webpack.ssr.config';\nimport { StartPlugin, StartPluginOptions } from './start-plugin';\n\nexport type UIDeps = [PubsubMain, CLIMain, GraphqlMain, ExpressMain, ComponentMain, CacheMain, LoggerMain, AspectMain];\n\nexport type UIRootRegistry = SlotRegistry<UIRoot>;\n\nexport type PreStart = (preStartOpts: PreStartOpts) => Promise<void>;\n\nexport type PreStartOpts = { skipCompilation?: boolean };\n\nexport type OnStart = () => Promise<undefined | ComponentType<{}>>;\n\nexport type StartPluginSlot = SlotRegistry<StartPlugin>;\n\nexport type PublicDirOverwrite = (uiRoot: UIRoot) => Promise<string | undefined>;\n\nexport type BuildMethodOverwrite = (name: string, uiRoot: UIRoot, rebuild?: boolean) => Promise<string>;\n\nexport type PreStartSlot = SlotRegistry<PreStart>;\n\nexport type OnStartSlot = SlotRegistry<OnStart>;\n\nexport type PublicDirOverwriteSlot = SlotRegistry<PublicDirOverwrite>;\n\nexport type BuildMethodOverwriteSlot = SlotRegistry<BuildMethodOverwrite>;\n\nexport type UIConfig = {\n /**\n * port for the UI root to use.\n */\n port?: number;\n\n /**\n * port range for the UI root to use.\n */\n portRange: [number, number];\n\n /**\n * host for the UI root\n */\n host: string;\n\n /**\n * directory in workspace to use for public assets.\n * always relative to the workspace root directory.\n */\n publicDir: string;\n\n /** the url to display when server is listening. Note that bit does not provide proxying to this url */\n publicUrl?: string;\n};\n\nexport type RuntimeOptions = {\n /**\n * determine whether to initiate on verbose mode.\n */\n verbose?: boolean;\n\n /**\n * name of the UI root to load.\n */\n uiRootName?: string;\n\n /**\n * component selector pattern to load.\n */\n pattern?: string;\n\n /**\n * determine whether to start a dev server (defaults to false).\n */\n dev?: boolean;\n\n /**\n * port of the config.\n */\n port?: number;\n\n /**\n * determine whether to rebuild the UI before start.\n */\n rebuild?: boolean;\n};\n\nexport class UiMain {\n constructor(\n /**\n * Pubsub extension.\n */\n private pubsub: PubsubMain,\n\n private config: UIConfig,\n\n /**\n * graphql extension.\n */\n private graphql: GraphqlMain,\n\n /**\n * slot registry of ui roots.\n */\n private uiRootSlot: UIRootRegistry,\n\n /**\n * express extension.\n */\n private express: ExpressMain,\n\n /**\n * pre-start slot\n */\n private preStartSlot: PreStartSlot,\n\n /**\n * on start slot\n */\n private onStartSlot: OnStartSlot,\n\n /**\n * Overwrite the public dir Slot\n */\n private publicDirOverwriteSlot: PublicDirOverwriteSlot,\n\n /**\n * Overwrite the build ui method\n */\n private buildMethodOverwriteSlot: BuildMethodOverwriteSlot,\n\n /**\n * component extension.\n */\n private componentExtension: ComponentMain,\n\n /**\n * ui logger instance.\n */\n private cache: CacheMain,\n\n /**\n * ui logger instance.\n */\n private logger: Logger,\n\n private harmony: Harmony,\n\n private startPluginSlot: StartPluginSlot\n ) {}\n\n async publicDir(uiRoot: UIRoot) {\n const overwriteFn = this.getOverwritePublic();\n if (overwriteFn) {\n const hasDir = await overwriteFn(uiRoot);\n if (hasDir) return hasDir;\n }\n\n if (this.config.publicDir.startsWith('/')) {\n return this.config.publicDir.substring(1);\n }\n\n return this.config.publicDir;\n }\n\n private getUiByName(name: string) {\n const roots = this.uiRootSlot.toArray();\n const [, root] =\n roots.find(([, uiRoot]) => {\n return uiRoot.name === name;\n }) || [];\n\n return root;\n }\n\n /**\n * create a build of the given UI root.\n */\n async build(uiRootName?: string): Promise<webpack.MultiStats | undefined> {\n // TODO: change to MultiStats from webpack once they export it in their types\n this.logger.debug(`build, uiRootName: \"${uiRootName}\"`);\n const maybeUiRoot = this.getUi(uiRootName);\n\n if (!maybeUiRoot) throw new UnknownUI(uiRootName, this.possibleUis());\n const [name, uiRoot] = maybeUiRoot;\n\n // TODO: @uri refactor all dev server related code to use the bundler extension instead.\n const ssr = uiRoot.buildOptions?.ssr || false;\n const mainEntry = await this.generateRoot(await uiRoot.resolveAspects(UIRuntime.name), name);\n\n const browserConfig = createWebpackConfig(uiRoot.path, [mainEntry], uiRoot.name, await this.publicDir(uiRoot));\n const ssrConfig = ssr && createSsrWebpackConfig(uiRoot.path, [mainEntry], await this.publicDir(uiRoot));\n\n const config = [browserConfig, ssrConfig].filter((x) => !!x) as webpack.Configuration[];\n const compiler = webpack(config);\n this.logger.debug(`build, uiRootName: \"${uiRootName}\" running webpack`);\n const compilerRun = promisify(compiler.run.bind(compiler));\n const results = await compilerRun();\n this.logger.debug(`build, uiRootName: \"${uiRootName}\" completed webpack`);\n if (!results) throw new UnknownBuildError();\n if (results?.hasErrors()) {\n this.clearConsole();\n throw new Error(results?.toString());\n }\n\n return results;\n }\n\n registerStartPlugin(startPlugin: StartPlugin) {\n this.startPluginSlot.register(startPlugin);\n return this;\n }\n\n private async initiatePlugins(options: StartPluginOptions) {\n const plugins = this.startPluginSlot.values();\n await Promise.all(plugins.map((plugin) => plugin.initiate(options)));\n return plugins;\n }\n\n /**\n * create a Bit UI runtime.\n */\n async createRuntime({ uiRootName, pattern, dev, port, rebuild, verbose }: RuntimeOptions) {\n const maybeUiRoot = this.getUi(uiRootName);\n if (!maybeUiRoot) throw new UnknownUI(uiRootName, this.possibleUis());\n\n const [name, uiRoot] = maybeUiRoot;\n\n const plugins = await this.initiatePlugins({\n verbose,\n pattern,\n });\n\n if (this.componentExtension.isHost(name)) this.componentExtension.setHostPriority(name);\n\n const uiServer = UIServer.create({\n express: this.express,\n graphql: this.graphql,\n uiRoot,\n uiRootExtension: name,\n ui: this,\n logger: this.logger,\n publicDir: await this.publicDir(uiRoot),\n startPlugins: plugins,\n });\n\n // Adding signal listeners to make sure we immediately close the process on sigint / sigterm (otherwise webpack dev server closing will take time)\n this.addSignalListener();\n if (dev) {\n await uiServer.dev({ portRange: port || this.config.portRange });\n } else {\n await this.buildUI(name, uiRoot, rebuild);\n await uiServer.start({ portRange: port || this.config.portRange });\n }\n\n this.pubsub.pub(UIAspect.id, this.createUiServerStartedEvent(this.config.host, uiServer.port, uiRoot));\n\n return uiServer;\n }\n\n private addSignalListener() {\n process.on('SIGTERM', () => {\n process.exit();\n });\n\n process.on('SIGINT', () => {\n process.exit();\n });\n }\n\n async getPort(port?: number): Promise<number> {\n if (port) return port;\n return this.config.port || this.selectPort();\n }\n\n /**\n * Events\n */\n private createUiServerStartedEvent = (targetHost, targetPort, uiRoot) => {\n return new UiServerStartedEvent(Date.now(), targetHost, targetPort, uiRoot);\n };\n\n /**\n * pre-start events are triggered and *completed* before the webserver started.\n * (the promise is awaited)\n */\n registerPreStart(preStartFn: PreStart) {\n this.preStartSlot.register(preStartFn);\n }\n\n /**\n * bind to ui server start event.\n */\n registerOnStart(onStartFn: OnStart) {\n this.onStartSlot.register(onStartFn);\n return this;\n }\n\n /**\n * overwrite the build ui function\n */\n registerBuildUIOverwrite(fn: BuildMethodOverwrite) {\n this.buildMethodOverwriteSlot.register(fn);\n return this;\n }\n\n /**\n * overwrite the build ui function\n */\n registerPublicDirOverwrite(fn: PublicDirOverwrite) {\n this.publicDirOverwriteSlot.register(fn);\n return this;\n }\n\n private getOverwriteBuildFn() {\n const buildMethodOverwrite = this.buildMethodOverwriteSlot.toArray();\n if (buildMethodOverwrite[0]) {\n const [, fn] = buildMethodOverwrite[0];\n return fn;\n }\n return undefined;\n }\n\n private getOverwritePublic() {\n const overwritePublic = this.publicDirOverwriteSlot.toArray();\n if (overwritePublic[0]) {\n const [, fn] = overwritePublic[0];\n return fn;\n }\n return undefined;\n }\n\n async invokePreStart(preStartOpts: PreStartOpts): Promise<void> {\n const promises = this.preStartSlot.values().map((fn) => fn(preStartOpts));\n await Promise.all(promises);\n }\n\n async invokeOnStart(): Promise<ComponentType[]> {\n const promises = this.onStartSlot.values().map((fn) => fn());\n const startPlugins = await Promise.all(promises);\n return startPlugins.filter((plugin) => !!plugin) as ComponentType[];\n }\n\n /**\n * register a UI slot.\n */\n registerUiRoot(uiRoot: UIRoot) {\n return this.uiRootSlot.register(uiRoot);\n }\n\n /**\n * get a UI runtime instance.\n */\n getUi(uiRootName?: string): [string, UIRoot] | undefined {\n if (uiRootName) {\n const root = this.uiRootSlot.get(uiRootName) || this.getUiByName(uiRootName);\n if (!root) return undefined;\n return [uiRootName, root];\n }\n const uis = this.uiRootSlot.toArray();\n if (uis.length === 1) return uis[0];\n return uis.find(([, root]) => root.priority);\n }\n\n isHostAvailable(): boolean {\n return Boolean(this.componentExtension.getHost());\n }\n\n getUiName(uiRootName?: string): string | undefined {\n const [, ui] = this.getUi(uiRootName) || [];\n if (!ui) return undefined;\n\n return ui.name;\n }\n\n private possibleUis() {\n return this.uiRootSlot.toArray().map(([id]) => id);\n }\n\n createLink(aspectDefs: AspectDefinition[], rootExtensionName: string) {\n return createRoot(aspectDefs, rootExtensionName);\n }\n\n /**\n * generate the root file of the UI runtime.\n */\n async generateRoot(\n aspectDefs: AspectDefinition[],\n rootExtensionName: string,\n runtimeName = UIRuntime.name,\n rootAspect = UIAspect.id,\n config?: object,\n ) {\n const contents = await createRoot(\n aspectDefs,\n rootExtensionName,\n rootAspect,\n runtimeName,\n config || this.harmony.config.toObject()\n );\n const filepath = resolve(join(__dirname, `${runtimeName}.root${sha1(contents)}.js`));\n if (fs.existsSync(filepath)) return filepath;\n fs.outputFileSync(filepath, contents);\n return filepath;\n }\n\n private async selectPort() {\n const [from, to] = this.config.portRange;\n const usedPorts = (await this.cache.get<number[]>(`${from}${to}`)) || [];\n const port = await Port.getPort(from, to, usedPorts);\n // this will lock the port for 1 min to avoid race conditions\n await this.cache.set(`${from}${to}`, usedPorts.concat(port), 5000);\n return port;\n }\n\n private async buildUI(name: string, uiRoot: UIRoot, rebuild?: boolean): Promise<string> {\n this.logger.debug(`buildUI, name ${name}`);\n const overwrite = this.getOverwriteBuildFn();\n if (overwrite) return overwrite(name, uiRoot, rebuild);\n const hash = await this.buildIfChanged(name, uiRoot, rebuild);\n await this.buildIfNoBundle(name, uiRoot);\n return hash;\n }\n\n async buildUiHash(uiRoot: UIRoot, runtime = 'ui'): Promise<string> {\n const aspects = await uiRoot.resolveAspects(runtime);\n aspects.sort((a, b) => (a.aspectPath > b.aspectPath ? 1 : -1));\n const hash = aspects.map((aspect) => {\n return [aspect.aspectPath, aspect.runtimePath].join('');\n });\n return sha1(hash.join(''));\n }\n\n async buildIfChanged(name: string, uiRoot: UIRoot, force: boolean | undefined): Promise<string> {\n this.logger.debug(`buildIfChanged, name ${name}`);\n const hash = await this.buildUiHash(uiRoot);\n const hashed = await this.cache.get(uiRoot.path);\n if (hash === hashed && !force) {\n this.logger.debug(`buildIfChanged, name ${name}, returned from cache`);\n return hash;\n }\n if (!hashed) {\n this.logger.console(\n `Building UI assets for '${chalk.cyan(uiRoot.name)}' in target directory: ${chalk.cyan(\n await this.publicDir(uiRoot)\n )}. The first time we build the UI it may take a few minutes.`\n );\n } else {\n this.logger.console(\n `Rebuilding UI assets for '${chalk.cyan(uiRoot.name)} in target directory: ${chalk.cyan(\n await this.publicDir(uiRoot)\n )}' as ${uiRoot.configFile} has been changed.`\n );\n }\n\n await this.build(name);\n await this.cache.set(uiRoot.path, hash);\n return hash;\n }\n\n clearConsole() {\n process.stdout.write(process.platform === 'win32' ? '\\x1B[2J\\x1B[0f' : '\\x1B[2J\\x1B[3J\\x1B[H');\n }\n\n async buildIfNoBundle(name: string, uiRoot: UIRoot) {\n const config = createWebpackConfig(\n uiRoot.path,\n [await this.generateRoot(await uiRoot.resolveAspects(UIRuntime.name), name)],\n uiRoot.name,\n await this.publicDir(uiRoot)\n );\n if (config.output?.path && fs.pathExistsSync(config.output.path)) return;\n const hash = await this.buildUiHash(uiRoot);\n await this.build(name);\n await this.cache.set(uiRoot.path, hash);\n }\n\n get publicUrl() {\n return this.config.publicUrl;\n }\n\n static defaultConfig: UIConfig = {\n publicDir: 'public/bit',\n portRange: [3000, 3100],\n host: 'localhost',\n };\n\n static runtime = MainRuntime;\n static dependencies = [\n PubsubAspect,\n CLIAspect,\n GraphqlAspect,\n ExpressAspect,\n ComponentAspect,\n CacheAspect,\n LoggerAspect,\n ];\n\n static slots = [\n Slot.withType<UIRoot>(),\n Slot.withType<PreStart>(),\n Slot.withType<OnStart>(),\n Slot.withType<PublicDirOverwriteSlot>(),\n Slot.withType<BuildMethodOverwriteSlot>(),\n Slot.withType<StartPlugin>(),\n ];\n\n static async provider(\n [pubsub, cli, graphql, express, componentExtension, cache, loggerMain]: UIDeps,\n config,\n [uiRootSlot, preStartSlot, onStartSlot, publicDirOverwriteSlot, buildMethodOverwriteSlot, proxyGetterSlot]: [\n UIRootRegistry,\n PreStartSlot,\n OnStartSlot,\n PublicDirOverwriteSlot,\n BuildMethodOverwriteSlot,\n StartPluginSlot\n ],\n harmony: Harmony\n ) {\n // aspectExtension.registerRuntime(new RuntimeDefinition('ui', []))\n const logger = loggerMain.createLogger(UIAspect.id);\n\n const ui = new UiMain(\n pubsub,\n config,\n graphql,\n uiRootSlot,\n express,\n preStartSlot,\n onStartSlot,\n publicDirOverwriteSlot,\n buildMethodOverwriteSlot,\n componentExtension,\n cache,\n logger,\n harmony,\n proxyGetterSlot\n );\n cli.register(new StartCmd(ui, logger), new UIBuildCmd(ui));\n return ui;\n }\n}\n\nUIAspect.addRuntime(UiMain);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAGA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAEA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAEA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;E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AcTsK,eAdS,CAAX;IAgBAF,GAAG,CAAC9G,QAAJ,CAAa,KAAIkH,iBAAJ,EAAa5F,EAAb,EAAiB7E,MAAjB,CAAb,EAAuC,KAAI0K,qBAAJ,EAAe7F,EAAf,CAAvC;IACA,OAAOA,EAAP;EACD;;AAtciB;;;gCAAP1F,M,mBA0YsB;EAC/BsB,SAAS,EAAE,YADoB;EAE/BuE,SAAS,EAAE,CAAC,IAAD,EAAO,IAAP,CAFoB;EAG/BO,IAAI,EAAE;AAHyB,C;gCA1YtBpG,M,aAgZMwL,kB;gCAhZNxL,M,kBAiZW,CACpByL,iBADoB,EAEpBC,gBAFoB,EAGpBC,wBAHoB,EAIpBC,wBAJoB,EAKpBC,4BALoB,EAMpBC,oBANoB,EAOpBC,sBAPoB,C;gCAjZX/L,M,WA2ZI,CACbgM,eAAA,CAAKC,QAAL,EADa,EAEbD,eAAA,CAAKC,QAAL,EAFa,EAGbD,eAAA,CAAKC,QAAL,EAHa,EAIbD,eAAA,CAAKC,QAAL,EAJa,EAKbD,eAAA,CAAKC,QAAL,EALa,EAMbD,eAAA,CAAKC,QAAL,EANa,C;;AA8CjBhG,cAAA,CAASiG,UAAT,CAAoBlM,MAApB"}
|
|
1
|
+
{"version":3,"names":["UiMain","constructor","pubsub","config","graphql","uiRootSlot","express","preStartSlot","onStartSlot","publicDirOverwriteSlot","buildMethodOverwriteSlot","componentExtension","cache","logger","harmony","startPluginSlot","targetHost","targetPort","uiRoot","UiServerStartedEvent","Date","now","publicDir","overwriteFn","getOverwritePublic","hasDir","startsWith","substring","getUiByName","name","roots","toArray","root","find","build","uiRootName","debug","maybeUiRoot","getUi","UnknownUI","possibleUis","ssr","buildOptions","mainEntry","generateRoot","resolveAspects","UIRuntime","browserConfig","createWebpackConfig","path","ssrConfig","createSsrWebpackConfig","filter","x","compiler","webpack","compilerRun","promisify","run","bind","results","UnknownBuildError","hasErrors","clearConsole","Error","toString","registerStartPlugin","startPlugin","register","initiatePlugins","options","plugins","values","Promise","all","map","plugin","initiate","createRuntime","pattern","dev","port","rebuild","verbose","isHost","setHostPriority","uiServer","UIServer","create","uiRootExtension","ui","startPlugins","addSignalListener","portRange","buildUI","start","pub","UIAspect","id","createUiServerStartedEvent","host","process","on","exit","getPort","selectPort","registerPreStart","preStartFn","registerOnStart","onStartFn","registerBuildUIOverwrite","fn","registerPublicDirOverwrite","getOverwriteBuildFn","buildMethodOverwrite","undefined","overwritePublic","invokePreStart","preStartOpts","promises","invokeOnStart","registerUiRoot","get","uis","length","priority","isHostAvailable","Boolean","getHost","getUiName","createLink","aspectDefs","rootExtensionName","createRoot","runtimeName","rootAspect","contents","toObject","filepath","resolve","join","__dirname","sha1","fs","existsSync","outputFileSync","from","to","usedPorts","Port","set","concat","overwrite","hash","buildIfChanged","buildIfNoBundle","buildUiHash","runtime","aspects","sort","a","b","aspectPath","aspect","runtimePath","force","hashed","console","chalk","cyan","configFile","stdout","write","platform","output","pathExistsSync","publicUrl","provider","cli","loggerMain","proxyGetterSlot","createLogger","StartCmd","UIBuildCmd","MainRuntime","PubsubAspect","CLIAspect","GraphqlAspect","ExpressAspect","ComponentAspect","CacheAspect","LoggerAspect","Slot","withType","addRuntime"],"sources":["ui.main.runtime.ts"],"sourcesContent":["import type { AspectMain } from '@teambit/aspect';\nimport { ComponentType } from 'react';\nimport { AspectDefinition } from '@teambit/aspect-loader';\nimport { CacheAspect, CacheMain } from '@teambit/cache';\nimport { CLIAspect, CLIMain, MainRuntime } from '@teambit/cli';\nimport type { ComponentMain } from '@teambit/component';\nimport { ComponentAspect } from '@teambit/component';\nimport { ExpressAspect, ExpressMain } from '@teambit/express';\nimport type { GraphqlMain } from '@teambit/graphql';\nimport { GraphqlAspect } from '@teambit/graphql';\nimport chalk from 'chalk';\nimport { Slot, SlotRegistry, Harmony } from '@teambit/harmony';\nimport { Logger, LoggerAspect, LoggerMain } from '@teambit/logger';\nimport PubsubAspect, { PubsubMain } from '@teambit/pubsub';\nimport { sha1 } from '@teambit/legacy/dist/utils';\nimport fs from 'fs-extra';\nimport { Port } from '@teambit/toolbox.network.get-port';\nimport { join, resolve } from 'path';\nimport { promisify } from 'util';\nimport webpack from 'webpack';\nimport { UiServerStartedEvent } from './events';\nimport { createRoot } from './create-root';\nimport { UnknownUI, UnknownBuildError } from './exceptions';\nimport { StartCmd } from './start.cmd';\nimport { UIBuildCmd } from './ui-build.cmd';\nimport { UIRoot } from './ui-root';\nimport { UIServer } from './ui-server';\nimport { UIAspect, UIRuntime } from './ui.aspect';\nimport createWebpackConfig from './webpack/webpack.browser.config';\nimport createSsrWebpackConfig from './webpack/webpack.ssr.config';\nimport { StartPlugin, StartPluginOptions } from './start-plugin';\n\nexport type UIDeps = [PubsubMain, CLIMain, GraphqlMain, ExpressMain, ComponentMain, CacheMain, LoggerMain, AspectMain];\n\nexport type UIRootRegistry = SlotRegistry<UIRoot>;\n\nexport type PreStart = (preStartOpts: PreStartOpts) => Promise<void>;\n\nexport type PreStartOpts = { skipCompilation?: boolean };\n\nexport type OnStart = () => Promise<undefined | ComponentType<{}>>;\n\nexport type StartPluginSlot = SlotRegistry<StartPlugin>;\n\nexport type PublicDirOverwrite = (uiRoot: UIRoot) => Promise<string | undefined>;\n\nexport type BuildMethodOverwrite = (name: string, uiRoot: UIRoot, rebuild?: boolean) => Promise<string>;\n\nexport type PreStartSlot = SlotRegistry<PreStart>;\n\nexport type OnStartSlot = SlotRegistry<OnStart>;\n\nexport type PublicDirOverwriteSlot = SlotRegistry<PublicDirOverwrite>;\n\nexport type BuildMethodOverwriteSlot = SlotRegistry<BuildMethodOverwrite>;\n\nexport type UIConfig = {\n /**\n * port for the UI root to use.\n */\n port?: number;\n\n /**\n * port range for the UI root to use.\n */\n portRange: [number, number];\n\n /**\n * host for the UI root\n */\n host: string;\n\n /**\n * directory in workspace to use for public assets.\n * always relative to the workspace root directory.\n */\n publicDir: string;\n\n /** the url to display when server is listening. Note that bit does not provide proxying to this url */\n publicUrl?: string;\n};\n\nexport type RuntimeOptions = {\n /**\n * determine whether to initiate on verbose mode.\n */\n verbose?: boolean;\n\n /**\n * name of the UI root to load.\n */\n uiRootName?: string;\n\n /**\n * component selector pattern to load.\n */\n pattern?: string;\n\n /**\n * determine whether to start a dev server (defaults to false).\n */\n dev?: boolean;\n\n /**\n * port of the config.\n */\n port?: number;\n\n /**\n * determine whether to rebuild the UI before start.\n */\n rebuild?: boolean;\n};\n\nexport class UiMain {\n constructor(\n /**\n * Pubsub extension.\n */\n private pubsub: PubsubMain,\n\n private config: UIConfig,\n\n /**\n * graphql extension.\n */\n private graphql: GraphqlMain,\n\n /**\n * slot registry of ui roots.\n */\n private uiRootSlot: UIRootRegistry,\n\n /**\n * express extension.\n */\n private express: ExpressMain,\n\n /**\n * pre-start slot\n */\n private preStartSlot: PreStartSlot,\n\n /**\n * on start slot\n */\n private onStartSlot: OnStartSlot,\n\n /**\n * Overwrite the public dir Slot\n */\n private publicDirOverwriteSlot: PublicDirOverwriteSlot,\n\n /**\n * Overwrite the build ui method\n */\n private buildMethodOverwriteSlot: BuildMethodOverwriteSlot,\n\n /**\n * component extension.\n */\n private componentExtension: ComponentMain,\n\n /**\n * ui logger instance.\n */\n private cache: CacheMain,\n\n /**\n * ui logger instance.\n */\n private logger: Logger,\n\n private harmony: Harmony,\n\n private startPluginSlot: StartPluginSlot\n ) {}\n\n async publicDir(uiRoot: UIRoot) {\n const overwriteFn = this.getOverwritePublic();\n if (overwriteFn) {\n const hasDir = await overwriteFn(uiRoot);\n if (hasDir) return hasDir;\n }\n\n if (this.config.publicDir.startsWith('/')) {\n return this.config.publicDir.substring(1);\n }\n\n return this.config.publicDir;\n }\n\n private getUiByName(name: string) {\n const roots = this.uiRootSlot.toArray();\n const [, root] =\n roots.find(([, uiRoot]) => {\n return uiRoot.name === name;\n }) || [];\n\n return root;\n }\n\n /**\n * create a build of the given UI root.\n */\n async build(uiRootName?: string): Promise<webpack.MultiStats | undefined> {\n // TODO: change to MultiStats from webpack once they export it in their types\n this.logger.debug(`build, uiRootName: \"${uiRootName}\"`);\n const maybeUiRoot = this.getUi(uiRootName);\n\n if (!maybeUiRoot) throw new UnknownUI(uiRootName, this.possibleUis());\n const [name, uiRoot] = maybeUiRoot;\n\n // TODO: @uri refactor all dev server related code to use the bundler extension instead.\n const ssr = uiRoot.buildOptions?.ssr || false;\n const mainEntry = await this.generateRoot(await uiRoot.resolveAspects(UIRuntime.name), name);\n\n const browserConfig = createWebpackConfig(uiRoot.path, [mainEntry], uiRoot.name, await this.publicDir(uiRoot));\n const ssrConfig = ssr && createSsrWebpackConfig(uiRoot.path, [mainEntry], await this.publicDir(uiRoot));\n\n const config = [browserConfig, ssrConfig].filter((x) => !!x) as webpack.Configuration[];\n const compiler = webpack(config);\n this.logger.debug(`build, uiRootName: \"${uiRootName}\" running webpack`);\n const compilerRun = promisify(compiler.run.bind(compiler));\n const results = await compilerRun();\n this.logger.debug(`build, uiRootName: \"${uiRootName}\" completed webpack`);\n if (!results) throw new UnknownBuildError();\n if (results?.hasErrors()) {\n this.clearConsole();\n throw new Error(results?.toString());\n }\n\n return results;\n }\n\n registerStartPlugin(startPlugin: StartPlugin) {\n this.startPluginSlot.register(startPlugin);\n return this;\n }\n\n private async initiatePlugins(options: StartPluginOptions) {\n const plugins = this.startPluginSlot.values();\n await Promise.all(plugins.map((plugin) => plugin.initiate(options)));\n return plugins;\n }\n\n /**\n * create a Bit UI runtime.\n */\n async createRuntime({ uiRootName, pattern, dev, port, rebuild, verbose }: RuntimeOptions) {\n const maybeUiRoot = this.getUi(uiRootName);\n if (!maybeUiRoot) throw new UnknownUI(uiRootName, this.possibleUis());\n\n const [name, uiRoot] = maybeUiRoot;\n\n const plugins = await this.initiatePlugins({\n verbose,\n pattern,\n });\n\n if (this.componentExtension.isHost(name)) this.componentExtension.setHostPriority(name);\n\n const uiServer = UIServer.create({\n express: this.express,\n graphql: this.graphql,\n uiRoot,\n uiRootExtension: name,\n ui: this,\n logger: this.logger,\n publicDir: await this.publicDir(uiRoot),\n startPlugins: plugins,\n });\n\n // Adding signal listeners to make sure we immediately close the process on sigint / sigterm (otherwise webpack dev server closing will take time)\n this.addSignalListener();\n if (dev) {\n await uiServer.dev({ portRange: port || this.config.portRange });\n } else {\n await this.buildUI(name, uiRoot, rebuild);\n await uiServer.start({ portRange: port || this.config.portRange });\n }\n\n this.pubsub.pub(UIAspect.id, this.createUiServerStartedEvent(this.config.host, uiServer.port, uiRoot));\n\n return uiServer;\n }\n\n private addSignalListener() {\n process.on('SIGTERM', () => {\n process.exit();\n });\n\n process.on('SIGINT', () => {\n process.exit();\n });\n }\n\n async getPort(port?: number): Promise<number> {\n if (port) return port;\n return this.config.port || this.selectPort();\n }\n\n /**\n * Events\n */\n private createUiServerStartedEvent = (targetHost, targetPort, uiRoot) => {\n return new UiServerStartedEvent(Date.now(), targetHost, targetPort, uiRoot);\n };\n\n /**\n * pre-start events are triggered and *completed* before the webserver started.\n * (the promise is awaited)\n */\n registerPreStart(preStartFn: PreStart) {\n this.preStartSlot.register(preStartFn);\n }\n\n /**\n * bind to ui server start event.\n */\n registerOnStart(onStartFn: OnStart) {\n this.onStartSlot.register(onStartFn);\n return this;\n }\n\n /**\n * overwrite the build ui function\n */\n registerBuildUIOverwrite(fn: BuildMethodOverwrite) {\n this.buildMethodOverwriteSlot.register(fn);\n return this;\n }\n\n /**\n * overwrite the build ui function\n */\n registerPublicDirOverwrite(fn: PublicDirOverwrite) {\n this.publicDirOverwriteSlot.register(fn);\n return this;\n }\n\n private getOverwriteBuildFn() {\n const buildMethodOverwrite = this.buildMethodOverwriteSlot.toArray();\n if (buildMethodOverwrite[0]) {\n const [, fn] = buildMethodOverwrite[0];\n return fn;\n }\n return undefined;\n }\n\n private getOverwritePublic() {\n const overwritePublic = this.publicDirOverwriteSlot.toArray();\n if (overwritePublic[0]) {\n const [, fn] = overwritePublic[0];\n return fn;\n }\n return undefined;\n }\n\n async invokePreStart(preStartOpts: PreStartOpts): Promise<void> {\n const promises = this.preStartSlot.values().map((fn) => fn(preStartOpts));\n await Promise.all(promises);\n }\n\n async invokeOnStart(): Promise<ComponentType[]> {\n const promises = this.onStartSlot.values().map((fn) => fn());\n const startPlugins = await Promise.all(promises);\n return startPlugins.filter((plugin) => !!plugin) as ComponentType[];\n }\n\n /**\n * register a UI slot.\n */\n registerUiRoot(uiRoot: UIRoot) {\n return this.uiRootSlot.register(uiRoot);\n }\n\n /**\n * get a UI runtime instance.\n */\n getUi(uiRootName?: string): [string, UIRoot] | undefined {\n if (uiRootName) {\n const root = this.uiRootSlot.get(uiRootName) || this.getUiByName(uiRootName);\n if (!root) return undefined;\n return [uiRootName, root];\n }\n const uis = this.uiRootSlot.toArray();\n if (uis.length === 1) return uis[0];\n return uis.find(([, root]) => root.priority);\n }\n\n isHostAvailable(): boolean {\n return Boolean(this.componentExtension.getHost());\n }\n\n getUiName(uiRootName?: string): string | undefined {\n const [, ui] = this.getUi(uiRootName) || [];\n if (!ui) return undefined;\n\n return ui.name;\n }\n\n private possibleUis() {\n return this.uiRootSlot.toArray().map(([id]) => id);\n }\n\n createLink(aspectDefs: AspectDefinition[], rootExtensionName: string) {\n return createRoot(aspectDefs, rootExtensionName);\n }\n\n /**\n * generate the root file of the UI runtime.\n */\n async generateRoot(\n aspectDefs: AspectDefinition[],\n rootExtensionName: string,\n runtimeName = UIRuntime.name,\n rootAspect = UIAspect.id,\n config?: object,\n ) {\n const contents = await createRoot(\n aspectDefs,\n rootExtensionName,\n rootAspect,\n runtimeName,\n config || this.harmony.config.toObject()\n );\n const filepath = resolve(join(__dirname, `${runtimeName}.root.${sha1(contents)}.js`));\n if (fs.existsSync(filepath)) return filepath;\n fs.outputFileSync(filepath, contents);\n return filepath;\n }\n\n private async selectPort() {\n const [from, to] = this.config.portRange;\n const usedPorts = (await this.cache.get<number[]>(`${from}${to}`)) || [];\n const port = await Port.getPort(from, to, usedPorts);\n // this will lock the port for 1 min to avoid race conditions\n await this.cache.set(`${from}${to}`, usedPorts.concat(port), 5000);\n return port;\n }\n\n private async buildUI(name: string, uiRoot: UIRoot, rebuild?: boolean): Promise<string> {\n this.logger.debug(`buildUI, name ${name}`);\n const overwrite = this.getOverwriteBuildFn();\n if (overwrite) return overwrite(name, uiRoot, rebuild);\n const hash = await this.buildIfChanged(name, uiRoot, rebuild);\n await this.buildIfNoBundle(name, uiRoot);\n return hash;\n }\n\n async buildUiHash(uiRoot: UIRoot, runtime = 'ui'): Promise<string> {\n const aspects = await uiRoot.resolveAspects(runtime);\n aspects.sort((a, b) => (a.aspectPath > b.aspectPath ? 1 : -1));\n const hash = aspects.map((aspect) => {\n return [aspect.aspectPath, aspect.runtimePath].join('');\n });\n return sha1(hash.join(''));\n }\n\n async buildIfChanged(name: string, uiRoot: UIRoot, force: boolean | undefined): Promise<string> {\n this.logger.debug(`buildIfChanged, name ${name}`);\n const hash = await this.buildUiHash(uiRoot);\n const hashed = await this.cache.get(uiRoot.path);\n if (hash === hashed && !force) {\n this.logger.debug(`buildIfChanged, name ${name}, returned from cache`);\n return hash;\n }\n if (!hashed) {\n this.logger.console(\n `Building UI assets for '${chalk.cyan(uiRoot.name)}' in target directory: ${chalk.cyan(\n await this.publicDir(uiRoot)\n )}. The first time we build the UI it may take a few minutes.`\n );\n } else {\n this.logger.console(\n `Rebuilding UI assets for '${chalk.cyan(uiRoot.name)} in target directory: ${chalk.cyan(\n await this.publicDir(uiRoot)\n )}' as ${uiRoot.configFile} has been changed.`\n );\n }\n\n await this.build(name);\n await this.cache.set(uiRoot.path, hash);\n return hash;\n }\n\n clearConsole() {\n process.stdout.write(process.platform === 'win32' ? '\\x1B[2J\\x1B[0f' : '\\x1B[2J\\x1B[3J\\x1B[H');\n }\n\n async buildIfNoBundle(name: string, uiRoot: UIRoot) {\n const config = createWebpackConfig(\n uiRoot.path,\n [await this.generateRoot(await uiRoot.resolveAspects(UIRuntime.name), name)],\n uiRoot.name,\n await this.publicDir(uiRoot)\n );\n if (config.output?.path && fs.pathExistsSync(config.output.path)) return;\n const hash = await this.buildUiHash(uiRoot);\n await this.build(name);\n await this.cache.set(uiRoot.path, hash);\n }\n\n get publicUrl() {\n return this.config.publicUrl;\n }\n\n static defaultConfig: UIConfig = {\n publicDir: 'public/bit',\n portRange: [3000, 3100],\n host: 'localhost',\n };\n\n static runtime = MainRuntime;\n static dependencies = [\n PubsubAspect,\n CLIAspect,\n GraphqlAspect,\n ExpressAspect,\n ComponentAspect,\n CacheAspect,\n LoggerAspect,\n ];\n\n static slots = [\n Slot.withType<UIRoot>(),\n Slot.withType<PreStart>(),\n Slot.withType<OnStart>(),\n Slot.withType<PublicDirOverwriteSlot>(),\n Slot.withType<BuildMethodOverwriteSlot>(),\n Slot.withType<StartPlugin>(),\n ];\n\n static async provider(\n [pubsub, cli, graphql, express, componentExtension, cache, loggerMain]: UIDeps,\n config,\n [uiRootSlot, preStartSlot, onStartSlot, publicDirOverwriteSlot, buildMethodOverwriteSlot, proxyGetterSlot]: [\n UIRootRegistry,\n PreStartSlot,\n OnStartSlot,\n PublicDirOverwriteSlot,\n BuildMethodOverwriteSlot,\n StartPluginSlot\n ],\n harmony: Harmony\n ) {\n // aspectExtension.registerRuntime(new RuntimeDefinition('ui', []))\n const logger = loggerMain.createLogger(UIAspect.id);\n\n const ui = new UiMain(\n pubsub,\n config,\n graphql,\n uiRootSlot,\n express,\n preStartSlot,\n onStartSlot,\n publicDirOverwriteSlot,\n buildMethodOverwriteSlot,\n componentExtension,\n cache,\n logger,\n harmony,\n proxyGetterSlot\n );\n cli.register(new StartCmd(ui, logger), new UIBuildCmd(ui));\n return ui;\n }\n}\n\nUIAspect.addRuntime(UiMain);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAGA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAEA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAEA;EAAA;;EAAA;IAAA;EAAA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A,CAAKC,QAAL,EALa,EAMbD,eAAA,CAAKC,QAAL,EANa,C;;AA8CjBhG,cAAA,CAASiG,UAAT,CAAoBlM,MAApB"}
|
package/dist/ui.ui.runtime.d.ts
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import type { GraphqlUI } from '@teambit/graphql';
|
|
2
2
|
import { SlotRegistry } from '@teambit/harmony';
|
|
3
3
|
import type { ReactRouterUI } from '@teambit/react-router';
|
|
4
|
+
import type { SsrSession, RenderPlugin, ContextProps } from '@teambit/react.rendering.ssr';
|
|
4
5
|
import React, { ReactNode, ComponentType } from 'react';
|
|
5
6
|
import { UIRootFactory } from './ui-root.ui';
|
|
6
|
-
import type { SsrContent } from './react-ssr/ssr-content';
|
|
7
|
-
import { ContextProps, RenderPlugins } from './react-ssr/render-lifecycle';
|
|
8
7
|
declare type HudSlot = SlotRegistry<ReactNode>;
|
|
9
|
-
declare type RenderPluginsSlot = SlotRegistry<
|
|
8
|
+
declare type RenderPluginsSlot = SlotRegistry<RenderPlugin<any, any>>;
|
|
10
9
|
declare type UIRootRegistry = SlotRegistry<UIRootFactory>;
|
|
11
10
|
/**
|
|
12
11
|
* extension
|
|
@@ -40,7 +39,7 @@ export declare class UiUI {
|
|
|
40
39
|
/** render and rehydrate client-side */
|
|
41
40
|
render(rootExtension: string): Promise<void>;
|
|
42
41
|
/** render dehydrated server-side */
|
|
43
|
-
renderSsr(rootExtension: string, ssrContent:
|
|
42
|
+
renderSsr(rootExtension: string, ssrContent: SsrSession): Promise<string>;
|
|
44
43
|
/** adds elements to the Heads Up Display */
|
|
45
44
|
registerHudItem: (element: ReactNode) => void;
|
|
46
45
|
/**
|
|
@@ -49,7 +48,7 @@ export declare class UiUI {
|
|
|
49
48
|
*/
|
|
50
49
|
registerContext<T>(context: ComponentType<ContextProps<T>>): void;
|
|
51
50
|
registerRoot(uiRoot: UIRootFactory): void;
|
|
52
|
-
registerRenderHooks<T, Y>(
|
|
51
|
+
registerRenderHooks<T, Y>(plugin: RenderPlugin<T, Y>): void;
|
|
53
52
|
private getLifecyclePlugins;
|
|
54
53
|
private getRoot;
|
|
55
54
|
static slots: ((registerFn: () => string) => SlotRegistry<React.ReactNode>)[];
|
package/dist/ui.ui.runtime.js
CHANGED
|
@@ -51,6 +51,16 @@ function _reactRouter() {
|
|
|
51
51
|
return data;
|
|
52
52
|
}
|
|
53
53
|
|
|
54
|
+
function _reactRendering() {
|
|
55
|
+
const data = require("@teambit/react.rendering.ssr");
|
|
56
|
+
|
|
57
|
+
_reactRendering = function () {
|
|
58
|
+
return data;
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
return data;
|
|
62
|
+
}
|
|
63
|
+
|
|
54
64
|
function _react() {
|
|
55
65
|
const data = _interopRequireDefault(require("react"));
|
|
56
66
|
|
|
@@ -81,15 +91,9 @@ function _clientContext() {
|
|
|
81
91
|
return data;
|
|
82
92
|
}
|
|
83
93
|
|
|
84
|
-
function
|
|
85
|
-
const data = require("./react-ssr/react-ssr");
|
|
94
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
86
95
|
|
|
87
|
-
|
|
88
|
-
return data;
|
|
89
|
-
};
|
|
90
|
-
|
|
91
|
-
return data;
|
|
92
|
-
}
|
|
96
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2().default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
93
97
|
|
|
94
98
|
/**
|
|
95
99
|
* extension
|
|
@@ -126,8 +130,8 @@ class UiUI {
|
|
|
126
130
|
const routes = this.router.renderRoutes(uiRoot.routes);
|
|
127
131
|
const hudItems = this.hudSlot.values();
|
|
128
132
|
const lifecyclePlugins = this.getLifecyclePlugins();
|
|
129
|
-
const reactSsr = new (
|
|
130
|
-
await reactSsr.
|
|
133
|
+
const reactSsr = new (_reactRendering().BrowserRenderer)(lifecyclePlugins);
|
|
134
|
+
await reactSsr.render( /*#__PURE__*/_react().default.createElement(_clientContext().ClientContext, null, hudItems, routes));
|
|
131
135
|
}
|
|
132
136
|
/** render dehydrated server-side */
|
|
133
137
|
|
|
@@ -139,8 +143,8 @@ class UiUI {
|
|
|
139
143
|
const routes = this.router.renderRoutes(uiRoot.routes);
|
|
140
144
|
const hudItems = this.hudSlot.values();
|
|
141
145
|
const lifecyclePlugins = this.getLifecyclePlugins();
|
|
142
|
-
const reactSsr = new (
|
|
143
|
-
const fullHtml = await reactSsr.
|
|
146
|
+
const reactSsr = new (_reactRendering().ServerRenderer)(lifecyclePlugins);
|
|
147
|
+
const fullHtml = await reactSsr.render( /*#__PURE__*/_react().default.createElement(_clientContext().ClientContext, null, hudItems, routes), ssrContent);
|
|
144
148
|
return fullHtml;
|
|
145
149
|
}
|
|
146
150
|
/** adds elements to the Heads Up Display */
|
|
@@ -160,14 +164,20 @@ class UiUI {
|
|
|
160
164
|
return this.uiRootSlot.register(uiRoot);
|
|
161
165
|
}
|
|
162
166
|
|
|
163
|
-
registerRenderHooks(
|
|
164
|
-
return this.renderPluginsSlot.register(
|
|
167
|
+
registerRenderHooks(plugin) {
|
|
168
|
+
return this.renderPluginsSlot.register(plugin);
|
|
165
169
|
}
|
|
166
170
|
|
|
167
171
|
getLifecyclePlugins() {
|
|
168
|
-
const lifecyclePlugins = this.renderPluginsSlot.toArray()
|
|
172
|
+
const lifecyclePlugins = this.renderPluginsSlot.toArray().map(([key, plugin]) => {
|
|
173
|
+
if (plugin.key) return plugin; // for backward compatibility
|
|
174
|
+
|
|
175
|
+
return _objectSpread(_objectSpread({}, plugin), {}, {
|
|
176
|
+
key
|
|
177
|
+
});
|
|
178
|
+
}); // react-router should register its plugin, when we can reverse it's dependency to depend on Ui
|
|
169
179
|
|
|
170
|
-
lifecyclePlugins.unshift(
|
|
180
|
+
lifecyclePlugins.unshift(this.router.renderPlugin);
|
|
171
181
|
return lifecyclePlugins;
|
|
172
182
|
}
|
|
173
183
|
|
|
@@ -177,7 +187,7 @@ class UiUI {
|
|
|
177
187
|
|
|
178
188
|
static async provider([GraphqlUi, router], config, [uiRootSlot, hudSlot, renderLifecycleSlot]) {
|
|
179
189
|
const uiUi = new UiUI(router, uiRootSlot, hudSlot, renderLifecycleSlot);
|
|
180
|
-
uiUi.registerRenderHooks(GraphqlUi.renderPlugins);
|
|
190
|
+
if (GraphqlUi) uiUi.registerRenderHooks(GraphqlUi.renderPlugins);
|
|
181
191
|
return uiUi;
|
|
182
192
|
}
|
|
183
193
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["UiUI","constructor","router","uiRootSlot","hudSlot","renderPluginsSlot","element","register","render","rootExtension","rootFactory","getRoot","Error","uiRoot","routes","renderRoutes","hudItems","values","lifecyclePlugins","getLifecyclePlugins","reactSsr","
|
|
1
|
+
{"version":3,"names":["UiUI","constructor","router","uiRootSlot","hudSlot","renderPluginsSlot","element","register","render","rootExtension","rootFactory","getRoot","Error","uiRoot","routes","renderRoutes","hudItems","values","lifecyclePlugins","getLifecyclePlugins","reactSsr","BrowserRenderer","renderSsr","ssrContent","ServerRenderer","fullHtml","registerContext","context","reactContext","registerRoot","registerRenderHooks","plugin","toArray","map","key","unshift","renderPlugin","get","provider","GraphqlUi","config","renderLifecycleSlot","uiUi","renderPlugins","Slot","withType","GraphqlAspect","ReactRouterAspect","UIRuntime","UIAspect","addRuntime"],"sources":["ui.ui.runtime.tsx"],"sourcesContent":["import type { GraphqlUI } from '@teambit/graphql';\nimport { GraphqlAspect } from '@teambit/graphql';\nimport { Slot, SlotRegistry } from '@teambit/harmony';\nimport type { ReactRouterUI } from '@teambit/react-router';\nimport { ReactRouterAspect } from '@teambit/react-router';\nimport { ServerRenderer, BrowserRenderer } from '@teambit/react.rendering.ssr';\nimport type { SsrSession, RenderPlugin, ContextProps } from '@teambit/react.rendering.ssr';\n\nimport React, { ReactNode, ComponentType } from 'react';\n\nimport { UIRootFactory } from './ui-root.ui';\nimport { UIAspect, UIRuntime } from './ui.aspect';\nimport { ClientContext } from './ui/client-context';\n\ntype HudSlot = SlotRegistry<ReactNode>;\ntype RenderPluginsSlot = SlotRegistry<RenderPlugin<any, any>>;\ntype UIRootRegistry = SlotRegistry<UIRootFactory>;\n\n/**\n * extension\n */\nexport class UiUI {\n constructor(\n /**\n * react-router extension.\n */\n private router: ReactRouterUI,\n /**\n * ui root registry.\n */\n private uiRootSlot: UIRootRegistry,\n /** slot for overlay ui elements */\n private hudSlot: HudSlot,\n /** hooks into the ssr render process */\n private renderPluginsSlot: RenderPluginsSlot\n ) {}\n\n /** render and rehydrate client-side */\n async render(rootExtension: string): Promise<void> {\n const rootFactory = this.getRoot(rootExtension);\n if (!rootFactory) throw new Error(`root: ${rootExtension} was not found`);\n const uiRoot = rootFactory();\n const routes = this.router.renderRoutes(uiRoot.routes);\n const hudItems = this.hudSlot.values();\n const lifecyclePlugins = this.getLifecyclePlugins();\n\n const reactSsr = new BrowserRenderer(lifecyclePlugins);\n await reactSsr.render(\n <ClientContext>\n {hudItems}\n {routes}\n </ClientContext>\n );\n }\n\n /** render dehydrated server-side */\n async renderSsr(rootExtension: string, ssrContent: SsrSession): Promise<string> {\n const rootFactory = this.getRoot(rootExtension);\n if (!rootFactory) throw new Error(`root: ${rootExtension} was not found`);\n\n const uiRoot = rootFactory();\n const routes = this.router.renderRoutes(uiRoot.routes);\n const hudItems = this.hudSlot.values();\n const lifecyclePlugins = this.getLifecyclePlugins();\n\n const reactSsr = new ServerRenderer(lifecyclePlugins);\n const fullHtml = await reactSsr.render(\n <ClientContext>\n {hudItems}\n {routes}\n </ClientContext>,\n ssrContent\n );\n\n return fullHtml;\n }\n\n /** adds elements to the Heads Up Display */\n registerHudItem = (element: ReactNode) => {\n this.hudSlot.register(element);\n };\n\n /**\n * adds global context at the ui root\n * @deprecated replace with `.registerRenderHooks({ reactContext })`.\n */\n registerContext<T>(context: ComponentType<ContextProps<T>>) {\n this.renderPluginsSlot.register({ reactContext: context });\n }\n\n registerRoot(uiRoot: UIRootFactory) {\n return this.uiRootSlot.register(uiRoot);\n }\n\n registerRenderHooks<T, Y>(plugin: RenderPlugin<T, Y>) {\n return this.renderPluginsSlot.register(plugin);\n }\n\n private getLifecyclePlugins() {\n const lifecyclePlugins = this.renderPluginsSlot.toArray().map(([key, plugin]) => {\n if (plugin.key) return plugin;\n\n // for backward compatibility\n return { ...plugin, key };\n });\n\n // react-router should register its plugin, when we can reverse it's dependency to depend on Ui\n lifecyclePlugins.unshift(this.router.renderPlugin);\n\n return lifecyclePlugins;\n }\n\n private getRoot(rootExtension: string) {\n return this.uiRootSlot.get(rootExtension);\n }\n\n static slots = [Slot.withType<UIRootFactory>(), Slot.withType<ReactNode>(), Slot.withType<RenderPlugin>()];\n\n static dependencies = [GraphqlAspect, ReactRouterAspect];\n\n static runtime = UIRuntime;\n\n static async provider(\n [GraphqlUi, router]: [GraphqlUI, ReactRouterUI],\n config,\n [uiRootSlot, hudSlot, renderLifecycleSlot]: [UIRootRegistry, HudSlot, RenderPluginsSlot]\n ) {\n const uiUi = new UiUI(router, uiRootSlot, hudSlot, renderLifecycleSlot);\n\n if (GraphqlUi) uiUi.registerRenderHooks(GraphqlUi.renderPlugins);\n\n return uiUi;\n }\n}\n\nUIAspect.addRuntime(UiUI);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAEA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAC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