@teambit/ui 0.0.881 → 0.0.883

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.
Files changed (54) hide show
  1. package/dist/create-root.js +2 -26
  2. package/dist/create-root.js.map +1 -1
  3. package/dist/events/index.js +0 -2
  4. package/dist/events/index.js.map +1 -1
  5. package/dist/events/ui-server-started-event.js +1 -12
  6. package/dist/events/ui-server-started-event.js.map +1 -1
  7. package/dist/exceptions/index.js +0 -6
  8. package/dist/exceptions/index.js.map +1 -1
  9. package/dist/exceptions/unknown-build-error.js +0 -3
  10. package/dist/exceptions/unknown-build-error.js.map +1 -1
  11. package/dist/exceptions/unknown-ui.js +0 -5
  12. package/dist/exceptions/unknown-ui.js.map +1 -1
  13. package/dist/index.js +0 -14
  14. package/dist/index.js.map +1 -1
  15. package/dist/ssr-middleware/index.js +0 -3
  16. package/dist/ssr-middleware/index.js.map +1 -1
  17. package/dist/ssr-middleware/ssr-middleware.js +0 -39
  18. package/dist/ssr-middleware/ssr-middleware.js.map +1 -1
  19. package/dist/start.cmd.js +8 -30
  20. package/dist/start.cmd.js.map +1 -1
  21. package/dist/ui/client-context.js +1 -27
  22. package/dist/ui/client-context.js.map +1 -1
  23. package/dist/ui-build.cmd.js +0 -13
  24. package/dist/ui-build.cmd.js.map +1 -1
  25. package/dist/ui-server.js +22 -83
  26. package/dist/ui-server.js.map +1 -1
  27. package/dist/ui.aspect.js +0 -6
  28. package/dist/ui.aspect.js.map +1 -1
  29. package/dist/ui.cli.rt.js +1 -0
  30. package/dist/ui.cli.rt.js.map +1 -1
  31. package/dist/ui.composition.js +0 -6
  32. package/dist/ui.composition.js.map +1 -1
  33. package/dist/ui.main.runtime.js +15 -150
  34. package/dist/ui.main.runtime.js.map +1 -1
  35. package/dist/ui.runtime.js +1 -0
  36. package/dist/ui.runtime.js.map +1 -1
  37. package/dist/ui.ui.runtime.js +9 -49
  38. package/dist/ui.ui.runtime.js.map +1 -1
  39. package/dist/webpack/html.js +0 -1
  40. package/dist/webpack/html.js.map +1 -1
  41. package/dist/webpack/postcss.config.js +7 -3
  42. package/dist/webpack/postcss.config.js.map +1 -1
  43. package/dist/webpack/webpack.base.config.js +45 -65
  44. package/dist/webpack/webpack.base.config.js.map +1 -1
  45. package/dist/webpack/webpack.browser.config.js +3 -31
  46. package/dist/webpack/webpack.browser.config.js.map +1 -1
  47. package/dist/webpack/webpack.dev.config.js +25 -63
  48. package/dist/webpack/webpack.dev.config.js.map +1 -1
  49. package/dist/webpack/webpack.ssr.config.js +5 -14
  50. package/dist/webpack/webpack.ssr.config.js.map +1 -1
  51. package/package-tar/teambit-ui-0.0.883.tgz +0 -0
  52. package/package.json +10 -10
  53. package/{preview-1666409808293.js → preview-1666582798766.js} +2 -2
  54. package/package-tar/teambit-ui-0.0.881.tgz +0 -0
package/dist/ui-server.js CHANGED
@@ -1,140 +1,98 @@
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.UIServer = 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 _lodash() {
25
18
  const data = require("lodash");
26
-
27
19
  _lodash = function () {
28
20
  return data;
29
21
  };
30
-
31
22
  return data;
32
23
  }
33
-
34
24
  function _express() {
35
25
  const data = _interopRequireDefault(require("express"));
36
-
37
26
  _express = function () {
38
27
  return data;
39
28
  };
40
-
41
29
  return data;
42
30
  }
43
-
44
31
  function _expressHistoryApiFallback() {
45
32
  const data = _interopRequireDefault(require("express-history-api-fallback"));
46
-
47
33
  _expressHistoryApiFallback = function () {
48
34
  return data;
49
35
  };
50
-
51
36
  return data;
52
37
  }
53
-
54
38
  function _toolboxNetwork() {
55
39
  const data = require("@teambit/toolbox.network.get-port");
56
-
57
40
  _toolboxNetwork = function () {
58
41
  return data;
59
42
  };
60
-
61
43
  return data;
62
44
  }
63
-
64
45
  function _httpProxy() {
65
46
  const data = _interopRequireDefault(require("http-proxy"));
66
-
67
47
  _httpProxy = function () {
68
48
  return data;
69
49
  };
70
-
71
50
  return data;
72
51
  }
73
-
74
52
  function _path() {
75
53
  const data = require("path");
76
-
77
54
  _path = function () {
78
55
  return data;
79
56
  };
80
-
81
57
  return data;
82
58
  }
83
-
84
59
  function _webpack() {
85
60
  const data = _interopRequireDefault(require("webpack"));
86
-
87
61
  _webpack = function () {
88
62
  return data;
89
63
  };
90
-
91
64
  return data;
92
65
  }
93
-
94
66
  function _webpackDevServer() {
95
67
  const data = _interopRequireDefault(require("webpack-dev-server"));
96
-
97
68
  _webpackDevServer = function () {
98
69
  return data;
99
70
  };
100
-
101
71
  return data;
102
72
  }
