@atlaspack/transformer-js 3.2.3-canary.88 → 3.2.3-canary.89

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.
@@ -25,6 +25,13 @@ function _rust() {
25
25
  };
26
26
  return data;
27
27
  }
28
+ function _assert() {
29
+ const data = _interopRequireDefault(require("assert"));
30
+ _assert = function () {
31
+ return data;
32
+ };
33
+ return data;
34
+ }
28
35
  function _browserslist() {
29
36
  const data = _interopRequireDefault(require("browserslist"));
30
37
  _browserslist = function () {
@@ -374,6 +381,7 @@ var _default = exports.default = new (_plugin().Transformer)({
374
381
  standalone: asset.query.has('standalone'),
375
382
  inline_constants: config.inlineConstants,
376
383
  conditional_bundling: options.featureFlags.conditionalBundlingApi,
384
+ hmr_improvements: options.featureFlags.hmrImprovements,
377
385
  magic_comments: Boolean(config === null || config === void 0 ? void 0 : config.magicComments),
378
386
  callMacro: asset.isSource ? async (err, src, exportName, args, loc) => {
379
387
  let mod;
@@ -630,6 +638,13 @@ var _default = exports.default = new (_plugin().Transformer)({
630
638
  });
631
639
  } else if (dep.kind === 'File') {
632
640
  asset.invalidateOnFileChange(dep.specifier);
641
+ } else if (dep.kind === 'Id') {
642
+ // Record parcelRequire calls so that the dev packager can add them as dependencies.
643
+ // This allows the HMR runtime to collect parents across async boundaries (through runtimes).
644
+ // TODO: ideally this would result as an actual dep in the graph rather than asset.meta.
645
+ asset.meta.hmrDeps ??= [];
646
+ (0, _assert().default)(Array.isArray(asset.meta.hmrDeps));
647
+ asset.meta.hmrDeps.push(dep.specifier);
633
648
  } else {
634
649
  let meta = {
635
650
  kind: dep.kind
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaspack/transformer-js",
3
- "version": "3.2.3-canary.88+ef3d6228f",
3
+ "version": "3.2.3-canary.89+26aa9c599",
4
4
  "license": "(MIT OR Apache-2.0)",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -22,12 +22,12 @@
22
22
  "src"
23
23
  ],
24
24
  "dependencies": {
25
- "@atlaspack/diagnostic": "2.14.1-canary.156+ef3d6228f",
26
- "@atlaspack/feature-flags": "2.14.1-canary.156+ef3d6228f",
27
- "@atlaspack/plugin": "2.14.5-canary.88+ef3d6228f",
28
- "@atlaspack/rust": "3.2.1-canary.88+ef3d6228f",
29
- "@atlaspack/utils": "2.14.5-canary.88+ef3d6228f",
30
- "@atlaspack/workers": "2.14.5-canary.88+ef3d6228f",
25
+ "@atlaspack/diagnostic": "2.14.1-canary.157+26aa9c599",
26
+ "@atlaspack/feature-flags": "2.14.1-canary.157+26aa9c599",
27
+ "@atlaspack/plugin": "2.14.5-canary.89+26aa9c599",
28
+ "@atlaspack/rust": "3.2.1-canary.89+26aa9c599",
29
+ "@atlaspack/utils": "2.14.5-canary.89+26aa9c599",
30
+ "@atlaspack/workers": "2.14.5-canary.89+26aa9c599",
31
31
  "@parcel/source-map": "^2.1.1",
32
32
  "@swc/helpers": "^0.5.15",
33
33
  "browserslist": "^4.6.6",
@@ -39,5 +39,5 @@
39
39
  "@atlaspack/core": "^2.13.1"
40
40
  },
41
41
  "type": "commonjs",
42
- "gitHead": "ef3d6228f4e006702198a19c61e051d194d325cb"
42
+ "gitHead": "26aa9c599d2be45ce1438a74c5fa22f39b9b554b"
43
43
  }
@@ -12,6 +12,7 @@ import type {Diagnostic} from '@atlaspack/diagnostic';
12
12
  import SourceMap from '@parcel/source-map';
13
13
  import {Transformer} from '@atlaspack/plugin';
14
14
  import {transform, transformAsync} from '@atlaspack/rust';
15
+ import invariant from 'assert';
15
16
  import browserslist from 'browserslist';
16
17
  import semver from 'semver';
17
18
  import nullthrows from 'nullthrows';
@@ -474,6 +475,7 @@ export default (new Transformer({
474
475
  standalone: asset.query.has('standalone'),
475
476
  inline_constants: config.inlineConstants,
476
477
  conditional_bundling: options.featureFlags.conditionalBundlingApi,
478
+ hmr_improvements: options.featureFlags.hmrImprovements,
477
479
  magic_comments: Boolean(config?.magicComments),
478
480
  callMacro: asset.isSource
479
481
  ? async (err, src, exportName, args, loc) => {
@@ -780,6 +782,13 @@ export default (new Transformer({
780
782
  });
781
783
  } else if (dep.kind === 'File') {
782
784
  asset.invalidateOnFileChange(dep.specifier);
785
+ } else if (dep.kind === 'Id') {
786
+ // Record parcelRequire calls so that the dev packager can add them as dependencies.
787
+ // This allows the HMR runtime to collect parents across async boundaries (through runtimes).
788
+ // TODO: ideally this would result as an actual dep in the graph rather than asset.meta.
789
+ asset.meta.hmrDeps ??= [];
790
+ invariant(Array.isArray(asset.meta.hmrDeps));
791
+ asset.meta.hmrDeps.push(dep.specifier);
783
792
  } else {
784
793
  let meta: JSONObject = {kind: dep.kind};
785
794
  if (dep.attributes) {