@teambit/react 0.0.555 → 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.
Files changed (94) hide show
  1. package/package.json +49 -43
  2. package/compositions-app.tsx +0 -31
  3. package/eslint/eslintrc.js +0 -12
  4. package/highlighter-widget.tsx +0 -19
  5. package/index.ts +0 -9
  6. package/jest/css-transform.js +0 -12
  7. package/jest/file-transform.js +0 -38
  8. package/jest/jest.config.js +0 -30
  9. package/jest/setupTests.js +0 -7
  10. package/jest/transformer.js +0 -41
  11. package/mount.tsx +0 -17
  12. package/package-tar/teambit-react-0.0.555.tgz +0 -0
  13. package/prettier/prettier.config.js +0 -5
  14. package/react-app-options.ts +0 -45
  15. package/react.app-type.ts +0 -19
  16. package/react.application.ts +0 -96
  17. package/react.aspect.ts +0 -5
  18. package/react.composition.tsx +0 -7
  19. package/react.docs.mdx +0 -8
  20. package/react.env.ts +0 -363
  21. package/react.graphql.ts +0 -52
  22. package/react.main.runtime.ts +0 -437
  23. package/react.preview.runtime.ts +0 -44
  24. package/react.templates.ts +0 -29
  25. package/react.ui.runtime.tsx +0 -35
  26. package/templates/react-app/files/app-root.ts +0 -10
  27. package/templates/react-app/files/app.ts +0 -30
  28. package/templates/react-app/files/aspect.ts +0 -10
  29. package/templates/react-app/files/compositions.ts +0 -11
  30. package/templates/react-app/files/doc.ts +0 -29
  31. package/templates/react-app/files/index.ts +0 -10
  32. package/templates/react-app/files/main.runtime.ts +0 -22
  33. package/templates/react-app/index.ts +0 -47
  34. package/templates/react-component/files/component.ts +0 -25
  35. package/templates/react-component/files/composition.ts +0 -16
  36. package/templates/react-component/files/docs.ts +0 -32
  37. package/templates/react-component/files/test.ts +0 -19
  38. package/templates/react-component/index.ts +0 -40
  39. package/templates/react-component-js/files/component.ts +0 -18
  40. package/templates/react-component-js/files/composition.ts +0 -16
  41. package/templates/react-component-js/files/docs.ts +0 -32
  42. package/templates/react-component-js/files/test.ts +0 -21
  43. package/templates/react-component-js/index.ts +0 -38
  44. package/templates/react-context/files/composition.ts +0 -27
  45. package/templates/react-context/files/context-provider.ts +0 -27
  46. package/templates/react-context/files/context.ts +0 -21
  47. package/templates/react-context/files/docs.ts +0 -51
  48. package/templates/react-context/files/test.ts +0 -18
  49. package/templates/react-context/index.ts +0 -32
  50. package/templates/react-env/files/aspect.ts +0 -10
  51. package/templates/react-env/files/doc.ts +0 -163
  52. package/templates/react-env/files/index.ts +0 -10
  53. package/templates/react-env/files/jest.config.ts +0 -21
  54. package/templates/react-env/files/main.runtime.ts +0 -84
  55. package/templates/react-env/files/preview.runtime.ts +0 -27
  56. package/templates/react-env/files/typescript.config.ts +0 -21
  57. package/templates/react-env/files/webpack.config.ts +0 -48
  58. package/templates/react-env/index.ts +0 -51
  59. package/templates/react-hook/files/component.ts +0 -16
  60. package/templates/react-hook/files/composition.ts +0 -23
  61. package/templates/react-hook/files/docs.ts +0 -33
  62. package/templates/react-hook/files/test.ts +0 -20
  63. package/templates/react-hook/index.ts +0 -21
  64. package/templates/react-workspace/index.ts +0 -27
  65. package/templates/react-workspace-app/index.ts +0 -20
  66. package/templates/react-workspace-deprecated/index.ts +0 -28
  67. package/templates/react-workspace-lib/index.ts +0 -21
  68. package/templates/workspace-common/files/eslint-config.ts +0 -6
  69. package/templates/workspace-common/files/git-ignore.ts +0 -113
  70. package/templates/workspace-common/files/prettier-config.ts +0 -5
  71. package/templates/workspace-common/files/readme-file.ts +0 -36
  72. package/templates/workspace-common/files/ts-config.ts +0 -7
  73. package/templates/workspace-common/files/types/asset.ts +0 -28
  74. package/templates/workspace-common/files/types/style.ts +0 -43
  75. package/templates/workspace-common/files/workspace-config.ts +0 -58
  76. package/templates/workspace-common/generate-files.ts +0 -51
  77. package/templates/workspace-common/index.ts +0 -1
  78. package/tsconfig.json +0 -34
  79. package/types/asset.d.ts +0 -29
  80. package/types/style.d.ts +0 -42
  81. package/typescript/asset.d.ts +0 -29
  82. package/typescript/style.d.ts +0 -42
  83. package/typescript/tsconfig.build.json +0 -22
  84. package/typescript/tsconfig.json +0 -18
  85. package/webpack/format-webpack-messages.js +0 -102
  86. package/webpack/launch-editor-endpoint.js +0 -8
  87. package/webpack/postcss.config.ts +0 -21
  88. package/webpack/react-hot-dev-client.js +0 -274
  89. package/webpack/refresh.js +0 -16
  90. package/webpack/webpack.config.base.prod.ts +0 -123
  91. package/webpack/webpack.config.base.ts +0 -365
  92. package/webpack/webpack.config.component.dev.ts +0 -104
  93. package/webpack/webpack.config.component.prod.ts +0 -39
  94. package/webpack/webpack.config.env.dev.ts +0 -21
