@atlaspack/runtime-browser-hmr 2.14.21-typescript-5b4d3ad41.0 → 2.14.21

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.
@@ -1,3 +1,4 @@
1
+ // @flow
1
2
  /* global HMR_HOST, HMR_PORT, HMR_ENV_HASH, HMR_SECURE, HMR_USE_SSE, chrome, browser, __parcel__import__, __parcel__importScripts__, ServiceWorkerGlobalScope */
2
3
 
3
4
  /*::
@@ -48,85 +49,57 @@ declare var globalThis: typeof self;
48
49
  declare var ServiceWorkerGlobalScope: Object;
49
50
  */
50
51
 
51
- // flow-to-ts helpers
52
- export type SetComplement<A, B extends A> = A extends B ? never : A;
53
- export type Diff<T extends U, U extends object> = Pick<
54
- T,
55
- SetComplement<keyof T, keyof U>
56
- >;
57
- // /flow-to-ts helpers
58
-
59
52
  var OVERLAY_ID = '__parcel__error__overlay__';
60
53
 
61
- // @ts-expect-error TS2339
62
54
  var OldModule = module.bundle.Module;
63
55
 
64
- function Module(moduleName: any) {
65
- // @ts-expect-error TS2683
56
+ function Module(moduleName) {
66
57
  OldModule.call(this, moduleName);
67
- // @ts-expect-error TS2683
68
58
  this.hot = {
69
- // @ts-expect-error TS2339
70
59
  data: module.bundle.hotData[moduleName],
71
60
  _acceptCallbacks: [],
72
61
  _disposeCallbacks: [],
73
- // @ts-expect-error TS7006
74
62
  accept: function (fn) {
75
63
  this._acceptCallbacks.push(fn || function () {});
76
64
  },
77
- // @ts-expect-error TS7006
78
65
  dispose: function (fn) {
79
66
  this._disposeCallbacks.push(fn);
80
67
  },
81
68
  };
82
- // @ts-expect-error TS2339
83
69
  module.bundle.hotData[moduleName] = undefined;
84
70
  }
85
- // @ts-expect-error TS2339
86
71
  module.bundle.Module = Module;
87
- // @ts-expect-error TS2339
88
72
  module.bundle.hotData = {};
89
73
 
90
- // @ts-expect-error TS7034
91
74
  var checkedAssets /*: {|[string]: boolean|} */,
92
- // @ts-expect-error TS7034
93
75
  disposedAssets /*: {|[string]: boolean|} */,
94
- // @ts-expect-error TS7034
95
76
  assetsToDispose /*: Array<[ParcelRequire, string]> */,
96
- // @ts-expect-error TS7034
97
77
  assetsToAccept /*: Array<[ParcelRequire, string]> */;
98
78
 
99
79
  function getHostname() {
100
80
  return (
101
- // @ts-expect-error TS2304
102
81
  HMR_HOST ||
103
- // @ts-expect-error TS2304
104
82
  (location.protocol.indexOf('http') === 0 ? location.hostname : 'localhost')
105
83
  );
106
84
  }
107
85
 
108
86
  function getPort() {
109
- // @ts-expect-error TS2304
110
87
  return HMR_PORT || location.port;
111
88
  }
112
89
 
113
90
  // eslint-disable-next-line no-redeclare
114
- // @ts-expect-error TS2339
115
91
  var parent = module.bundle.parent;
116
92
  if ((!parent || !parent.isParcelRequire) && typeof WebSocket !== 'undefined') {
117
93
  var hostname = getHostname();
118
94
  var port = getPort();
119
95
  var protocol =
120
- // @ts-expect-error TS2304
121
96
  HMR_SECURE ||
122
- // @ts-expect-error TS2304
123
97
  (location.protocol == 'https:' &&
124
98
  !['localhost', '127.0.0.1', '0.0.0.0'].includes(hostname))
125
99
  ? 'wss'
126
100
  : 'ws';
127
101
 
128
102
  var ws;
129
- // @ts-expect-error TS2304
130
103
  if (HMR_USE_SSE) {
131
104
  ws = new EventSource('/__parcel_hmr');
132
105
  } else {
@@ -134,7 +107,7 @@ if ((!parent || !parent.isParcelRequire) && typeof WebSocket !== 'undefined') {
134
107
  ws = new WebSocket(
135
108
  protocol + '://' + hostname + (port ? ':' + port : '') + '/',
136
109
  );
137
- } catch (err: any) {
110
+ } catch (err) {
138
111
  if (err.message) {
139
112
  console.error(err.message);
140
113
  }
@@ -144,33 +117,25 @@ if ((!parent || !parent.isParcelRequire) && typeof WebSocket !== 'undefined') {
144
117
 
145
118
  // Web extension context
146
119
  var extCtx =
147
- // @ts-expect-error TS2304
148
120
  typeof browser === 'undefined'
149
- ? // @ts-expect-error TS2304
150
- typeof chrome === 'undefined'
121
+ ? typeof chrome === 'undefined'
151
122
  ? null
152
- : // @ts-expect-error TS2304
153
- chrome
154
- : // @ts-expect-error TS2304
155
- browser;
123
+ : chrome
124
+ : browser;
156
125
 
157
126
  // Safari doesn't support sourceURL in error stacks.
158
127
  // eval may also be disabled via CSP, so do a quick check.
159
128
  var supportsSourceURL = false;
160
129
  try {
161
130
  (0, eval)('throw new Error("test"); //# sourceURL=test.js');
162
- } catch (err: any) {
131
+ } catch (err) {
163
132
  supportsSourceURL = err.stack.includes('test.js');
164
133
  }
165
134
 
166
- // @ts-expect-error TS2339
167
- ws.onmessage = async function (
168
- event: {
169
- data: string;
170
- } /*: {data: string, ...} */,
171
- ) {
172
- checkedAssets = {} /*: {|[string]: boolean|} */;
173
- disposedAssets = {} /*: {|[string]: boolean|} */;
135
+ // $FlowFixMe
136
+ ws.onmessage = async function (event /*: {data: string, ...} */) {
137
+ checkedAssets = ({} /*: {|[string]: boolean|} */);
138
+ disposedAssets = ({} /*: {|[string]: boolean|} */);
174
139
  assetsToAccept = [];
175
140
  assetsToDispose = [];
176
141
 
@@ -180,23 +145,19 @@ if ((!parent || !parent.isParcelRequire) && typeof WebSocket !== 'undefined') {
180
145
  fullReload();
181
146
  } else if (data.type === 'update') {
182
147
  // Remove error overlay if there is one
183
- // @ts-expect-error TS2304
184
148
  if (typeof document !== 'undefined') {
185
149
  removeErrorOverlay();
186
150
  }
187
151
 
188
152
  let assets = data.assets.filter(
189
- // @ts-expect-error TS7006
190
153
  (asset) => asset.envHash === HMR_ENV_HASH,
191
154
  );
192
155
 
193
156
  // Handle HMR Update
194
- // @ts-expect-error TS7006
195
157
  let handled = assets.every((asset) => {
196
158
  return (
197
159
  asset.type === 'css' ||
198
160
  (asset.type === 'js' &&
199
- // @ts-expect-error TS2339
200
161
  hmrAcceptCheck(module.bundle.root, asset.id, asset.depsByBundle))
201
162
  );
202
163
  });
@@ -206,11 +167,9 @@ if ((!parent || !parent.isParcelRequire) && typeof WebSocket !== 'undefined') {
206
167
 
207
168
  // Dispatch custom event so other runtimes (e.g React Refresh) are aware.
208
169
  if (
209
- // @ts-expect-error TS2304
210
170
  typeof window !== 'undefined' &&
211
171
  typeof CustomEvent !== 'undefined'
212
172
  ) {
213
- // @ts-expect-error TS2304
214
173
  window.dispatchEvent(new CustomEvent('parcelhmraccept'));
215
174
  }
216
175
 
@@ -219,13 +178,11 @@ if ((!parent || !parent.isParcelRequire) && typeof WebSocket !== 'undefined') {
219
178
  hmrDisposeQueue();
220
179
 
221
180
  // Run accept callbacks. This will also re-execute other disposed assets in topological order.
222
- let processedAssets: Record<string, any> = {};
181
+ let processedAssets = {};
223
182
  for (let i = 0; i < assetsToAccept.length; i++) {
224
- // @ts-expect-error TS7005
225
183
  let id = assetsToAccept[i][1];
226
184
 
227
185
  if (!processedAssets[id]) {
228
- // @ts-expect-error TS7005
229
186
  hmrAccept(assetsToAccept[i][0], id);
230
187
  processedAssets[id] = true;
231
188
  }
@@ -250,23 +207,22 @@ if ((!parent || !parent.isParcelRequire) && typeof WebSocket !== 'undefined') {
250
207
  );
251
208
  }
252
209
 
253
- // @ts-expect-error TS2304
254
210
  if (typeof document !== 'undefined') {
255
211
  // Render the fancy html overlay
256
212
  removeErrorOverlay();
257
213
  var overlay = createErrorOverlay(data.diagnostics.html);
258
- // @ts-expect-error TS2304
214
+ // $FlowFixMe
259
215
  document.body.appendChild(overlay);
260
216
  }
261
217
  }
262
218
  };
263
219
  if (ws instanceof WebSocket) {
264
- ws.onerror = function (e: any) {
220
+ ws.onerror = function (e) {
265
221
  if (e.message) {
266
222
  console.error(e.message);
267
223
  }
268
224
  };
269
- ws.onclose = function (e: CloseEvent) {
225
+ ws.onclose = function (e) {
270
226
  if (process.env.ATLASPACK_BUILD_ENV !== 'test') {
271
227
  console.warn('[parcel] 🚨 Connection to the HMR server was lost');
272
228
  }
@@ -275,7 +231,6 @@ if ((!parent || !parent.isParcelRequire) && typeof WebSocket !== 'undefined') {
275
231
  }
276
232
 
277
233
  function removeErrorOverlay() {
278
- // @ts-expect-error TS2304
279
234
  var overlay = document.getElementById(OVERLAY_ID);
280
235
  if (overlay) {
281
236
  overlay.remove();
@@ -283,20 +238,7 @@ function removeErrorOverlay() {
283
238
  }
284
239
  }
285
240
 
286
- function createErrorOverlay(
287
- diagnostics: Array<
288
- Partial<
289
- Diff<
290
- // @ts-expect-error TS2304
291
- AnsiDiagnosticResult,
292
- {
293
- codeframe: string;
294
- }
295
- >
296
- >
297
- >,
298
- ) {
299
- // @ts-expect-error TS2304
241
+ function createErrorOverlay(diagnostics) {
300
242
  var overlay = document.createElement('div');
301
243
  overlay.id = OVERLAY_ID;
302
244
 
@@ -305,8 +247,7 @@ function createErrorOverlay(
305
247
 
306
248
  for (let diagnostic of diagnostics) {
307
249
  let stack = diagnostic.frames.length
308
- ? // @ts-expect-error TS7006
309
- diagnostic.frames.reduce((p, frame) => {
250
+ ? diagnostic.frames.reduce((p, frame) => {
310
251
  return `${p}
311
252
  <a href="/__parcel_launch_editor?file=${encodeURIComponent(
312
253
  frame.location,
@@ -325,7 +266,6 @@ ${frame.code}`;
325
266
  <pre>${stack}</pre>
326
267
  <div>
327
268
  ${diagnostic.hints
328
- // @ts-expect-error TS7006
329
269
  .map((hint) => '<div>💡 ' + hint + '</div>')
330
270
  .join('')}
331
271
  </div>
@@ -346,27 +286,20 @@ ${frame.code}`;
346
286
  }
347
287
 
348
288
  function fullReload() {
349
- // @ts-expect-error TS2304
350
289
  if ('reload' in location) {
351
- // @ts-expect-error TS2304
352
290
  location.reload();
353
291
  } else if (extCtx && extCtx.runtime && extCtx.runtime.reload) {
354
292
  extCtx.runtime.reload();
355
293
  }
356
294
  }
357
295
 
358
- function getParents(
359
- // @ts-expect-error TS2304
360
- bundle: ParcelRequire,
361
- id: string,
362
- ) /*: Array<[ParcelRequire, string]> */ {
296
+ function getParents(bundle, id) /*: Array<[ParcelRequire, string]> */ {
363
297
  var modules = bundle.modules;
364
298
  if (!modules) {
365
299
  return [];
366
300
  }
367
301
 
368
- // @ts-expect-error TS2304
369
- var parents: Array<[ParcelRequire, string]> = [];
302
+ var parents = [];
370
303
  var k, d, dep;
371
304
 
372
305
  for (k in modules) {
@@ -386,40 +319,38 @@ function getParents(
386
319
  return parents;
387
320
  }
388
321
 
389
- function updateLink(link: HTMLElement) {
390
- // @ts-expect-error TS2339
322
+ function updateLink(link) {
391
323
  var href = link.getAttribute('href');
392
324
 
393
325
  if (!href) {
394
326
  return;
395
327
  }
396
- // @ts-expect-error TS2339
397
328
  var newLink = link.cloneNode();
398
329
  newLink.onload = function () {
399
- // @ts-expect-error TS2339
400
330
  if (link.parentNode !== null) {
401
- // @ts-expect-error TS2339
331
+ // $FlowFixMe
402
332
  link.parentNode.removeChild(link);
403
333
  }
404
334
  };
405
- newLink.setAttribute('href', href.split('?')[0] + '?' + Date.now());
406
- // @ts-expect-error TS18047
335
+ newLink.setAttribute(
336
+ 'href',
337
+ // $FlowFixMe
338
+ href.split('?')[0] + '?' + Date.now(),
339
+ );
340
+ // $FlowFixMe
407
341
  link.parentNode.insertBefore(newLink, link.nextSibling);
408
342
  }
409
343
 
410
- // @ts-expect-error TS7034
411
344
  var cssTimeout = null;
412
345
  function reloadCSS() {
413
- // @ts-expect-error TS7005
414
346
  if (cssTimeout) {
415
347
  return;
416
348
  }
417
349
 
418
350
  cssTimeout = setTimeout(function () {
419
- // @ts-expect-error TS18047
420
- var document = window.document;
421
351
  var links = document.querySelectorAll('link[rel="stylesheet"]');
422
352
  for (var i = 0; i < links.length; i++) {
353
+ // $FlowFixMe[incompatible-type]
423
354
  var href /*: string */ = links[i].getAttribute('href');
424
355
  var hostname = getHostname();
425
356
  var servedFromHMRServer =
@@ -430,7 +361,6 @@ function reloadCSS() {
430
361
  : href.indexOf(hostname + ':' + getPort());
431
362
  var absolute =
432
363
  /^https?:\/\//i.test(href) &&
433
- // @ts-expect-error TS18047
434
364
  href.indexOf(location.origin) !== 0 &&
435
365
  !servedFromHMRServer;
436
366
  if (!absolute) {
@@ -442,60 +372,38 @@ function reloadCSS() {
442
372
  }, 50);
443
373
  }
444
374
 
445
- // @ts-expect-error TS2304
446
- function hmrDownload(asset: HMRAsset) {
375
+ function hmrDownload(asset) {
447
376
  if (asset.type === 'js') {
448
- // @ts-expect-error TS18047
449
377
  if (typeof document !== 'undefined') {
450
- // @ts-expect-error TS18047
451
378
  let script = document.createElement('script');
452
379
  script.src = asset.url + '?t=' + Date.now();
453
380
  if (asset.outputFormat === 'esmodule') {
454
381
  script.type = 'module';
455
382
  }
456
- return new Promise(
457
- (
458
- resolve: (
459
- result: Promise<HTMLScriptElement> | HTMLScriptElement,
460
- ) => void,
461
- reject: (error?: any) => void,
462
- ) => {
463
- script.onload = () => resolve(script);
464
- script.onerror = reject;
465
- // @ts-expect-error TS18047
466
- document.head?.appendChild(script);
467
- },
468
- );
469
- // @ts-expect-error TS2304
383
+ return new Promise((resolve, reject) => {
384
+ script.onload = () => resolve(script);
385
+ script.onerror = reject;
386
+ document.head?.appendChild(script);
387
+ });
470
388
  } else if (typeof importScripts === 'function') {
471
389
  // Worker scripts
472
390
  if (asset.outputFormat === 'esmodule') {
473
- // @ts-expect-error TS2304
474
391
  return __parcel__import__(asset.url + '?t=' + Date.now());
475
392
  } else {
476
- return new Promise(
477
- (
478
- resolve: (result: Promise<undefined> | undefined) => void,
479
- reject: (error?: any) => void,
480
- ) => {
481
- try {
482
- // @ts-expect-error TS2304
483
- __parcel__importScripts__(asset.url + '?t=' + Date.now());
484
- // @ts-expect-error TS2794
485
- resolve();
486
- } catch (err: any) {
487
- reject(err);
488
- }
489
- },
490
- );
393
+ return new Promise((resolve, reject) => {
394
+ try {
395
+ __parcel__importScripts__(asset.url + '?t=' + Date.now());
396
+ resolve();
397
+ } catch (err) {
398
+ reject(err);
399
+ }
400
+ });
491
401
  }
492
402
  }
493
403
  }
494
404
  }
495
405
 
496
- // @ts-expect-error TS2304
497
- async function hmrApplyUpdates(assets: Array<HMRAsset>) {
498
- // @ts-expect-error TS7017
406
+ async function hmrApplyUpdates(assets) {
499
407
  global.parcelHotUpdate = Object.create(null);
500
408
 
501
409
  let scriptsToRemove;
@@ -508,15 +416,13 @@ async function hmrApplyUpdates(assets: Array<HMRAsset>) {
508
416
  // This path is also taken if a CSP disallows eval.
509
417
  if (!supportsSourceURL) {
510
418
  let promises = assets.map((asset) =>
511
- hmrDownload(asset)?.catch((err: any) => {
419
+ hmrDownload(asset)?.catch((err) => {
512
420
  // Web extension fix
513
421
  if (
514
422
  extCtx &&
515
423
  extCtx.runtime &&
516
424
  extCtx.runtime.getManifest().manifest_version == 3 &&
517
- // @ts-expect-error TS2304
518
425
  typeof ServiceWorkerGlobalScope != 'undefined' &&
519
- // @ts-expect-error TS2304
520
426
  global instanceof ServiceWorkerGlobalScope
521
427
  ) {
522
428
  extCtx.runtime.reload();
@@ -530,18 +436,14 @@ async function hmrApplyUpdates(assets: Array<HMRAsset>) {
530
436
  }
531
437
 
532
438
  assets.forEach(function (asset) {
533
- // @ts-expect-error TS2339
534
439
  hmrApply(module.bundle.root, asset);
535
440
  });
536
441
  } finally {
537
- // @ts-expect-error TS7017
538
442
  delete global.parcelHotUpdate;
539
443
 
540
444
  if (scriptsToRemove) {
541
- // @ts-expect-error TS7006
542
445
  scriptsToRemove.forEach((script) => {
543
446
  if (script) {
544
- // @ts-expect-error TS18047
545
447
  document.head?.removeChild(script);
546
448
  }
547
449
  });
@@ -549,12 +451,7 @@ async function hmrApplyUpdates(assets: Array<HMRAsset>) {
549
451
  }
550
452
  }
551
453
 
552
- function hmrApply(
553
- // @ts-expect-error TS2304
554
- bundle: ParcelRequire /*: ParcelRequire */,
555
- // @ts-expect-error TS2304
556
- asset: HMRAsset /*: HMRAsset */,
557
- ) {
454
+ function hmrApply(bundle /*: ParcelRequire */, asset /*: HMRAsset */) {
558
455
  var modules = bundle.modules;
559
456
  if (!modules) {
560
457
  return;
@@ -572,10 +469,8 @@ function hmrApply(
572
469
  for (let dep in oldDeps) {
573
470
  if (!deps[dep] || deps[dep] !== oldDeps[dep]) {
574
471
  let id = oldDeps[dep];
575
- // @ts-expect-error TS2339
576
472
  let parents = getParents(module.bundle.root, id);
577
473
  if (parents.length === 1) {
578
- // @ts-expect-error TS2339
579
474
  hmrDelete(module.bundle.root, id);
580
475
  }
581
476
  }
@@ -588,7 +483,7 @@ function hmrApply(
588
483
  (0, eval)(asset.output);
589
484
  }
590
485
 
591
- // @ts-expect-error TS7017
486
+ // $FlowFixMe
592
487
  let fn = global.parcelHotUpdate[asset.id];
593
488
  modules[asset.id] = [fn, deps];
594
489
  }
@@ -601,8 +496,7 @@ function hmrApply(
601
496
  }
602
497
  }
603
498
 
604
- // @ts-expect-error TS2304
605
- function hmrDelete(bundle: ParcelRequire, id: string) {
499
+ function hmrDelete(bundle, id) {
606
500
  let modules = bundle.modules;
607
501
  if (!modules) {
608
502
  return;
@@ -611,9 +505,8 @@ function hmrDelete(bundle: ParcelRequire, id: string) {
611
505
  if (modules[id]) {
612
506
  // Collect dependencies that will become orphaned when this module is deleted.
613
507
  let deps = modules[id][1];
614
- let orphans: Array<string> = [];
508
+ let orphans = [];
615
509
  for (let dep in deps) {
616
- // @ts-expect-error TS2339
617
510
  let parents = getParents(module.bundle.root, deps[dep]);
618
511
  if (parents.length === 1) {
619
512
  orphans.push(deps[dep]);
@@ -626,7 +519,6 @@ function hmrDelete(bundle: ParcelRequire, id: string) {
626
519
 
627
520
  // Now delete the orphans.
628
521
  orphans.forEach((id) => {
629
- // @ts-expect-error TS2339
630
522
  hmrDelete(module.bundle.root, id);
631
523
  });
632
524
  } else if (bundle.parent) {
@@ -635,36 +527,25 @@ function hmrDelete(bundle: ParcelRequire, id: string) {
635
527
  }
636
528
 
637
529
  function hmrAcceptCheck(
638
- // @ts-expect-error TS2304
639
- bundle: ParcelRequire /*: ParcelRequire */,
640
- id: string /*: string */,
641
- depsByBundle:
642
- | {
643
- [key: string]: {
644
- [key: string]: string;
645
- };
646
- }
647
- | null
648
- | undefined /*: ?{ [string]: { [string]: string } }*/,
530
+ bundle /*: ParcelRequire */,
531
+ id /*: string */,
532
+ depsByBundle /*: ?{ [string]: { [string]: string } }*/,
649
533
  ) {
650
534
  if (hmrAcceptCheckOne(bundle, id, depsByBundle)) {
651
535
  return true;
652
536
  }
653
537
 
654
538
  // Traverse parents breadth first. All possible ancestries must accept the HMR update, or we'll reload.
655
- // @ts-expect-error TS2339
656
539
  let parents = getParents(module.bundle.root, id);
657
540
  let accepted = false;
658
541
  while (parents.length > 0) {
659
542
  let v = parents.shift();
660
- // @ts-expect-error TS18048
661
543
  let a = hmrAcceptCheckOne(v[0], v[1], null);
662
544
  if (a) {
663
545
  // If this parent accepts, stop traversing upward, but still consider siblings.
664
546
  accepted = true;
665
547
  } else {
666
548
  // Otherwise, queue the parents in the next level upward.
667
- // @ts-expect-error TS2339
668
549
  let p = getParents(module.bundle.root, v[1]);
669
550
  if (p.length === 0) {
670
551
  // If there are no parents, then we've reached an entry without accepting. Reload.
@@ -679,17 +560,9 @@ function hmrAcceptCheck(
679
560
  }
680
561
 
681
562
  function hmrAcceptCheckOne(
682
- // @ts-expect-error TS2304
683
- bundle: ParcelRequire /*: ParcelRequire */,
684
- id: string /*: string */,
685
- depsByBundle:
686
- | {
687
- [key: string]: {
688
- [key: string]: string;
689
- };
690
- }
691
- | null
692
- | undefined /*: ?{ [string]: { [string]: string } }*/,
563
+ bundle /*: ParcelRequire */,
564
+ id /*: string */,
565
+ depsByBundle /*: ?{ [string]: { [string]: string } }*/,
693
566
  ) {
694
567
  var modules = bundle.modules;
695
568
  if (!modules) {
@@ -706,12 +579,10 @@ function hmrAcceptCheckOne(
706
579
  return hmrAcceptCheck(bundle.parent, id, depsByBundle);
707
580
  }
708
581
 
709
- // @ts-expect-error TS7005
710
582
  if (checkedAssets[id]) {
711
583
  return true;
712
584
  }
713
585
 
714
- // @ts-expect-error TS7005
715
586
  checkedAssets[id] = true;
716
587
 
717
588
  var cached = bundle.cache[id];
@@ -726,12 +597,9 @@ function hmrAcceptCheckOne(
726
597
  function hmrDisposeQueue() {
727
598
  // Dispose all old assets.
728
599
  for (let i = 0; i < assetsToDispose.length; i++) {
729
- // @ts-expect-error TS7005
730
600
  let id = assetsToDispose[i][1];
731
601
 
732
- // @ts-expect-error TS7005
733
602
  if (!disposedAssets[id]) {
734
- // @ts-expect-error TS7005
735
603
  hmrDispose(assetsToDispose[i][0], id);
736
604
  disposedAssets[id] = true;
737
605
  }
@@ -740,11 +608,7 @@ function hmrDisposeQueue() {
740
608
  assetsToDispose = [];
741
609
  }
742
610
 
743
- function hmrDispose(
744
- // @ts-expect-error TS2304
745
- bundle: ParcelRequire /*: ParcelRequire */,
746
- id: string /*: string */,
747
- ) {
611
+ function hmrDispose(bundle /*: ParcelRequire */, id /*: string */) {
748
612
  var cached = bundle.cache[id];
749
613
  bundle.hotData[id] = {};
750
614
  if (cached && cached.hot) {
@@ -752,7 +616,6 @@ function hmrDispose(
752
616
  }
753
617
 
754
618
  if (cached && cached.hot && cached.hot._disposeCallbacks.length) {
755
- // @ts-expect-error TS7006
756
619
  cached.hot._disposeCallbacks.forEach(function (cb) {
757
620
  cb(bundle.hotData[id]);
758
621
  });
@@ -761,33 +624,25 @@ function hmrDispose(
761
624
  delete bundle.cache[id];
762
625
  }
763
626
 
764
- function hmrAccept(
765
- // @ts-expect-error TS2304
766
- bundle: ParcelRequire /*: ParcelRequire */,
767
- id: string /*: string */,
768
- ) {
627
+ function hmrAccept(bundle /*: ParcelRequire */, id /*: string */) {
769
628
  // Execute the module.
770
629
  bundle(id);
771
630
 
772
631
  // Run the accept callbacks in the new version of the module.
773
632
  var cached = bundle.cache[id];
774
633
  if (cached && cached.hot && cached.hot._acceptCallbacks.length) {
775
- let assetsToAlsoAccept: Array<never> = [];
776
- // @ts-expect-error TS7006
634
+ let assetsToAlsoAccept = [];
777
635
  cached.hot._acceptCallbacks.forEach(function (cb) {
778
636
  let additionalAssets = cb(function () {
779
- // @ts-expect-error TS2339
780
637
  return getParents(module.bundle.root, id);
781
638
  });
782
639
  if (Array.isArray(additionalAssets) && additionalAssets.length) {
783
- // @ts-expect-error TS2345
784
640
  assetsToAlsoAccept.push(...additionalAssets);
785
641
  }
786
642
  });
787
643
 
788
644
  if (assetsToAlsoAccept.length > 0) {
789
645
  let handled = assetsToAlsoAccept.every(function (a) {
790
- // @ts-expect-error TS2554
791
646
  return hmrAcceptCheck(a[0], a[1]);
792
647
  });
793
648