103
-
104
73
  function _ssrMiddleware() {
105
74
  const data = require("./ssr-middleware");
106
-
107
75
  _ssrMiddleware = function () {
108
76
  return data;
109
77
  };
110
-
111
78
  return data;
112
79
  }
113
-
114
80
  function _ui() {
115
81
  const data = require("./ui.aspect");
116
-
117
82
  _ui = function () {
118
83
  return data;
119
84
  };
120
-
121
85
  return data;
122
86
  }
123
-
124
87
  function _webpackDev() {
125
88
  const data = require("./webpack/webpack.dev.config");
126
-
127
89
  _webpackDev = function () {
128
90
  return data;
129
91
  };
130
-
131
92
  return data;
132
93
  }
133
-
134
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; }
135
-
136
95
  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; }
137
-
138
96
  class UIServer {
139
97
  constructor(graphql, expressExtension, ui, uiRoot, uiRootExtension, logger, publicDir, plugins) {
140
98
  this.graphql = graphql;
@@ -149,49 +107,41 @@ class UIServer {
149
107
  (0, _defineProperty2().default)(this, "setReady", void 0);
150
108
  (0, _defineProperty2().default)(this, "startPromise", new Promise(resolve => this.setReady = resolve));
151
109
  }
152
-
153
110
  getName() {
154
111
  return this.uiRoot.name;
155
112
  }
156
-
157
113
  get port() {
158
114
  return this._port;
159
115
  }
160
- /** the hostname for the server to listen at. Currently statically 'localhost' */
161
-
162
116
 
117
+ /** the hostname for the server to listen at. Currently statically 'localhost' */
163
118
  get host() {
164
119
  return 'localhost';
165
120
  }
166
- /** the server listens at this url */
167
-
168
121
 
122
+ /** the server listens at this url */
169
123
  get fullUrl() {
170
124
  const port = this.port !== 80 ? `:${this.port}` : '';
171
125
  return `http://${this.host}${port}`;
172
126
  }
173
-
174
127
  get buildOptions() {
175
128
  return this.uiRoot.buildOptions;
176
129
  }
130
+
177
131
  /**
178
132
  * get the webpack configuration of the UI server.
179
133
  */
180
-
181
-
182
134
  async getDevConfig() {
183
135
  const aspects = await this.uiRoot.resolveAspects(_ui().UIRuntime.name);
184
136
  return (0, _webpackDev().devConfig)(this.uiRoot.path, [await this.ui.generateRoot(aspects, this.uiRootExtension)], this.uiRoot.name);
185
137
  }
186
-
187
138
  get whenReady() {
188
139
  return Promise.all([this.startPromise, ...this.plugins.map(x => x === null || x === void 0 ? void 0 : x.whenReady)]);
189
140
  }
141
+
190
142
  /**
191
143
  * start a UI server.
192
144
  */
193
-
194
-
195
145
  async start({
196
146
  portRange
197
147
  } = {}) {
@@ -200,11 +150,13 @@ class UIServer {
200
150
  const root = (0, _path().join)(this.uiRoot.path, publicDir);
201
151
  const server = await this.graphql.createServer({
202
152
  app
203
- }); // set up proxy, for things like preview, e.g. '/preview/teambit.react/react'
153
+ });
204
154
 
205
- await this.configureProxy(app, server); // pass through files from public /folder:
206
- // setting `index: false` so index.html will be served by the fallback() middleware
155
+ // set up proxy, for things like preview, e.g. '/preview/teambit.react/react'
156
+ await this.configureProxy(app, server);
207
157
 
158
+ // pass through files from public /folder:
159
+ // setting `index: false` so index.html will be served by the fallback() middleware
208
160
  app.use(_express().default.static(root, {
209
161
  index: false
210
162
  }));
@@ -213,31 +165,30 @@ class UIServer {
213
165
  root,
214
166
  port,
215
167
  app
216
- }); // in any and all other cases, serve index.html.
217
- // No any other endpoints past this will execute
168
+ });
218
169
 
170
+ // in any and all other cases, serve index.html.
171
+ // No any other endpoints past this will execute
219
172
  app.use((0, _expressHistoryApiFallback().default)('index.html', {
220
173
  root
221
174
  }));
222
175
  server.listen(port);
223
- this._port = port; // important: we use the string of the following message for the http.e2e.ts. if you change the message,
224
- // please make sure you change the `HTTP_SERVER_READY_MSG` const.
176
+ this._port = port;
225
177
 
178
+ // important: we use the string of the following message for the http.e2e.ts. if you change the message,
179
+ // please make sure you change the `HTTP_SERVER_READY_MSG` const.
226
180
  this.logger.info(`UI server of ${this.uiRootExtension} is listening to port ${port}`);
227
181
  this.setReady();
228
182
  }
229
-
230
183
  getPluginsComponents() {
231
184
  return this.plugins.map(plugin => plugin.render);
232
185
  }
