@teambit/react 0.0.659 → 0.0.662
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-1645932113477.js → __compositions-1646104918375.js} +0 -0
- package/{__overview-1645932113477.js → __overview-1646104918375.js} +0 -0
- package/{__preview-1645932113477.js → __preview-1646104918375.js} +2 -2
- package/artifacts/env-template/public/141.js +1 -1
- package/artifacts/env-template/public/181.js +1 -1
- package/artifacts/env-template/public/719.js +6 -6
- package/artifacts/env-template/public/848.js +1 -1
- package/artifacts/env-template/public/987.js +1 -0
- package/artifacts/env-template/public/assets-manifest.json +10 -10
- package/artifacts/env-template/public/compositions.9d9873c2553242033d9c.js +1 -0
- package/artifacts/env-template/public/compositions.html +1 -1
- package/artifacts/env-template/public/overview.68f82edda78fd792f787.js +1 -0
- package/artifacts/env-template/public/overview.html +1 -1
- package/artifacts/env-template/public/preview-root.bb467305f0de987ac64f.js +1 -0
- package/artifacts/env-template/public/service-worker.js +1 -1
- package/artifacts/env-template/public/static/css/{719.9bbec047.css → 719.8dcf0b5d.css} +1 -1
- package/artifacts/preview/teambit_react_react-preview.js +1 -1
- package/dist/webpack/{format-webpack-messages.js → overlay/formatWebpackMessages.js} +28 -14
- package/dist/webpack/overlay/formatWebpackMessages.js.map +1 -0
- package/dist/webpack/{launch-editor-endpoint.js → overlay/launchEditorEndpoint.js} +4 -3
- package/dist/webpack/overlay/launchEditorEndpoint.js.map +1 -0
- package/dist/webpack/{refresh.js → overlay/refreshOverlayInterop.js} +4 -1
- package/dist/webpack/overlay/refreshOverlayInterop.js.map +1 -0
- package/dist/webpack/{react-hot-dev-client.js → overlay/webpackHotDevClient.js} +70 -52
- package/dist/webpack/overlay/webpackHotDevClient.js.map +1 -0
- package/dist/webpack/webpack.config.component.dev.js +3 -4
- package/dist/webpack/webpack.config.component.dev.js.map +1 -1
- package/package-tar/teambit-react-0.0.662.tgz +0 -0
- package/package.json +29 -28
- package/webpack/{format-webpack-messages.js → overlay/formatWebpackMessages.js} +21 -6
- package/webpack/{launch-editor-endpoint.js → overlay/launchEditorEndpoint.js} +3 -0
- package/webpack/{refresh.js → overlay/refreshOverlayInterop.js} +3 -0
- package/webpack/{react-hot-dev-client.js → overlay/webpackHotDevClient.js} +70 -44
- package/webpack/webpack.config.component.dev.ts +3 -4
- package/artifacts/env-template/public/559.js +0 -1
- package/artifacts/env-template/public/compositions.05af2e766778aff0b737.js +0 -1
- package/artifacts/env-template/public/overview.f5eef564ec1da91f72c1.js +0 -1
- package/artifacts/env-template/public/preview-root.950788994d846582523c.js +0 -1
- package/dist/webpack/format-webpack-messages.js.map +0 -1
- package/dist/webpack/launch-editor-endpoint.js.map +0 -1
- package/dist/webpack/react-hot-dev-client.js.map +0 -1
- package/dist/webpack/refresh.js.map +0 -1
- package/package-tar/teambit-react-0.0.659.tgz +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["webpack.config.component.dev.ts"],"names":["matchNothingRegex","workDir","envId","module","rules","test","enforce","include","path","join","descriptionData","componentId","value","use","require","resolve","ComponentID","isValidObject","loader","options","babelrc","configFile","plugins","compact","minified","presets","ReactRefreshWebpackPlugin","overlay","sockPath","entry"],"mappings":";;;;;;;;;AAAA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAEA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAGA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAHA;AACA;AAIA,MAAMA,iBAAiB,GAAG,IAA1B,C,CAEA;AACA;AACA;AACA;;AACe,kBAAUC,OAAV,EAA2BC,KAA3B,EAAyD;AACtE,SAAO;AACLC,IAAAA,MAAM,EAAE;AACNC,MAAAA,KAAK,EAAE,CACL;AACEC,QAAAA,IAAI,EAAE,OADR;AAEEC,QAAAA,OAAO,EAAE,KAFX;AAGE;AACA;AACAC,QAAAA,OAAO,EAAEC,gBAAKC,IAAL,CAAUR,OAAV,EAAmB,cA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,OAAO,EAAE;AACPC,YAAAA,OAAO,EAAE,KADF;AAEPC,YAAAA,UAAU,EAAE,KAFL;AAGPI,YAAAA,OAAO,EAAE,CAACX,OAAO,CAACC,OAAR,CAAgB,qBAAhB,CAAD,EAAyCD,OAAO,CAACC,OAAR,CAAgB,mBAAhB,CAAzC,CAHF;AAIPO,YAAAA,OAAO,EAAE,CAACR,OAAO,CAACC,OAAR,CAAgB,qBAAhB,CAAD;AAJF;AAFX,SAFG,EAWH;AACEG,UAAAA,MAAM,EAAEJ,OAAO,CAACC,OAAR,CAAgB,iCAAhB;AADV,SAXG;AANP,OAtCK;AADD,KADH;AAgELO,IAAAA,OAAO,EAAE,CACP;AACA;AACA,SAAII,oCAAJ,EAA8B;AAC5BC,MAAAA,OAAO,EAAE;AACPC,QAAAA,QAAQ,EAAG,QAAO1B,KAAM,EADjB;AAEP;
|
|
1
|
+
{"version":3,"sources":["webpack.config.component.dev.ts"],"names":["matchNothingRegex","workDir","envId","module","rules","test","enforce","include","path","join","descriptionData","componentId","value","use","require","resolve","ComponentID","isValidObject","loader","options","babelrc","configFile","plugins","compact","minified","presets","ReactRefreshWebpackPlugin","overlay","sockPath","entry"],"mappings":";;;;;;;;;AAAA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAEA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAGA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAHA;AACA;AAIA,MAAMA,iBAAiB,GAAG,IAA1B,C,CAEA;AACA;AACA;AACA;;AACe,kBAAUC,OAAV,EAA2BC,KAA3B,EAAyD;AACtE,SAAO;AACLC,IAAAA,MAAM,EAAE;AACNC,MAAAA,KAAK,EAAE,CACL;AACEC,QAAAA,IAAI,EAAE,OADR;AAEEC,QAAAA,OAAO,EAAE,KAFX;AAGE;AACA;AACAC,QAAAA,OAAO,EAAEC,gBAAKC,IAAL,CAAUR,OAAV,EAAmB,cAAnB,CALX;AAME;AACAS,QAA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A,OAAO,EAAE,KADF;AAEPC,YAAAA,UAAU,EAAE,KAFL;AAGPI,YAAAA,OAAO,EAAE,CAACX,OAAO,CAACC,OAAR,CAAgB,qBAAhB,CAAD,EAAyCD,OAAO,CAACC,OAAR,CAAgB,mBAAhB,CAAzC,CAHF;AAIPO,YAAAA,OAAO,EAAE,CAACR,OAAO,CAACC,OAAR,CAAgB,qBAAhB,CAAD;AAJF;AAFX,SAFG,EAWH;AACEG,UAAAA,MAAM,EAAEJ,OAAO,CAACC,OAAR,CAAgB,iCAAhB;AADV,SAXG;AANP,OAtCK;AADD,KADH;AAgELO,IAAAA,OAAO,EAAE,CACP;AACA;AACA,SAAII,oCAAJ,EAA8B;AAC5BC,MAAAA,OAAO,EAAE;AACPC,QAAAA,QAAQ,EAAG,QAAO1B,KAAM,EADjB;AAEP;AACA2B,QAAAA,KAAK,EAAEf,OAAO,CAACC,OAAR,CAAgB,+BAAhB,CAHA;AAIPZ,QAAAA,MAAM,EAAEW,OAAO,CAACC,OAAR,CAAgB,iCAAhB;AAJD,OADmB;AAQ5B;AACA;AACA;AACAR,MAAAA,OAAO,EAAEP;AAXmB,KAA9B,CAHO;AAhEJ,GAAP;AAkFD","sourcesContent":["import path from 'path';\nimport { Configuration } from 'webpack';\nimport { ComponentID } from '@teambit/component-id';\n// Make sure the bit-react-transformer is a dependency\n// TODO: remove it once we can set policy from component to component then set it via the component.json\nimport '@teambit/react.babel.bit-react-transformer';\nimport ReactRefreshWebpackPlugin from '@pmmmwh/react-refresh-webpack-plugin';\n\nconst matchNothingRegex = 'a^';\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\n// export default function (workDir: string, envId: string): Configuration {\nexport default function (workDir: string, envId: string): Configuration {\n return {\n module: {\n rules: [\n {\n test: /\\.js$/,\n enforce: 'pre',\n // limit loader to files in the current project,\n // to skip any files linked from other projects (like Bit itself)\n include: path.join(workDir, 'node_modules'),\n // only apply to packages with componentId in their package.json (ie. bit components)\n descriptionData: { componentId: (value) => !!value },\n use: [require.resolve('source-map-loader')],\n },\n {\n test: /\\.js$/,\n // limit loader to files in the current project,\n // to skip any files linked from other projects (like Bit itself)\n include: path.join(workDir, 'node_modules'),\n // only apply to packages with componentId in their package.json (ie. bit components)\n descriptionData: { componentId: ComponentID.isValidObject },\n use: [\n require.resolve('@pmmmwh/react-refresh-webpack-plugin/loader'),\n {\n loader: require.resolve('babel-loader'),\n options: {\n babelrc: false,\n configFile: false,\n plugins: [\n require.resolve('react-refresh/babel'),\n // for component highlighting in preview.\n [require.resolve('@teambit/react.babel.bit-react-transformer')],\n ],\n // turn off all optimizations (only slow down for node_modules)\n compact: false,\n minified: false,\n },\n },\n ],\n },\n // MDX support (move to the mdx aspect and extend from there)\n {\n test: /\\.mdx?$/,\n // to skip any files linked from other projects (like Bit itself)\n include: path.join(workDir, 'node_modules'),\n // only apply to packages with componentId in their package.json (ie. bit components)\n descriptionData: { componentId: (value) => !!value },\n use: [\n require.resolve('@pmmmwh/react-refresh-webpack-plugin/loader'),\n {\n loader: require.resolve('babel-loader'),\n options: {\n babelrc: false,\n configFile: false,\n presets: [require.resolve('@babel/preset-react'), require.resolve('@babel/preset-env')],\n plugins: [require.resolve('react-refresh/babel')],\n },\n },\n {\n loader: require.resolve('@teambit/mdx.modules.mdx-loader'),\n },\n ],\n },\n ],\n },\n plugins: [\n // No need here as we have `hot: true` in the dev server\n // new webpack.HotModuleReplacementPlugin({}),\n new ReactRefreshWebpackPlugin({\n overlay: {\n sockPath: `_hmr/${envId}`,\n // TODO - react-error-overlay not showing runtime errors - https://github.com/teambit/bit/issues/5452\n entry: require.resolve('./overlay/webpackHotDevClient'),\n module: require.resolve('./overlay/refreshOverlayInterop'),\n },\n\n // we use '@pmmmwh/react-refresh-webpack-plugin/loader' directly where relevant.\n // FYI, original defaults of the plugin are:\n // include: /\\.([cm]js|[jt]sx?|flow)$/i, exclude: /node_modules/,\n include: matchNothingRegex,\n }),\n ],\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.662",
|
|
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.662"
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"react-error-boundary": "^3.0.0",
|
|
@@ -32,8 +32,6 @@
|
|
|
32
32
|
"@babel/preset-typescript": "7.12.17",
|
|
33
33
|
"expose-loader": "3.1.0",
|
|
34
34
|
"postcss-preset-env": "6.7.0",
|
|
35
|
-
"react-error-overlay": "6.0.9",
|
|
36
|
-
"strip-ansi": "6.0.0",
|
|
37
35
|
"css-minimizer-webpack-plugin": "3.0.2",
|
|
38
36
|
"terser-webpack-plugin": "5.2.0",
|
|
39
37
|
"webpack": "5.51.1",
|
|
@@ -41,7 +39,9 @@
|
|
|
41
39
|
"mini-css-extract-plugin": "2.2.2",
|
|
42
40
|
"react-dev-utils": "11.0.4",
|
|
43
41
|
"style-loader": "^2.0.0",
|
|
44
|
-
"@pmmmwh/react-refresh-webpack-plugin": "0.5.
|
|
42
|
+
"@pmmmwh/react-refresh-webpack-plugin": "0.5.4",
|
|
43
|
+
"react-error-overlay": "6.0.10",
|
|
44
|
+
"strip-ansi": "6.0.0",
|
|
45
45
|
"@dreysolano/prerender-spa-plugin": "1.0.3",
|
|
46
46
|
"comment-json": "3.0.3",
|
|
47
47
|
"react-refresh": "0.10.0",
|
|
@@ -79,38 +79,38 @@
|
|
|
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.662",
|
|
83
83
|
"@teambit/react.ui.error-fallback": "0.0.110",
|
|
84
84
|
"@teambit/react.ui.loader-fallback": "0.0.89",
|
|
85
85
|
"@teambit/compositions.ui.hooks.use-composition": "0.0.163",
|
|
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.
|
|
88
|
+
"@teambit/builder": "0.0.662",
|
|
89
|
+
"@teambit/bundler": "0.0.662",
|
|
90
|
+
"@teambit/compiler": "0.0.662",
|
|
91
91
|
"@teambit/component.modules.component-url": "0.0.123",
|
|
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.
|
|
92
|
+
"@teambit/component": "0.0.662",
|
|
93
|
+
"@teambit/envs": "0.0.662",
|
|
94
|
+
"@teambit/eslint": "0.0.662",
|
|
95
|
+
"@teambit/formatter": "0.0.213",
|
|
96
|
+
"@teambit/jest": "0.0.662",
|
|
97
|
+
"@teambit/linter": "0.0.662",
|
|
98
|
+
"@teambit/pkg": "0.0.662",
|
|
99
|
+
"@teambit/prettier": "0.0.213",
|
|
100
100
|
"@teambit/react.ui.highlighter.component-metadata.bit-component-meta": "0.0.21",
|
|
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.
|
|
101
|
+
"@teambit/schema": "0.0.662",
|
|
102
|
+
"@teambit/tester": "0.0.662",
|
|
103
|
+
"@teambit/typescript": "0.0.662",
|
|
104
|
+
"@teambit/webpack": "0.0.662",
|
|
105
|
+
"@teambit/workspace": "0.0.662",
|
|
106
|
+
"@teambit/application": "0.0.304",
|
|
107
107
|
"@teambit/cli": "0.0.449",
|
|
108
|
-
"@teambit/dependency-resolver": "0.0.
|
|
109
|
-
"@teambit/generator": "0.0.
|
|
110
|
-
"@teambit/graphql": "0.0.
|
|
108
|
+
"@teambit/dependency-resolver": "0.0.662",
|
|
109
|
+
"@teambit/generator": "0.0.662",
|
|
110
|
+
"@teambit/graphql": "0.0.662",
|
|
111
111
|
"@teambit/react.ui.highlighter-provider": "0.0.184",
|
|
112
|
-
"@teambit/compositions": "0.0.
|
|
113
|
-
"@teambit/ui": "0.0.
|
|
112
|
+
"@teambit/compositions": "0.0.662",
|
|
113
|
+
"@teambit/ui": "0.0.662",
|
|
114
114
|
"@teambit/react.eslint-config-bit-react": "0.0.526",
|
|
115
115
|
"@teambit/webpack.modules.generate-expose-loaders": "0.0.3",
|
|
116
116
|
"@teambit/webpack.modules.generate-externals": "0.0.3",
|
|
@@ -131,6 +131,7 @@
|
|
|
131
131
|
"@types/lodash.flatten": "4.4.6",
|
|
132
132
|
"@types/webpack": "5.28.0",
|
|
133
133
|
"@types/mini-css-extract-plugin": "2.2.0",
|
|
134
|
+
"@types/react-dev-utils": "9.0.10",
|
|
134
135
|
"@types/postcss-normalize": "9.0.1",
|
|
135
136
|
"@types/node": "12.20.4",
|
|
136
137
|
"@types/mocha": "9.1.0",
|
|
@@ -1,9 +1,13 @@
|
|
|
1
|
+
/* eslint-disable */
|
|
1
2
|
/**
|
|
2
3
|
* Copyright (c) 2015-present, Facebook, Inc.
|
|
3
4
|
*
|
|
4
5
|
* This source code is licensed under the MIT license found in the
|
|
5
6
|
* LICENSE file in the root directory of this source tree.
|
|
6
7
|
*/
|
|
8
|
+
|
|
9
|
+
'use strict';
|
|
10
|
+
|
|
7
11
|
const friendlySyntaxErrorLabel = 'Syntax error:';
|
|
8
12
|
|
|
9
13
|
function isLikelyASyntaxError(message) {
|
|
@@ -11,9 +15,20 @@ function isLikelyASyntaxError(message) {
|
|
|
11
15
|
}
|
|
12
16
|
|
|
13
17
|
// Cleans up webpack error messages.
|
|
14
|
-
function formatMessage(
|
|
15
|
-
let
|
|
16
|
-
|
|
18
|
+
function formatMessage(message) {
|
|
19
|
+
let lines = [];
|
|
20
|
+
|
|
21
|
+
if (typeof message === 'string') {
|
|
22
|
+
lines = message.split('\n');
|
|
23
|
+
} else if ('message' in message) {
|
|
24
|
+
lines = message['message'].split('\n');
|
|
25
|
+
} else if (Array.isArray(message)) {
|
|
26
|
+
message.forEach((message) => {
|
|
27
|
+
if ('message' in message) {
|
|
28
|
+
lines = message['message'].split('\n');
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
}
|
|
17
32
|
|
|
18
33
|
// Strip webpack-added headers off errors/warnings
|
|
19
34
|
// https://github.com/webpack/webpack/blob/master/lib/ModuleError.js
|
|
@@ -64,9 +79,9 @@ function formatMessage(error) {
|
|
|
64
79
|
}
|
|
65
80
|
|
|
66
81
|
// Add helpful message for users trying to use Sass for the first time
|
|
67
|
-
if (lines[1] && lines[1].match(/Cannot find module.+
|
|
68
|
-
lines[1] = 'To import Sass files, you first need to install
|
|
69
|
-
lines[1] += 'Run `
|
|
82
|
+
if (lines[1] && lines[1].match(/Cannot find module.+sass/)) {
|
|
83
|
+
lines[1] = 'To import Sass files, you first need to install sass.\n';
|
|
84
|
+
lines[1] += 'Run `bit install sass` inside your workspace.';
|
|
70
85
|
}
|
|
71
86
|
|
|
72
87
|
message = lines.join('\n');
|
|
@@ -1,8 +1,11 @@
|
|
|
1
|
+
/* eslint-disable */
|
|
1
2
|
/**
|
|
2
3
|
* Copyright (c) 2015-present, Facebook, Inc.
|
|
3
4
|
*
|
|
4
5
|
* This source code is licensed under the MIT license found in the
|
|
5
6
|
* LICENSE file in the root directory of this source tree.
|
|
6
7
|
*/
|
|
8
|
+
'use strict';
|
|
9
|
+
|
|
7
10
|
// TODO: we might want to make this injectable to support DEV-time non-root URLs.
|
|
8
11
|
module.exports = '/__open-stack-frame-in-editor';
|
|
@@ -1,25 +1,46 @@
|
|
|
1
|
-
/* eslint-disable
|
|
1
|
+
/* eslint-disable */
|
|
2
|
+
/*
|
|
3
|
+
* this file was copied as is from `react-dev-utils/webpackHotDevClient`
|
|
4
|
+
* and adjusted for our socket url.
|
|
5
|
+
*
|
|
6
|
+
* we use just set process.env.WDS_* with the EnvironmentPlugin or DefinePlugin
|
|
7
|
+
* once we get react-error-overlay up and running again
|
|
8
|
+
*/
|
|
9
|
+
|
|
2
10
|
/**
|
|
3
11
|
* Copyright (c) 2015-present, Facebook, Inc.
|
|
4
12
|
*
|
|
5
13
|
* This source code is licensed under the MIT license found in the
|
|
6
14
|
* LICENSE file in the root directory of this source tree.
|
|
7
15
|
*/
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
16
|
+
|
|
17
|
+
'use strict';
|
|
18
|
+
|
|
19
|
+
// This alternative WebpackDevServer combines the functionality of:
|
|
20
|
+
// https://github.com/webpack/webpack-dev-server/blob/webpack-1/client/index.js
|
|
21
|
+
// https://github.com/webpack/webpack/blob/webpack-1/hot/dev-server.js
|
|
22
|
+
|
|
23
|
+
// It only supports their simplest configuration (hot updates on same server).
|
|
24
|
+
// It makes some opinionated choices on top, like adding a syntax error overlay
|
|
25
|
+
// that looks similar to our console output. The error overlay is inspired by:
|
|
26
|
+
// https://github.com/glenjamin/webpack-hot-middleware
|
|
27
|
+
|
|
28
|
+
var stripAnsi = require('strip-ansi');
|
|
29
|
+
var url = require('url');
|
|
30
|
+
var launchEditorEndpoint = require('./launchEditorEndpoint');
|
|
31
|
+
var formatWebpackMessages = require('./formatWebpackMessages');
|
|
32
|
+
var ErrorOverlay = require('react-error-overlay');
|
|
13
33
|
|
|
14
34
|
ErrorOverlay.setEditorHandler(function editorHandler(errorLocation) {
|
|
15
35
|
// Keep this sync with errorOverlayMiddleware.js
|
|
16
|
-
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
17
36
|
fetch(
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
37
|
+
launchEditorEndpoint +
|
|
38
|
+
'?fileName=' +
|
|
39
|
+
window.encodeURIComponent(errorLocation.fileName) +
|
|
40
|
+
'&lineNumber=' +
|
|
41
|
+
window.encodeURIComponent(errorLocation.lineNumber || 1) +
|
|
42
|
+
'&colNumber=' +
|
|
43
|
+
window.encodeURIComponent(errorLocation.colNumber || 1)
|
|
23
44
|
);
|
|
24
45
|
});
|
|
25
46
|
|
|
@@ -29,9 +50,9 @@ ErrorOverlay.setEditorHandler(function editorHandler(errorLocation) {
|
|
|
29
50
|
// application. This is handled below when we are notified of a compile (code
|
|
30
51
|
// change).
|
|
31
52
|
// See https://github.com/facebook/create-react-app/issues/3096
|
|
32
|
-
|
|
53
|
+
var hadRuntimeError = false;
|
|
33
54
|
ErrorOverlay.startReportingRuntimeErrors({
|
|
34
|
-
onError() {
|
|
55
|
+
onError: function () {
|
|
35
56
|
hadRuntimeError = true;
|
|
36
57
|
},
|
|
37
58
|
filename: '/static/js/bundle.js',
|
|
@@ -44,18 +65,16 @@ if (module.hot && typeof module.hot.dispose === 'function') {
|
|
|
44
65
|
});
|
|
45
66
|
}
|
|
46
67
|
|
|
47
|
-
// Connect to WebpackDevServer via a socket.
|
|
48
68
|
const querystring = module.id.substring(module.id.indexOf('?'));
|
|
49
69
|
const urlParams = new URLSearchParams(querystring);
|
|
50
70
|
|
|
51
|
-
|
|
71
|
+
// Connect to WebpackDevServer via a socket.
|
|
72
|
+
var connection = new WebSocket(
|
|
52
73
|
url.format({
|
|
53
74
|
protocol: window.location.protocol === 'https:' ? 'wss' : 'ws',
|
|
54
75
|
hostname: window.location.hostname,
|
|
55
76
|
port: window.location.port,
|
|
56
|
-
|
|
57
|
-
pathname: urlParams.get('sockPath') || '/sockjs-node',
|
|
58
|
-
// pathname: '_hmr/teambit.bad-jokes/extensions/harmony-react',
|
|
77
|
+
pathname: urlParams.get('sockPath') || '/ws',
|
|
59
78
|
slashes: true,
|
|
60
79
|
})
|
|
61
80
|
);
|
|
@@ -64,24 +83,20 @@ const connection = new WebSocket(
|
|
|
64
83
|
// to avoid spamming the console. Disconnect usually happens
|
|
65
84
|
// when developer stops the server.
|
|
66
85
|
connection.onclose = function () {
|
|
67
|
-
// eslint-disable-next-line no-console
|
|
68
86
|
if (typeof console !== 'undefined' && typeof console.info === 'function') {
|
|
69
|
-
// eslint-disable-next-line no-console
|
|
70
87
|
console.info('The development server has disconnected.\nRefresh the page if necessary.');
|
|
71
88
|
}
|
|
72
89
|
};
|
|
73
90
|
|
|
74
91
|
// Remember some state related to hot module replacement.
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
92
|
+
var isFirstCompilation = true;
|
|
93
|
+
var mostRecentCompilationHash = null;
|
|
94
|
+
var hasCompileErrors = false;
|
|
78
95
|
|
|
79
96
|
function clearOutdatedErrors() {
|
|
80
97
|
// Clean up outdated compile errors, if any.
|
|
81
|
-
// eslint-disable-next-line no-console
|
|
82
98
|
if (typeof console !== 'undefined' && typeof console.clear === 'function') {
|
|
83
99
|
if (hasCompileErrors) {
|
|
84
|
-
// eslint-disable-next-line no-console
|
|
85
100
|
console.clear();
|
|
86
101
|
}
|
|
87
102
|
}
|
|
@@ -91,7 +106,7 @@ function clearOutdatedErrors() {
|
|
|
91
106
|
function handleSuccess() {
|
|
92
107
|
clearOutdatedErrors();
|
|
93
108
|
|
|
94
|
-
|
|
109
|
+
var isHotUpdate = !isFirstCompilation;
|
|
95
110
|
isFirstCompilation = false;
|
|
96
111
|
hasCompileErrors = false;
|
|
97
112
|
|
|
@@ -109,27 +124,23 @@ function handleSuccess() {
|
|
|
109
124
|
function handleWarnings(warnings) {
|
|
110
125
|
clearOutdatedErrors();
|
|
111
126
|
|
|
112
|
-
|
|
127
|
+
var isHotUpdate = !isFirstCompilation;
|
|
113
128
|
isFirstCompilation = false;
|
|
114
129
|
hasCompileErrors = false;
|
|
115
130
|
|
|
116
131
|
function printWarnings() {
|
|
117
132
|
// Print warnings to the console.
|
|
118
|
-
|
|
119
|
-
warnings,
|
|
133
|
+
var formatted = formatWebpackMessages({
|
|
134
|
+
warnings: warnings,
|
|
120
135
|
errors: [],
|
|
121
136
|
});
|
|
122
137
|
|
|
123
|
-
// eslint-disable-next-line no-console
|
|
124
138
|
if (typeof console !== 'undefined' && typeof console.warn === 'function') {
|
|
125
|
-
|
|
126
|
-
for (let i = 0; i < formatted.warnings.length; i++) {
|
|
139
|
+
for (var i = 0; i < formatted.warnings.length; i++) {
|
|
127
140
|
if (i === 5) {
|
|
128
|
-
// eslint-disable-next-line
|
|
129
141
|
console.warn('There were more warnings in other files.\n' + 'You can find a complete log in the terminal.');
|
|
130
142
|
break;
|
|
131
143
|
}
|
|
132
|
-
// eslint-disable-next-line no-console
|
|
133
144
|
console.warn(stripAnsi(formatted.warnings[i]));
|
|
134
145
|
}
|
|
135
146
|
}
|
|
@@ -155,8 +166,8 @@ function handleErrors(errors) {
|
|
|
155
166
|
hasCompileErrors = true;
|
|
156
167
|
|
|
157
168
|
// "Massage" webpack messages.
|
|
158
|
-
|
|
159
|
-
errors,
|
|
169
|
+
var formatted = formatWebpackMessages({
|
|
170
|
+
errors: errors,
|
|
160
171
|
warnings: [],
|
|
161
172
|
});
|
|
162
173
|
|
|
@@ -164,11 +175,8 @@ function handleErrors(errors) {
|
|
|
164
175
|
ErrorOverlay.reportBuildError(formatted.errors[0]);
|
|
165
176
|
|
|
166
177
|
// Also log them to the console.
|
|
167
|
-
// eslint-disable-next-line no-console
|
|
168
178
|
if (typeof console !== 'undefined' && typeof console.error === 'function') {
|
|
169
|
-
|
|
170
|
-
for (let i = 0; i < formatted.errors.length; i++) {
|
|
171
|
-
// eslint-disable-next-line no-console
|
|
179
|
+
for (var i = 0; i < formatted.errors.length; i++) {
|
|
172
180
|
console.error(stripAnsi(formatted.errors[i]));
|
|
173
181
|
}
|
|
174
182
|
}
|
|
@@ -191,7 +199,7 @@ function handleAvailableHash(hash) {
|
|
|
191
199
|
|
|
192
200
|
// Handle messages from the server.
|
|
193
201
|
connection.onmessage = function (e) {
|
|
194
|
-
|
|
202
|
+
var message = JSON.parse(e.data);
|
|
195
203
|
switch (message.type) {
|
|
196
204
|
case 'hash':
|
|
197
205
|
handleAvailableHash(message.data);
|
|
@@ -228,6 +236,18 @@ function canApplyUpdates() {
|
|
|
228
236
|
return module.hot.status() === 'idle';
|
|
229
237
|
}
|
|
230
238
|
|
|
239
|
+
function canAcceptErrors() {
|
|
240
|
+
// NOTE: This var is injected by Webpack's DefinePlugin, and is a boolean instead of string.
|
|
241
|
+
const hasReactRefresh = process.env.FAST_REFRESH;
|
|
242
|
+
|
|
243
|
+
const status = module.hot.status();
|
|
244
|
+
// React refresh can handle hot-reloading over errors.
|
|
245
|
+
// However, when hot-reload status is abort or fail,
|
|
246
|
+
// it indicates the current update cannot be applied safely,
|
|
247
|
+
// and thus we should bail out to a forced reload for consistency.
|
|
248
|
+
return hasReactRefresh && ['abort', 'fail'].indexOf(status) === -1;
|
|
249
|
+
}
|
|
250
|
+
|
|
231
251
|
// Attempt to update code on the fly, fall back to a hard reload.
|
|
232
252
|
function tryApplyUpdates(onHotUpdateSuccess) {
|
|
233
253
|
if (!module.hot) {
|
|
@@ -241,7 +261,13 @@ function tryApplyUpdates(onHotUpdateSuccess) {
|
|
|
241
261
|
}
|
|
242
262
|
|
|
243
263
|
function handleApplyUpdates(err, updatedModules) {
|
|
244
|
-
|
|
264
|
+
const haveErrors = err || hadRuntimeError;
|
|
265
|
+
// When there is no error but updatedModules is unavailable,
|
|
266
|
+
// it indicates a critical failure in hot-reloading,
|
|
267
|
+
// e.g. server is not ready to serve new bundle,
|
|
268
|
+
// and hence we need to do a forced reload.
|
|
269
|
+
const needsForcedReload = !err && !updatedModules;
|
|
270
|
+
if ((haveErrors && !canAcceptErrors()) || needsForcedReload) {
|
|
245
271
|
window.location.reload();
|
|
246
272
|
return;
|
|
247
273
|
}
|
|
@@ -258,7 +284,7 @@ function tryApplyUpdates(onHotUpdateSuccess) {
|
|
|
258
284
|
}
|
|
259
285
|
|
|
260
286
|
// https://webpack.github.io/docs/hot-module-replacement.html#check
|
|
261
|
-
|
|
287
|
+
var result = module.hot.check(/* autoApply */ true, handleApplyUpdates);
|
|
262
288
|
|
|
263
289
|
// // webpack 2 returns a Promise instead of invoking a callback
|
|
264
290
|
if (result && result.then) {
|
|
@@ -83,10 +83,9 @@ export default function (workDir: string, envId: string): Configuration {
|
|
|
83
83
|
new ReactRefreshWebpackPlugin({
|
|
84
84
|
overlay: {
|
|
85
85
|
sockPath: `_hmr/${envId}`,
|
|
86
|
-
// TODO
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
module: require.resolve('./refresh'),
|
|
86
|
+
// TODO - react-error-overlay not showing runtime errors - https://github.com/teambit/bit/issues/5452
|
|
87
|
+
entry: require.resolve('./overlay/webpackHotDevClient'),
|
|
88
|
+
module: require.resolve('./overlay/refreshOverlayInterop'),
|
|
90
89
|
},
|
|
91
90
|
|
|
92
91
|
// we use '@pmmmwh/react-refresh-webpack-plugin/loader' directly where relevant.
|