@teambit/preview 1.0.451 → 1.0.452
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/artifacts/__bit_junit.xml +1 -1
- package/artifacts/preview/teambit_preview_preview-preview.js +1 -1
- package/artifacts/schema.json +3 -3
- package/dist/{preview-1730517501720.js → preview-1730807031698.js} +2 -2
- package/dist/preview.start-plugin.js +21 -18
- package/dist/preview.start-plugin.js.map +1 -1
- package/package.json +22 -22
- package/preview.start-plugin.tsx +15 -12
@@ -1,6 +1,6 @@
|
|
1
1
|
<?xml version="1.0" encoding="UTF-8"?>
|
2
2
|
<testsuites tests="1" failures="0" errors="0" skipped="0">
|
3
|
-
<testsuite name="teambit.preview/preview@1.0.
|
3
|
+
<testsuite name="teambit.preview/preview@1.0.452" tests="1" failures="0" errors="0" skipped="0">
|
4
4
|
<testcase classname="dist/bundler/create-peer-link.spec.js" name="should output snapshot" time="0.004"/>
|
5
5
|
</testsuite>
|
6
6
|
</testsuites>
|
@@ -1 +1 @@
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports["teambit.preview/preview-preview"]=t():e["teambit.preview/preview-preview"]=t()}(self,(()=>(()=>{"use strict";var e={
|
1
|
+
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports["teambit.preview/preview-preview"]=t():e["teambit.preview/preview-preview"]=t()}(self,(()=>(()=>{"use strict";var e={95745:(e,t,n)=>{Object.defineProperty(t,"l",{enumerable:!0,get:function(){return o.default}});var o=r(n(83688));function r(e){return e&&e.__esModule?e:{default:e}}r.__bit_component={id:"teambit.preview/aspect-docs/preview@0.0.168",homepage:"https://bit.cloud/teambit/preview/aspect-docs/preview",exported:!0}},83688:(e,t,n)=>{var o={id:"teambit.preview/aspect-docs/preview@0.0.168",homepage:"https://bit.cloud/teambit/preview/aspect-docs/preview",exported:!0};Object.defineProperty(t,"__esModule",{value:!0}),t.default=m,a(n(41594));var r=n(5016),i=["components"];function a(e){return e&&e.__esModule?e:{default:e}}function s(){return s=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)({}).hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},s.apply(null,arguments)}function p(e,t){if(null==e)return{};var n,o,r=l(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(o=0;o<i.length;o++)n=i[o],t.includes(n)||{}.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function l(e,t){if(null==e)return{};var n={};for(var o in e)if({}.hasOwnProperty.call(e,o)){if(t.includes(o))continue;n[o]=e[o]}return n}a.__bit_component=o,s.__bit_component=o,p.__bit_component=o,l.__bit_component=o;var d={},c="wrapper";function m(e){var t=e.components,n=p(e,i);return(0,r.mdx)(c,s({},d,n,{components:t,mdxType:"MDXLayout"}),(0,r.mdx)("p",null,"The Preview aspect handles the bundling and rendering of component compositions and documentation, for the Workspace UI and Scope UI."),(0,r.mdx)("p",null,"Preview is used to display components in development (on ",(0,r.mdx)("inlineCode",{parentName:"p"},"bit start"),") as well as in their released versions (assets for the release version are generated as part of the build process)."),(0,r.mdx)("p",null,"The Preview aspect handles each component according to the configurations set by the environment that is used by that component. That means both the documentation and the component compositions will be bundled and displayed differently for different environments."),(0,r.mdx)("h2",null,"Rational"),(0,r.mdx)("p",null,"In a standard web application, UI components ",(0,r.mdx)("em",{parentName:"p"},"serving the same application")," are bundled together to produce the necessary assets to make them renderable by the browser."),(0,r.mdx)("p",null,"Components in a Bit workspace are not all in the service of the same application. Each component is authored, tagged and exported as an independent component.\nThat means a few things:"),(0,r.mdx)("ol",null,(0,r.mdx)("li",{parentName:"ol"},(0,r.mdx)("p",{parentName:"li"},"Components in a Bit workspace are not consumed ,directly or indirectly, by a single entry file (e.g, the app's ",(0,r.mdx)("inlineCode",{parentName:"p"},"index.js"),"). That makes it impossible for the bundler to follow the files needed to be bundled.")),(0,r.mdx)("li",{parentName:"ol"},(0,r.mdx)("p",{parentName:"li"},"Different components in a single workspace may be implemented using different technologies and bundled using different configurations or even different bundlers."))),(0,r.mdx)("p",null,"Preview solves the above challenges by creating a temporary entry file for each group of components using the same environment.\nIt then serves this file to the Bundler, to be bundled according to the environment and the purpose of bundling. That is, to display components in development or to display the components' release versions (for a \"production-level\" exhibition of the component's documentation and compositions)."),(0,r.mdx)("h2",null,"Usage"),(0,r.mdx)("h3",null,"Extending the Preview aspect"),(0,r.mdx)("p",null,"The preview aspect can be extended to generate other renderable artifacts , either when running Bit's development server or as part of the build pipeline (for a component's tagged version).\nThese artifacts can present additional information that assists in inspecting a component (for example, showing the results of accessibility tests)."))}m.__bit_component=o,m.isMDXComponent=!0},76055:(e,t,n)=>{var o={id:"teambit.preview/preview@1.0.452",homepage:"https://bit.cloud/teambit/preview/preview",exported:!0};function r(){const e=i(n(41594));return r=function(){return e},e}function i(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0}),t.Logo=void 0,r.__bit_component=o,i.__bit_component=o;const a=()=>r().default.createElement("div",{style:{height:"100%",display:"flex",justifyContent:"center"}},r().default.createElement("img",{style:{width:70},src:"https://static.bit.dev/extensions-icons/preview.svg"}));a.__bit_component=o,t.Logo=a},5016:e=>{e.exports=MdxJsReact},41594:e=>{e.exports=React}},t={};function n(o){var r=t[o];if(void 0!==r)return r.exports;var i=t[o]={exports:{}};return e[o](i,i.exports,n),i.exports}n.d=(e,t)=>{for(var o in t)n.o(t,o)&&!n.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var o={};n.r(o),n.d(o,{compositions:()=>f,compositions_metadata:()=>b,overview:()=>v});var r={};n.r(r),n.d(r,{default:()=>u});var i=n(76055),a=(n(41594),n(5016));const s=TeambitMdxUiMdxScopeContext;var p=n(95745),l=["components"];function d(){return d=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)({}).hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},d.apply(null,arguments)}var c={},m="wrapper";function u(e){var t=e.components,n=function(e,t){if(null==e)return{};var n,o,r=function(e,t){if(null==e)return{};var n={};for(var o in e)if({}.hasOwnProperty.call(e,o)){if(t.includes(o))continue;n[o]=e[o]}return n}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(o=0;o<i.length;o++)n=i[o],t.includes(n)||{}.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}(e,l);return(0,a.mdx)(m,d({},c,n,{components:t,mdxType:"MDXLayout"}),(0,a.mdx)(s.MDXScopeProvider,{components:{Preview:p.l},mdxType:"MDXScopeProvider"},(0,a.mdx)(p.l,{mdxType:"Preview"})))}u.isMDXComponent=!0;const f=[i],v=[r],b={compositions:[{displayName:"Logo",identifier:"Logo"}]};return o})()));
|
package/artifacts/schema.json
CHANGED
@@ -249,7 +249,7 @@
|
|
249
249
|
"_legacy": {
|
250
250
|
"scope": "teambit.preview",
|
251
251
|
"name": "preview",
|
252
|
-
"version": "1.0.
|
252
|
+
"version": "1.0.452"
|
253
253
|
},
|
254
254
|
"_scope": "teambit.preview"
|
255
255
|
}
|
@@ -6279,7 +6279,7 @@
|
|
6279
6279
|
"_legacy": {
|
6280
6280
|
"scope": "teambit.preview",
|
6281
6281
|
"name": "preview",
|
6282
|
-
"version": "1.0.
|
6282
|
+
"version": "1.0.452"
|
6283
6283
|
},
|
6284
6284
|
"_scope": "teambit.preview"
|
6285
6285
|
}
|
@@ -12981,7 +12981,7 @@
|
|
12981
12981
|
"componentId": {
|
12982
12982
|
"scope": "teambit.preview",
|
12983
12983
|
"name": "preview",
|
12984
|
-
"version": "1.0.
|
12984
|
+
"version": "1.0.452"
|
12985
12985
|
},
|
12986
12986
|
"taggedModuleExports": []
|
12987
12987
|
}
|
@@ -1,5 +1,5 @@
|
|
1
|
-
import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.preview_preview@1.0.
|
2
|
-
import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.preview_preview@1.0.
|
1
|
+
import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.preview_preview@1.0.452/dist/preview.composition.js';
|
2
|
+
import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.preview_preview@1.0.452/dist/preview.docs.mdx';
|
3
3
|
|
4
4
|
export const compositions = [compositions_0];
|
5
5
|
export const overview = [overview_0];
|
@@ -129,24 +129,27 @@ class PreviewStartPlugin {
|
|
129
129
|
};
|
130
130
|
const previewServer = this.serversMap[id];
|
131
131
|
const spinnerId = getSpinnerId(id);
|
132
|
-
const
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
this.
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
132
|
+
const spinner = this.logger.multiSpinner.spinners[spinnerId];
|
133
|
+
if (spinner && spinner.isActive()) {
|
134
|
+
const errors = results.errors || [];
|
135
|
+
const hasErrors = !!errors.length;
|
136
|
+
const warnings = getWarningsWithoutIgnored(results.warnings);
|
137
|
+
const hasWarnings = !!warnings.length;
|
138
|
+
const url = `http://localhost:${previewServer.port}`;
|
139
|
+
const text = getSpinnerDoneMessage(this.serversMap[id], errors, warnings, url);
|
140
|
+
if (hasErrors) {
|
141
|
+
this.logger.multiSpinner.fail(spinnerId, {
|
142
|
+
text
|
143
|
+
});
|
144
|
+
} else if (hasWarnings) {
|
145
|
+
this.logger.multiSpinner.warn(spinnerId, {
|
146
|
+
text
|
147
|
+
});
|
148
|
+
} else {
|
149
|
+
this.logger.multiSpinner.succeed(spinnerId, {
|
150
|
+
text
|
151
|
+
});
|
152
|
+
}
|
150
153
|
}
|
151
154
|
const noneAreCompiling = Object.values(this.serversState).every(x => !x.isCompiling);
|
152
155
|
if (noneAreCompiling) this.setReady();
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["_lodash","data","require","_previewCli","_compiler","_watcher","_chalk","_interopRequireDefault","e","__esModule","default","_defineProperty","r","t","_toPropertyKey","Object","defineProperty","value","enumerable","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","PreviewStartPlugin","constructor","workspace","bundler","ui","pubsub","logger","watcher","Promise","resolve","setReady","initiate","options","listenToDevServers","components","getComponentsByUserInput","pattern","previewServers","devServer","forEach","server","serversMap","context","envRuntime","id","listen","watch","spawnTSServer","checkTypes","CheckTypes","None","preCompile","compile","initiator","CompilationInitiator","Start","catch","err","msg","error","console","message","concat","getProxy","proxyConfigs","map","target","port","ws","flatten","SubscribeToWebpackEvents","onStart","handleOnStartCompiling","onDone","results","handleOnDoneCompiling","serversState","isCompiling","spinnerId","getSpinnerId","text","getSpinnerCompilingMessage","exists","multiSpinner","spinners","add","isReady","errors","warnings","previewServer","hasErrors","length","getWarningsWithoutIgnored","hasWarnings","url","getSpinnerDoneMessage","fail","warn","succeed","noneAreCompiling","values","every","x","whenReady","readyPromise","exports","IGNORE_WARNINGS","filter","warning","find","reg","match","envId","verbose","prefix","chalk","cyan","includedEnvs","relatedContexts","stringifyIncludedEnvs","errorsTxt","join","errorsTxtWithTitle","red","warningsTxt","warningsTxtWithTitle","yellow","urlMessage"],"sources":["preview.start-plugin.tsx"],"sourcesContent":["import { flatten } from 'lodash';\nimport { BundlerMain, ComponentServer } from '@teambit/bundler';\nimport { PubsubMain } from '@teambit/pubsub';\nimport { ProxyEntry, StartPlugin, StartPluginOptions, UiMain } from '@teambit/ui';\nimport { Workspace } from '@teambit/workspace';\nimport { SubscribeToWebpackEvents, CompilationResult } from '@teambit/preview.cli.webpack-events-listener';\nimport { CompilationInitiator } from '@teambit/compiler';\nimport { Logger } from '@teambit/logger';\nimport { CheckTypes, WatcherMain } from '@teambit/watcher';\nimport chalk from 'chalk';\n\ntype ServerState = {\n isCompiling?: boolean;\n isReady?: boolean;\n errors?: Error[];\n warnings?: Error[];\n results?: any[];\n};\n\ntype ServerStateMap = Record<string, ServerState>;\n\nexport class PreviewStartPlugin implements StartPlugin {\n constructor(\n private workspace: Workspace,\n private bundler: BundlerMain,\n private ui: UiMain,\n private pubsub: PubsubMain,\n private logger: Logger,\n private watcher: WatcherMain\n ) {}\n\n previewServers: ComponentServer[] = [];\n serversState: ServerStateMap = {};\n serversMap: Record<string, ComponentServer> = {};\n\n async initiate(options: StartPluginOptions) {\n this.listenToDevServers();\n\n const components = await this.workspace.getComponentsByUserInput(!options.pattern, options.pattern);\n // TODO: logic for creating preview servers must be refactored to this aspect from the DevServer aspect.\n const previewServers = await this.bundler.devServer(components);\n previewServers.forEach((server) => {\n this.serversMap[server.context.envRuntime.id] = server;\n // DON'T add wait! this promise never resolves, so it would stop the start process!\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n server.listen();\n });\n this.watcher\n .watch({\n spawnTSServer: true,\n checkTypes: CheckTypes.None,\n preCompile: false,\n compile: true,\n initiator: CompilationInitiator.Start,\n })\n .catch((err) => {\n const msg = `watcher found an error`;\n this.logger.error(msg, err);\n this.logger.console(`${msg}, ${err.message}`);\n });\n this.previewServers = this.previewServers.concat(previewServers);\n }\n\n getProxy(): ProxyEntry[] {\n const proxyConfigs = this.previewServers.map<ProxyEntry[]>((server) => {\n return [\n {\n context: [`/preview/${server.context.envRuntime.id}`],\n target: `http://localhost:${server.port}`,\n },\n {\n context: [`/_hmr/${server.context.envRuntime.id}`],\n target: `http://localhost:${server.port}`,\n ws: true,\n },\n ];\n });\n\n return flatten(proxyConfigs);\n }\n\n // TODO: this should be a part of the devServer\n private listenToDevServers() {\n // keep state changes immutable!\n SubscribeToWebpackEvents(this.pubsub, {\n onStart: (id) => {\n this.handleOnStartCompiling(id);\n },\n onDone: (id, results) => {\n this.handleOnDoneCompiling(id, results);\n },\n });\n }\n\n private handleOnStartCompiling(id: string) {\n this.serversState[id] = { isCompiling: true };\n const spinnerId = getSpinnerId(id);\n const text = getSpinnerCompilingMessage(this.serversMap[id]);\n const exists = this.logger.multiSpinner.spinners[spinnerId];\n if (!exists) {\n this.logger.multiSpinner.add(spinnerId, { text });\n }\n }\n\n private handleOnDoneCompiling(id: string, results: CompilationResult) {\n this.serversState[id] = {\n isCompiling: false,\n isReady: true,\n errors: results.errors,\n warnings: results.warnings,\n };\n const previewServer = this.serversMap[id];\n const spinnerId = getSpinnerId(id);\n const errors = results.errors || [];\n const hasErrors = !!errors.length;\n const warnings = getWarningsWithoutIgnored(results.warnings);\n const hasWarnings = !!warnings.length;\n const url = `http://localhost:${previewServer.port}`;\n const text = getSpinnerDoneMessage(this.serversMap[id], errors, warnings, url);\n if (hasErrors) {\n this.logger.multiSpinner.fail(spinnerId, { text });\n } else if (hasWarnings) {\n this.logger.multiSpinner.warn(spinnerId, { text });\n } else {\n this.logger.multiSpinner.succeed(spinnerId, { text });\n }\n\n const noneAreCompiling = Object.values(this.serversState).every((x) => !x.isCompiling);\n if (noneAreCompiling) this.setReady();\n }\n\n private setReady: () => void;\n private readyPromise = new Promise<void>((resolve) => (this.setReady = resolve));\n get whenReady(): Promise<void> {\n return this.readyPromise;\n }\n}\n\nfunction getWarningsWithoutIgnored(warnings?: Error[]): Error[] {\n if (!warnings || !warnings.length) return [];\n const IGNORE_WARNINGS = [\n // Webpack 5+ has no facility to disable this warning.\n // System.import is used in @angular/core for deprecated string-form lazy routes\n /System.import\\(\\) is deprecated and will be removed soon/i,\n // We need to include all the files in the compilation because we don't know what people will use in their compositions\n /is part of the TypeScript compilation but it's unused/i,\n // https://github.com/webpack-contrib/source-map-loader/blob/b2de4249c7431dd8432da607e08f0f65e9d64219/src/index.js#L83\n /Failed to parse source map from/,\n ];\n warnings.filter((warning) => !IGNORE_WARNINGS.find((reg) => warning?.message?.match(reg)));\n return warnings;\n}\n\nfunction getSpinnerId(envId: string) {\n return `preview-${envId}`;\n}\n\nfunction getSpinnerCompilingMessage(server: ComponentServer, verbose = false) {\n const prefix = 'COMPILING';\n const envId = chalk.cyan(server.context.envRuntime.id);\n let includedEnvs = '';\n if (server.context.relatedContexts && server.context.relatedContexts.length > 1) {\n includedEnvs = `on behalf of ${chalk.cyan(stringifyIncludedEnvs(server.context.relatedContexts, verbose))}`;\n }\n return `${prefix} ${envId} ${includedEnvs}`;\n}\n\nfunction getSpinnerDoneMessage(\n server: ComponentServer,\n errors: Error[],\n warnings: Error[],\n url: string,\n verbose = false\n) {\n const hasErrors = !!errors.length;\n const hasWarnings = !!warnings.length;\n const prefix = hasErrors ? 'FAILED' : 'RUNNING';\n const envId = chalk.cyan(server.context.envRuntime.id);\n let includedEnvs = '';\n if (server.context.relatedContexts && server.context.relatedContexts.length > 1) {\n includedEnvs = ` on behalf of ${chalk.cyan(stringifyIncludedEnvs(server.context.relatedContexts, verbose))}`;\n }\n const errorsTxt = hasErrors ? errors.map((err) => err.message).join('\\n') : '';\n const errorsTxtWithTitle = hasErrors ? chalk.red(`\\nErrors:\\n${errorsTxt}`) : '';\n const warningsTxt = hasWarnings ? warnings.map((warning) => warning.message).join('\\n') : '';\n const warningsTxtWithTitle = hasWarnings ? chalk.yellow(`\\nWarnings:\\n${warningsTxt}`) : '';\n\n const urlMessage = hasErrors ? '' : `at ${chalk.cyan(url)}`;\n return `${prefix} ${envId}${includedEnvs} ${urlMessage} ${errorsTxtWithTitle} ${warningsTxtWithTitle}`;\n}\n\nfunction stringifyIncludedEnvs(includedEnvs: string[] = [], verbose = false) {\n if (includedEnvs.length < 2) return '';\n if (includedEnvs.length > 2 && !verbose) return ` ${includedEnvs.length} other envs`;\n return includedEnvs.join(', ');\n}\n"],"mappings":";;;;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0B,YAAY,CAACI,IAAI,CAAC,IAAI,CAAC;AAChC","ignoreList":[]}
|
1
|
+
{"version":3,"names":["_lodash","data","require","_previewCli","_compiler","_watcher","_chalk","_interopRequireDefault","e","__esModule","default","_defineProperty","r","t","_toPropertyKey","Object","defineProperty","value","enumerable","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","PreviewStartPlugin","constructor","workspace","bundler","ui","pubsub","logger","watcher","Promise","resolve","setReady","initiate","options","listenToDevServers","components","getComponentsByUserInput","pattern","previewServers","devServer","forEach","server","serversMap","context","envRuntime","id","listen","watch","spawnTSServer","checkTypes","CheckTypes","None","preCompile","compile","initiator","CompilationInitiator","Start","catch","err","msg","error","console","message","concat","getProxy","proxyConfigs","map","target","port","ws","flatten","SubscribeToWebpackEvents","onStart","handleOnStartCompiling","onDone","results","handleOnDoneCompiling","serversState","isCompiling","spinnerId","getSpinnerId","text","getSpinnerCompilingMessage","exists","multiSpinner","spinners","add","isReady","errors","warnings","previewServer","spinner","isActive","hasErrors","length","getWarningsWithoutIgnored","hasWarnings","url","getSpinnerDoneMessage","fail","warn","succeed","noneAreCompiling","values","every","x","whenReady","readyPromise","exports","IGNORE_WARNINGS","filter","warning","find","reg","match","envId","verbose","prefix","chalk","cyan","includedEnvs","relatedContexts","stringifyIncludedEnvs","errorsTxt","join","errorsTxtWithTitle","red","warningsTxt","warningsTxtWithTitle","yellow","urlMessage"],"sources":["preview.start-plugin.tsx"],"sourcesContent":["import { flatten } from 'lodash';\nimport { BundlerMain, ComponentServer } from '@teambit/bundler';\nimport { PubsubMain } from '@teambit/pubsub';\nimport { ProxyEntry, StartPlugin, StartPluginOptions, UiMain } from '@teambit/ui';\nimport { Workspace } from '@teambit/workspace';\nimport { SubscribeToWebpackEvents, CompilationResult } from '@teambit/preview.cli.webpack-events-listener';\nimport { CompilationInitiator } from '@teambit/compiler';\nimport { Logger } from '@teambit/logger';\nimport { CheckTypes, WatcherMain } from '@teambit/watcher';\nimport chalk from 'chalk';\n\ntype ServerState = {\n isCompiling?: boolean;\n isReady?: boolean;\n errors?: Error[];\n warnings?: Error[];\n results?: any[];\n};\n\ntype ServerStateMap = Record<string, ServerState>;\n\nexport class PreviewStartPlugin implements StartPlugin {\n constructor(\n private workspace: Workspace,\n private bundler: BundlerMain,\n private ui: UiMain,\n private pubsub: PubsubMain,\n private logger: Logger,\n private watcher: WatcherMain\n ) {}\n\n previewServers: ComponentServer[] = [];\n serversState: ServerStateMap = {};\n serversMap: Record<string, ComponentServer> = {};\n\n async initiate(options: StartPluginOptions) {\n this.listenToDevServers();\n\n const components = await this.workspace.getComponentsByUserInput(!options.pattern, options.pattern);\n // TODO: logic for creating preview servers must be refactored to this aspect from the DevServer aspect.\n const previewServers = await this.bundler.devServer(components);\n previewServers.forEach((server) => {\n this.serversMap[server.context.envRuntime.id] = server;\n // DON'T add wait! this promise never resolves, so it would stop the start process!\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n server.listen();\n });\n this.watcher\n .watch({\n spawnTSServer: true,\n checkTypes: CheckTypes.None,\n preCompile: false,\n compile: true,\n initiator: CompilationInitiator.Start,\n })\n .catch((err) => {\n const msg = `watcher found an error`;\n this.logger.error(msg, err);\n this.logger.console(`${msg}, ${err.message}`);\n });\n this.previewServers = this.previewServers.concat(previewServers);\n }\n\n getProxy(): ProxyEntry[] {\n const proxyConfigs = this.previewServers.map<ProxyEntry[]>((server) => {\n return [\n {\n context: [`/preview/${server.context.envRuntime.id}`],\n target: `http://localhost:${server.port}`,\n },\n {\n context: [`/_hmr/${server.context.envRuntime.id}`],\n target: `http://localhost:${server.port}`,\n ws: true,\n },\n ];\n });\n\n return flatten(proxyConfigs);\n }\n\n // TODO: this should be a part of the devServer\n private listenToDevServers() {\n // keep state changes immutable!\n SubscribeToWebpackEvents(this.pubsub, {\n onStart: (id) => {\n this.handleOnStartCompiling(id);\n },\n onDone: (id, results) => {\n this.handleOnDoneCompiling(id, results);\n },\n });\n }\n\n private handleOnStartCompiling(id: string) {\n this.serversState[id] = { isCompiling: true };\n const spinnerId = getSpinnerId(id);\n const text = getSpinnerCompilingMessage(this.serversMap[id]);\n const exists = this.logger.multiSpinner.spinners[spinnerId];\n if (!exists) {\n this.logger.multiSpinner.add(spinnerId, { text });\n }\n }\n\n private handleOnDoneCompiling(id: string, results: CompilationResult) {\n this.serversState[id] = {\n isCompiling: false,\n isReady: true,\n errors: results.errors,\n warnings: results.warnings,\n };\n const previewServer = this.serversMap[id];\n const spinnerId = getSpinnerId(id);\n const spinner = this.logger.multiSpinner.spinners[spinnerId];\n if (spinner && spinner.isActive()) {\n const errors = results.errors || [];\n const hasErrors = !!errors.length;\n const warnings = getWarningsWithoutIgnored(results.warnings);\n const hasWarnings = !!warnings.length;\n const url = `http://localhost:${previewServer.port}`;\n const text = getSpinnerDoneMessage(this.serversMap[id], errors, warnings, url);\n if (hasErrors) {\n this.logger.multiSpinner.fail(spinnerId, { text });\n } else if (hasWarnings) {\n this.logger.multiSpinner.warn(spinnerId, { text });\n } else {\n this.logger.multiSpinner.succeed(spinnerId, { text });\n }\n }\n\n const noneAreCompiling = Object.values(this.serversState).every((x) => !x.isCompiling);\n if (noneAreCompiling) this.setReady();\n }\n\n private setReady: () => void;\n private readyPromise = new Promise<void>((resolve) => (this.setReady = resolve));\n get whenReady(): Promise<void> {\n return this.readyPromise;\n }\n}\n\nfunction getWarningsWithoutIgnored(warnings?: Error[]): Error[] {\n if (!warnings || !warnings.length) return [];\n const IGNORE_WARNINGS = [\n // Webpack 5+ has no facility to disable this warning.\n // System.import is used in @angular/core for deprecated string-form lazy routes\n /System.import\\(\\) is deprecated and will be removed soon/i,\n // We need to include all the files in the compilation because we don't know what people will use in their compositions\n /is part of the TypeScript compilation but it's unused/i,\n // https://github.com/webpack-contrib/source-map-loader/blob/b2de4249c7431dd8432da607e08f0f65e9d64219/src/index.js#L83\n /Failed to parse source map from/,\n ];\n warnings.filter((warning) => !IGNORE_WARNINGS.find((reg) => warning?.message?.match(reg)));\n return warnings;\n}\n\nfunction getSpinnerId(envId: string) {\n return `preview-${envId}`;\n}\n\nfunction getSpinnerCompilingMessage(server: ComponentServer, verbose = false) {\n const prefix = 'COMPILING';\n const envId = chalk.cyan(server.context.envRuntime.id);\n let includedEnvs = '';\n if (server.context.relatedContexts && server.context.relatedContexts.length > 1) {\n includedEnvs = `on behalf of ${chalk.cyan(stringifyIncludedEnvs(server.context.relatedContexts, verbose))}`;\n }\n return `${prefix} ${envId} ${includedEnvs}`;\n}\n\nfunction getSpinnerDoneMessage(\n server: ComponentServer,\n errors: Error[],\n warnings: Error[],\n url: string,\n verbose = false\n) {\n const hasErrors = !!errors.length;\n const hasWarnings = !!warnings.length;\n const prefix = hasErrors ? 'FAILED' : 'RUNNING';\n const envId = chalk.cyan(server.context.envRuntime.id);\n let includedEnvs = '';\n if (server.context.relatedContexts && server.context.relatedContexts.length > 1) {\n includedEnvs = ` on behalf of ${chalk.cyan(stringifyIncludedEnvs(server.context.relatedContexts, verbose))}`;\n }\n const errorsTxt = hasErrors ? errors.map((err) => err.message).join('\\n') : '';\n const errorsTxtWithTitle = hasErrors ? chalk.red(`\\nErrors:\\n${errorsTxt}`) : '';\n const warningsTxt = hasWarnings ? warnings.map((warning) => warning.message).join('\\n') : '';\n const warningsTxtWithTitle = hasWarnings ? chalk.yellow(`\\nWarnings:\\n${warningsTxt}`) : '';\n\n const urlMessage = hasErrors ? '' : `at ${chalk.cyan(url)}`;\n return `${prefix} ${envId}${includedEnvs} ${urlMessage} ${errorsTxtWithTitle} ${warningsTxtWithTitle}`;\n}\n\nfunction stringifyIncludedEnvs(includedEnvs: string[] = [], verbose = false) {\n if (includedEnvs.length < 2) return '';\n if (includedEnvs.length > 2 && !verbose) return ` ${includedEnvs.length} other envs`;\n return includedEnvs.join(', ');\n}\n"],"mappings":";;;;;;AAAA,SAAAA,QAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,OAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;E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,EAAE,OAAO,IAAII,YAAY,CAAC1B,MAAM,aAAa;EACpF,OAAO0B,YAAY,CAACI,IAAI,CAAC,IAAI,CAAC;AAChC","ignoreList":[]}
|
package/package.json
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
{
|
2
2
|
"name": "@teambit/preview",
|
3
|
-
"version": "1.0.
|
3
|
+
"version": "1.0.452",
|
4
4
|
"homepage": "https://bit.cloud/teambit/preview/preview",
|
5
5
|
"main": "dist/index.js",
|
6
6
|
"componentId": {
|
7
7
|
"scope": "teambit.preview",
|
8
8
|
"name": "preview",
|
9
|
-
"version": "1.0.
|
9
|
+
"version": "1.0.452"
|
10
10
|
},
|
11
11
|
"dependencies": {
|
12
12
|
"mime": "2.5.2",
|
@@ -28,35 +28,35 @@
|
|
28
28
|
"@teambit/component-id": "1.2.2",
|
29
29
|
"@teambit/bit-error": "0.0.404",
|
30
30
|
"@teambit/react.webpack.react-webpack": "1.0.37",
|
31
|
-
"@teambit/express": "0.0.
|
32
|
-
"@teambit/logger": "0.0.
|
31
|
+
"@teambit/express": "0.0.1128",
|
32
|
+
"@teambit/logger": "0.0.1122",
|
33
33
|
"@teambit/ui-foundation.ui.pages.static-error": "0.0.105",
|
34
|
-
"@teambit/builder": "1.0.
|
35
|
-
"@teambit/bundler": "1.0.
|
36
|
-
"@teambit/component": "1.0.
|
34
|
+
"@teambit/builder": "1.0.452",
|
35
|
+
"@teambit/bundler": "1.0.452",
|
36
|
+
"@teambit/component": "1.0.452",
|
37
37
|
"@teambit/preview.ui.component-preview": "1.0.16",
|
38
|
-
"@teambit/aspect-loader": "1.0.
|
39
|
-
"@teambit/cli": "0.0.
|
40
|
-
"@teambit/dependency-resolver": "1.0.
|
41
|
-
"@teambit/envs": "1.0.
|
38
|
+
"@teambit/aspect-loader": "1.0.452",
|
39
|
+
"@teambit/cli": "0.0.1029",
|
40
|
+
"@teambit/dependency-resolver": "1.0.452",
|
41
|
+
"@teambit/envs": "1.0.452",
|
42
42
|
"@teambit/toolbox.path.to-windows-compatible-path": "0.0.496",
|
43
43
|
"@teambit/toolbox.crypto.sha1": "0.0.2",
|
44
|
-
"@teambit/ui": "1.0.
|
45
|
-
"@teambit/isolator": "1.0.
|
44
|
+
"@teambit/ui": "1.0.452",
|
45
|
+
"@teambit/isolator": "1.0.452",
|
46
46
|
"@teambit/harmony.modules.harmony-root-generator": "0.0.7",
|
47
47
|
"@teambit/component.sources": "0.0.42",
|
48
48
|
"@teambit/toolbox.path.path": "0.0.4",
|
49
|
-
"@teambit/cache": "0.0.
|
50
|
-
"@teambit/graphql": "1.0.
|
49
|
+
"@teambit/cache": "0.0.1122",
|
50
|
+
"@teambit/graphql": "1.0.452",
|
51
51
|
"@teambit/harmony.modules.feature-toggle": "0.0.6",
|
52
|
-
"@teambit/pkg": "1.0.
|
53
|
-
"@teambit/pubsub": "1.0.
|
54
|
-
"@teambit/scope": "1.0.
|
55
|
-
"@teambit/watcher": "1.0.
|
56
|
-
"@teambit/workspace": "1.0.
|
57
|
-
"@teambit/compiler": "1.0.
|
52
|
+
"@teambit/pkg": "1.0.452",
|
53
|
+
"@teambit/pubsub": "1.0.452",
|
54
|
+
"@teambit/scope": "1.0.452",
|
55
|
+
"@teambit/watcher": "1.0.452",
|
56
|
+
"@teambit/workspace": "1.0.452",
|
57
|
+
"@teambit/compiler": "1.0.452",
|
58
58
|
"@teambit/preview.cli.webpack-events-listener": "0.0.175",
|
59
|
-
"@teambit/webpack": "1.0.
|
59
|
+
"@teambit/webpack": "1.0.452"
|
60
60
|
},
|
61
61
|
"devDependencies": {
|
62
62
|
"@types/mime": "2.0.3",
|
package/preview.start-plugin.tsx
CHANGED
@@ -111,18 +111,21 @@ export class PreviewStartPlugin implements StartPlugin {
|
|
111
111
|
};
|
112
112
|
const previewServer = this.serversMap[id];
|
113
113
|
const spinnerId = getSpinnerId(id);
|
114
|
-
const
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
this.
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
114
|
+
const spinner = this.logger.multiSpinner.spinners[spinnerId];
|
115
|
+
if (spinner && spinner.isActive()) {
|
116
|
+
const errors = results.errors || [];
|
117
|
+
const hasErrors = !!errors.length;
|
118
|
+
const warnings = getWarningsWithoutIgnored(results.warnings);
|
119
|
+
const hasWarnings = !!warnings.length;
|
120
|
+
const url = `http://localhost:${previewServer.port}`;
|
121
|
+
const text = getSpinnerDoneMessage(this.serversMap[id], errors, warnings, url);
|
122
|
+
if (hasErrors) {
|
123
|
+
this.logger.multiSpinner.fail(spinnerId, { text });
|
124
|
+
} else if (hasWarnings) {
|
125
|
+
this.logger.multiSpinner.warn(spinnerId, { text });
|
126
|
+
} else {
|
127
|
+
this.logger.multiSpinner.succeed(spinnerId, { text });
|
128
|
+
}
|
126
129
|
}
|
127
130
|
|
128
131
|
const noneAreCompiling = Object.values(this.serversState).every((x) => !x.isCompiling);
|