@teambit/react 0.0.555 → 0.0.559

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 (80) hide show
  1. package/package.json +58 -43
  2. package/tsconfig.json +1 -1
  3. package/compositions-app.tsx +0 -31
  4. package/highlighter-widget.tsx +0 -19
  5. package/index.ts +0 -9
  6. package/mount.tsx +0 -17
  7. package/package-tar/teambit-react-0.0.555.tgz +0 -0
  8. package/react-app-options.ts +0 -45
  9. package/react.app-type.ts +0 -19
  10. package/react.application.ts +0 -96
  11. package/react.aspect.ts +0 -5
  12. package/react.composition.tsx +0 -7
  13. package/react.env.ts +0 -363
  14. package/react.graphql.ts +0 -52
  15. package/react.main.runtime.ts +0 -437
  16. package/react.preview.runtime.ts +0 -44
  17. package/react.templates.ts +0 -29
  18. package/react.ui.runtime.tsx +0 -35
  19. package/templates/react-app/files/app-root.ts +0 -10
  20. package/templates/react-app/files/app.ts +0 -30
  21. package/templates/react-app/files/aspect.ts +0 -10
  22. package/templates/react-app/files/compositions.ts +0 -11
  23. package/templates/react-app/files/doc.ts +0 -29
  24. package/templates/react-app/files/index.ts +0 -10
  25. package/templates/react-app/files/main.runtime.ts +0 -22
  26. package/templates/react-app/index.ts +0 -47
  27. package/templates/react-component/files/component.ts +0 -25
  28. package/templates/react-component/files/composition.ts +0 -16
  29. package/templates/react-component/files/docs.ts +0 -32
  30. package/templates/react-component/files/test.ts +0 -19
  31. package/templates/react-component/index.ts +0 -40
  32. package/templates/react-component-js/files/component.ts +0 -18
  33. package/templates/react-component-js/files/composition.ts +0 -16
  34. package/templates/react-component-js/files/docs.ts +0 -32
  35. package/templates/react-component-js/files/test.ts +0 -21
  36. package/templates/react-component-js/index.ts +0 -38
  37. package/templates/react-context/files/composition.ts +0 -27
  38. package/templates/react-context/files/context-provider.ts +0 -27
  39. package/templates/react-context/files/context.ts +0 -21
  40. package/templates/react-context/files/docs.ts +0 -51
  41. package/templates/react-context/files/test.ts +0 -18
  42. package/templates/react-context/index.ts +0 -32
  43. package/templates/react-env/files/aspect.ts +0 -10
  44. package/templates/react-env/files/doc.ts +0 -163
  45. package/templates/react-env/files/index.ts +0 -10
  46. package/templates/react-env/files/jest.config.ts +0 -21
  47. package/templates/react-env/files/main.runtime.ts +0 -84
  48. package/templates/react-env/files/preview.runtime.ts +0 -27
  49. package/templates/react-env/files/typescript.config.ts +0 -21
  50. package/templates/react-env/files/webpack.config.ts +0 -48
  51. package/templates/react-env/index.ts +0 -51
  52. package/templates/react-hook/files/component.ts +0 -16
  53. package/templates/react-hook/files/composition.ts +0 -23
  54. package/templates/react-hook/files/docs.ts +0 -33
  55. package/templates/react-hook/files/test.ts +0 -20
  56. package/templates/react-hook/index.ts +0 -21
  57. package/templates/react-workspace/index.ts +0 -27
  58. package/templates/react-workspace-app/index.ts +0 -20
  59. package/templates/react-workspace-deprecated/index.ts +0 -28
  60. package/templates/react-workspace-lib/index.ts +0 -21
  61. package/templates/workspace-common/files/eslint-config.ts +0 -6
  62. package/templates/workspace-common/files/git-ignore.ts +0 -113
  63. package/templates/workspace-common/files/prettier-config.ts +0 -5
  64. package/templates/workspace-common/files/readme-file.ts +0 -36
  65. package/templates/workspace-common/files/ts-config.ts +0 -7
  66. package/templates/workspace-common/files/types/asset.ts +0 -28
  67. package/templates/workspace-common/files/types/style.ts +0 -43
  68. package/templates/workspace-common/files/workspace-config.ts +0 -58
  69. package/templates/workspace-common/generate-files.ts +0 -51
  70. package/templates/workspace-common/index.ts +0 -1
  71. package/types/asset.d.ts +0 -29
  72. package/types/style.d.ts +0 -42
  73. package/typescript/asset.d.ts +0 -29
  74. package/typescript/style.d.ts +0 -42
  75. package/webpack/postcss.config.ts +0 -21
  76. package/webpack/webpack.config.base.prod.ts +0 -123
  77. package/webpack/webpack.config.base.ts +0 -365
  78. package/webpack/webpack.config.component.dev.ts +0 -104
  79. package/webpack/webpack.config.component.prod.ts +0 -39
  80. 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/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,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
