@teambit/mdx 1.0.41 → 1.0.43

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. package/artifacts/env-template/public/{29.aabccd461805a58cd99a.js → 29.4f04dfbd91dbb8c799d1.js} +20 -20
  2. package/artifacts/env-template/public/{238.64be32cc6d4bc396b35e.js → 293.4bce474b96c9eb955917.js} +4 -4
  3. package/artifacts/env-template/public/assets-manifest.json +14 -14
  4. package/artifacts/env-template/public/{compositions.bb31bbb4b0be0e4c6673.js → compositions.4689e529c6a6b30e86ed.js} +1 -1
  5. package/artifacts/env-template/public/compositions.html +1 -1
  6. package/artifacts/env-template/public/{overview.6c899e88b7cdaeff733e.js → overview.16ca5b30cdc15c85d9af.js} +1 -1
  7. package/artifacts/env-template/public/overview.html +1 -1
  8. package/artifacts/env-template/public/peers.da933e8045576bb74818.js +1 -0
  9. package/artifacts/env-template/public/{preview-root.983463c786334e1fbaf1.js → preview-root.3b62d04b3a7f234bd8ca.js} +1 -1
  10. package/artifacts/env-template/public/static/css/{29.1c2448c7.css → 29.a178b2ff.css} +1 -1
  11. package/dist/babel/babel.config.js +1 -2
  12. package/dist/babel/babel.config.js.map +1 -1
  13. package/dist/index.js +1 -2
  14. package/dist/index.js.map +1 -1
  15. package/dist/mdx.aspect.js +2 -4
  16. package/dist/mdx.aspect.js.map +1 -1
  17. package/dist/mdx.env.js +1 -2
  18. package/dist/mdx.env.js.map +1 -1
  19. package/dist/mdx.main.runtime.d.ts +8 -3
  20. package/dist/mdx.main.runtime.js +12 -2
  21. package/dist/mdx.main.runtime.js.map +1 -1
  22. package/dist/mdx.templates.d.ts +2 -1
  23. package/dist/mdx.templates.js +18 -6
  24. package/dist/mdx.templates.js.map +1 -1
  25. package/dist/mdx.ui.runtime.js +1 -2
  26. package/dist/mdx.ui.runtime.js.map +1 -1
  27. package/dist/{preview-1698981534427.js → preview-1699369416537.js} +2 -2
  28. package/package.json +22 -18
  29. package/artifacts/env-template/public/peers.15b05c9b45fbcf4cde0c.js +0 -1
  30. package/dist/templates/mdx-component/files/component.d.ts +0 -5
  31. package/dist/templates/mdx-component/files/component.js +0 -29
  32. package/dist/templates/mdx-component/files/component.js.map +0 -1
  33. package/dist/templates/mdx-component/files/composition.d.ts +0 -5
  34. package/dist/templates/mdx-component/files/composition.js +0 -25
  35. package/dist/templates/mdx-component/files/composition.js.map +0 -1
  36. package/dist/templates/mdx-component/files/docs.d.ts +0 -5
  37. package/dist/templates/mdx-component/files/docs.js +0 -44
  38. package/dist/templates/mdx-component/files/docs.js.map +0 -1
  39. package/dist/templates/mdx-component/files/test.d.ts +0 -5
  40. package/dist/templates/mdx-component/files/test.js +0 -28
  41. package/dist/templates/mdx-component/files/test.js.map +0 -1
  42. package/dist/templates/mdx-component/index.d.ts +0 -3
  43. package/dist/templates/mdx-component/index.js +0 -80
  44. package/dist/templates/mdx-component/index.js.map +0 -1
  45. package/templates/mdx-component/files/component.ts +0 -20
  46. package/templates/mdx-component/files/composition.ts +0 -16
  47. package/templates/mdx-component/files/docs.ts +0 -35
  48. package/templates/mdx-component/files/test.ts +0 -19
  49. package/templates/mdx-component/index.ts +0 -51
  50. /package/{compositions-1698981534427.js → compositions-1699369416537.js} +0 -0
  51. /package/{overview-1698981534427.js → overview-1699369416537.js} +0 -0
@@ -39,6 +39,13 @@ function _docs() {
39
39
  };
40
40
  return data;
41
41
  }
