babel-preset-evergreen 0.9.18 → 0.10.0

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.
Files changed (3) hide show
  1. package/README.md +20 -3
  2. package/index.cjs +17 -11
  3. package/package.json +3 -3
package/README.md CHANGED
@@ -33,7 +33,9 @@ npm install babel-preset-evergreen --save-dev
33
33
  [
34
34
  "evergreen",
35
35
  {
36
- "polyfill": "global"
36
+ "polyfill": {
37
+ "usage": "global"
38
+ }
37
39
  }
38
40
  ]
39
41
  ]
@@ -44,13 +46,28 @@ npm install babel-preset-evergreen --save-dev
44
46
 
45
47
  ### polyfill
46
48
 
47
- - type: [ false, 'global', 'pure' ]
49
+ - type: false | {}
48
50
  - default: false
49
51
 
50
- How `babel` handles polyfills. `pure` is an experimental option.
52
+ ### polyfill.usage
53
+
54
+ - type: ['global','pure']
55
+ - default: 'global'
56
+
57
+ How `babel` handles polyfills.
51
58
 
52
59
  References: <https://github.com/babel/babel/issues/10008>
53
60
 
61
+ ### polyfill.include
62
+
63
+ - type: string[]
64
+ - example: ['web.url']
65
+
66
+ ### polyfill.exclude
67
+
68
+ - type: string[]
69
+ - example: ['web.url']
70
+
54
71
  ## Tips
55
72
 
56
73
  You might need to pin `core-js@3` when your project dependency tree has `core-js@2`:
package/index.cjs CHANGED
@@ -20,21 +20,27 @@ module.exports = declare((api, options = {}) => {
20
20
  ],
21
21
  ];
22
22
 
23
+ if (!polyfill) {
24
+ return { presets };
25
+ }
26
+
27
+ const { usage = 'global', include, exclude } = polyfill;
28
+
23
29
  const pkg = require('./package.json');
24
30
 
25
31
  return {
26
32
  presets,
27
33
  plugins: [
28
- polyfill
29
- ? [
30
- 'babel-plugin-polyfill-corejs3',
31
- {
32
- version: pkg.dependencies['core-js'],
33
- proposals: true,
34
- method: `usage-${polyfill}`,
35
- },
36
- ]
37
- : undefined,
38
- ].filter(Boolean),
34
+ [
35
+ 'babel-plugin-polyfill-corejs3',
36
+ {
37
+ version: pkg.dependencies['core-js'],
38
+ proposals: true,
39
+ method: `usage-${usage}`,
40
+ include,
41
+ exclude,
42
+ },
43
+ ],
44
+ ],
39
45
  };
40
46
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "babel-preset-evergreen",
3
- "version": "0.9.18",
3
+ "version": "0.10.0",
4
4
  "description": "A `babel` preset for modern javascript syntaxes",
5
5
  "license": "MIT",
6
6
  "author": {
@@ -33,7 +33,7 @@
33
33
  "type": "commonjs",
34
34
  "dependencies": {
35
35
  "@babel/helper-plugin-utils": "^7.24.8",
36
- "@babel/preset-env": "^7.25.2",
36
+ "@babel/preset-env": "^7.25.3",
37
37
  "babel-plugin-polyfill-corejs3": "^0.10.4",
38
38
  "core-js": "^3.37.1"
39
39
  },
@@ -41,7 +41,7 @@
41
41
  "@babel/core": "^7.25.2",
42
42
  "@bring-it/npm": "^0.5.7",
43
43
  "@nice-move/cli": "^0.11.13",
44
- "@nice-move/eslint-config-base": "^0.11.11",
44
+ "@nice-move/eslint-config-base": "^0.11.12",
45
45
  "@nice-move/prettier-config": "^0.12.4",
46
46
  "ava": "^6.1.3",
47
47
  "eslint": "^8.57.0",