@shuvi/platform-web 1.0.20 → 1.0.22

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.
@@ -269,12 +269,14 @@ function tryApplyUpdates(onHotUpdateSuccess) {
269
269
  return;
270
270
  }
271
271
  if (!isUpdateAvailable() || !canApplyUpdates()) {
272
- onBuildOk();
273
272
  // HMR failed, need to refresh
274
273
  const hmrStatus = module.hot.status();
275
274
  if (hmrStatus === 'abort' || hmrStatus === 'fail') {
276
275
  window.location.reload();
277
276
  }
277
+ else {
278
+ onBuildOk();
279
+ }
278
280
  return;
279
281
  }
280
282
  function handleApplyUpdates(err, updatedModules) {
@@ -299,34 +301,38 @@ function tryApplyUpdates(onHotUpdateSuccess) {
299
301
  onBuildOk();
300
302
  }
301
303
  }
302
- try {
303
- // https://webpack.js.org/api/hot-module-replacement/#check
304
- let updatedModules = yield module.hot.check(/* autoApply */ false);
305
- if (!updatedModules) {
306
- return;
307
- }
308
- // if there is another updating, delay the update
309
- // multiple hotupdate occurs during import() will cause hmr error
310
- // so we delay the adjacent hotupdates
311
- // import() == loade module script ----> require(module)
312
- // |
313
- // |
314
- // if applyUpdate happens here, require will cause a error
315
- if (isUpdateAvailable()) {
316
- yield new Promise(resolve => {
317
- setTimeout(resolve, 50);
318
- });
319
- }
320
- if (updatedModules) {
321
- if (module.hot.status() !== 'ready') {
322
- yield waitForReady();
323
- }
324
- updatedModules = yield module.hot.apply();
325
- }
304
+ module.hot.check(/* autoApply */ true).then((updatedModules) => {
326
305
  handleApplyUpdates(null, updatedModules);
327
- }
328
- catch (err) {
306
+ }, (err) => {
329
307
  handleApplyUpdates(err, null);
330
- }
308
+ });
309
+ // try {
310
+ // // https://webpack.js.org/api/hot-module-replacement/#check
311
+ // let updatedModules = await module.hot.check(/* autoApply */ false);
312
+ // if (!updatedModules) {
313
+ // return;
314
+ // }
315
+ // // if there is another updating, delay the update
316
+ // // multiple hotupdate occurs during import() will cause hmr error
317
+ // // so we delay the adjacent hotupdates
318
+ // // import() == loade module script ----> require(module)
319
+ // // |
320
+ // // |
321
+ // // if applyUpdate happens here, require will cause a error
322
+ // if (isUpdateAvailable()) {
323
+ // await new Promise(resolve => {
324
+ // setTimeout(resolve, 50);
325
+ // });
326
+ // }
327
+ // if (updatedModules) {
328
+ // if (module.hot.status() !== 'ready') {
329
+ // await waitForReady();
330
+ // }
331
+ // updatedModules = await module.hot.apply();
332
+ // }
333
+ // handleApplyUpdates(null, updatedModules);
334
+ // } catch (err) {
335
+ // handleApplyUpdates(err, null);
336
+ // }
331
337
  });
332
338
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shuvi/platform-web",
3
- "version": "1.0.20",
3
+ "version": "1.0.22",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/shuvijs/shuvi.git",
@@ -72,18 +72,18 @@
72
72
  },
73
73
  "dependencies": {
74
74
  "@next/react-refresh-utils": "12.1.6",
75
- "@shuvi/error-overlay": "1.0.20",
76
- "@shuvi/hook": "1.0.20",
77
- "@shuvi/platform-shared": "1.0.20",
78
- "@shuvi/router": "1.0.20",
79
- "@shuvi/router-react": "1.0.20",
80
- "@shuvi/runtime": "1.0.20",
81
- "@shuvi/shared": "1.0.20",
82
- "@shuvi/toolpack": "1.0.20",
83
- "@shuvi/utils": "1.0.20",
75
+ "@shuvi/error-overlay": "1.0.22",
76
+ "@shuvi/hook": "1.0.22",
77
+ "@shuvi/platform-shared": "1.0.22",
78
+ "@shuvi/router": "1.0.22",
79
+ "@shuvi/router-react": "1.0.22",
80
+ "@shuvi/runtime": "1.0.22",
81
+ "@shuvi/shared": "1.0.22",
82
+ "@shuvi/toolpack": "1.0.22",
83
+ "@shuvi/utils": "1.0.22",
84
84
  "content-type": "1.0.4",
85
85
  "core-js": "3.6.5",
86
- "doura": "0.0.9",
86
+ "doura": "0.0.10",
87
87
  "ejs": "3.1.5",
88
88
  "fs-extra": "9.0.1",
89
89
  "node-mocks-http": "1.11.0",
@@ -91,14 +91,14 @@
91
91
  "raw-body": "2.4.1",
92
92
  "react": "18.2.0",
93
93
  "react-dom": "18.2.0",
94
- "react-doura": "0.0.9",
94
+ "react-doura": "0.0.10",
95
95
  "react-refresh": "0.12.0",
96
96
  "strip-ansi": "6.0.0",
97
97
  "use-sync-external-store": "1.1.0",
98
98
  "whatwg-fetch": "3.0.0"
99
99
  },
100
100
  "peerDependencies": {
101
- "@shuvi/service": "1.0.20"
101
+ "@shuvi/service": "1.0.22"
102
102
  },
103
103
  "devDependencies": {
104
104
  "@shuvi/service": "workspace:*",