42
+ function _componentId() {
43
+ const data = require("@teambit/component-id");
44
+ _componentId = function () {
45
+ return data;
46
+ };
47
+ return data;
48
+ }
42
49
  function _envs() {
43
50
  const data = require("@teambit/envs");
44
51
  _envs = function () {
@@ -134,7 +141,7 @@ class MDXMain {
134
141
  set mdxEnv(value) {
135
142
  this._mdxEnv = value;
136
143
  }
137
- static async provider([docs, depResolver, react, envs, multiCompiler, babel, compiler, generator], config) {
144
+ static async provider([docs, depResolver, react, envs, multiCompiler, babel, compiler, generator, loggerAspect, workerMain], config, slots, harmony) {
138
145
  const mdx = new MDXMain();
139
146
  const tsTransformer = tsconfig => {
140
147
  // set the shouldCopyNonSupportedFiles to false since we don't want ts to copy the .mdx file to the dist folder (it will conflict with the .mdx.js file created by the mdx compiler)
@@ -166,7 +173,10 @@ class MDXMain {
166
173
  envs.registerEnv(mdxEnv);
167
174
  depResolver.registerDetector(new (_mdx3().MDXDependencyDetector)(config.extensions));
168
175
  docs.registerDocReader(new (_mdx4().MDXDocReader)(config.extensions));
169
- if (generator) generator.registerComponentTemplate(_mdx5().componentTemplates);
176
+ if (generator) {
177
+ const envContext = new (_envs().EnvContext)(_componentId().ComponentID.fromString(_react().default.id), loggerAspect, workerMain, harmony);
178
+ generator.registerComponentTemplate((0, _mdx5().getTemplates)(envContext));
179
+ }
170
180
  mdx.mdxEnv = mdxEnv;
171
181
  return mdx;
172
182
  }
@@ -1 +1 @@
1
- {"version":3,"names":["_babel","data","require","_cli","_compiler","_dependencyResolver","_docs","_interopRequireDefault","_envs","_multiCompiler","_react","_generator","_mdx","_mdx2","_mdx3","_mdx4","_mdx5","_babel2","obj","__esModule","default","_defineProperty","key","value","_toPropertyKey","Object","defineProperty","enumerable","configurable","writable","arg","_toPrimitive","String","input","hint","prim","Symbol","toPrimitive","undefined","res","call","TypeError","Number","MDXMain","constructor","icon","createCompiler","opts","mdxCompiler","MDXCompiler","MDXAspect","id","mdxEnv","_mdxEnv","provider","docs","depResolver","react","envs","multiCompiler","babel","compiler","generator","config","mdx","tsTransformer","tsconfig","setCompileJs","setCompileJsx","setShouldCopyNonSupportedFiles","tsCompiler","env","getCompiler","babelTransformOptions","babelConfig","shouldCopyNonSupportedFiles","ignoredPatterns","getPatterns","compose","reactEnv","overrideCompiler","overrideDependencies","dependencies","overrideCompilerTasks","createTask","override","__getDescriptor","type","registerEnv","registerDetector","MDXDependencyDetector","extensions","registerDocReader","MDXDocReader","registerComponentTemplate","componentTemplates","exports","MainRuntime","DocsAspect","DependencyResolverAspect","ReactAspect","EnvsAspect","MultiCompilerAspect","BabelAspect","CompilerAspect","GeneratorAspect","addRuntime"],"sources":["mdx.main.runtime.ts"],"sourcesContent":["import { TypescriptConfigMutator } from '@teambit/typescript.modules.ts-config-mutator';\nimport { TsConfigTransformer } from '@teambit/typescript';\nimport { BabelAspect, BabelMain } from '@teambit/babel';\nimport { MainRuntime } from '@teambit/cli';\nimport { CompilerAspect, CompilerMain } from '@teambit/compiler';\nimport { DependencyResolverAspect, DependencyResolverMain } from '@teambit/dependency-resolver';\nimport DocsAspect, { DocsMain } from '@teambit/docs';\nimport { EnvsAspect, EnvsMain } from '@teambit/envs';\nimport MultiCompilerAspect, { MultiCompilerMain } from '@teambit/multi-compiler';\nimport ReactAspect, { ReactEnv, ReactMain } from '@teambit/react';\nimport { GeneratorAspect, GeneratorMain } from '@teambit/generator';\nimport { MDXAspect } from './mdx.aspect';\nimport { MDXCompiler, MDXCompilerOpts } from './mdx.compiler';\nimport { MDXDependencyDetector } from './mdx.detector';\nimport { MDXDocReader } from './mdx.doc-reader';\nimport { componentTemplates } from './mdx.templates';\nimport { babelConfig } from './babel/babel.config';\n\nexport type MDXConfig = {\n /**\n * list of file extensions to consider as MDX files.\n */\n extensions: string[];\n};\n\nexport class MDXMain {\n icon() {\n return 'https://static.bit.dev/extensions-icons/mdx-icon-small.svg';\n }\n\n /**\n * create an instance of the MDX compiler.\n */\n createCompiler(opts: MDXCompilerOpts = {}) {\n const mdxCompiler = new MDXCompiler(MDXAspect.id, opts);\n return mdxCompiler;\n }\n\n _mdxEnv: ReactEnv;\n get mdxEnv() {\n return this._mdxEnv;\n }\n private set mdxEnv(value: ReactEnv) {\n this._mdxEnv = value;\n }\n\n static runtime = MainRuntime;\n\n static dependencies = [\n DocsAspect,\n DependencyResolverAspect,\n ReactAspect,\n EnvsAspect,\n MultiCompilerAspect,\n BabelAspect,\n CompilerAspect,\n GeneratorAspect,\n ];\n\n static defaultConfig = {\n extensions: ['.md', '.mdx'],\n };\n\n static async provider(\n [docs, depResolver, react, envs, multiCompiler, babel, compiler, generator]: [\n DocsMain,\n DependencyResolverMain,\n ReactMain,\n EnvsMain,\n MultiCompilerMain,\n BabelMain,\n CompilerMain,\n GeneratorMain\n ],\n config: MDXConfig\n ) {\n const mdx = new MDXMain();\n const tsTransformer: TsConfigTransformer = (tsconfig: TypescriptConfigMutator) => {\n // set the shouldCopyNonSupportedFiles to false since we don't want ts to copy the .mdx file to the dist folder (it will conflict with the .mdx.js file created by the mdx compiler)\n tsconfig.setCompileJs(false).setCompileJsx(false).setShouldCopyNonSupportedFiles(false);\n return tsconfig;\n };\n const tsCompiler = react.env.getCompiler([tsTransformer]);\n\n const mdxCompiler = multiCompiler.createCompiler(\n [\n // set the shouldCopyNonSupportedFiles to false since we don't want babel to copy the .mdx file to the dist folder (it will conflict with the .mdx.js file created by the mdx compiler)\n babel.createCompiler({ babelTransformOptions: babelConfig, shouldCopyNonSupportedFiles: false }),\n mdx.createCompiler({ ignoredPatterns: docs.getPatterns(), babelTransformOptions: babelConfig }),\n tsCompiler,\n ],\n {}\n );\n const mdxEnv = envs.compose(react.reactEnv, [\n react.overrideCompiler(mdxCompiler),\n react.overrideDependencies({\n dependencies: {\n '@teambit/mdx.ui.mdx-scope-context': '1.0.0',\n '@mdx-js/react': '1.6.22',\n },\n }),\n react.overrideCompilerTasks([compiler.createTask('MDXCompiler', mdxCompiler)]),\n envs.override({\n __getDescriptor: async () => {\n return {\n type: 'mdx',\n };\n },\n }),\n ]);\n envs.registerEnv(mdxEnv);\n depResolver.registerDetector(new MDXDependencyDetector(config.extensions));\n docs.registerDocReader(new MDXDocReader(config.extensions));\n if (generator) generator.registerComponentTemplate(componentTemplates);\n\n mdx.mdxEnv = mdxEnv as ReactEnv;\n return mdx;\n }\n}\n\nMDXAspect.addRuntime(MDXMain);\n"],"mappings":";;;;;;AAEA,SAAAA,OAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,MAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IA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W;AAAA5E,eAAA,CArBjBsB,OAAO,kBAuBI,CACpBuD,eAAU,EACVC,8CAAwB,EACxBC,gBAAW,EACXC,kBAAU,EACVC,wBAAmB,EACnBC,oBAAW,EACXC,0BAAc,EACdC,4BAAe,CAChB;AAAApF,eAAA,CAhCUsB,OAAO,mBAkCK;EACrBgD,UAAU,EAAE,CAAC,KAAK,EAAE,MAAM;AAC5B,CAAC;AA2DHzC,gBAAS,CAACwD,UAAU,CAAC/D,OAAO,CAAC"}
1
+ {"version":3,"names":["_babel","data","require","_cli","_compiler","_dependencyResolver","_docs","_interopRequireDefault","_componentId","_envs","_multiCompiler","_react","_generator","_mdx","_mdx2","_mdx3","_mdx4","_mdx5","_babel2","obj","__esModule","default","_defineProperty","key","value","_toPropertyKey","Object","defineProperty","enumerable","configurable","writable","arg","_toPrimitive","String","input","hint","prim","Symbol","toPrimitive","undefined","res","call","TypeError","Number","MDXMain","constructor","icon","createCompiler","opts","mdxCompiler","MDXCompiler","MDXAspect","id","mdxEnv","_mdxEnv","provider","docs","depResolver","react","envs","multiCompiler","babel","compiler","generator","loggerAspect","workerMain","config","slots","harmony","mdx","tsTransformer","tsconfig","setCompileJs","setCompileJsx","setShouldCopyNonSupportedFiles","tsCompiler","env","getCompiler","babelTransformOptions","babelConfig","shouldCopyNonSupportedFiles","ignoredPatterns","getPatterns","compose","reactEnv","overrideCompiler","overrideDependencies","dependencies","overrideCompilerTasks","createTask","override","__getDescriptor","type","registerEnv","registerDetector","MDXDependencyDetector","extensions","registerDocReader","MDXDocReader","envContext","EnvContext","ComponentID","fromString","ReactAspect","registerComponentTemplate","getTemplates","exports","MainRuntime","DocsAspect","DependencyResolverAspect","EnvsAspect","MultiCompilerAspect","BabelAspect","CompilerAspect","GeneratorAspect","addRuntime"],"sources":["mdx.main.runtime.ts"],"sourcesContent":["import { Harmony } from '@teambit/harmony';\nimport { TypescriptConfigMutator } from '@teambit/typescript.modules.ts-config-mutator';\nimport { TsConfigTransformer } from '@teambit/typescript';\nimport { BabelAspect, BabelMain } from '@teambit/babel';\nimport { MainRuntime } from '@teambit/cli';\nimport { CompilerAspect, CompilerMain } from '@teambit/compiler';\nimport { DependencyResolverAspect, DependencyResolverMain } from '@teambit/dependency-resolver';\nimport DocsAspect, { DocsMain } from '@teambit/docs';\nimport { ComponentID } from '@teambit/component-id';\nimport { LoggerMain } from '@teambit/logger';\nimport { WorkerMain } from '@teambit/worker';\nimport { EnvContext, EnvsAspect, EnvsMain } from '@teambit/envs';\nimport MultiCompilerAspect, { MultiCompilerMain } from '@teambit/multi-compiler';\nimport ReactAspect, { ReactEnv, ReactMain } from '@teambit/react';\nimport { GeneratorAspect, GeneratorMain } from '@teambit/generator';\nimport { MDXAspect } from './mdx.aspect';\nimport { MDXCompiler, MDXCompilerOpts } from './mdx.compiler';\nimport { MDXDependencyDetector } from './mdx.detector';\nimport { MDXDocReader } from './mdx.doc-reader';\nimport { getTemplates } from './mdx.templates';\nimport { babelConfig } from './babel/babel.config';\n\nexport type MDXConfig = {\n /**\n * list of file extensions to consider as MDX files.\n */\n extensions: string[];\n};\n\nexport class MDXMain {\n icon() {\n return 'https://static.bit.dev/extensions-icons/mdx-icon-small.svg';\n }\n\n /**\n * create an instance of the MDX compiler.\n */\n createCompiler(opts: MDXCompilerOpts = {}) {\n const mdxCompiler = new MDXCompiler(MDXAspect.id, opts);\n return mdxCompiler;\n }\n\n _mdxEnv: ReactEnv;\n get mdxEnv() {\n return this._mdxEnv;\n }\n private set mdxEnv(value: ReactEnv) {\n this._mdxEnv = value;\n }\n\n static runtime = MainRuntime;\n\n static dependencies = [\n DocsAspect,\n DependencyResolverAspect,\n ReactAspect,\n EnvsAspect,\n MultiCompilerAspect,\n BabelAspect,\n CompilerAspect,\n GeneratorAspect,\n ];\n\n static defaultConfig = {\n extensions: ['.md', '.mdx'],\n };\n\n static async provider(\n [docs, depResolver, react, envs, multiCompiler, babel, compiler, generator, loggerAspect, workerMain]: [\n DocsMain,\n DependencyResolverMain,\n ReactMain,\n EnvsMain,\n MultiCompilerMain,\n BabelMain,\n CompilerMain,\n GeneratorMain,\n LoggerMain,\n WorkerMain\n ],\n config: MDXConfig,\n slots,\n harmony: Harmony\n ) {\n const mdx = new MDXMain();\n const tsTransformer: TsConfigTransformer = (tsconfig: TypescriptConfigMutator) => {\n // set the shouldCopyNonSupportedFiles to false since we don't want ts to copy the .mdx file to the dist folder (it will conflict with the .mdx.js file created by the mdx compiler)\n tsconfig.setCompileJs(false).setCompileJsx(false).setShouldCopyNonSupportedFiles(false);\n return tsconfig;\n };\n const tsCompiler = react.env.getCompiler([tsTransformer]);\n\n const mdxCompiler = multiCompiler.createCompiler(\n [\n // set the shouldCopyNonSupportedFiles to false since we don't want babel to copy the .mdx file to the dist folder (it will conflict with the .mdx.js file created by the mdx compiler)\n babel.createCompiler({ babelTransformOptions: babelConfig, shouldCopyNonSupportedFiles: false }),\n mdx.createCompiler({ ignoredPatterns: docs.getPatterns(), babelTransformOptions: babelConfig }),\n tsCompiler,\n ],\n {}\n );\n const mdxEnv = envs.compose(react.reactEnv, [\n react.overrideCompiler(mdxCompiler),\n react.overrideDependencies({\n dependencies: {\n '@teambit/mdx.ui.mdx-scope-context': '1.0.0',\n '@mdx-js/react': '1.6.22',\n },\n }),\n react.overrideCompilerTasks([compiler.createTask('MDXCompiler', mdxCompiler)]),\n envs.override({\n __getDescriptor: async () => {\n return {\n type: 'mdx',\n };\n },\n }),\n ]);\n envs.registerEnv(mdxEnv);\n depResolver.registerDetector(new MDXDependencyDetector(config.extensions));\n docs.registerDocReader(new MDXDocReader(config.extensions));\n if (generator) {\n const envContext = new EnvContext(ComponentID.fromString(ReactAspect.id), loggerAspect, workerMain, harmony);\n generator.registerComponentTemplate(getTemplates(envContext));\n }\n\n mdx.mdxEnv = mdxEnv as ReactEnv;\n return mdx;\n }\n}\n\nMDXAspect.addRuntime(MDXMain);\n"],"mappings":";;;;;;AAGA,SAAAA,OAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAA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M,CAAC8B,UAAU,CAAC,CAAC;IAC3D,IAAIjC,SAAS,EAAE;MACb,MAAMoC,UAAU,GAAG,KAAIC,kBAAU,EAACC,0BAAW,CAACC,UAAU,CAACC,gBAAW,CAACnD,EAAE,CAAC,EAAEY,YAAY,EAAEC,UAAU,EAAEG,OAAO,CAAC;MAC5GL,SAAS,CAACyC,yBAAyB,CAAC,IAAAC,oBAAY,EAACN,UAAU,CAAC,CAAC;IAC/D;IAEA9B,GAAG,CAAChB,MAAM,GAAGA,MAAkB;IAC/B,OAAOgB,GAAG;EACZ;AACF;AAACqC,OAAA,CAAA9D,OAAA,GAAAA,OAAA;AAAAtB,eAAA,CApGYsB,OAAO,aAqBD+D,kBAAW;AAAArF,eAAA,CArBjBsB,OAAO,kBAuBI,CACpBgE,eAAU,EACVC,8CAAwB,EACxBN,gBAAW,EACXO,kBAAU,EACVC,wBAAmB,EACnBC,oBAAW,EACXC,0BAAc,EACdC,4BAAe,CAChB;AAAA5F,eAAA,CAhCUsB,OAAO,mBAkCK;EACrBoD,UAAU,EAAE,CAAC,KAAK,EAAE,MAAM;AAC5B,CAAC;AAkEH7C,gBAAS,CAACgE,UAAU,CAACvE,OAAO,CAAC"}
@@ -1,2 +1,3 @@
1
+ import { EnvContext } from '@teambit/envs';
1
2
  import { ComponentTemplate } from '@teambit/generator';
2
- export declare const componentTemplates: ComponentTemplate[];
3
+ export declare function getTemplates(envContext: EnvContext): ComponentTemplate[];
@@ -3,15 +3,27 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.componentTemplates = void 0;
7
- function _mdxComponent() {
8
- const data = require("./templates/mdx-component");
9
- _mdxComponent = function () {
6
+ exports.getTemplates = getTemplates;
7
+ function _mdxGenerator() {
8
+ const data = require("@teambit/mdx.generator.mdx-templates");
9
+ _mdxGenerator = function () {
10
10
  return data;
11
11
  };
12
12
  return data;
13
13
  }
14
- const componentTemplates = [_mdxComponent().MDXComponent, _mdxComponent().deprecatedMDXComponent];
15
- exports.componentTemplates = componentTemplates;
14
+ function _generator() {
15
+ const data = require("@teambit/generator");
16
+ _generator = function () {
17
+ return data;
18
+ };
19
+ return data;
20
+ }
21
+ const templateListHandler = _generator().TemplateList.from([_mdxGenerator().MdxComponentTemplate.from({
22
+ env: 'teambit.mdx/mdx-env'
23
+ }), _mdxGenerator().MdxEnvTemplate.from({})]);
24
+ function getTemplates(envContext) {
25
+ const templateList = templateListHandler(envContext);
26
+ return templateList.compute();
27
+ }
16
28
 
17
29
  //# sourceMappingURL=mdx.templates.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_mdxComponent","data","require","componentTemplates","MDXComponent","deprecatedMDXComponent","exports"],"sources":["mdx.templates.ts"],"sourcesContent":["import { ComponentTemplate } from '@teambit/generator';\nimport { MDXComponent, deprecatedMDXComponent } from './templates/mdx-component';\n\nexport const componentTemplates: ComponentTemplate[] = [MDXComponent, deprecatedMDXComponent];\n"],"mappings":";;;;;;AACA,SAAAA,cAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,aAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEO,MAAME,kBAAuC,GAAG,CAACC,4BAAY,EAAEC,sCAAsB,CAAC;AAACC,OAAA,CAAAH,kBAAA,GAAAA,kBAAA"}
1
+ {"version":3,"names":["_mdxGenerator","data","require","_generator","templateListHandler","TemplateList","from","MdxComponentTemplate","env","MdxEnvTemplate","getTemplates","envContext","templateList","compute"],"sources":["mdx.templates.ts"],"sourcesContent":["import { MdxComponentTemplate, MdxEnvTemplate } from '@teambit/mdx.generator.mdx-templates';\nimport { EnvContext } from '@teambit/envs';\nimport { ComponentTemplate, TemplateList } from '@teambit/generator';\n\nconst templateListHandler = TemplateList.from([\n MdxComponentTemplate.from({ env: 'teambit.mdx/mdx-env' }),\n MdxEnvTemplate.from({}),\n]);\n\nexport function getTemplates(envContext: EnvContext): ComponentTemplate[] {\n const templateList = templateListHandler(envContext);\n return templateList.compute();\n}\n"],"mappings":";;;;;;AAAA,SAAAA,cAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,aAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAE,WAAA;EAAA,MAAAF,IAAA,GAAAC,OAAA;EAAAC,UAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,MAAMG,mBAAmB,GAAGC,yBAAY,CAACC,IAAI,CAAC,CAC5CC,oCAAoB,CAACD,IAAI,CAAC;EAAEE,GAAG,EAAE;AAAsB,CAAC,CAAC,EACzDC,8BAAc,CAACH,IAAI,CAAC,CAAC,CAAC,CAAC,CACxB,CAAC;AAEK,SAASI,YAAYA,CAACC,UAAsB,EAAuB;EACxE,MAAMC,YAAY,GAAGR,mBAAmB,CAACO,UAAU,CAAC;EACpD,OAAOC,YAAY,CAACC,OAAO,CAAC,CAAC;AAC/B"}
@@ -79,7 +79,6 @@ _defineProperty(MDXEnvUI, "runtime", _ui().UIRuntime);
79
79
  _defineProperty(MDXEnvUI, "slots", []);
80
80
  _defineProperty(MDXEnvUI, "dependencies", [_compositions().CompositionsAspect, _tester().TesterAspect]);
81
81
  _mdx().MDXAspect.addRuntime(MDXEnvUI);
82
- var _default = MDXEnvUI;
83
- exports.default = _default;
82
+ var _default = exports.default = MDXEnvUI;
84
83
 
85
84
  //# sourceMappingURL=mdx.ui.runtime.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_react","data","_interopRequireDefault","require","_compositions","_ui","_tester","_designUi","_mdx","obj","__esModule","default","_defineProperty","key","value","_toPropertyKey","Object","defineProperty","enumerable","configurable","writable","arg","_toPrimitive","String","input","hint","prim","Symbol","toPrimitive","undefined","res","call","TypeError","Number","MDXEnvUI","provider","compositionsUI","testerUi","mdxEnvUI","registerEmptyState","createElement","EmptyBox","title","linkText","link","exports","UIRuntime","CompositionsAspect","TesterAspect","MDXAspect","addRuntime","_default"],"sources":["mdx.ui.runtime.tsx"],"sourcesContent":["import React from 'react';\nimport { CompositionsAspect, CompositionsUI } from '@teambit/compositions';\nimport { UIRuntime } from '@teambit/ui';\nimport { TesterAspect, TesterUI } from '@teambit/tester';\nimport { EmptyBox } from '@teambit/design.ui.empty-box';\nimport { MDXAspect } from './mdx.aspect';\n\nexport class MDXEnvUI {\n static runtime = UIRuntime;\n static slots = [];\n static dependencies = [CompositionsAspect, TesterAspect];\n\n static async provider([compositionsUI, testerUi]: [CompositionsUI, TesterUI]) {\n const mdxEnvUI = new MDXEnvUI();\n\n // TODO: get the docs domain from the community aspect and pass it here as a prop\n testerUi.registerEmptyState(() => {\n return (\n <EmptyBox\n title=\"This component doesn’t have any tests.\"\n linkText=\"Learn how to add tests to your MDX components\"\n link={`https://bit.dev/docs/dev-services-overview/tester/tester-overview`}\n />\n );\n });\n\n // TODO: get the docs domain from the community aspect and pass it here as a prop\n compositionsUI.registerEmptyState(() => {\n return (\n <EmptyBox\n title=\"This component doesn’t have any compositions.\"\n linkText=\"Learn how to add compositions to your MDX components\"\n link={`https://bit.dev/docs/dev-services-overview/compositions/compositions-overview`}\n />\n );\n });\n\n return mdxEnvUI;\n }\n}\n\nMDXAspect.addRuntime(MDXEnvUI);\n\nexport default MDXEnvUI;\n"],"mappings":";;;;;;AAAA,SAAAA,OAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,MAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,cAAA;EAAA,MAAAH,IAAA,GAAAE,OAAA;EAAAC,aAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAI,IAAA;EAAA,MAAAJ,IAAA,GAAAE,OAAA;EAAAE,GAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAA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AT,KAAA;AAElC,MAAMU,QAAQ,CAAC;EAKpB,aAAaC,QAAQA,CAAC,CAACC,cAAc,EAAEC,QAAQ,CAA6B,EAAE;IAC5E,MAAMC,QAAQ,GAAG,IAAIJ,QAAQ,CAAC,CAAC;;IAE/B;IACAG,QAAQ,CAACE,kBAAkB,CAAC,MAAM;MAChC,oBACEvC,MAAA,GAAAW,OAAA,CAAA6B,aAAA,CAACjC,SAAA,GAAAkC,QAAQ;QACPC,KAAK,EAAC,6CAAwC;QAC9CC,QAAQ,EAAC,+CAA+C;QACxDC,IAAI,EAAG;MAAmE,CAC3E,CAAC;IAEN,CAAC,CAAC;;IAEF;IACAR,cAAc,CAACG,kBAAkB,CAAC,MAAM;MACtC,oBACEvC,MAAA,GAAAW,OAAA,CAAA6B,aAAA,CAACjC,SAAA,GAAAkC,QAAQ;QACPC,KAAK,EAAC,oDAA+C;QACrDC,QAAQ,EAAC,sDAAsD;QAC/DC,IAAI,EAAG;MAA+E,CACvF,CAAC;IAEN,CAAC,CAAC;IAEF,OAAON,QAAQ;EACjB;AACF;AAACO,OAAA,CAAAX,QAAA,GAAAA,QAAA;AAAAtB,eAAA,CAhCYsB,QAAQ,aACFY,eAAS;AAAAlC,eAAA,CADfsB,QAAQ,WAEJ,EAAE;AAAAtB,eAAA,CAFNsB,QAAQ,kBAGG,CAACa,kCAAkB,EAAEC,sBAAY,CAAC;AA+B1DC,gBAAS,CAACC,UAAU,CAAChB,QAAQ,CAAC;AAAC,IAAAiB,QAAA,GAEhBjB,QAAQ;AAAAW,OAAA,CAAAlC,OAAA,GAAAwC,QAAA"}
1
+ {"version":3,"names":["_react","data","_interopRequireDefault","require","_compositions","_ui","_tester","_designUi","_mdx","obj","__esModule","default","_defineProperty","key","value","_toPropertyKey","Object","defineProperty","enumerable","configurable","writable","arg","_toPrimitive","String","input","hint","prim","Symbol","toPrimitive","undefined","res","call","TypeError","Number","MDXEnvUI","provider","compositionsUI","testerUi","mdxEnvUI","registerEmptyState","createElement","EmptyBox","title","linkText","link","exports","UIRuntime","CompositionsAspect","TesterAspect","MDXAspect","addRuntime","_default"],"sources":["mdx.ui.runtime.tsx"],"sourcesContent":["import React from 'react';\nimport { CompositionsAspect, CompositionsUI } from '@teambit/compositions';\nimport { UIRuntime } from '@teambit/ui';\nimport { TesterAspect, TesterUI } from '@teambit/tester';\nimport { EmptyBox } from '@teambit/design.ui.empty-box';\nimport { MDXAspect } from './mdx.aspect';\n\nexport class MDXEnvUI {\n static runtime = UIRuntime;\n static slots = [];\n static dependencies = [CompositionsAspect, TesterAspect];\n\n static async provider([compositionsUI, testerUi]: [CompositionsUI, TesterUI]) {\n const mdxEnvUI = new MDXEnvUI();\n\n // TODO: get the docs domain from the community aspect and pass it here as a prop\n testerUi.registerEmptyState(() => {\n return (\n <EmptyBox\n title=\"This component doesn’t have any tests.\"\n linkText=\"Learn how to add tests to your MDX components\"\n link={`https://bit.dev/docs/dev-services-overview/tester/tester-overview`}\n />\n );\n });\n\n // TODO: get the docs domain from the community aspect and pass it here as a prop\n compositionsUI.registerEmptyState(() => {\n return (\n <EmptyBox\n title=\"This component doesn’t have any compositions.\"\n linkText=\"Learn how to add compositions to your MDX components\"\n link={`https://bit.dev/docs/dev-services-overview/compositions/compositions-overview`}\n />\n );\n });\n\n return mdxEnvUI;\n }\n}\n\nMDXAspect.addRuntime(MDXEnvUI);\n\nexport default MDXEnvUI;\n"],"mappings":";;;;;;AAAA,SAAAA,OAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,MAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,cAAA;EAAA,MAAAH,IAAA,GAAAE,OAAA;EAAAC,aAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAI,IAAA;EAAA,MAAAJ,IAAA,GAAAE,OAAA;EAAAE,GAAA,YAAAA,CAAA;IAA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P,IAAA,gBAAAF,MAAA,GAAAU,MAAA,EAAAT,KAAA;AAElC,MAAMU,QAAQ,CAAC;EAKpB,aAAaC,QAAQA,CAAC,CAACC,cAAc,EAAEC,QAAQ,CAA6B,EAAE;IAC5E,MAAMC,QAAQ,GAAG,IAAIJ,QAAQ,CAAC,CAAC;;IAE/B;IACAG,QAAQ,CAACE,kBAAkB,CAAC,MAAM;MAChC,oBACEvC,MAAA,GAAAW,OAAA,CAAA6B,aAAA,CAACjC,SAAA,GAAAkC,QAAQ;QACPC,KAAK,EAAC,6CAAwC;QAC9CC,QAAQ,EAAC,+CAA+C;QACxDC,IAAI,EAAG;MAAmE,CAC3E,CAAC;IAEN,CAAC,CAAC;;IAEF;IACAR,cAAc,CAACG,kBAAkB,CAAC,MAAM;MACtC,oBACEvC,MAAA,GAAAW,OAAA,CAAA6B,aAAA,CAACjC,SAAA,GAAAkC,QAAQ;QACPC,KAAK,EAAC,oDAA+C;QACrDC,QAAQ,EAAC,sDAAsD;QAC/DC,IAAI,EAAG;MAA+E,CACvF,CAAC;IAEN,CAAC,CAAC;IAEF,OAAON,QAAQ;EACjB;AACF;AAACO,OAAA,CAAAX,QAAA,GAAAA,QAAA;AAAAtB,eAAA,CAhCYsB,QAAQ,aACFY,eAAS;AAAAlC,eAAA,CADfsB,QAAQ,WAEJ,EAAE;AAAAtB,eAAA,CAFNsB,QAAQ,kBAGG,CAACa,kCAAkB,EAAEC,sBAAY,CAAC;AA+B1DC,gBAAS,CAACC,UAAU,CAAChB,QAAQ,CAAC;AAAC,IAAAiB,QAAA,GAAAN,OAAA,CAAAlC,OAAA,GAEhBuB,QAAQ"}
@@ -1,5 +1,5 @@
1
- import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.mdx_mdx@1.0.41/dist/mdx.composition.js';
2
- import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.mdx_mdx@1.0.41/dist/mdx.docs.mdx';
1
+ import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.mdx_mdx@1.0.43/dist/mdx.composition.js';
2
+ import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.mdx_mdx@1.0.43/dist/mdx.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/mdx",
3
- "version": "1.0.41",
3
+ "version": "1.0.43",
4
4
  "homepage": "https://bit.cloud/teambit/mdx/mdx",
5
5
  "main": "dist/index.js",
6
6
  "componentId": {
7
7
  "scope": "teambit.mdx",
8
8
  "name": "mdx",
9
- "version": "1.0.41"
9
+ "version": "1.0.43"
10
10
  },
11
11
  "dependencies": {
12
12
  "@babel/core": "7.19.6",
@@ -14,28 +14,32 @@
14
14
  "minimatch": "3.0.5",
15
15
  "@babel/helper-plugin-test-runner": "7.16.7",
16
16
  "core-js": "^3.0.0",
17
- "@babel/runtime": "7.20.0",
17
+ "@babel/runtime": "7.23.2",
18
18
  "react": "^16.8.0 || ^17.0.0",
19
19
  "react-dom": "^16.8.0 || ^17.0.0",
20
20
  "@teambit/harmony": "0.4.6",
21
+ "@teambit/component-id": "1.1.1",
22
+ "@teambit/mdx.generator.mdx-templates": "1.0.9",
21
23
  "@teambit/design.ui.empty-box": "0.0.363",
22
- "@teambit/builder": "1.0.41",
24
+ "@teambit/builder": "1.0.43",
23
25
  "@teambit/compilation.modules.babel-compiler": "0.0.136",
24
- "@teambit/compiler": "1.0.41",
26
+ "@teambit/compiler": "1.0.43",
25
27
  "@teambit/mdx.modules.mdx-compiler": "0.0.503",
26
- "@teambit/dependency-resolver": "1.0.41",
27
- "@teambit/docs": "1.0.41",
28
- "@teambit/envs": "1.0.41",
29
- "@teambit/babel": "1.0.41",
30
- "@teambit/cli": "0.0.806",
31
- "@teambit/generator": "1.0.42",
32
- "@teambit/multi-compiler": "1.0.41",
33
- "@teambit/react": "1.0.41",
28
+ "@teambit/dependency-resolver": "1.0.43",
29
+ "@teambit/docs": "1.0.43",
30
+ "@teambit/envs": "1.0.43",
31
+ "@teambit/babel": "1.0.43",
32
+ "@teambit/cli": "0.0.808",
33
+ "@teambit/generator": "1.0.44",
34
+ "@teambit/logger": "0.0.901",
35
+ "@teambit/multi-compiler": "1.0.43",
36
+ "@teambit/react": "1.0.43",
34
37
  "@teambit/typescript.modules.ts-config-mutator": "0.0.79",
35
- "@teambit/typescript": "1.0.41",
36
- "@teambit/compositions": "1.0.41",
37
- "@teambit/tester": "1.0.41",
38
- "@teambit/ui": "1.0.41"
38
+ "@teambit/typescript": "1.0.43",
39
+ "@teambit/worker": "0.0.1112",
40
+ "@teambit/compositions": "1.0.43",
41
+ "@teambit/tester": "1.0.43",
42
+ "@teambit/ui": "1.0.43"
39
43
  },
40
44
  "devDependencies": {
41
45
  "@types/fs-extra": "9.0.7",
@@ -47,7 +51,7 @@
47
51
  "@types/react-dom": "^17.0.5",
48
52
  "@types/jest": "^26.0.0",
49
53
  "@types/testing-library__jest-dom": "5.9.5",
50
- "@teambit/mdx.aspect-docs.mdx": "0.0.163"
54
+ "@teambit/mdx.aspect-docs.mdx": "0.0.165"
51
55
  },
52
56
  "peerDependencies": {},
53
57
  "license": "Apache-2.0",
@@ -1 +0,0 @@
1
- (()=>{"use strict";var __webpack_modules__={95117:(__unused_webpack_module,__unused_webpack___webpack_exports__,__webpack_require__2)=>{var react__WEBPACK_IMPORTED_MODULE_2___namespace_cache,react_dom__WEBPACK_IMPORTED_MODULE_3___namespace_cache,_teambit_mdx_ui_mdx_scope_context__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__2(38168),_mdx_js_react__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__2(3905),react__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__2(67294),react_dom__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__2(73935);const globalObj=window;guard("TeambitMdxUiMdxScopeContext",_teambit_mdx_ui_mdx_scope_context__WEBPACK_IMPORTED_MODULE_0__),guard("MdxJsReact",_mdx_js_react__WEBPACK_IMPORTED_MODULE_1__),guard("React",react__WEBPACK_IMPORTED_MODULE_2___namespace_cache||(react__WEBPACK_IMPORTED_MODULE_2___namespace_cache=__webpack_require__2.t(react__WEBPACK_IMPORTED_MODULE_2__,2))),guard("ReactDom",react_dom__WEBPACK_IMPORTED_MODULE_3___namespace_cache||(react_dom__WEBPACK_IMPORTED_MODULE_3___namespace_cache=__webpack_require__2.t(react_dom__WEBPACK_IMPORTED_MODULE_3__,2))),globalObj.TeambitMdxUiMdxScopeContext=_teambit_mdx_ui_mdx_scope_context__WEBPACK_IMPORTED_MODULE_0__,globalObj.MdxJsReact=_mdx_js_react__WEBPACK_IMPORTED_MODULE_1__,globalObj.React=react__WEBPACK_IMPORTED_MODULE_2___namespace_cache||(react__WEBPACK_IMPORTED_MODULE_2___namespace_cache=__webpack_require__2.t(react__WEBPACK_IMPORTED_MODULE_2__,2)),globalObj.ReactDom=react_dom__WEBPACK_IMPORTED_MODULE_3___namespace_cache||(react_dom__WEBPACK_IMPORTED_MODULE_3___namespace_cache=__webpack_require__2.t(react_dom__WEBPACK_IMPORTED_MODULE_3__,2));function guard(property,expected){var existing=globalObj[property];if(existing===expected&&expected!==void 0)console.warn('[expose-peers] "'+property+'" already exists in global scope, but with correct value');else if(existing!==void 0)throw new Error('[expose-peers] "'+property+'" already exists in the global scope, cannot overwrite')}}},__webpack_module_cache__={};function __webpack_require__(moduleId){var cachedModule=__webpack_module_cache__[moduleId];if(cachedModule!==void 0)return cachedModule.exports;var module=__webpack_module_cache__[moduleId]={id:moduleId,loaded:!1,exports:{}};return __webpack_modules__[moduleId].call(module.exports,module,module.exports,__webpack_require__),module.loaded=!0,module.exports}__webpack_require__.m=__webpack_modules__,(()=>{var deferred=[];__webpack_require__.O=(result,chunkIds,fn,priority)=>{if(chunkIds){priority=priority||0;for(var i=deferred.length;i>0&&deferred[i-1][2]>priority;i--)deferred[i]=deferred[i-1];deferred[i]=[chunkIds,fn,priority];return}for(var notFulfilled=1/0,i=0;i<deferred.length;i++){for(var[chunkIds,fn,priority]=deferred[i],fulfilled=!0,j=0;j<chunkIds.length;j++)(priority&!1||notFulfilled>=priority)&&Object.keys(__webpack_require__.O).every(key=>__webpack_require__.O[key](chunkIds[j]))?chunkIds.splice(j--,1):(fulfilled=!1,priority<notFulfilled&&(notFulfilled=priority));if(fulfilled){deferred.splice(i--,1);var r=fn();r!==void 0&&(result=r)}}return result}})(),__webpack_require__.n=module=>{var getter=module&&module.__esModule?()=>module.default:()=>module;return __webpack_require__.d(getter,{a:getter}),getter},(()=>{var getProto=Object.getPrototypeOf?obj=>Object.getPrototypeOf(obj):obj=>obj.__proto__,leafPrototypes;__webpack_require__.t=function(value,mode){if(mode&1&&(value=this(value)),mode&8||typeof value=="object"&&value&&(mode&4&&value.__esModule||mode&16&&typeof value.then=="function"))return value;var ns=Object.create(null);__webpack_require__.r(ns);var def={};leafPrototypes=leafPrototypes||[null,getProto({}),getProto([]),getProto(getProto)];for(var current=mode&2&&value;typeof current=="object"&&!~leafPrototypes.indexOf(current);current=getProto(current))Object.getOwnPropertyNames(current).forEach(key=>def[key]=()=>value[key]);return def.default=()=>value,__webpack_require__.d(ns,def),ns}})(),__webpack_require__.d=(exports,definition)=>{for(var key in definition)__webpack_require__.o(definition,key)&&!__webpack_require__.o(exports,key)&&Object.defineProperty(exports,key,{enumerable:!0,get:definition[key]})},__webpack_require__.g=function(){if(typeof globalThis=="object")return globalThis;try{return this||new Function("return this")()}catch{if(typeof window=="object")return window}}(),__webpack_require__.o=(obj,prop)=>Object.prototype.hasOwnProperty.call(obj,prop),__webpack_require__.r=exports=>{typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(exports,"__esModule",{value:!0})},__webpack_require__.nmd=module=>(module.paths=[],module.children||(module.children=[]),module),(()=>{var installedChunks={703:0};__webpack_require__.O.j=chunkId=>installedChunks[chunkId]===0;var webpackJsonpCallback=(parentChunkLoadingFunction,data)=>{var[chunkIds,moreModules,runtime]=data,moduleId,chunkId,i=0;if(chunkIds.some(id=>installedChunks[id]!==0)){for(moduleId in moreModules)__webpack_require__.o(moreModules,moduleId)&&(__webpack_require__.m[moduleId]=moreModules[moduleId]);if(runtime)var result=runtime(__webpack_require__)}for(parentChunkLoadingFunction&&parentChunkLoadingFunction(data);i<chunkIds.length;i++)chunkId=chunkIds[i],__webpack_require__.o(installedChunks,chunkId)&&installedChunks[chunkId]&&installedChunks[chunkId][0](),installedChunks[chunkId]=0;return __webpack_require__.O(result)},chunkLoadingGlobal=self.__loadChunks_EnvTemplate=self.__loadChunks_EnvTemplate||[];chunkLoadingGlobal.forEach(webpackJsonpCallback.bind(null,0)),chunkLoadingGlobal.push=webpackJsonpCallback.bind(null,chunkLoadingGlobal.push.bind(chunkLoadingGlobal))})();var __webpack_exports__=__webpack_require__.O(void 0,[244],()=>__webpack_require__(95117));__webpack_exports__=__webpack_require__.O(__webpack_exports__)})();
@@ -1,5 +0,0 @@
1
- import { ComponentContext } from '@teambit/generator';
2
- export declare const componentFile: (context: ComponentContext) => {
3
- relativePath: string;
4
- content: string;
5
- };
@@ -1,29 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.componentFile = void 0;
7
- const regex = /([A-Z])([A-Z])([a-z])|([a-z])([A-Z])/g;
8
- const componentFile = context => {
9
- const {
10
- name,
11
- namePascalCase: Name
12
- } = context;
13
- return {
14
- relativePath: `${name}.mdx`,
15
- content: `# ${Name.replace(regex, '$1$4 $2$3$5')}
16
-
17
- This is markdown.
18
-
19
- <p>This is HTML</p>
20
-
21
- # Import a React Component or use HTML
22
-
23
- <button>Button 👋 </button>
24
- `
25
- };
26
- };
27
- exports.componentFile = componentFile;
28
-
29
- //# sourceMappingURL=component.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["regex","componentFile","context","name","namePascalCase","Name","relativePath","content","replace","exports"],"sources":["component.ts"],"sourcesContent":["import { ComponentContext } from '@teambit/generator';\n\nconst regex = /([A-Z])([A-Z])([a-z])|([a-z])([A-Z])/g;\n\nexport const componentFile = (context: ComponentContext) => {\n const { name, namePascalCase: Name } = context;\n return {\n relativePath: `${name}.mdx`,\n content: `# ${Name.replace(regex, '$1$4 $2$3$5')}\n\nThis is markdown.\n\n<p>This is HTML</p>\n\n# Import a React Component or use HTML\n\n<button>Button 👋 </button>\n`,\n };\n};\n"],"mappings":";;;;;;AAEA,MAAMA,KAAK,GAAG,uCAAuC;AAE9C,MAAMC,aAAa,GAAIC,OAAyB,IAAK;EAC1D,MAAM;IAAEC,IAAI;IAAEC,cAAc,EAAEC;EAAK,CAAC,GAAGH,OAAO;EAC9C,OAAO;IACLI,YAAY,EAAG,GAAEH,IAAK,MAAK;IAC3BI,OAAO,EAAG,KAAIF,IAAI,CAACG,OAAO,CAACR,KAAK,EAAE,aAAa,CAAE;AACrD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACE,CAAC;AACH,CAAC;AAACS,OAAA,CAAAR,aAAA,GAAAA,aAAA"}
@@ -1,5 +0,0 @@
1
- import { ComponentContext } from '@teambit/generator';
2
- export declare const compositionFile: (context: ComponentContext) => {
3
- relativePath: string;
4
- content: string;
5
- };
@@ -1,25 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.compositionFile = void 0;
7
- const compositionFile = context => {
8
- const {
9
- name,
10
- namePascalCase: Name
11
- } = context;
12
- return {
13
- relativePath: `${name}.composition.tsx`,
14
- content: `import React from 'react';
15
- import { ${Name} } from './index';
16
-
17
- export const Basic${Name} = () => (
18
- <${Name} />
19
- );
20
- `
21
- };
22
- };
23
- exports.compositionFile = compositionFile;
24
-
25
- //# sourceMappingURL=composition.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["compositionFile","context","name","namePascalCase","Name","relativePath","content","exports"],"sources":["composition.ts"],"sourcesContent":["import { ComponentContext } from '@teambit/generator';\n\nexport const compositionFile = (context: ComponentContext) => {\n const { name, namePascalCase: Name } = context;\n\n return {\n relativePath: `${name}.composition.tsx`,\n content: `import React from 'react';\nimport { ${Name} } from './index';\n\nexport const Basic${Name} = () => (\n <${Name} />\n);\n`,\n };\n};\n"],"mappings":";;;;;;AAEO,MAAMA,eAAe,GAAIC,OAAyB,IAAK;EAC5D,MAAM;IAAEC,IAAI;IAAEC,cAAc,EAAEC;EAAK,CAAC,GAAGH,OAAO;EAE9C,OAAO;IACLI,YAAY,EAAG,GAAEH,IAAK,kBAAiB;IACvCI,OAAO,EAAG;AACd,WAAWF,IAAK;AAChB;AACA,oBAAoBA,IAAK;AACzB,KAAKA,IAAK;AACV;AACA;EACE,CAAC;AACH,CAAC;AAACG,OAAA,CAAAP,eAAA,GAAAA,eAAA"}
@@ -1,5 +0,0 @@
1
- import { ComponentContext } from '@teambit/generator';
2
- export declare const docsFile: (context: ComponentContext) => {
3
- relativePath: string;
4
- content: string;
5
- };
@@ -1,44 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.docsFile = void 0;
7
- const docsFile = context => {
8
- const {
9
- name,
10
- namePascalCase: Name
11
- } = context;
12
- return {
13
- relativePath: `${name}.docs.mdx`,
14
- content: `---
15
- description: 'An MDX component.'
16
- labels: ['content', 'mdx']
17
- ---
18
-
19
- import { ${Name} } from './index';
20
-
21
- ### Component usage
22
- \`\`\`js
23
- <${Name} />
24
- \`\`\`
25
-
26
- ### Render with theme and MDX providers
27
-
28
- \`\`\`js
29
- import { ThemeCompositions } from '@teambit/documenter.theme.theme-compositions'
30
- import { MDXLayout } from '@teambit/mdx.ui.mdx-layout'
31
- import { ${Name} } from './index'
32
-
33
- <ThemeCompositions>
34
- <MDXLayout>
35
- <${Name} />
36
- </MDXLayout>
37
- </ThemeCompositions>
38
- \`\`\`
39
- `
40
- };
41
- };
42
- exports.docsFile = docsFile;
43
-
44
- //# sourceMappingURL=docs.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["docsFile","context","name","namePascalCase","Name","relativePath","content","exports"],"sources":["docs.ts"],"sourcesContent":["import { ComponentContext } from '@teambit/generator';\n\nexport const docsFile = (context: ComponentContext) => {\n const { name, namePascalCase: Name } = context;\n\n return {\n relativePath: `${name}.docs.mdx`,\n content: `---\ndescription: 'An MDX component.'\nlabels: ['content', 'mdx']\n---\n\nimport { ${Name} } from './index';\n\n### Component usage\n\\`\\`\\`js\n<${Name} />\n\\`\\`\\`\n\n### Render with theme and MDX providers\n\n\\`\\`\\`js\nimport { ThemeCompositions } from '@teambit/documenter.theme.theme-compositions'\nimport { MDXLayout } from '@teambit/mdx.ui.mdx-layout'\nimport { ${Name} } from './index'\n\n<ThemeCompositions>\n <MDXLayout>\n <${Name} />\n </MDXLayout>\n</ThemeCompositions>\n\\`\\`\\`\n`,\n };\n};\n"],"mappings":";;;;;;AAEO,MAAMA,QAAQ,GAAIC,OAAyB,IAAK;EACrD,MAAM;IAAEC,IAAI;IAAEC,cAAc,EAAEC;EAAK,CAAC,GAAGH,OAAO;EAE9C,OAAO;IACLI,YAAY,EAAG,GAAEH,IAAK,WAAU;IAChCI,OAAO,EAAG;AACd;AACA;AACA;AACA;AACA,WAAWF,IAAK;AAChB;AACA;AACA;AACA,GAAGA,IAAK;AACR;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAWA,IAAK;AAChB;AACA;AACA;AACA,OAAOA,IAAK;AACZ;AACA;AACA;AACA;EACE,CAAC;AACH,CAAC;AAACG,OAAA,CAAAP,QAAA,GAAAA,QAAA"}
@@ -1,5 +0,0 @@
1
- import { ComponentContext } from '@teambit/generator';
2
- export declare const testFile: (context: ComponentContext) => {
3
- relativePath: string;
4
- content: string;
5
- };
@@ -1,28 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.testFile = void 0;
7
- const testFile = context => {
8
- const {
9
- name,
10
- namePascalCase: Name
11
- } = context;
12
- return {
13
- relativePath: `${name}.spec.tsx`,
14
- content: `import React from 'react';
15
- import { render } from '@testing-library/react';
16
- import { Basic${Name} } from './${name}.composition';
17
-
18
- it('should render with the correct text', () => {
19
- const { getByText } = render(<Basic${Name} />);
20
- const rendered = getByText('${Name}');
21
- expect(rendered).toBeTruthy();
22
- });
23
- `
24
- };
25
- };
26
- exports.testFile = testFile;
27
-
28
- //# sourceMappingURL=test.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["testFile","context","name","namePascalCase","Name","relativePath","content","exports"],"sources":["test.ts"],"sourcesContent":["import { ComponentContext } from '@teambit/generator';\n\nexport const testFile = (context: ComponentContext) => {\n const { name, namePascalCase: Name } = context;\n\n return {\n relativePath: `${name}.spec.tsx`,\n content: `import React from 'react';\nimport { render } from '@testing-library/react';\nimport { Basic${Name} } from './${name}.composition';\n\nit('should render with the correct text', () => {\n const { getByText } = render(<Basic${Name} />);\n const rendered = getByText('${Name}');\n expect(rendered).toBeTruthy();\n});\n`,\n };\n};\n"],"mappings":";;;;;;AAEO,MAAMA,QAAQ,GAAIC,OAAyB,IAAK;EACrD,MAAM;IAAEC,IAAI;IAAEC,cAAc,EAAEC;EAAK,CAAC,GAAGH,OAAO;EAE9C,OAAO;IACLI,YAAY,EAAG,GAAEH,IAAK,WAAU;IAChCI,OAAO,EAAG;AACd;AACA,gBAAgBF,IAAK,cAAaF,IAAK;AACvC;AACA;AACA,uCAAuCE,IAAK;AAC5C,gCAAgCA,IAAK;AACrC;AACA;AACA;EACE,CAAC;AACH,CAAC;AAACG,OAAA,CAAAP,QAAA,GAAAA,QAAA"}
@@ -1,3 +0,0 @@
1
- import { ComponentTemplate } from '@teambit/generator';
2
- export declare const MDXComponent: ComponentTemplate;
3
- export declare const deprecatedMDXComponent: ComponentTemplate;
@@ -1,80 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.deprecatedMDXComponent = exports.MDXComponent = void 0;
7
- function _component() {
8
- const data = require("./files/component");
9
- _component = function () {
10
- return data;
11
- };
12
- return data;
13
- }
14
- function _composition() {
15
- const data = require("./files/composition");
16
- _composition = function () {
17
- return data;
18
- };
19
- return data;
20
- }
21
- function _docs() {
22
- const data = require("./files/docs");
23
- _docs = function () {
24
- return data;
25
- };
26
- return data;
27
- }
28
- // TODO @ranm8 Tests won't work in MDX until we add a Jest Transformer for the MDX env.
29
- // import { testFile } from './files/test';
30
-
31
- const MDXComponent = {
32
- name: 'mdx',
33
- description: 'MDX-file compiled by Bit to a reuseable component',
34
- hidden: true,
35
- generateFiles: context => {
36
- const {
37
- name,
38
- namePascalCase: Name
39
- } = context;
40
- const indexFile = {
41
- relativePath: 'index.ts',
42
- content: `export { default as ${Name}, default } from './${name}.mdx';
43
- `
44
- };
45
- return [indexFile, (0, _component().componentFile)(context), (0, _composition().compositionFile)(context), (0, _docs().docsFile)(context)];
46
- },
47
- config: {
48
- 'teambit.mdx/mdx': {},
49
- 'teambit.envs/envs': {
50
- env: 'teambit.mdx/mdx'
51
- }
52
- }
53
- };
54
- exports.MDXComponent = MDXComponent;
55
- const deprecatedMDXComponent = {
56
- name: 'mdx-component',
57
- description: 'MDX-file compiled by Bit to a reuseable component',
58
- hidden: true,
59
- generateFiles: context => {
60
- const {
61
- name,
62
- namePascalCase: Name
63
- } = context;
64
- const indexFile = {
65
- relativePath: 'index.ts',
66
- content: `export { default as ${Name} } from './${name}.mdx';
67
- `
68
- };
69
- return [indexFile, (0, _component().componentFile)(context), (0, _composition().compositionFile)(context), (0, _docs().docsFile)(context)];
70
- },
71
- config: {
72
- 'teambit.mdx/mdx': {},
73
- 'teambit.envs/envs': {
74
- env: 'teambit.mdx/mdx'
75
- }
76
- }
77
- };
78
- exports.deprecatedMDXComponent = deprecatedMDXComponent;
79
-
80
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["_component","data","require","_composition","_docs","MDXComponent","name","description","hidden","generateFiles","context","namePascalCase","Name","indexFile","relativePath","content","componentFile","compositionFile","docsFile","config","env","exports","deprecatedMDXComponent"],"sources":["index.ts"],"sourcesContent":["import { ComponentTemplate, ComponentContext } from '@teambit/generator';\nimport { componentFile } from './files/component';\nimport { compositionFile } from './files/composition';\nimport { docsFile } from './files/docs';\n// TODO @ranm8 Tests won't work in MDX until we add a Jest Transformer for the MDX env.\n// import { testFile } from './files/test';\n\nexport const MDXComponent: ComponentTemplate = {\n name: 'mdx',\n description: 'MDX-file compiled by Bit to a reuseable component',\n hidden: true,\n generateFiles: (context: ComponentContext) => {\n const { name, namePascalCase: Name } = context;\n const indexFile = {\n relativePath: 'index.ts',\n content: `export { default as ${Name}, default } from './${name}.mdx';\n`,\n };\n\n return [indexFile, componentFile(context), compositionFile(context), docsFile(context)];\n },\n config: {\n 'teambit.mdx/mdx': {},\n 'teambit.envs/envs': {\n env: 'teambit.mdx/mdx',\n },\n },\n};\n\nexport const deprecatedMDXComponent: ComponentTemplate = {\n name: 'mdx-component',\n description: 'MDX-file compiled by Bit to a reuseable component',\n hidden: true,\n\n generateFiles: (context: ComponentContext) => {\n const { name, namePascalCase: Name } = context;\n const indexFile = {\n relativePath: 'index.ts',\n content: `export { default as ${Name} } from './${name}.mdx';\n`,\n };\n\n return [indexFile, componentFile(context), compositionFile(context), docsFile(context)];\n },\n config: {\n 'teambit.mdx/mdx': {},\n 'teambit.envs/envs': {\n env: 'teambit.mdx/mdx',\n },\n },\n};\n"],"mappings":";;;;;;AACA,SAAAA,WAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,UAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAE,aAAA;EAAA,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AS,EAAE,IAAAG,0BAAa,EAACN,OAAO,CAAC,EAAE,IAAAO,8BAAe,EAACP,OAAO,CAAC,EAAE,IAAAQ,gBAAQ,EAACR,OAAO,CAAC,CAAC;EACzF,CAAC;EACDS,MAAM,EAAE;IACN,iBAAiB,EAAE,CAAC,CAAC;IACrB,mBAAmB,EAAE;MACnBC,GAAG,EAAE;IACP;EACF;AACF,CAAC;AAACC,OAAA,CAAAC,sBAAA,GAAAA,sBAAA"}
@@ -1,20 +0,0 @@
1
- import { ComponentContext } from '@teambit/generator';
2
-
3
- const regex = /([A-Z])([A-Z])([a-z])|([a-z])([A-Z])/g;
4
-
5
- export const componentFile = (context: ComponentContext) => {
6
- const { name, namePascalCase: Name } = context;
7
- return {
8
- relativePath: `${name}.mdx`,
9
- content: `# ${Name.replace(regex, '$1$4 $2$3$5')}
10
-
11
- This is markdown.
12
-
13
- <p>This is HTML</p>
14
-
15
- # Import a React Component or use HTML
16
-
17
- <button>Button 👋 </button>
18
- `,
19
- };
20
- };
@@ -1,16 +0,0 @@
1
- import { ComponentContext } from '@teambit/generator';
2
-
3
- export const compositionFile = (context: ComponentContext) => {
4
- const { name, namePascalCase: Name } = context;
5
-
6
- return {
7
- relativePath: `${name}.composition.tsx`,
8
- content: `import React from 'react';
9
- import { ${Name} } from './index';
10
-
11
- export const Basic${Name} = () => (
12
- <${Name} />
13
- );
14
- `,
15
- };
16
- };
@@ -1,35 +0,0 @@
1
- import { ComponentContext } from '@teambit/generator';
2
-
3
- export const docsFile = (context: ComponentContext) => {
4
- const { name, namePascalCase: Name } = context;
5
-
6
- return {
7
- relativePath: `${name}.docs.mdx`,
8
- content: `---
9
- description: 'An MDX component.'
10
- labels: ['content', 'mdx']
11
- ---
12
-
13
- import { ${Name} } from './index';
14
-
15
- ### Component usage
16
- \`\`\`js
17
- <${Name} />
18
- \`\`\`
19
-
20
- ### Render with theme and MDX providers
21
-
22
- \`\`\`js
23
- import { ThemeCompositions } from '@teambit/documenter.theme.theme-compositions'
24
- import { MDXLayout } from '@teambit/mdx.ui.mdx-layout'
25
- import { ${Name} } from './index'
26
-
27
- <ThemeCompositions>
28
- <MDXLayout>
29
- <${Name} />
30
- </MDXLayout>
31
- </ThemeCompositions>
32
- \`\`\`
33
- `,
34
- };
35
- };