@teambit/react 0.0.657 → 0.0.660

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 (48) hide show
  1. package/{__compositions-1645759524217.js → __compositions-1646018619726.js} +0 -0
  2. package/{__overview-1645759524217.js → __overview-1646018619726.js} +0 -0
  3. package/{__preview-1645759524217.js → __preview-1646018619726.js} +2 -2
  4. package/artifacts/env-template/public/141.js +1 -1
  5. package/artifacts/env-template/public/181.js +1 -1
  6. package/artifacts/env-template/public/719.js +6 -6
  7. package/artifacts/env-template/public/848.js +1 -1
  8. package/artifacts/env-template/public/864.js +1 -0
  9. package/artifacts/env-template/public/assets-manifest.json +16 -16
  10. package/artifacts/env-template/public/compositions.752cf13a1746726ef2c9.js +1 -0
  11. package/artifacts/env-template/public/compositions.html +1 -1
  12. package/artifacts/env-template/public/{overview.dd7be883417caf750b38.js → overview.ac72670e087df5dda9d6.js} +1 -1
  13. package/artifacts/env-template/public/overview.html +1 -1
  14. package/artifacts/env-template/public/preview-root.89a0f6d48b09f77957ad.js +1 -0
  15. package/artifacts/env-template/public/service-worker.js +1 -1
  16. package/artifacts/env-template/public/static/css/719.2ea24b38.css +1 -0
  17. package/artifacts/env-template/public/static/css/compositions.ef89e3a6.css +1 -0
  18. package/artifacts/env-template/public/static/css/{overview.7bb7dce6.css → overview.811feff5.css} +1 -1
  19. package/artifacts/env-template/public/static/css/previewRoot.7ec209f3.css +1 -0
  20. package/artifacts/preview/teambit_react_react-preview.js +1 -1
  21. package/dist/webpack/{format-webpack-messages.js → overlay/formatWebpackMessages.js} +28 -14
  22. package/dist/webpack/overlay/formatWebpackMessages.js.map +1 -0
  23. package/dist/webpack/{launch-editor-endpoint.js → overlay/launchEditorEndpoint.js} +4 -3
  24. package/dist/webpack/overlay/launchEditorEndpoint.js.map +1 -0
  25. package/dist/webpack/{refresh.js → overlay/refreshOverlayInterop.js} +4 -1
  26. package/dist/webpack/overlay/refreshOverlayInterop.js.map +1 -0
  27. package/dist/webpack/{react-hot-dev-client.js → overlay/webpackHotDevClient.js} +70 -52
  28. package/dist/webpack/overlay/webpackHotDevClient.js.map +1 -0
  29. package/dist/webpack/webpack.config.component.dev.js +3 -4
  30. package/dist/webpack/webpack.config.component.dev.js.map +1 -1
  31. package/package-tar/teambit-react-0.0.660.tgz +0 -0
  32. package/package.json +35 -34
  33. package/webpack/{format-webpack-messages.js → overlay/formatWebpackMessages.js} +21 -6
  34. package/webpack/{launch-editor-endpoint.js → overlay/launchEditorEndpoint.js} +3 -0
  35. package/webpack/{refresh.js → overlay/refreshOverlayInterop.js} +3 -0
  36. package/webpack/{react-hot-dev-client.js → overlay/webpackHotDevClient.js} +70 -44
  37. package/webpack/webpack.config.component.dev.ts +3 -4
  38. package/artifacts/env-template/public/630.js +0 -1
  39. package/artifacts/env-template/public/compositions.9fc7bd1805a663d9e969.js +0 -1
  40. package/artifacts/env-template/public/preview-root.c077b08ae05bc42cdb9b.js +0 -1
  41. package/artifacts/env-template/public/static/css/719.9bbec047.css +0 -1
  42. package/artifacts/env-template/public/static/css/compositions.cd8be53f.css +0 -1
  43. package/artifacts/env-template/public/static/css/previewRoot.1262db93.css +0 -1
  44. package/dist/webpack/format-webpack-messages.js.map +0 -1
  45. package/dist/webpack/launch-editor-endpoint.js.map +0 -1
  46. package/dist/webpack/react-hot-dev-client.js.map +0 -1
  47. package/dist/webpack/refresh.js.map +0 -1
  48. package/package-tar/teambit-react-0.0.657.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;;AA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A;AACEnB,QAAAA,IAAI,EAAE,SADR;AAEE;AACAE,QAAAA,OAAO,EAAEC,gBAAKC,IAAL,CAAUR,OAAV,EAAmB,cAAnB,CAHX;AAIE;AACAS,QAAAA,eAAe,EAAE;AAAEC,UAAAA,WAAW,EAAGC,KAAD,IAAW,CAAC,CAACA;AAA5B,SALnB;AAMEC,QAAAA,GAAG,EAAE,CACHC,OAAO,CAACC,OAAR,CAAgB,6CAAhB,CADG,EAEH;AACEG,UAAAA,MAAM,EAAEJ,OAAO,CAACC,OAAR,CAAgB,cAAhB,CADV;AAEEI,UAAAA,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;AACA;AACA2B,QAAAA,KAAK,EAAEf,OAAO,CAACC,OAAR,CAAgB,wBAAhB,CAJA;AAKPZ,QAAAA,MAAM,EAAEW,OAAO,CAACC,OAAR,CAAgB,WAAhB;AALD,OADmB;AAS5B;AACA;AACA;AACAR,MAAAA,OAAO,EAAEP;AAZmB,KAA9B,CAHO;AAhEJ,GAAP;AAmFD","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: check why webpackHotDevClient and react-error-overlay are not responding for runtime\n // errors\n entry: require.resolve('./react-hot-dev-client'),\n module: require.resolve('./refresh'),\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"]}
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,QAAAA,eAAe,EAAE;AAAEC,UAAAA,WAAW,EAAGC,KAAD,IAAW,CAAC,CAACA;AAA5B,SAPnB;AAQEC,QAAAA,GAAG,EAAE,CAACC,OAAO,CAACC,OAAR,CAAgB,mBAAhB,CAAD;AARP,OAD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AhB,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"]}
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@teambit/react",
3
- "version": "0.0.657",
3
+ "version": "0.0.660",
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.657"
9
+ "version": "0.0.660"
10
10
  },
