@teambit/docs 1.0.150 → 1.0.152
Sign up to get free protection for your applications and to get access to all the features.
- package/artifacts/__bit_junit.xml +1 -1
- package/artifacts/preview/static/css/teambit.docs/{docs-preview.8d0b968b.css → docs-preview.1ba33439.css} +6 -6
- package/artifacts/preview/teambit_docs_docs-preview.js +6 -6
- package/dist/docs.preview.runtime.js +8 -1
- package/dist/docs.preview.runtime.js.map +1 -1
- package/dist/{preview-1706671044097.js → preview-1706757518460.js} +2 -2
- package/docs.preview.runtime.tsx +8 -2
- package/package.json +18 -18
@@ -39,7 +39,12 @@ class DocsPreview {
|
|
39
39
|
_defineProperty(this, "render", (componentId, envId, modules, [compositions], context) => {
|
40
40
|
const docsModule = this.selectPreviewModel(componentId.fullName, modules);
|
41
41
|
const mainModule = modules.modulesMap[envId] || modules.modulesMap.default;
|
42
|
-
|
42
|
+
let defaultExports = mainModule.default;
|
43
|
+
// Sometime when using ESM (package.json with type:"module") the default export is nested under "default"
|
44
|
+
if (typeof defaultExports !== 'function' && defaultExports.default) {
|
45
|
+
defaultExports = defaultExports.default;
|
46
|
+
}
|
47
|
+
// @ts-ignore Gilad - to fix.
|
43
48
|
const isObject = !!defaultExports.apiObject;
|
44
49
|
|
45
50
|
/**
|
@@ -47,6 +52,7 @@ class DocsPreview {
|
|
47
52
|
*/
|
48
53
|
if (!isObject) {
|
49
54
|
const docsPropsArray = [NoopProvider, componentId.toString(), docsModule, compositions, context];
|
55
|
+
// @ts-ignore Gilad - to fix. it happens because defaultExports might be a func or an object (handled above)
|
50
56
|
defaultExports(...docsPropsArray);
|
51
57
|
return;
|
52
58
|
}
|
@@ -57,6 +63,7 @@ class DocsPreview {
|
|
57
63
|
compositions,
|
58
64
|
context
|
59
65
|
};
|
66
|
+
// @ts-ignore Gilad - to fix. it happens because defaultExports might be a func or an object (handled above)
|
60
67
|
defaultExports(docsProps);
|
61
68
|
});
|
62
69
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["_react","data","_interopRequireDefault","require","_preview","_docs","obj","__esModule","default","_defineProperty","key","value","_toPropertyKey","Object","defineProperty","enumerable","configurable","writable","t","i","_toPrimitive","String","r","e","Symbol","toPrimitive","call","TypeError","Number","DocsPreview","constructor","preview","componentId","envId","modules","compositions","context","docsModule","selectPreviewModel","fullName","mainModule","modulesMap","defaultExports","isObject","apiObject","docsPropsArray","NoopProvider","toString","docsProps","Provider","docs","relevant","componentMap","undefined","provider","docsPreview","registerPreview","name","render","bind","include","exports","PreviewRuntime","PreviewAspect","DocsAspect","addRuntime","children","createElement","Fragment"],"sources":["docs.preview.runtime.tsx"],"sourcesContent":["import React, { ReactNode } from 'react';\nimport { PreviewAspect, RenderingContext, PreviewPreview, PreviewRuntime, PreviewModule } from '@teambit/preview';\nimport { ComponentID } from '@teambit/component-id';\n\nimport { DocsAspect } from './docs.aspect';\nimport type { Docs } from './docs';\n\nexport type DocsRootProps = {\n Provider: React.ComponentType | undefined;\n componentId: string;\n docs: Docs | undefined;\n compositions: any;\n context: RenderingContext;\n};\n\nexport class DocsPreview {\n constructor(\n /**\n * preview extension.\n */\n private preview: PreviewPreview\n ) {}\n\n render = (\n componentId: ComponentID,\n envId: string,\n modules: PreviewModule,\n [compositions]: [any],\n context: RenderingContext\n ) => {\n const docsModule = this.selectPreviewModel(componentId.fullName, modules);\n\n const mainModule = modules.modulesMap[envId] || modules.modulesMap.default;\n
|
1
|
+
{"version":3,"names":["_react","data","_interopRequireDefault","require","_preview","_docs","obj","__esModule","default","_defineProperty","key","value","_toPropertyKey","Object","defineProperty","enumerable","configurable","writable","t","i","_toPrimitive","String","r","e","Symbol","toPrimitive","call","TypeError","Number","DocsPreview","constructor","preview","componentId","envId","modules","compositions","context","docsModule","selectPreviewModel","fullName","mainModule","modulesMap","defaultExports","isObject","apiObject","docsPropsArray","NoopProvider","toString","docsProps","Provider","docs","relevant","componentMap","undefined","provider","docsPreview","registerPreview","name","render","bind","include","exports","PreviewRuntime","PreviewAspect","DocsAspect","addRuntime","children","createElement","Fragment"],"sources":["docs.preview.runtime.tsx"],"sourcesContent":["import React, { ReactNode } from 'react';\nimport { PreviewAspect, RenderingContext, PreviewPreview, PreviewRuntime, PreviewModule } from '@teambit/preview';\nimport { ComponentID } from '@teambit/component-id';\n\nimport { DocsAspect } from './docs.aspect';\nimport type { Docs } from './docs';\n\nexport type DocsRootProps = {\n Provider: React.ComponentType | undefined;\n componentId: string;\n docs: Docs | undefined;\n compositions: any;\n context: RenderingContext;\n};\n\nexport class DocsPreview {\n constructor(\n /**\n * preview extension.\n */\n private preview: PreviewPreview\n ) {}\n\n render = (\n componentId: ComponentID,\n envId: string,\n modules: PreviewModule,\n [compositions]: [any],\n context: RenderingContext\n ) => {\n const docsModule = this.selectPreviewModel(componentId.fullName, modules);\n\n const mainModule = modules.modulesMap[envId] || modules.modulesMap.default;\n let defaultExports = mainModule.default;\n // Sometime when using ESM (package.json with type:\"module\") the default export is nested under \"default\"\n if (typeof defaultExports !== 'function' && defaultExports.default) {\n defaultExports = defaultExports.default;\n }\n // @ts-ignore Gilad - to fix.\n const isObject = !!defaultExports.apiObject;\n\n /**\n * for backwards compatibility - can be removed end of 2022\n */\n if (!isObject) {\n const docsPropsArray = [\n NoopProvider as React.ComponentType,\n componentId.toString(),\n docsModule as Docs,\n compositions,\n context,\n ];\n // @ts-ignore Gilad - to fix. it happens because defaultExports might be a func or an object (handled above)\n defaultExports(...docsPropsArray);\n return;\n }\n\n const docsProps: DocsRootProps = {\n Provider: NoopProvider as React.ComponentType,\n componentId: componentId.toString(),\n docs: docsModule as Docs,\n compositions,\n context,\n };\n // @ts-ignore Gilad - to fix. it happens because defaultExports might be a func or an object (handled above)\n defaultExports(docsProps);\n };\n\n selectPreviewModel(componentId: string, modules: PreviewModule) {\n const relevant = modules.componentMap[componentId];\n if (!relevant) return undefined;\n\n // only one doc file is supported.\n return relevant[0];\n }\n\n static runtime = PreviewRuntime;\n static dependencies = [PreviewAspect];\n\n static async provider([preview]: [PreviewPreview]) {\n const docsPreview = new DocsPreview(preview);\n preview.registerPreview({\n name: 'overview',\n render: docsPreview.render.bind(docsPreview),\n selectPreviewModel: docsPreview.selectPreviewModel.bind(docsPreview),\n include: ['compositions'],\n });\n\n return docsPreview;\n }\n}\n\nDocsAspect.addRuntime(DocsPreview);\n\nfunction NoopProvider({ children }: { children: ReactNode }) {\n return <>{children}</>;\n}\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,SAAA;EAAA,MAAAH,IAAA,GAAAE,OAAA;EAAAC,QAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAGA,SAAAI,MAAA;EAAA,MAAAJ,IAAA,GAAAE,OAAA;EAAAE,KAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAA2C,SAAAC,uBAAAI,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAAA,SAAAG,gBAAAH,GAAA,EAAAI,GAAA,EAAAC,KAAA,IAAAD,GAAA,GAAAE,cAAA,CAAAF,GAAA,OAAAA,GAAA,IAAAJ,GAAA,IAAAO,MAAA,CAAAC,cAAA,CAAAR,GAAA,EAAAI,GAAA,IAAAC,KAAA,EAAAA,KAAA,EAAAI,UAAA,QAAAC,YAAA,QAAAC,QAAA,oBAAAX,GAAA,CAAAI,GAAA,IAAAC,KAAA,WAAAL,GAAA;AAAA,SAAAM,eAAAM,CAAA,QAAAC,CAAA,GAAAC,YAAA,CAAAF,CAAA,uCAAAC,CAAA,GAAAA,CAAA,GAAAE,MAAA,CAAAF,CAAA;AAAA,SAAAC,aAAAF,CAAA,EAAAI,CAAA,2BAAAJ,CAAA,KAAAA,CAAA,SAAA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,UAAkB;QACxBF,YAAY;QACZC;MACF,CAAC;MACD;MACAM,cAAc,CAACM,SAAS,CAAC;IAC3B,CAAC;EA7CE;EA+CHV,kBAAkBA,CAACN,WAAmB,EAAEE,OAAsB,EAAE;IAC9D,MAAMiB,QAAQ,GAAGjB,OAAO,CAACkB,YAAY,CAACpB,WAAW,CAAC;IAClD,IAAI,CAACmB,QAAQ,EAAE,OAAOE,SAAS;;IAE/B;IACA,OAAOF,QAAQ,CAAC,CAAC,CAAC;EACpB;EAKA,aAAaG,QAAQA,CAAC,CAACvB,OAAO,CAAmB,EAAE;IACjD,MAAMwB,WAAW,GAAG,IAAI1B,WAAW,CAACE,OAAO,CAAC;IAC5CA,OAAO,CAACyB,eAAe,CAAC;MACtBC,IAAI,EAAE,UAAU;MAChBC,MAAM,EAAEH,WAAW,CAACG,MAAM,CAACC,IAAI,CAACJ,WAAW,CAAC;MAC5CjB,kBAAkB,EAAEiB,WAAW,CAACjB,kBAAkB,CAACqB,IAAI,CAACJ,WAAW,CAAC;MACpEK,OAAO,EAAE,CAAC,cAAc;IAC1B,CAAC,CAAC;IAEF,OAAOL,WAAW;EACpB;AACF;AAACM,OAAA,CAAAhC,WAAA,GAAAA,WAAA;AAAApB,eAAA,CA3EYoB,WAAW,aA6DLiC,yBAAc;AAAArD,eAAA,CA7DpBoB,WAAW,kBA8DA,CAACkC,wBAAa,CAAC;AAevCC,kBAAU,CAACC,UAAU,CAACpC,WAAW,CAAC;AAElC,SAASiB,YAAYA,CAAC;EAAEoB;AAAkC,CAAC,EAAE;EAC3D,oBAAOlE,MAAA,GAAAQ,OAAA,CAAA2D,aAAA,CAAAnE,MAAA,GAAAQ,OAAA,CAAA4D,QAAA,QAAGF,QAAW,CAAC;AACxB"}
|
@@ -1,5 +1,5 @@
|
|
1
|
-
import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.docs_docs@1.0.
|
2
|
-
import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.docs_docs@1.0.
|
1
|
+
import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.docs_docs@1.0.152/dist/docs.composition.js';
|
2
|
+
import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.docs_docs@1.0.152/dist/docs.docs.mdx';
|
3
3
|
|
4
4
|
export const compositions = [compositions_0];
|
5
5
|
export const overview = [overview_0];
|
package/docs.preview.runtime.tsx
CHANGED
@@ -31,7 +31,12 @@ export class DocsPreview {
|
|
31
31
|
const docsModule = this.selectPreviewModel(componentId.fullName, modules);
|
32
32
|
|
33
33
|
const mainModule = modules.modulesMap[envId] || modules.modulesMap.default;
|
34
|
-
|
34
|
+
let defaultExports = mainModule.default;
|
35
|
+
// Sometime when using ESM (package.json with type:"module") the default export is nested under "default"
|
36
|
+
if (typeof defaultExports !== 'function' && defaultExports.default) {
|
37
|
+
defaultExports = defaultExports.default;
|
38
|
+
}
|
39
|
+
// @ts-ignore Gilad - to fix.
|
35
40
|
const isObject = !!defaultExports.apiObject;
|
36
41
|
|
37
42
|
/**
|
@@ -45,6 +50,7 @@ export class DocsPreview {
|
|
45
50
|
compositions,
|
46
51
|
context,
|
47
52
|
];
|
53
|
+
// @ts-ignore Gilad - to fix. it happens because defaultExports might be a func or an object (handled above)
|
48
54
|
defaultExports(...docsPropsArray);
|
49
55
|
return;
|
50
56
|
}
|
@@ -56,7 +62,7 @@ export class DocsPreview {
|
|
56
62
|
compositions,
|
57
63
|
context,
|
58
64
|
};
|
59
|
-
|
65
|
+
// @ts-ignore Gilad - to fix. it happens because defaultExports might be a func or an object (handled above)
|
60
66
|
defaultExports(docsProps);
|
61
67
|
};
|
62
68
|
|
package/package.json
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
{
|
2
2
|
"name": "@teambit/docs",
|
3
|
-
"version": "1.0.
|
3
|
+
"version": "1.0.152",
|
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.
|
9
|
+
"version": "1.0.152"
|
10
10
|
},
|
11
11
|
"dependencies": {
|
12
12
|
"graphql-tag": "2.12.1",
|
@@ -19,23 +19,23 @@
|
|
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.
|
23
|
-
"@teambit/component": "1.0.
|
24
|
-
"@teambit/pkg": "1.0.
|
25
|
-
"@teambit/workspace": "1.0.
|
26
|
-
"@teambit/cli": "0.0.
|
27
|
-
"@teambit/dev-files": "1.0.
|
28
|
-
"@teambit/envs": "1.0.
|
29
|
-
"@teambit/graphql": "1.0.
|
30
|
-
"@teambit/logger": "0.0.
|
31
|
-
"@teambit/preview": "1.0.
|
32
|
-
"@teambit/scope": "1.0.
|
33
|
-
"@teambit/api-reference": "1.0.
|
34
|
-
"@teambit/component-compare": "1.0.
|
35
|
-
"@teambit/ui": "1.0.
|
22
|
+
"@teambit/compiler": "1.0.152",
|
23
|
+
"@teambit/component": "1.0.152",
|
24
|
+
"@teambit/pkg": "1.0.152",
|
25
|
+
"@teambit/workspace": "1.0.152",
|
26
|
+
"@teambit/cli": "0.0.850",
|
27
|
+
"@teambit/dev-files": "1.0.152",
|
28
|
+
"@teambit/envs": "1.0.152",
|
29
|
+
"@teambit/graphql": "1.0.152",
|
30
|
+
"@teambit/logger": "0.0.943",
|
31
|
+
"@teambit/preview": "1.0.152",
|
32
|
+
"@teambit/scope": "1.0.152",
|
33
|
+
"@teambit/api-reference": "1.0.152",
|
34
|
+
"@teambit/component-compare": "1.0.152",
|
35
|
+
"@teambit/ui": "1.0.152",
|
36
|
+
"@teambit/pubsub": "1.0.152",
|
36
37
|
"@teambit/compositions.panels.composition-gallery": "0.0.210",
|
37
|
-
"@teambit/preview.ui.component-preview": "1.0.5"
|
38
|
-
"@teambit/pubsub": "1.0.150"
|
38
|
+
"@teambit/preview.ui.component-preview": "1.0.5"
|
39
39
|
},
|
40
40
|
"devDependencies": {
|
41
41
|
"@types/lodash": "4.14.165",
|