@umijs/bundler-webpack 4.0.0-rc.11 → 4.0.0-rc.14

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 (44) hide show
  1. package/client/client/client.js +15 -7
  2. package/client/constants.js +6 -0
  3. package/compiled/cssnano/index.js +6 -6
  4. package/compiled/fork-ts-checker-webpack-plugin/index.js +7 -13
  5. package/compiled/{tapable → react-refresh}/LICENSE +6 -6
  6. package/compiled/react-refresh/index.js +9 -7
  7. package/compiled/react-refresh/package.json +1 -0
  8. package/compiled/webpack/BasicEffectRulePlugin.js +1 -0
  9. package/compiled/webpack/BasicMatcherRulePlugin.js +1 -0
  10. package/compiled/webpack/HotModuleReplacement.runtime.js +29 -14
  11. package/compiled/webpack/JavascriptHotModuleReplacement.runtime.js +4 -3
  12. package/compiled/webpack/ObjectMatcherRulePlugin.js +1 -0
  13. package/compiled/webpack/RuleSetCompiler.js +1 -0
  14. package/compiled/webpack/UseEffectRulePlugin.js +1 -0
  15. package/compiled/webpack/deepImports.json +6 -1
  16. package/compiled/webpack/index.js +4473 -2910
  17. package/compiled/webpack/types.d.ts +606 -171
  18. package/compiled/webpack-manifest-plugin/index.js +1 -1
  19. package/dist/build.d.ts +1 -0
  20. package/dist/build.js +2 -0
  21. package/dist/client/client.js +15 -7
  22. package/dist/config/compressPlugin.js +9 -1
  23. package/dist/config/config.d.ts +2 -0
  24. package/dist/config/config.js +7 -4
  25. package/dist/config/javaScriptRules.d.ts +1 -0
  26. package/dist/config/javaScriptRules.js +36 -12
  27. package/dist/config/nodePolyfill.js +2 -1
  28. package/dist/constants.d.ts +1 -0
  29. package/dist/constants.js +7 -1
  30. package/dist/dev.d.ts +4 -0
  31. package/dist/dev.js +33 -7
  32. package/dist/schema.js +2 -0
  33. package/dist/server/https.d.ts +1 -2
  34. package/dist/server/https.js +3 -2
  35. package/dist/server/server.d.ts +1 -0
  36. package/dist/server/server.js +19 -13
  37. package/dist/server/ws.d.ts +3 -1
  38. package/dist/types.d.ts +1 -0
  39. package/dist/utils/getEsBuildTarget.d.ts +5 -0
  40. package/dist/utils/getEsBuildTarget.js +12 -0
  41. package/package.json +19 -18
  42. package/compiled/tapable/index.js +0 -1
  43. package/compiled/tapable/package.json +0 -1
  44. package/compiled/tapable/tapable.d.ts +0 -116
@@ -13,21 +13,29 @@ import * as ErrorOverlay from 'react-error-overlay';
13
13
  import { MESSAGE_TYPE } from '../constants';
14
14
  import { formatWebpackMessages } from '../utils/formatWebpackMessages';
15
15
  console.log('[webpack] connecting...');
16
- function getSocketHost() {
17
- let l = location;
16
+ function getHost() {
18
17
  if (process.env.SOCKET_SERVER) {
19
- l = new URL(process.env.SOCKET_SERVER);
18
+ return new URL(process.env.SOCKET_SERVER);
20
19
  }
21
- const host = l.host;
22
- const isHttps = l.protocol === 'https:';
20
+ return location;
21
+ }
22
+ function getSocketUrl() {
23
+ let h = getHost();
24
+ const host = h.host;
25
+ const isHttps = h.protocol === 'https:';
23
26
  return `${isHttps ? 'wss' : 'ws'}://${host}`;
24
27
  }
28
+ function getPingUrl() {
29
+ const h = getHost();
30
+ return `${h.protocol}//${h.host}/__umi_ping`;
31
+ }
25
32
  let pingTimer = null;
26
33
  let isFirstCompilation = true;
27
34
  let mostRecentCompilationHash = null;
28
35
  let hasCompileErrors = false;
29
36
  let hadRuntimeError = false;
30
- const socket = new WebSocket(getSocketHost(), 'webpack-hmr');
37
+ const pingUrl = getPingUrl();
38
+ const socket = new WebSocket(getSocketUrl(), 'webpack-hmr');
31
39
  socket.addEventListener('message', ({ data }) => __awaiter(void 0, void 0, void 0, function* () {
32
40
  data = JSON.parse(data);
33
41
  if (data.type === 'connected') {
@@ -45,7 +53,7 @@ function waitForSuccessfulPing(ms = 1000) {
45
53
  // eslint-disable-next-line no-constant-condition
46
54
  while (true) {
47
55
  try {
48
- yield fetch(`/__umi_ping`);
56
+ yield fetch(pingUrl);
49
57
  break;
50
58
  }
51
59
  catch (e) {
@@ -13,3 +13,9 @@ export var MESSAGE_TYPE;
13
13
  export const DEFAULT_BROWSER_TARGETS = {
14
14
  chrome: 80,
15
15
  };
16
+ export const DEFAULT_ESBUILD_TARGET_KEYS = [
17
+ 'chrome',
18
+ 'firefox',
19
+ 'edge',
20
+ 'safari',
21
+ ];