@teambit/react 0.0.667 → 0.0.670
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/artifacts/env-template/public/141.js +12 -1
- package/artifacts/env-template/public/181.js +1 -1
- package/artifacts/env-template/public/719.js +24 -13
- package/artifacts/env-template/public/848.js +1 -1
- package/artifacts/env-template/public/984.js +1 -0
- package/artifacts/env-template/public/assets-manifest.json +12 -12
- package/artifacts/env-template/public/compositions.4971ce41fc1ec91d4612.js +1 -0
- package/artifacts/env-template/public/compositions.html +1 -1
- package/artifacts/env-template/public/overview.b9047e294ee81a8c6af5.js +1 -0
- package/artifacts/env-template/public/overview.html +1 -1
- package/artifacts/env-template/public/{peers.85f002ab582bd77ee4eb.js → peers.e9c6c15491f6fc7c952b.js} +0 -0
- package/artifacts/env-template/public/preview-root.985eb88239d8610a2170.js +1 -0
- package/artifacts/env-template/public/service-worker.js +1 -1
- package/artifacts/env-template/public/static/css/719.da75bc9c.css +1 -0
- package/artifacts/preview/teambit_react_react-preview.js +1 -1
- package/{__compositions-1646623282945.js → compositions-1646882648682.js} +10 -3
- package/compositions-app.tsx +3 -4
- package/dist/compositions-app.d.ts +2 -2
- package/dist/compositions-app.js +3 -2
- package/dist/compositions-app.js.map +1 -1
- package/dist/react.preview.runtime.d.ts +2 -4
- package/dist/react.preview.runtime.js +17 -9
- package/dist/react.preview.runtime.js.map +1 -1
- package/dist/templates/react-component/files/index-file.d.ts +5 -0
- package/dist/templates/react-component/files/index-file.js +23 -0
- package/dist/templates/react-component/files/index-file.js.map +1 -0
- package/dist/templates/react-component/index.js +37 -28
- package/dist/templates/react-component/index.js.map +1 -1
- package/dist/templates/react-component-js/index.js +26 -16
- package/dist/templates/react-component-js/index.js.map +1 -1
- package/dist/templates/react-context/files/index-file.d.ts +5 -0
- package/dist/templates/react-context/files/index-file.js +25 -0
- package/dist/templates/react-context/files/index-file.js.map +1 -0
- package/dist/templates/react-context/index.js +16 -13
- package/dist/templates/react-context/index.js.map +1 -1
- package/dist/templates/react-env/index.js +5 -0
- package/dist/templates/react-env/index.js.map +1 -1
- package/dist/templates/react-hook/files/index-file.d.ts +5 -0
- package/dist/templates/react-hook/files/index-file.js +22 -0
- package/dist/templates/react-hook/files/index-file.js.map +1 -0
- package/dist/templates/react-hook/index.js +16 -10
- package/dist/templates/react-hook/index.js.map +1 -1
- package/dist/webpack/webpack.config.base.js +12 -0
- package/dist/webpack/webpack.config.base.js.map +1 -1
- package/{__overview-1646623282945.js → overview-1646882648682.js} +10 -3
- package/package-tar/teambit-react-0.0.670.tgz +0 -0
- package/package.json +30 -30
- package/{__preview-1646623282945.js → preview-1646882648682.js} +2 -2
- package/templates/react-component/files/index-file.ts +12 -0
- package/templates/react-component/index.ts +9 -23
- package/templates/react-component-js/index.ts +6 -13
- package/templates/react-context/files/index-file.ts +14 -0
- package/templates/react-context/index.ts +7 -11
- package/templates/react-env/index.ts +5 -0
- package/templates/react-hook/files/index-file.ts +11 -0
- package/templates/react-hook/index.ts +7 -8
- package/webpack/webpack.config.base.ts +14 -0
- package/artifacts/env-template/public/74.js +0 -1
- package/artifacts/env-template/public/compositions.c61449b7a3a5348d8e30.js +0 -1
- package/artifacts/env-template/public/overview.f27c0d49fcc1ed18e185.js +0 -1
- package/artifacts/env-template/public/preview-root.078fe28d93fd986dce80.js +0 -1
- package/artifacts/env-template/public/static/css/719.683e3caf.css +0 -1
- package/package-tar/teambit-react-0.0.667.tgz +0 -0
|
@@ -1,7 +1,14 @@
|
|
|
1
1
|
|
|
2
2
|
import { linkModules } from '/home/circleci/bit/bit/node_modules/@teambit/preview/dist/preview.preview.runtime.js';
|
|
3
3
|
import harmony from '/home/circleci/bit/bit/node_modules/@teambit/harmony/dist/index.js';
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
import * as mainModule from '/home/circleci/bit/bit/node_modules/@teambit/react/dist/mount.js';
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
linkModules('compositions', {
|
|
9
|
+
mainModule,
|
|
10
|
+
isSplitComponentBundle: true,
|
|
11
|
+
componentMap: {
|
|
12
|
+
|
|
13
|
+
}
|
|
7
14
|
});
|
package/compositions-app.tsx
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { ComponentType } from 'react';
|
|
2
2
|
import { Composer } from '@teambit/base-ui.utils.composer';
|
|
3
3
|
import { StandaloneNotFoundPage } from '@teambit/design.ui.pages.standalone-not-found-page';
|
|
4
4
|
import { RenderingContext } from '@teambit/preview';
|
|
@@ -14,11 +14,10 @@ export function CompositionsApp({
|
|
|
14
14
|
Composition,
|
|
15
15
|
previewContext,
|
|
16
16
|
}: {
|
|
17
|
-
Composition?:
|
|
17
|
+
Composition?: ComponentType;
|
|
18
18
|
previewContext: RenderingContext;
|
|
19
19
|
}) {
|
|
20
|
-
const
|
|
21
|
-
const providers = reactContext?.providers || [];
|
|
20
|
+
const { providers = [] } = previewContext.get(ReactAspect.id) || {};
|
|
22
21
|
|
|
23
22
|
const safeComposition = useFallback(Composition && <Composition />, <StandaloneNotFoundPage />);
|
|
24
23
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { ComponentType } from 'react';
|
|
2
2
|
import { RenderingContext } from '@teambit/preview';
|
|
3
3
|
export declare function CompositionsApp({ Composition, previewContext, }: {
|
|
4
|
-
Composition?:
|
|
4
|
+
Composition?: ComponentType;
|
|
5
5
|
previewContext: RenderingContext;
|
|
6
6
|
}): JSX.Element;
|
package/dist/compositions-app.js
CHANGED
|
@@ -84,8 +84,9 @@ function CompositionsApp({
|
|
|
84
84
|
Composition,
|
|
85
85
|
previewContext
|
|
86
86
|
}) {
|
|
87
|
-
const
|
|
88
|
-
|
|
87
|
+
const {
|
|
88
|
+
providers = []
|
|
89
|
+
} = previewContext.get(_react2().ReactAspect.id) || {};
|
|
89
90
|
const safeComposition = (0, _reactUi2().useFallback)(Composition && /*#__PURE__*/_react().default.createElement(Composition, null), /*#__PURE__*/_react().default.createElement(_designUiPages().StandaloneNotFoundPage, null));
|
|
90
91
|
return /*#__PURE__*/_react().default.createElement(_reactErrorBoundary().ErrorBoundary, {
|
|
91
92
|
FallbackComponent: _reactUi().ErrorFallback,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["compositions-app.tsx"],"names":["hideScrollbars","CompositionsApp","Composition","previewContext","
|
|
1
|
+
{"version":3,"sources":["compositions-app.tsx"],"names":["hideScrollbars","CompositionsApp","Composition","previewContext","providers","get","ReactAspect","id","safeComposition","ErrorFallback"],"mappings":";;;;;;;;;AAAA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAEA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAEA;AACA,MAAMA,cAAc,GAAG,0CAAvB;;AAEO,SAASC,eAAT,CAAyB;AAC9BC,EAAAA,WAD8B;AAE9BC,EAAAA;AAF8B,CAAzB,EAMJ;AACD,QAAM;AAAEC,IAAAA,SAAS,GAAG;AAAd,MAAqBD,cAAc,CAACE,GAAf,CAAmBC,sBAAYC,EAA/B,KAAsC,EAAjE;AAEA,QAAMC,eAAe,GAAG,6BAAYN,WAAW,iBAAI,+BAAC,WAAD,OAA3B,eAA4C,+BAAC,uCAAD,OAA5C,CAAxB;AAEA,sBACE,+BAAC,mCAAD;AAAe,IAAA,iBAAiB,EAAEO,wBAAlC;AAAiD,IAAA,SAAS,EAAE,CAACP,WAAD;AAA5D,kBACE,+BAAC,uBAAD;AAAU,IAAA,UAAU,EAAEE;AAAtB,kBACE,8CAAQJ,cAAR,CADF,EAEGQ,eAFH,CADF,CADF;AAQD","sourcesContent":["import React, { ComponentType } from 'react';\nimport { Composer } from '@teambit/base-ui.utils.composer';\nimport { StandaloneNotFoundPage } from '@teambit/design.ui.pages.standalone-not-found-page';\nimport { RenderingContext } from '@teambit/preview';\nimport { ErrorFallback } from '@teambit/react.ui.error-fallback';\nimport { useFallback } from '@teambit/react.ui.loader-fallback';\nimport { ErrorBoundary } from 'react-error-boundary';\nimport { ReactAspect } from './react.aspect';\n\n// hide scrollbars so they won't be visible in the preview at the component card (and it's ok not to show them in the compositions page)\nconst hideScrollbars = 'body::-webkit-scrollbar {display: none;}';\n\nexport function CompositionsApp({\n Composition,\n previewContext,\n}: {\n Composition?: ComponentType;\n previewContext: RenderingContext;\n}) {\n const { providers = [] } = previewContext.get(ReactAspect.id) || {};\n\n const safeComposition = useFallback(Composition && <Composition />, <StandaloneNotFoundPage />);\n\n return (\n <ErrorBoundary FallbackComponent={ErrorFallback} resetKeys={[Composition]}>\n <Composer components={providers}>\n <style>{hideScrollbars}</style>\n {safeComposition}\n </Composer>\n </ErrorBoundary>\n );\n}\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ComponentType } from 'react';
|
|
2
2
|
import { SlotRegistry } from '@teambit/harmony';
|
|
3
|
-
import { PreviewPreview } from '@teambit/preview';
|
|
3
|
+
import { PreviewPreview, RenderingContextProvider } from '@teambit/preview';
|
|
4
4
|
export declare type Provider = ComponentType<{}>;
|
|
5
5
|
export declare type ProviderSlot = SlotRegistry<Provider[]>;
|
|
6
6
|
export declare class ReactPreview {
|
|
@@ -8,9 +8,7 @@ export declare class ReactPreview {
|
|
|
8
8
|
private providerSlot;
|
|
9
9
|
constructor(preview: PreviewPreview, providerSlot: ProviderSlot);
|
|
10
10
|
registerProvider(provider: Provider[]): void;
|
|
11
|
-
getRenderingContext
|
|
12
|
-
providers: Provider[];
|
|
13
|
-
};
|
|
11
|
+
getRenderingContext: RenderingContextProvider;
|
|
14
12
|
static runtime: import("@teambit/harmony").RuntimeDefinition;
|
|
15
13
|
static slots: ((registerFn: () => string) => SlotRegistry<Provider>)[];
|
|
16
14
|
static dependencies: import("@teambit/harmony").Aspect[];
|
|
@@ -79,24 +79,32 @@ class ReactPreview {
|
|
|
79
79
|
constructor(preview, providerSlot) {
|
|
80
80
|
this.preview = preview;
|
|
81
81
|
this.providerSlot = providerSlot;
|
|
82
|
+
(0, _defineProperty2().default)(this, "getRenderingContext", ({
|
|
83
|
+
aspectsFilter
|
|
84
|
+
}) => {
|
|
85
|
+
let entries = this.providerSlot.toArray();
|
|
86
|
+
|
|
87
|
+
if (aspectsFilter) {
|
|
88
|
+
const allowedAspects = new Set(aspectsFilter);
|
|
89
|
+
allowedAspects.add(_react().ReactAspect.id);
|
|
90
|
+
entries = entries.filter(([aspectId]) => allowedAspects.has(aspectId));
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
const providers = (0, _lodash().default)(entries.map(([, provider]) => provider));
|
|
94
|
+
return {
|
|
95
|
+
providers
|
|
96
|
+
};
|
|
97
|
+
});
|
|
82
98
|
}
|
|
83
99
|
|
|
84
100
|
registerProvider(provider) {
|
|
85
101
|
this.providerSlot.register(provider);
|
|
86
102
|
}
|
|
87
103
|
|
|
88
|
-
getRenderingContext() {
|
|
89
|
-
return {
|
|
90
|
-
providers: (0, _lodash().default)(this.providerSlot.values())
|
|
91
|
-
};
|
|
92
|
-
}
|
|
93
|
-
|
|
94
104
|
static async provider([preview], config, [providerSlot]) {
|
|
95
105
|
const reactPreview = new ReactPreview(preview, providerSlot);
|
|
96
106
|
reactPreview.registerProvider([_reactUi().HighlighterProvider]);
|
|
97
|
-
preview.registerRenderContext(
|
|
98
|
-
return reactPreview.getRenderingContext();
|
|
99
|
-
});
|
|
107
|
+
preview.registerRenderContext(reactPreview.getRenderingContext);
|
|
100
108
|
return reactPreview;
|
|
101
109
|
}
|
|
102
110
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["react.preview.runtime.ts"],"names":["ReactPreview","constructor","preview","providerSlot","
|
|
1
|
+
{"version":3,"sources":["react.preview.runtime.ts"],"names":["ReactPreview","constructor","preview","providerSlot","aspectsFilter","entries","toArray","allowedAspects","Set","add","ReactAspect","id","filter","aspectId","has","providers","map","provider","registerProvider","register","config","reactPreview","HighlighterProvider","registerRenderContext","getRenderingContext","PreviewRuntime","Slot","withType","PreviewAspect","addRuntime"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;;;;;AAKO,MAAMA,YAAN,CAAmB;AACxBC,EAAAA,WAAW,CAASC,OAAT,EAA0CC,YAA1C,EAAsE;AAAA,SAA7DD,OAA6D,GAA7DA,OAA6D;AAAA,SAA5BC,YAA4B,GAA5BA,YAA4B;AAAA,iEAMjC,CAAC;AAAEC,MAAAA;AAAF,KAAD,KAAuB;AACrE,UAAIC,OAAO,GAAG,KAAKF,YAAL,CAAkBG,OAAlB,EAAd;;AAEA,UAAIF,aAAJ,EAAmB;AACjB,cAAMG,cAAc,GAAG,IAAIC,GAAJ,CAAQJ,aAAR,CAAvB;AACAG,QAAAA,cAAc,CAACE,GAAf,CAAmBC,qBAAYC,EAA/B;AAEAN,QAAAA,OAAO,GAAGA,OAAO,CAACO,MAAR,CAAe,CAAC,CAACC,QAAD,CAAD,KAAgBN,cAAc,CAACO,GAAf,CAAmBD,QAAnB,CAA/B,CAAV;AACD;;AAED,YAAME,SAAS,GAAG,uBAAQV,OAAO,CAACW,GAAR,CAAY,CAAC,GAAGC,QAAH,CAAD,KAAkBA,QAA9B,CAAR,CAAlB;AAEA,aAAO;AACLF,QAAAA;AADK,OAAP;AAGD,KArBgF;AAAE;;AAEnFG,EAAAA,gBAAgB,CAACD,QAAD,EAAuB;AACrC,SAAKd,YAAL,CAAkBgB,QAAlB,CAA2BF,QAA3B;AACD;;AAyBoB,eAARA,QAAQ,CAAC,CAACf,OAAD,CAAD,EAA8BkB,MAA9B,EAAsC,CAACjB,YAAD,CAAtC,EAAsE;AACzF,UAAMkB,YAAY,GAAG,IAAIrB,YAAJ,CAAiBE,OAAjB,EAA0BC,YAA1B,CAArB;AAEAkB,IAAAA,YAAY,CAACH,gBAAb,CAA8B,CAACI,8BAAD,CAA9B;AAEApB,IAAAA,OAAO,CAACqB,qBAAR,CAA8BF,YAAY,CAACG,mBAA3C;AAEA,WAAOH,YAAP;AACD;;AAtCuB;;;gCAAbrB,Y,aAwBMyB,yB;gCAxBNzB,Y,WA0BI,CAAC0B,gBAAKC,QAAL,EAAD,C;gCA1BJ3B,Y,kBA4BW,CAAC4B,kBAAD,C;;AAaxBlB,qBAAYmB,UAAZ,CAAuB7B,YAAvB;;eAEeA,Y","sourcesContent":["import { ComponentType } from 'react';\nimport flatten from 'lodash.flatten';\nimport { SlotRegistry, Slot } from '@teambit/harmony';\nimport PreviewAspect, { PreviewPreview, PreviewRuntime, RenderingContextProvider } from '@teambit/preview';\nimport { HighlighterProvider } from '@teambit/react.ui.highlighter-provider';\nimport { ReactAspect } from './react.aspect';\n\nexport type Provider = ComponentType<{}>;\nexport type ProviderSlot = SlotRegistry<Provider[]>;\n\nexport class ReactPreview {\n constructor(private preview: PreviewPreview, private providerSlot: ProviderSlot) {}\n\n registerProvider(provider: Provider[]) {\n this.providerSlot.register(provider);\n }\n\n getRenderingContext: RenderingContextProvider = ({ aspectsFilter }) => {\n let entries = this.providerSlot.toArray();\n\n if (aspectsFilter) {\n const allowedAspects = new Set(aspectsFilter);\n allowedAspects.add(ReactAspect.id);\n\n entries = entries.filter(([aspectId]) => allowedAspects.has(aspectId));\n }\n\n const providers = flatten(entries.map(([, provider]) => provider));\n\n return {\n providers,\n };\n };\n\n static runtime = PreviewRuntime;\n\n static slots = [Slot.withType<Provider>()];\n\n static dependencies = [PreviewAspect];\n\n static async provider([preview]: [PreviewPreview], config, [providerSlot]: [ProviderSlot]) {\n const reactPreview = new ReactPreview(preview, providerSlot);\n\n reactPreview.registerProvider([HighlighterProvider]);\n\n preview.registerRenderContext(reactPreview.getRenderingContext);\n\n return reactPreview;\n }\n}\n\nReactAspect.addRuntime(ReactPreview);\n\nexport default ReactPreview;\n"]}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.indexFile = void 0;
|
|
7
|
+
|
|
8
|
+
const indexFile = context => {
|
|
9
|
+
const {
|
|
10
|
+
name,
|
|
11
|
+
namePascalCase: Name
|
|
12
|
+
} = context;
|
|
13
|
+
return {
|
|
14
|
+
relativePath: 'index.ts',
|
|
15
|
+
content: `export { ${Name} } from './${name}';
|
|
16
|
+
export type { ${Name}Props } from './${name}';
|
|
17
|
+
`
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
exports.indexFile = indexFile;
|
|
22
|
+
|
|
23
|
+
//# sourceMappingURL=index-file.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["index-file.ts"],"names":["indexFile","context","name","namePascalCase","Name","relativePath","content"],"mappings":";;;;;;;AAEO,MAAMA,SAAS,GAAIC,OAAD,IAA+B;AACtD,QAAM;AAAEC,IAAAA,IAAF;AAAQC,IAAAA,cAAc,EAAEC;AAAxB,MAAiCH,OAAvC;AAEA,SAAO;AACLI,IAAAA,YAAY,EAAE,UADT;AAELC,IAAAA,OAAO,EAAG,YAAWF,IAAK,cAAaF,IAAK;AAChD,gBAAgBE,IAAK,mBAAkBF,IAAK;AAC5C;AAJS,GAAP;AAMD,CATM","sourcesContent":["import { ComponentContext } from '@teambit/generator';\n\nexport const indexFile = (context: ComponentContext) => {\n const { name, namePascalCase: Name } = context;\n\n return {\n relativePath: 'index.ts',\n content: `export { ${Name} } from './${name}';\nexport type { ${Name}Props } from './${name}';\n`,\n };\n}\n"]}
|
|
@@ -1,10 +1,22 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
3
5
|
Object.defineProperty(exports, "__esModule", {
|
|
4
6
|
value: true
|
|
5
7
|
});
|
|
6
8
|
exports.reactComponent = exports.deprecatedReactComponent = void 0;
|
|
7
9
|
|
|
10
|
+
function _defineProperty2() {
|
|
11
|
+
const data = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
12
|
+
|
|
13
|
+
_defineProperty2 = function () {
|
|
14
|
+
return data;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
return data;
|
|
18
|
+
}
|
|
19
|
+
|
|
8
20
|
function _component() {
|
|
9
21
|
const data = require("./files/component");
|
|
10
22
|
|
|
@@ -45,42 +57,39 @@ function _test() {
|
|
|
45
57
|
return data;
|
|
46
58
|
}
|
|
47
59
|
|
|
60
|
+
function _indexFile() {
|
|
61
|
+
const data = require("./files/index-file");
|
|
62
|
+
|
|
63
|
+
_indexFile = function () {
|
|
64
|
+
return data;
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
return data;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
71
|
+
|
|
72
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2().default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
73
|
+
|
|
48
74
|
const reactComponent = {
|
|
49
75
|
name: 'react',
|
|
50
76
|
description: 'a basic react component',
|
|
51
77
|
generateFiles: context => {
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
content: `export { ${Name} } from './${name}';
|
|
59
|
-
export type { ${Name}Props } from './${name}';
|
|
60
|
-
`
|
|
61
|
-
};
|
|
62
|
-
return [indexFile, (0, _component().componentFile)(context), (0, _composition().compositionFile)(context), (0, _docs().docsFile)(context), (0, _test().testFile)(context)];
|
|
78
|
+
return [(0, _indexFile().indexFile)(context), (0, _component().componentFile)(context), (0, _composition().compositionFile)(context), (0, _docs().docsFile)(context), (0, _test().testFile)(context)];
|
|
79
|
+
},
|
|
80
|
+
config: {
|
|
81
|
+
'teambit.envs/envs': {
|
|
82
|
+
env: 'teambit.react/react'
|
|
83
|
+
}
|
|
63
84
|
}
|
|
64
85
|
};
|
|
65
86
|
exports.reactComponent = reactComponent;
|
|
66
|
-
|
|
87
|
+
|
|
88
|
+
const deprecatedReactComponent = _objectSpread(_objectSpread({}, reactComponent), {}, {
|
|
67
89
|
name: 'react-component',
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
const {
|
|
72
|
-
name,
|
|
73
|
-
namePascalCase: Name
|
|
74
|
-
} = context;
|
|
75
|
-
const indexFile = {
|
|
76
|
-
relativePath: 'index.ts',
|
|
77
|
-
content: `export { ${Name} } from './${name}';
|
|
78
|
-
export type { ${Name}Props } from './${name}';
|
|
79
|
-
`
|
|
80
|
-
};
|
|
81
|
-
return [indexFile, (0, _component().componentFile)(context), (0, _composition().compositionFile)(context), (0, _docs().docsFile)(context), (0, _test().testFile)(context)];
|
|
82
|
-
}
|
|
83
|
-
};
|
|
90
|
+
hidden: true
|
|
91
|
+
});
|
|
92
|
+
|
|
84
93
|
exports.deprecatedReactComponent = deprecatedReactComponent;
|
|
85
94
|
|
|
86
95
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["index.ts"],"names":["reactComponent","name","description","generateFiles","context","
|
|
1
|
+
{"version":3,"sources":["index.ts"],"names":["reactComponent","name","description","generateFiles","context","config","env","deprecatedReactComponent","hidden"],"mappings":";;;;;;;;;;;;;;;;;;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;;;;;AAEO,MAAMA,cAAiC,GAAG;AAC/CC,EAAAA,IAAI,EAAE,OADyC;AAE/CC,EAAAA,WAAW,EAAE,yBAFkC;AAG/CC,EAAAA,aAAa,EAAGC,OAAD,IAA+B;AAC5C,WAAO,CAAC,4BAAUA,OAAV,CAAD,EAAqB,gCAAcA,OAAd,CAArB,EAA6C,oCAAgBA,OAAhB,CAA7C,EAAuE,sBAASA,OAAT,CAAvE,EAA0F,sBAASA,OAAT,CAA1F,CAAP;AACD,GAL8C;AAM/CC,EAAAA,MAAM,EAAE;AACN,yBAAqB;AACnBC,MAAAA,GAAG,EAAE;AADc;AADf;AANuC,CAA1C;;;AAaA,MAAMC,wBAA2C,mCACnDP,cADmD;AAEtDC,EAAAA,IAAI,EAAE,iBAFgD;AAGtDO,EAAAA,MAAM,EAAE;AAH8C,EAAjD","sourcesContent":["import { ComponentTemplate, ComponentContext } from '@teambit/generator';\nimport { componentFile } from './files/component';\nimport { compositionFile } from './files/composition';\nimport { docsFile } from './files/docs';\nimport { testFile } from './files/test';\nimport { indexFile } from './files/index-file';\n\nexport const reactComponent: ComponentTemplate = {\n name: 'react',\n description: 'a basic react component',\n generateFiles: (context: ComponentContext) => {\n return [indexFile(context), componentFile(context), compositionFile(context), docsFile(context), testFile(context)];\n },\n config: {\n 'teambit.envs/envs': {\n env: 'teambit.react/react',\n },\n }\n};\n\nexport const deprecatedReactComponent: ComponentTemplate = {\n ...reactComponent,\n name: 'react-component',\n hidden: true\n};\n"]}
|
|
@@ -1,10 +1,22 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
3
5
|
Object.defineProperty(exports, "__esModule", {
|
|
4
6
|
value: true
|
|
5
7
|
});
|
|
6
8
|
exports.reactComponentJS = exports.deprecatedReactComponentJS = void 0;
|
|
7
9
|
|
|
10
|
+
function _defineProperty2() {
|
|
11
|
+
const data = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
12
|
+
|
|
13
|
+
_defineProperty2 = function () {
|
|
14
|
+
return data;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
return data;
|
|
18
|
+
}
|
|
19
|
+
|
|
8
20
|
function _component() {
|
|
9
21
|
const data = require("./files/component");
|
|
10
22
|
|
|
@@ -45,6 +57,10 @@ function _test() {
|
|
|
45
57
|
return data;
|
|
46
58
|
}
|
|
47
59
|
|
|
60
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
61
|
+
|
|
62
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2().default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
63
|
+
|
|
48
64
|
const reactComponentJS = {
|
|
49
65
|
name: 'react-js',
|
|
50
66
|
description: 'a basic react component in js',
|
|
@@ -59,26 +75,20 @@ const reactComponentJS = {
|
|
|
59
75
|
`
|
|
60
76
|
};
|
|
61
77
|
return [indexFile, (0, _component().componentFile)(context), (0, _composition().compositionFile)(context), (0, _docs().docsFile)(context), (0, _test().testFile)(context)];
|
|
78
|
+
},
|
|
79
|
+
config: {
|
|
80
|
+
'teambit.envs/envs': {
|
|
81
|
+
env: 'teambit.react/react'
|
|
82
|
+
}
|
|
62
83
|
}
|
|
63
84
|
};
|
|
64
85
|
exports.reactComponentJS = reactComponentJS;
|
|
65
|
-
|
|
86
|
+
|
|
87
|
+
const deprecatedReactComponentJS = _objectSpread(_objectSpread({}, reactComponentJS), {}, {
|
|
66
88
|
name: 'react-component-js',
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
const {
|
|
71
|
-
name,
|
|
72
|
-
namePascalCase: Name
|
|
73
|
-
} = context;
|
|
74
|
-
const indexFile = {
|
|
75
|
-
relativePath: 'index.js',
|
|
76
|
-
content: `export { ${Name} } from './${name}';
|
|
77
|
-
`
|
|
78
|
-
};
|
|
79
|
-
return [indexFile, (0, _component().componentFile)(context), (0, _composition().compositionFile)(context), (0, _docs().docsFile)(context), (0, _test().testFile)(context)];
|
|
80
|
-
}
|
|
81
|
-
};
|
|
89
|
+
hidden: true
|
|
90
|
+
});
|
|
91
|
+
|
|
82
92
|
exports.deprecatedReactComponentJS = deprecatedReactComponentJS;
|
|
83
93
|
|
|
84
94
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["index.ts"],"names":["reactComponentJS","name","description","generateFiles","context","namePascalCase","Name","indexFile","relativePath","content","deprecatedReactComponentJS","hidden"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["index.ts"],"names":["reactComponentJS","name","description","generateFiles","context","namePascalCase","Name","indexFile","relativePath","content","config","env","deprecatedReactComponentJS","hidden"],"mappings":";;;;;;;;;;;;;;;;;;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;;;;;AAEO,MAAMA,gBAAmC,GAAG;AACjDC,EAAAA,IAAI,EAAE,UAD2C;AAEjDC,EAAAA,WAAW,EAAE,+BAFoC;AAIjDC,EAAAA,aAAa,EAAGC,OAAD,IAA+B;AAC5C,UAAM;AAAEH,MAAAA,IAAF;AAAQI,MAAAA,cAAc,EAAEC;AAAxB,QAAiCF,OAAvC;AACA,UAAMG,SAAS,GAAG;AAChBC,MAAAA,YAAY,EAAE,UADE;AAEhBC,MAAAA,OAAO,EAAG,YAAWH,IAAK,cAAaL,IAAK;AAClD;AAHsB,KAAlB;AAKA,WAAO,CAACM,SAAD,EAAY,gCAAcH,OAAd,CAAZ,EAAoC,oCAAgBA,OAAhB,CAApC,EAA8D,sBAASA,OAAT,CAA9D,EAAiF,sBAASA,OAAT,CAAjF,CAAP;AACD,GAZgD;AAajDM,EAAAA,MAAM,EAAE;AACN,yBAAqB;AACnBC,MAAAA,GAAG,EAAE;AADc;AADf;AAbyC,CAA5C;;;AAoBA,MAAMC,0BAA6C,mCACrDZ,gBADqD;AAExDC,EAAAA,IAAI,EAAE,oBAFkD;AAGxDY,EAAAA,MAAM,EAAE;AAHgD,EAAnD","sourcesContent":["import { ComponentTemplate, ComponentContext } from '@teambit/generator';\nimport { componentFile } from './files/component';\nimport { compositionFile } from './files/composition';\nimport { docsFile } from './files/docs';\nimport { testFile } from './files/test';\n\nexport const reactComponentJS: ComponentTemplate = {\n name: 'react-js',\n description: 'a basic react component in js',\n\n generateFiles: (context: ComponentContext) => {\n const { name, namePascalCase: Name } = context;\n const indexFile = {\n relativePath: 'index.js',\n content: `export { ${Name} } from './${name}';\n`,\n };\n return [indexFile, componentFile(context), compositionFile(context), docsFile(context), testFile(context)];\n },\n config: {\n 'teambit.envs/envs': {\n env: 'teambit.react/react',\n },\n }\n};\n\nexport const deprecatedReactComponentJS: ComponentTemplate = {\n ...reactComponentJS,\n name: 'react-component-js',\n hidden: true,\n};\n"]}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.indexFile = void 0;
|
|
7
|
+
|
|
8
|
+
const indexFile = context => {
|
|
9
|
+
const {
|
|
10
|
+
name,
|
|
11
|
+
namePascalCase: Name
|
|
12
|
+
} = context;
|
|
13
|
+
return {
|
|
14
|
+
relativePath: 'index.ts',
|
|
15
|
+
content: `export { ${Name}Context } from './${name}-context';
|
|
16
|
+
export type { ${Name}ContextType } from './${name}-context';
|
|
17
|
+
export { ${Name}Provider } from './${name}-context-provider';
|
|
18
|
+
export type { ${Name}ProviderProps } from './${name}-context-provider';
|
|
19
|
+
`
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
exports.indexFile = indexFile;
|
|
24
|
+
|
|
25
|
+
//# sourceMappingURL=index-file.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["index-file.ts"],"names":["indexFile","context","name","namePascalCase","Name","relativePath","content"],"mappings":";;;;;;;AAEO,MAAMA,SAAS,GAAIC,OAAD,IAA+B;AACtD,QAAM;AAAEC,IAAAA,IAAF;AAAQC,IAAAA,cAAc,EAAEC;AAAxB,MAAiCH,OAAvC;AAEA,SAAO;AACLI,IAAAA,YAAY,EAAE,UADT;AAELC,IAAAA,OAAO,EAAG,YAAWF,IAAK,qBAAoBF,IAAK;AACvD,gBAAgBE,IAAK,yBAAwBF,IAAK;AAClD,WAAWE,IAAK,sBAAqBF,IAAK;AAC1C,gBAAgBE,IAAK,2BAA0BF,IAAK;AACpD;AANS,GAAP;AAQD,CAXM","sourcesContent":["import { ComponentContext } from '@teambit/generator';\n\nexport const indexFile = (context: ComponentContext) => {\n const { name, namePascalCase: Name } = context;\n\n return {\n relativePath: 'index.ts',\n content: `export { ${Name}Context } from './${name}-context';\nexport type { ${Name}ContextType } from './${name}-context';\nexport { ${Name}Provider } from './${name}-context-provider';\nexport type { ${Name}ProviderProps } from './${name}-context-provider';\n`,\n };\n}\n"]}
|
|
@@ -55,23 +55,26 @@ function _test() {
|
|
|
55
55
|
return data;
|
|
56
56
|
}
|
|
57
57
|
|
|
58
|
+
function _indexFile() {
|
|
59
|
+
const data = require("./files/index-file");
|
|
60
|
+
|
|
61
|
+
_indexFile = function () {
|
|
62
|
+
return data;
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
return data;
|
|
66
|
+
}
|
|
67
|
+
|
|
58
68
|
const reactContext = {
|
|
59
69
|
name: 'react-context',
|
|
60
70
|
description: 'a react context component',
|
|
61
71
|
generateFiles: context => {
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
content: `export { ${Name}Context } from './${name}-context';
|
|
69
|
-
export type { ${Name}ContextType } from './${name}-context';
|
|
70
|
-
export { ${Name}Provider } from './${name}-context-provider';
|
|
71
|
-
export type { ${Name}ProviderProps } from './${name}-context-provider';
|
|
72
|
-
`
|
|
73
|
-
};
|
|
74
|
-
return [indexFile, (0, _context().contextFile)(context), (0, _contextProvider().contextProviderFile)(context), (0, _composition().compositionFile)(context), (0, _docs().docsFile)(context), (0, _test().testFile)(context)];
|
|
72
|
+
return [(0, _indexFile().indexFile)(context), (0, _context().contextFile)(context), (0, _contextProvider().contextProviderFile)(context), (0, _composition().compositionFile)(context), (0, _docs().docsFile)(context), (0, _test().testFile)(context)];
|
|
73
|
+
},
|
|
74
|
+
config: {
|
|
75
|
+
'teambit.envs/envs': {
|
|
76
|
+
env: 'teambit.react/react'
|
|
77
|
+
}
|
|
75
78
|
}
|
|
76
79
|
};
|
|
77
80
|
exports.reactContext = reactContext;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["index.ts"],"names":["reactContext","name","description","generateFiles","context","
|
|
1
|
+
{"version":3,"sources":["index.ts"],"names":["reactContext","name","description","generateFiles","context","config","env"],"mappings":";;;;;;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAEO,MAAMA,YAA+B,GAAG;AAC7CC,EAAAA,IAAI,EAAE,eADuC;AAE7CC,EAAAA,WAAW,EAAE,2BAFgC;AAI7CC,EAAAA,aAAa,EAAGC,OAAD,IAA+B;AAC5C,WAAO,CACL,4BAAUA,OAAV,CADK,EAEL,4BAAYA,OAAZ,CAFK,EAGL,4CAAoBA,OAApB,CAHK,EAIL,oCAAgBA,OAAhB,CAJK,EAKL,sBAASA,OAAT,CALK,EAML,sBAASA,OAAT,CANK,CAAP;AAQD,GAb4C;AAc7CC,EAAAA,MAAM,EAAE;AACN,yBAAqB;AACnBC,MAAAA,GAAG,EAAE;AADc;AADf;AAdqC,CAAxC","sourcesContent":["import { ComponentTemplate, ComponentContext } from '@teambit/generator';\nimport { contextFile } from './files/context';\nimport { contextProviderFile } from './files/context-provider';\nimport { compositionFile } from './files/composition';\nimport { docsFile } from './files/docs';\nimport { testFile } from './files/test';\nimport { indexFile } from './files/index-file';\n\nexport const reactContext: ComponentTemplate = {\n name: 'react-context',\n description: 'a react context component',\n\n generateFiles: (context: ComponentContext) => {\n return [\n indexFile(context),\n contextFile(context),\n contextProviderFile(context),\n compositionFile(context),\n docsFile(context),\n testFile(context),\n ];\n },\n config: {\n 'teambit.envs/envs': {\n env: 'teambit.react/react',\n },\n }\n};\n"]}
|
|
@@ -115,6 +115,11 @@ const reactEnvTemplate = {
|
|
|
115
115
|
relativePath: `jest/jest.config.js`,
|
|
116
116
|
content: (0, _jest().jestConfigFile)()
|
|
117
117
|
}];
|
|
118
|
+
},
|
|
119
|
+
config: {
|
|
120
|
+
'teambit.envs/envs': {
|
|
121
|
+
env: 'teambit.envs/env'
|
|
122
|
+
}
|
|
118
123
|
}
|
|
119
124
|
};
|
|
120
125
|
exports.reactEnvTemplate = reactEnvTemplate;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["index.ts"],"names":["reactEnvTemplate","name","description","generateFiles","context","relativePath","content","isMain"],"mappings":";;;;;;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAEO,MAAMA,gBAAmC,GAAG;AACjDC,EAAAA,IAAI,EAAE,WAD2C;AAEjDC,EAAAA,WAAW,EAAE,0DAFoC;AAGjDC,EAAAA,aAAa,EAAGC,OAAD,IAA+B;AAC5C,WAAO,CACL;AACEC,MAAAA,YAAY,EAAE,UADhB;AAEEC,MAAAA,OAAO,EAAE,wBAAUF,OAAV,CAFX;AAGEG,MAAAA,MAAM,EAAE;AAHV,KADK,EAML;AACEF,MAAAA,YAAY,EAAG,GAAED,OAAO,CAACH,IAAK,WADhC;AAEEK,MAAAA,OAAO,EAAE,oBAAQF,OAAR;AAFX,KANK,EAUL;AACEC,MAAAA,YAAY,EAAG,GAAED,OAAO,CAACH,IAAK,kBADhC;AAEEK,MAAAA,OAAO,EAAE,6BAAgBF,OAAhB;AAFX,KAVK,EAcL;AACEC,MAAAA,YAAY,EAAG,GAAED,OAAO,CAACH,IAAK,qBADhC;AAEEK,MAAAA,OAAO,EAAE,mCAAmBF,OAAnB;AAFX,KAdK,EAkBL;AACEC,MAAAA,YAAY,EAAG,GAAED,OAAO,CAACH,IAAK,YADhC;AAEEK,MAAAA,OAAO,EAAE,0BAAWF,OAAX;AAFX,KAlBK,EAsBL;AACEC,MAAAA,YAAY,EAAG,iCADjB;AAEEC,MAAAA,OAAO,EAAE;AAFX,KAtBK,EA0BL;AACED,MAAAA,YAAY,EAAG,0BADjB;AAEEC,MAAAA,OAAO,EAAE;AAFX,KA1BK,EA8BL;AACED,MAAAA,YAAY,EAAG,qBADjB;AAEEC,MAAAA,OAAO,EAAE;AAFX,KA9BK,CAAP;AAmCD;
|
|
1
|
+
{"version":3,"sources":["index.ts"],"names":["reactEnvTemplate","name","description","generateFiles","context","relativePath","content","isMain","config","env"],"mappings":";;;;;;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAEO,MAAMA,gBAAmC,GAAG;AACjDC,EAAAA,IAAI,EAAE,WAD2C;AAEjDC,EAAAA,WAAW,EAAE,0DAFoC;AAGjDC,EAAAA,aAAa,EAAGC,OAAD,IAA+B;AAC5C,WAAO,CACL;AACEC,MAAAA,YAAY,EAAE,UADhB;AAEEC,MAAAA,OAAO,EAAE,wBAAUF,OAAV,CAFX;AAGEG,MAAAA,MAAM,EAAE;AAHV,KADK,EAML;AACEF,MAAAA,YAAY,EAAG,GAAED,OAAO,CAACH,IAAK,WADhC;AAEEK,MAAAA,OAAO,EAAE,oBAAQF,OAAR;AAFX,KANK,EAUL;AACEC,MAAAA,YAAY,EAAG,GAAED,OAAO,CAACH,IAAK,kBADhC;AAEEK,MAAAA,OAAO,EAAE,6BAAgBF,OAAhB;AAFX,KAVK,EAcL;AACEC,MAAAA,YAAY,EAAG,GAAED,OAAO,CAACH,IAAK,qBADhC;AAEEK,MAAAA,OAAO,EAAE,mCAAmBF,OAAnB;AAFX,KAdK,EAkBL;AACEC,MAAAA,YAAY,EAAG,GAAED,OAAO,CAACH,IAAK,YADhC;AAEEK,MAAAA,OAAO,EAAE,0BAAWF,OAAX;AAFX,KAlBK,EAsBL;AACEC,MAAAA,YAAY,EAAG,iCADjB;AAEEC,MAAAA,OAAO,EAAE;AAFX,KAtBK,EA0BL;AACED,MAAAA,YAAY,EAAG,0BADjB;AAEEC,MAAAA,OAAO,EAAE;AAFX,KA1BK,EA8BL;AACED,MAAAA,YAAY,EAAG,qBADjB;AAEEC,MAAAA,OAAO,EAAE;AAFX,KA9BK,CAAP;AAmCD,GAvCgD;AAwCjDE,EAAAA,MAAM,EAAE;AACN,yBAAqB;AACnBC,MAAAA,GAAG,EAAE;AADc;AADf;AAxCyC,CAA5C","sourcesContent":["import { ComponentContext, ComponentTemplate } from '@teambit/generator';\nimport { indexFile } from './files/index';\nimport { docFile } from './files/doc';\nimport { mainRuntimeFile } from './files/main.runtime';\nimport { previewRuntimeFile } from './files/preview.runtime';\nimport { aspectFile } from './files/aspect';\nimport { webpackConfigFile } from './files/webpack.config';\nimport { typescriptConfigFile } from './files/typescript.config';\nimport { jestConfigFile } from './files/jest.config';\n\nexport const reactEnvTemplate: ComponentTemplate = {\n name: 'react-env',\n description: 'customize the base React env with your configs and tools',\n generateFiles: (context: ComponentContext) => {\n return [\n {\n relativePath: 'index.ts',\n content: indexFile(context),\n isMain: true,\n },\n {\n relativePath: `${context.name}.docs.mdx`,\n content: docFile(context),\n },\n {\n relativePath: `${context.name}.main.runtime.ts`,\n content: mainRuntimeFile(context),\n },\n {\n relativePath: `${context.name}.preview.runtime.ts`,\n content: previewRuntimeFile(context),\n },\n {\n relativePath: `${context.name}.aspect.ts`,\n content: aspectFile(context),\n },\n {\n relativePath: `webpack/webpack-transformers.ts`,\n content: webpackConfigFile(),\n },\n {\n relativePath: `typescript/tsconfig.json`,\n content: typescriptConfigFile(),\n },\n {\n relativePath: `jest/jest.config.js`,\n content: jestConfigFile(),\n },\n ];\n },\n config: {\n 'teambit.envs/envs': {\n env: 'teambit.envs/env',\n },\n }\n};\n"]}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.indexFile = void 0;
|
|
7
|
+
|
|
8
|
+
const indexFile = context => {
|
|
9
|
+
const {
|
|
10
|
+
name,
|
|
11
|
+
namePascalCase: Name
|
|
12
|
+
} = context;
|
|
13
|
+
return {
|
|
14
|
+
relativePath: 'index.ts',
|
|
15
|
+
content: `export { ${Name} } from './${name}';
|
|
16
|
+
`
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
exports.indexFile = indexFile;
|
|
21
|
+
|
|
22
|
+
//# sourceMappingURL=index-file.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["index-file.ts"],"names":["indexFile","context","name","namePascalCase","Name","relativePath","content"],"mappings":";;;;;;;AAEO,MAAMA,SAAS,GAAIC,OAAD,IAA+B;AACtD,QAAM;AAAEC,IAAAA,IAAF;AAAQC,IAAAA,cAAc,EAAEC;AAAxB,MAAiCH,OAAvC;AAEA,SAAO;AACLI,IAAAA,YAAY,EAAE,UADT;AAELC,IAAAA,OAAO,EAAG,YAAWF,IAAK,cAAaF,IAAK;AAChD;AAHS,GAAP;AAKD,CARM","sourcesContent":["import { ComponentContext } from '@teambit/generator';\n\nexport const indexFile = (context: ComponentContext) => {\n const { name, namePascalCase: Name } = context;\n\n return {\n relativePath: 'index.ts',\n content: `export { ${Name} } from './${name}';\n`,\n };\n}\n"]}
|
|
@@ -45,20 +45,26 @@ function _test() {
|
|
|
45
45
|
return data;
|
|
46
46
|
}
|
|
47
47
|
|
|
48
|
+
function _indexFile() {
|
|
49
|
+
const data = require("./files/index-file");
|
|
50
|
+
|
|
51
|
+
_indexFile = function () {
|
|
52
|
+
return data;
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
return data;
|
|
56
|
+
}
|
|
57
|
+
|
|
48
58
|
const reactHook = {
|
|
49
59
|
name: 'react-hook',
|
|
50
60
|
description: 'a react hook component',
|
|
51
61
|
generateFiles: context => {
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
content: `export { ${Name} } from './${name}';
|
|
59
|
-
`
|
|
60
|
-
};
|
|
61
|
-
return [indexFile, (0, _component().componentFile)(context), (0, _composition().compositionFile)(context), (0, _docs().docsFile)(context), (0, _test().testFile)(context)];
|
|
62
|
+
return [(0, _indexFile().indexFile)(context), (0, _component().componentFile)(context), (0, _composition().compositionFile)(context), (0, _docs().docsFile)(context), (0, _test().testFile)(context)];
|
|
63
|
+
},
|
|
64
|
+
config: {
|
|
65
|
+
'teambit.envs/envs': {
|
|
66
|
+
env: 'teambit.react/react'
|
|
67
|
+
}
|
|
62
68
|
}
|
|
63
69
|
};
|
|
64
70
|
exports.reactHook = reactHook;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["index.ts"],"names":["reactHook","name","description","generateFiles","context","
|
|
1
|
+
{"version":3,"sources":["index.ts"],"names":["reactHook","name","description","generateFiles","context","config","env"],"mappings":";;;;;;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAEO,MAAMA,SAA4B,GAAG;AAC1CC,EAAAA,IAAI,EAAE,YADoC;AAE1CC,EAAAA,WAAW,EAAE,wBAF6B;AAI1CC,EAAAA,aAAa,EAAGC,OAAD,IAA+B;AAC5C,WAAO,CAAC,4BAAUA,OAAV,CAAD,EAAqB,gCAAcA,OAAd,CAArB,EAA6C,oCAAgBA,OAAhB,CAA7C,EAAuE,sBAASA,OAAT,CAAvE,EAA0F,sBAASA,OAAT,CAA1F,CAAP;AACD,GANyC;AAO1CC,EAAAA,MAAM,EAAE;AACN,yBAAqB;AACnBC,MAAAA,GAAG,EAAE;AADc;AADf;AAPkC,CAArC","sourcesContent":["import { ComponentTemplate, ComponentContext } from '@teambit/generator';\nimport { componentFile } from './files/component';\nimport { compositionFile } from './files/composition';\nimport { docsFile } from './files/docs';\nimport { testFile } from './files/test';\nimport { indexFile } from './files/index-file';\n\nexport const reactHook: ComponentTemplate = {\n name: 'react-hook',\n description: 'a react hook component',\n\n generateFiles: (context: ComponentContext) => {\n return [indexFile(context), componentFile(context), compositionFile(context), docsFile(context), testFile(context)];\n },\n config: {\n 'teambit.envs/envs': {\n env: 'teambit.react/react',\n },\n }\n};\n"]}
|