@teambit/react 0.0.621 → 0.0.629
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/__compositions-1642994756471.js +7 -0
- package/__overview-1642994756471.js +7 -0
- package/__preview-1642994756471.js +2 -0
- package/apps/web/deploy-context.ts +4 -0
- package/apps/web/index.ts +3 -0
- package/apps/web/react-app-options.ts +3 -3
- package/apps/web/react-build-result.ts +9 -0
- package/apps/web/react.application.ts +32 -34
- package/artifacts/env-template/public/141.js +1 -0
- package/artifacts/env-template/public/181.js +1 -0
- package/artifacts/env-template/public/283.js +1 -0
- package/artifacts/env-template/public/664.js +128 -0
- package/artifacts/env-template/public/743.js +1 -0
- package/artifacts/env-template/public/848.js +1 -0
- package/artifacts/env-template/public/assets-manifest.json +74 -0
- package/artifacts/env-template/public/compositions.68fc39172cbc486d5064.js +1 -0
- package/artifacts/env-template/public/compositions.html +2 -0
- package/artifacts/env-template/public/overview.8ab165bb03610b2e8c5b.js +1 -0
- package/artifacts/env-template/public/overview.html +2 -0
- package/artifacts/env-template/public/peers.23d97726152f744ec115.js +1 -0
- package/artifacts/env-template/public/preview-root.b33a2fef3cb8fc3d6479.js +1 -0
- package/artifacts/env-template/public/runtime.js +1 -0
- package/artifacts/env-template/public/service-worker.js +1 -0
- package/artifacts/env-template/public/static/css/664.50460623.css +1 -0
- package/artifacts/env-template/public/static/css/compositions.cd8be53f.css +1 -0
- package/artifacts/env-template/public/static/css/overview.71e25e30.css +1 -0
- package/artifacts/env-template/public/static/css/previewRoot.5ad41161.css +1 -0
- package/artifacts/env-template/public/workbox-ca45de73.js +1 -0
- package/artifacts/preview/teambit_react_react-preview.js +1 -0
- package/dist/apps/web/deploy-context.d.ts +3 -0
- package/dist/apps/web/deploy-context.js +3 -0
- package/dist/apps/web/deploy-context.js.map +1 -0
- package/dist/apps/web/index.d.ts +3 -0
- package/dist/apps/web/index.js +23 -0
- package/dist/apps/web/index.js.map +1 -0
- package/dist/apps/web/react-app-options.d.ts +2 -3
- package/dist/apps/web/react-app-options.js +0 -10
- package/dist/apps/web/react-app-options.js.map +1 -1
- package/dist/apps/web/react-build-result.d.ts +8 -0
- package/dist/apps/web/react-build-result.js +3 -0
- package/dist/apps/web/react-build-result.js.map +1 -0
- package/dist/apps/web/react.application.d.ts +7 -7
- package/dist/apps/web/react.application.js +41 -29
- package/dist/apps/web/react.application.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js.map +1 -1
- package/dist/react.env.d.ts +10 -1
- package/dist/react.env.js +60 -8
- package/dist/react.env.js.map +1 -1
- package/dist/react.main.runtime.js +11 -11
- package/dist/react.main.runtime.js.map +1 -1
- package/dist/templates/react-app/files/app-root.js +7 -1
- package/dist/templates/react-app/files/app-root.js.map +1 -1
- package/dist/templates/react-app/files/compositions.js +1 -1
- package/dist/templates/react-app/files/compositions.js.map +1 -1
- package/dist/templates/workspace-common/files/workspace-config.js +1 -1
- package/dist/templates/workspace-common/files/workspace-config.js.map +1 -1
- package/dist/webpack/get-exposed-rules.d.ts +2 -0
- package/dist/webpack/get-exposed-rules.js +50 -0
- package/dist/webpack/get-exposed-rules.js.map +1 -0
- package/dist/webpack/get-externals.d.ts +1 -0
- package/dist/webpack/get-externals.js +42 -0
- package/dist/webpack/get-externals.js.map +1 -0
- package/dist/webpack/html.d.ts +2 -0
- package/dist/webpack/html.js +31 -0
- package/dist/webpack/html.js.map +1 -0
- package/dist/webpack/index.d.ts +1 -0
- package/dist/webpack/index.js +23 -0
- package/dist/webpack/index.js.map +1 -0
- package/dist/webpack/transformers.d.ts +2 -0
- package/dist/webpack/transformers.js +19 -0
- package/dist/webpack/transformers.js.map +1 -0
- package/dist/webpack/webpack.config.base.js +3 -5
- package/dist/webpack/webpack.config.base.js.map +1 -1
- package/dist/webpack/webpack.config.base.prod.d.ts +1 -1
- package/dist/webpack/webpack.config.base.prod.js +101 -80
- package/dist/webpack/webpack.config.base.prod.js.map +1 -1
- package/package-tar/teambit-react-0.0.629.tgz +0 -0
- package/package.json +38 -36
- package/templates/react-app/files/app-root.ts +7 -1
- package/templates/react-app/files/compositions.ts +1 -1
- package/templates/workspace-common/files/workspace-config.ts +1 -1
- package/webpack/get-exposed-rules.ts +12 -0
- package/webpack/get-externals.ts +8 -0
- package/webpack/html.ts +22 -0
- package/webpack/index.ts +1 -0
- package/webpack/transformers.ts +12 -0
- package/webpack/webpack.config.base.prod.ts +99 -81
- package/webpack/webpack.config.base.ts +3 -5
- package/package-tar/teambit-react-0.0.621.tgz +0 -0
|
@@ -41,103 +41,124 @@ function _terserWebpackPlugin() {
|
|
|
41
41
|
return data;
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
-
function
|
|
45
|
-
const data = require("
|
|
44
|
+
function _getExternals() {
|
|
45
|
+
const data = require("./get-externals");
|
|
46
46
|
|
|
47
|
-
|
|
47
|
+
_getExternals = function () {
|
|
48
48
|
return data;
|
|
49
49
|
};
|
|
50
50
|
|
|
51
51
|
return data;
|
|
52
52
|
}
|
|
53
53
|
|
|
54
|
+
function _getExposedRules() {
|
|
55
|
+
const data = require("./get-exposed-rules");
|
|
56
|
+
|
|
57
|
+
_getExposedRules = function () {
|
|
58
|
+
return data;
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
return data;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
// import { WebpackManifestPlugin } from 'webpack-manifest-plugin';
|
|
54
65
|
// This is the production and development configuration.
|
|
55
66
|
// It is focused on developer experience, fast rebuilds, and a minimal bundle.
|
|
56
67
|
// eslint-disable-next-line complexity
|
|
57
|
-
function _default() {
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
compress
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
minifyFontValues: {
|
|
101
|
-
removeQuotes: false
|
|
102
|
-
}
|
|
103
|
-
}]
|
|
68
|
+
function _default(externalizePeer, peers, dev) {
|
|
69
|
+
const externals = externalizePeer ? (0, _getExternals().getExternals)(peers) : undefined;
|
|
70
|
+
const exposedRules = externalizePeer ? undefined : (0, _getExposedRules().getExposedRules)(peers);
|
|
71
|
+
const module = externalizePeer ? undefined : {
|
|
72
|
+
rules: exposedRules
|
|
73
|
+
};
|
|
74
|
+
const optimization = dev ? undefined : {
|
|
75
|
+
minimize: true,
|
|
76
|
+
minimizer: [// This is only used in production mode
|
|
77
|
+
new (_terserWebpackPlugin().default)({
|
|
78
|
+
extractComments: false,
|
|
79
|
+
terserOptions: {
|
|
80
|
+
parse: {
|
|
81
|
+
// We want terser to parse ecma 8 code. However, we don't want it
|
|
82
|
+
// to apply any minification steps that turns valid ecma 5 code
|
|
83
|
+
// into invalid ecma 5 code. This is why the 'compress' and 'output'
|
|
84
|
+
// sections only apply transformations that are ecma 5 safe
|
|
85
|
+
// https://github.com/facebook/create-react-app/pull/4234
|
|
86
|
+
ecma: 8
|
|
87
|
+
},
|
|
88
|
+
compress: {
|
|
89
|
+
ecma: 5,
|
|
90
|
+
warnings: false,
|
|
91
|
+
// Disabled because of an issue with Uglify breaking seemingly valid code:
|
|
92
|
+
// https://github.com/facebook/create-react-app/issues/2376
|
|
93
|
+
// Pending further investigation:
|
|
94
|
+
// https://github.com/mishoo/UglifyJS2/issues/2011
|
|
95
|
+
comparisons: false,
|
|
96
|
+
// Disabled because of an issue with Terser breaking valid code:
|
|
97
|
+
// https://github.com/facebook/create-react-app/issues/5250
|
|
98
|
+
// Pending further investigation:
|
|
99
|
+
// https://github.com/terser-js/terser/issues/120
|
|
100
|
+
inline: 2
|
|
101
|
+
},
|
|
102
|
+
mangle: {
|
|
103
|
+
safari10: true
|
|
104
|
+
},
|
|
105
|
+
output: {
|
|
106
|
+
ecma: 5,
|
|
107
|
+
comments: false,
|
|
108
|
+
// Turned on because emoji and regex is not minified properly using default
|
|
109
|
+
// https://github.com/facebook/create-react-app/issues/2488
|
|
110
|
+
ascii_only: true
|
|
104
111
|
}
|
|
105
|
-
})],
|
|
106
|
-
// Automatically split vendor and commons
|
|
107
|
-
// https://twitter.com/wSokra/status/969633336732905474
|
|
108
|
-
// https://medium.com/webpack/webpack-4-code-splitting-chunk-graph-and-the-splitchunks-optimization-be739a861366
|
|
109
|
-
splitChunks: {
|
|
110
|
-
chunks: 'all' // name: false,
|
|
111
|
-
|
|
112
|
-
},
|
|
113
|
-
// Keep the runtime chunk separated to enable long term caching
|
|
114
|
-
// https://twitter.com/wSokra/status/969679223278505985
|
|
115
|
-
// https://github.com/facebook/create-react-app/issues/5358
|
|
116
|
-
runtimeChunk: {
|
|
117
|
-
name: entrypoint => `runtime-${entrypoint.name}`
|
|
118
112
|
}
|
|
119
|
-
},
|
|
113
|
+
}), new (_cssMinimizerWebpackPlugin().default)({
|
|
114
|
+
minimizerOptions: {
|
|
115
|
+
preset: ['default', {
|
|
116
|
+
minifyFontValues: {
|
|
117
|
+
removeQuotes: false
|
|
118
|
+
}
|
|
119
|
+
}]
|
|
120
|
+
}
|
|
121
|
+
})] // Automatically split vendor and commons
|
|
122
|
+
// https://twitter.com/wSokra/status/969633336732905474
|
|
123
|
+
// https://medium.com/webpack/webpack-4-code-splitting-chunk-graph-and-the-splitchunks-optimization-be739a861366
|
|
124
|
+
// splitChunks: {
|
|
125
|
+
// chunks: 'all',
|
|
126
|
+
// name: false,
|
|
127
|
+
// },
|
|
128
|
+
// Keep the runtime chunk separated to enable long term caching
|
|
129
|
+
// https://twitter.com/wSokra/status/969679223278505985
|
|
130
|
+
// https://github.com/facebook/create-react-app/issues/5358
|
|
131
|
+
// runtimeChunk: {
|
|
132
|
+
// name: (entrypoint) => `runtime-${entrypoint.name}`,
|
|
133
|
+
// },
|
|
134
|
+
|
|
135
|
+
};
|
|
136
|
+
return {
|
|
137
|
+
module,
|
|
138
|
+
externals,
|
|
139
|
+
optimization,
|
|
120
140
|
plugins: [// Generate an asset manifest file with the following content:
|
|
121
141
|
// - "files" key: Mapping of all asset filenames to their corresponding
|
|
122
142
|
// output file so that tools can pick it up without having to parse
|
|
123
143
|
// `index.html`
|
|
124
144
|
// can be used to reconstruct the HTML if necessary
|
|
125
|
-
new
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
}),
|
|
145
|
+
// new WebpackManifestPlugin({
|
|
146
|
+
// fileName: 'asset-manifest.json',
|
|
147
|
+
// publicPath: 'public',
|
|
148
|
+
// generate: (seed, files, entrypoints) => {
|
|
149
|
+
// const manifestFiles = files.reduce((manifest, file) => {
|
|
150
|
+
// manifest[file.name] = file.path;
|
|
151
|
+
// return manifest;
|
|
152
|
+
// }, seed);
|
|
153
|
+
// const entrypointFiles = entrypoints.main.filter((fileName) => !fileName.endsWith('.map'));
|
|
154
|
+
// // @ts-ignore - https://github.com/shellscape/webpack-manifest-plugin/issues/276
|
|
155
|
+
// return {
|
|
156
|
+
// files: manifestFiles,
|
|
157
|
+
// entrypoints: entrypointFiles,
|
|
158
|
+
// } as Record<string, string>;
|
|
159
|
+
// },
|
|
160
|
+
// }),
|
|
161
|
+
// Generate a service worker script that will precache, and keep up to date,
|
|
141
162
|
// the HTML & assets that are part of the webpack build.
|
|
142
163
|
new (_workboxWebpackPlugin().default.GenerateSW)({
|
|
143
164
|
clientsClaim: true,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["webpack.config.base.prod.ts"],"names":["
|
|
1
|
+
{"version":3,"sources":["webpack.config.base.prod.ts"],"names":["externalizePeer","peers","dev","externals","undefined","exposedRules","module","rules","optimization","minimize","minimizer","TerserPlugin","extractComments","terserOptions","parse","ecma","compress","warnings","comparisons","inline","mangle","safari10","output","comments","ascii_only","CssMinimizerPlugin","minimizerOptions","preset","minifyFontValues","removeQuotes","plugins","WorkboxWebpackPlugin","GenerateSW","clientsClaim","exclude","navigateFallback","navigateFallbackDenylist","RegExp","filter","Boolean","performance"],"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;AAEA;AACA;AACA;AACe,kBAAUA,eAAV,EAAoCC,KAApC,EAAqDC,GAArD,EAAmF;AAChG,QAAMC,SAAS,GAAGH,eAAe,GAAI,kCAAaC,KAAb,CAAJ,GAAkCG,SAAnE;AACA,QAAMC,YAAY,GAAGL,eAAe,GAAGI,SAAH,GAAe,wCAAgBH,KAAhB,CAAnD;AAEA,QAAMK,MAAM,GAAGN,eAAe,GAC1BI,SAD0B,GAE1B;AACEG,IAAAA,KAAK,EAAEF;AADT,GAFJ;AAMA,QAAMG,YAAY,GAAGN,GAAG,GACpBE,SADoB,GAEpB;AACEK,IAAAA,QAAQ,EAAE,IADZ;AAEEC,IAAAA,SAAS,EAAE,CACT;AACA,SAAIC,8BAAJ,EAAiB;AACfC,MAAAA,eAAe,EAAE,KADF;AAEfC,MAAAA,aAAa,EAAE;AACbC,QAAAA,KAAK,EAAE;AACL;AACA;AACA;AACA;AACA;AACAC,UAAAA,IAAI,EAAE;AAND,SADM;AASbC,QAAAA,QAAQ,EAAE;AACRD,UAAAA,IAAI,EAAE,CADE;AAERE,UAAAA,QAAQ,EAAE,KAFF;AAGR;AACA;AACA;AACA;AACAC,UAAAA,WAAW,EAAE,KAPL;AAQR;AACA;AACA;AACA;AACAC,UAAAA,MAAM,EAAE;AAZA,SATG;AAuBbC,QAAAA,MAAM,EAAE;AACNC,UAAAA,QAAQ,EAAE;AADJ,SAvBK;AA0BbC,QAAAA,MAAM,EAAE;AACNP,UAAAA,IAAI,EAAE,CADA;AAENQ,UAAAA,QAAQ,EAAE,KAFJ;AAGN;AACA;AACAC,UAAAA,UAAU,EAAE;AALN;AA1BK;AAFA,KAAjB,CAFS,EAuCT,KAAIC,oCAAJ,EAAuB;AACrBC,MAAAA,gBAAgB,EAAE;AAChBC,QAAAA,MAAM,EAAE,CACN,SADM,EAEN;AACEC,UAAAA,gBAAgB,EAAE;AAAEC,YAAAA,YAAY,EAAE;AAAhB;AADpB,SAFM;AADQ;AADG,KAAvB,CAvCS,CAFb,CAoDE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAhEF,GAFJ;AAqEA,SAAO;AACLvB,IAAAA,MADK;AAELH,IAAAA,SAFK;AAGLK,IAAAA,YAHK;AAKLsB,IAAAA,OAAO,EAAE,CACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAIC,gCAAqBC,UAAzB,EAAoC;AAClCC,MAAAA,YAAY,EAAE,IADoB;AAElCC,MAAAA,OAAO,EAAE,CAAC,QAAD,EAAW,uBAAX,CAFyB;AAGlC;AACAC,MAAAA,gBAAgB,EAAE,mBAJgB;AAKlCC,MAAAA,wBAAwB,EAAE,CACxB;AACA,UAAIC,MAAJ,CAAW,KAAX,CAFwB,EAGxB;AACA;AACA;AACA;AACA,UAAIA,MAAJ,CAAW,kBAAX,CAPwB;AALQ,KAApC,CAzBO,EAwCPC,MAxCO,CAwCAC,OAxCA,CALJ;AA8CL;AACA;AACAC,IAAAA,WAAW,EAAE;AAhDR,GAAP;AAkDD","sourcesContent":["import WorkboxWebpackPlugin from 'workbox-webpack-plugin';\nimport CssMinimizerPlugin from 'css-minimizer-webpack-plugin';\nimport TerserPlugin from 'terser-webpack-plugin';\nimport { Configuration } from 'webpack';\nimport { getExternals } from './get-externals';\nimport { getExposedRules } from './get-exposed-rules';\n// import { WebpackManifestPlugin } from 'webpack-manifest-plugin';\n\n// This is the production and development configuration.\n// It is focused on developer experience, fast rebuilds, and a minimal bundle.\n// eslint-disable-next-line complexity\nexport default function (externalizePeer: boolean, peers: string[], dev?: boolean): Configuration {\n const externals = externalizePeer ? (getExternals(peers) as any) : undefined;\n const exposedRules = externalizePeer ? undefined : getExposedRules(peers);\n\n const module = externalizePeer\n ? undefined\n : {\n rules: exposedRules,\n };\n\n const optimization = dev\n ? undefined\n : {\n minimize: true,\n minimizer: [\n // This is only used in production mode\n new TerserPlugin({\n extractComments: false,\n terserOptions: {\n parse: {\n // We want terser to parse ecma 8 code. However, we don't want it\n // to apply any minification steps that turns valid ecma 5 code\n // into invalid ecma 5 code. This is why the 'compress' and 'output'\n // sections only apply transformations that are ecma 5 safe\n // https://github.com/facebook/create-react-app/pull/4234\n ecma: 8,\n },\n compress: {\n ecma: 5,\n warnings: false,\n // Disabled because of an issue with Uglify breaking seemingly valid code:\n // https://github.com/facebook/create-react-app/issues/2376\n // Pending further investigation:\n // https://github.com/mishoo/UglifyJS2/issues/2011\n comparisons: false,\n // Disabled because of an issue with Terser breaking valid code:\n // https://github.com/facebook/create-react-app/issues/5250\n // Pending further investigation:\n // https://github.com/terser-js/terser/issues/120\n inline: 2,\n },\n mangle: {\n safari10: true,\n },\n output: {\n ecma: 5,\n comments: false,\n // Turned on because emoji and regex is not minified properly using default\n // https://github.com/facebook/create-react-app/issues/2488\n ascii_only: true,\n },\n },\n }),\n new CssMinimizerPlugin({\n minimizerOptions: {\n preset: [\n 'default',\n {\n minifyFontValues: { removeQuotes: false },\n },\n ],\n },\n }),\n ],\n // Automatically split vendor and commons\n // https://twitter.com/wSokra/status/969633336732905474\n // https://medium.com/webpack/webpack-4-code-splitting-chunk-graph-and-the-splitchunks-optimization-be739a861366\n // splitChunks: {\n // chunks: 'all',\n // name: false,\n // },\n // Keep the runtime chunk separated to enable long term caching\n // https://twitter.com/wSokra/status/969679223278505985\n // https://github.com/facebook/create-react-app/issues/5358\n // runtimeChunk: {\n // name: (entrypoint) => `runtime-${entrypoint.name}`,\n // },\n };\n\n return {\n module,\n externals,\n optimization,\n\n plugins: [\n // Generate an asset manifest file with the following content:\n // - \"files\" key: Mapping of all asset filenames to their corresponding\n // output file so that tools can pick it up without having to parse\n // `index.html`\n // can be used to reconstruct the HTML if necessary\n // new WebpackManifestPlugin({\n // fileName: 'asset-manifest.json',\n // publicPath: 'public',\n // generate: (seed, files, entrypoints) => {\n // const manifestFiles = files.reduce((manifest, file) => {\n // manifest[file.name] = file.path;\n // return manifest;\n // }, seed);\n // const entrypointFiles = entrypoints.main.filter((fileName) => !fileName.endsWith('.map'));\n\n // // @ts-ignore - https://github.com/shellscape/webpack-manifest-plugin/issues/276\n // return {\n // files: manifestFiles,\n // entrypoints: entrypointFiles,\n // } as Record<string, string>;\n // },\n // }),\n // Generate a service worker script that will precache, and keep up to date,\n // the HTML & assets that are part of the webpack build.\n new WorkboxWebpackPlugin.GenerateSW({\n clientsClaim: true,\n exclude: [/\\.map$/, /asset-manifest\\.json$/],\n // importWorkboxFrom: 'cdn',\n navigateFallback: 'public/index.html',\n navigateFallbackDenylist: [\n // Exclude URLs starting with /_, as they're likely an API call\n new RegExp('^/_'),\n // Exclude any URLs whose last part seems to be a file extension\n // as they're likely a resource and not a SPA route.\n // URLs containing a \"?\" character won't be blacklisted as they're likely\n // a route with query params (e.g. auth callbacks).\n new RegExp('/[^/?]+\\\\.[^/]+$'),\n ],\n }),\n ].filter(Boolean),\n // Turn off performance processing because we utilize\n // our own hints via the FileSizeReporter\n performance: false,\n };\n}\n"]}
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@teambit/react",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.629",
|
|
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.629"
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"react-error-boundary": "^3.0.0",
|
|
@@ -30,12 +30,12 @@
|
|
|
30
30
|
"babel-plugin-transform-typescript-metadata": "0.3.1",
|
|
31
31
|
"babel-preset-jest": "26.6.2",
|
|
32
32
|
"@babel/preset-typescript": "7.12.17",
|
|
33
|
+
"expose-loader": "3.1.0",
|
|
33
34
|
"postcss-preset-env": "6.7.0",
|
|
34
35
|
"react-error-overlay": "6.0.9",
|
|
35
36
|
"strip-ansi": "6.0.0",
|
|
36
37
|
"css-minimizer-webpack-plugin": "3.0.2",
|
|
37
38
|
"terser-webpack-plugin": "5.2.0",
|
|
38
|
-
"webpack-manifest-plugin": "4.0.2",
|
|
39
39
|
"webpack": "5.51.1",
|
|
40
40
|
"workbox-webpack-plugin": "6.2.4",
|
|
41
41
|
"mini-css-extract-plugin": "2.2.2",
|
|
@@ -79,47 +79,49 @@
|
|
|
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.355",
|
|
82
|
-
"@teambit/preview": "0.0.
|
|
82
|
+
"@teambit/preview": "0.0.629",
|
|
83
83
|
"@teambit/react.ui.error-fallback": "0.0.109",
|
|
84
84
|
"@teambit/react.ui.loader-fallback": "0.0.88",
|
|
85
85
|
"@teambit/compositions.ui.hooks.use-composition": "0.0.162",
|
|
86
86
|
"@teambit/design.ui.input.option-button": "0.0.26",
|
|
87
87
|
"@teambit/design.ui.tooltip": "0.0.352",
|
|
88
|
-
"@teambit/builder": "0.0.
|
|
89
|
-
"@teambit/bundler": "0.0.
|
|
90
|
-
"@teambit/compiler": "0.0.
|
|
91
|
-
"@teambit/component.modules.component-url": "0.0.
|
|
92
|
-
"@teambit/component": "0.0.
|
|
93
|
-
"@teambit/envs": "0.0.
|
|
94
|
-
"@teambit/eslint": "0.0.
|
|
95
|
-
"@teambit/formatter": "0.0.
|
|
96
|
-
"@teambit/jest": "0.0.
|
|
97
|
-
"@teambit/linter": "0.0.
|
|
98
|
-
"@teambit/pkg": "0.0.
|
|
99
|
-
"@teambit/prettier": "0.0.
|
|
88
|
+
"@teambit/builder": "0.0.629",
|
|
89
|
+
"@teambit/bundler": "0.0.629",
|
|
90
|
+
"@teambit/compiler": "0.0.629",
|
|
91
|
+
"@teambit/component.modules.component-url": "0.0.121",
|
|
92
|
+
"@teambit/component": "0.0.629",
|
|
93
|
+
"@teambit/envs": "0.0.629",
|
|
94
|
+
"@teambit/eslint": "0.0.629",
|
|
95
|
+
"@teambit/formatter": "0.0.180",
|
|
96
|
+
"@teambit/jest": "0.0.629",
|
|
97
|
+
"@teambit/linter": "0.0.629",
|
|
98
|
+
"@teambit/pkg": "0.0.629",
|
|
99
|
+
"@teambit/prettier": "0.0.180",
|
|
100
100
|
"@teambit/react.ui.highlighter.component-metadata.bit-component-meta": "0.0.20",
|
|
101
|
-
"@teambit/schema": "0.0.
|
|
102
|
-
"@teambit/tester": "0.0.
|
|
103
|
-
"@teambit/typescript": "0.0.
|
|
104
|
-
"@teambit/webpack": "0.0.
|
|
105
|
-
"@teambit/workspace": "0.0.
|
|
106
|
-
"@teambit/application": "0.0.
|
|
107
|
-
"@teambit/cli": "0.0.
|
|
108
|
-
"@teambit/dependency-resolver": "0.0.
|
|
109
|
-
"@teambit/generator": "0.0.
|
|
110
|
-
"@teambit/graphql": "0.0.
|
|
111
|
-
"@teambit/react.ui.highlighter-provider": "0.0.
|
|
112
|
-
"@teambit/compositions": "0.0.
|
|
113
|
-
"@teambit/ui": "0.0.
|
|
114
|
-
"@teambit/react.eslint-config-bit-react": "0.0.
|
|
101
|
+
"@teambit/schema": "0.0.629",
|
|
102
|
+
"@teambit/tester": "0.0.629",
|
|
103
|
+
"@teambit/typescript": "0.0.629",
|
|
104
|
+
"@teambit/webpack": "0.0.629",
|
|
105
|
+
"@teambit/workspace": "0.0.629",
|
|
106
|
+
"@teambit/application": "0.0.271",
|
|
107
|
+
"@teambit/cli": "0.0.433",
|
|
108
|
+
"@teambit/dependency-resolver": "0.0.629",
|
|
109
|
+
"@teambit/generator": "0.0.629",
|
|
110
|
+
"@teambit/graphql": "0.0.629",
|
|
111
|
+
"@teambit/react.ui.highlighter-provider": "0.0.182",
|
|
112
|
+
"@teambit/compositions": "0.0.629",
|
|
113
|
+
"@teambit/ui": "0.0.629",
|
|
114
|
+
"@teambit/react.eslint-config-bit-react": "0.0.510",
|
|
115
|
+
"@teambit/webpack.modules.generate-expose-loaders": "0.0.2",
|
|
116
|
+
"@teambit/webpack.modules.generate-externals": "0.0.2",
|
|
117
|
+
"@teambit/webpack.modules.config-mutator": "0.0.136",
|
|
115
118
|
"@teambit/mdx.modules.mdx-loader": "0.0.488",
|
|
116
|
-
"@teambit/react.babel.bit-react-transformer": "0.0.
|
|
119
|
+
"@teambit/react.babel.bit-react-transformer": "0.0.498",
|
|
117
120
|
"@teambit/webpack.modules.generate-style-loaders": "0.0.102",
|
|
118
121
|
"@teambit/webpack.modules.style-regexps": "0.0.131",
|
|
119
|
-
"@teambit/component-id": "0.0.
|
|
120
|
-
"@teambit/isolator": "0.0.621",
|
|
122
|
+
"@teambit/component-id": "0.0.400",
|
|
121
123
|
"@teambit/toolbox.network.get-port": "0.0.112",
|
|
122
|
-
"@teambit/config": "0.0.
|
|
124
|
+
"@teambit/config": "0.0.445"
|
|
123
125
|
},
|
|
124
126
|
"devDependencies": {
|
|
125
127
|
"@types/react": "^17.0.8",
|
|
@@ -137,7 +139,7 @@
|
|
|
137
139
|
"@teambit/react.aspect-docs.react": "0.0.131"
|
|
138
140
|
},
|
|
139
141
|
"peerDependencies": {
|
|
140
|
-
"@teambit/legacy": "1.0.
|
|
142
|
+
"@teambit/legacy": "1.0.209",
|
|
141
143
|
"react-dom": "^16.8.0 || ^17.0.0",
|
|
142
144
|
"react": "^16.8.0 || ^17.0.0"
|
|
143
145
|
},
|
|
@@ -199,7 +201,7 @@
|
|
|
199
201
|
"@types/jest": "^26.0.0"
|
|
200
202
|
},
|
|
201
203
|
"peerDependencies": {
|
|
202
|
-
"@teambit/legacy": "1.0.
|
|
204
|
+
"@teambit/legacy": "1.0.209",
|
|
203
205
|
"react-dom": "^16.8.0 || ^17.0.0",
|
|
204
206
|
"react": "^16.8.0 || ^17.0.0"
|
|
205
207
|
}
|
|
@@ -3,8 +3,14 @@ import { ComponentContext } from '@teambit/generator';
|
|
|
3
3
|
export function appRootFile({ namePascalCase: Name }: ComponentContext) {
|
|
4
4
|
return `import React from 'react';
|
|
5
5
|
import ReactDOM from 'react-dom';
|
|
6
|
+
import { BrowserRouter } from 'react-router-dom';
|
|
6
7
|
import { ${Name}App } from './app';
|
|
7
8
|
|
|
8
|
-
ReactDOM.render(
|
|
9
|
+
ReactDOM.render((
|
|
10
|
+
<BrowserRouter>
|
|
11
|
+
<${Name}App />
|
|
12
|
+
</BrowserRouter>
|
|
13
|
+
), document.getElementById('root'));
|
|
14
|
+
|
|
9
15
|
`;
|
|
10
16
|
}
|
|
@@ -54,7 +54,7 @@ export async function workspaceConfig({ name, defaultScope }: WorkspaceContext)
|
|
|
54
54
|
/**
|
|
55
55
|
* configures components with namespaces 'envs' and 'aspects' to use the default Aspect development environment.
|
|
56
56
|
*/
|
|
57
|
-
"{envs/**}, {aspects/**}": {
|
|
57
|
+
"{envs/**}, {aspects/**}, {apps/**}": {
|
|
58
58
|
"teambit.harmony/aspect": {}
|
|
59
59
|
}
|
|
60
60
|
}`),
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import camelcase from 'camelcase';
|
|
2
|
+
import 'expose-loader';
|
|
3
|
+
import { generateExposeLoaders } from '@teambit/webpack.modules.generate-expose-loaders';
|
|
4
|
+
|
|
5
|
+
export function getExposedRules(peers: string[]) {
|
|
6
|
+
const loaderPath = require.resolve('expose-loader');
|
|
7
|
+
const depsEntries = peers.map((peer) => ({
|
|
8
|
+
path: require.resolve(peer),
|
|
9
|
+
globalName: camelcase(peer.replace('@', '').replace('/', '-'), { pascalCase: true }),
|
|
10
|
+
}));
|
|
11
|
+
return generateExposeLoaders(depsEntries, { loaderPath });
|
|
12
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import camelcase from 'camelcase';
|
|
2
|
+
import { generateExternals } from '@teambit/webpack.modules.generate-externals';
|
|
3
|
+
|
|
4
|
+
export function getExternals(deps: string[]) {
|
|
5
|
+
return generateExternals(deps, {
|
|
6
|
+
transformName: (depName) => camelcase(depName.replace('@', '').replace('/', '-'), { pascalCase: true }),
|
|
7
|
+
});
|
|
8
|
+
}
|
package/webpack/html.ts
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/** html template for Previews (docs, compositions, etc) */
|
|
2
|
+
export function html(title: string) {
|
|
3
|
+
return `
|
|
4
|
+
<!DOCTYPE html>
|
|
5
|
+
<html lang="en">
|
|
6
|
+
<head>
|
|
7
|
+
<meta charset="utf-8">
|
|
8
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
9
|
+
<title>${title}</title>
|
|
10
|
+
<script>
|
|
11
|
+
// Allow to use react dev-tools inside the examples
|
|
12
|
+
try { window.__REACT_DEVTOOLS_GLOBAL_HOOK__ = window.parent.__REACT_DEVTOOLS_GLOBAL_HOOK__; } catch {}
|
|
13
|
+
</script>
|
|
14
|
+
<!-- minimal css resets -->
|
|
15
|
+
<style> html { height: 100%; } body { margin: 0; height: 100%; } #root { height: 100%; } </style>
|
|
16
|
+
</head>
|
|
17
|
+
<body>
|
|
18
|
+
<div id="root"></div>
|
|
19
|
+
</body>
|
|
20
|
+
</html>
|
|
21
|
+
`;
|
|
22
|
+
}
|
package/webpack/index.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { html } from './html';
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { WebpackConfigMutator } from '@teambit/webpack.modules.config-mutator';
|
|
2
|
+
|
|
3
|
+
export function generateAddAliasesFromPeersTransformer(peers: string[]) {
|
|
4
|
+
const peerAliases = peers.reduce((acc, peerName) => {
|
|
5
|
+
acc[peerName] = require.resolve(peerName);
|
|
6
|
+
return acc;
|
|
7
|
+
}, {});
|
|
8
|
+
return (config: WebpackConfigMutator): WebpackConfigMutator => {
|
|
9
|
+
config.addAliases(peerAliases);
|
|
10
|
+
return config;
|
|
11
|
+
};
|
|
12
|
+
}
|