11
11
  "dependencies": {
12
12
  "react-error-boundary": "^3.0.0",
@@ -32,16 +32,16 @@
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",
40
38
  "workbox-webpack-plugin": "6.2.4",
41
39
  "mini-css-extract-plugin": "2.2.2",
42
- "react-dev-utils": "11.0.4",
40
+ "react-dev-utils": "12.0.0",
43
41
  "style-loader": "^2.0.0",
44
- "@pmmmwh/react-refresh-webpack-plugin": "0.5.1",
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,39 +79,39 @@
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.657",
82
+ "@teambit/preview": "0.0.660",
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.657",
89
- "@teambit/bundler": "0.0.657",
90
- "@teambit/compiler": "0.0.657",
88
+ "@teambit/builder": "0.0.660",
89
+ "@teambit/bundler": "0.0.660",
90
+ "@teambit/compiler": "0.0.660",
91
91
  "@teambit/component.modules.component-url": "0.0.123",
92
- "@teambit/component": "0.0.657",
93
- "@teambit/envs": "0.0.657",
94
- "@teambit/eslint": "0.0.657",
95
- "@teambit/formatter": "0.0.208",
96
- "@teambit/jest": "0.0.657",
97
- "@teambit/linter": "0.0.657",
98
- "@teambit/pkg": "0.0.657",
99
- "@teambit/prettier": "0.0.208",
92
+ "@teambit/component": "0.0.660",
93
+ "@teambit/envs": "0.0.660",
94
+ "@teambit/eslint": "0.0.660",
95
+ "@teambit/formatter": "0.0.211",
96
+ "@teambit/jest": "0.0.660",
97
+ "@teambit/linter": "0.0.660",
98
+ "@teambit/pkg": "0.0.660",
99
+ "@teambit/prettier": "0.0.211",
100
100
  "@teambit/react.ui.highlighter.component-metadata.bit-component-meta": "0.0.21",
101
- "@teambit/schema": "0.0.657",
102
- "@teambit/tester": "0.0.657",
103
- "@teambit/typescript": "0.0.657",
104
- "@teambit/webpack": "0.0.657",
105
- "@teambit/workspace": "0.0.657",
106
- "@teambit/application": "0.0.299",
107
- "@teambit/cli": "0.0.448",
108
- "@teambit/dependency-resolver": "0.0.657",
109
- "@teambit/generator": "0.0.657",
110
- "@teambit/graphql": "0.0.657",
101
+ "@teambit/schema": "0.0.660",
102
+ "@teambit/tester": "0.0.660",
103
+ "@teambit/typescript": "0.0.660",
104
+ "@teambit/webpack": "0.0.660",
105
+ "@teambit/workspace": "0.0.660",
106
+ "@teambit/application": "0.0.302",
107
+ "@teambit/cli": "0.0.449",
108
+ "@teambit/dependency-resolver": "0.0.660",
109
+ "@teambit/generator": "0.0.660",
110
+ "@teambit/graphql": "0.0.660",
111
111
  "@teambit/react.ui.highlighter-provider": "0.0.184",
112
- "@teambit/compositions": "0.0.657",
113
- "@teambit/ui": "0.0.657",
114
- "@teambit/react.eslint-config-bit-react": "0.0.525",
112
+ "@teambit/compositions": "0.0.660",
113
+ "@teambit/ui": "0.0.660",
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",
117
117
  "@teambit/webpack.modules.config-mutator": "0.0.137",
@@ -121,7 +121,7 @@
121
121
  "@teambit/webpack.modules.style-regexps": "0.0.132",
122
122
  "@teambit/component-id": "0.0.401",
123
123
  "@teambit/toolbox.network.get-port": "0.0.113",
124
- "@teambit/config": "0.0.461"
124
+ "@teambit/config": "0.0.462"
125
125
  },
