@atlaspack/transformer-babel 2.12.1-dev.3365 → 2.12.1-dev.3398
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/babel7.js +2 -2
- package/lib/config.js +6 -6
- package/lib/utils.js +3 -3
- package/package.json +7 -7
- package/src/babel7.js +2 -2
- package/src/config.js +6 -6
- package/src/utils.js +3 -3
package/lib/babel7.js
CHANGED
|
@@ -73,7 +73,7 @@ async function babel7(opts) {
|
|
|
73
73
|
},
|
|
74
74
|
|
|
75
75
|
caller: {
|
|
76
|
-
name: '
|
|
76
|
+
name: 'parcel',
|
|
77
77
|
version: transformerVersion,
|
|
78
78
|
targets: JSON.stringify(babelOptions.targets),
|
|
79
79
|
outputFormat: asset.env.outputFormat
|
|
@@ -109,7 +109,7 @@ async function babel7(opts) {
|
|
|
109
109
|
if (!_path().default.isAbsolute(f)) {
|
|
110
110
|
opts.logger.warn({
|
|
111
111
|
message: (0, _diagnostic().md)`Ignoring non-absolute Babel external dependency: ${f}`,
|
|
112
|
-
hints: ['Please report this to the corresponding Babel plugin and/or to
|
|
112
|
+
hints: ['Please report this to the corresponding Babel plugin and/or to Parcel.']
|
|
113
113
|
});
|
|
114
114
|
} else {
|
|
115
115
|
if (await options.inputFS.exists(f)) {
|
package/lib/config.js
CHANGED
|
@@ -83,7 +83,7 @@ async function load(config, options, logger) {
|
|
|
83
83
|
// We need to invalidate on startup in case the config is non-static,
|
|
84
84
|
// e.g. uses unknown environment variables, reads from the filesystem, etc.
|
|
85
85
|
logger.warn({
|
|
86
|
-
message: `It looks like you're using a JavaScript Babel config file. This means the config cannot be watched for changes, and Babel transformations cannot be cached. You'll need to restart
|
|
86
|
+
message: `It looks like you're using a JavaScript Babel config file. This means the config cannot be watched for changes, and Babel transformations cannot be cached. You'll need to restart Parcel for changes to this config to take effect. Try using a ${_path().default.basename(file, _path().default.extname(file)) + '.json'} file instead.`
|
|
87
87
|
});
|
|
88
88
|
config.invalidateOnStartup();
|
|
89
89
|
|
|
@@ -105,7 +105,7 @@ async function load(config, options, logger) {
|
|
|
105
105
|
};
|
|
106
106
|
let warnOldVersion = () => {
|
|
107
107
|
logger.warn({
|
|
108
|
-
message: 'You are using an old version of @babel/core which does not support the necessary features for
|
|
108
|
+
message: 'You are using an old version of @babel/core which does not support the necessary features for Parcel to cache and watch babel config files safely. You may need to restart Parcel for config changes to take effect. Please upgrade to @babel/core 7.12.0 or later to resolve this issue.'
|
|
109
109
|
});
|
|
110
110
|
config.invalidateOnStartup();
|
|
111
111
|
};
|
|
@@ -240,7 +240,7 @@ async function warnOnRedundantPlugins(fs, babelConfig, logger) {
|
|
|
240
240
|
let diagnostics = [];
|
|
241
241
|
if (filteredPresets.length === 0 && foundRedundantPresets.size > 0 && plugins.length === 0) {
|
|
242
242
|
diagnostics.push({
|
|
243
|
-
message: (0, _diagnostic().md)`
|
|
243
|
+
message: (0, _diagnostic().md)`Parcel includes transpilation by default. Babel config __${filePath}__ contains only redundant presets. Deleting it may significantly improve build performance.`,
|
|
244
244
|
codeFrames: [{
|
|
245
245
|
filePath: configPath,
|
|
246
246
|
codeHighlights: await getCodeHighlights(fs, configPath, foundRedundantPresets)
|
|
@@ -250,7 +250,7 @@ async function warnOnRedundantPlugins(fs, babelConfig, logger) {
|
|
|
250
250
|
});
|
|
251
251
|
} else if (foundRedundantPresets.size > 0) {
|
|
252
252
|
diagnostics.push({
|
|
253
|
-
message: (0, _diagnostic().md)`
|
|
253
|
+
message: (0, _diagnostic().md)`Parcel includes transpilation by default. Babel config __${filePath}__ includes the following redundant presets: ${[...foundRedundantPresets].map(p => _diagnostic().md.underline(p))}. Removing these may improve build performance.`,
|
|
254
254
|
codeFrames: [{
|
|
255
255
|
filePath: configPath,
|
|
256
256
|
codeHighlights: await getCodeHighlights(fs, configPath, foundRedundantPresets)
|
|
@@ -261,12 +261,12 @@ async function warnOnRedundantPlugins(fs, babelConfig, logger) {
|
|
|
261
261
|
}
|
|
262
262
|
if (foundRedundantPresets.has('@babel/preset-env')) {
|
|
263
263
|
diagnostics.push({
|
|
264
|
-
message: "@babel/preset-env does not support
|
|
264
|
+
message: "@babel/preset-env does not support Parcel's targets, which will likely result in unnecessary transpilation and larger bundle sizes.",
|
|
265
265
|
codeFrames: [{
|
|
266
266
|
filePath: babelConfig.config ?? babelConfig.babelrc,
|
|
267
267
|
codeHighlights: await getCodeHighlights(fs, babelConfig.config ?? babelConfig.babelrc, new Set(['@babel/preset-env']))
|
|
268
268
|
}],
|
|
269
|
-
hints: [`Either remove __@babel/preset-env__ to use
|
|
269
|
+
hints: [`Either remove __@babel/preset-env__ to use Parcel's builtin transpilation, or replace with __@atlaspack/babel-preset-env__`],
|
|
270
270
|
documentationURL: 'https://parceljs.org/languages/javascript/#custom-plugins'
|
|
271
271
|
});
|
|
272
272
|
}
|
package/lib/utils.js
CHANGED
|
@@ -39,9 +39,9 @@ const TargetNames = {
|
|
|
39
39
|
// Based on https://caniuse.com/#feat=es6-module
|
|
40
40
|
const ESMODULE_BROWSERS = ['not ie <= 11', 'not edge < 16', 'not firefox < 60', 'not chrome < 61', 'not safari < 11', 'not opera < 48', 'not ios_saf < 11', 'not op_mini all', 'not android < 76', 'not blackberry > 0', 'not op_mob > 0', 'not and_chr < 76', 'not and_ff < 68', 'not ie_mob > 0', 'not and_uc > 0', 'not samsung < 8.2', 'not and_qq > 0', 'not baidu > 0', 'not kaios > 0'];
|
|
41
41
|
function enginesToBabelTargets(env) {
|
|
42
|
-
// "Targets" is the name @babel/preset-env uses for what
|
|
43
|
-
// This should not be confused with
|
|
44
|
-
// Unlike
|
|
42
|
+
// "Targets" is the name @babel/preset-env uses for what Parcel calls engines.
|
|
43
|
+
// This should not be confused with Parcel's own targets.
|
|
44
|
+
// Unlike Parcel's engines, @babel/preset-env expects to work with minimum
|
|
45
45
|
// versions, not semver ranges, of its targets.
|
|
46
46
|
let targets = {};
|
|
47
47
|
for (let engineName of Object.keys(env.engines)) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaspack/transformer-babel",
|
|
3
|
-
"version": "2.12.1-dev.
|
|
3
|
+
"version": "2.12.1-dev.3398+81c73b3cd",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -13,12 +13,12 @@
|
|
|
13
13
|
"source": "src/BabelTransformer.js",
|
|
14
14
|
"engines": {
|
|
15
15
|
"node": ">= 16.0.0",
|
|
16
|
-
"
|
|
16
|
+
"parcel": "^2.12.1-dev.3398+81c73b3cd"
|
|
17
17
|
},
|
|
18
18
|
"dependencies": {
|
|
19
|
-
"@atlaspack/diagnostic": "2.12.1-dev.
|
|
20
|
-
"@atlaspack/plugin": "2.12.1-dev.
|
|
21
|
-
"@atlaspack/utils": "2.12.1-dev.
|
|
19
|
+
"@atlaspack/diagnostic": "2.12.1-dev.3398+81c73b3cd",
|
|
20
|
+
"@atlaspack/plugin": "2.12.1-dev.3398+81c73b3cd",
|
|
21
|
+
"@atlaspack/utils": "2.12.1-dev.3398+81c73b3cd",
|
|
22
22
|
"@parcel/source-map": "^2.1.1",
|
|
23
23
|
"browserslist": "^4.6.6",
|
|
24
24
|
"json5": "^2.2.0",
|
|
@@ -26,10 +26,10 @@
|
|
|
26
26
|
"semver": "^7.5.2"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
|
-
"@atlaspack/types": "2.12.1-dev.
|
|
29
|
+
"@atlaspack/types": "2.12.1-dev.3398+81c73b3cd",
|
|
30
30
|
"@babel/core": "^7.22.11",
|
|
31
31
|
"@babel/preset-env": "^7.22.14",
|
|
32
32
|
"@babel/types": "^7.22.11"
|
|
33
33
|
},
|
|
34
|
-
"gitHead": "
|
|
34
|
+
"gitHead": "81c73b3cdf93adf8b0013be9fed5422579bd5910"
|
|
35
35
|
}
|
package/src/babel7.js
CHANGED
|
@@ -69,7 +69,7 @@ export default async function babel7(
|
|
|
69
69
|
],
|
|
70
70
|
},
|
|
71
71
|
caller: {
|
|
72
|
-
name: '
|
|
72
|
+
name: 'parcel',
|
|
73
73
|
version: transformerVersion,
|
|
74
74
|
targets: JSON.stringify(babelOptions.targets),
|
|
75
75
|
outputFormat: asset.env.outputFormat,
|
|
@@ -120,7 +120,7 @@ export default async function babel7(
|
|
|
120
120
|
opts.logger.warn({
|
|
121
121
|
message: md`Ignoring non-absolute Babel external dependency: ${f}`,
|
|
122
122
|
hints: [
|
|
123
|
-
'Please report this to the corresponding Babel plugin and/or to
|
|
123
|
+
'Please report this to the corresponding Babel plugin and/or to Parcel.',
|
|
124
124
|
],
|
|
125
125
|
});
|
|
126
126
|
} else {
|
package/src/config.js
CHANGED
|
@@ -107,7 +107,7 @@ export async function load(
|
|
|
107
107
|
// We need to invalidate on startup in case the config is non-static,
|
|
108
108
|
// e.g. uses unknown environment variables, reads from the filesystem, etc.
|
|
109
109
|
logger.warn({
|
|
110
|
-
message: `It looks like you're using a JavaScript Babel config file. This means the config cannot be watched for changes, and Babel transformations cannot be cached. You'll need to restart
|
|
110
|
+
message: `It looks like you're using a JavaScript Babel config file. This means the config cannot be watched for changes, and Babel transformations cannot be cached. You'll need to restart Parcel for changes to this config to take effect. Try using a ${
|
|
111
111
|
path.basename(file, path.extname(file)) + '.json'
|
|
112
112
|
} file instead.`,
|
|
113
113
|
});
|
|
@@ -135,7 +135,7 @@ export async function load(
|
|
|
135
135
|
let warnOldVersion = () => {
|
|
136
136
|
logger.warn({
|
|
137
137
|
message:
|
|
138
|
-
'You are using an old version of @babel/core which does not support the necessary features for
|
|
138
|
+
'You are using an old version of @babel/core which does not support the necessary features for Parcel to cache and watch babel config files safely. You may need to restart Parcel for config changes to take effect. Please upgrade to @babel/core 7.12.0 or later to resolve this issue.',
|
|
139
139
|
});
|
|
140
140
|
config.invalidateOnStartup();
|
|
141
141
|
};
|
|
@@ -312,7 +312,7 @@ async function warnOnRedundantPlugins(fs, babelConfig, logger) {
|
|
|
312
312
|
plugins.length === 0
|
|
313
313
|
) {
|
|
314
314
|
diagnostics.push({
|
|
315
|
-
message: md`
|
|
315
|
+
message: md`Parcel includes transpilation by default. Babel config __${filePath}__ contains only redundant presets. Deleting it may significantly improve build performance.`,
|
|
316
316
|
codeFrames: [
|
|
317
317
|
{
|
|
318
318
|
filePath: configPath,
|
|
@@ -329,7 +329,7 @@ async function warnOnRedundantPlugins(fs, babelConfig, logger) {
|
|
|
329
329
|
});
|
|
330
330
|
} else if (foundRedundantPresets.size > 0) {
|
|
331
331
|
diagnostics.push({
|
|
332
|
-
message: md`
|
|
332
|
+
message: md`Parcel includes transpilation by default. Babel config __${filePath}__ includes the following redundant presets: ${[
|
|
333
333
|
...foundRedundantPresets,
|
|
334
334
|
].map(p =>
|
|
335
335
|
md.underline(p),
|
|
@@ -353,7 +353,7 @@ async function warnOnRedundantPlugins(fs, babelConfig, logger) {
|
|
|
353
353
|
if (foundRedundantPresets.has('@babel/preset-env')) {
|
|
354
354
|
diagnostics.push({
|
|
355
355
|
message:
|
|
356
|
-
"@babel/preset-env does not support
|
|
356
|
+
"@babel/preset-env does not support Parcel's targets, which will likely result in unnecessary transpilation and larger bundle sizes.",
|
|
357
357
|
codeFrames: [
|
|
358
358
|
{
|
|
359
359
|
filePath: babelConfig.config ?? babelConfig.babelrc,
|
|
@@ -365,7 +365,7 @@ async function warnOnRedundantPlugins(fs, babelConfig, logger) {
|
|
|
365
365
|
},
|
|
366
366
|
],
|
|
367
367
|
hints: [
|
|
368
|
-
`Either remove __@babel/preset-env__ to use
|
|
368
|
+
`Either remove __@babel/preset-env__ to use Parcel's builtin transpilation, or replace with __@atlaspack/babel-preset-env__`,
|
|
369
369
|
],
|
|
370
370
|
documentationURL:
|
|
371
371
|
'https://parceljs.org/languages/javascript/#custom-plugins',
|
package/src/utils.js
CHANGED
|
@@ -47,9 +47,9 @@ const ESMODULE_BROWSERS = [
|
|
|
47
47
|
];
|
|
48
48
|
|
|
49
49
|
export function enginesToBabelTargets(env: Environment): BabelTargets {
|
|
50
|
-
// "Targets" is the name @babel/preset-env uses for what
|
|
51
|
-
// This should not be confused with
|
|
52
|
-
// Unlike
|
|
50
|
+
// "Targets" is the name @babel/preset-env uses for what Parcel calls engines.
|
|
51
|
+
// This should not be confused with Parcel's own targets.
|
|
52
|
+
// Unlike Parcel's engines, @babel/preset-env expects to work with minimum
|
|
53
53
|
// versions, not semver ranges, of its targets.
|
|
54
54
|
let targets = {};
|
|
55
55
|
for (let engineName of Object.keys(env.engines)) {
|