@atlaspack/transformer-js 19.0.3 → 19.0.4

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.
@@ -1018,7 +1018,20 @@ var _default = exports.default = new (_plugin().Transformer)({
1018
1018
  let dep = deps.get(source);
1019
1019
  if (!dep) continue;
1020
1020
  if (local === '*' && imported === '*') {
1021
- dep.symbols.set('*', '*', convertLoc(loc), true);
1021
+ // When a module has both `import * as ns from 'x'` and
1022
+ // `export * from 'x'`, they share a single dep (merged by the
1023
+ // core). The namespace import binding ('*' → local, isWeak:false)
1024
+ // set by imported_symbols is strictly more inclusive than the
1025
+ // wildcard re-export ('*' → '*', isWeak:true) for symbol
1026
+ // propagation, so don't overwrite it. Instead, flag the dep so
1027
+ // that symbol propagation still treats it as a wildcard
1028
+ // re-exporter.
1029
+ let existingStar = dep.symbols.get('*');
1030
+ if ((0, _featureFlags().getFeatureFlag)('fixExportStarNamespaceOverwrite') && existingStar && existingStar.local !== '*') {
1031
+ dep.meta.hasExportStar = true;
1032
+ } else {
1033
+ dep.symbols.set('*', '*', convertLoc(loc), true);
1034
+ }
1022
1035
  } else {
1023
1036
  var _dep$symbols$get;
1024
1037
  let reExportName = ((_dep$symbols$get = dep.symbols.get(imported)) === null || _dep$symbols$get === void 0 ? void 0 : _dep$symbols$get.local) ?? `$${asset.id}$re_export$${local}`;
@@ -1111,7 +1124,16 @@ var _default = exports.default = new (_plugin().Transformer)({
1111
1124
  let dep = deps.get(source);
1112
1125
  if (!dep) continue;
1113
1126
  dep.symbols.ensure();
1114
- dep.symbols.set('*', '*', convertLoc(loc), true);
1127
+ // When a module has both `import * as ns from 'x'` and
1128
+ // `export * from 'x'`, they share a single dep. Don't overwrite
1129
+ // the namespace import binding — flag the dep instead so symbol
1130
+ // propagation still treats it as a wildcard re-exporter.
1131
+ let existingStar = dep.symbols.get('*');
1132
+ if ((0, _featureFlags().getFeatureFlag)('fixExportStarNamespaceOverwrite') && existingStar && existingStar.local !== '*') {
1133
+ dep.meta.hasExportStar = true;
1134
+ } else {
1135
+ dep.symbols.set('*', '*', convertLoc(loc), true);
1136
+ }
1115
1137
  }
1116
1138
 
1117
1139
  // Add * symbol if there are CJS exports, no imports/exports at all, or the asset is wrapped.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaspack/transformer-js",
3
- "version": "19.0.3",
3
+ "version": "19.0.4",
4
4
  "license": "(MIT OR Apache-2.0)",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -24,14 +24,14 @@
24
24
  "src"
25
25
  ],
26
26
  "dependencies": {
27
- "@atlaspack/build-cache": "2.13.15",
27
+ "@atlaspack/build-cache": "2.13.16",
28
28
  "@atlaspack/diagnostic": "2.14.4",
29
- "@atlaspack/feature-flags": "2.31.1",
30
- "@atlaspack/plugin": "2.14.61",
31
- "@atlaspack/rust": "3.29.0",
32
- "@atlaspack/source-map": "3.3.5",
33
- "@atlaspack/utils": "3.4.3",
34
- "@atlaspack/workers": "2.14.61",
29
+ "@atlaspack/feature-flags": "2.31.2",
30
+ "@atlaspack/plugin": "2.14.62",
31
+ "@atlaspack/rust": "3.29.1",
32
+ "@atlaspack/source-map": "3.3.6",
33
+ "@atlaspack/utils": "3.4.4",
34
+ "@atlaspack/workers": "2.14.62",
35
35
  "@swc/helpers": "^0.5.15",
36
36
  "browserslist": "^4.6.6",
37
37
  "nullthrows": "^1.1.1",
@@ -39,7 +39,7 @@
39
39
  "semver": "^7.5.2"
40
40
  },
41
41
  "peerDependencies": {
42
- "@atlaspack/core": "2.38.3"
42
+ "@atlaspack/core": "2.38.4"
43
43
  },
44
44
  "type": "commonjs"
45
45
  }
@@ -1300,7 +1300,24 @@ export default new Transformer({
1300
1300
  let dep = deps.get(source);
1301
1301
  if (!dep) continue;
1302
1302
  if (local === '*' && imported === '*') {
1303
- dep.symbols.set('*', '*', convertLoc(loc), true);
1303
+ // When a module has both `import * as ns from 'x'` and
1304
+ // `export * from 'x'`, they share a single dep (merged by the
1305
+ // core). The namespace import binding ('*' → local, isWeak:false)
1306
+ // set by imported_symbols is strictly more inclusive than the
1307
+ // wildcard re-export ('*' → '*', isWeak:true) for symbol
1308
+ // propagation, so don't overwrite it. Instead, flag the dep so
1309
+ // that symbol propagation still treats it as a wildcard
1310
+ // re-exporter.
1311
+ let existingStar = dep.symbols.get('*');
1312
+ if (
1313
+ getFeatureFlag('fixExportStarNamespaceOverwrite') &&
1314
+ existingStar &&
1315
+ existingStar.local !== '*'
1316
+ ) {
1317
+ dep.meta.hasExportStar = true;
1318
+ } else {
1319
+ dep.symbols.set('*', '*', convertLoc(loc), true);
1320
+ }
1304
1321
  } else {
1305
1322
  let reExportName =
1306
1323
  dep.symbols.get(imported)?.local ??
@@ -1412,7 +1429,20 @@ export default new Transformer({
1412
1429
  let dep = deps.get(source);
1413
1430
  if (!dep) continue;
1414
1431
  dep.symbols.ensure();
1415
- dep.symbols.set('*', '*', convertLoc(loc), true);
1432
+ // When a module has both `import * as ns from 'x'` and
1433
+ // `export * from 'x'`, they share a single dep. Don't overwrite
1434
+ // the namespace import binding — flag the dep instead so symbol
1435
+ // propagation still treats it as a wildcard re-exporter.
1436
+ let existingStar = dep.symbols.get('*');
1437
+ if (
1438
+ getFeatureFlag('fixExportStarNamespaceOverwrite') &&
1439
+ existingStar &&
1440
+ existingStar.local !== '*'
1441
+ ) {
1442
+ dep.meta.hasExportStar = true;
1443
+ } else {
1444
+ dep.symbols.set('*', '*', convertLoc(loc), true);
1445
+ }
1416
1446
  }
1417
1447
 
1418
1448
  // Add * symbol if there are CJS exports, no imports/exports at all, or the asset is wrapped.