@atlaspack/transformer-js 6.0.2-dev-native-compiled-test-712d92d32.0 → 7.0.1-dev-yarn-8750a7d2e.0
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 +9 -12
- package/package.json +9 -9
- package/src/JSTransformer.ts +14 -12
package/lib/JSTransformer.js
CHANGED
|
@@ -242,6 +242,8 @@ var _default = exports.default = new (_plugin().Transformer)({
|
|
|
242
242
|
let inlineConstants = false;
|
|
243
243
|
let magicComments = false;
|
|
244
244
|
let addReactDisplayName = false;
|
|
245
|
+
let enableGlobalThisAliaser = Boolean(options.env.NATIVE_GLOBAL_THIS_ALIASER);
|
|
246
|
+
let enableLazyLoadingTransformer = Boolean(options.env.NATIVE_LAZY_LOADING_TRANSFORMER);
|
|
245
247
|
if (conf && conf.contents) {
|
|
246
248
|
var _conf$contents, _conf$contents2, _conf$contents3, _conf$contents4, _conf$contents5;
|
|
247
249
|
_utils().validateSchema.diagnostic(CONFIG_SCHEMA, {
|
|
@@ -279,7 +281,9 @@ var _default = exports.default = new (_plugin().Transformer)({
|
|
|
279
281
|
reactRefresh,
|
|
280
282
|
decorators,
|
|
281
283
|
useDefineForClassFields,
|
|
282
|
-
magicComments
|
|
284
|
+
magicComments,
|
|
285
|
+
enableGlobalThisAliaser,
|
|
286
|
+
enableLazyLoadingTransformer
|
|
283
287
|
};
|
|
284
288
|
},
|
|
285
289
|
async transform({
|
|
@@ -391,9 +395,7 @@ var _default = exports.default = new (_plugin().Transformer)({
|
|
|
391
395
|
// @ts-expect-error TS2339
|
|
392
396
|
conditions,
|
|
393
397
|
// @ts-expect-error TS2339
|
|
394
|
-
magic_comments
|
|
395
|
-
// @ts-expect-error TS2339
|
|
396
|
-
compiled_css_rules
|
|
398
|
+
magic_comments
|
|
397
399
|
} = await (_rust().transformAsync || _rust().transform)({
|
|
398
400
|
filename: asset.filePath,
|
|
399
401
|
code,
|
|
@@ -432,6 +434,8 @@ var _default = exports.default = new (_plugin().Transformer)({
|
|
|
432
434
|
add_display_name: Boolean(config.addReactDisplayName),
|
|
433
435
|
exports_rebinding_optimisation: options.featureFlags.exportsRebindingOptimisation,
|
|
434
436
|
magic_comments: Boolean(config === null || config === void 0 ? void 0 : config.magicComments) || (0, _featureFlags().getFeatureFlag)('supportWebpackChunkName'),
|
|
437
|
+
enable_global_this_aliaser: Boolean(config.enableGlobalThisAliaser),
|
|
438
|
+
enable_lazy_loading_transformer: Boolean(config.enableLazyLoadingTransformer),
|
|
435
439
|
callMacro: asset.isSource ? async (err, src, exportName, args, loc) => {
|
|
436
440
|
let mod;
|
|
437
441
|
try {
|
|
@@ -540,13 +544,7 @@ var _default = exports.default = new (_plugin().Transformer)({
|
|
|
540
544
|
} : null
|
|
541
545
|
});
|
|
542
546
|
if ((0, _featureFlags().getFeatureFlag)('conditionalBundlingApi')) {
|
|
543
|
-
asset.meta.conditions = conditions
|
|
544
|
-
// @ts-expect-error TS7006
|
|
545
|
-
c => ({
|
|
546
|
-
key: c.key,
|
|
547
|
-
ifTruePlaceholder: c.if_true_placeholder,
|
|
548
|
-
ifFalsePlaceholder: c.if_false_placeholder
|
|
549
|
-
}));
|
|
547
|
+
asset.meta.conditions = conditions;
|
|
550
548
|
}
|
|
551
549
|
if (is_constant_module) {
|
|
552
550
|
asset.meta.isConstantModule = true;
|
|
@@ -969,7 +967,6 @@ var _default = exports.default = new (_plugin().Transformer)({
|
|
|
969
967
|
});
|
|
970
968
|
}
|
|
971
969
|
}
|
|
972
|
-
asset.setCompiledCssStyles(compiled_css_rules);
|
|
973
970
|
asset.type = 'js';
|
|
974
971
|
asset.setBuffer(compiledCode);
|
|
975
972
|
if (map) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaspack/transformer-js",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "7.0.1-dev-yarn-8750a7d2e.0",
|
|
4
4
|
"license": "(MIT OR Apache-2.0)",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -24,12 +24,12 @@
|
|
|
24
24
|
"src"
|
|
25
25
|
],
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@atlaspack/diagnostic": "2.14.5-dev-
|
|
28
|
-
"@atlaspack/feature-flags": "2.25.
|
|
29
|
-
"@atlaspack/plugin": "2.14.
|
|
30
|
-
"@atlaspack/rust": "3.8.
|
|
31
|
-
"@atlaspack/utils": "3.0.
|
|
32
|
-
"@atlaspack/workers": "2.14.
|
|
27
|
+
"@atlaspack/diagnostic": "2.14.5-dev-yarn-8750a7d2e.0",
|
|
28
|
+
"@atlaspack/feature-flags": "2.25.6-dev-yarn-8750a7d2e.0",
|
|
29
|
+
"@atlaspack/plugin": "2.14.36-dev-yarn-8750a7d2e.0",
|
|
30
|
+
"@atlaspack/rust": "3.8.4-dev-yarn-8750a7d2e.0",
|
|
31
|
+
"@atlaspack/utils": "3.0.4-dev-yarn-8750a7d2e.0",
|
|
32
|
+
"@atlaspack/workers": "2.14.36-dev-yarn-8750a7d2e.0",
|
|
33
33
|
"@parcel/source-map": "^2.1.1",
|
|
34
34
|
"@swc/helpers": "^0.5.15",
|
|
35
35
|
"browserslist": "^4.6.6",
|
|
@@ -38,8 +38,8 @@
|
|
|
38
38
|
"semver": "^7.5.2"
|
|
39
39
|
},
|
|
40
40
|
"peerDependencies": {
|
|
41
|
-
"@atlaspack/core": "
|
|
41
|
+
"@atlaspack/core": "workspace:*"
|
|
42
42
|
},
|
|
43
43
|
"type": "commonjs",
|
|
44
|
-
"gitHead": "
|
|
44
|
+
"gitHead": "8750a7d2e6330244dd618c28a20d5a391080e4a3"
|
|
45
45
|
}
|
package/src/JSTransformer.ts
CHANGED
|
@@ -303,6 +303,13 @@ export default new Transformer({
|
|
|
303
303
|
let magicComments = false;
|
|
304
304
|
let addReactDisplayName = false;
|
|
305
305
|
|
|
306
|
+
let enableGlobalThisAliaser = Boolean(
|
|
307
|
+
options.env.NATIVE_GLOBAL_THIS_ALIASER,
|
|
308
|
+
);
|
|
309
|
+
let enableLazyLoadingTransformer = Boolean(
|
|
310
|
+
options.env.NATIVE_LAZY_LOADING_TRANSFORMER,
|
|
311
|
+
);
|
|
312
|
+
|
|
306
313
|
if (conf && conf.contents) {
|
|
307
314
|
validateSchema.diagnostic(
|
|
308
315
|
CONFIG_SCHEMA,
|
|
@@ -346,6 +353,8 @@ export default new Transformer({
|
|
|
346
353
|
decorators,
|
|
347
354
|
useDefineForClassFields,
|
|
348
355
|
magicComments,
|
|
356
|
+
enableGlobalThisAliaser,
|
|
357
|
+
enableLazyLoadingTransformer,
|
|
349
358
|
};
|
|
350
359
|
},
|
|
351
360
|
async transform({asset, config, options, logger}) {
|
|
@@ -475,8 +484,6 @@ export default new Transformer({
|
|
|
475
484
|
conditions,
|
|
476
485
|
// @ts-expect-error TS2339
|
|
477
486
|
magic_comments,
|
|
478
|
-
// @ts-expect-error TS2339
|
|
479
|
-
compiled_css_rules,
|
|
480
487
|
} = await (transformAsync || transform)({
|
|
481
488
|
filename: asset.filePath,
|
|
482
489
|
code,
|
|
@@ -526,6 +533,10 @@ export default new Transformer({
|
|
|
526
533
|
magic_comments:
|
|
527
534
|
Boolean(config?.magicComments) ||
|
|
528
535
|
getFeatureFlag('supportWebpackChunkName'),
|
|
536
|
+
enable_global_this_aliaser: Boolean(config.enableGlobalThisAliaser),
|
|
537
|
+
enable_lazy_loading_transformer: Boolean(
|
|
538
|
+
config.enableLazyLoadingTransformer,
|
|
539
|
+
),
|
|
529
540
|
callMacro: asset.isSource
|
|
530
541
|
? async (err: any, src: any, exportName: any, args: any, loc: any) => {
|
|
531
542
|
let mod;
|
|
@@ -647,14 +658,7 @@ export default new Transformer({
|
|
|
647
658
|
});
|
|
648
659
|
|
|
649
660
|
if (getFeatureFlag('conditionalBundlingApi')) {
|
|
650
|
-
asset.meta.conditions = conditions
|
|
651
|
-
// @ts-expect-error TS7006
|
|
652
|
-
(c): ConditionMeta => ({
|
|
653
|
-
key: c.key,
|
|
654
|
-
ifTruePlaceholder: c.if_true_placeholder,
|
|
655
|
-
ifFalsePlaceholder: c.if_false_placeholder,
|
|
656
|
-
}),
|
|
657
|
-
);
|
|
661
|
+
asset.meta.conditions = conditions;
|
|
658
662
|
}
|
|
659
663
|
|
|
660
664
|
if (is_constant_module) {
|
|
@@ -1173,8 +1177,6 @@ export default new Transformer({
|
|
|
1173
1177
|
}
|
|
1174
1178
|
}
|
|
1175
1179
|
|
|
1176
|
-
asset.setCompiledCssStyles(compiled_css_rules);
|
|
1177
|
-
|
|
1178
1180
|
asset.type = 'js';
|
|
1179
1181
|
asset.setBuffer(compiledCode);
|
|
1180
1182
|
|