@atlaspack/transformer-js 3.2.3-canary.190 → 3.2.3-canary.192
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.
- package/lib/JSTransformer.js +5 -23
- package/package.json +9 -9
- package/src/JSTransformer.ts +0 -13
package/lib/JSTransformer.js
CHANGED
|
@@ -837,14 +837,11 @@ var _default = exports.default = new (_plugin().Transformer)({
|
|
|
837
837
|
let dep = deps.get(source);
|
|
838
838
|
if (!dep) continue;
|
|
839
839
|
if (local === '*' && imported === '*') {
|
|
840
|
-
// @ts-expect-error TS2345
|
|
841
840
|
dep.symbols.set('*', '*', convertLoc(loc), true);
|
|
842
841
|
} else {
|
|
843
842
|
var _dep$symbols$get;
|
|
844
843
|
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}`;
|
|
845
|
-
// @ts-expect-error TS2345
|
|
846
844
|
asset.symbols.set(local, reExportName);
|
|
847
|
-
// @ts-expect-error TS2345
|
|
848
845
|
dep.symbols.set(imported, reExportName, convertLoc(loc), true);
|
|
849
846
|
}
|
|
850
847
|
}
|
|
@@ -862,9 +859,7 @@ var _default = exports.default = new (_plugin().Transformer)({
|
|
|
862
859
|
let symbols = new Map();
|
|
863
860
|
for (let name of hoist_result.self_references) {
|
|
864
861
|
// Do not create a self-reference for the `default` symbol unless we have seen an __esModule flag.
|
|
865
|
-
if (name === 'default' &&
|
|
866
|
-
// @ts-expect-error TS2345
|
|
867
|
-
!asset.symbols.hasExportSymbol('__esModule')) {
|
|
862
|
+
if (name === 'default' && !asset.symbols.hasExportSymbol('__esModule')) {
|
|
868
863
|
continue;
|
|
869
864
|
}
|
|
870
865
|
let local = (0, _nullthrows().default)(asset.symbols.get(name)).local;
|
|
@@ -891,13 +886,10 @@ var _default = exports.default = new (_plugin().Transformer)({
|
|
|
891
886
|
// Add * symbol if there are CJS exports, no imports/exports at all
|
|
892
887
|
// (and the asset has side effects), or the asset is wrapped.
|
|
893
888
|
// This allows accessing symbols that don't exist without errors in symbol propagation.
|
|
894
|
-
if (hoist_result.has_cjs_exports || !hoist_result.is_esm && asset.sideEffects && deps.size === 0 && Object.keys(hoist_result.exported_symbols).length === 0 ||
|
|
895
|
-
// @ts-expect-error TS2345
|
|
896
|
-
hoist_result.should_wrap && !asset.symbols.hasExportSymbol('*')) {
|
|
889
|
+
if (hoist_result.has_cjs_exports || !hoist_result.is_esm && asset.sideEffects && deps.size === 0 && Object.keys(hoist_result.exported_symbols).length === 0 || hoist_result.should_wrap && !asset.symbols.hasExportSymbol('*')) {
|
|
897
890
|
if (is_empty_or_empty_export) {
|
|
898
891
|
asset.meta.emptyFileStarReexport = true;
|
|
899
892
|
}
|
|
900
|
-
// @ts-expect-error TS2345
|
|
901
893
|
asset.symbols.set('*', `$${asset.id}$exports`);
|
|
902
894
|
}
|
|
903
895
|
asset.meta.hasCJSExports = hoist_result.has_cjs_exports;
|
|
@@ -914,14 +906,10 @@ var _default = exports.default = new (_plugin().Transformer)({
|
|
|
914
906
|
source
|
|
915
907
|
} of symbol_result.exports) {
|
|
916
908
|
let dep = source ? deps.get(source) : undefined;
|
|
917
|
-
asset.symbols.set(exported,
|
|
918
|
-
// @ts-expect-error TS2345
|
|
919
|
-
`${(dep === null || dep === void 0 ? void 0 : dep.id) ?? ''}$${local}`, convertLoc(loc));
|
|
909
|
+
asset.symbols.set(exported, `${(dep === null || dep === void 0 ? void 0 : dep.id) ?? ''}$${local}`, convertLoc(loc));
|
|
920
910
|
if (dep != null) {
|
|
921
911
|
dep.symbols.ensure();
|
|
922
|
-
dep.symbols.set(local,
|
|
923
|
-
// @ts-expect-error TS2345
|
|
924
|
-
`${(dep === null || dep === void 0 ? void 0 : dep.id) ?? ''}$${local}`, convertLoc(loc), true);
|
|
912
|
+
dep.symbols.set(local, `${(dep === null || dep === void 0 ? void 0 : dep.id) ?? ''}$${local}`, convertLoc(loc), true);
|
|
925
913
|
}
|
|
926
914
|
}
|
|
927
915
|
for (let {
|
|
@@ -942,23 +930,18 @@ var _default = exports.default = new (_plugin().Transformer)({
|
|
|
942
930
|
let dep = deps.get(source);
|
|
943
931
|
if (!dep) continue;
|
|
944
932
|
dep.symbols.ensure();
|
|
945
|
-
// @ts-expect-error TS2345
|
|
946
933
|
dep.symbols.set('*', '*', convertLoc(loc), true);
|
|
947
934
|
}
|
|
948
935
|
|
|
949
936
|
// Add * symbol if there are CJS exports, no imports/exports at all, or the asset is wrapped.
|
|
950
937
|
// This allows accessing symbols that don't exist without errors in symbol propagation.
|
|
951
|
-
if (symbol_result.has_cjs_exports || !symbol_result.is_esm && deps.size === 0 && symbol_result.exports.length === 0 ||
|
|
952
|
-
// @ts-expect-error TS2345
|
|
953
|
-
symbol_result.should_wrap && !asset.symbols.hasExportSymbol('*')) {
|
|
938
|
+
if (symbol_result.has_cjs_exports || !symbol_result.is_esm && deps.size === 0 && symbol_result.exports.length === 0 || symbol_result.should_wrap && !asset.symbols.hasExportSymbol('*')) {
|
|
954
939
|
asset.symbols.ensure();
|
|
955
|
-
// @ts-expect-error TS2345
|
|
956
940
|
asset.symbols.set('*', `$${asset.id}$exports`);
|
|
957
941
|
}
|
|
958
942
|
} else {
|
|
959
943
|
// If the asset is wrapped, add * as a fallback
|
|
960
944
|
asset.symbols.ensure();
|
|
961
|
-
// @ts-expect-error TS2345
|
|
962
945
|
asset.symbols.set('*', `$${asset.id}$exports`);
|
|
963
946
|
}
|
|
964
947
|
|
|
@@ -967,7 +950,6 @@ var _default = exports.default = new (_plugin().Transformer)({
|
|
|
967
950
|
for (let dep of asset.getDependencies()) {
|
|
968
951
|
if (dep.symbols.isCleared) {
|
|
969
952
|
dep.symbols.ensure();
|
|
970
|
-
// @ts-expect-error TS2345
|
|
971
953
|
dep.symbols.set('*', `${dep.id}$`);
|
|
972
954
|
}
|
|
973
955
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaspack/transformer-js",
|
|
3
|
-
"version": "3.2.3-canary.
|
|
3
|
+
"version": "3.2.3-canary.192+dc6e4b2bb",
|
|
4
4
|
"license": "(MIT OR Apache-2.0)",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -25,12 +25,12 @@
|
|
|
25
25
|
"src"
|
|
26
26
|
],
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@atlaspack/diagnostic": "2.14.1-canary.
|
|
29
|
-
"@atlaspack/feature-flags": "2.14.1-canary.
|
|
30
|
-
"@atlaspack/plugin": "2.14.5-canary.
|
|
31
|
-
"@atlaspack/rust": "3.2.1-canary.
|
|
32
|
-
"@atlaspack/utils": "2.14.5-canary.
|
|
33
|
-
"@atlaspack/workers": "2.14.5-canary.
|
|
28
|
+
"@atlaspack/diagnostic": "2.14.1-canary.260+dc6e4b2bb",
|
|
29
|
+
"@atlaspack/feature-flags": "2.14.1-canary.260+dc6e4b2bb",
|
|
30
|
+
"@atlaspack/plugin": "2.14.5-canary.192+dc6e4b2bb",
|
|
31
|
+
"@atlaspack/rust": "3.2.1-canary.192+dc6e4b2bb",
|
|
32
|
+
"@atlaspack/utils": "2.14.5-canary.192+dc6e4b2bb",
|
|
33
|
+
"@atlaspack/workers": "2.14.5-canary.192+dc6e4b2bb",
|
|
34
34
|
"@parcel/source-map": "^2.1.1",
|
|
35
35
|
"@swc/helpers": "^0.5.15",
|
|
36
36
|
"browserslist": "^4.6.6",
|
|
@@ -39,8 +39,8 @@
|
|
|
39
39
|
"semver": "^7.5.2"
|
|
40
40
|
},
|
|
41
41
|
"peerDependencies": {
|
|
42
|
-
"@atlaspack/core": "2.
|
|
42
|
+
"@atlaspack/core": "2.24.0"
|
|
43
43
|
},
|
|
44
44
|
"type": "commonjs",
|
|
45
|
-
"gitHead": "
|
|
45
|
+
"gitHead": "dc6e4b2bb99f371d225c296dbf96363fdac52333"
|
|
46
46
|
}
|
package/src/JSTransformer.ts
CHANGED
|
@@ -1010,15 +1010,12 @@ export default new Transformer({
|
|
|
1010
1010
|
let dep = deps.get(source);
|
|
1011
1011
|
if (!dep) continue;
|
|
1012
1012
|
if (local === '*' && imported === '*') {
|
|
1013
|
-
// @ts-expect-error TS2345
|
|
1014
1013
|
dep.symbols.set('*', '*', convertLoc(loc), true);
|
|
1015
1014
|
} else {
|
|
1016
1015
|
let reExportName =
|
|
1017
1016
|
dep.symbols.get(imported)?.local ??
|
|
1018
1017
|
`$${asset.id}$re_export$${local}`;
|
|
1019
|
-
// @ts-expect-error TS2345
|
|
1020
1018
|
asset.symbols.set(local, reExportName);
|
|
1021
|
-
// @ts-expect-error TS2345
|
|
1022
1019
|
dep.symbols.set(imported, reExportName, convertLoc(loc), true);
|
|
1023
1020
|
}
|
|
1024
1021
|
}
|
|
@@ -1041,7 +1038,6 @@ export default new Transformer({
|
|
|
1041
1038
|
// Do not create a self-reference for the `default` symbol unless we have seen an __esModule flag.
|
|
1042
1039
|
if (
|
|
1043
1040
|
name === 'default' &&
|
|
1044
|
-
// @ts-expect-error TS2345
|
|
1045
1041
|
!asset.symbols.hasExportSymbol('__esModule')
|
|
1046
1042
|
) {
|
|
1047
1043
|
continue;
|
|
@@ -1077,13 +1073,11 @@ export default new Transformer({
|
|
|
1077
1073
|
asset.sideEffects &&
|
|
1078
1074
|
deps.size === 0 &&
|
|
1079
1075
|
Object.keys(hoist_result.exported_symbols).length === 0) ||
|
|
1080
|
-
// @ts-expect-error TS2345
|
|
1081
1076
|
(hoist_result.should_wrap && !asset.symbols.hasExportSymbol('*'))
|
|
1082
1077
|
) {
|
|
1083
1078
|
if (is_empty_or_empty_export) {
|
|
1084
1079
|
asset.meta.emptyFileStarReexport = true;
|
|
1085
1080
|
}
|
|
1086
|
-
// @ts-expect-error TS2345
|
|
1087
1081
|
asset.symbols.set('*', `$${asset.id}$exports`);
|
|
1088
1082
|
}
|
|
1089
1083
|
|
|
@@ -1103,7 +1097,6 @@ export default new Transformer({
|
|
|
1103
1097
|
let dep = source ? deps.get(source) : undefined;
|
|
1104
1098
|
asset.symbols.set(
|
|
1105
1099
|
exported,
|
|
1106
|
-
// @ts-expect-error TS2345
|
|
1107
1100
|
`${dep?.id ?? ''}$${local}`,
|
|
1108
1101
|
convertLoc(loc),
|
|
1109
1102
|
);
|
|
@@ -1111,7 +1104,6 @@ export default new Transformer({
|
|
|
1111
1104
|
dep.symbols.ensure();
|
|
1112
1105
|
dep.symbols.set(
|
|
1113
1106
|
local,
|
|
1114
|
-
// @ts-expect-error TS2345
|
|
1115
1107
|
`${dep?.id ?? ''}$${local}`,
|
|
1116
1108
|
convertLoc(loc),
|
|
1117
1109
|
true,
|
|
@@ -1130,7 +1122,6 @@ export default new Transformer({
|
|
|
1130
1122
|
let dep = deps.get(source);
|
|
1131
1123
|
if (!dep) continue;
|
|
1132
1124
|
dep.symbols.ensure();
|
|
1133
|
-
// @ts-expect-error TS2345
|
|
1134
1125
|
dep.symbols.set('*', '*', convertLoc(loc), true);
|
|
1135
1126
|
}
|
|
1136
1127
|
|
|
@@ -1141,17 +1132,14 @@ export default new Transformer({
|
|
|
1141
1132
|
(!symbol_result.is_esm &&
|
|
1142
1133
|
deps.size === 0 &&
|
|
1143
1134
|
symbol_result.exports.length === 0) ||
|
|
1144
|
-
// @ts-expect-error TS2345
|
|
1145
1135
|
(symbol_result.should_wrap && !asset.symbols.hasExportSymbol('*'))
|
|
1146
1136
|
) {
|
|
1147
1137
|
asset.symbols.ensure();
|
|
1148
|
-
// @ts-expect-error TS2345
|
|
1149
1138
|
asset.symbols.set('*', `$${asset.id}$exports`);
|
|
1150
1139
|
}
|
|
1151
1140
|
} else {
|
|
1152
1141
|
// If the asset is wrapped, add * as a fallback
|
|
1153
1142
|
asset.symbols.ensure();
|
|
1154
|
-
// @ts-expect-error TS2345
|
|
1155
1143
|
asset.symbols.set('*', `$${asset.id}$exports`);
|
|
1156
1144
|
}
|
|
1157
1145
|
|
|
@@ -1160,7 +1148,6 @@ export default new Transformer({
|
|
|
1160
1148
|
for (let dep of asset.getDependencies()) {
|
|
1161
1149
|
if (dep.symbols.isCleared) {
|
|
1162
1150
|
dep.symbols.ensure();
|
|
1163
|
-
// @ts-expect-error TS2345
|
|
1164
1151
|
dep.symbols.set('*', `${dep.id}$`);
|
|
1165
1152
|
}
|
|
1166
1153
|
}
|