@atlaspack/babel-preset-env 2.12.1-dev.3368 → 2.12.1-dev.3401
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/index.js +1 -1
- package/package.json +2 -2
- package/src/index.js +2 -2
- package/test/preset-env.test.js +3 -3
package/lib/index.js
CHANGED
|
@@ -5,7 +5,7 @@ const COMPATIBLE_ATLASPACK_BABEL_TRANSFORMER_SEMVER = '^2.0.0-beta.1';
|
|
|
5
5
|
module.exports = function (api, opts) {
|
|
6
6
|
let name = api.caller(caller => caller && caller.name);
|
|
7
7
|
let version = api.caller(caller => caller && caller.version);
|
|
8
|
-
if (name === '
|
|
8
|
+
if (name === 'parcel' && typeof version === 'string' && semver.satisfies(version, COMPATIBLE_ATLASPACK_BABEL_TRANSFORMER_SEMVER)) {
|
|
9
9
|
let targets = api.caller(caller => caller && caller.targets);
|
|
10
10
|
if (typeof targets !== 'string') {
|
|
11
11
|
throw new Error('Expected targets to be a string');
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaspack/babel-preset-env",
|
|
3
|
-
"version": "2.12.1-dev.
|
|
3
|
+
"version": "2.12.1-dev.3401+b483af77f",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -23,5 +23,5 @@
|
|
|
23
23
|
"peerDependencies": {
|
|
24
24
|
"@babel/core": "^7.22.11"
|
|
25
25
|
},
|
|
26
|
-
"gitHead": "
|
|
26
|
+
"gitHead": "b483af77f02d1258c8dad156e097b94f83671d8e"
|
|
27
27
|
}
|
package/src/index.js
CHANGED
|
@@ -2,12 +2,12 @@ const semver = require('semver');
|
|
|
2
2
|
|
|
3
3
|
const COMPATIBLE_ATLASPACK_BABEL_TRANSFORMER_SEMVER = '^2.0.0-beta.1';
|
|
4
4
|
|
|
5
|
-
module.exports = function
|
|
5
|
+
module.exports = function parcelBabelPresetEnv(api, opts) {
|
|
6
6
|
let name = api.caller(caller => caller && caller.name);
|
|
7
7
|
let version = api.caller(caller => caller && caller.version);
|
|
8
8
|
|
|
9
9
|
if (
|
|
10
|
-
name === '
|
|
10
|
+
name === 'parcel' &&
|
|
11
11
|
typeof version === 'string' &&
|
|
12
12
|
semver.satisfies(version, COMPATIBLE_ATLASPACK_BABEL_TRANSFORMER_SEMVER)
|
|
13
13
|
) {
|
package/test/preset-env.test.js
CHANGED
|
@@ -22,12 +22,12 @@ export default class Foo {
|
|
|
22
22
|
const preset = require.resolve('../src');
|
|
23
23
|
|
|
24
24
|
describe('@atlaspack/babel-preset-env', () => {
|
|
25
|
-
it('compiles against targets passed through caller when the caller is
|
|
25
|
+
it('compiles against targets passed through caller when the caller is parcel 2.x', () => {
|
|
26
26
|
let {code: transformed} = babel.transformSync(input, {
|
|
27
27
|
configFile: false,
|
|
28
28
|
presets: [preset],
|
|
29
29
|
caller: {
|
|
30
|
-
name: '
|
|
30
|
+
name: 'parcel',
|
|
31
31
|
version: '2.0.0',
|
|
32
32
|
targets: JSON.stringify({
|
|
33
33
|
browsers: ['last 1 Chrome version'],
|
|
@@ -40,7 +40,7 @@ describe('@atlaspack/babel-preset-env', () => {
|
|
|
40
40
|
assert(transformed.includes('export default'));
|
|
41
41
|
});
|
|
42
42
|
|
|
43
|
-
it('does not compile against targets passed through caller when the caller is not
|
|
43
|
+
it('does not compile against targets passed through caller when the caller is not parcel', () => {
|
|
44
44
|
let {code: transformed} = babel.transformSync(input, {
|
|
45
45
|
configFile: false,
|
|
46
46
|
presets: [preset],
|