@@ -1,43 +0,0 @@
1
- export const styleTypes = `declare module '*.module.css' {
2
- const classes: { readonly [key: string]: string };
3
- export default classes;
4
- }
5
- declare module '*.module.scss' {
6
- const classes: { readonly [key: string]: string };
7
- export default classes;
8
- }
9
- declare module '*.module.sass' {
10
- const classes: { readonly [key: string]: string };
11
- export default classes;
12
- }
13
-
14
- declare module '*.module.less' {
15
- const classes: { readonly [key: string]: string };
16
- export default classes;
17
- }
18
-
19
- declare module '*.less' {
20
- const classes: { readonly [key: string]: string };
21
- export default classes;
22
- }
23
-
24
- declare module '*.css' {
25
- const classes: { readonly [key: string]: string };
26
- export default classes;
27
- }
28
-
29
- declare module '*.sass' {
30
- const classes: { readonly [key: string]: string };
31
- export default classes;
32
- }
33
-
34
- declare module '*.scss' {
35
- const classes: { readonly [key: string]: string };
36
- export default classes;
37
- }
38
-
39
- declare module '*.mdx' {
40
- const component: any;
41
- export default component;
42
- }
43
- `;
@@ -1,58 +0,0 @@
1
- import { WorkspaceContext } from '@teambit/generator';
2
- import { getWorkspaceConfigTemplateParsed, stringifyWorkspaceConfig } from '@teambit/config';
3
- import { parse, assign } from 'comment-json';
4
-
5
- export async function workspaceConfig({ name, defaultScope, empty }: WorkspaceContext) {
6
- const scope = defaultScope || 'company.scope';
7
- const configParsed = await getWorkspaceConfigTemplateParsed();
8
- configParsed['teambit.workspace/workspace'].name = name;
9
- configParsed['teambit.workspace/workspace'].defaultScope = scope;
10
- configParsed['teambit.dependencies/dependency-resolver'].packageManager = 'teambit.dependencies/pnpm';
11
- configParsed['teambit.dependencies/dependency-resolver'].policy = {
12
- dependencies: {
13
- '@teambit/eslint-config-bit-react': '~0.0.367',
14
- '@typescript-eslint/eslint-plugin': '4.29.3',
15
- 'eslint-import-resolver-node': '0.3.6',
16
- 'eslint-plugin-import': '2.22.1',
17
- 'eslint-plugin-jest': '24.4.0',
18
- 'eslint-plugin-jsx-a11y': '6.4.1',
19
- 'eslint-plugin-mdx': '1.15.0',
20
- 'eslint-plugin-react': '7.25.1',
21
- },
22
- peerDependencies: {
23
- '@testing-library/react': '12.0.0',
24
- react: '17.0.2',
25
- 'react-dom': '17.0.2',
26
- },
27
- };
28
-
29
- const variants = {
30
- 'teambit.workspace/variants': empty
31
- ? {
32
- '*': {
33
- 'teambit.react/react': {},
34
- },
35
- }
36
- : parse(`{
37
- "{ui/**}, {pages/**}": {
38
- // uses the custom env
39
- "${scope}/envs/my-react": {},
40
- // uncomment the line below if you remove the custom env and remove the line above
41
- // "teambit.react/react": {},
42
- },
43
- "{themes/**}": {
44
- "teambit.react/react": {},
45
- },
46
- "{content/**}": {
47
- "teambit.mdx/mdx": {},
48
- },
49
- "{envs/**}, {extensions/**}": {
50
- "teambit.harmony/aspect": {},
51
- },
52
- }`),
53
- };
54
-
55
- const configMerged = assign(configParsed, variants);
56
-
57
- return stringifyWorkspaceConfig(configMerged);
58
- }
@@ -1,51 +0,0 @@
1
- import { WorkspaceContext } from '@teambit/generator';
2
- import { workspaceConfig } from './files/workspace-config';
3
- import { readme } from './files/readme-file';
4
- import { gitIgnore } from './files/git-ignore';
5
- import { assetTypes } from './files/types/asset';
6
- import { styleTypes } from './files/types/style';
7
- import { eslintConfig } from './files/eslint-config';
8
- import { tsConfig } from './files/ts-config';
9
- import { prettierConfig } from './files/prettier-config';
10
-
11
- type GeneratedFile = {
12
- relativePath: string;
13
- content: string;
14
- };
15
-
16
- export async function generateFiles(context: WorkspaceContext): Promise<GeneratedFile[]> {
17
- return [
18
- {
19
- relativePath: 'workspace.jsonc',
20
- content: await workspaceConfig(context),
21
- },
22
- {
23
- relativePath: `.gitignore`,
24
- content: gitIgnore(),
25
- },
26
- {
27
- relativePath: `README.md`,
28
- content: readme(),
29
- },
30
- {
31
- relativePath: `.eslintrc.js`,
32
- content: eslintConfig,
33
- },
34
- {
35
- relativePath: `tsconfig.json`,
36
- content: tsConfig,
37
- },
38
- {
39
- relativePath: `.prettierrc.js`,
40
- content: prettierConfig,
41
- },
42
- {
43
- relativePath: `types/asset.d.ts`,
44
- content: assetTypes,
45
- },
46
- {
47
- relativePath: `types/style.d.ts`,
48
- content: styleTypes,
49
- },
50
- ];
51
- }
@@ -1 +0,0 @@
1
- export { generateFiles } from './generate-files';
package/tsconfig.json DELETED
@@ -1,34 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- "lib": [
4
- "es2019",
5
- "DOM",
6
- "ES6",
7
- "DOM.Iterable",
8
- "ScriptHost"
9
- ],
10
- "target": "es2015",
11
- "module": "commonjs",
12
- "jsx": "react",
13
- "declaration": true,
14
- "sourceMap": true,
15
- "skipLibCheck": true,
16
- "moduleResolution": "node",
17
- "esModuleInterop": true,
18
- "outDir": "dist",
19
- "composite": true,
20
- "emitDeclarationOnly": true,
21
- "experimentalDecorators": true,
22
- "emitDecoratorMetadata": true,
23
- "allowSyntheticDefaultImports": true,
24
- "strictPropertyInitialization": false,
25
- "strict": true,
26
- "noImplicitAny": false,
27
- "rootDir": ".",
28
- "preserveConstEnums": true,
29
- "resolveJsonModule": true
30
- },
31
- "exclude": [
32
- "dist"
33
- ]
34
- }
package/types/asset.d.ts DELETED
@@ -1,29 +0,0 @@
1
- declare module '*.png' {
2
- const value: any;
3
- export = value;
4
- }
5
- declare module '*.svg' {
6
- import type { FunctionComponent, SVGProps } from 'react';
7
-
8
- export const ReactComponent: FunctionComponent<SVGProps<SVGSVGElement> & { title?: string }>;
9
- const src: string;
10
- export default src;
11
- }
12
-
13
- // @TODO Gilad
14
- declare module '*.jpg' {
15
- const value: any;
16
- export = value;
17
- }
18
- declare module '*.jpeg' {
19
- const value: any;
20
- export = value;
21
- }
22
- declare module '*.gif' {
23
- const value: any;
24
- export = value;
25
- }
26
- declare module '*.bmp' {
27
- const value: any;
28
- export = value;
29
- }
package/types/style.d.ts DELETED
@@ -1,42 +0,0 @@
1
- declare module '*.module.css' {
2
- const classes: { readonly [key: string]: string };
3
- export default classes;
4
- }
5
- declare module '*.module.scss' {
6
- const classes: { readonly [key: string]: string };
7
- export default classes;
8
- }
9
- declare module '*.module.sass' {
10
- const classes: { readonly [key: string]: string };
11
- export default classes;
12
- }
13
-
14
- declare module '*.module.less' {
15
- const classes: { readonly [key: string]: string };
16
- export default classes;
17
- }
18
-
19
- declare module '*.less' {
20
- const classes: { readonly [key: string]: string };
21
- export default classes;
22
- }
23
-
24
- declare module '*.css' {
25
- const classes: { readonly [key: string]: string };
26
- export default classes;
27
- }
28
-
29
- declare module '*.sass' {
30
- const classes: { readonly [key: string]: string };
31
- export default classes;
32
- }
33
-
34
- declare module '*.scss' {
35
- const classes: { readonly [key: string]: string };
36
- export default classes;
37
- }
38
-
39
- declare module '*.mdx' {
40
- const component: any;
41
- export default component;
42
- }
@@ -1,29 +0,0 @@
1
- declare module '*.png' {
2
- const value: any;
3
- export = value;
4
- }
5
- declare module '*.svg' {
6
- import type { FunctionComponent, SVGProps } from 'react';
7
-
8
- export const ReactComponent: FunctionComponent<SVGProps<SVGSVGElement> & { title?: string }>;
9
- const src: string;
10
- export default src;
11
- }
12
-
13
- // @TODO Gilad
14
- declare module '*.jpg' {
15
- const value: any;
16
- export = value;
17
- }
18
- declare module '*.jpeg' {
19
- const value: any;
20
- export = value;
21
- }
22
- declare module '*.gif' {
23
- const value: any;
24
- export = value;
25
- }
26
- declare module '*.bmp' {
27
- const value: any;
28
- export = value;
29
- }
@@ -1,42 +0,0 @@
1
- declare module '*.module.css' {
2
- const classes: { readonly [key: string]: string };
3
- export default classes;
4
- }
5
- declare module '*.module.scss' {
6
- const classes: { readonly [key: string]: string };
7
- export default classes;
8
- }
9
- declare module '*.module.sass' {
10
- const classes: { readonly [key: string]: string };
11
- export default classes;
12
- }
13
-
14
- declare module '*.module.less' {
15
- const classes: { readonly [key: string]: string };
16
- export default classes;
17
- }
18
-
19
- declare module '*.less' {
20
- const classes: { readonly [key: string]: string };
21
- export default classes;
22
- }
23
-
24
- declare module '*.css' {
25
- const classes: { readonly [key: string]: string };
26
- export default classes;
27
- }
28
-
29
- declare module '*.sass' {
30
- const classes: { readonly [key: string]: string };
31
- export default classes;
32
- }
33
-
34
- declare module '*.scss' {
35
- const classes: { readonly [key: string]: string };
36
- export default classes;
37
- }
38
-
39
- declare module '*.mdx' {
40
- const component: any;
41
- export default component;
42
- }
@@ -1,22 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- "lib": [
4
- "es2019", "DOM", "ES6" ,"DOM.Iterable"
5
- ],
6
- "target": "es2015",
7
- "module": "commonjs",
8
- "jsx": "react",
9
- "allowJs": true,
10
- "composite": true,
11
- "declaration": true,
12
- "sourceMap": true,
13
- "skipLibCheck": true,
14
- "outDir": "dist",
15
- "moduleResolution": "node",
16
- "esModuleInterop": true,
17
- "rootDir": "."
18
- },
19
- "exclude": [
20
- "dist"
21
- ]
22
- }
@@ -1,18 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- "lib": [
4
- "es2019", "DOM", "ES6" ,"DOM.Iterable"
5
- ],
6
- "target": "es2015",
7
- "module": "commonjs",
8
- "jsx": "react",
9
- "declaration": true,
10
- "sourceMap": true,
11
- "skipLibCheck": true,
12
- "moduleResolution": "node",
13
- "esModuleInterop": true
14
- },
15
- "exclude": [
16
- "dist"
17
- ]
18
- }
@@ -1,102 +0,0 @@
1
- /**
2
- * Copyright (c) 2015-present, Facebook, Inc.
3
- *
4
- * This source code is licensed under the MIT license found in the
5
- * LICENSE file in the root directory of this source tree.
6
- */
7
- const friendlySyntaxErrorLabel = 'Syntax error:';
8
-
9
- function isLikelyASyntaxError(message) {
10
- return message.indexOf(friendlySyntaxErrorLabel) !== -1;
11
- }
12
-
13
- // Cleans up webpack error messages.
14
- function formatMessage(error) {
15
- let message = error.message;
16
- let lines = message.split('\n');
17
-
18
- // Strip webpack-added headers off errors/warnings
19
- // https://github.com/webpack/webpack/blob/master/lib/ModuleError.js
20
- lines = lines.filter((line) => !/Module [A-z ]+\(from/.test(line));
21
-
22
- // Transform parsing error into syntax error
23
- // TODO: move this to our ESLint formatter?
24
- lines = lines.map((line) => {
25
- const parsingError = /Line (\d+):(?:(\d+):)?\s*Parsing error: (.+)$/.exec(line);
26
- if (!parsingError) {
27
- return line;
28
- }
29
- const [, errorLine, errorColumn, errorMessage] = parsingError;
30
- return `${friendlySyntaxErrorLabel} ${errorMessage} (${errorLine}:${errorColumn})`;
31
- });
32
-
33
- message = lines.join('\n');
34
- // Smoosh syntax errors (commonly found in CSS)
35
- message = message.replace(/SyntaxError\s+\((\d+):(\d+)\)\s*(.+?)\n/g, `${friendlySyntaxErrorLabel} $3 ($1:$2)\n`);
36
- // Clean up export errors
37
- message = message.replace(
38
- /^.*export '(.+?)' was not found in '(.+?)'.*$/gm,
39
- `Attempted import error: '$1' is not exported from '$2'.`
40
- );
41
- message = message.replace(
42
- /^.*export 'default' \(imported as '(.+?)'\) was not found in '(.+?)'.*$/gm,
43
- `Attempted import error: '$2' does not contain a default export (imported as '$1').`
44
- );
45
- message = message.replace(
46
- /^.*export '(.+?)' \(imported as '(.+?)'\) was not found in '(.+?)'.*$/gm,
47
- `Attempted import error: '$1' is not exported from '$3' (imported as '$2').`
48
- );
49
- lines = message.split('\n');
50
-
51
- // Remove leading newline
52
- if (lines.length > 2 && lines[1].trim() === '') {
53
- lines.splice(1, 1);
54
- }
55
- // Clean up file name
56
- lines[0] = lines[0].replace(/^(.*) \d+:\d+-\d+$/, '$1');
57
-
58
- // Cleans up verbose "module not found" messages for files and packages.
59
- if (lines[1] && lines[1].indexOf('Module not found: ') === 0) {
60
- lines = [
61
- lines[0],
62
- lines[1].replace('Error: ', '').replace('Module not found: Cannot find file:', 'Cannot find file:'),
63
- ];
64
- }
65
-
66
- // Add helpful message for users trying to use Sass for the first time
67
- if (lines[1] && lines[1].match(/Cannot find module.+node-sass/)) {
68
- lines[1] = 'To import Sass files, you first need to install node-sass.\n';
69
- lines[1] += 'Run `npm install node-sass` or `yarn add node-sass` inside your workspace.';
70
- }
71
-
72
- message = lines.join('\n');
73
- // Internal stacks are generally useless so we strip them... with the
74
- // exception of stacks containing `webpack:` because they're normally
75
- // from user code generated by webpack. For more information see
76
- // https://github.com/facebook/create-react-app/pull/1050
77
- message = message.replace(/^\s*at\s((?!webpack:).)*:\d+:\d+[\s)]*(\n|$)/gm, ''); // at ... ...:x:y
78
- message = message.replace(/^\s*at\s<anonymous>(\n|$)/gm, ''); // at <anonymous>
79
- lines = message.split('\n');
80
-
81
- // Remove duplicated newlines
82
- lines = lines.filter(
83
- (line, index, arr) => index === 0 || line.trim() !== '' || line.trim() !== arr[index - 1].trim()
84
- );
85
-
86
- // Reassemble the message
87
- message = lines.join('\n');
88
- return message.trim();
89
- }
90
-
91
- function formatWebpackMessages(json) {
92
- const formattedErrors = json.errors.map(formatMessage);
93
- const formattedWarnings = json.warnings.map(formatMessage);
94
- const result = { errors: formattedErrors, warnings: formattedWarnings };
95
- if (result.errors.some(isLikelyASyntaxError)) {
96
- // If there are any syntax errors, show just them.
97
- result.errors = result.errors.filter(isLikelyASyntaxError);
98
- }
99
- return result;
100
- }
101
-
102
- module.exports = formatWebpackMessages;
@@ -1,8 +0,0 @@
1
- /**
2
- * Copyright (c) 2015-present, Facebook, Inc.
3
- *
4
- * This source code is licensed under the MIT license found in the
5
- * LICENSE file in the root directory of this source tree.
6
- */
7
- // TODO: we might want to make this injectable to support DEV-time non-root URLs.
8
- module.exports = '/__open-stack-frame-in-editor';
@@ -1,21 +0,0 @@
1
-
2
- export const postCssConfig = {
3
- // Necessary for external CSS imports to work
4
- // https://github.com/facebook/create-react-app/issues/2677
5
- ident: 'postcss',
6
- plugins: [
7
- // eslint-disable-next-line global-require
8
- require.resolve('postcss-flexbugs-fixes'),
9
- // eslint-disable-next-line global-require
10
- require('postcss-preset-env')({
11
- autoprefixer: {
12
- flexbox: 'no-2009',
13
- },
14
- stage: 3,
15
- }),
16
- // Adds PostCSS Normalize as the reset css with default options,
17
- // so that it honors browserslist config in package.json
18
- // which in turn let's users customize the target behavior as per their needs.
19
- require.resolve('postcss-normalize'),
20
- ],
21
- };