- };
@@ -1,123 +0,0 @@
1
- import WorkboxWebpackPlugin from 'workbox-webpack-plugin';
2
- import CssMinimizerPlugin from 'css-minimizer-webpack-plugin';
3
- import TerserPlugin from 'terser-webpack-plugin';
4
- import { Configuration } from 'webpack';
5
- import { WebpackManifestPlugin } from 'webpack-manifest-plugin';
6
-
7
- // This is the production and development configuration.
8
- // It is focused on developer experience, fast rebuilds, and a minimal bundle.
9
- // eslint-disable-next-line complexity
10
- export default function (): Configuration {
11
- return {
12
- optimization: {
13
- minimize: true,
14
- minimizer: [
15
- // This is only used in production mode
16
- new TerserPlugin({
17
- terserOptions: {
18
- parse: {
19
- // We want terser to parse ecma 8 code. However, we don't want it
20
- // to apply any minification steps that turns valid ecma 5 code
21
- // into invalid ecma 5 code. This is why the 'compress' and 'output'
22
- // sections only apply transformations that are ecma 5 safe
23
- // https://github.com/facebook/create-react-app/pull/4234
24
- ecma: 8,
25
- },
26
- compress: {
27
- ecma: 5,
28
- warnings: false,
29
- // Disabled because of an issue with Uglify breaking seemingly valid code:
30
- // https://github.com/facebook/create-react-app/issues/2376
31
- // Pending further investigation:
32
- // https://github.com/mishoo/UglifyJS2/issues/2011
33
- comparisons: false,
34
- // Disabled because of an issue with Terser breaking valid code:
35
- // https://github.com/facebook/create-react-app/issues/5250
36
- // Pending further investigation:
37
- // https://github.com/terser-js/terser/issues/120
38
- inline: 2,
39
- },
40
- mangle: {
41
- safari10: true,
42
- },
43
- output: {
44
- ecma: 5,
45
- comments: false,
46
- // Turned on because emoji and regex is not minified properly using default
47
- // https://github.com/facebook/create-react-app/issues/2488
48
- ascii_only: true,
49
- },
50
- },
51
- }),
52
- new CssMinimizerPlugin({
53
- minimizerOptions: {
54
- preset: [
55
- 'default',
56
- {
57
- minifyFontValues: { removeQuotes: false },
58
- },
59
- ],
60
- },
61
- }),
62
- ],
63
- // Automatically split vendor and commons
64
- // https://twitter.com/wSokra/status/969633336732905474
65
- // https://medium.com/webpack/webpack-4-code-splitting-chunk-graph-and-the-splitchunks-optimization-be739a861366
66
- splitChunks: {
67
- chunks: 'all',
68
- // name: false,
69
- },
70
- // Keep the runtime chunk separated to enable long term caching
71
- // https://twitter.com/wSokra/status/969679223278505985
72
- // https://github.com/facebook/create-react-app/issues/5358
73
- runtimeChunk: {
74
- name: (entrypoint) => `runtime-${entrypoint.name}`,
75
- },
76
- },
77
-
78
- plugins: [
79
- // Generate an asset manifest file with the following content:
80
- // - "files" key: Mapping of all asset filenames to their corresponding
81
- // output file so that tools can pick it up without having to parse
82
- // `index.html`
83
- // can be used to reconstruct the HTML if necessary
84
- new WebpackManifestPlugin({
85
- fileName: 'asset-manifest.json',
86
- publicPath: 'public',
87
- generate: (seed, files, entrypoints) => {
88
- const manifestFiles = files.reduce((manifest, file) => {
89
- manifest[file.name] = file.path;
90
- return manifest;
91
- }, seed);
92
- const entrypointFiles = entrypoints.main.filter((fileName) => !fileName.endsWith('.map'));
93
-
94
- // @ts-ignore - https://github.com/shellscape/webpack-manifest-plugin/issues/276
95
- return {
96
- files: manifestFiles,
97
- entrypoints: entrypointFiles,
98
- } as Record<string, string>;
99
- },
100
- }),
101
- // Generate a service worker script that will precache, and keep up to date,
102
- // the HTML & assets that are part of the webpack build.
103
- new WorkboxWebpackPlugin.GenerateSW({
104
- clientsClaim: true,
105
- exclude: [/\.map$/, /asset-manifest\.json$/],
106
- // importWorkboxFrom: 'cdn',
107
- navigateFallback: 'public/index.html',
108
- navigateFallbackDenylist: [
109
- // Exclude URLs starting with /_, as they're likely an API call
110
- new RegExp('^/_'),
111
- // Exclude any URLs whose last part seems to be a file extension
112
- // as they're likely a resource and not a SPA route.
113
- // URLs containing a "?" character won't be blacklisted as they're likely
114
- // a route with query params (e.g. auth callbacks).
115
- new RegExp('/[^/?]+\\.[^/]+$'),
116
- ],
117
- }),
118
- ].filter(Boolean),
119
- // Turn off performance processing because we utilize
120
- // our own hints via the FileSizeReporter
121
- performance: false,
122
- };
123
- }