@teambit/react 0.0.551 → 0.0.556
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/dist/mount.d.ts +5 -0
- package/dist/react-app-options.d.ts +25 -0
- package/dist/react.env.d.ts +87 -1
- package/dist/react.main.runtime.d.ts +89 -1
- package/package.json +49 -43
- package/compositions-app.tsx +0 -31
- package/eslint/eslintrc.js +0 -12
- package/highlighter-widget.tsx +0 -19
- package/index.ts +0 -9
- package/jest/css-transform.js +0 -12
- package/jest/file-transform.js +0 -38
- package/jest/jest.config.js +0 -30
- package/jest/setupTests.js +0 -7
- package/jest/transformer.js +0 -41
- package/mount.tsx +0 -17
- package/package-tar/teambit-react-0.0.551.tgz +0 -0
- package/prettier/prettier.config.js +0 -5
- package/react-app-options.ts +0 -45
- package/react.app-type.ts +0 -19
- package/react.application.ts +0 -96
- package/react.aspect.ts +0 -5
- package/react.composition.tsx +0 -7
- package/react.docs.mdx +0 -8
- package/react.env.ts +0 -363
- package/react.graphql.ts +0 -52
- package/react.main.runtime.ts +0 -437
- package/react.preview.runtime.ts +0 -44
- package/react.templates.ts +0 -29
- package/react.ui.runtime.tsx +0 -35
- package/templates/react-app/files/app-root.ts +0 -10
- package/templates/react-app/files/app.ts +0 -30
- package/templates/react-app/files/aspect.ts +0 -10
- package/templates/react-app/files/compositions.ts +0 -11
- package/templates/react-app/files/doc.ts +0 -29
- package/templates/react-app/files/index.ts +0 -10
- package/templates/react-app/files/main.runtime.ts +0 -22
- package/templates/react-app/index.ts +0 -47
- package/templates/react-component/files/component.ts +0 -25
- package/templates/react-component/files/composition.ts +0 -16
- package/templates/react-component/files/docs.ts +0 -32
- package/templates/react-component/files/test.ts +0 -19
- package/templates/react-component/index.ts +0 -40
- package/templates/react-component-js/files/component.ts +0 -18
- package/templates/react-component-js/files/composition.ts +0 -16
- package/templates/react-component-js/files/docs.ts +0 -32
- package/templates/react-component-js/files/test.ts +0 -21
- package/templates/react-component-js/index.ts +0 -38
- package/templates/react-context/files/composition.ts +0 -27
- package/templates/react-context/files/context-provider.ts +0 -27
- package/templates/react-context/files/context.ts +0 -21
- package/templates/react-context/files/docs.ts +0 -51
- package/templates/react-context/files/test.ts +0 -18
- package/templates/react-context/index.ts +0 -32
- package/templates/react-env/files/aspect.ts +0 -10
- package/templates/react-env/files/doc.ts +0 -163
- package/templates/react-env/files/index.ts +0 -10
- package/templates/react-env/files/jest.config.ts +0 -21
- package/templates/react-env/files/main.runtime.ts +0 -84
- package/templates/react-env/files/preview.runtime.ts +0 -27
- package/templates/react-env/files/typescript.config.ts +0 -21
- package/templates/react-env/files/webpack.config.ts +0 -48
- package/templates/react-env/index.ts +0 -51
- package/templates/react-hook/files/component.ts +0 -16
- package/templates/react-hook/files/composition.ts +0 -23
- package/templates/react-hook/files/docs.ts +0 -33
- package/templates/react-hook/files/test.ts +0 -20
- package/templates/react-hook/index.ts +0 -21
- package/templates/react-workspace/index.ts +0 -27
- package/templates/react-workspace-app/index.ts +0 -20
- package/templates/react-workspace-deprecated/index.ts +0 -28
- package/templates/react-workspace-lib/index.ts +0 -21
- package/templates/workspace-common/files/eslint-config.ts +0 -6
- package/templates/workspace-common/files/git-ignore.ts +0 -113
- package/templates/workspace-common/files/prettier-config.ts +0 -5
- package/templates/workspace-common/files/readme-file.ts +0 -36
- package/templates/workspace-common/files/ts-config.ts +0 -7
- package/templates/workspace-common/files/types/asset.ts +0 -28
- package/templates/workspace-common/files/types/style.ts +0 -43
- package/templates/workspace-common/files/workspace-config.ts +0 -58
- package/templates/workspace-common/generate-files.ts +0 -51
- package/templates/workspace-common/index.ts +0 -1
- package/tsconfig.json +0 -35
- package/types/asset.d.ts +0 -29
- package/types/style.d.ts +0 -42
- package/typescript/asset.d.ts +0 -29
- package/typescript/style.d.ts +0 -42
- package/typescript/tsconfig.build.json +0 -22
- package/typescript/tsconfig.json +0 -18
- package/webpack/format-webpack-messages.js +0 -102
- package/webpack/launch-editor-endpoint.js +0 -8
- package/webpack/postcss.config.ts +0 -21
- package/webpack/react-hot-dev-client.js +0 -274
- package/webpack/refresh.js +0 -16
- package/webpack/webpack.config.base.prod.ts +0 -123
- package/webpack/webpack.config.base.ts +0 -365
- package/webpack/webpack.config.component.dev.ts +0 -104
- package/webpack/webpack.config.component.prod.ts +0 -39
- package/webpack/webpack.config.env.dev.ts +0 -21
package/dist/mount.d.ts
CHANGED
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { RenderingContext } from '@teambit/preview';
|
|
3
3
|
declare const _default: (Composition: React.ComponentType, previewContext: RenderingContext) => void;
|
|
4
|
+
/**
|
|
5
|
+
* this mounts compositions into the DOM in the component preview.
|
|
6
|
+
* this function can be overridden through ReactAspect.overrideCompositionsMounter() API
|
|
7
|
+
* to apply custom logic for component DOM mounting.
|
|
8
|
+
*/
|
|
4
9
|
export default _default;
|
|
@@ -1,12 +1,37 @@
|
|
|
1
1
|
import { Bundler, DevServer } from '@teambit/bundler';
|
|
2
2
|
import { DeployContext } from '@teambit/application';
|
|
3
3
|
export declare type ReactAppOptions = {
|
|
4
|
+
/**
|
|
5
|
+
* name of the application.
|
|
6
|
+
*/
|
|
4
7
|
name: string;
|
|
8
|
+
/**
|
|
9
|
+
* path to entry files of the application.
|
|
10
|
+
*/
|
|
5
11
|
entry: string[];
|
|
12
|
+
/**
|
|
13
|
+
* use server-side rendering for the app.
|
|
14
|
+
*/
|
|
6
15
|
ssr?: boolean;
|
|
16
|
+
/**
|
|
17
|
+
* instance of bundler to use.
|
|
18
|
+
*/
|
|
7
19
|
bundler?: Bundler;
|
|
20
|
+
/**
|
|
21
|
+
* instance of dev server to use.
|
|
22
|
+
*/
|
|
8
23
|
devServer?: DevServer;
|
|
24
|
+
/**
|
|
25
|
+
* deploy function.
|
|
26
|
+
*/
|
|
9
27
|
deploy?: (context: DeployContext) => Promise<void>;
|
|
28
|
+
/**
|
|
29
|
+
* prerender routes of application (will create static file for the route)
|
|
30
|
+
* e.g ['/plugins', '/learn', '/docs/quick-start]
|
|
31
|
+
*/
|
|
10
32
|
prerenderRoutes?: string[];
|
|
33
|
+
/**
|
|
34
|
+
* ranges of ports to use to run the app server.
|
|
35
|
+
*/
|
|
11
36
|
portRange?: number[];
|
|
12
37
|
};
|
package/dist/react.env.d.ts
CHANGED
|
@@ -19,38 +19,121 @@ export declare const AspectEnvType = "react";
|
|
|
19
19
|
declare type GetBuildPipeModifiers = PipeServiceModifiersMap & {
|
|
20
20
|
tsModifier?: PipeServiceModifier;
|
|
21
21
|
};
|
|
22
|
+
/**
|
|
23
|
+
* a component environment built for [React](https://reactjs.org) .
|
|
24
|
+
*/
|
|
22
25
|
export declare class ReactEnv implements TesterEnv, CompilerEnv, LinterEnv, DevEnv, BuilderEnv, DependenciesEnv, PackageEnv, FormatterEnv {
|
|
26
|
+
/**
|
|
27
|
+
* jest extension
|
|
28
|
+
*/
|
|
23
29
|
private jestAspect;
|
|
30
|
+
/**
|
|
31
|
+
* typescript extension.
|
|
32
|
+
*/
|
|
24
33
|
private tsAspect;
|
|
34
|
+
/**
|
|
35
|
+
* compiler extension.
|
|
36
|
+
*/
|
|
25
37
|
private compiler;
|
|
38
|
+
/**
|
|
39
|
+
* webpack extension.
|
|
40
|
+
*/
|
|
26
41
|
private webpack;
|
|
42
|
+
/**
|
|
43
|
+
* workspace extension.
|
|
44
|
+
*/
|
|
27
45
|
private workspace;
|
|
46
|
+
/**
|
|
47
|
+
* pkg extension.
|
|
48
|
+
*/
|
|
28
49
|
private pkg;
|
|
50
|
+
/**
|
|
51
|
+
* tester extension
|
|
52
|
+
*/
|
|
29
53
|
private tester;
|
|
30
54
|
private config;
|
|
31
55
|
private eslint;
|
|
32
56
|
private prettier;
|
|
33
|
-
constructor(
|
|
57
|
+
constructor(
|
|
58
|
+
/**
|
|
59
|
+
* jest extension
|
|
60
|
+
*/
|
|
61
|
+
jestAspect: JestMain,
|
|
62
|
+
/**
|
|
63
|
+
* typescript extension.
|
|
64
|
+
*/
|
|
65
|
+
tsAspect: TypescriptMain,
|
|
66
|
+
/**
|
|
67
|
+
* compiler extension.
|
|
68
|
+
*/
|
|
69
|
+
compiler: CompilerMain,
|
|
70
|
+
/**
|
|
71
|
+
* webpack extension.
|
|
72
|
+
*/
|
|
73
|
+
webpack: WebpackMain,
|
|
74
|
+
/**
|
|
75
|
+
* workspace extension.
|
|
76
|
+
*/
|
|
77
|
+
workspace: Workspace,
|
|
78
|
+
/**
|
|
79
|
+
* pkg extension.
|
|
80
|
+
*/
|
|
81
|
+
pkg: PkgMain,
|
|
82
|
+
/**
|
|
83
|
+
* tester extension
|
|
84
|
+
*/
|
|
85
|
+
tester: TesterMain, config: ReactMainConfig, eslint: ESLintMain, prettier: PrettierMain);
|
|
34
86
|
getTsConfig(targetTsConfig?: TsConfigSourceFile): TsConfigSourceFile;
|
|
35
87
|
getBuildTsConfig(targetTsConfig?: TsConfigSourceFile): TsConfigSourceFile;
|
|
88
|
+
/**
|
|
89
|
+
* returns a component tester.
|
|
90
|
+
*/
|
|
36
91
|
getTester(jestConfigPath: string, jestModulePath?: string): Tester;
|
|
37
92
|
private getTsCompilerOptions;
|
|
38
93
|
private getTsCompiler;
|
|
39
94
|
getCompiler(transformers?: TsConfigTransformer[], tsModule?: typeof ts): import("@teambit/compiler").Compiler;
|
|
95
|
+
/**
|
|
96
|
+
* returns and configures the component linter.
|
|
97
|
+
*/
|
|
40
98
|
getLinter(context: LinterContext, transformers?: EslintConfigTransformer[]): Linter;
|
|
99
|
+
/**
|
|
100
|
+
* returns and configures the component formatter.
|
|
101
|
+
*/
|
|
41
102
|
getFormatter(context: FormatterContext, transformers?: PrettierConfigTransformer[]): Formatter;
|
|
42
103
|
private getFileMap;
|
|
43
104
|
private writeFileMap;
|
|
105
|
+
/**
|
|
106
|
+
* required for `bit start`
|
|
107
|
+
*/
|
|
44
108
|
getDevEnvId(id?: string): string;
|
|
109
|
+
/**
|
|
110
|
+
* get a schema generator instance configured with the correct tsconfig.
|
|
111
|
+
*/
|
|
45
112
|
getSchemaExtractor(tsconfig: TsConfigSourceFile): SchemaExtractor;
|
|
113
|
+
/**
|
|
114
|
+
* returns and configures the React component dev server.
|
|
115
|
+
* required for `bit start`
|
|
116
|
+
*/
|
|
46
117
|
getDevServer(context: DevServerContext, transformers?: WebpackConfigTransformer[]): DevServer;
|
|
47
118
|
getBundler(context: BundlerContext, transformers?: WebpackConfigTransformer[]): Promise<Bundler>;
|
|
48
119
|
private getComponentsModulesDirectories;
|
|
49
120
|
private getEntriesFromWebpackConfig;
|
|
121
|
+
/**
|
|
122
|
+
* returns a path to a docs template.
|
|
123
|
+
*/
|
|
50
124
|
getDocsTemplate(): string;
|
|
51
125
|
icon: string;
|
|
126
|
+
/**
|
|
127
|
+
* returns a paths to a function which mounts a given component to DOM
|
|
128
|
+
*/
|
|
52
129
|
getMounter(): string;
|
|
130
|
+
/**
|
|
131
|
+
* define the package json properties to add to each component.
|
|
132
|
+
*/
|
|
53
133
|
getPackageJsonProps(): import("@teambit/pkg").PackageJsonProps;
|
|
134
|
+
/**
|
|
135
|
+
* adds dependencies to all configured components.
|
|
136
|
+
*/
|
|
54
137
|
getDependencies(): {
|
|
55
138
|
dependencies: {
|
|
56
139
|
react: string;
|
|
@@ -73,6 +156,9 @@ export declare class ReactEnv implements TesterEnv, CompilerEnv, LinterEnv, DevE
|
|
|
73
156
|
'react-dom': string;
|
|
74
157
|
};
|
|
75
158
|
};
|
|
159
|
+
/**
|
|
160
|
+
* returns the component build pipeline.
|
|
161
|
+
*/
|
|
76
162
|
getBuildPipe(modifiers?: GetBuildPipeModifiers): BuildTask[];
|
|
77
163
|
private getCompilerTask;
|
|
78
164
|
__getDescriptor(): Promise<{
|
|
@@ -33,8 +33,19 @@ declare type ReactDeps = [
|
|
|
33
33
|
GeneratorMain
|
|
34
34
|
];
|
|
35
35
|
export declare type ReactMainConfig = {
|
|
36
|
+
/**
|
|
37
|
+
* configure the react env compiler.
|
|
38
|
+
* can be configured to either TypeScript ('ts') or Babel ('babel').
|
|
39
|
+
*/
|
|
36
40
|
compiler: 'babel' | 'ts';
|
|
41
|
+
/**
|
|
42
|
+
* configure the component tester.
|
|
43
|
+
* can be either Jest ('jest') or Mocha ('mocha')
|
|
44
|
+
*/
|
|
37
45
|
tester: 'jest' | 'mocha';
|
|
46
|
+
/**
|
|
47
|
+
* version of React to configure.
|
|
48
|
+
*/
|
|
38
49
|
reactVersion: string;
|
|
39
50
|
};
|
|
40
51
|
export declare type UseWebpackModifiers = {
|
|
@@ -52,31 +63,108 @@ export declare type UsePrettierModifiers = {
|
|
|
52
63
|
transformers: PrettierConfigTransformer[];
|
|
53
64
|
};
|
|
54
65
|
export declare class ReactMain {
|
|
66
|
+
/**
|
|
67
|
+
* an instance of the React env.
|
|
68
|
+
*/
|
|
55
69
|
readonly reactEnv: ReactEnv;
|
|
56
70
|
private envs;
|
|
57
71
|
private application;
|
|
58
72
|
private workspace;
|
|
59
|
-
constructor(
|
|
73
|
+
constructor(
|
|
74
|
+
/**
|
|
75
|
+
* an instance of the React env.
|
|
76
|
+
*/
|
|
77
|
+
reactEnv: ReactEnv, envs: EnvsMain, application: ApplicationMain, workspace: Workspace);
|
|
60
78
|
readonly env: ReactEnv;
|
|
79
|
+
/**
|
|
80
|
+
* override the env's typescript config for both dev and build time.
|
|
81
|
+
* Replaces both overrideTsConfig (devConfig) and overrideBuildTsConfig (buildConfig)
|
|
82
|
+
*/
|
|
61
83
|
useTypescript(modifiers?: UseTypescriptModifiers, tsModule?: any): EnvTransformer;
|
|
84
|
+
/**
|
|
85
|
+
* @deprecated use useTypescript()
|
|
86
|
+
* override the TS config of the React environment.
|
|
87
|
+
* @param tsModule typeof `ts` module instance.
|
|
88
|
+
*/
|
|
62
89
|
overrideTsConfig(tsconfig?: Record<string, any>, compilerOptions?: Partial<TsCompilerOptionsWithoutTsConfig>, tsModule?: any): EnvTransformer;
|
|
90
|
+
/**
|
|
91
|
+
* Override the Bit documentation link. See docs: https://bit.dev/docs/docs/doc-templates
|
|
92
|
+
*/
|
|
63
93
|
overrideDocsTemplate(templatePath: string): EnvTransformer;
|
|
94
|
+
/**
|
|
95
|
+
* @deprecated use useTypescript()
|
|
96
|
+
* override the build tsconfig.
|
|
97
|
+
*/
|
|
64
98
|
overrideBuildTsConfig(tsconfig?: Record<string, any>, compilerOptions?: Partial<TsCompilerOptionsWithoutTsConfig>, tsModule?: any): EnvTransformer;
|
|
99
|
+
/**
|
|
100
|
+
* register a new React application.
|
|
101
|
+
*/
|
|
65
102
|
registerReactApp(options: ReactAppOptions): this;
|
|
103
|
+
/**
|
|
104
|
+
* override the env's dev server and preview webpack configurations.
|
|
105
|
+
* Replaces both overrideDevServerConfig and overridePreviewConfig
|
|
106
|
+
*/
|
|
66
107
|
useWebpack(modifiers?: UseWebpackModifiers): EnvTransformer;
|
|
108
|
+
/**
|
|
109
|
+
* An API to mutate the prettier config
|
|
110
|
+
* @param modifiers
|
|
111
|
+
* @returns
|
|
112
|
+
*/
|
|
67
113
|
useEslint(modifiers?: UseEslintModifiers): EnvTransformer;
|
|
114
|
+
/**
|
|
115
|
+
* An API to mutate the prettier config
|
|
116
|
+
* @param modifiers
|
|
117
|
+
* @returns
|
|
118
|
+
*/
|
|
68
119
|
usePrettier(modifiers?: UsePrettierModifiers): EnvTransformer;
|
|
120
|
+
/**
|
|
121
|
+
* @deprecated use useWebpack()
|
|
122
|
+
* override the dev server webpack config.
|
|
123
|
+
*/
|
|
69
124
|
overrideDevServerConfig(config: Configuration): EnvTransformer;
|
|
125
|
+
/**
|
|
126
|
+
* @deprecated use useWebpack()
|
|
127
|
+
* override the preview webpack config.
|
|
128
|
+
*/
|
|
70
129
|
overridePreviewConfig(config: Configuration): EnvTransformer;
|
|
71
130
|
overrideMounter(mounterPath: string): EnvTransformer;
|
|
131
|
+
/**
|
|
132
|
+
* create a new composition of the react environment.
|
|
133
|
+
*/
|
|
72
134
|
compose(transformers: EnvTransformer[], targetEnv?: Environment): Environment;
|
|
135
|
+
/**
|
|
136
|
+
* override the jest configuration.
|
|
137
|
+
* @param jestConfigPath {typeof jest} absolute path to jest.config.json.
|
|
138
|
+
* @param jestModulePath absolute path to jest
|
|
139
|
+
*/
|
|
73
140
|
overrideJestConfig(jestConfigPath: string, jestModulePath?: string): EnvTransformer;
|
|
141
|
+
/**
|
|
142
|
+
* override the build pipeline of the component environment.
|
|
143
|
+
*/
|
|
74
144
|
overrideBuildPipe(tasks: BuildTask[]): EnvTransformer;
|
|
145
|
+
/**
|
|
146
|
+
* override the compiler tasks inside the build pipeline of the component environment.
|
|
147
|
+
*/
|
|
75
148
|
overrideCompilerTasks(tasks: BuildTask[]): EnvTransformer;
|
|
149
|
+
/**
|
|
150
|
+
* override the dependency configuration of the component environment.
|
|
151
|
+
*/
|
|
76
152
|
overrideDependencies(dependencyPolicy: VariantPolicyConfigObject): EnvTransformer;
|
|
153
|
+
/**
|
|
154
|
+
* override the workspace compiler.
|
|
155
|
+
*/
|
|
77
156
|
overrideCompiler(compiler: Compiler): EnvTransformer;
|
|
157
|
+
/**
|
|
158
|
+
* TODO: @gilad we need to implement this.
|
|
159
|
+
*/
|
|
78
160
|
overrideEslintConfig(): void;
|
|
161
|
+
/**
|
|
162
|
+
* override the package json props of the component environment.
|
|
163
|
+
*/
|
|
79
164
|
overridePackageJsonProps(props: PackageJsonProps): EnvTransformer;
|
|
165
|
+
/**
|
|
166
|
+
* returns doc adjusted specifically for react components.
|
|
167
|
+
*/
|
|
80
168
|
getDocs(component: Component): {
|
|
81
169
|
abstract: any;
|
|
82
170
|
filePath: any;
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@teambit/react",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.556",
|
|
4
4
|
"homepage": "https://bit.dev/teambit/react/react",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"componentId": {
|
|
7
7
|
"scope": "teambit.react",
|
|
8
8
|
"name": "react",
|
|
9
|
-
"version": "0.0.
|
|
9
|
+
"version": "0.0.556"
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"react-error-boundary": "^3.0.0",
|
|
@@ -79,46 +79,46 @@
|
|
|
79
79
|
"@teambit/react.instructions.react.adding-compositions": "0.0.6",
|
|
80
80
|
"@teambit/react.instructions.react.adding-tests": "0.0.6",
|
|
81
81
|
"@teambit/design.ui.pages.standalone-not-found-page": "0.0.354",
|
|
82
|
-
"@teambit/preview": "0.0.
|
|
83
|
-
"@teambit/react.ui.error-fallback": "0.0.
|
|
84
|
-
"@teambit/react.ui.loader-fallback": "0.0.
|
|
85
|
-
"@teambit/compositions.ui.hooks.use-composition": "0.0.
|
|
82
|
+
"@teambit/preview": "0.0.556",
|
|
83
|
+
"@teambit/react.ui.error-fallback": "0.0.88",
|
|
84
|
+
"@teambit/react.ui.loader-fallback": "0.0.66",
|
|
85
|
+
"@teambit/compositions.ui.hooks.use-composition": "0.0.141",
|
|
86
86
|
"@teambit/design.ui.input.option-button": "0.0.26",
|
|
87
87
|
"@teambit/design.ui.tooltip": "0.0.352",
|
|
88
|
-
"@teambit/application": "0.0.
|
|
89
|
-
"@teambit/bundler": "0.0.
|
|
90
|
-
"@teambit/builder": "0.0.
|
|
91
|
-
"@teambit/isolator": "0.0.
|
|
92
|
-
"@teambit/toolbox.network.get-port": "0.0.
|
|
93
|
-
"@teambit/compiler": "0.0.
|
|
94
|
-
"@teambit/component.modules.component-url": "0.0.
|
|
95
|
-
"@teambit/component": "0.0.
|
|
96
|
-
"@teambit/envs": "0.0.
|
|
97
|
-
"@teambit/eslint": "0.0.
|
|
98
|
-
"@teambit/formatter": "0.0.
|
|
99
|
-
"@teambit/jest": "0.0.
|
|
100
|
-
"@teambit/linter": "0.0.
|
|
101
|
-
"@teambit/pkg": "0.0.
|
|
102
|
-
"@teambit/prettier": "0.0.
|
|
103
|
-
"@teambit/react.babel.bit-react-transformer": "0.0.
|
|
104
|
-
"@teambit/schema": "0.0.
|
|
105
|
-
"@teambit/tester": "0.0.
|
|
106
|
-
"@teambit/typescript": "0.0.
|
|
107
|
-
"@teambit/webpack": "0.0.
|
|
108
|
-
"@teambit/workspace": "0.0.
|
|
109
|
-
"@teambit/cli": "0.0.
|
|
110
|
-
"@teambit/dependency-resolver": "0.0.
|
|
111
|
-
"@teambit/generator": "0.0.
|
|
112
|
-
"@teambit/graphql": "0.0.
|
|
113
|
-
"@teambit/react.ui.highlighter-provider": "0.0.
|
|
114
|
-
"@teambit/compositions": "0.0.
|
|
115
|
-
"@teambit/ui": "0.0.
|
|
116
|
-
"@teambit/react.eslint-config-bit-react": "0.0.
|
|
117
|
-
"@teambit/mdx.modules.mdx-loader": "0.0.
|
|
118
|
-
"@teambit/webpack.modules.generate-style-loaders": "0.0.
|
|
119
|
-
"@teambit/webpack.modules.style-regexps": "0.0.
|
|
120
|
-
"@teambit/component-id": "0.0.
|
|
121
|
-
"@teambit/config": "0.0.
|
|
88
|
+
"@teambit/application": "0.0.198",
|
|
89
|
+
"@teambit/bundler": "0.0.556",
|
|
90
|
+
"@teambit/builder": "0.0.556",
|
|
91
|
+
"@teambit/isolator": "0.0.556",
|
|
92
|
+
"@teambit/toolbox.network.get-port": "0.0.91",
|
|
93
|
+
"@teambit/compiler": "0.0.556",
|
|
94
|
+
"@teambit/component.modules.component-url": "0.0.98",
|
|
95
|
+
"@teambit/component": "0.0.556",
|
|
96
|
+
"@teambit/envs": "0.0.556",
|
|
97
|
+
"@teambit/eslint": "0.0.556",
|
|
98
|
+
"@teambit/formatter": "0.0.107",
|
|
99
|
+
"@teambit/jest": "0.0.556",
|
|
100
|
+
"@teambit/linter": "0.0.556",
|
|
101
|
+
"@teambit/pkg": "0.0.556",
|
|
102
|
+
"@teambit/prettier": "0.0.107",
|
|
103
|
+
"@teambit/react.babel.bit-react-transformer": "0.0.471",
|
|
104
|
+
"@teambit/schema": "0.0.556",
|
|
105
|
+
"@teambit/tester": "0.0.556",
|
|
106
|
+
"@teambit/typescript": "0.0.556",
|
|
107
|
+
"@teambit/webpack": "0.0.556",
|
|
108
|
+
"@teambit/workspace": "0.0.556",
|
|
109
|
+
"@teambit/cli": "0.0.387",
|
|
110
|
+
"@teambit/dependency-resolver": "0.0.556",
|
|
111
|
+
"@teambit/generator": "0.0.556",
|
|
112
|
+
"@teambit/graphql": "0.0.556",
|
|
113
|
+
"@teambit/react.ui.highlighter-provider": "0.0.151",
|
|
114
|
+
"@teambit/compositions": "0.0.556",
|
|
115
|
+
"@teambit/ui": "0.0.556",
|
|
116
|
+
"@teambit/react.eslint-config-bit-react": "0.0.464",
|
|
117
|
+
"@teambit/mdx.modules.mdx-loader": "0.0.465",
|
|
118
|
+
"@teambit/webpack.modules.generate-style-loaders": "0.0.81",
|
|
119
|
+
"@teambit/webpack.modules.style-regexps": "0.0.110",
|
|
120
|
+
"@teambit/component-id": "0.0.377",
|
|
121
|
+
"@teambit/config": "0.0.398"
|
|
122
122
|
},
|
|
123
123
|
"devDependencies": {
|
|
124
124
|
"@types/react": "^17.0.8",
|
|
@@ -133,10 +133,10 @@
|
|
|
133
133
|
"@types/mocha": "5.2.7",
|
|
134
134
|
"@types/testing-library__jest-dom": "5.9.5",
|
|
135
135
|
"@types/jest": "^26.0.0",
|
|
136
|
-
"@teambit/react.aspect-docs.react": "0.0.
|
|
136
|
+
"@teambit/react.aspect-docs.react": "0.0.106"
|
|
137
137
|
},
|
|
138
138
|
"peerDependencies": {
|
|
139
|
-
"@teambit/legacy": "1.0.
|
|
139
|
+
"@teambit/legacy": "1.0.173",
|
|
140
140
|
"react-dom": "^16.8.0 || ^17.0.0",
|
|
141
141
|
"react": "^16.8.0 || ^17.0.0"
|
|
142
142
|
},
|
|
@@ -198,11 +198,17 @@
|
|
|
198
198
|
"@types/jest": "^26.0.0"
|
|
199
199
|
},
|
|
200
200
|
"peerDependencies": {
|
|
201
|
-
"@teambit/legacy": "1.0.
|
|
201
|
+
"@teambit/legacy": "1.0.173",
|
|
202
202
|
"react-dom": "^16.8.0 || ^17.0.0",
|
|
203
203
|
"react": "^16.8.0 || ^17.0.0"
|
|
204
204
|
}
|
|
205
205
|
}
|
|
206
206
|
},
|
|
207
|
+
"files": [
|
|
208
|
+
"dist",
|
|
209
|
+
"!dist/tsconfig.tsbuildinfo",
|
|
210
|
+
"README.md",
|
|
211
|
+
"README.mdx"
|
|
212
|
+
],
|
|
207
213
|
"private": false
|
|
208
214
|
}
|
package/compositions-app.tsx
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { Composer } from '@teambit/base-ui.utils.composer';
|
|
3
|
-
import { StandaloneNotFoundPage } from '@teambit/design.ui.pages.standalone-not-found-page';
|
|
4
|
-
import { RenderingContext } from '@teambit/preview';
|
|
5
|
-
import { ErrorFallback } from '@teambit/react.ui.error-fallback';
|
|
6
|
-
import { LoaderFallback } from '@teambit/react.ui.loader-fallback';
|
|
7
|
-
import { ErrorBoundary } from 'react-error-boundary';
|
|
8
|
-
import { ReactAspect } from './react.aspect';
|
|
9
|
-
|
|
10
|
-
// 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)
|
|
11
|
-
const hideScrollbars = 'body::-webkit-scrollbar {display: none;}';
|
|
12
|
-
|
|
13
|
-
export function CompositionsApp({
|
|
14
|
-
Composition,
|
|
15
|
-
previewContext,
|
|
16
|
-
}: {
|
|
17
|
-
Composition?: React.ComponentType;
|
|
18
|
-
previewContext: RenderingContext;
|
|
19
|
-
}) {
|
|
20
|
-
const reactContext = previewContext.get(ReactAspect.id);
|
|
21
|
-
const providers = reactContext?.providers || [];
|
|
22
|
-
|
|
23
|
-
return (
|
|
24
|
-
<ErrorBoundary FallbackComponent={ErrorFallback} resetKeys={[Composition]}>
|
|
25
|
-
<Composer components={providers}>
|
|
26
|
-
<style>{hideScrollbars}</style>
|
|
27
|
-
<LoaderFallback Target={Composition} DefaultComponent={StandaloneNotFoundPage} />
|
|
28
|
-
</Composer>
|
|
29
|
-
</ErrorBoundary>
|
|
30
|
-
);
|
|
31
|
-
}
|
package/eslint/eslintrc.js
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
// Using object
|
|
2
|
-
import '@teambit/react.eslint-config-bit-react';
|
|
3
|
-
|
|
4
|
-
module.exports = {
|
|
5
|
-
extends: [require.resolve('@teambit/react.eslint-config-bit-react')],
|
|
6
|
-
parserOptions: {
|
|
7
|
-
// parser: require.resolve('@typescript-eslint/parser'),
|
|
8
|
-
// createDefaultProgram: true,
|
|
9
|
-
// resolve the env tsconfig.
|
|
10
|
-
project: require.resolve('../typescript/tsconfig.json'),
|
|
11
|
-
},
|
|
12
|
-
};
|
package/highlighter-widget.tsx
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { OptionButton } from '@teambit/design.ui.input.option-button';
|
|
3
|
-
import { Tooltip } from '@teambit/design.ui.tooltip';
|
|
4
|
-
import { usePreviewQueryParams } from '@teambit/compositions.ui.hooks.use-composition';
|
|
5
|
-
|
|
6
|
-
const PARAM_NAME = 'highlighter';
|
|
7
|
-
|
|
8
|
-
export function HighlighterWidget() {
|
|
9
|
-
const [active, setActive] = usePreviewQueryParams(PARAM_NAME);
|
|
10
|
-
|
|
11
|
-
return (
|
|
12
|
-
<Tooltip content="Component Highlighter (beta)">
|
|
13
|
-
{/* tooltip requires child with ref */}
|
|
14
|
-
<span>
|
|
15
|
-
<OptionButton icon="highlighter-toggle" onClick={() => setActive(!active)} active={active} />
|
|
16
|
-
</span>
|
|
17
|
-
</Tooltip>
|
|
18
|
-
);
|
|
19
|
-
}
|
package/index.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
export type { ReactMain, UseWebpackModifiers, UseTypescriptModifiers } from './react.main.runtime';
|
|
2
|
-
export type { ReactPreview } from './react.preview.runtime';
|
|
3
|
-
export type { ReactEnv } from './react.env';
|
|
4
|
-
export type { ReactAppOptions } from './react-app-options';
|
|
5
|
-
// Re-export it to indicate for people that extends the react env that we are using it
|
|
6
|
-
// Commented - make errors in safari - SyntaxError: Invalid regular expression: invalid group specifier name
|
|
7
|
-
// export * as styleRegexps from '@teambit/modules.style-regexps';
|
|
8
|
-
|
|
9
|
-
export { ReactAspect, ReactAspect as default } from './react.aspect';
|
package/jest/css-transform.js
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
// This is a custom Jest transformer turning style imports into empty objects.
|
|
2
|
-
// http://facebook.github.io/jest/docs/en/webpack.html
|
|
3
|
-
|
|
4
|
-
module.exports = {
|
|
5
|
-
process() {
|
|
6
|
-
return 'module.exports = {};';
|
|
7
|
-
},
|
|
8
|
-
getCacheKey() {
|
|
9
|
-
// The output is always the same.
|
|
10
|
-
return 'cssTransform';
|
|
11
|
-
},
|
|
12
|
-
};
|
package/jest/file-transform.js
DELETED
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
const path = require('path');
|
|
2
|
-
const camelcase = require('camelcase');
|
|
3
|
-
|
|
4
|
-
// This is a custom Jest transformer turning file imports into filenames.
|
|
5
|
-
// http://facebook.github.io/jest/docs/en/webpack.html
|
|
6
|
-
|
|
7
|
-
module.exports = {
|
|
8
|
-
process(src, filename) {
|
|
9
|
-
const assetFilename = JSON.stringify(path.basename(filename));
|
|
10
|
-
|
|
11
|
-
if (filename.match(/\.svg$/)) {
|
|
12
|
-
// Based on how SVGR generates a component name:
|
|
13
|
-
// https://github.com/smooth-code/svgr/blob/01b194cf967347d43d4cbe6b434404731b87cf27/packages/core/src/state.js#L6
|
|
14
|
-
const pascalCaseFilename = camelcase(path.parse(filename).name, {
|
|
15
|
-
pascalCase: true,
|
|
16
|
-
});
|
|
17
|
-
const componentName = `Svg${pascalCaseFilename}`;
|
|
18
|
-
return `const React = require('react');
|
|
19
|
-
module.exports = {
|
|
20
|
-
__esModule: true,
|
|
21
|
-
default: ${assetFilename},
|
|
22
|
-
ReactComponent: React.forwardRef(function ${componentName}(props, ref) {
|
|
23
|
-
return {
|
|
24
|
-
$$typeof: Symbol.for('react.element'),
|
|
25
|
-
type: 'svg',
|
|
26
|
-
ref: ref,
|
|
27
|
-
key: null,
|
|
28
|
-
props: Object.assign({}, props, {
|
|
29
|
-
children: ${assetFilename}
|
|
30
|
-
})
|
|
31
|
-
};
|
|
32
|
-
}),
|
|
33
|
-
};`;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
return `module.exports = ${assetFilename};`;
|
|
37
|
-
},
|
|
38
|
-
};
|
package/jest/jest.config.js
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
module.exports = {
|
|
2
|
-
// "roots": [
|
|
3
|
-
// "<rootDir>/src"
|
|
4
|
-
// ],
|
|
5
|
-
// "collectCoverageFrom": [
|
|
6
|
-
// "src/**/*.{js,jsx,ts,tsx}",
|
|
7
|
-
// "!src/**/*.d.ts"
|
|
8
|
-
// ],
|
|
9
|
-
setupFiles: [require.resolve('react-app-polyfill/jsdom')],
|
|
10
|
-
setupFilesAfterEnv: [require.resolve('./setupTests.js')],
|
|
11
|
-
// "testMatch": [
|
|
12
|
-
// "<rootDir>/src/**/__tests__/**/*.{js,jsx,ts,tsx}",
|
|
13
|
-
// "<rootDir>/src/**/*.{spec,test}.{js,jsx,ts,tsx}"
|
|
14
|
-
// ],
|
|
15
|
-
testEnvironment: require.resolve('jest-environment-jsdom'),
|
|
16
|
-
transform: {
|
|
17
|
-
'^.+\\.(js|jsx|ts|tsx)$': require.resolve('./transformer'),
|
|
18
|
-
'^.+\\.css$': require.resolve('./css-transform.js'),
|
|
19
|
-
'^(?!.*\\.(js|jsx|ts|tsx|css|json)$)': require.resolve('./file-transform.js'),
|
|
20
|
-
// '^(?!.*\\.(svg|png|jpg|jpeg|gif|webp|woff|ttf|woff2)$)': require.resolve('./file-transform.js'),
|
|
21
|
-
},
|
|
22
|
-
transformIgnorePatterns: ['[/\\\\]node_modules[/\\\\].+\\.(js|jsx|ts|tsx)$', '^.+\\.module\\.(css|sass|scss)$'],
|
|
23
|
-
modulePaths: [],
|
|
24
|
-
moduleNameMapper: {
|
|
25
|
-
'^react-native$': require.resolve('react-native-web'),
|
|
26
|
-
'^.+\\.module\\.(css|sass|scss)$': require.resolve('identity-obj-proxy'),
|
|
27
|
-
},
|
|
28
|
-
moduleFileExtensions: ['web.js', 'js', 'web.ts', 'ts', 'web.tsx', 'tsx', 'json', 'web.jsx', 'jsx', 'node'],
|
|
29
|
-
// watchPlugins: [require.resolve('jest-watch-typeahead/filename'), require.resolve('jest-watch-typeahead/testname')],
|
|
30
|
-
};
|
package/jest/setupTests.js
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
// add babel-polyfill.
|
|
2
|
-
// require('babel-polyfill');
|
|
3
|
-
// jest-dom adds custom jest matchers for asserting on DOM nodes.
|
|
4
|
-
// allows you to do things like:
|
|
5
|
-
// expect(element).toHaveTextContent(/react/i)
|
|
6
|
-
// learn more: https://github.com/testing-library/jest-dom
|
|
7
|
-
require('@testing-library/jest-dom/extend-expect');
|
package/jest/transformer.js
DELETED
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
/* eslint-disable global-require */
|
|
2
|
-
const { transform } = require('@babel/core');
|
|
3
|
-
|
|
4
|
-
const presets = [
|
|
5
|
-
require('@babel/preset-react'),
|
|
6
|
-
require('@babel/preset-typescript'),
|
|
7
|
-
require('babel-preset-jest'),
|
|
8
|
-
[
|
|
9
|
-
require('@babel/preset-env'),
|
|
10
|
-
{
|
|
11
|
-
targets: {
|
|
12
|
-
node: 12,
|
|
13
|
-
},
|
|
14
|
-
useBuiltIns: 'usage',
|
|
15
|
-
corejs: 3,
|
|
16
|
-
},
|
|
17
|
-
],
|
|
18
|
-
];
|
|
19
|
-
const plugins = [
|
|
20
|
-
[require('@babel/plugin-transform-modules-commonjs')],
|
|
21
|
-
[require('babel-plugin-transform-typescript-metadata')],
|
|
22
|
-
[require('@babel/plugin-proposal-decorators'), { legacy: true }],
|
|
23
|
-
[require('@babel/plugin-transform-runtime')],
|
|
24
|
-
[require('@babel/plugin-proposal-object-rest-spread')],
|
|
25
|
-
[require('@babel/plugin-proposal-class-properties')],
|
|
26
|
-
];
|
|
27
|
-
|
|
28
|
-
module.exports = {
|
|
29
|
-
process(src, filename) {
|
|
30
|
-
const result = transform(src, {
|
|
31
|
-
sourceMap: 'inline',
|
|
32
|
-
filename,
|
|
33
|
-
presets,
|
|
34
|
-
plugins,
|
|
35
|
-
babelrc: false,
|
|
36
|
-
configFile: false,
|
|
37
|
-
});
|
|
38
|
-
|
|
39
|
-
return result ? result.code : src;
|
|
40
|
-
},
|
|
41
|
-
};
|
package/mount.tsx
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import ReactDOM from 'react-dom';
|
|
3
|
-
import { RenderingContext } from '@teambit/preview';
|
|
4
|
-
|
|
5
|
-
import { CompositionsApp } from './compositions-app';
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* this mounts compositions into the DOM in the component preview.
|
|
9
|
-
* this function can be overridden through ReactAspect.overrideCompositionsMounter() API
|
|
10
|
-
* to apply custom logic for component DOM mounting.
|
|
11
|
-
*/
|
|
12
|
-
export default (Composition: React.ComponentType, previewContext: RenderingContext) => {
|
|
13
|
-
ReactDOM.render(
|
|
14
|
-
<CompositionsApp Composition={Composition} previewContext={previewContext} />,
|
|
15
|
-
document.getElementById('root')
|
|
16
|
-
);
|
|
17
|
-
};
|