126
126
  "devDependencies": {
127
127
  "@types/react": "^17.0.8",
@@ -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",
@@ -139,7 +140,7 @@
139
140
  "@teambit/react.aspect-docs.react": "0.0.132"
140
141
  },
141
142
  "peerDependencies": {
142
- "@teambit/legacy": "1.0.227",
143
+ "@teambit/legacy": "1.0.228",
143
144
  "react-dom": "^16.8.0 || ^17.0.0",
144
145
  "react": "^16.8.0 || ^17.0.0"
145
146
  },
@@ -201,7 +202,7 @@
201
202
  "@types/jest": "^26.0.0"
202
203
  },
203
204
  "peerDependencies": {
204
- "@teambit/legacy": "1.0.227",
205
+ "@teambit/legacy": "1.0.228",
205
206
  "react-dom": "^16.8.0 || ^17.0.0",
206
207
  "react": "^16.8.0 || ^17.0.0"
207
208
  }
@@ -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(error) {
15
- let message = error.message;
16
- let lines = message.split('\n');
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.+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.';
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,3 +1,6 @@
1
+ /* eslint-disable */
2
+ /** this file was copied as is from react-dev-utils/refreshOverlayInterop */
3
+
1
4
  // @remove-on-eject-begin
2
5
  /**
3
6
  * Copyright (c) 2015-present, Facebook, Inc.
@@ -1,25 +1,46 @@
1
- /* eslint-disable promise/catch-or-return */
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
- const stripAnsi = require('strip-ansi');
9
- const ErrorOverlay = require('react-error-overlay');
10
- const url = require('url');
11
- const launchEditorEndpoint = require('./launch-editor-endpoint');
12
- const formatWebpackMessages = require('./format-webpack-messages');
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
- `${launchEditorEndpoint}?fileName=${window.encodeURIComponent(
19
- errorLocation.fileName
20
- )}&lineNumber=${window.encodeURIComponent(errorLocation.lineNumber || 1)}&colNumber=${window.encodeURIComponent(
21
- errorLocation.colNumber || 1
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
- let hadRuntimeError = false;
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
- const connection = new WebSocket(
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
- // Hardcoded in WebpackDevServer
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
- let isFirstCompilation = true;
76
- let mostRecentCompilationHash = null;
77
- let hasCompileErrors = false;
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
- const isHotUpdate = !isFirstCompilation;
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
- const isHotUpdate = !isFirstCompilation;
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
- const formatted = formatWebpackMessages({
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
- // eslint-disable-next-line no-plusplus
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
- const formatted = formatWebpackMessages({
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
- // eslint-disable-next-line no-plusplus
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
- const message = JSON.parse(e.data);
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
- if (err || !updatedModules || hadRuntimeError) {
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
- const result = module.hot.check(/* autoApply */ true, handleApplyUpdates);
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: check why webpackHotDevClient and react-error-overlay are not responding for runtime
87
- // errors
88
- entry: require.resolve('./react-hot-dev-client'),
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.