233
-
234
186
  async setupServerSideRendering({
235
187
  root,
236
188
  port,
237
189
  app
238
190
  }) {
239
191
  var _this$buildOptions;
240
-
241
192
  if (!((_this$buildOptions = this.buildOptions) !== null && _this$buildOptions !== void 0 && _this$buildOptions.ssr)) return;
242
193
  const ssrMiddleware = await (0, _ssrMiddleware().createSsrMiddleware)({
243
194
  root,
@@ -245,23 +196,21 @@ class UIServer {
245
196
  title: this.uiRoot.name,
246
197
  logger: this.logger
247
198
  });
248
-
249
199
  if (!ssrMiddleware) {
250
200
  this.logger.warn('[ssr] middleware failed setup');
251
201
  return;
252
- } // eslint-disable-next-line @typescript-eslint/no-misused-promises
253
-
202
+ }
254
203
 
204
+ // eslint-disable-next-line @typescript-eslint/no-misused-promises
255
205
  app.get('*', ssrMiddleware);
256
206
  this.logger.debug('[ssr] serving for "*"');
257
207
  }
258
-
259
208
  async configureProxy(app, server) {
260
209
  const proxServer = _httpProxy().default.createProxyServer();
261
-
262
210
  proxServer.on('error', e => this.logger.error(e.message));
263
- const proxyEntries = await this.getProxyFromPlugins(); // TODO - should use https://github.com/chimurai/http-proxy-middleware
211
+ const proxyEntries = await this.getProxyFromPlugins();
264
212
 
213
+ // TODO - should use https://github.com/chimurai/http-proxy-middleware
265
214
  server.on('upgrade', function (req, socket, head) {
266
215
  const entry = proxyEntries.find(proxy => proxy.context.some(item => item === req.url));
267
216
  if (!entry) return;
@@ -279,11 +228,10 @@ class UIServer {
279
228
  });
280
229
  });
281
230
  }
231
+
282
232
  /**
283
233
  * start a UI dev server.
284
234
  */
