@atlaspack/transformer-js 3.2.3-canary.304 → 3.2.3-canary.305
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 +21 -12
- package/package.json +10 -10
- package/src/JSTransformer.ts +28 -20
package/lib/JSTransformer.js
CHANGED
|
@@ -251,6 +251,13 @@ var _default = exports.default = new (_plugin().Transformer)({
|
|
|
251
251
|
let inlineConstants = false;
|
|
252
252
|
let magicComments = false;
|
|
253
253
|
let addReactDisplayName = false;
|
|
254
|
+
let enableSsrTypeofReplacement = options.env.NATIVE_SSR_TYPEOF_REPLACEMENT === 'true';
|
|
255
|
+
let globalAliasingConfig = options.env.NATIVE_GLOBAL_ALIASING && JSON.parse(options.env.NATIVE_GLOBAL_ALIASING);
|
|
256
|
+
let enableLazyLoading = options.env.NATIVE_LAZY_LOADING === 'true';
|
|
257
|
+
let enableReactHooksRemoval = options.env.NATIVE_REACT_HOOKS_REMOVAL === 'true';
|
|
258
|
+
let enableStaticPrevaluation = options.env.NATIVE_PREVALUATION === 'true';
|
|
259
|
+
let enableDeadReturnsRemoval = options.env.NATIVE_DEAD_RETURNS_REMOVAL === 'true';
|
|
260
|
+
let enableUnusedBindingsRemoval = options.env.NATIVE_UNUSED_BINDINGS_REMOVAL === 'true';
|
|
254
261
|
let syncDynamicImportConfig;
|
|
255
262
|
if (config.env.isTesseract() && options.env.SYNC_DYNAMIC_IMPORT_CONFIG) {
|
|
256
263
|
try {
|
|
@@ -277,10 +284,6 @@ var _default = exports.default = new (_plugin().Transformer)({
|
|
|
277
284
|
}
|
|
278
285
|
}
|
|
279
286
|
config.invalidateOnEnvChange('SYNC_DYNAMIC_IMPORT_CONFIG');
|
|
280
|
-
let enableGlobalThisAliaser = options.env.NATIVE_GLOBAL_THIS_ALIASER === 'true';
|
|
281
|
-
let enableLazyLoadingTransformer = options.env.NATIVE_LAZY_LOADING_TRANSFORMER === 'true';
|
|
282
|
-
let enableDeadReturnsRemover = options.env.NATIVE_DEAD_RETURNS_REMOVER === 'true';
|
|
283
|
-
let enableUnusedBindingsRemover = options.env.NATIVE_UNUSED_BINDINGS_REMOVER === 'true';
|
|
284
287
|
if (conf && conf.contents) {
|
|
285
288
|
var _conf$contents, _conf$contents2, _conf$contents3, _conf$contents4, _conf$contents5;
|
|
286
289
|
_utils().validateSchema.diagnostic(CONFIG_SCHEMA, {
|
|
@@ -318,10 +321,13 @@ var _default = exports.default = new (_plugin().Transformer)({
|
|
|
318
321
|
decorators,
|
|
319
322
|
useDefineForClassFields,
|
|
320
323
|
magicComments,
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
324
|
+
globalAliasingConfig,
|
|
325
|
+
enableSsrTypeofReplacement,
|
|
326
|
+
enableLazyLoading,
|
|
327
|
+
enableDeadReturnsRemoval,
|
|
328
|
+
enableUnusedBindingsRemoval,
|
|
329
|
+
enableStaticPrevaluation,
|
|
330
|
+
enableReactHooksRemoval,
|
|
325
331
|
syncDynamicImportConfig
|
|
326
332
|
};
|
|
327
333
|
},
|
|
@@ -474,12 +480,15 @@ var _default = exports.default = new (_plugin().Transformer)({
|
|
|
474
480
|
exports_rebinding_optimisation: options.featureFlags.exportsRebindingOptimisation,
|
|
475
481
|
magic_comments: Boolean(config === null || config === void 0 ? void 0 : config.magicComments) || (0, _featureFlags().getFeatureFlag)('supportWebpackChunkName'),
|
|
476
482
|
is_source: asset.isSource,
|
|
477
|
-
enable_global_this_aliaser: Boolean(config.enableGlobalThisAliaser),
|
|
478
|
-
enable_lazy_loading_transformer: Boolean(config.enableLazyLoadingTransformer),
|
|
479
483
|
sync_dynamic_import_config: config.syncDynamicImportConfig,
|
|
480
484
|
nested_promise_import_fix: options.featureFlags.nestedPromiseImportFix,
|
|
481
|
-
|
|
482
|
-
|
|
485
|
+
global_aliasing_config: config.globalAliasingConfig,
|
|
486
|
+
enable_ssr_typeof_replacement: Boolean(config.enableSsrTypeofReplacement),
|
|
487
|
+
enable_lazy_loading: Boolean(config.enableLazyLoading),
|
|
488
|
+
enable_dead_returns_removal: Boolean(config.enableDeadReturnsRemoval),
|
|
489
|
+
enable_unused_bindings_removal: Boolean(config.enableUnusedBindingsRemoval),
|
|
490
|
+
enable_static_prevaluation: Boolean(config.enableStaticPrevaluation),
|
|
491
|
+
enable_react_hooks_removal: Boolean(config.enableReactHooksRemoval),
|
|
483
492
|
callMacro: asset.isSource ? async (err, src, exportName, args, loc) => {
|
|
484
493
|
let mod;
|
|
485
494
|
try {
|
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.305+96f1d7f3e",
|
|
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.3-canary.
|
|
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/source-map": "3.1.2-canary.
|
|
33
|
-
"@atlaspack/utils": "2.14.5-canary.
|
|
34
|
-
"@atlaspack/workers": "2.14.5-canary.
|
|
27
|
+
"@atlaspack/build-cache": "2.13.3-canary.373+96f1d7f3e",
|
|
28
|
+
"@atlaspack/diagnostic": "2.14.1-canary.373+96f1d7f3e",
|
|
29
|
+
"@atlaspack/feature-flags": "2.14.1-canary.373+96f1d7f3e",
|
|
30
|
+
"@atlaspack/plugin": "2.14.5-canary.305+96f1d7f3e",
|
|
31
|
+
"@atlaspack/rust": "3.2.1-canary.305+96f1d7f3e",
|
|
32
|
+
"@atlaspack/source-map": "3.1.2-canary.4084+96f1d7f3e",
|
|
33
|
+
"@atlaspack/utils": "2.14.5-canary.305+96f1d7f3e",
|
|
34
|
+
"@atlaspack/workers": "2.14.5-canary.305+96f1d7f3e",
|
|
35
35
|
"@swc/helpers": "^0.5.15",
|
|
36
36
|
"browserslist": "^4.6.6",
|
|
37
37
|
"nullthrows": "^1.1.1",
|
|
@@ -42,5 +42,5 @@
|
|
|
42
42
|
"@atlaspack/core": "2.29.0"
|
|
43
43
|
},
|
|
44
44
|
"type": "commonjs",
|
|
45
|
-
"gitHead": "
|
|
45
|
+
"gitHead": "96f1d7f3efef12ce4f5966e34d00b299fcefb4dd"
|
|
46
46
|
}
|
package/src/JSTransformer.ts
CHANGED
|
@@ -305,6 +305,19 @@ export default new Transformer({
|
|
|
305
305
|
let magicComments = false;
|
|
306
306
|
let addReactDisplayName = false;
|
|
307
307
|
|
|
308
|
+
let enableSsrTypeofReplacement =
|
|
309
|
+
options.env.NATIVE_SSR_TYPEOF_REPLACEMENT === 'true';
|
|
310
|
+
let globalAliasingConfig =
|
|
311
|
+
options.env.NATIVE_GLOBAL_ALIASING &&
|
|
312
|
+
JSON.parse(options.env.NATIVE_GLOBAL_ALIASING);
|
|
313
|
+
let enableLazyLoading = options.env.NATIVE_LAZY_LOADING === 'true';
|
|
314
|
+
let enableReactHooksRemoval =
|
|
315
|
+
options.env.NATIVE_REACT_HOOKS_REMOVAL === 'true';
|
|
316
|
+
let enableStaticPrevaluation = options.env.NATIVE_PREVALUATION === 'true';
|
|
317
|
+
let enableDeadReturnsRemoval =
|
|
318
|
+
options.env.NATIVE_DEAD_RETURNS_REMOVAL === 'true';
|
|
319
|
+
let enableUnusedBindingsRemoval =
|
|
320
|
+
options.env.NATIVE_UNUSED_BINDINGS_REMOVAL === 'true';
|
|
308
321
|
let syncDynamicImportConfig:
|
|
309
322
|
| {
|
|
310
323
|
entrypoint_filepath_suffix: string;
|
|
@@ -347,15 +360,6 @@ export default new Transformer({
|
|
|
347
360
|
|
|
348
361
|
config.invalidateOnEnvChange('SYNC_DYNAMIC_IMPORT_CONFIG');
|
|
349
362
|
|
|
350
|
-
let enableGlobalThisAliaser =
|
|
351
|
-
options.env.NATIVE_GLOBAL_THIS_ALIASER === 'true';
|
|
352
|
-
let enableLazyLoadingTransformer =
|
|
353
|
-
options.env.NATIVE_LAZY_LOADING_TRANSFORMER === 'true';
|
|
354
|
-
let enableDeadReturnsRemover =
|
|
355
|
-
options.env.NATIVE_DEAD_RETURNS_REMOVER === 'true';
|
|
356
|
-
let enableUnusedBindingsRemover =
|
|
357
|
-
options.env.NATIVE_UNUSED_BINDINGS_REMOVER === 'true';
|
|
358
|
-
|
|
359
363
|
if (conf && conf.contents) {
|
|
360
364
|
validateSchema.diagnostic(
|
|
361
365
|
CONFIG_SCHEMA,
|
|
@@ -398,10 +402,13 @@ export default new Transformer({
|
|
|
398
402
|
decorators,
|
|
399
403
|
useDefineForClassFields,
|
|
400
404
|
magicComments,
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
+
globalAliasingConfig,
|
|
406
|
+
enableSsrTypeofReplacement,
|
|
407
|
+
enableLazyLoading,
|
|
408
|
+
enableDeadReturnsRemoval,
|
|
409
|
+
enableUnusedBindingsRemoval,
|
|
410
|
+
enableStaticPrevaluation,
|
|
411
|
+
enableReactHooksRemoval,
|
|
405
412
|
syncDynamicImportConfig,
|
|
406
413
|
};
|
|
407
414
|
},
|
|
@@ -582,16 +589,17 @@ export default new Transformer({
|
|
|
582
589
|
Boolean(config?.magicComments) ||
|
|
583
590
|
getFeatureFlag('supportWebpackChunkName'),
|
|
584
591
|
is_source: asset.isSource,
|
|
585
|
-
enable_global_this_aliaser: Boolean(config.enableGlobalThisAliaser),
|
|
586
|
-
enable_lazy_loading_transformer: Boolean(
|
|
587
|
-
config.enableLazyLoadingTransformer,
|
|
588
|
-
),
|
|
589
592
|
sync_dynamic_import_config: config.syncDynamicImportConfig,
|
|
590
593
|
nested_promise_import_fix: options.featureFlags.nestedPromiseImportFix,
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
+
global_aliasing_config: config.globalAliasingConfig,
|
|
595
|
+
enable_ssr_typeof_replacement: Boolean(config.enableSsrTypeofReplacement),
|
|
596
|
+
enable_lazy_loading: Boolean(config.enableLazyLoading),
|
|
597
|
+
enable_dead_returns_removal: Boolean(config.enableDeadReturnsRemoval),
|
|
598
|
+
enable_unused_bindings_removal: Boolean(
|
|
599
|
+
config.enableUnusedBindingsRemoval,
|
|
594
600
|
),
|
|
601
|
+
enable_static_prevaluation: Boolean(config.enableStaticPrevaluation),
|
|
602
|
+
enable_react_hooks_removal: Boolean(config.enableReactHooksRemoval),
|
|
595
603
|
callMacro: asset.isSource
|
|
596
604
|
? async (err: any, src: any, exportName: any, args: any, loc: any) => {
|
|
597
605
|
let mod;
|