@atlaspack/transformer-js 3.3.9 → 3.3.10
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 +18 -2
- package/package.json +5 -5
- package/src/JSTransformer.js +14 -1
package/lib/JSTransformer.js
CHANGED
|
@@ -309,6 +309,8 @@ var _default = exports.default = new (_plugin().Transformer)({
|
|
|
309
309
|
};
|
|
310
310
|
}
|
|
311
311
|
let env = {};
|
|
312
|
+
|
|
313
|
+
// $FlowFixMe
|
|
312
314
|
if (!(config !== null && config !== void 0 && config.inlineEnvironment)) {
|
|
313
315
|
if (options.env.NODE_ENV != null) {
|
|
314
316
|
env.NODE_ENV = options.env.NODE_ENV;
|
|
@@ -317,7 +319,9 @@ var _default = exports.default = new (_plugin().Transformer)({
|
|
|
317
319
|
env.ATLASPACK_BUILD_ENV = 'test';
|
|
318
320
|
}
|
|
319
321
|
} else if (Array.isArray(config === null || config === void 0 ? void 0 : config.inlineEnvironment)) {
|
|
320
|
-
for (let match of (0, _utils().globMatch)(Object.keys(options.env),
|
|
322
|
+
for (let match of (0, _utils().globMatch)(Object.keys(options.env),
|
|
323
|
+
// $FlowFixMe
|
|
324
|
+
config.inlineEnvironment)) {
|
|
321
325
|
env[match] = String(options.env[match]);
|
|
322
326
|
}
|
|
323
327
|
} else {
|
|
@@ -328,6 +332,7 @@ var _default = exports.default = new (_plugin().Transformer)({
|
|
|
328
332
|
}
|
|
329
333
|
}
|
|
330
334
|
let supportsModuleWorkers = asset.env.shouldScopeHoist && asset.env.supports('worker-module', true);
|
|
335
|
+
// $FlowFixMe
|
|
331
336
|
let isJSX = Boolean(config === null || config === void 0 ? void 0 : config.isJSX);
|
|
332
337
|
if (asset.isSource) {
|
|
333
338
|
if (asset.type === 'ts') {
|
|
@@ -357,6 +362,7 @@ var _default = exports.default = new (_plugin().Transformer)({
|
|
|
357
362
|
module_id: asset.id,
|
|
358
363
|
project_root: options.projectRoot,
|
|
359
364
|
replace_env: !asset.env.isNode(),
|
|
365
|
+
// $FlowFixMe
|
|
360
366
|
inline_fs: Boolean(config === null || config === void 0 ? void 0 : config.inlineFS) && !asset.env.isNode(),
|
|
361
367
|
insert_node_globals: !asset.env.isNode() && asset.env.sourceType !== 'script',
|
|
362
368
|
node_replacer: asset.env.isNode(),
|
|
@@ -365,13 +371,21 @@ var _default = exports.default = new (_plugin().Transformer)({
|
|
|
365
371
|
env,
|
|
366
372
|
is_type_script: asset.type === 'ts' || asset.type === 'tsx',
|
|
367
373
|
is_jsx: isJSX,
|
|
374
|
+
// $FlowFixMe
|
|
368
375
|
jsx_pragma: config === null || config === void 0 ? void 0 : config.pragma,
|
|
376
|
+
// $FlowFixMe
|
|
369
377
|
jsx_pragma_frag: config === null || config === void 0 ? void 0 : config.pragmaFrag,
|
|
378
|
+
// $FlowFixMe
|
|
370
379
|
automatic_jsx_runtime: Boolean(config === null || config === void 0 ? void 0 : config.automaticJSXRuntime),
|
|
380
|
+
// $FlowFixMe
|
|
371
381
|
jsx_import_source: config === null || config === void 0 ? void 0 : config.jsxImportSource,
|
|
372
382
|
is_development: options.mode === 'development',
|
|
373
|
-
react_refresh: asset.env.isBrowser() && !asset.env.isLibrary && !asset.env.isWorker() && !asset.env.isWorklet() &&
|
|
383
|
+
react_refresh: asset.env.isBrowser() && !asset.env.isLibrary && !asset.env.isWorker() && !asset.env.isWorklet() &&
|
|
384
|
+
// $FlowFixMe
|
|
385
|
+
Boolean(config === null || config === void 0 ? void 0 : config.reactRefresh),
|
|
386
|
+
// $FlowFixMe
|
|
374
387
|
decorators: Boolean(config === null || config === void 0 ? void 0 : config.decorators),
|
|
388
|
+
// $FlowFixMe
|
|
375
389
|
use_define_for_class_fields: Boolean(config === null || config === void 0 ? void 0 : config.useDefineForClassFields),
|
|
376
390
|
targets,
|
|
377
391
|
source_maps: !!asset.env.sourceMap,
|
|
@@ -383,10 +397,12 @@ var _default = exports.default = new (_plugin().Transformer)({
|
|
|
383
397
|
trace_bailouts: options.logLevel === 'verbose',
|
|
384
398
|
is_swc_helpers: /@swc[/\\]helpers/.test(asset.filePath),
|
|
385
399
|
standalone: asset.query.has('standalone'),
|
|
400
|
+
// $FlowFixMe
|
|
386
401
|
inline_constants: config.inlineConstants,
|
|
387
402
|
conditional_bundling: options.featureFlags.conditionalBundlingApi,
|
|
388
403
|
hmr_improvements: options.featureFlags.hmrImprovements,
|
|
389
404
|
computed_properties_fix: options.featureFlags.unusedComputedPropertyFix,
|
|
405
|
+
// $FlowFixMe
|
|
390
406
|
magic_comments: Boolean(config === null || config === void 0 ? void 0 : config.magicComments),
|
|
391
407
|
callMacro: asset.isSource ? async (err, src, exportName, args, loc) => {
|
|
392
408
|
let mod;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaspack/transformer-js",
|
|
3
|
-
"version": "3.3.
|
|
3
|
+
"version": "3.3.10",
|
|
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.19.
|
|
27
|
-
"@atlaspack/plugin": "2.14.
|
|
26
|
+
"@atlaspack/feature-flags": "2.19.2",
|
|
27
|
+
"@atlaspack/plugin": "2.14.20",
|
|
28
28
|
"@atlaspack/rust": "3.4.1",
|
|
29
29
|
"@parcel/source-map": "^2.1.1",
|
|
30
|
-
"@atlaspack/utils": "2.17.
|
|
31
|
-
"@atlaspack/workers": "2.14.
|
|
30
|
+
"@atlaspack/utils": "2.17.2",
|
|
31
|
+
"@atlaspack/workers": "2.14.20",
|
|
32
32
|
"@swc/helpers": "^0.5.15",
|
|
33
33
|
"browserslist": "^4.6.6",
|
|
34
34
|
"nullthrows": "^1.1.1",
|
package/src/JSTransformer.js
CHANGED
|
@@ -386,6 +386,7 @@ export default (new Transformer({
|
|
|
386
386
|
|
|
387
387
|
let env: EnvMap = {};
|
|
388
388
|
|
|
389
|
+
// $FlowFixMe
|
|
389
390
|
if (!config?.inlineEnvironment) {
|
|
390
391
|
if (options.env.NODE_ENV != null) {
|
|
391
392
|
env.NODE_ENV = options.env.NODE_ENV;
|
|
@@ -397,6 +398,7 @@ export default (new Transformer({
|
|
|
397
398
|
} else if (Array.isArray(config?.inlineEnvironment)) {
|
|
398
399
|
for (let match of globMatch(
|
|
399
400
|
Object.keys(options.env),
|
|
401
|
+
// $FlowFixMe
|
|
400
402
|
config.inlineEnvironment,
|
|
401
403
|
)) {
|
|
402
404
|
env[match] = String(options.env[match]);
|
|
@@ -411,6 +413,7 @@ export default (new Transformer({
|
|
|
411
413
|
|
|
412
414
|
let supportsModuleWorkers =
|
|
413
415
|
asset.env.shouldScopeHoist && asset.env.supports('worker-module', true);
|
|
416
|
+
// $FlowFixMe
|
|
414
417
|
let isJSX = Boolean(config?.isJSX);
|
|
415
418
|
if (asset.isSource) {
|
|
416
419
|
if (asset.type === 'ts') {
|
|
@@ -441,6 +444,7 @@ export default (new Transformer({
|
|
|
441
444
|
module_id: asset.id,
|
|
442
445
|
project_root: options.projectRoot,
|
|
443
446
|
replace_env: !asset.env.isNode(),
|
|
447
|
+
// $FlowFixMe
|
|
444
448
|
inline_fs: Boolean(config?.inlineFS) && !asset.env.isNode(),
|
|
445
449
|
insert_node_globals:
|
|
446
450
|
!asset.env.isNode() && asset.env.sourceType !== 'script',
|
|
@@ -450,9 +454,13 @@ export default (new Transformer({
|
|
|
450
454
|
env,
|
|
451
455
|
is_type_script: asset.type === 'ts' || asset.type === 'tsx',
|
|
452
456
|
is_jsx: isJSX,
|
|
457
|
+
// $FlowFixMe
|
|
453
458
|
jsx_pragma: config?.pragma,
|
|
459
|
+
// $FlowFixMe
|
|
454
460
|
jsx_pragma_frag: config?.pragmaFrag,
|
|
461
|
+
// $FlowFixMe
|
|
455
462
|
automatic_jsx_runtime: Boolean(config?.automaticJSXRuntime),
|
|
463
|
+
// $FlowFixMe
|
|
456
464
|
jsx_import_source: config?.jsxImportSource,
|
|
457
465
|
is_development: options.mode === 'development',
|
|
458
466
|
react_refresh:
|
|
@@ -460,8 +468,11 @@ export default (new Transformer({
|
|
|
460
468
|
!asset.env.isLibrary &&
|
|
461
469
|
!asset.env.isWorker() &&
|
|
462
470
|
!asset.env.isWorklet() &&
|
|
471
|
+
// $FlowFixMe
|
|
463
472
|
Boolean(config?.reactRefresh),
|
|
473
|
+
// $FlowFixMe
|
|
464
474
|
decorators: Boolean(config?.decorators),
|
|
475
|
+
// $FlowFixMe
|
|
465
476
|
use_define_for_class_fields: Boolean(config?.useDefineForClassFields),
|
|
466
477
|
targets,
|
|
467
478
|
source_maps: !!asset.env.sourceMap,
|
|
@@ -474,10 +485,12 @@ export default (new Transformer({
|
|
|
474
485
|
trace_bailouts: options.logLevel === 'verbose',
|
|
475
486
|
is_swc_helpers: /@swc[/\\]helpers/.test(asset.filePath),
|
|
476
487
|
standalone: asset.query.has('standalone'),
|
|
488
|
+
// $FlowFixMe
|
|
477
489
|
inline_constants: config.inlineConstants,
|
|
478
490
|
conditional_bundling: options.featureFlags.conditionalBundlingApi,
|
|
479
491
|
hmr_improvements: options.featureFlags.hmrImprovements,
|
|
480
492
|
computed_properties_fix: options.featureFlags.unusedComputedPropertyFix,
|
|
493
|
+
// $FlowFixMe
|
|
481
494
|
magic_comments: Boolean(config?.magicComments),
|
|
482
495
|
callMacro: asset.isSource
|
|
483
496
|
? async (err, src, exportName, args, loc) => {
|
|
@@ -1111,4 +1124,4 @@ export default (new Transformer({
|
|
|
1111
1124
|
|
|
1112
1125
|
return [asset, ...macroAssets];
|
|
1113
1126
|
},
|
|
1114
|
-
}): Transformer);
|
|
1127
|
+
}): Transformer<mixed>);
|