@teambit/ui 0.0.880 → 0.0.882
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/create-root.js +2 -26
- package/dist/create-root.js.map +1 -1
- package/dist/events/index.js +0 -2
- package/dist/events/index.js.map +1 -1
- package/dist/events/ui-server-started-event.js +1 -12
- package/dist/events/ui-server-started-event.js.map +1 -1
- package/dist/exceptions/index.js +0 -6
- package/dist/exceptions/index.js.map +1 -1
- package/dist/exceptions/unknown-build-error.js +0 -3
- package/dist/exceptions/unknown-build-error.js.map +1 -1
- package/dist/exceptions/unknown-ui.js +0 -5
- package/dist/exceptions/unknown-ui.js.map +1 -1
- package/dist/index.js +0 -14
- package/dist/index.js.map +1 -1
- package/dist/ssr-middleware/index.js +0 -3
- package/dist/ssr-middleware/index.js.map +1 -1
- package/dist/ssr-middleware/ssr-middleware.js +0 -39
- package/dist/ssr-middleware/ssr-middleware.js.map +1 -1
- package/dist/start.cmd.js +8 -30
- package/dist/start.cmd.js.map +1 -1
- package/dist/ui/client-context.js +1 -27
- package/dist/ui/client-context.js.map +1 -1
- package/dist/ui-build.cmd.js +0 -13
- package/dist/ui-build.cmd.js.map +1 -1
- package/dist/ui-server.js +22 -83
- package/dist/ui-server.js.map +1 -1
- package/dist/ui.aspect.js +0 -6
- package/dist/ui.aspect.js.map +1 -1
- package/dist/ui.cli.rt.js +1 -0
- package/dist/ui.cli.rt.js.map +1 -1
- package/dist/ui.composition.js +0 -6
- package/dist/ui.composition.js.map +1 -1
- package/dist/ui.main.runtime.js +15 -150
- package/dist/ui.main.runtime.js.map +1 -1
- package/dist/ui.runtime.js +1 -0
- package/dist/ui.runtime.js.map +1 -1
- package/dist/ui.ui.runtime.js +9 -49
- package/dist/ui.ui.runtime.js.map +1 -1
- package/dist/webpack/html.js +0 -1
- package/dist/webpack/html.js.map +1 -1
- package/dist/webpack/postcss.config.js +7 -3
- package/dist/webpack/postcss.config.js.map +1 -1
- package/dist/webpack/webpack.base.config.js +45 -65
- package/dist/webpack/webpack.base.config.js.map +1 -1
- package/dist/webpack/webpack.browser.config.js +3 -31
- package/dist/webpack/webpack.browser.config.js.map +1 -1
- package/dist/webpack/webpack.dev.config.js +25 -63
- package/dist/webpack/webpack.dev.config.js.map +1 -1
- package/dist/webpack/webpack.ssr.config.js +5 -14
- package/dist/webpack/webpack.ssr.config.js.map +1 -1
- package/package-tar/teambit-ui-0.0.882.tgz +0 -0
- package/package.json +15 -15
- package/{preview-1666312873430.js → preview-1666496165706.js} +2 -2
- package/package-tar/teambit-ui-0.0.880.tgz +0 -0
|
@@ -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","pMapSeries","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","onPreStartFuncs","invokeOnStart","onStartFuncs","registerUiRoot","get","uis","length","priority","isHostAvailable","Boolean","getHost","getUiName","map","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 pMapSeries from 'p-map-series';\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 pMapSeries(plugins, (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 onPreStartFuncs = this.preStartSlot.values();\n await pMapSeries(onPreStartFuncs, async (fn) => fn(preStartOpts));\n }\n\n async invokeOnStart(): Promise<ComponentType[]> {\n const onStartFuncs = this.onStartSlot.values();\n const startPlugins = await pMapSeries(onStartFuncs, async (fn) => fn());\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 path?: string\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(path || __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;;EA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K,eAA1F,CAHmB,EAWnBtK,OAXmB,EAYnB;IACA;IACA,MAAMD,MAAM,GAAGsK,UAAU,CAACE,YAAX,CAAwBtF,cAAA,CAASC,EAAjC,CAAf;IAEA,MAAMR,EAAE,GAAG,IAAIxF,MAAJ,CACTE,MADS,EAETC,MAFS,EAGTC,OAHS,EAITC,UAJS,EAKTC,OALS,EAMTC,YANS,EAOTC,WAPS,EAQTC,sBARS,EASTC,wBATS,EAUTC,kBAVS,EAWTC,KAXS,EAYTC,MAZS,EAaTC,OAbS,EAcTsK,eAdS,CAAX;IAgBAF,GAAG,CAAC9G,QAAJ,CAAa,KAAIkH,iBAAJ,EAAa9F,EAAb,EAAiB3E,MAAjB,CAAb,EAAuC,KAAI0K,qBAAJ,EAAe/F,EAAf,CAAvC;IACA,OAAOA,EAAP;EACD;;AAvciB;;;gCAAPxF,M,mBA2YsB;EAC/BsB,SAAS,EAAE,YADoB;EAE/BqE,SAAS,EAAE,CAAC,IAAD,EAAO,IAAP,CAFoB;EAG/BO,IAAI,EAAE;AAHyB,C;gCA3YtBlG,M,aAiZMwL,kB;gCAjZNxL,M,kBAkZW,CACpByL,iBADoB,EAEpBC,gBAFoB,EAGpBC,wBAHoB,EAIpBC,wBAJoB,EAKpBC,4BALoB,EAMpBC,oBANoB,EAOpBC,sBAPoB,C;gCAlZX/L,M,WA4ZI,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;;AA8CjBlG,cAAA,CAASmG,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","pMapSeries","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","onPreStartFuncs","invokeOnStart","onStartFuncs","registerUiRoot","get","uis","length","priority","isHostAvailable","Boolean","getHost","getUiName","map","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 pMapSeries from 'p-map-series';\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 pMapSeries(plugins, (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 onPreStartFuncs = this.preStartSlot.values();\n await pMapSeries(onPreStartFuncs, async (fn) => fn(preStartOpts));\n }\n\n async invokeOnStart(): Promise<ComponentType[]> {\n const onStartFuncs = this.onStartSlot.values();\n const startPlugins = await pMapSeries(onStartFuncs, async (fn) => fn());\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 path?: string\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(path || __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;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;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;AAqFO,MAAM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KAAI0K,qBAAU,EAAC/F,EAAE,CAAC,CAAC;IAC1D,OAAOA,EAAE;EACX;AACF;AAAC;AAAA,gCAxcYxF,MAAM,mBA2YgB;EAC/BsB,SAAS,EAAE,YAAY;EACvBqE,SAAS,EAAE,CAAC,IAAI,EAAE,IAAI,CAAC;EACvBO,IAAI,EAAE;AACR,CAAC;AAAA,gCA/YUlG,MAAM,aAiZAwL,kBAAW;AAAA,gCAjZjBxL,MAAM,kBAkZK,CACpByL,iBAAY,EACZC,gBAAS,EACTC,wBAAa,EACbC,wBAAa,EACbC,4BAAe,EACfC,oBAAW,EACXC,sBAAY,CACb;AAAA,gCA1ZU/L,MAAM,WA4ZF,CACbgM,eAAI,CAACC,QAAQ,EAAU,EACvBD,eAAI,CAACC,QAAQ,EAAY,EACzBD,eAAI,CAACC,QAAQ,EAAW,EACxBD,eAAI,CAACC,QAAQ,EAA0B,EACvCD,eAAI,CAACC,QAAQ,EAA4B,EACzCD,eAAI,CAACC,QAAQ,EAAe,CAC7B;AAuCHlG,cAAQ,CAACmG,UAAU,CAAClM,MAAM,CAAC"}
|
package/dist/ui.runtime.js
CHANGED
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
// import { ChangeLogUI } from '../changelog/changelog.ui';
|
|
6
6
|
// import { ComponentUI } from '../component';
|
|
7
7
|
// import { CompositionsUI } from '../compositions/compositions.ui';
|
|
8
|
+
|
|
8
9
|
// /**
|
|
9
10
|
// * configure all core extensions
|
|
10
11
|
// * TODO: pass all other extensions from above.
|
package/dist/ui.runtime.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["ui.runtime.ts"],"sourcesContent":["// import harmony from '@teambit/harmony';\n// import { UIRuntimeExtension } from './ui.ui';\n// import { DocsUI } from '../docs/docs.ui';\n// import { TesterUI } from '../tester/tester.ui';\n// import { ChangeLogUI } from '../changelog/changelog.ui';\n// import { ComponentUI } from '../component';\n// import { CompositionsUI } from '../compositions/compositions.ui';\n\n// /**\n// * configure all core extensions\n// * TODO: pass all other extensions from above.\n// */\n// harmony\n// .run([UIRuntimeExtension, TesterUI, ChangeLogUI, CompositionsUI, DocsUI, ComponentUI])\n// .then(() => {\n// const uiExtension = harmony.get<UIRuntimeExtension>('UIRuntimeExtension');\n// uiExtension.render();\n// })\n// .catch((err) => {\n// throw err;\n// });\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA
|
|
1
|
+
{"version":3,"names":[],"sources":["ui.runtime.ts"],"sourcesContent":["// import harmony from '@teambit/harmony';\n// import { UIRuntimeExtension } from './ui.ui';\n// import { DocsUI } from '../docs/docs.ui';\n// import { TesterUI } from '../tester/tester.ui';\n// import { ChangeLogUI } from '../changelog/changelog.ui';\n// import { ComponentUI } from '../component';\n// import { CompositionsUI } from '../compositions/compositions.ui';\n\n// /**\n// * configure all core extensions\n// * TODO: pass all other extensions from above.\n// */\n// harmony\n// .run([UIRuntimeExtension, TesterUI, ChangeLogUI, CompositionsUI, DocsUI, ComponentUI])\n// .then(() => {\n// const uiExtension = harmony.get<UIRuntimeExtension>('UIRuntimeExtension');\n// uiExtension.render();\n// })\n// .catch((err) => {\n// throw err;\n// });\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA"}
|
package/dist/ui.ui.runtime.js
CHANGED
|
@@ -1,100 +1,70 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
4
|
require("core-js/modules/es.array.iterator.js");
|
|
6
|
-
|
|
7
5
|
require("core-js/modules/es.promise.js");
|
|
8
|
-
|
|
9
6
|
Object.defineProperty(exports, "__esModule", {
|
|
10
7
|
value: true
|
|
11
8
|
});
|
|
12
9
|
exports.UiUI = void 0;
|
|
13
|
-
|
|
14
10
|
function _defineProperty2() {
|
|
15
11
|
const data = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
16
|
-
|
|
17
12
|
_defineProperty2 = function () {
|
|
18
13
|
return data;
|
|
19
14
|
};
|
|
20
|
-
|
|
21
15
|
return data;
|
|
22
16
|
}
|
|
23
|
-
|
|
24
17
|
function _graphql() {
|
|
25
18
|
const data = require("@teambit/graphql");
|
|
26
|
-
|
|
27
19
|
_graphql = function () {
|
|
28
20
|
return data;
|
|
29
21
|
};
|
|
30
|
-
|
|
31
22
|
return data;
|
|
32
23
|
}
|
|
33
|
-
|
|
34
24
|
function _harmony() {
|
|
35
25
|
const data = require("@teambit/harmony");
|
|
36
|
-
|
|
37
26
|
_harmony = function () {
|
|
38
27
|
return data;
|
|
39
28
|
};
|
|
40
|
-
|
|
41
29
|
return data;
|
|
42
30
|
}
|
|
43
|
-
|
|
44
31
|
function _reactRouter() {
|
|
45
32
|
const data = require("@teambit/react-router");
|
|
46
|
-
|
|
47
33
|
_reactRouter = function () {
|
|
48
34
|
return data;
|
|
49
35
|
};
|
|
50
|
-
|
|
51
36
|
return data;
|
|
52
37
|
}
|
|
53
|
-
|
|
54
38
|
function _reactRendering() {
|
|
55
39
|
const data = require("@teambit/react.rendering.ssr");
|
|
56
|
-
|
|
57
40
|
_reactRendering = function () {
|
|
58
41
|
return data;
|
|
59
42
|
};
|
|
60
|
-
|
|
61
43
|
return data;
|
|
62
44
|
}
|
|
63
|
-
|
|
64
45
|
function _react() {
|
|
65
46
|
const data = _interopRequireDefault(require("react"));
|
|
66
|
-
|
|
67
47
|
_react = function () {
|
|
68
48
|
return data;
|
|
69
49
|
};
|
|
70
|
-
|
|
71
50
|
return data;
|
|
72
51
|
}
|
|
73
|
-
|
|
74
52
|
function _ui() {
|
|
75
53
|
const data = require("./ui.aspect");
|
|
76
|
-
|
|
77
54
|
_ui = function () {
|
|
78
55
|
return data;
|
|
79
56
|
};
|
|
80
|
-
|
|
81
57
|
return data;
|
|
82
58
|
}
|
|
83
|
-
|
|
84
59
|
function _clientContext() {
|
|
85
60
|
const data = require("./ui/client-context");
|
|
86
|
-
|
|
87
61
|
_clientContext = function () {
|
|
88
62
|
return data;
|
|
89
63
|
};
|
|
90
|
-
|
|
91
64
|
return data;
|
|
92
65
|
}
|
|
93
|
-
|
|
94
66
|
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; }
|
|
95
|
-
|
|
96
67
|
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; }
|
|
97
|
-
|
|
98
68
|
/**
|
|
99
69
|
* extension
|
|
100
70
|
*/
|
|
@@ -107,10 +77,8 @@ class UiUI {
|
|
|
107
77
|
/**
|
|
108
78
|
* ui root registry.
|
|
109
79
|
*/
|
|
110
|
-
uiRootSlot,
|
|
111
|
-
/**
|
|
112
|
-
hudSlot,
|
|
113
|
-
/** hooks into the ssr render process */
|
|
80
|
+
uiRootSlot, /** slot for overlay ui elements */
|
|
81
|
+
hudSlot, /** hooks into the ssr render process */
|
|
114
82
|
renderPluginsSlot) {
|
|
115
83
|
this.router = router;
|
|
116
84
|
this.uiRootSlot = uiRootSlot;
|
|
@@ -120,9 +88,8 @@ class UiUI {
|
|
|
120
88
|
this.hudSlot.register(element);
|
|
121
89
|
});
|
|
122
90
|
}
|
|
123
|
-
/** render and rehydrate client-side */
|
|
124
|
-
|
|
125
91
|
|
|
92
|
+
/** render and rehydrate client-side */
|
|
126
93
|
async render(rootExtension) {
|
|
127
94
|
const rootFactory = this.getRoot(rootExtension);
|
|
128
95
|
if (!rootFactory) throw new Error(`root: ${rootExtension} was not found`);
|
|
@@ -133,9 +100,8 @@ class UiUI {
|
|
|
133
100
|
const reactSsr = new (_reactRendering().BrowserRenderer)(lifecyclePlugins);
|
|
134
101
|
await reactSsr.render( /*#__PURE__*/_react().default.createElement(_clientContext().ClientContext, null, hudItems, routes));
|
|
135
102
|
}
|
|
136
|
-
/** render dehydrated server-side */
|
|
137
|
-
|
|
138
103
|
|
|
104
|
+
/** render dehydrated server-side */
|
|
139
105
|
async renderSsr(rootExtension, ssrContent) {
|
|
140
106
|
const rootFactory = this.getRoot(rootExtension);
|
|
141
107
|
if (!rootFactory) throw new Error(`root: ${rootExtension} was not found`);
|
|
@@ -147,8 +113,8 @@ class UiUI {
|
|
|
147
113
|
const fullHtml = await reactSsr.render( /*#__PURE__*/_react().default.createElement(_clientContext().ClientContext, null, hudItems, routes), ssrContent);
|
|
148
114
|
return fullHtml;
|
|
149
115
|
}
|
|
150
|
-
/** adds elements to the Heads Up Display */
|
|
151
116
|
|
|
117
|
+
/** adds elements to the Heads Up Display */
|
|
152
118
|
|
|
153
119
|
/**
|
|
154
120
|
* adds global context at the ui root
|
|
@@ -159,45 +125,39 @@ class UiUI {
|
|
|
159
125
|
reactContext: context
|
|
160
126
|
});
|
|
161
127
|
}
|
|
162
|
-
|
|
163
128
|
registerRoot(uiRoot) {
|
|
164
129
|
return this.uiRootSlot.register(uiRoot);
|
|
165
130
|
}
|
|
166
|
-
|
|
167
131
|
registerRenderHooks(plugin) {
|
|
168
132
|
return this.renderPluginsSlot.register(plugin);
|
|
169
133
|
}
|
|
170
|
-
|
|
171
134
|
getLifecyclePlugins() {
|
|
172
135
|
const lifecyclePlugins = this.renderPluginsSlot.toArray().map(([key, plugin]) => {
|
|
173
|
-
if (plugin.key) return plugin;
|
|
136
|
+
if (plugin.key) return plugin;
|
|
174
137
|
|
|
138
|
+
// for backward compatibility
|
|
175
139
|
return _objectSpread(_objectSpread({}, plugin), {}, {
|
|
176
140
|
key
|
|
177
141
|
});
|
|
178
|
-
});
|
|
142
|
+
});
|
|
179
143
|
|
|
144
|
+
// react-router should register its plugin, when we can reverse it's dependency to depend on Ui
|
|
180
145
|
lifecyclePlugins.unshift(this.router.renderPlugin);
|
|
181
146
|
return lifecyclePlugins;
|
|
182
147
|
}
|
|
183
|
-
|
|
184
148
|
getRoot(rootExtension) {
|
|
185
149
|
return this.uiRootSlot.get(rootExtension);
|
|
186
150
|
}
|
|
187
|
-
|
|
188
151
|
static async provider([GraphqlUi, router], config, [uiRootSlot, hudSlot, renderLifecycleSlot]) {
|
|
189
152
|
const uiUi = new UiUI(router, uiRootSlot, hudSlot, renderLifecycleSlot);
|
|
190
153
|
if (GraphqlUi) uiUi.registerRenderHooks(GraphqlUi.renderPlugins);
|
|
191
154
|
return uiUi;
|
|
192
155
|
}
|
|
193
|
-
|
|
194
156
|
}
|
|
195
|
-
|
|
196
157
|
exports.UiUI = UiUI;
|
|
197
158
|
(0, _defineProperty2().default)(UiUI, "slots", [_harmony().Slot.withType(), _harmony().Slot.withType(), _harmony().Slot.withType()]);
|
|
198
159
|
(0, _defineProperty2().default)(UiUI, "dependencies", [_graphql().GraphqlAspect, _reactRouter().ReactRouterAspect]);
|
|
199
160
|
(0, _defineProperty2().default)(UiUI, "runtime", _ui().UIRuntime);
|
|
200
|
-
|
|
201
161
|
_ui().UIAspect.addRuntime(UiUI);
|
|
202
162
|
|
|
203
163
|
//# sourceMappingURL=ui.ui.runtime.js.map
|
|
@@ -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","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":"
|
|
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;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAGA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAGA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAAoD;AAAA;AAMpD;AACA;AACA;AACO,MAAMA,IAAI,CAAC;EAChBC,WAAW;EACT;AACJ;AACA;EACYC,MAAqB;EAC7B;AACJ;AACA;EACYC,UAA0B,EAClC;EACQC,OAAgB,EACxB;EACQC,iBAAoC,EAC5C;IAAA,KATQH,MAAqB,GAArBA,MAAqB;IAAA,KAIrBC,UAA0B,GAA1BA,UAA0B;IAAA,KAE1BC,OAAgB,GAAhBA,OAAgB;IAAA,KAEhBC,iBAAoC,GAApCA,iBAAoC;IAAA,yDA4C3BC,OAAkB,IAAK;MACxC,IAAI,CAACF,OAAO,CAACG,QAAQ,CAACD,OAAO,CAAC;IAChC,CAAC;EA7CE;;EAEH;EACA,MAAME,MAAM,CAACC,aAAqB,EAAiB;IACjD,MAAMC,WAAW,GAAG,IAAI,CAACC,OAAO,CAACF,aAAa,CAAC;IAC/C,IAAI,CAACC,WAAW,EAAE,MAAM,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kBAiGO,CAAC8C,wBAAa,EAAEC,gCAAiB,CAAC;AAAA,gCAjG7C/C,IAAI,aAmGEgD,eAAS;AAe5BC,cAAQ,CAACC,UAAU,CAAClD,IAAI,CAAC"}
|
package/dist/webpack/html.js
CHANGED
package/dist/webpack/html.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["html","title","withDevTools"],"sources":["html.ts"],"sourcesContent":["/** fallback html template for the main UI, in case ssr is not active */\nexport function html(title: string, withDevTools?: boolean) {\n return () => `\n <!DOCTYPE html>\n <html lang=\"en\">\n <head>\n <meta charset=\"utf-8\">\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\n <title>${title}</title>\n <script>\n // Allow to use react dev-tools inside the examples\n ${\n withDevTools\n ? ''\n : 'try { window.__REACT_DEVTOOLS_GLOBAL_HOOK__ = window.parent.__REACT_DEVTOOLS_GLOBAL_HOOK__; } catch {}'\n }\n </script>\n </head>\n <body>\n <div id=\"root\"></div>\n </body>\n </html> \n `;\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"names":["html","title","withDevTools"],"sources":["html.ts"],"sourcesContent":["/** fallback html template for the main UI, in case ssr is not active */\nexport function html(title: string, withDevTools?: boolean) {\n return () => `\n <!DOCTYPE html>\n <html lang=\"en\">\n <head>\n <meta charset=\"utf-8\">\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\n <title>${title}</title>\n <script>\n // Allow to use react dev-tools inside the examples\n ${\n withDevTools\n ? ''\n : 'try { window.__REACT_DEVTOOLS_GLOBAL_HOOK__ = window.parent.__REACT_DEVTOOLS_GLOBAL_HOOK__; } catch {}'\n }\n </script>\n </head>\n <body>\n <div id=\"root\"></div>\n </body>\n </html> \n `;\n}\n"],"mappings":";;;;;;AAAA;AACO,SAASA,IAAI,CAACC,KAAa,EAAEC,YAAsB,EAAE;EAC1D,OAAO,MAAO;AAChB;AACA;AACA;AACA;AACA;AACA,eAAeD,KAAM;AACrB;AACA;AACA,QACQC,YAAY,GACR,EAAE,GACF,wGACL;AACP;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH"}
|
|
@@ -5,18 +5,22 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.postCssConfig = void 0;
|
|
7
7
|
// import postcssFlexbugsFixes from 'postcss-flexbugs-fixes';
|
|
8
|
+
|
|
8
9
|
const postCssConfig = {
|
|
9
10
|
// Necessary for external CSS imports to work
|
|
10
11
|
// https://github.com/facebook/create-react-app/issues/2677
|
|
11
12
|
ident: 'postcss',
|
|
12
|
-
plugins: [
|
|
13
|
-
|
|
13
|
+
plugins: [
|
|
14
|
+
// eslint-disable-next-line global-require
|
|
15
|
+
require.resolve('postcss-flexbugs-fixes'),
|
|
16
|
+
// eslint-disable-next-line global-require
|
|
14
17
|
require('postcss-preset-env')({
|
|
15
18
|
autoprefixer: {
|
|
16
19
|
flexbox: 'no-2009'
|
|
17
20
|
},
|
|
18
21
|
stage: 3
|
|
19
|
-
}),
|
|
22
|
+
}),
|
|
23
|
+
// Adds PostCSS Normalize as the reset css with default options,
|
|
20
24
|
// so that it honors browserslist config in package.json
|
|
21
25
|
// which in turn let's users customize the target behavior as per their needs.
|
|
22
26
|
require.resolve('postcss-normalize')]
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["postCssConfig","ident","plugins","require","resolve","autoprefixer","flexbox","stage"],"sources":["postcss.config.ts"],"sourcesContent":["// import postcssFlexbugsFixes from 'postcss-flexbugs-fixes';\n\nexport const postCssConfig = {\n // Necessary for external CSS imports to work\n // https://github.com/facebook/create-react-app/issues/2677\n ident: 'postcss',\n plugins: [\n // eslint-disable-next-line global-require\n require.resolve('postcss-flexbugs-fixes'),\n // eslint-disable-next-line global-require\n require('postcss-preset-env')({\n autoprefixer: {\n flexbox: 'no-2009',\n },\n stage: 3,\n }),\n // Adds PostCSS Normalize as the reset css with default options,\n // so that it honors browserslist config in package.json\n // which in turn let's users customize the target behavior as per their needs.\n require.resolve('postcss-normalize'),\n ],\n};\n"],"mappings":";;;;;;AAAA
|
|
1
|
+
{"version":3,"names":["postCssConfig","ident","plugins","require","resolve","autoprefixer","flexbox","stage"],"sources":["postcss.config.ts"],"sourcesContent":["// import postcssFlexbugsFixes from 'postcss-flexbugs-fixes';\n\nexport const postCssConfig = {\n // Necessary for external CSS imports to work\n // https://github.com/facebook/create-react-app/issues/2677\n ident: 'postcss',\n plugins: [\n // eslint-disable-next-line global-require\n require.resolve('postcss-flexbugs-fixes'),\n // eslint-disable-next-line global-require\n require('postcss-preset-env')({\n autoprefixer: {\n flexbox: 'no-2009',\n },\n stage: 3,\n }),\n // Adds PostCSS Normalize as the reset css with default options,\n // so that it honors browserslist config in package.json\n // which in turn let's users customize the target behavior as per their needs.\n require.resolve('postcss-normalize'),\n ],\n};\n"],"mappings":";;;;;;AAAA;;AAEO,MAAMA,aAAa,GAAG;EAC3B;EACA;EACAC,KAAK,EAAE,SAAS;EAChBC,OAAO,EAAE;EACP;EACAC,OAAO,CAACC,OAAO,CAAC,wBAAwB,CAAC;EACzC;EACAD,OAAO,CAAC,oBAAoB,CAAC,CAAC;IAC5BE,YAAY,EAAE;MACZC,OAAO,EAAE;IACX,CAAC;IACDC,KAAK,EAAE;EACT,CAAC,CAAC;EACF;EACA;EACA;EACAJ,OAAO,CAACC,OAAO,CAAC,mBAAmB,CAAC;AAExC,CAAC;AAAC"}
|