@parcel/babel-preset-env 2.0.0-nightly.133 → 2.0.0-nightly.1332
Sign up to get free protection for your applications and to get access to all the features.
- package/lib/index.js +13 -17
- package/package.json +12 -5
- package/src/index.js +14 -2
- package/test/preset-env.test.js +1 -1
package/lib/index.js
CHANGED
@@ -1,35 +1,31 @@
|
|
1
1
|
"use strict";
|
2
2
|
|
3
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
|
4
|
-
|
5
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
6
|
-
|
7
|
-
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
8
|
-
|
9
3
|
const semver = require('semver');
|
10
|
-
|
11
|
-
const COMPATIBLE_PARCEL_BABEL_TRANSFORMER_SEMVER = '^2.0.0-alpha.1.1';
|
12
|
-
|
4
|
+
const COMPATIBLE_PARCEL_BABEL_TRANSFORMER_SEMVER = '^2.0.0-beta.1';
|
13
5
|
module.exports = function (api, opts) {
|
14
6
|
let name = api.caller(caller => caller && caller.name);
|
15
7
|
let version = api.caller(caller => caller && caller.version);
|
16
|
-
|
17
8
|
if (name === 'parcel' && typeof version === 'string' && semver.satisfies(version, COMPATIBLE_PARCEL_BABEL_TRANSFORMER_SEMVER)) {
|
18
9
|
let targets = api.caller(caller => caller && caller.targets);
|
19
|
-
|
20
10
|
if (typeof targets !== 'string') {
|
21
11
|
throw new Error('Expected targets to be a string');
|
22
12
|
}
|
23
|
-
|
24
13
|
return {
|
25
|
-
presets: [['@babel/preset-env',
|
14
|
+
presets: [['@babel/preset-env', {
|
26
15
|
modules: false,
|
27
|
-
|
28
|
-
|
16
|
+
ignoreBrowserslistConfig: true,
|
17
|
+
targets: JSON.parse(targets),
|
18
|
+
useBuiltIns: 'entry',
|
19
|
+
corejs: 3,
|
20
|
+
shippedProposals: true,
|
21
|
+
...opts
|
22
|
+
}]]
|
29
23
|
};
|
30
24
|
}
|
31
|
-
|
32
25
|
return {
|
33
|
-
presets: [['@babel/preset-env',
|
26
|
+
presets: [['@babel/preset-env', {
|
27
|
+
shippedProposals: true,
|
28
|
+
...opts
|
29
|
+
}]]
|
34
30
|
};
|
35
31
|
};
|
package/package.json
CHANGED
@@ -1,24 +1,31 @@
|
|
1
1
|
{
|
2
2
|
"name": "@parcel/babel-preset-env",
|
3
|
-
"version": "2.0.0-nightly.
|
3
|
+
"version": "2.0.0-nightly.1332+76e710092",
|
4
4
|
"license": "MIT",
|
5
5
|
"publishConfig": {
|
6
6
|
"access": "public"
|
7
7
|
},
|
8
|
+
"funding": {
|
9
|
+
"type": "opencollective",
|
10
|
+
"url": "https://opencollective.com/parcel"
|
11
|
+
},
|
8
12
|
"repository": {
|
9
13
|
"type": "git",
|
10
14
|
"url": "https://github.com/parcel-bundler/parcel.git"
|
11
15
|
},
|
12
16
|
"main": "src/index.js",
|
13
17
|
"engines": {
|
14
|
-
"node": ">=
|
18
|
+
"node": ">= 12.0.0"
|
15
19
|
},
|
16
20
|
"dependencies": {
|
17
21
|
"@babel/preset-env": "^7.4.0",
|
18
|
-
"semver": "^5.
|
22
|
+
"semver": "^5.7.1"
|
19
23
|
},
|
20
24
|
"devDependencies": {
|
21
|
-
"@babel/core": "^7.
|
25
|
+
"@babel/core": "^7.12.0"
|
26
|
+
},
|
27
|
+
"peerDependencies": {
|
28
|
+
"@babel/core": "^7.12.0"
|
22
29
|
},
|
23
|
-
"gitHead": "
|
30
|
+
"gitHead": "76e7100922bd0688c1ed3ce56f21c78d8eeb5d65"
|
24
31
|
}
|
package/src/index.js
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
const semver = require('semver');
|
2
2
|
|
3
|
-
const COMPATIBLE_PARCEL_BABEL_TRANSFORMER_SEMVER = '^2.0.0-
|
3
|
+
const COMPATIBLE_PARCEL_BABEL_TRANSFORMER_SEMVER = '^2.0.0-beta.1';
|
4
4
|
|
5
5
|
module.exports = function parcelBabelPresetEnv(api, opts) {
|
6
6
|
let name = api.caller(caller => caller && caller.name);
|
@@ -22,7 +22,11 @@ module.exports = function parcelBabelPresetEnv(api, opts) {
|
|
22
22
|
'@babel/preset-env',
|
23
23
|
{
|
24
24
|
modules: false,
|
25
|
+
ignoreBrowserslistConfig: true,
|
25
26
|
targets: JSON.parse(targets),
|
27
|
+
useBuiltIns: 'entry',
|
28
|
+
corejs: 3,
|
29
|
+
shippedProposals: true,
|
26
30
|
...opts,
|
27
31
|
},
|
28
32
|
],
|
@@ -31,6 +35,14 @@ module.exports = function parcelBabelPresetEnv(api, opts) {
|
|
31
35
|
}
|
32
36
|
|
33
37
|
return {
|
34
|
-
presets: [
|
38
|
+
presets: [
|
39
|
+
[
|
40
|
+
'@babel/preset-env',
|
41
|
+
{
|
42
|
+
shippedProposals: true,
|
43
|
+
...opts,
|
44
|
+
},
|
45
|
+
],
|
46
|
+
],
|
35
47
|
};
|
36
48
|
};
|
package/test/preset-env.test.js
CHANGED
@@ -19,7 +19,7 @@ export default class Foo {
|
|
19
19
|
}
|
20
20
|
`;
|
21
21
|
|
22
|
-
const preset = require.resolve('../');
|
22
|
+
const preset = require.resolve('../src');
|
23
23
|
|
24
24
|
describe('@parcel/babel-preset-env', () => {
|
25
25
|
it('compiles against targets passed through caller when the caller is parcel 2.x', () => {
|