285
-
286
-
287
235
  async dev({
288
236
  portRange
289
237
  } = {}) {
@@ -294,25 +242,22 @@ class UIServer {
294
242
  const expressAppPort = this._port;
295
243
  const config = await this.getDevConfig();
296
244
  const compiler = (0, _webpack().default)(config);
297
- const devServerConfig = await this.getDevServerConfig(devServerPort, expressAppPort, config.devServer); // @ts-ignore in the capsules it throws an error about compatibilities issues between webpack.compiler and webpackDevServer/webpack/compiler
298
-
245
+ const devServerConfig = await this.getDevServerConfig(devServerPort, expressAppPort, config.devServer);
246
+ // @ts-ignore in the capsules it throws an error about compatibilities issues between webpack.compiler and webpackDevServer/webpack/compiler
299
247
  const devServer = new (_webpackDevServer().default)(devServerConfig, compiler);
300
248
  await devServer.start();
301
249
  this._port = devServerPort;
302
250
  return devServer;
303
251
  }
304
-
305
252
  async selectPort(portRange) {
306
253
  return _toolboxNetwork().Port.getPortFromRange(portRange || [3100, 3200]);
307
254
  }
308
-
309
255
  async getProxyFromPlugins() {
310
256
  const proxiesByPlugin = this.plugins.map(plugin => {
311
257
  return plugin.getProxy ? plugin.getProxy() : [];
312
258
  });
313
259
  return (0, _lodash().flatten)(await Promise.all(proxiesByPlugin));
314
260
  }
315
-
316
261
  async getProxy(port = 4000) {
317
262
  const proxyEntries = await this.getProxyFromPlugins();
318
263
  const gqlProxies = [{
@@ -326,24 +271,18 @@ class UIServer {
326
271
  }];
327
272
  return gqlProxies.concat(proxyEntries);
328
273
  }
329
-
330
274
  async getDevServerConfig(appPort, gqlPort, config) {
331
275
  const proxy = await this.getProxy(gqlPort);
332
-
333
276
  const devServerConf = _objectSpread(_objectSpread({}, config), {}, {
334
277
  proxy,
335
278
  port: appPort
336
279
  });
337
-
338
280
  return devServerConf;
339
281
  }
340
-
341
282
  static create(props) {
342
283
  return new UIServer(props.graphql, props.express, props.ui, props.uiRoot, props.uiRootExtension, props.logger, props.publicDir, props.startPlugins);
343
284
  }
344
-
345
285
  }
346
-
347
286
  exports.UIServer = UIServer;
348
287
 
349
288
  //# sourceMappingURL=ui-server.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["UIServer","constructor","graphql","expressExtension","ui","uiRoot","uiRootExtension","logger","publicDir","plugins","Promise","resolve","setReady","getName","name","port","_port","host","fullUrl","buildOptions","getDevConfig","aspects","resolveAspects","UIRuntime","devConfig","path","generateRoot","whenReady","all","startPromise","map","x","start","portRange","app","createApp","root","join","server","createServer","configureProxy","use","express","static","index","Port","getPortFromRange","setupServerSideRendering","fallback","listen","info","getPluginsComponents","plugin","render","ssr","ssrMiddleware","createSsrMiddleware","title","warn","get","debug","proxServer","httpProxy","createProxyServer","on","e","error","message","proxyEntries","getProxyFromPlugins","req","socket","head","entry","find","proxy","context","some","item","url","ws","target","forEach","route","res","web","originalUrl","dev","devServerPort","selectPort","expressAppPort","config","compiler","webpack","devServerConfig","getDevServerConfig","devServer","WebpackDevServer","proxiesByPlugin","getProxy","flatten","gqlProxies","changeOrigin","concat","appPort","gqlPort","devServerConf","create","props","startPlugins"],"sources":["ui-server.ts"],"sourcesContent":["import { flatten } from 'lodash';\nimport { ExpressMain } from '@teambit/express';\nimport { GraphqlMain } from '@teambit/graphql';\nimport { Logger } from '@teambit/logger';\nimport express, { Express } from 'express';\nimport fallback from 'express-history-api-fallback';\nimport { Port } from '@teambit/toolbox.network.get-port';\nimport { Server } from 'http';\nimport httpProxy from 'http-proxy';\nimport { join } from 'path';\nimport webpack from 'webpack';\nimport WebpackDevServer, { Configuration as WdsConfiguration } from 'webpack-dev-server';\nimport { createSsrMiddleware } from './ssr-middleware';\nimport { StartPlugin } from './start-plugin';\nimport { ProxyEntry, UIRoot } from './ui-root';\nimport { UIRuntime } from './ui.aspect';\nimport { UiMain } from './ui.main.runtime';\n\nimport { devConfig } from './webpack/webpack.dev.config';\n\nexport type UIServerProps = {\n graphql: GraphqlMain;\n express: ExpressMain;\n ui: UiMain;\n uiRoot: UIRoot;\n uiRootExtension: string;\n logger: Logger;\n publicDir: string;\n startPlugins: StartPlugin[];\n};\n\nexport type StartOptions = {\n /**\n * port range for the UI server to bind. default is a port range of 4000-4200.\n */\n portRange?: number[] | number;\n};\n\nexport class UIServer {\n constructor(\n private graphql: GraphqlMain,\n private expressExtension: ExpressMain,\n private ui: UiMain,\n private uiRoot: UIRoot,\n private uiRootExtension: string,\n private logger: Logger,\n private publicDir: string,\n private plugins: StartPlugin[]\n ) {}\n\n getName() {\n return this.uiRoot.name;\n }\n\n private _port = 0;\n\n get port() {\n return this._port;\n }\n\n /** the hostname for the server to listen at. Currently statically 'localhost' */\n get host() {\n return 'localhost';\n }\n\n /** the server listens at this url */\n get fullUrl() {\n const port = this.port !== 80 ? `:${this.port}` : '';\n return `http://${this.host}${port}`;\n }\n\n get buildOptions() {\n return this.uiRoot.buildOptions;\n }\n\n /**\n * get the webpack configuration of the UI server.\n */\n async getDevConfig() {\n const aspects = await this.uiRoot.resolveAspects(UIRuntime.name);\n\n return devConfig(this.uiRoot.path, [await this.ui.generateRoot(aspects, this.uiRootExtension)], this.uiRoot.name);\n }\n\n private setReady: () => void;\n private startPromise = new Promise<void>((resolve) => (this.setReady = resolve));\n get whenReady() {\n return Promise.all([this.startPromise, ...this.plugins.map((x) => x?.whenReady)]);\n }\n\n /**\n * start a UI server.\n */\n async start({ portRange }: StartOptions = {}) {\n const app = this.expressExtension.createApp();\n const publicDir = `/${this.publicDir}`;\n const root = join(this.uiRoot.path, publicDir);\n const server = await this.graphql.createServer({ app });\n\n // set up proxy, for things like preview, e.g. '/preview/teambit.react/react'\n await this.configureProxy(app, server);\n\n // pass through files from public /folder:\n // setting `index: false` so index.html will be served by the fallback() middleware\n app.use(express.static(root, { index: false }));\n\n const port = await Port.getPortFromRange(portRange || [3100, 3200]);\n\n await this.setupServerSideRendering({ root, port, app });\n\n // in any and all other cases, serve index.html.\n // No any other endpoints past this will execute\n app.use(fallback('index.html', { root }));\n\n server.listen(port);\n this._port = port;\n\n // important: we use the string of the following message for the http.e2e.ts. if you change the message,\n // please make sure you change the `HTTP_SERVER_READY_MSG` const.\n this.logger.info(`UI server of ${this.uiRootExtension} is listening to port ${port}`);\n\n this.setReady();\n }\n\n getPluginsComponents() {\n return this.plugins.map((plugin) => plugin.render);\n }\n\n private async setupServerSideRendering({ root, port, app }: { root: string; port: number; app: Express }) {\n if (!this.buildOptions?.ssr) return;\n\n const ssrMiddleware = await createSsrMiddleware({\n root,\n port,\n title: this.uiRoot.name,\n logger: this.logger,\n });\n\n if (!ssrMiddleware) {\n this.logger.warn('[ssr] middleware failed setup');\n return;\n }\n\n // eslint-disable-next-line @typescript-eslint/no-misused-promises\n app.get('*', ssrMiddleware);\n this.logger.debug('[ssr] serving for \"*\"');\n }\n\n private async configureProxy(app: Express, server: Server) {\n const proxServer = httpProxy.createProxyServer();\n proxServer.on('error', (e) => this.logger.error(e.message));\n const proxyEntries = await this.getProxyFromPlugins();\n\n // TODO - should use https://github.com/chimurai/http-proxy-middleware\n server.on('upgrade', function (req, socket, head) {\n const entry = proxyEntries.find((proxy) => proxy.context.some((item) => item === req.url));\n if (!entry) return;\n proxServer.ws(req, socket, head, {\n target: entry.target,\n });\n });\n\n proxyEntries.forEach((entry) => {\n entry.context.forEach((route) => {\n app.use(`${route}/*`, (req, res) => {\n proxServer.web(req, res, { ...entry, target: `${entry.target}/${req.originalUrl}` });\n });\n });\n });\n }\n\n /**\n * start a UI dev server.\n */\n async dev({ portRange }: StartOptions = {}) {\n const devServerPort = await this.selectPort(portRange);\n await this.start({ portRange: [4100, 4200] });\n const expressAppPort = this._port;\n\n const config = await this.getDevConfig();\n const compiler = webpack(config);\n const devServerConfig = await this.getDevServerConfig(devServerPort, expressAppPort, config.devServer);\n // @ts-ignore in the capsules it throws an error about compatibilities issues between webpack.compiler and webpackDevServer/webpack/compiler\n const devServer = new WebpackDevServer(devServerConfig, compiler);\n\n await devServer.start();\n this._port = devServerPort;\n return devServer;\n }\n\n private async selectPort(portRange?: number[] | number) {\n return Port.getPortFromRange(portRange || [3100, 3200]);\n }\n\n private async getProxyFromPlugins(): Promise<ProxyEntry[]> {\n const proxiesByPlugin = this.plugins.map((plugin) => {\n return plugin.getProxy ? plugin.getProxy() : [];\n });\n\n return flatten(await Promise.all(proxiesByPlugin));\n }\n\n private async getProxy(port = 4000) {\n const proxyEntries = await this.getProxyFromPlugins();\n\n const gqlProxies: ProxyEntry[] = [\n {\n context: ['/graphql', '/api'],\n target: `http://${this.host}:${port}`,\n changeOrigin: true,\n },\n {\n context: ['/subscriptions'],\n target: `ws://${this.host}:${port}`,\n ws: true,\n },\n ];\n\n return gqlProxies.concat(proxyEntries);\n }\n\n private async getDevServerConfig(\n appPort: number,\n gqlPort: number,\n config?: WdsConfiguration\n ): Promise<WdsConfiguration> {\n const proxy = await this.getProxy(gqlPort);\n const devServerConf = { ...config, proxy, port: appPort };\n\n return devServerConf;\n }\n\n static create(props: UIServerProps) {\n return new UIServer(\n props.graphql,\n props.express,\n props.ui,\n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CAAd,CAAP;EACD;;EAEqB,MAARC,QAAQ,CAACpF,IAAI,GAAG,IAAR,EAAc;IAClC,MAAMqD,YAAY,GAAG,MAAM,KAAKC,mBAAL,EAA3B;IAEA,MAAMgC,UAAwB,GAAG,CAC/B;MACEzB,OAAO,EAAE,CAAC,UAAD,EAAa,MAAb,CADX;MAEEK,MAAM,EAAG,UAAS,KAAKhE,IAAK,IAAGF,IAAK,EAFtC;MAGEuF,YAAY,EAAE;IAHhB,CAD+B,EAM/B;MACE1B,OAAO,EAAE,CAAC,gBAAD,CADX;MAEEK,MAAM,EAAG,QAAO,KAAKhE,IAAK,IAAGF,IAAK,EAFpC;MAGEiE,EAAE,EAAE;IAHN,CAN+B,CAAjC;IAaA,OAAOqB,UAAU,CAACE,MAAX,CAAkBnC,YAAlB,CAAP;EACD;;EAE+B,MAAlB2B,kBAAkB,CAC9BS,OAD8B,EAE9BC,OAF8B,EAG9Bd,MAH8B,EAIH;IAC3B,MAAMhB,KAAK,GAAG,MAAM,KAAKwB,QAAL,CAAcM,OAAd,CAApB;;IACA,MAAMC,aAAa,mCAAQf,MAAR;MAAgBhB,KAAhB;MAAuB5D,IAAI,EAAEyF;IAA7B,EAAnB;;IAEA,OAAOE,aAAP;EACD;;EAEY,OAANC,MAAM,CAACC,KAAD,EAAuB;IAClC,OAAO,IAAI5G,QAAJ,CACL4G,KAAK,CAAC1G,OADD,EAEL0G,KAAK,CAAClE,OAFD,EAGLkE,KAAK,CAACxG,EAHD,EAILwG,KAAK,CAACvG,MAJD,EAKLuG,KAAK,CAACtG,eALD,EAMLsG,KAAK,CAACrG,MAND,EAOLqG,KAAK,CAACpG,SAPD,EAQLoG,KAAK,CAACC,YARD,CAAP;EAUD;;AA7MmB"}
1
+ {"version":3,"names":["UIServer","constructor","graphql","expressExtension","ui","uiRoot","uiRootExtension","logger","publicDir","plugins","Promise","resolve","setReady","getName","name","port","_port","host","fullUrl","buildOptions","getDevConfig","aspects","resolveAspects","UIRuntime","devConfig","path","generateRoot","whenReady","all","startPromise","map","x","start","portRange","app","createApp","root","join","server","createServer","configureProxy","use","express","static","index","Port","getPortFromRange","setupServerSideRendering","fallback","listen","info","getPluginsComponents","plugin","render","ssr","ssrMiddleware","createSsrMiddleware","title","warn","get","debug","proxServer","httpProxy","createProxyServer","on","e","error","message","proxyEntries","getProxyFromPlugins","req","socket","head","entry","find","proxy","context","some","item","url","ws","target","forEach","route","res","web","originalUrl","dev","devServerPort","selectPort","expressAppPort","config","compiler","webpack","devServerConfig","getDevServerConfig","devServer","WebpackDevServer","proxiesByPlugin","getProxy","flatten","gqlProxies","changeOrigin","concat","appPort","gqlPort","devServerConf","create","props","startPlugins"],"sources":["ui-server.ts"],"sourcesContent":["import { flatten } from 'lodash';\nimport { ExpressMain } from '@teambit/express';\nimport { GraphqlMain } from '@teambit/graphql';\nimport { Logger } from '@teambit/logger';\nimport express, { Express } from 'express';\nimport fallback from 'express-history-api-fallback';\nimport { Port } from '@teambit/toolbox.network.get-port';\nimport { Server } from 'http';\nimport httpProxy from 'http-proxy';\nimport { join } from 'path';\nimport webpack from 'webpack';\nimport WebpackDevServer, { Configuration as WdsConfiguration } from 'webpack-dev-server';\nimport { createSsrMiddleware } from './ssr-middleware';\nimport { StartPlugin } from './start-plugin';\nimport { ProxyEntry, UIRoot } from './ui-root';\nimport { UIRuntime } from './ui.aspect';\nimport { UiMain } from './ui.main.runtime';\n\nimport { devConfig } from './webpack/webpack.dev.config';\n\nexport type UIServerProps = {\n graphql: GraphqlMain;\n express: ExpressMain;\n ui: UiMain;\n uiRoot: UIRoot;\n uiRootExtension: string;\n logger: Logger;\n publicDir: string;\n startPlugins: StartPlugin[];\n};\n\nexport type StartOptions = {\n /**\n * port range for the UI server to bind. default is a port range of 4000-4200.\n */\n portRange?: number[] | number;\n};\n\nexport class UIServer {\n constructor(\n private graphql: GraphqlMain,\n private expressExtension: ExpressMain,\n private ui: UiMain,\n private uiRoot: UIRoot,\n private uiRootExtension: string,\n private logger: Logger,\n private publicDir: string,\n private plugins: StartPlugin[]\n ) {}\n\n getName() {\n return this.uiRoot.name;\n }\n\n private _port = 0;\n\n get port() {\n return this._port;\n }\n\n /** the hostname for the server to listen at. Currently statically 'localhost' */\n get host() {\n return 'localhost';\n }\n\n /** the server listens at this url */\n get fullUrl() {\n const port = this.port !== 80 ? `:${this.port}` : '';\n return `http://${this.host}${port}`;\n }\n\n get buildOptions() {\n return this.uiRoot.buildOptions;\n }\n\n /**\n * get the webpack configuration of the UI server.\n */\n async getDevConfig() {\n const aspects = await this.uiRoot.resolveAspects(UIRuntime.name);\n\n return devConfig(this.uiRoot.path, [await this.ui.generateRoot(aspects, this.uiRootExtension)], this.uiRoot.name);\n }\n\n private setReady: () => void;\n private startPromise = new Promise<void>((resolve) => (this.setReady = resolve));\n get whenReady() {\n return Promise.all([this.startPromise, ...this.plugins.map((x) => x?.whenReady)]);\n }\n\n /**\n * start a UI server.\n */\n async start({ portRange }: StartOptions = {}) {\n const app = this.expressExtension.createApp();\n const publicDir = `/${this.publicDir}`;\n const root = join(this.uiRoot.path, publicDir);\n const server = await this.graphql.createServer({ app });\n\n // set up proxy, for things like preview, e.g. '/preview/teambit.react/react'\n await this.configureProxy(app, server);\n\n // pass through files from public /folder:\n // setting `index: false` so index.html will be served by the fallback() middleware\n app.use(express.static(root, { index: false }));\n\n const port = await Port.getPortFromRange(portRange || [3100, 3200]);\n\n await this.setupServerSideRendering({ root, port, app });\n\n // in any and all other cases, serve index.html.\n // No any other endpoints past this will execute\n app.use(fallback('index.html', { root }));\n\n server.listen(port);\n this._port = port;\n\n // important: we use the string of the following message for the http.e2e.ts. if you change the message,\n // please make sure you change the `HTTP_SERVER_READY_MSG` const.\n this.logger.info(`UI server of ${this.uiRootExtension} is listening to port ${port}`);\n\n this.setReady();\n }\n\n getPluginsComponents() {\n return this.plugins.map((plugin) => plugin.render);\n }\n\n private async setupServerSideRendering({ root, port, app }: { root: string; port: number; app: Express }) {\n if (!this.buildOptions?.ssr) return;\n\n const ssrMiddleware = await createSsrMiddleware({\n root,\n port,\n title: this.uiRoot.name,\n logger: this.logger,\n });\n\n if (!ssrMiddleware) {\n this.logger.warn('[ssr] middleware failed setup');\n return;\n }\n\n // eslint-disable-next-line @typescript-eslint/no-misused-promises\n app.get('*', ssrMiddleware);\n this.logger.debug('[ssr] serving for \"*\"');\n }\n\n private async configureProxy(app: Express, server: Server) {\n const proxServer = httpProxy.createProxyServer();\n proxServer.on('error', (e) => this.logger.error(e.message));\n const proxyEntries = await this.getProxyFromPlugins();\n\n // TODO - should use https://github.com/chimurai/http-proxy-middleware\n server.on('upgrade', function (req, socket, head) {\n const entry = proxyEntries.find((proxy) => proxy.context.some((item) => item === req.url));\n if (!entry) return;\n proxServer.ws(req, socket, head, {\n target: entry.target,\n });\n });\n\n proxyEntries.forEach((entry) => {\n entry.context.forEach((route) => {\n app.use(`${route}/*`, (req, res) => {\n proxServer.web(req, res, { ...entry, target: `${entry.target}/${req.originalUrl}` });\n });\n });\n });\n }\n\n /**\n * start a UI dev server.\n */\n async dev({ portRange }: StartOptions = {}) {\n const devServerPort = await this.selectPort(portRange);\n await this.start({ portRange: [4100, 4200] });\n const expressAppPort = this._port;\n\n const config = await this.getDevConfig();\n const compiler = webpack(config);\n const devServerConfig = await this.getDevServerConfig(devServerPort, expressAppPort, config.devServer);\n // @ts-ignore in the capsules it throws an error about compatibilities issues between webpack.compiler and webpackDevServer/webpack/compiler\n const devServer = new WebpackDevServer(devServerConfig, compiler);\n\n await devServer.start();\n this._port = devServerPort;\n return devServer;\n }\n\n private async selectPort(portRange?: number[] | number) {\n return Port.getPortFromRange(portRange || [3100, 3200]);\n }\n\n private async getProxyFromPlugins(): Promise<ProxyEntry[]> {\n const proxiesByPlugin = this.plugins.map((plugin) => {\n return plugin.getProxy ? plugin.getProxy() : [];\n });\n\n return flatten(await Promise.all(proxiesByPlugin));\n }\n\n private async getProxy(port = 4000) {\n const proxyEntries = await this.getProxyFromPlugins();\n\n const gqlProxies: ProxyEntry[] = [\n {\n context: ['/graphql', '/api'],\n target: `http://${this.host}:${port}`,\n changeOrigin: true,\n },\n {\n context: ['/subscriptions'],\n target: `ws://${this.host}:${port}`,\n ws: true,\n },\n ];\n\n return gqlProxies.concat(proxyEntries);\n }\n\n private async getDevServerConfig(\n appPort: number,\n gqlPort: number,\n config?: WdsConfiguration\n ): Promise<WdsConfiguration> {\n const proxy = await this.getProxy(gqlPort);\n const devServerConf = { ...config, proxy, port: appPort };\n\n return devServerConf;\n }\n\n static create(props: UIServerProps) {\n return new UIServer(\n props.graphql,\n props.express,\n props.ui,\n props.uiRoot,\n props.uiRootExtension,\n props.logger,\n props.publicDir,\n props.startPlugins\n );\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAIA;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;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAGA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAGA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAAyD;AAAA;AAoBlD,MAAMA,QAAQ,CAAC;EACpBC,WAAW,CACDC,OAAoB,EACpBC,gBAA6B,EAC7BC,EAAU,EACVC,MAAc,EACdC,eAAuB,EACvBC,MAAc,EACdC,SAAiB,EACjBC,OAAsB,EAC9B;IAAA,KARQP,OAAoB,GAApBA,OAAoB;IAAA,KACpBC,gBAA6B,GAA7BA,gBAA6B;IAAA,KAC7BC,EAAU,GAAVA,EAAU;IAAA,KACVC,MAAc,GAAdA,MAAc;IAAA,KACd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C,KAAoB,EAAE;IAClC,OAAO,IAAI5G,QAAQ,CACjB4G,KAAK,CAAC1G,OAAO,EACb0G,KAAK,CAAClE,OAAO,EACbkE,KAAK,CAACxG,EAAE,EACRwG,KAAK,CAACvG,MAAM,EACZuG,KAAK,CAACtG,eAAe,EACrBsG,KAAK,CAACrG,MAAM,EACZqG,KAAK,CAACpG,SAAS,EACfoG,KAAK,CAACC,YAAY,CACnB;EACH;AACF;AAAC"}
package/dist/ui.aspect.js CHANGED
@@ -4,25 +4,19 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = exports.UIRuntime = exports.UIAspect = void 0;
7
-
8
7
  function _harmony() {
9
8
  const data = require("@teambit/harmony");
10
-
11
9
  _harmony = function () {
12
10
  return data;
13
11
  };
14
-
15
12
  return data;
16
13
  }
17
-
18
14
  const UIRuntime = new (_harmony().RuntimeDefinition)('ui');
19
15
  exports.UIRuntime = UIRuntime;
20
-
21
16
  const UIAspect = _harmony().Aspect.create({
22
17
  id: 'teambit.ui-foundation/ui',
23
18
  declareRuntime: UIRuntime
24
19
  });
25
-
26
20
  exports.UIAspect = UIAspect;
27
21
  var _default = UIAspect;
28
22
  exports.default = _default;
@@ -1 +1 @@
1
- {"version":3,"names":["UIRuntime","RuntimeDefinition","UIAspect","Aspect","create","id","declareRuntime"],"sources":["ui.aspect.ts"],"sourcesContent":["import { Aspect, RuntimeDefinition } from '@teambit/harmony';\n\nexport const UIRuntime = new RuntimeDefinition('ui');\n\nexport const UIAspect = Aspect.create({\n id: 'teambit.ui-foundation/ui',\n declareRuntime: UIRuntime,\n});\n\nexport default UIAspect;\n"],"mappings":";;;;;;;AAAA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAEO,MAAMA,SAAS,GAAG,KAAIC,4BAAJ,EAAsB,IAAtB,CAAlB;;;AAEA,MAAMC,QAAQ,GAAGC,iBAAA,CAAOC,MAAP,CAAc;EACpCC,EAAE,EAAE,0BADgC;EAEpCC,cAAc,EAAEN;AAFoB,CAAd,CAAjB;;;eAKQE,Q"}
1
+ {"version":3,"names":["UIRuntime","RuntimeDefinition","UIAspect","Aspect","create","id","declareRuntime"],"sources":["ui.aspect.ts"],"sourcesContent":["import { Aspect, RuntimeDefinition } from '@teambit/harmony';\n\nexport const UIRuntime = new RuntimeDefinition('ui');\n\nexport const UIAspect = Aspect.create({\n id: 'teambit.ui-foundation/ui',\n declareRuntime: UIRuntime,\n});\n\nexport default UIAspect;\n"],"mappings":";;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEO,MAAMA,SAAS,GAAG,KAAIC,4BAAiB,EAAC,IAAI,CAAC;AAAC;AAE9C,MAAMC,QAAQ,GAAGC,iBAAM,CAACC,MAAM,CAAC;EACpCC,EAAE,EAAE,0BAA0B;EAC9BC,cAAc,EAAEN;AAClB,CAAC,CAAC;AAAC;AAAA,eAEYE,QAAQ;AAAA"}
package/dist/ui.cli.rt.js CHANGED
@@ -2,6 +2,7 @@
2
2
  // import { StartCmd } from './start.cmd';
3
3
  // import { Workspace } from '../workspace';
4
4
  // import { GraphQLExtension } from '../graphql';
5
+
5
6
  // export default ([cli, envs, workspace, graphql]: [CLIExtension, Environments, Workspace, GraphQLExtension]) => {
6
7
  // // const ui = new UIExtension(envs, graphql);
7
8
  // cli.register(new StartCmd(ui, workspace));
@@ -1 +1 @@
1
- {"version":3,"names":[],"sources":["ui.cli.rt.tsx"],"sourcesContent":["// import { CLIExtension } from '../cli';\n// import { StartCmd } from './start.cmd';\n// import { Workspace } from '../workspace';\n// import { GraphQLExtension } from '../graphql';\n\n// export default ([cli, envs, workspace, graphql]: [CLIExtension, Environments, Workspace, GraphQLExtension]) => {\n// // const ui = new UIExtension(envs, graphql);\n// cli.register(new StartCmd(ui, workspace));\n// // return ui;\n// }\n"],"mappings":"AAAA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA"}
1
+ {"version":3,"names":[],"sources":["ui.cli.rt.tsx"],"sourcesContent":["// import { CLIExtension } from '../cli';\n// import { StartCmd } from './start.cmd';\n// import { Workspace } from '../workspace';\n// import { GraphQLExtension } from '../graphql';\n\n// export default ([cli, envs, workspace, graphql]: [CLIExtension, Environments, Workspace, GraphQLExtension]) => {\n// // const ui = new UIExtension(envs, graphql);\n// cli.register(new StartCmd(ui, workspace));\n// // return ui;\n// }\n"],"mappings":"AAAA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AAAA"}
@@ -1,22 +1,17 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
7
  exports.Logo = void 0;
9
-
10
8
  function _react() {
11
9
  const data = _interopRequireDefault(require("react"));
12
-
13
10
  _react = function () {
14
11
  return data;
15
12
  };
16
-
17
13
  return data;
18
14
  }
19
-
20
15
  const Logo = () => /*#__PURE__*/_react().default.createElement("div", {
21
16
  style: {
22
17
  height: '100%',
@@ -29,7 +24,6 @@ const Logo = () => /*#__PURE__*/_react().default.createElement("div", {
29
24
  },
30
25
  src: "https://static.bit.dev/extensions-icons/ui.svg"
31
26
  }));
32
-
33
27
  exports.Logo = Logo;
34
28
 
35
29
  //# sourceMappingURL=ui.composition.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["Logo","height","display","justifyContent","width"],"sources":["ui.composition.tsx"],"sourcesContent":["import React from 'react';\n\nexport const Logo = () => (\n <div style={{ height: '100%', display: 'flex', justifyContent: 'center' }}>\n <img style={{ width: 70 }} src=\"https://static.bit.dev/extensions-icons/ui.svg\" />\n </div>\n);\n"],"mappings":";;;;;;;;;AAAA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAEO,MAAMA,IAAI,GAAG,mBAClB;EAAK,KAAK,EAAE;IAAEC,MAAM,EAAE,MAAV;IAAkBC,OAAO,EAAE,MAA3B;IAAmCC,cAAc,EAAE;EAAnD;AAAZ,gBACE;EAAK,KAAK,EAAE;IAAEC,KAAK,EAAE;EAAT,CAAZ;EAA2B,GAAG,EAAC;AAA/B,EADF,CADK"}
1
+ {"version":3,"names":["Logo","height","display","justifyContent","width"],"sources":["ui.composition.tsx"],"sourcesContent":["import React from 'react';\n\nexport const Logo = () => (\n <div style={{ height: '100%', display: 'flex', justifyContent: 'center' }}>\n <img style={{ width: 70 }} src=\"https://static.bit.dev/extensions-icons/ui.svg\" />\n </div>\n);\n"],"mappings":";;;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEO,MAAMA,IAAI,GAAG,mBAClB;EAAK,KAAK,EAAE;IAAEC,MAAM,EAAE,MAAM;IAAEC,OAAO,EAAE,MAAM;IAAEC,cAAc,EAAE;EAAS;AAAE,gBACxE;EAAK,KAAK,EAAE;IAAEC,KAAK,EAAE;EAAG,CAAE;EAAC,GAAG,EAAC;AAAgD,EAAG,CAErF;AAAC"}