@atlaspack/transformer-js 3.3.2 → 3.3.3

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 () {
@@ -177,7 +184,7 @@ var _default = exports.default = new (_plugin().Transformer)({
177
184
  }
178
185
  reactRefresh = options.hmrOptions && options.mode === 'development' && Boolean((packageJson === null || packageJson === void 0 || (_packageJson$dependen2 = packageJson.dependencies) === null || _packageJson$dependen2 === void 0 ? void 0 : _packageJson$dependen2.react) || (packageJson === null || packageJson === void 0 || (_packageJson$devDepen2 = packageJson.devDependencies) === null || _packageJson$devDepen2 === void 0 ? void 0 : _packageJson$devDepen2.react) || (packageJson === null || packageJson === void 0 || (_packageJson$peerDepe2 = packageJson.peerDependencies) === null || _packageJson$peerDepe2 === void 0 ? void 0 : _packageJson$peerDepe2.react));
179
186
  const compilerOptions = (_await$config$getConf = await config.getConfigFrom(options.projectRoot + '/index', ['tsconfig.json', 'jsconfig.json'], {
180
- readTracking: (0, _featureFlags().getFeatureFlag)('granularTsConfigInvalidation')
187
+ readTracking: true
181
188
  })) === null || _await$config$getConf === void 0 || (_await$config$getConf = _await$config$getConf.contents) === null || _await$config$getConf === void 0 ? void 0 : _await$config$getConf.compilerOptions;
182
189
 
183
190
  // Use explicitly defined JSX options in tsconfig.json over inferred values from dependencies.
@@ -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.3.2",
3
+ "version": "3.3.3",
4
4
  "license": "(MIT OR Apache-2.0)",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -23,12 +23,12 @@
23
23
  ],
24
24
  "dependencies": {
25
25
  "@atlaspack/diagnostic": "2.14.1",
26
- "@atlaspack/feature-flags": "2.18.0",
27
- "@atlaspack/plugin": "2.14.12",
26
+ "@atlaspack/feature-flags": "2.18.1",
27
+ "@atlaspack/plugin": "2.14.13",
28
28
  "@atlaspack/rust": "3.3.5",
29
29
  "@parcel/source-map": "^2.1.1",
30
- "@atlaspack/utils": "2.15.0",
31
- "@atlaspack/workers": "2.14.12",
30
+ "@atlaspack/utils": "2.15.1",
31
+ "@atlaspack/workers": "2.14.13",
32
32
  "@swc/helpers": "^0.5.15",
33
33
  "browserslist": "^4.6.6",
34
34
  "nullthrows": "^1.1.1",
@@ -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';
@@ -211,7 +212,7 @@ export default (new Transformer({
211
212
  options.projectRoot + '/index',
212
213
  ['tsconfig.json', 'jsconfig.json'],
213
214
  {
214
- readTracking: getFeatureFlag('granularTsConfigInvalidation'),
215
+ readTracking: true,
215
216
  },
216
217
  )
217
218
  )?.contents?.compilerOptions;
@@ -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) {