es-check 9.6.0 → 9.6.2
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/constants/es-features/13.js +1 -0
- package/lib/constants/polyfillableFeatures.js +53 -117
- package/lib/helpers/ast.js +116 -1
- package/package.json +24 -5
|
@@ -1,132 +1,68 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
"
|
|
13
|
-
"
|
|
14
|
-
"Array.prototype.flat",
|
|
15
|
-
"ArrayToSorted",
|
|
16
|
-
"ArrayToReversed",
|
|
17
|
-
"ArrayWith",
|
|
1
|
+
/**
|
|
2
|
+
* Generated by scripts/generate/polyfills/core.mjs — do not edit manually.
|
|
3
|
+
*
|
|
4
|
+
* These values use es-check's internal feature names (e.g. "ArrayToSorted"),
|
|
5
|
+
* not core-js module names (e.g. "es.array.to-sorted"). Core-js module names
|
|
6
|
+
* cannot be used directly because es-check matches features against its own
|
|
7
|
+
* ES_FEATURES keys, which follow PascalCase naming derived from acorn AST
|
|
8
|
+
* detection. The generation script bridges the two naming schemes by converting
|
|
9
|
+
* core-js modules to es-check feature names and intersecting with ES_FEATURES.
|
|
10
|
+
*/
|
|
11
|
+
const coreJsPolyfillable = new Set([
|
|
12
|
+
"ArrayBufferTransfer",
|
|
13
|
+
"ArrayBufferTransferToFixedLength",
|
|
18
14
|
"ArrayFindLast",
|
|
19
15
|
"ArrayFindLastIndex",
|
|
20
|
-
"
|
|
21
|
-
"
|
|
22
|
-
"
|
|
23
|
-
"
|
|
24
|
-
"
|
|
25
|
-
"String.prototype.padStart",
|
|
26
|
-
"String.prototype.padEnd",
|
|
27
|
-
"String.prototype.trimStart",
|
|
28
|
-
"String.prototype.trimEnd",
|
|
29
|
-
"String.prototype.replaceAll",
|
|
30
|
-
"String.prototype.matchAll",
|
|
31
|
-
"String.prototype.at",
|
|
32
|
-
"StringReplaceAll",
|
|
33
|
-
"StringMatchAll",
|
|
34
|
-
"StringAt",
|
|
35
|
-
"Object.assign",
|
|
36
|
-
"Object.keys",
|
|
37
|
-
"Object.values",
|
|
38
|
-
"Object.entries",
|
|
39
|
-
"Object.fromEntries",
|
|
40
|
-
"Object.hasOwn",
|
|
41
|
-
"ObjectHasOwn",
|
|
42
|
-
"Promise.resolve",
|
|
43
|
-
"Promise.reject",
|
|
44
|
-
"Promise.all",
|
|
45
|
-
"Promise.race",
|
|
46
|
-
"Promise.allSettled",
|
|
47
|
-
"Promise.any",
|
|
48
|
-
"PromiseAny",
|
|
49
|
-
"PromiseAllSettled",
|
|
50
|
-
"Map",
|
|
51
|
-
"Set",
|
|
52
|
-
"WeakMap",
|
|
53
|
-
"WeakSet",
|
|
54
|
-
"Symbol",
|
|
55
|
-
"Symbol.iterator",
|
|
56
|
-
"Symbol.asyncIterator",
|
|
57
|
-
"globalThis",
|
|
58
|
-
"GlobalThis",
|
|
59
|
-
"Number.isNaN",
|
|
60
|
-
"Number.isFinite",
|
|
61
|
-
"Number.isInteger",
|
|
62
|
-
"Number.isSafeInteger",
|
|
63
|
-
"Number.parseFloat",
|
|
64
|
-
"Number.parseInt",
|
|
65
|
-
"Math.trunc",
|
|
66
|
-
"Math.sign",
|
|
67
|
-
"Math.cbrt",
|
|
68
|
-
"Math.hypot",
|
|
69
|
-
"RegExp.prototype.flags",
|
|
70
|
-
]);
|
|
71
|
-
|
|
72
|
-
const CORE_JS_POLYFILLABLE = new Set([
|
|
73
|
-
"Array.from",
|
|
74
|
-
"Array.of",
|
|
75
|
-
"Array.prototype.find",
|
|
76
|
-
"Array.prototype.findIndex",
|
|
77
|
-
"Array.prototype.includes",
|
|
78
|
-
"Array.prototype.at",
|
|
79
|
-
"Array.prototype.findLast",
|
|
80
|
-
"Array.prototype.findLastIndex",
|
|
81
|
-
"Array.prototype.toSorted",
|
|
82
|
-
"Array.prototype.toReversed",
|
|
83
|
-
"Array.prototype.with",
|
|
84
|
-
"ArrayToSorted",
|
|
16
|
+
"ArrayFlat",
|
|
17
|
+
"ArrayFlatMap",
|
|
18
|
+
"ArrayFromAsync",
|
|
19
|
+
"ArrayPrototypeAt",
|
|
20
|
+
"ArrayPrototypeIncludes",
|
|
85
21
|
"ArrayToReversed",
|
|
22
|
+
"ArrayToSorted",
|
|
23
|
+
"ArrayToSpliced",
|
|
86
24
|
"ArrayWith",
|
|
87
|
-
"
|
|
88
|
-
"
|
|
89
|
-
"
|
|
90
|
-
"
|
|
91
|
-
"
|
|
92
|
-
"
|
|
93
|
-
"
|
|
94
|
-
"String.prototype.padStart",
|
|
95
|
-
"String.prototype.padEnd",
|
|
96
|
-
"String.prototype.trimStart",
|
|
97
|
-
"String.prototype.trimEnd",
|
|
98
|
-
"String.prototype.replaceAll",
|
|
99
|
-
"String.prototype.matchAll",
|
|
100
|
-
"String.prototype.at",
|
|
101
|
-
"StringReplaceAll",
|
|
102
|
-
"StringMatchAll",
|
|
103
|
-
"StringAt",
|
|
104
|
-
"Object.assign",
|
|
105
|
-
"Object.keys",
|
|
106
|
-
"Object.values",
|
|
107
|
-
"Object.entries",
|
|
108
|
-
"Object.fromEntries",
|
|
109
|
-
"Object.hasOwn",
|
|
25
|
+
"ErrorCause",
|
|
26
|
+
"ErrorIsError",
|
|
27
|
+
"Map",
|
|
28
|
+
"MapGroupBy",
|
|
29
|
+
"ObjectEntries",
|
|
30
|
+
"ObjectFromEntries",
|
|
31
|
+
"ObjectGroupBy",
|
|
110
32
|
"ObjectHasOwn",
|
|
111
|
-
"
|
|
112
|
-
"Promise
|
|
113
|
-
"Promise.all",
|
|
114
|
-
"Promise.race",
|
|
115
|
-
"Promise.allSettled",
|
|
116
|
-
"Promise.any",
|
|
117
|
-
"PromiseAny",
|
|
33
|
+
"ObjectValues",
|
|
34
|
+
"Promise",
|
|
118
35
|
"PromiseAllSettled",
|
|
119
|
-
"
|
|
36
|
+
"PromiseAny",
|
|
37
|
+
"PromiseFinally",
|
|
38
|
+
"PromiseReject",
|
|
39
|
+
"PromiseResolve",
|
|
40
|
+
"PromiseTry",
|
|
41
|
+
"PromiseWithResolvers",
|
|
42
|
+
"RegExpEscape",
|
|
120
43
|
"Set",
|
|
44
|
+
"SetDifference",
|
|
45
|
+
"SetIntersection",
|
|
46
|
+
"SetIsDisjointFrom",
|
|
47
|
+
"SetIsSubsetOf",
|
|
48
|
+
"SetIsSupersetOf",
|
|
49
|
+
"SetSymmetricDifference",
|
|
50
|
+
"SetUnion",
|
|
51
|
+
"StringIsWellFormed",
|
|
52
|
+
"StringMatchAll",
|
|
53
|
+
"StringPadEnd",
|
|
54
|
+
"StringPadStart",
|
|
55
|
+
"StringReplaceAll",
|
|
56
|
+
"StringToWellFormed",
|
|
57
|
+
"Symbol",
|
|
121
58
|
"WeakMap",
|
|
122
59
|
"WeakSet",
|
|
123
|
-
"Symbol",
|
|
124
|
-
"Symbol.iterator",
|
|
125
|
-
"Symbol.asyncIterator",
|
|
126
60
|
"globalThis",
|
|
127
|
-
"GlobalThis",
|
|
128
61
|
]);
|
|
129
62
|
|
|
63
|
+
const POLYFILLABLE_FEATURES = coreJsPolyfillable;
|
|
64
|
+
const CORE_JS_POLYFILLABLE = coreJsPolyfillable;
|
|
65
|
+
|
|
130
66
|
module.exports = {
|
|
131
67
|
POLYFILLABLE_FEATURES,
|
|
132
68
|
CORE_JS_POLYFILLABLE,
|
package/lib/helpers/ast.js
CHANGED
|
@@ -32,6 +32,117 @@ function hasNumericArgument(node) {
|
|
|
32
32
|
return isNumericLiteral || isNegativeNumeric;
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
+
const ARRAY_LIKE_NAMES = new Set([
|
|
36
|
+
"arr",
|
|
37
|
+
"array",
|
|
38
|
+
"list",
|
|
39
|
+
"items",
|
|
40
|
+
"values",
|
|
41
|
+
"arguments",
|
|
42
|
+
]);
|
|
43
|
+
|
|
44
|
+
const ARRAY_CONSTRUCTOR_FUNCTIONS = new Set([
|
|
45
|
+
"Array",
|
|
46
|
+
"from",
|
|
47
|
+
"of",
|
|
48
|
+
"slice",
|
|
49
|
+
"filter",
|
|
50
|
+
"map",
|
|
51
|
+
"concat",
|
|
52
|
+
]);
|
|
53
|
+
|
|
54
|
+
const ARRAY_METHODS = new Set([
|
|
55
|
+
"slice",
|
|
56
|
+
"filter",
|
|
57
|
+
"map",
|
|
58
|
+
"concat",
|
|
59
|
+
"from",
|
|
60
|
+
"of",
|
|
61
|
+
]);
|
|
62
|
+
|
|
63
|
+
const COMMON_NON_ARRAY_NAMES = new Set([
|
|
64
|
+
"obj",
|
|
65
|
+
"object",
|
|
66
|
+
"foo",
|
|
67
|
+
"bar",
|
|
68
|
+
"baz",
|
|
69
|
+
"data",
|
|
70
|
+
"config",
|
|
71
|
+
"options",
|
|
72
|
+
"params",
|
|
73
|
+
"props",
|
|
74
|
+
"state",
|
|
75
|
+
"item",
|
|
76
|
+
"element",
|
|
77
|
+
"node",
|
|
78
|
+
"target",
|
|
79
|
+
"source",
|
|
80
|
+
"result",
|
|
81
|
+
"response",
|
|
82
|
+
"request",
|
|
83
|
+
"payload",
|
|
84
|
+
"model",
|
|
85
|
+
"view",
|
|
86
|
+
"controller",
|
|
87
|
+
"service",
|
|
88
|
+
"utils",
|
|
89
|
+
"helpers",
|
|
90
|
+
"custom",
|
|
91
|
+
]);
|
|
92
|
+
function isArrayExpression(calleeObject) {
|
|
93
|
+
return calleeObject.type === "ArrayExpression";
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
function isArrayLikeIdentifier(calleeObject) {
|
|
97
|
+
const isIdentifier = calleeObject.type === "Identifier";
|
|
98
|
+
if (!isIdentifier) return false;
|
|
99
|
+
|
|
100
|
+
const objectName = calleeObject.name.toLowerCase();
|
|
101
|
+
|
|
102
|
+
const isCommonNonArrayName = COMMON_NON_ARRAY_NAMES.has(objectName);
|
|
103
|
+
if (isCommonNonArrayName) return false;
|
|
104
|
+
|
|
105
|
+
return ARRAY_LIKE_NAMES.has(objectName);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
function isArrayConstructorCall(calleeObject) {
|
|
109
|
+
const isCallExpression = calleeObject.type === "CallExpression";
|
|
110
|
+
if (!isCallExpression) return false;
|
|
111
|
+
|
|
112
|
+
const innerCallee = calleeObject.callee;
|
|
113
|
+
const isIdentifierCallee = innerCallee?.type === "Identifier";
|
|
114
|
+
const isMemberExpressionCallee = innerCallee?.type === "MemberExpression";
|
|
115
|
+
|
|
116
|
+
if (isIdentifierCallee) {
|
|
117
|
+
const functionName = innerCallee.name;
|
|
118
|
+
return ARRAY_CONSTRUCTOR_FUNCTIONS.has(functionName);
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
if (isMemberExpressionCallee) {
|
|
122
|
+
const innerProperty = innerCallee.property;
|
|
123
|
+
const hasPropertyName = innerProperty?.name;
|
|
124
|
+
const isArrayMethod = hasPropertyName && ARRAY_METHODS.has(innerProperty.name);
|
|
125
|
+
return isArrayMethod;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
return false;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
function isArrayLikeCall(node) {
|
|
132
|
+
const callee = node.callee;
|
|
133
|
+
const calleeObject = callee?.object;
|
|
134
|
+
const hasCalleeObject = calleeObject != null;
|
|
135
|
+
|
|
136
|
+
if (!hasCalleeObject) return false;
|
|
137
|
+
|
|
138
|
+
const isArrayExpr = isArrayExpression(calleeObject);
|
|
139
|
+
const isArrayIdent = isArrayLikeIdentifier(calleeObject);
|
|
140
|
+
const isArrayConstr = isArrayConstructorCall(calleeObject);
|
|
141
|
+
const isArray = isArrayExpr || isArrayIdent || isArrayConstr;
|
|
142
|
+
|
|
143
|
+
return isArray;
|
|
144
|
+
}
|
|
145
|
+
|
|
35
146
|
function checkMap(node, astInfo) {
|
|
36
147
|
const callee = node.callee;
|
|
37
148
|
const calleeObject = callee?.object;
|
|
@@ -82,6 +193,9 @@ function checkMap(node, astInfo) {
|
|
|
82
193
|
const hasNumericArgMismatch =
|
|
83
194
|
astInfo.requireNumericArg && !hasNumericArgument(node);
|
|
84
195
|
|
|
196
|
+
const hasArrayLikeCallMismatch =
|
|
197
|
+
astInfo.requireArrayLikeCall && !isArrayLikeCall(node);
|
|
198
|
+
|
|
85
199
|
const hasMismatch =
|
|
86
200
|
hasKindMismatch ||
|
|
87
201
|
hasOperatorMismatch ||
|
|
@@ -93,7 +207,8 @@ function checkMap(node, astInfo) {
|
|
|
93
207
|
hasObjectAndPropertyMismatch ||
|
|
94
208
|
hasOptionsCauseMismatch ||
|
|
95
209
|
hasExcludedCallerType ||
|
|
96
|
-
hasNumericArgMismatch
|
|
210
|
+
hasNumericArgMismatch ||
|
|
211
|
+
hasArrayLikeCallMismatch;
|
|
97
212
|
|
|
98
213
|
if (hasMismatch) return false;
|
|
99
214
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "es-check",
|
|
3
|
-
"version": "9.6.
|
|
3
|
+
"version": "9.6.2",
|
|
4
4
|
"description": "Checks the ECMAScript version of .js glob against a specified version of ECMAScript with a shell command",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"license": "MIT",
|
|
@@ -24,10 +24,13 @@
|
|
|
24
24
|
"format:check": "prettier --check .",
|
|
25
25
|
"pastoralist": "pastoralist",
|
|
26
26
|
"pre-commit": "pnpm lint && pnpm format && pnpm test",
|
|
27
|
-
"prepare": "node scripts/install
|
|
27
|
+
"prepare": "node scripts/install/hooks.mjs",
|
|
28
28
|
"prepublishOnly": "pnpm test",
|
|
29
29
|
"release": "release-it --no-git.requireUpstream",
|
|
30
30
|
"report:coverage": "mkdir -p coverage && node tests/scripts/test-runner.js unit --coverage --reporter=lcov",
|
|
31
|
+
"scripts:generate": "pnpm run scripts:generate:requirements && pnpm run scripts:generate:polyfills",
|
|
32
|
+
"scripts:generate:requirements": "node scripts/generate/requirements/parser.mjs",
|
|
33
|
+
"scripts:generate:polyfills": "node scripts/generate/polyfills/core.mjs",
|
|
31
34
|
"test": "node tests/scripts/test-runner.js unit && npm run test:e2e",
|
|
32
35
|
"test:unit": "node tests/scripts/test-runner.js unit",
|
|
33
36
|
"test:unit:verbose": "node tests/scripts/test-runner.js unit --verbose",
|
|
@@ -37,8 +40,7 @@
|
|
|
37
40
|
"test:e2e:esm": "node tests/e2e/test-esm-import.mjs",
|
|
38
41
|
"test:e2e:package-files": "node tests/e2e/test-package-files.mjs",
|
|
39
42
|
"test:e2e:sourcemap": "node --test tests/e2e/test-sourcemap.js --test-timeout=10000",
|
|
40
|
-
"
|
|
41
|
-
"update": "codependence --update && pastoralist && pnpm run generate-parser-requirements",
|
|
43
|
+
"update": "codependence --update && pastoralist && pnpm run scripts:generate",
|
|
42
44
|
"benchmark": "./tests/benchmarks/run-benchmarks.sh",
|
|
43
45
|
"site:dev": "pnpm --filter es-check-docs run dev",
|
|
44
46
|
"site:build": "pnpm --filter es-check-docs run build",
|
|
@@ -59,6 +61,7 @@
|
|
|
59
61
|
"@mdn/browser-compat-data": "^7.3.3",
|
|
60
62
|
"browserslist": "^4.28.1",
|
|
61
63
|
"codependence": "0.3.1",
|
|
64
|
+
"core-js-compat": "^3.48.0",
|
|
62
65
|
"oxlint": "^1.49.0",
|
|
63
66
|
"pastoralist": "1.10.0-1",
|
|
64
67
|
"prettier": "3.8.1",
|
|
@@ -208,6 +211,21 @@
|
|
|
208
211
|
"severity": "low",
|
|
209
212
|
"url": "https://github.com/yowainwright/es-check/security/dependabot/61"
|
|
210
213
|
}
|
|
214
|
+
},
|
|
215
|
+
"ajv@8.18.0": {
|
|
216
|
+
"dependents": {
|
|
217
|
+
"es-check": "ajv (transitive dependency)"
|
|
218
|
+
},
|
|
219
|
+
"ledger": {
|
|
220
|
+
"addedDate": "2026-02-21T09:31:35.017Z",
|
|
221
|
+
"reason": "Security fix: ajv has ReDoS when using `$data` option (medium)",
|
|
222
|
+
"securityChecked": true,
|
|
223
|
+
"securityCheckDate": "2026-02-21T09:31:35.017Z",
|
|
224
|
+
"securityProvider": "github",
|
|
225
|
+
"cve": "CVE-2025-69873",
|
|
226
|
+
"severity": "medium",
|
|
227
|
+
"url": "https://github.com/yowainwright/es-check/security/dependabot/67"
|
|
228
|
+
}
|
|
211
229
|
}
|
|
212
230
|
},
|
|
213
231
|
"depPaths": [
|
|
@@ -231,7 +249,8 @@
|
|
|
231
249
|
"undici": "6.23.0",
|
|
232
250
|
"devalue": "5.6.3",
|
|
233
251
|
"lodash": "4.17.23",
|
|
234
|
-
"diff": "5.2.2"
|
|
252
|
+
"diff": "5.2.2",
|
|
253
|
+
"ajv": "8.18.0"
|
|
235
254
|
},
|
|
236
255
|
"workspaces": [
|
|
237
256
|
"site"
|