@teambit/preview 1.0.448 → 1.0.450

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.
@@ -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.448" tests="1" failures="0" errors="0" skipped="0">
3
+ <testsuite name="teambit.preview/preview@1.0.450" 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.005"/>
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={64576:(e,t,n)=>{Object.defineProperty(t,"l",{enumerable:!0,get:function(){return o.default}});var o=r(n(65257));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}},65257:(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},79931:(e,t,n)=>{var o={id:"teambit.preview/preview@1.0.448",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(79931),a=(n(41594),n(5016));const s=TeambitMdxUiMdxScopeContext;var p=n(64576),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})()));
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={64576:(e,t,n)=>{Object.defineProperty(t,"l",{enumerable:!0,get:function(){return o.default}});var o=r(n(65257));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}},65257:(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},17124:(e,t,n)=>{var o={id:"teambit.preview/preview@1.0.450",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(17124),a=(n(41594),n(5016));const s=TeambitMdxUiMdxScopeContext;var p=n(64576),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})()));
@@ -249,7 +249,7 @@
249
249
  "_legacy": {
250
250
  "scope": "teambit.preview",
251
251
  "name": "preview",
252
- "version": "1.0.448"
252
+ "version": "1.0.450"
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.448"
6282
+ "version": "1.0.450"
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.448"
12984
+ "version": "1.0.450"
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.448/dist/preview.composition.js';
2
- import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.preview_preview@1.0.448/dist/preview.docs.mdx';
1
+ import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.preview_preview@1.0.450/dist/preview.composition.js';
2
+ import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.preview_preview@1.0.450/dist/preview.docs.mdx';
3
3
 
4
4
  export const compositions = [compositions_0];
5
5
  export const overview = [overview_0];
@@ -1 +1 @@
1
- {"version":3,"names":["_path","data","require","_fsExtra","_lodash","_component","_htmlTemplate","_defineProperty","e","r","t","_toPropertyKey","Object","defineProperty","value","enumerable","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","ENV_STRATEGY_ARTIFACT_NAME","exports","EnvBundlingStrategy","constructor","preview","pkg","dependencyResolver","computeTargets","context","previewDefs","outputPath","getOutputPath","existsSync","mkdirpSync","htmlConfig","generateHtmlConfig","dev","peers","getPreviewHostDependenciesFromEnv","envDefinition","env","componentDirectoryMap","components","forEach","component","capsule","capsuleNetwork","graphCapsules","getCapsule","id","toString","path","entries","computePaths","html","hostDependencies","aliasHostDependencies","options","config","title","templateContent","cache","minify","computeResults","results","result","componentsResults","map","errors","err","message","warning","warnings","startTime","endTime","artifacts","getArtifactDef","rootDir","getDirName","name","globPatterns","envName","replace","resolve","capsulesRootDir","getPaths","files","compiler","getCompiler","file","join","getDistPathBySrcPath","relative","defs","previewMain","writePreviewRuntime","moduleMapsPromise","previewDef","moduleMap","getModuleMap","paths","ComponentMap","as","maybeFiles","get","compiledPaths","template","renderTemplatePath","link","writeLink","prefix","default","flatten","toArray","concat","moduleMaps","Promise","all"],"sources":["env-strategy.ts"],"sourcesContent":["import { join, resolve } from 'path';\nimport { existsSync, mkdirpSync } from 'fs-extra';\nimport { flatten } from 'lodash';\nimport { ComponentMap } from '@teambit/component';\nimport { Compiler } from '@teambit/compiler';\nimport { AbstractVinyl } from '@teambit/component.sources';\nimport { Capsule } from '@teambit/isolator';\nimport { ComponentResult } from '@teambit/builder';\nimport { BundlerContext, BundlerHtmlConfig, BundlerResult } from '@teambit/bundler';\nimport { DependencyResolverMain } from '@teambit/dependency-resolver';\nimport { PkgMain } from '@teambit/pkg';\nimport type { BundlingStrategy, ComputeTargetsContext } from '../bundling-strategy';\nimport { PreviewDefinition } from '../preview-definition';\nimport { PreviewMain } from '../preview.main.runtime';\nimport { html } from '../bundler/html-template';\n\nexport const ENV_STRATEGY_ARTIFACT_NAME = 'preview';\n\n/**\n * bundles all components in a given env into the same bundle.\n */\nexport class EnvBundlingStrategy implements BundlingStrategy {\n name = 'env';\n\n constructor(\n private preview: PreviewMain,\n private pkg: PkgMain,\n private dependencyResolver: DependencyResolverMain\n ) {}\n\n async computeTargets(context: ComputeTargetsContext, previewDefs: PreviewDefinition[]) {\n const outputPath = this.getOutputPath(context);\n if (!existsSync(outputPath)) mkdirpSync(outputPath);\n const htmlConfig = this.generateHtmlConfig({ dev: context.dev });\n const peers = await this.dependencyResolver.getPreviewHostDependenciesFromEnv(context.envDefinition.env);\n const componentDirectoryMap = {};\n context.components.forEach((component) => {\n const capsule = context.capsuleNetwork.graphCapsules.getCapsule(component.id);\n if (!capsule) return;\n componentDirectoryMap[component.id.toString()] = capsule.path;\n });\n\n return [\n {\n entries: await this.computePaths(outputPath, previewDefs, context),\n componentDirectoryMap,\n html: [htmlConfig],\n components: context.components,\n outputPath,\n /* It's a path to the root of the host component. */\n // hostRootDir, handle this\n hostDependencies: peers,\n aliasHostDependencies: true,\n },\n ];\n }\n\n private generateHtmlConfig(options: { dev?: boolean }): BundlerHtmlConfig {\n const config = {\n title: 'Preview',\n templateContent: html('Preview'),\n cache: false,\n minify: options?.dev ?? true,\n };\n return config;\n }\n\n async computeResults(context: BundlerContext, results: BundlerResult[]) {\n const result = results[0];\n\n const componentsResults: ComponentResult[] = result.components.map((component) => {\n return {\n component,\n errors: result.errors.map((err) => (typeof err === 'string' ? err : err.message)),\n warning: result.warnings,\n startTime: result.startTime,\n endTime: result.endTime,\n };\n });\n\n const artifacts = this.getArtifactDef(context);\n\n return {\n componentsResults,\n artifacts,\n };\n }\n\n private getArtifactDef(context: ComputeTargetsContext) {\n // eslint-disable-next-line @typescript-eslint/prefer-as-const\n const env: 'env' = 'env';\n const rootDir = this.getDirName(context);\n\n return [\n {\n name: ENV_STRATEGY_ARTIFACT_NAME,\n globPatterns: ['public/**'],\n rootDir,\n context: env,\n },\n ];\n }\n\n getDirName(context: ComputeTargetsContext) {\n const envName = context.id.replace('/', '__');\n return `${envName}-preview`;\n }\n\n private getOutputPath(context: ComputeTargetsContext) {\n return resolve(`${context.capsuleNetwork.capsulesRootDir}/${this.getDirName(context)}`);\n }\n\n private getPaths(context: ComputeTargetsContext, files: AbstractVinyl[], capsule: Capsule) {\n const compiler: Compiler = context.env.getCompiler();\n return files.map((file) => join(capsule.path, compiler.getDistPathBySrcPath(file.relative)));\n }\n\n private async computePaths(\n outputPath: string,\n defs: PreviewDefinition[],\n context: ComputeTargetsContext\n ): Promise<string[]> {\n const previewMain = await this.preview.writePreviewRuntime(context);\n const moduleMapsPromise = defs.map(async (previewDef) => {\n const moduleMap = await previewDef.getModuleMap(context.components);\n\n const paths = ComponentMap.as(context.components, (component) => {\n const capsule = context.capsuleNetwork.graphCapsules.getCapsule(component.id);\n const maybeFiles = moduleMap.get(component);\n if (!maybeFiles || !capsule) return [];\n const [, files] = maybeFiles;\n const compiledPaths = this.getPaths(context, files, capsule);\n return compiledPaths;\n });\n\n const template = previewDef.renderTemplatePath ? await previewDef.renderTemplatePath(context) : 'undefined';\n\n const link = this.preview.writeLink(\n previewDef.prefix,\n paths,\n { default: template || 'undefined' },\n outputPath,\n false\n );\n\n const files = flatten(paths.toArray().map(([, file]) => file)).concat([link]);\n\n if (template) return files.concat([template]);\n return files;\n });\n\n const moduleMaps = await Promise.all(moduleMapsPromise);\n\n return flatten(moduleMaps.concat([previewMain]));\n }\n}\n"],"mappings":";;;;;;AAAA,SAAAA,MAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,KAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAE,SAAA;EAAA,MAAAF,IAAA,GAAAC,OAAA;EAAAC,QAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,QAAA;EAAA,MAAAH,IAAA,GAAAC,OAAA;EAAAE,OAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAI,W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MAEF,MAAMC,QAAQ,GAAGT,UAAU,CAACU,kBAAkB,GAAG,MAAMV,UAAU,CAACU,kBAAkB,CAAC/E,OAAO,CAAC,GAAG,WAAW;MAE3G,MAAMgF,IAAI,GAAG,IAAI,CAACpF,OAAO,CAACqF,SAAS,CACjCZ,UAAU,CAACa,MAAM,EACjBV,KAAK,EACL;QAAEW,OAAO,EAAEL,QAAQ,IAAI;MAAY,CAAC,EACpC5E,UAAU,EACV,KACF,CAAC;MAED,MAAMwD,KAAK,GAAG,IAAA0B,iBAAO,EAACZ,KAAK,CAACa,OAAO,CAAC,CAAC,CAAC9C,GAAG,CAAC,CAAC,GAAGsB,IAAI,CAAC,KAAKA,IAAI,CAAC,CAAC,CAACyB,MAAM,CAAC,CAACN,IAAI,CAAC,CAAC;MAE7E,IAAIF,QAAQ,EAAE,OAAOpB,KAAK,CAAC4B,MAAM,CAAC,CAACR,QAAQ,CAAC,CAAC;MAC7C,OAAOpB,KAAK;IACd,CAAC,CAAC;IAEF,MAAM6B,UAAU,GAAG,MAAMC,OAAO,CAACC,GAAG,CAACrB,iBAAiB,CAAC;IAEvD,OAAO,IAAAgB,iBAAO,EAACG,UAAU,CAACD,MAAM,CAAC,CAACpB,WAAW,CAAC,CAAC,CAAC;EAClD;AACF;AAACzE,OAAA,CAAAC,mBAAA,GAAAA,mBAAA","ignoreList":[]}
1
+ {"version":3,"names":["_path","data","require","_fsExtra","_lodash","_component","_htmlTemplate","_defineProperty","e","r","t","_toPropertyKey","Object","defineProperty","value","enumerable","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","ENV_STRATEGY_ARTIFACT_NAME","exports","EnvBundlingStrategy","constructor","preview","pkg","dependencyResolver","computeTargets","context","previewDefs","outputPath","getOutputPath","existsSync","mkdirpSync","htmlConfig","generateHtmlConfig","dev","peers","getPreviewHostDependenciesFromEnv","envDefinition","env","componentDirectoryMap","components","forEach","component","capsule","capsuleNetwork","graphCapsules","getCapsule","id","toString","path","entries","computePaths","html","hostDependencies","aliasHostDependencies","options","config","title","templateContent","cache","minify","computeResults","results","result","componentsResults","map","errors","err","message","warning","warnings","startTime","endTime","artifacts","getArtifactDef","rootDir","getDirName","name","globPatterns","envName","replace","resolve","capsulesRootDir","getPaths","files","compiler","getCompiler","file","join","getDistPathBySrcPath","relative","defs","previewMain","writePreviewRuntime","moduleMapsPromise","previewDef","moduleMap","getModuleMap","paths","ComponentMap","as","maybeFiles","get","compiledPaths","template","renderTemplatePath","link","writeLink","prefix","default","flatten","toArray","concat","moduleMaps","Promise","all"],"sources":["env-strategy.ts"],"sourcesContent":["import { join, resolve } from 'path';\nimport { existsSync, mkdirpSync } from 'fs-extra';\nimport { flatten } from 'lodash';\nimport { ComponentMap } from '@teambit/component';\nimport { Compiler } from '@teambit/compiler';\nimport { AbstractVinyl } from '@teambit/component.sources';\nimport { Capsule } from '@teambit/isolator';\nimport { ComponentResult } from '@teambit/builder';\nimport { BundlerContext, BundlerHtmlConfig, BundlerResult } from '@teambit/bundler';\nimport { DependencyResolverMain } from '@teambit/dependency-resolver';\nimport { PkgMain } from '@teambit/pkg';\nimport type { BundlingStrategy, ComputeTargetsContext } from '../bundling-strategy';\nimport { PreviewDefinition } from '../preview-definition';\nimport { PreviewMain } from '../preview.main.runtime';\nimport { html } from '../bundler/html-template';\n\nexport const ENV_STRATEGY_ARTIFACT_NAME = 'preview';\n\n/**\n * bundles all components in a given env into the same bundle.\n */\nexport class EnvBundlingStrategy implements BundlingStrategy {\n name = 'env';\n\n constructor(private preview: PreviewMain, private pkg: PkgMain, private dependencyResolver: DependencyResolverMain) {}\n\n async computeTargets(context: ComputeTargetsContext, previewDefs: PreviewDefinition[]) {\n const outputPath = this.getOutputPath(context);\n if (!existsSync(outputPath)) mkdirpSync(outputPath);\n const htmlConfig = this.generateHtmlConfig({ dev: context.dev });\n const peers = await this.dependencyResolver.getPreviewHostDependenciesFromEnv(context.envDefinition.env);\n const componentDirectoryMap = {};\n context.components.forEach((component) => {\n const capsule = context.capsuleNetwork.graphCapsules.getCapsule(component.id);\n if (!capsule) return;\n componentDirectoryMap[component.id.toString()] = capsule.path;\n });\n\n return [\n {\n entries: await this.computePaths(outputPath, previewDefs, context),\n componentDirectoryMap,\n html: [htmlConfig],\n components: context.components,\n outputPath,\n /* It's a path to the root of the host component. */\n // hostRootDir, handle this\n hostDependencies: peers,\n aliasHostDependencies: true,\n },\n ];\n }\n\n private generateHtmlConfig(options: { dev?: boolean }): BundlerHtmlConfig {\n const config = {\n title: 'Preview',\n templateContent: html('Preview'),\n cache: false,\n minify: options?.dev ?? true,\n };\n return config;\n }\n\n async computeResults(context: BundlerContext, results: BundlerResult[]) {\n const result = results[0];\n\n const componentsResults: ComponentResult[] = result.components.map((component) => {\n return {\n component,\n errors: result.errors.map((err) => (typeof err === 'string' ? err : err.message)),\n warning: result.warnings,\n startTime: result.startTime,\n endTime: result.endTime,\n };\n });\n\n const artifacts = this.getArtifactDef(context);\n\n return {\n componentsResults,\n artifacts,\n };\n }\n\n private getArtifactDef(context: ComputeTargetsContext) {\n // eslint-disable-next-line @typescript-eslint/prefer-as-const\n const env: 'env' = 'env';\n const rootDir = this.getDirName(context);\n\n return [\n {\n name: ENV_STRATEGY_ARTIFACT_NAME,\n globPatterns: ['public/**'],\n rootDir,\n context: env,\n },\n ];\n }\n\n getDirName(context: ComputeTargetsContext) {\n const envName = context.id.replace('/', '__');\n return `${envName}-preview`;\n }\n\n private getOutputPath(context: ComputeTargetsContext) {\n return resolve(`${context.capsuleNetwork.capsulesRootDir}/${this.getDirName(context)}`);\n }\n\n private getPaths(context: ComputeTargetsContext, files: AbstractVinyl[], capsule: Capsule) {\n const compiler: Compiler = context.env.getCompiler();\n return files.map((file) => join(capsule.path, compiler.getDistPathBySrcPath(file.relative)));\n }\n\n private async computePaths(\n outputPath: string,\n defs: PreviewDefinition[],\n context: ComputeTargetsContext\n ): Promise<string[]> {\n const previewMain = await this.preview.writePreviewRuntime(context);\n const moduleMapsPromise = defs.map(async (previewDef) => {\n const moduleMap = await previewDef.getModuleMap(context.components);\n\n const paths = ComponentMap.as(context.components, (component) => {\n const capsule = context.capsuleNetwork.graphCapsules.getCapsule(component.id);\n const maybeFiles = moduleMap.get(component);\n if (!maybeFiles || !capsule) return [];\n const [, files] = maybeFiles;\n const compiledPaths = this.getPaths(context, files, capsule);\n return compiledPaths;\n });\n\n const template = previewDef.renderTemplatePath ? await previewDef.renderTemplatePath(context) : 'undefined';\n\n const link = this.preview.writeLink(\n previewDef.prefix,\n paths,\n { default: template || 'undefined' },\n outputPath,\n false\n );\n\n const files = flatten(paths.toArray().map(([, file]) => file)).concat([link]);\n\n if (template) return files.concat([template]);\n return files;\n });\n\n const moduleMaps = await Promise.all(moduleMapsPromise);\n\n return flatten(moduleMaps.concat([previewMain]));\n }\n}\n"],"mappings":";;;;;;AAAA,SAAAA,MAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,KAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAE,SAAA;EAAA,MAAAF,IAAA,GAAAC,OAAA;EAAAC,QAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,QAAA;EAAA,MAAAH,IAAA,GAAAC,OAAA;EAAAE,OAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAI,WAAA;EAAA,MAAAJ,IAAA,GAAAC,OAAA;EAAAG,UAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAWA,SAAAK,cAAA;EAAA,MAAAL,IAAA,GAAAC,OAAA;EAAAI,aAAA,YAAAA,CAAA;IAAA,OAAAL,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAAgD,SAAAM,gBAAAC,CAAA,EAAAC,CAAA,EAAAC,CAAA,YAAAD,CAAA,GAAAE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AAG,IAAA0B,iBAAO,EAACZ,KAAK,CAACa,OAAO,CAAC,CAAC,CAAC9C,GAAG,CAAC,CAAC,GAAGsB,IAAI,CAAC,KAAKA,IAAI,CAAC,CAAC,CAACyB,MAAM,CAAC,CAACN,IAAI,CAAC,CAAC;MAE7E,IAAIF,QAAQ,EAAE,OAAOpB,KAAK,CAAC4B,MAAM,CAAC,CAACR,QAAQ,CAAC,CAAC;MAC7C,OAAOpB,KAAK;IACd,CAAC,CAAC;IAEF,MAAM6B,UAAU,GAAG,MAAMC,OAAO,CAACC,GAAG,CAACrB,iBAAiB,CAAC;IAEvD,OAAO,IAAAgB,iBAAO,EAACG,UAAU,CAACD,MAAM,CAAC,CAACpB,WAAW,CAAC,CAAC,CAAC;EAClD;AACF;AAACzE,OAAA,CAAAC,mBAAA,GAAAA,mBAAA","ignoreList":[]}
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@teambit/preview",
3
- "version": "1.0.448",
3
+ "version": "1.0.450",
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.448"
9
+ "version": "1.0.450"
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.1124",
32
- "@teambit/logger": "0.0.1118",
31
+ "@teambit/express": "0.0.1126",
32
+ "@teambit/logger": "0.0.1120",
33
33
  "@teambit/ui-foundation.ui.pages.static-error": "0.0.105",
34
- "@teambit/builder": "1.0.448",
35
- "@teambit/bundler": "1.0.448",
36
- "@teambit/component": "1.0.448",
34
+ "@teambit/builder": "1.0.450",
35
+ "@teambit/bundler": "1.0.450",
36
+ "@teambit/component": "1.0.450",
37
37
  "@teambit/preview.ui.component-preview": "1.0.16",
38
- "@teambit/aspect-loader": "1.0.448",
39
- "@teambit/cli": "0.0.1025",
40
- "@teambit/dependency-resolver": "1.0.448",
41
- "@teambit/envs": "1.0.448",
38
+ "@teambit/aspect-loader": "1.0.450",
39
+ "@teambit/cli": "0.0.1027",
40
+ "@teambit/dependency-resolver": "1.0.450",
41
+ "@teambit/envs": "1.0.450",
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.448",
45
- "@teambit/isolator": "1.0.448",
44
+ "@teambit/ui": "1.0.450",
45
+ "@teambit/isolator": "1.0.450",
46
46
  "@teambit/harmony.modules.harmony-root-generator": "0.0.7",
47
- "@teambit/component.sources": "0.0.41",
47
+ "@teambit/component.sources": "0.0.42",
48
48
  "@teambit/toolbox.path.path": "0.0.4",
49
- "@teambit/cache": "0.0.1118",
50
- "@teambit/graphql": "1.0.448",
49
+ "@teambit/cache": "0.0.1120",
50
+ "@teambit/graphql": "1.0.450",
51
51
  "@teambit/harmony.modules.feature-toggle": "0.0.6",
52
- "@teambit/pkg": "1.0.448",
53
- "@teambit/pubsub": "1.0.448",
54
- "@teambit/scope": "1.0.448",
55
- "@teambit/watcher": "1.0.448",
56
- "@teambit/workspace": "1.0.448",
57
- "@teambit/compiler": "1.0.448",
52
+ "@teambit/pkg": "1.0.450",
53
+ "@teambit/pubsub": "1.0.450",
54
+ "@teambit/scope": "1.0.450",
55
+ "@teambit/watcher": "1.0.450",
56
+ "@teambit/workspace": "1.0.450",
57
+ "@teambit/compiler": "1.0.450",
58
58
  "@teambit/preview.cli.webpack-events-listener": "0.0.175",
59
- "@teambit/webpack": "1.0.448"
59
+ "@teambit/webpack": "1.0.450"
60
60
  },
61
61
  "devDependencies": {
62
62
  "@types/mime": "2.0.3",
@@ -22,11 +22,7 @@ export const ENV_STRATEGY_ARTIFACT_NAME = 'preview';
22
22
  export class EnvBundlingStrategy implements BundlingStrategy {
23
23
  name = 'env';
24
24
 
25
- constructor(
26
- private preview: PreviewMain,
27
- private pkg: PkgMain,
28
- private dependencyResolver: DependencyResolverMain
29
- ) {}
25
+ constructor(private preview: PreviewMain, private pkg: PkgMain, private dependencyResolver: DependencyResolverMain) {}
30
26
 
31
27
  async computeTargets(context: ComputeTargetsContext, previewDefs: PreviewDefinition[]) {
32
28
  const outputPath = this.getOutputPath(context);