babel-preset-evergreen 0.10.1 → 0.10.3

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 (4) hide show
  1. package/README.md +6 -0
  2. package/index.cjs +4 -3
  3. package/mini.cjs +129 -0
  4. package/package.json +10 -7
package/README.md CHANGED
@@ -68,6 +68,12 @@ References: <https://github.com/babel/babel/issues/10008>
68
68
  - type: string[]
69
69
  - example: ['web.url']
70
70
 
71
+ ### polyfill.mini
72
+
73
+ - type: boolean
74
+ - default: false
75
+ - description: Use miniprogram presets.
76
+
71
77
  ## Tips
72
78
 
73
79
  You might need to pin `core-js@3` when your project dependency tree has `core-js@2`:
package/index.cjs CHANGED
@@ -1,6 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  const { declare } = require('@babel/helper-plugin-utils');
4
+ const { excludeIfMini } = require('./mini.cjs');
4
5
 
5
6
  module.exports = declare((api, options = {}) => {
6
7
  api.assertVersion(7);
@@ -24,7 +25,7 @@ module.exports = declare((api, options = {}) => {
24
25
  return { presets };
25
26
  }
26
27
 
27
- const { usage = 'global', include, exclude } = polyfill;
28
+ const { usage = 'global', include, exclude, mini = false } = polyfill;
28
29
 
29
30
  const pkg = require('./package.json');
30
31
 
@@ -37,8 +38,8 @@ module.exports = declare((api, options = {}) => {
37
38
  version: pkg.dependencies['core-js'],
38
39
  proposals: true,
39
40
  method: `usage-${usage}`,
40
- include,
41
- exclude,
41
+ include: mini ? [...include, 'web.url'] : include,
42
+ exclude: mini ? [...exclude, ...excludeIfMini] : exclude,
42
43
  },
43
44
  ],
44
45
  ],
package/mini.cjs ADDED
@@ -0,0 +1,129 @@
1
+ const modules = require('core-js-compat/modules.json');
2
+
3
+ const miniprogramCompat = [
4
+ 'es.aggregate-error',
5
+ 'es.aggregate-error.cause',
6
+ 'es.array-buffer.slice',
7
+ 'es.array.at',
8
+ 'es.array.find-last',
9
+ 'es.array.find-last-index',
10
+ 'es.array.push',
11
+ 'es.array.reverse',
12
+ 'es.array.unscopables.flat',
13
+ 'es.array.unscopables.flat-map',
14
+ 'es.array.unshift',
15
+ 'es.error.cause',
16
+ 'es.global-this',
17
+ 'es.json.stringify',
18
+ 'es.object.from-entries',
19
+ 'es.object.has-own',
20
+ 'es.promise',
21
+ 'es.promise.all-settled',
22
+ 'es.promise.any',
23
+ 'es.promise.finally',
24
+ 'es.reflect.to-string-tag',
25
+ 'es.regexp.flags',
26
+ 'es.string.at-alternative',
27
+ 'es.string.match-all',
28
+ 'es.string.replace',
29
+ 'es.string.replace-all',
30
+ 'es.string.trim',
31
+ 'es.string.trim-end',
32
+ 'es.symbol.description',
33
+ 'es.symbol.match-all',
34
+ 'es.typed-array.at',
35
+ 'es.typed-array.fill',
36
+ 'es.typed-array.find-last',
37
+ 'es.typed-array.find-last-index',
38
+ 'es.typed-array.float32-array',
39
+ 'es.typed-array.float64-array',
40
+ 'es.typed-array.from',
41
+ 'es.typed-array.int16-array',
42
+ 'es.typed-array.int32-array',
43
+ 'es.typed-array.int8-array',
44
+ 'es.typed-array.of',
45
+ 'es.typed-array.set',
46
+ 'es.typed-array.sort',
47
+ 'es.typed-array.uint16-array',
48
+ 'es.typed-array.uint32-array',
49
+ 'es.typed-array.uint8-array',
50
+ 'es.typed-array.uint8-clamped-array',
51
+ 'esnext.aggregate-error',
52
+ 'esnext.array.at',
53
+ 'esnext.array.find-last',
54
+ 'esnext.array.find-last-index',
55
+ 'esnext.array.from-async',
56
+ 'esnext.array.group',
57
+ 'esnext.array.group-by',
58
+ 'esnext.array.group-by-to-map',
59
+ 'esnext.array.group-to-map',
60
+ 'esnext.array.to-reversed',
61
+ 'esnext.array.to-sorted',
62
+ 'esnext.array.to-spliced',
63
+ 'esnext.array.with',
64
+ 'esnext.async-iterator.constructor',
65
+ 'esnext.async-iterator.drop',
66
+ 'esnext.async-iterator.every',
67
+ 'esnext.async-iterator.filter',
68
+ 'esnext.async-iterator.find',
69
+ 'esnext.async-iterator.flat-map',
70
+ 'esnext.async-iterator.for-each',
71
+ 'esnext.async-iterator.from',
72
+ 'esnext.async-iterator.map',
73
+ 'esnext.async-iterator.reduce',
74
+ 'esnext.async-iterator.some',
75
+ 'esnext.async-iterator.take',
76
+ 'esnext.async-iterator.to-array',
77
+ 'esnext.disposable-stack.constructor',
78
+ 'esnext.global-this',
79
+ 'esnext.iterator.constructor',
80
+ 'esnext.iterator.dispose',
81
+ 'esnext.iterator.drop',
82
+ 'esnext.iterator.every',
83
+ 'esnext.iterator.filter',
84
+ 'esnext.iterator.find',
85
+ 'esnext.iterator.flat-map',
86
+ 'esnext.iterator.for-each',
87
+ 'esnext.iterator.from',
88
+ 'esnext.iterator.map',
89
+ 'esnext.iterator.reduce',
90
+ 'esnext.iterator.some',
91
+ 'esnext.iterator.take',
92
+ 'esnext.iterator.to-array',
93
+ 'esnext.iterator.to-async',
94
+ 'esnext.object.has-own',
95
+ 'esnext.promise.all-settled',
96
+ 'esnext.promise.any',
97
+ 'esnext.set.difference.v2',
98
+ 'esnext.set.intersection.v2',
99
+ 'esnext.set.is-disjoint-from.v2',
100
+ 'esnext.set.is-subset-of.v2',
101
+ 'esnext.set.is-superset-of.v2',
102
+ 'esnext.set.symmetric-difference.v2',
103
+ 'esnext.set.union.v2',
104
+ 'esnext.string.is-well-formed',
105
+ 'esnext.string.match-all',
106
+ 'esnext.string.replace-all',
107
+ 'esnext.string.to-well-formed',
108
+ 'esnext.suppressed-error.constructor',
109
+ 'esnext.symbol.dispose',
110
+ 'esnext.typed-array.at',
111
+ 'esnext.typed-array.find-last',
112
+ 'esnext.typed-array.find-last-index',
113
+ 'esnext.typed-array.to-reversed',
114
+ 'esnext.typed-array.to-sorted',
115
+ 'esnext.typed-array.to-spliced',
116
+ 'esnext.typed-array.with',
117
+ ];
118
+
119
+ const mini = [
120
+ ...new Set(
121
+ miniprogramCompat.flatMap((item) => [
122
+ item,
123
+ item.replace('esnext.', 'es.'),
124
+ item.replace('es.', 'esnext.'),
125
+ ]),
126
+ ),
127
+ ].sort();
128
+
129
+ exports.excludeIfMini = mini.filter((item) => modules.includes(item));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "babel-preset-evergreen",
3
- "version": "0.10.1",
3
+ "version": "0.10.3",
4
4
  "description": "A `babel` preset for modern javascript syntaxes",
5
5
  "license": "MIT",
6
6
  "author": {
@@ -29,24 +29,27 @@
29
29
  "url": "https://github.com/best-shot/babel-preset-evergreen/issues"
30
30
  },
31
31
  "main": "index.cjs",
32
- "files": [],
32
+ "files": [
33
+ "mini.cjs"
34
+ ],
33
35
  "type": "commonjs",
34
36
  "dependencies": {
35
37
  "@babel/helper-plugin-utils": "^7.24.8",
36
- "@babel/preset-env": "^7.25.3",
38
+ "@babel/preset-env": "^7.25.4",
37
39
  "babel-plugin-polyfill-corejs3": "^0.10.6",
38
- "core-js": "^3.38.0"
40
+ "core-js": "^3.38.1",
41
+ "core-js-compat": "^3.38.1"
39
42
  },
40
43
  "devDependencies": {
41
44
  "@babel/core": "^7.25.2",
42
- "@bring-it/npm": "^0.5.7",
45
+ "@bring-it/npm": "^0.5.9",
43
46
  "@nice-move/cli": "^0.11.14",
44
- "@nice-move/eslint-config-base": "^0.11.13",
47
+ "@nice-move/eslint-config-base": "^0.11.18",
45
48
  "@nice-move/prettier-config": "^0.12.5",
46
49
  "ava": "^6.1.3",
47
50
  "eslint": "^8.57.0",
48
51
  "eslint-plugin-ava": "^14.0.0",
49
- "garou": "^0.7.6",
52
+ "garou": "^0.7.8",
50
53
  "prettier": "^3.3.3"
51
54
  },
52
55
  "peerDependencies": {