@teambit/docs 1.0.331 → 1.0.333

Sign up to get free protection for your applications and to get access to all the features.
@@ -6667,7 +6667,7 @@
6667
6667
  "componentId": {
6668
6668
  "scope": "teambit.docs",
6669
6669
  "name": "docs",
6670
- "version": "1.0.331"
6670
+ "version": "1.0.333"
6671
6671
  },
6672
6672
  "taggedModuleExports": []
6673
6673
  }
@@ -8,7 +8,7 @@ import type { Environment } from '@teambit/envs';
8
8
  import { GraphqlMain } from '@teambit/graphql';
9
9
  import { PreviewMain } from '@teambit/preview';
10
10
  import { DevFilesMain } from '@teambit/dev-files';
11
- import { AbstractVinyl } from '@teambit/legacy/dist/consumer/component/sources';
11
+ import { AbstractVinyl } from '@teambit/component.sources';
12
12
  import { Workspace } from '@teambit/workspace';
13
13
  import { Doc } from '@teambit/docs.entities.doc';
14
14
  import { EnvsMain } from '@teambit/envs';
@@ -1 +1 @@
1
- {"version":3,"names":["_harmony","data","require","_cli","_logger","_compiler","_component","_scope","_pkg","_graphql","_preview","_devFiles","_workspace","_docsEntities","_lodash","_envs","_docs","_docs2","_docs3","_defaultDocReader","_exceptions","_defineProperty","e","r","t","_toPropertyKey","Object","defineProperty","value","enumerable","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","DocsMain","constructor","patterns","preview","pkg","compiler","workspace","logger","devFiles","envs","docPropSlot","docReaderSlot","getDocsMap","components","ComponentMap","as","component","getDocsFiles","getDevFiles","docFiles","get","DocsAspect","id","state","filesystem","files","filter","file","includes","relative","getDescription","componentDoc","getDoc","desc","description","getTemplate","env","getDocsTemplate","isFunction","undefined","getDocReader","extension","values","find","docReader","isFormatSupported","computeDoc","length","docFile","extname","FileExtensionNotSupported","doc","read","contents","err","debug","message","docData","Doc","filePath","DocPropList","props","getPatterns","getComponentDevPatterns","calculateEnv","skipWarnings","inInstallContext","componentEnvDocsDevPatterns","getDocsDevPatterns","componentPatterns","concat","name","pattern","getDevPatternToRegister","bind","registerDocReader","register","provider","graphql","loggerAspect","scope","config","createLogger","docs","DefaultDocReader","registerDevPattern","computeDocsOnLoad","opts","loadDocs","toObject","registerOnComponentLoad","registerOnCompAspectReCalc","docsSchema","registerDefinition","DocsPreviewDefinition","exports","Slot","withType","MainRuntime","PreviewAspect","GraphqlAspect","WorkspaceAspect","PkgAspect","CompilerAspect","LoggerAspect","DevFilesAspect","EnvsAspect","ScopeAspect","addRuntime"],"sources":["docs.main.runtime.ts"],"sourcesContent":["import { Slot, SlotRegistry } from '@teambit/harmony';\nimport { MainRuntime } from '@teambit/cli';\nimport { LoggerAspect, LoggerMain, Logger } from '@teambit/logger';\nimport { CompilerAspect, CompilerMain } from '@teambit/compiler';\nimport { Component, ComponentMap, IComponent } from '@teambit/component';\nimport { ScopeAspect, ScopeMain } from '@teambit/scope';\nimport { PkgAspect, PkgMain } from '@teambit/pkg';\nimport type { Environment } from '@teambit/envs';\nimport { GraphqlAspect, GraphqlMain } from '@teambit/graphql';\nimport { PreviewAspect, PreviewMain } from '@teambit/preview';\nimport { DevFilesAspect, DevFilesMain } from '@teambit/dev-files';\nimport { ComponentLoadOptions } from '@teambit/legacy/dist/consumer/component/component-loader';\nimport { AbstractVinyl } from '@teambit/legacy/dist/consumer/component/sources';\nimport { Workspace, WorkspaceAspect } from '@teambit/workspace';\nimport { Doc, DocPropList } from '@teambit/docs.entities.doc';\nimport { isFunction } from 'lodash';\nimport { EnvsAspect, EnvsMain } from '@teambit/envs';\nimport { DocsAspect } from './docs.aspect';\nimport { DocsPreviewDefinition } from './docs.preview-definition';\nimport { docsSchema } from './docs.graphql';\nimport { DocReader } from './doc-reader';\nimport { DefaultDocReader } from './default-doc-reader';\nimport { FileExtensionNotSupported } from './exceptions';\n\nexport type ComponentDocs = {\n files: string[];\n component: Component;\n};\n\nexport type DocProp = {};\n\nexport type DocPropSlot = SlotRegistry<DocProp>;\n\nexport type DocReaderSlot = SlotRegistry<DocReader>;\n\nexport type DocsConfig = {\n /**\n * glob patterns to identify doc files.\n */\n patterns: string[];\n};\n\n/**\n * the component documentation extension.\n */\nexport class DocsMain {\n constructor(\n private patterns: string[],\n /**\n * envs extension.\n */\n private preview: PreviewMain,\n\n private pkg: PkgMain,\n\n private compiler: CompilerMain,\n\n private workspace: Workspace,\n\n private logger: Logger,\n\n private devFiles: DevFilesMain,\n\n private envs: EnvsMain,\n\n private docPropSlot: DocPropSlot,\n\n private docReaderSlot: DocReaderSlot\n ) {}\n\n /**\n * returns an array of doc file paths for a set of components.\n */\n getDocsMap(components: Component[]): ComponentMap<AbstractVinyl[]> {\n return ComponentMap.as<AbstractVinyl[]>(components, (component) => {\n return this.getDocsFiles(component);\n });\n }\n\n getDocsFiles(component: Component): AbstractVinyl[] {\n const devFiles = this.devFiles.getDevFiles(component);\n const docFiles = devFiles.get(DocsAspect.id);\n return component.state.filesystem.files.filter((file) => docFiles.includes(file.relative));\n }\n\n /**\n * compute the description of the component from its source code and docs file.\n */\n async getDescription(component: Component): Promise<string> {\n const componentDoc = this.getDoc(component);\n const desc = componentDoc?.description;\n return desc || '';\n }\n\n async getTemplate(env: Environment): Promise<string | undefined> {\n if (env.getDocsTemplate && isFunction(env.getDocsTemplate)) {\n return env.getDocsTemplate();\n }\n return undefined;\n }\n\n getDocReader(extension: string) {\n return this.docReaderSlot.values().find((docReader) => docReader.isFormatSupported(extension));\n }\n\n /**\n * compute a doc for a component.\n */\n async computeDoc(component: Component) {\n const docFiles = this.getDocsFiles(component);\n if (docFiles.length) {\n // currently taking the the first docs file found with an abstract. (we support only one)\n const docFile = docFiles[0];\n\n try {\n const docReader = this.getDocReader(docFile.extname);\n if (!docReader) throw new FileExtensionNotSupported(docFile.relative, docFile.extname);\n const doc = await docReader.read(docFile.relative, docFile.contents, component);\n return doc;\n } catch (err: any) {\n // it's ok to fail here.\n this.logger.debug(`docs.main.runtime.computeDoc caught an error: ${err.message}`);\n return null;\n }\n }\n\n return null;\n }\n\n getDoc(component: IComponent) {\n const docData = component.get(DocsAspect.id)?.data?.doc;\n if (!docData) return null;\n return new Doc(docData.filePath, new DocPropList(docData.props));\n }\n\n getPatterns() {\n return this.patterns;\n }\n\n getComponentDevPatterns(component: Component) {\n const env = this.envs.calculateEnv(component, { skipWarnings: !!this.workspace?.inInstallContext }).env;\n const componentEnvDocsDevPatterns: string[] = env.getDocsDevPatterns ? env.getDocsDevPatterns(component) : [];\n const componentPatterns = componentEnvDocsDevPatterns.concat(this.getPatterns());\n return { name: 'docs', pattern: componentPatterns };\n }\n\n getDevPatternToRegister() {\n return this.getComponentDevPatterns.bind(this);\n }\n /**\n * register a new doc reader. this allows to support further\n * documentation file formats.\n */\n registerDocReader(docReader: DocReader) {\n this.docReaderSlot.register(docReader);\n return this;\n }\n\n static slots = [Slot.withType<DocProp>(), Slot.withType<DocReader>()];\n\n static runtime = MainRuntime;\n static dependencies = [\n PreviewAspect,\n GraphqlAspect,\n WorkspaceAspect,\n PkgAspect,\n CompilerAspect,\n LoggerAspect,\n DevFilesAspect,\n EnvsAspect,\n ScopeAspect,\n ];\n\n static defaultConfig = {\n patterns: ['**/*.docs.*'],\n };\n\n static async provider(\n [preview, graphql, workspace, pkg, compiler, loggerAspect, devFiles, envs, scope]: [\n PreviewMain,\n GraphqlMain,\n Workspace,\n PkgMain,\n CompilerMain,\n LoggerMain,\n DevFilesMain,\n EnvsMain,\n ScopeMain\n ],\n config: DocsConfig,\n [docPropSlot, docReaderSlot]: [DocPropSlot, DocReaderSlot]\n ) {\n const logger = loggerAspect.createLogger(DocsAspect.id);\n const docs = new DocsMain(\n config.patterns,\n preview,\n pkg,\n compiler,\n workspace,\n logger,\n devFiles,\n envs,\n docPropSlot,\n docReaderSlot\n );\n docs.registerDocReader(new DefaultDocReader(pkg, compiler, workspace));\n devFiles.registerDevPattern(docs.getDevPatternToRegister());\n\n const computeDocsOnLoad = async (component: Component, opts?: ComponentLoadOptions) => {\n if (opts?.loadDocs === false) return undefined;\n // const docFiles = await docs.computeDocs(component);\n const doc = await docs.computeDoc(component);\n\n return {\n doc: doc?.toObject(),\n // docFiles\n };\n };\n\n if (workspace) {\n workspace.registerOnComponentLoad(computeDocsOnLoad);\n }\n if (scope) {\n scope.registerOnCompAspectReCalc(computeDocsOnLoad);\n }\n\n graphql.register(docsSchema(docs));\n\n preview.registerDefinition(new DocsPreviewDefinition(docs));\n return docs;\n }\n}\n\nDocsAspect.addRuntime(DocsMain);\n"],"mappings":";;;;;;AAAA,SAAAA,SAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,QAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAE,KAAA;EAAA,MAAAF,IAAA,GAAAC,OAAA;EAAAC,IAAA,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,UAAA;EAAA,MAAAJ,IAAA,GAAAC,OAAA;EAAAG,SAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAK,WAAA;EAAA,MAAAL,IAAA,GAAAC,OAAA;EAAAI,UAAA,YAAAA,CAAA;IAAA,OAAAL,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAM,OAAA;EAAA,MAAAN,IAAA,GAAAC,OAAA;EAAAK,MAAA,YAAAA,CAAA;IAAA,OAAAN,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAO,KAAA;EAAA,MAAAP,IAAA,GAAAC,OAAA;EAAAM,IAAA,YAAAA,CAAA;IAAA,OAAAP,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAQ,SAAA;EAAA,MAAAR,IAAA,GAAAC,OAAA;EAAAO,QAAA,YAAAA,CAAA;IAAA,OAAAR,IAAA;EAAA;EAAA,O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AA9H,eAAA,CA9HUmB,QAAQ,mBAgII;EACrBE,QAAQ,EAAE,CAAC,aAAa;AAC1B,CAAC;AA0DHmB,kBAAU,CAACuF,UAAU,CAAC5G,QAAQ,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["_harmony","data","require","_cli","_logger","_compiler","_component","_scope","_pkg","_graphql","_preview","_devFiles","_workspace","_docsEntities","_lodash","_envs","_docs","_docs2","_docs3","_defaultDocReader","_exceptions","_defineProperty","e","r","t","_toPropertyKey","Object","defineProperty","value","enumerable","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","DocsMain","constructor","patterns","preview","pkg","compiler","workspace","logger","devFiles","envs","docPropSlot","docReaderSlot","getDocsMap","components","ComponentMap","as","component","getDocsFiles","getDevFiles","docFiles","get","DocsAspect","id","state","filesystem","files","filter","file","includes","relative","getDescription","componentDoc","getDoc","desc","description","getTemplate","env","getDocsTemplate","isFunction","undefined","getDocReader","extension","values","find","docReader","isFormatSupported","computeDoc","length","docFile","extname","FileExtensionNotSupported","doc","read","contents","err","debug","message","docData","Doc","filePath","DocPropList","props","getPatterns","getComponentDevPatterns","calculateEnv","skipWarnings","inInstallContext","componentEnvDocsDevPatterns","getDocsDevPatterns","componentPatterns","concat","name","pattern","getDevPatternToRegister","bind","registerDocReader","register","provider","graphql","loggerAspect","scope","config","createLogger","docs","DefaultDocReader","registerDevPattern","computeDocsOnLoad","opts","loadDocs","toObject","registerOnComponentLoad","registerOnCompAspectReCalc","docsSchema","registerDefinition","DocsPreviewDefinition","exports","Slot","withType","MainRuntime","PreviewAspect","GraphqlAspect","WorkspaceAspect","PkgAspect","CompilerAspect","LoggerAspect","DevFilesAspect","EnvsAspect","ScopeAspect","addRuntime"],"sources":["docs.main.runtime.ts"],"sourcesContent":["import { Slot, SlotRegistry } from '@teambit/harmony';\nimport { MainRuntime } from '@teambit/cli';\nimport { LoggerAspect, LoggerMain, Logger } from '@teambit/logger';\nimport { CompilerAspect, CompilerMain } from '@teambit/compiler';\nimport { Component, ComponentMap, IComponent } from '@teambit/component';\nimport { ScopeAspect, ScopeMain } from '@teambit/scope';\nimport { PkgAspect, PkgMain } from '@teambit/pkg';\nimport type { Environment } from '@teambit/envs';\nimport { GraphqlAspect, GraphqlMain } from '@teambit/graphql';\nimport { PreviewAspect, PreviewMain } from '@teambit/preview';\nimport { DevFilesAspect, DevFilesMain } from '@teambit/dev-files';\nimport { ComponentLoadOptions } from '@teambit/legacy/dist/consumer/component/component-loader';\nimport { AbstractVinyl } from '@teambit/component.sources';\nimport { Workspace, WorkspaceAspect } from '@teambit/workspace';\nimport { Doc, DocPropList } from '@teambit/docs.entities.doc';\nimport { isFunction } from 'lodash';\nimport { EnvsAspect, EnvsMain } from '@teambit/envs';\nimport { DocsAspect } from './docs.aspect';\nimport { DocsPreviewDefinition } from './docs.preview-definition';\nimport { docsSchema } from './docs.graphql';\nimport { DocReader } from './doc-reader';\nimport { DefaultDocReader } from './default-doc-reader';\nimport { FileExtensionNotSupported } from './exceptions';\n\nexport type ComponentDocs = {\n files: string[];\n component: Component;\n};\n\nexport type DocProp = {};\n\nexport type DocPropSlot = SlotRegistry<DocProp>;\n\nexport type DocReaderSlot = SlotRegistry<DocReader>;\n\nexport type DocsConfig = {\n /**\n * glob patterns to identify doc files.\n */\n patterns: string[];\n};\n\n/**\n * the component documentation extension.\n */\nexport class DocsMain {\n constructor(\n private patterns: string[],\n /**\n * envs extension.\n */\n private preview: PreviewMain,\n\n private pkg: PkgMain,\n\n private compiler: CompilerMain,\n\n private workspace: Workspace,\n\n private logger: Logger,\n\n private devFiles: DevFilesMain,\n\n private envs: EnvsMain,\n\n private docPropSlot: DocPropSlot,\n\n private docReaderSlot: DocReaderSlot\n ) {}\n\n /**\n * returns an array of doc file paths for a set of components.\n */\n getDocsMap(components: Component[]): ComponentMap<AbstractVinyl[]> {\n return ComponentMap.as<AbstractVinyl[]>(components, (component) => {\n return this.getDocsFiles(component);\n });\n }\n\n getDocsFiles(component: Component): AbstractVinyl[] {\n const devFiles = this.devFiles.getDevFiles(component);\n const docFiles = devFiles.get(DocsAspect.id);\n return component.state.filesystem.files.filter((file) => docFiles.includes(file.relative));\n }\n\n /**\n * compute the description of the component from its source code and docs file.\n */\n async getDescription(component: Component): Promise<string> {\n const componentDoc = this.getDoc(component);\n const desc = componentDoc?.description;\n return desc || '';\n }\n\n async getTemplate(env: Environment): Promise<string | undefined> {\n if (env.getDocsTemplate && isFunction(env.getDocsTemplate)) {\n return env.getDocsTemplate();\n }\n return undefined;\n }\n\n getDocReader(extension: string) {\n return this.docReaderSlot.values().find((docReader) => docReader.isFormatSupported(extension));\n }\n\n /**\n * compute a doc for a component.\n */\n async computeDoc(component: Component) {\n const docFiles = this.getDocsFiles(component);\n if (docFiles.length) {\n // currently taking the the first docs file found with an abstract. (we support only one)\n const docFile = docFiles[0];\n\n try {\n const docReader = this.getDocReader(docFile.extname);\n if (!docReader) throw new FileExtensionNotSupported(docFile.relative, docFile.extname);\n const doc = await docReader.read(docFile.relative, docFile.contents, component);\n return doc;\n } catch (err: any) {\n // it's ok to fail here.\n this.logger.debug(`docs.main.runtime.computeDoc caught an error: ${err.message}`);\n return null;\n }\n }\n\n return null;\n }\n\n getDoc(component: IComponent) {\n const docData = component.get(DocsAspect.id)?.data?.doc;\n if (!docData) return null;\n return new Doc(docData.filePath, new DocPropList(docData.props));\n }\n\n getPatterns() {\n return this.patterns;\n }\n\n getComponentDevPatterns(component: Component) {\n const env = this.envs.calculateEnv(component, { skipWarnings: !!this.workspace?.inInstallContext }).env;\n const componentEnvDocsDevPatterns: string[] = env.getDocsDevPatterns ? env.getDocsDevPatterns(component) : [];\n const componentPatterns = componentEnvDocsDevPatterns.concat(this.getPatterns());\n return { name: 'docs', pattern: componentPatterns };\n }\n\n getDevPatternToRegister() {\n return this.getComponentDevPatterns.bind(this);\n }\n /**\n * register a new doc reader. this allows to support further\n * documentation file formats.\n */\n registerDocReader(docReader: DocReader) {\n this.docReaderSlot.register(docReader);\n return this;\n }\n\n static slots = [Slot.withType<DocProp>(), Slot.withType<DocReader>()];\n\n static runtime = MainRuntime;\n static dependencies = [\n PreviewAspect,\n GraphqlAspect,\n WorkspaceAspect,\n PkgAspect,\n CompilerAspect,\n LoggerAspect,\n DevFilesAspect,\n EnvsAspect,\n ScopeAspect,\n ];\n\n static defaultConfig = {\n patterns: ['**/*.docs.*'],\n };\n\n static async provider(\n [preview, graphql, workspace, pkg, compiler, loggerAspect, devFiles, envs, scope]: [\n PreviewMain,\n GraphqlMain,\n Workspace,\n PkgMain,\n CompilerMain,\n LoggerMain,\n DevFilesMain,\n EnvsMain,\n ScopeMain\n ],\n config: DocsConfig,\n [docPropSlot, docReaderSlot]: [DocPropSlot, DocReaderSlot]\n ) {\n const logger = loggerAspect.createLogger(DocsAspect.id);\n const docs = new DocsMain(\n config.patterns,\n preview,\n pkg,\n compiler,\n workspace,\n logger,\n devFiles,\n envs,\n docPropSlot,\n docReaderSlot\n );\n docs.registerDocReader(new DefaultDocReader(pkg, compiler, workspace));\n devFiles.registerDevPattern(docs.getDevPatternToRegister());\n\n const computeDocsOnLoad = async (component: Component, opts?: ComponentLoadOptions) => {\n if (opts?.loadDocs === false) return undefined;\n // const docFiles = await docs.computeDocs(component);\n const doc = await docs.computeDoc(component);\n\n return {\n doc: doc?.toObject(),\n // docFiles\n };\n };\n\n if (workspace) {\n workspace.registerOnComponentLoad(computeDocsOnLoad);\n }\n if (scope) {\n scope.registerOnCompAspectReCalc(computeDocsOnLoad);\n }\n\n graphql.register(docsSchema(docs));\n\n preview.registerDefinition(new DocsPreviewDefinition(docs));\n return docs;\n }\n}\n\nDocsAspect.addRuntime(DocsMain);\n"],"mappings":";;;;;;AAAA,SAAAA,SAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,QAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAE,KAAA;EAAA,MAAAF,IAAA,GAAAC,OAAA;EAA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U,CAAC9B,SAAS,CAAC;MAE5C,OAAO;QACLmC,GAAG,EAAEA,GAAG,EAAEsC,QAAQ,CAAC;QACnB;MACF,CAAC;IACH,CAAC;IAED,IAAInF,SAAS,EAAE;MACbA,SAAS,CAACoF,uBAAuB,CAACJ,iBAAiB,CAAC;IACtD;IACA,IAAIN,KAAK,EAAE;MACTA,KAAK,CAACW,0BAA0B,CAACL,iBAAiB,CAAC;IACrD;IAEAR,OAAO,CAACF,QAAQ,CAAC,IAAAgB,mBAAU,EAACT,IAAI,CAAC,CAAC;IAElChF,OAAO,CAAC0F,kBAAkB,CAAC,KAAIC,8BAAqB,EAACX,IAAI,CAAC,CAAC;IAC3D,OAAOA,IAAI;EACb;AACF;AAACY,OAAA,CAAA/F,QAAA,GAAAA,QAAA;AAAAnB,eAAA,CA1LYmB,QAAQ,WAiHJ,CAACgG,eAAI,CAACC,QAAQ,CAAU,CAAC,EAAED,eAAI,CAACC,QAAQ,CAAY,CAAC,CAAC;AAAApH,eAAA,CAjH1DmB,QAAQ,aAmHFkG,kBAAW;AAAArH,eAAA,CAnHjBmB,QAAQ,kBAoHG,CACpBmG,wBAAa,EACbC,wBAAa,EACbC,4BAAe,EACfC,gBAAS,EACTC,0BAAc,EACdC,sBAAY,EACZC,0BAAc,EACdC,kBAAU,EACVC,oBAAW,CACZ;AAAA9H,eAAA,CA9HUmB,QAAQ,mBAgII;EACrBE,QAAQ,EAAE,CAAC,aAAa;AAC1B,CAAC;AA0DHmB,kBAAU,CAACuF,UAAU,CAAC5G,QAAQ,CAAC","ignoreList":[]}
@@ -1,7 +1,7 @@
1
1
  import { Component, ComponentMap } from '@teambit/component';
2
2
  import type { Environment, ExecutionContext } from '@teambit/envs';
3
3
  import { PreviewDefinition } from '@teambit/preview';
4
- import { AbstractVinyl } from '@teambit/legacy/dist/consumer/component/sources';
4
+ import { AbstractVinyl } from '@teambit/component.sources';
5
5
  import { DocsMain } from './docs.main.runtime';
6
6
  export declare class DocsPreviewDefinition implements PreviewDefinition {
7
7
  /**
@@ -1 +1 @@
1
- {"version":3,"names":["DocsPreviewDefinition","constructor","docs","_defineProperty","renderTemplatePath","context","renderTemplatePathByEnv","env","getTemplate","getModuleMap","components","map","getDocsMap","exports"],"sources":["docs.preview-definition.ts"],"sourcesContent":["import { Component, ComponentMap } from '@teambit/component';\nimport type { Environment, ExecutionContext } from '@teambit/envs';\nimport { PreviewDefinition } from '@teambit/preview';\nimport { AbstractVinyl } from '@teambit/legacy/dist/consumer/component/sources';\n\nimport { DocsMain } from './docs.main.runtime';\n\nexport class DocsPreviewDefinition implements PreviewDefinition {\n readonly prefix = 'overview';\n readonly include = ['compositions'];\n readonly includePeers = true;\n\n constructor(\n /**\n * docs extension.\n */\n private docs: DocsMain\n ) {}\n\n /**\n * application root\n */\n async renderTemplatePath(context: ExecutionContext): Promise<string | undefined> {\n return this.renderTemplatePathByEnv(context.env);\n }\n\n async renderTemplatePathByEnv(env: Environment): Promise<string | undefined> {\n return this.docs.getTemplate(env);\n }\n\n /**\n * files to load.\n */\n async getModuleMap(components: Component[]): Promise<ComponentMap<AbstractVinyl[]>> {\n const map = this.docs.getDocsMap(components);\n return map;\n }\n}\n"],"mappings":";;;;;;;;;AAOO,MAAMA,qBAAqB,CAA8B;EAK9DC,WAAWA;EACT;AACJ;AACA;EACYC,IAAc,EACtB;IAAA,KADQA,IAAc,GAAdA,IAAc;IAAAC,eAAA,iBARN,UAAU;IAAAA,eAAA,kBACT,CAAC,cAAc,CAAC;IAAAA,eAAA,uBACX,IAAI;EAOzB;;EAEH;AACF;AACA;EACE,MAAMC,kBAAkBA,CAACC,OAAyB,EAA+B;IAC/E,OAAO,IAAI,CAACC,uBAAuB,CAACD,OAAO,CAACE,GAAG,CAAC;EAClD;EAEA,MAAMD,uBAAuBA,CAACC,GAAgB,EAA+B;IAC3E,OAAO,IAAI,CAACL,IAAI,CAACM,WAAW,CAACD,GAAG,CAAC;EACnC;;EAEA;AACF;AACA;EACE,MAAME,YAAYA,CAACC,UAAuB,EAA0C;IAClF,MAAMC,GAAG,GAAG,IAAI,CAACT,IAAI,CAACU,UAAU,CAACF,UAAU,CAAC;IAC5C,OAAOC,GAAG;EACZ;AACF;AAACE,OAAA,CAAAb,qBAAA,GAAAA,qBAAA","ignoreList":[]}
1
+ {"version":3,"names":["DocsPreviewDefinition","constructor","docs","_defineProperty","renderTemplatePath","context","renderTemplatePathByEnv","env","getTemplate","getModuleMap","components","map","getDocsMap","exports"],"sources":["docs.preview-definition.ts"],"sourcesContent":["import { Component, ComponentMap } from '@teambit/component';\nimport type { Environment, ExecutionContext } from '@teambit/envs';\nimport { PreviewDefinition } from '@teambit/preview';\nimport { AbstractVinyl } from '@teambit/component.sources';\n\nimport { DocsMain } from './docs.main.runtime';\n\nexport class DocsPreviewDefinition implements PreviewDefinition {\n readonly prefix = 'overview';\n readonly include = ['compositions'];\n readonly includePeers = true;\n\n constructor(\n /**\n * docs extension.\n */\n private docs: DocsMain\n ) {}\n\n /**\n * application root\n */\n async renderTemplatePath(context: ExecutionContext): Promise<string | undefined> {\n return this.renderTemplatePathByEnv(context.env);\n }\n\n async renderTemplatePathByEnv(env: Environment): Promise<string | undefined> {\n return this.docs.getTemplate(env);\n }\n\n /**\n * files to load.\n */\n async getModuleMap(components: Component[]): Promise<ComponentMap<AbstractVinyl[]>> {\n const map = this.docs.getDocsMap(components);\n return map;\n }\n}\n"],"mappings":";;;;;;;;;AAOO,MAAMA,qBAAqB,CAA8B;EAK9DC,WAAWA;EACT;AACJ;AACA;EACYC,IAAc,EACtB;IAAA,KADQA,IAAc,GAAdA,IAAc;IAAAC,eAAA,iBARN,UAAU;IAAAA,eAAA,kBACT,CAAC,cAAc,CAAC;IAAAA,eAAA,uBACX,IAAI;EAOzB;;EAEH;AACF;AACA;EACE,MAAMC,kBAAkBA,CAACC,OAAyB,EAA+B;IAC/E,OAAO,IAAI,CAACC,uBAAuB,CAACD,OAAO,CAACE,GAAG,CAAC;EAClD;EAEA,MAAMD,uBAAuBA,CAACC,GAAgB,EAA+B;IAC3E,OAAO,IAAI,CAACL,IAAI,CAACM,WAAW,CAACD,GAAG,CAAC;EACnC;;EAEA;AACF;AACA;EACE,MAAME,YAAYA,CAACC,UAAuB,EAA0C;IAClF,MAAMC,GAAG,GAAG,IAAI,CAACT,IAAI,CAACU,UAAU,CAACF,UAAU,CAAC;IAC5C,OAAOC,GAAG;EACZ;AACF;AAACE,OAAA,CAAAb,qBAAA,GAAAA,qBAAA","ignoreList":[]}
@@ -1,5 +1,5 @@
1
- import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.docs_docs@1.0.331/dist/docs.composition.js';
2
- import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.docs_docs@1.0.331/dist/docs.docs.mdx';
1
+ import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.docs_docs@1.0.333/dist/docs.composition.js';
2
+ import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.docs_docs@1.0.333/dist/docs.docs.mdx';
3
3
 
4
4
  export const compositions = [compositions_0];
5
5
  export const overview = [overview_0];
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@teambit/docs",
3
- "version": "1.0.331",
3
+ "version": "1.0.333",
4
4
  "homepage": "https://bit.cloud/teambit/docs/docs",
5
5
  "main": "dist/index.js",
6
6
  "componentId": {
7
7
  "scope": "teambit.docs",
8
8
  "name": "docs",
9
- "version": "1.0.331"
9
+ "version": "1.0.333"
10
10
  },
11
11
  "dependencies": {
12
12
  "graphql-tag": "2.12.1",
@@ -19,21 +19,22 @@
19
19
  "@teambit/base-react.themes.theme-switcher": "1.0.2",
20
20
  "@teambit/component.ui.component-meta": "0.0.358",
21
21
  "@teambit/base-ui.loaders.skeleton": "1.0.1",
22
- "@teambit/compiler": "1.0.331",
23
- "@teambit/component": "1.0.331",
24
- "@teambit/pkg": "1.0.331",
25
- "@teambit/workspace": "1.0.331",
26
- "@teambit/cli": "0.0.908",
27
- "@teambit/dev-files": "1.0.331",
28
- "@teambit/envs": "1.0.331",
29
- "@teambit/graphql": "1.0.331",
30
- "@teambit/logger": "0.0.1001",
31
- "@teambit/preview": "1.0.331",
32
- "@teambit/scope": "1.0.331",
33
- "@teambit/api-reference": "1.0.331",
34
- "@teambit/component-compare": "1.0.331",
35
- "@teambit/ui": "1.0.331",
36
- "@teambit/pubsub": "1.0.331",
22
+ "@teambit/compiler": "1.0.333",
23
+ "@teambit/component": "1.0.333",
24
+ "@teambit/pkg": "1.0.333",
25
+ "@teambit/workspace": "1.0.333",
26
+ "@teambit/cli": "0.0.910",
27
+ "@teambit/component.sources": "0.0.2",
28
+ "@teambit/dev-files": "1.0.333",
29
+ "@teambit/envs": "1.0.333",
30
+ "@teambit/graphql": "1.0.333",
31
+ "@teambit/logger": "0.0.1003",
32
+ "@teambit/preview": "1.0.333",
33
+ "@teambit/scope": "1.0.333",
34
+ "@teambit/api-reference": "1.0.333",
35
+ "@teambit/component-compare": "1.0.333",
36
+ "@teambit/ui": "1.0.333",
37
+ "@teambit/pubsub": "1.0.333",
37
38
  "@teambit/compositions.panels.composition-gallery": "0.0.211",
38
39
  "@teambit/preview.ui.component-preview": "1.0.12"
39
40
  },