es-check 9.6.4 → 9.7.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.
@@ -1,63 +1,65 @@
1
1
  const fs = require("fs");
2
2
  const { loadConfig } = require("../config");
3
3
  const { runChecks } = require("../check-runner");
4
- const {
5
- createLogger,
6
- generateBashCompletion,
7
- generateZshCompletion,
8
- } = require("../helpers");
4
+ const { createLogger, generateBashCompletion, generateZshCompletion } = require("../helpers");
9
5
  const { JS_VERSIONS } = require("../constants/versions");
10
6
  const { SUPPORTED_SHELLS, COMPLETION_OPTIONS } = require("./constants");
11
7
 
8
+ function valueOrDefault(value, defaultValue) {
9
+ if (value !== undefined) return value;
10
+ return defaultValue;
11
+ }
12
+
13
+ function parseCommaList(value) {
14
+ return value
15
+ .split(",")
16
+ .map((item) => item.trim())
17
+ .filter(Boolean);
18
+ }
19
+
20
+ function parseOptionList(value, defaultValue) {
21
+ if (!value) return defaultValue;
22
+ return parseCommaList(value);
23
+ }
24
+
25
+ function resolveCacheOption(options, baseConfig) {
26
+ if (options.noCache) return false;
27
+ return valueOrDefault(baseConfig.cache, true);
28
+ }
29
+
12
30
  function buildConfig(ecmaVersionArg, filesArg, options, baseConfig) {
13
31
  const ignoreFilePath = options.ignoreFile || options["ignore-file"];
14
-
15
- const config = {
16
- ...baseConfig,
32
+ const ignore = valueOrDefault(options.ignore, baseConfig.ignore);
33
+ const ignoreFile = valueOrDefault(ignoreFilePath, baseConfig.ignoreFile);
34
+ const not = parseOptionList(options.not, baseConfig.not);
35
+ const allowList = valueOrDefault(options.allowList, baseConfig.allowList);
36
+ const browserslistQuery = valueOrDefault(options.browserslistQuery, baseConfig.browserslistQuery);
37
+ const browserslistPath = valueOrDefault(options.browserslistPath, baseConfig.browserslistPath);
38
+ const browserslistEnv = valueOrDefault(options.browserslistEnv, baseConfig.browserslistEnv);
39
+ const batchSize = valueOrDefault(options.batchSize, baseConfig.batchSize);
40
+ const cache = resolveCacheOption(options, baseConfig);
41
+ const light = valueOrDefault(options.light, baseConfig.light);
42
+
43
+ const config = Object.assign({}, baseConfig, {
17
44
  module: options.module,
18
45
  allowHashBang: options.allowHashBang || options["allow-hash-bang"],
19
46
  typescript: options.typescript || options.ts,
20
47
  checkFeatures: options.checkFeatures,
21
48
  checkForPolyfills: options.checkForPolyfills,
22
49
  ignorePolyfillable: options.ignorePolyfillable,
23
- ignore: options.ignore !== undefined ? options.ignore : baseConfig.ignore,
24
- ignoreFile:
25
- ignoreFilePath !== undefined ? ignoreFilePath : baseConfig.ignoreFile,
26
- not: options.not
27
- ? options.not
28
- .split(",")
29
- .map((n) => n.trim())
30
- .filter(Boolean)
31
- : baseConfig.not,
50
+ ignore,
51
+ ignoreFile,
52
+ not,
32
53
  looseGlobMatching: options.looseGlobMatching,
33
- allowList:
34
- options.allowList !== undefined
35
- ? options.allowList
36
- : baseConfig.allowList,
54
+ allowList,
37
55
  checkBrowser: options.checkBrowser,
38
- browserslistQuery:
39
- options.browserslistQuery !== undefined
40
- ? options.browserslistQuery
41
- : baseConfig.browserslistQuery,
42
- browserslistPath:
43
- options.browserslistPath !== undefined
44
- ? options.browserslistPath
45
- : baseConfig.browserslistPath,
46
- browserslistEnv:
47
- options.browserslistEnv !== undefined
48
- ? options.browserslistEnv
49
- : baseConfig.browserslistEnv,
50
- batchSize:
51
- options.batchSize !== undefined
52
- ? options.batchSize
53
- : baseConfig.batchSize,
54
- cache: options.noCache
55
- ? false
56
- : baseConfig.cache !== undefined
57
- ? baseConfig.cache
58
- : true,
59
- light: options.light !== undefined ? options.light : baseConfig.light,
60
- };
56
+ browserslistQuery,
57
+ browserslistPath,
58
+ browserslistEnv,
59
+ batchSize,
60
+ cache,
61
+ light,
62
+ });
61
63
 
62
64
  const hasEcmaVersion = ecmaVersionArg !== undefined;
63
65
  if (hasEcmaVersion) {
@@ -66,16 +68,14 @@ function buildConfig(ecmaVersionArg, filesArg, options, baseConfig) {
66
68
 
67
69
  const hasFilesArg = filesArg?.length > 0;
68
70
  const hasFilesOption = options.files !== undefined;
71
+ const shouldUseFilesOption = !hasFilesArg && hasFilesOption;
69
72
 
70
73
  if (hasFilesArg) {
71
74
  config.files = filesArg;
72
75
  }
73
76
 
74
- if (!hasFilesArg && hasFilesOption) {
75
- config.files = options.files
76
- .split(",")
77
- .map((f) => f.trim())
78
- .filter(Boolean);
77
+ if (shouldUseFilesOption) {
78
+ config.files = parseCommaList(options.files);
79
79
  }
80
80
 
81
81
  return config;
@@ -88,9 +88,7 @@ function warnAboutIgnoreFile(ignoreFilePath, logger) {
88
88
  const shouldWarn = hasIgnoreFile && !ignoreFileExists && isWarn;
89
89
 
90
90
  if (shouldWarn) {
91
- logger.warn(
92
- `Warning: Ignore file '${ignoreFilePath}' does not exist or is not accessible`,
93
- );
91
+ logger.warn(`Warning: Ignore file '${ignoreFilePath}' does not exist or is not accessible`);
94
92
  }
95
93
  }
96
94
 
@@ -99,51 +97,40 @@ async function handleMainCommand(ecmaVersionArg, filesArg, options) {
99
97
 
100
98
  const hasBothFilesInputs = filesArg?.length > 0 && options.files;
101
99
  if (hasBothFilesInputs) {
102
- logger.error(
103
- "Cannot pass in both [files...] argument and --files flag at the same time!",
104
- );
100
+ logger.error("Cannot pass in both [files...] argument and --files flag at the same time!");
105
101
  process.exit(1);
106
102
  }
107
103
 
108
104
  const validEcmaVersionValues = new Set(JS_VERSIONS);
109
105
  const isCheckBrowser = options.checkBrowser;
110
106
  const hasEcmaVersion = ecmaVersionArg !== undefined;
111
- const isInvalidEcmaVersion =
112
- hasEcmaVersion && !validEcmaVersionValues.has(ecmaVersionArg);
107
+ const isInvalidEcmaVersion = hasEcmaVersion && !validEcmaVersionValues.has(ecmaVersionArg);
113
108
  const shouldTreatAsFile = isCheckBrowser && isInvalidEcmaVersion;
114
109
 
115
110
  let adjustedEcmaVersion = ecmaVersionArg;
116
111
  let adjustedFiles = filesArg;
117
112
 
118
113
  if (shouldTreatAsFile) {
119
- adjustedFiles = [ecmaVersionArg, ...filesArg];
114
+ adjustedFiles = [ecmaVersionArg].concat(filesArg);
120
115
  adjustedEcmaVersion = "checkBrowser";
121
116
  }
122
117
 
123
118
  const configs = await loadConfig(options.config);
124
119
  const baseConfig = configs[0] || {};
125
120
 
126
- const hasCommandLineArgs =
127
- adjustedEcmaVersion || adjustedFiles?.length || options.files;
121
+ const hasCommandLineArgs = adjustedEcmaVersion || adjustedFiles?.length || options.files;
128
122
 
129
123
  if (hasCommandLineArgs) {
130
124
  const ignoreFilePath = options.ignoreFile || options["ignore-file"];
131
125
  warnAboutIgnoreFile(ignoreFilePath, logger);
132
126
 
133
- const singleConfig = buildConfig(
134
- adjustedEcmaVersion,
135
- adjustedFiles,
136
- options,
137
- baseConfig,
138
- );
127
+ const singleConfig = buildConfig(adjustedEcmaVersion, adjustedFiles, options, baseConfig);
139
128
  return runChecks([singleConfig], logger);
140
129
  }
141
130
 
142
131
  const hasNoConfigs = configs.length === 0;
143
132
  if (hasNoConfigs) {
144
- logger.error(
145
- "No configuration found. Please provide command line arguments or a config file.",
146
- );
133
+ logger.error("No configuration found. Please provide command line arguments or a config file.");
147
134
  process.exit(1);
148
135
  }
149
136
 
@@ -165,16 +152,19 @@ function handleCompletionCommand(shell) {
165
152
  const commands = ["completion"];
166
153
  const options = COMPLETION_OPTIONS;
167
154
 
155
+ const completionScript = getCompletionScript(shell, commands, options);
156
+
157
+ logger.info(completionScript);
158
+ }
159
+
160
+ function getCompletionScript(shell, commands, options) {
168
161
  const isBash = shell === "bash";
169
- const isZsh = shell === "zsh";
162
+ if (isBash) return generateBashCompletion("es-check", commands, options);
170
163
 
171
- const completionScript = isBash
172
- ? generateBashCompletion("es-check", commands, options)
173
- : isZsh
174
- ? generateZshCompletion("es-check", commands, options)
175
- : null;
164
+ const isZsh = shell === "zsh";
165
+ if (isZsh) return generateZshCompletion("es-check", commands, options);
176
166
 
177
- logger.info(completionScript);
167
+ return null;
178
168
  }
179
169
 
180
170
  module.exports = {
package/lib/cli/parser.js CHANGED
@@ -19,10 +19,17 @@ const BOOLEAN_FLAGS = new Set([
19
19
  "version",
20
20
  ]);
21
21
 
22
+ function createBooleanOptions(flags) {
23
+ return flags.split("").reduce((nextOptions, flag) => {
24
+ nextOptions[flag] = true;
25
+ return nextOptions;
26
+ }, {});
27
+ }
28
+
22
29
  function parseArgs(argv) {
23
30
  const args = argv.slice(2);
24
31
  const options = {};
25
- const positional = [];
32
+ let positional = [];
26
33
 
27
34
  let i = 0;
28
35
  const hasMoreArgs = () => i < args.length;
@@ -34,12 +41,13 @@ function parseArgs(argv) {
34
41
  const isShortOption = arg.startsWith("-") && !arg.startsWith("--");
35
42
 
36
43
  if (isLongOption) {
37
- const hasEquals = arg.includes("=");
44
+ const optionParts = arg.slice(2).split("=");
45
+ const hasEquals = optionParts.length > 1;
38
46
  if (hasEquals) {
39
- const [key, ...valueParts] = arg.slice(2).split("=");
47
+ const [key, ...valueParts] = optionParts;
40
48
  options[key] = valueParts.join("=");
41
49
  } else {
42
- const key = arg.slice(2);
50
+ const key = optionParts[0];
43
51
  const isBooleanFlag = BOOLEAN_FLAGS.has(key);
44
52
 
45
53
  if (isBooleanFlag) {
@@ -61,16 +69,12 @@ function parseArgs(argv) {
61
69
  const flags = arg.slice(1);
62
70
  const lastFlag = flags[flags.length - 1];
63
71
  const otherFlags = flags.slice(0, -1);
64
-
65
- for (const flag of otherFlags) {
66
- options[flag] = true;
67
- }
72
+ Object.assign(options, createBooleanOptions(otherFlags));
68
73
 
69
74
  const nextArg = args[i + 1];
70
75
  const hasNextArg = nextArg !== undefined;
71
76
  const isBooleanFlag = BOOLEAN_FLAGS.has(lastFlag);
72
- const nextIsValue =
73
- hasNextArg && !nextArg.startsWith("-") && !isBooleanFlag;
77
+ const nextIsValue = hasNextArg && !nextArg.startsWith("-") && !isBooleanFlag;
74
78
 
75
79
  if (nextIsValue) {
76
80
  options[lastFlag] = nextArg;
@@ -79,7 +83,7 @@ function parseArgs(argv) {
79
83
  options[lastFlag] = true;
80
84
  }
81
85
  } else {
82
- positional.push(arg);
86
+ positional = positional.concat(arg);
83
87
  }
84
88
 
85
89
  i++;
@@ -97,7 +101,7 @@ USAGE:
97
101
  es-check completion [shell]
98
102
 
99
103
  ARGUMENTS:
100
- ecmaVersion ES version to check (es3, es5, es6, es2015-es2025, or checkBrowser)
104
+ ecmaVersion ES version to check (es3, es5, es6, es2015-es2026, or checkBrowser)
101
105
  files Glob patterns of files to check
102
106
 
103
107
  OPTIONS:
package/lib/cli/utils.js CHANGED
@@ -1,5 +1,9 @@
1
1
  const fs = require("fs");
2
2
 
3
+ function appendError(allErrors, error) {
4
+ allErrors[allErrors.length] = error;
5
+ }
6
+
3
7
  function parseIgnoreList(options) {
4
8
  if (!options) {
5
9
  return new Set();
@@ -58,7 +62,8 @@ function parseIgnoreList(options) {
58
62
 
59
63
  if (Array.isArray(ignoreConfig.features)) {
60
64
  ignoreConfig.features.forEach((feature) => {
61
- if (feature && typeof feature === "string") {
65
+ const isStringFeature = feature && typeof feature === "string";
66
+ if (isStringFeature) {
62
67
  ignoreList.add(feature.trim());
63
68
  }
64
69
  });
@@ -74,7 +79,6 @@ function generateBashCompletion(cmdName, commands, options) {
74
79
  const cmdsStr = commands.join(" ");
75
80
  const optsStr = options.map((opt) => "--" + opt).join(" ");
76
81
 
77
- /* eslint-disable no-useless-escape */
78
82
  return `
79
83
  # es-check bash completion script
80
84
  # Install by adding to ~/.bashrc:
@@ -88,22 +92,22 @@ _${cmdName.replace(/-/g, "_")}_completion() {
88
92
 
89
93
  cmds="${cmdsStr}"
90
94
  opts="${optsStr}"
91
- es_versions="es3 es5 es6 es2015 es7 es2016 es8 es2017 es9 es2018 es10 es2019 es11 es2020 es12 es2021 es13 es2022 es14 es2023 es15 es2024 es16 es2025"
95
+ es_versions="es3 es5 es6 es2015 es7 es2016 es8 es2017 es9 es2018 es10 es2019 es11 es2020 es12 es2021 es13 es2022 es14 es2023 es15 es2024 es16 es2025 es17 es2026"
92
96
 
93
- case "\$prev" in
97
+ case "$prev" in
94
98
  ${cmdName})
95
- COMPREPLY=( \$(compgen -W "\$es_versions \$cmds \$opts" -- "\$cur") )
99
+ COMPREPLY=( $(compgen -W "$es_versions $cmds $opts" -- "$cur") )
96
100
  return 0
97
101
  ;;
98
102
  completion)
99
- COMPREPLY=( \$(compgen -W "bash zsh" -- "\$cur") )
103
+ COMPREPLY=( $(compgen -W "bash zsh" -- "$cur") )
100
104
  return 0
101
105
  ;;
102
106
  *)
103
- if [[ "\$cur" == -* ]]; then
104
- COMPREPLY=( \$(compgen -W "\$opts" -- "\$cur") )
107
+ if [[ "$cur" == -* ]]; then
108
+ COMPREPLY=( $(compgen -W "$opts" -- "$cur") )
105
109
  else
106
- COMPREPLY=( \$(compgen -f -- "\$cur") )
110
+ COMPREPLY=( $(compgen -f -- "$cur") )
107
111
  fi
108
112
  return 0
109
113
  ;;
@@ -112,16 +116,11 @@ _${cmdName.replace(/-/g, "_")}_completion() {
112
116
 
113
117
  complete -F _${cmdName.replace(/-/g, "_")}_completion ${cmdName}
114
118
  `;
115
- /* eslint-enable no-useless-escape */
116
119
  }
117
120
 
118
121
  function generateZshCompletion(cmdName, commands, options) {
119
- const optionsStr = options
120
- .map((opt) => `"--${opt}[Option description]"`)
121
- .join("\n ");
122
- const commandsStr = commands
123
- .map((cmd) => `"${cmd}:Command description"`)
124
- .join("\n ");
122
+ const optionsStr = options.map((opt) => `"--${opt}[Option description]"`).join("\n ");
123
+ const commandsStr = commands.map((cmd) => `"${cmd}:Command description"`).join("\n ");
125
124
 
126
125
  return `
127
126
  #compdef ${cmdName}
@@ -154,6 +153,8 @@ _${cmdName.replace(/-/g, "_")}() {
154
153
  "es2024:ECMAScript 2024"
155
154
  "es16:ECMAScript 2025"
156
155
  "es2025:ECMAScript 2025"
156
+ "es17:ECMAScript 2026"
157
+ "es2026:ECMAScript 2026"
157
158
  )
158
159
 
159
160
  commands=(
@@ -186,8 +187,9 @@ function determineInvocationType(loggerOrOptions) {
186
187
  }
187
188
 
188
189
  const hasLoggerMethods = loggerOrOptions.info || loggerOrOptions.error;
190
+ const isOptionsObject = typeof loggerOrOptions === "object" && !hasLoggerMethods;
189
191
 
190
- if (typeof loggerOrOptions === "object" && !hasLoggerMethods) {
192
+ if (isOptionsObject) {
191
193
  return { isNodeAPI: true, logger: loggerOrOptions.logger || null };
192
194
  }
193
195
 
@@ -195,13 +197,7 @@ function determineInvocationType(loggerOrOptions) {
195
197
  }
196
198
 
197
199
  function handleESVersionError(options) {
198
- const {
199
- errorMessage,
200
- logger,
201
- isNodeAPI,
202
- allErrors,
203
- file = "config",
204
- } = options;
200
+ const { errorMessage, logger, isNodeAPI, allErrors, file = "config" } = options;
205
201
 
206
202
  if (logger) {
207
203
  logger.error(errorMessage);
@@ -211,7 +207,7 @@ function handleESVersionError(options) {
211
207
  process.exit(1);
212
208
  return { shouldContinue: false, hasErrors: true };
213
209
  } else {
214
- allErrors.push({
210
+ appendError(allErrors, {
215
211
  err: new Error(errorMessage),
216
212
  file,
217
213
  });
@@ -19,7 +19,7 @@ const ES15_FEATURES = {
19
19
  minVersion: 15,
20
20
  example: "/pattern/v",
21
21
  astInfo: {
22
- nodeType: "RegExpLiteral",
22
+ nodeType: "Literal",
23
23
  flags: "v",
24
24
  },
25
25
  },
@@ -59,6 +59,22 @@ const ES15_FEATURES = {
59
59
  property: "waitAsync",
60
60
  },
61
61
  },
62
+ ArrayBufferTransfer: {
63
+ minVersion: 15,
64
+ example: "buffer.transfer(newByteLength)",
65
+ astInfo: {
66
+ nodeType: "CallExpression",
67
+ property: "transfer",
68
+ },
69
+ },
70
+ ArrayBufferTransferToFixedLength: {
71
+ minVersion: 15,
72
+ example: "buffer.transferToFixedLength(newByteLength)",
73
+ astInfo: {
74
+ nodeType: "CallExpression",
75
+ property: "transferToFixedLength",
76
+ },
77
+ },
62
78
  };
63
79
 
64
80
  module.exports = { ES15_FEATURES };
@@ -29,6 +29,15 @@ const ES16_FEATURES = {
29
29
  property: "try",
30
30
  },
31
31
  },
32
+ IntlDurationFormat: {
33
+ minVersion: 16,
34
+ example: "new Intl.DurationFormat('en')",
35
+ astInfo: {
36
+ nodeType: "NewExpression",
37
+ object: "Intl",
38
+ property: "DurationFormat",
39
+ },
40
+ },
32
41
  DuplicateNamedCaptureGroups: {
33
42
  minVersion: 16,
34
43
  example: "/(?<name>a)|(?<name>b)/",
@@ -117,6 +126,31 @@ const ES16_FEATURES = {
117
126
  property: "escape",
118
127
  },
119
128
  },
129
+ MathF16Round: {
130
+ minVersion: 16,
131
+ example: "Math.f16round(value)",
132
+ astInfo: {
133
+ nodeType: "CallExpression",
134
+ object: "Math",
135
+ property: "f16round",
136
+ },
137
+ },
138
+ DataViewGetFloat16: {
139
+ minVersion: 16,
140
+ example: "view.getFloat16(byteOffset)",
141
+ astInfo: {
142
+ nodeType: "CallExpression",
143
+ property: "getFloat16",
144
+ },
145
+ },
146
+ DataViewSetFloat16: {
147
+ minVersion: 16,
148
+ example: "view.setFloat16(byteOffset, value)",
149
+ astInfo: {
150
+ nodeType: "CallExpression",
151
+ property: "setFloat16",
152
+ },
153
+ },
120
154
  };
121
155
 
122
156
  module.exports = { ES16_FEATURES };
@@ -17,29 +17,108 @@ const ES17_FEATURES = {
17
17
  property: "isError",
18
18
  },
19
19
  },
20
- ArrayBufferTransfer: {
20
+ MapGetOrInsert: {
21
21
  minVersion: 17,
22
- example: "buffer.transfer(newByteLength)",
22
+ example: "map.getOrInsert(key, value)",
23
23
  astInfo: {
24
24
  nodeType: "CallExpression",
25
- property: "transfer",
25
+ property: "getOrInsert",
26
+ requireMapReceiver: true,
26
27
  },
27
28
  },
28
- ArrayBufferTransferToFixedLength: {
29
+ MapGetOrInsertComputed: {
29
30
  minVersion: 17,
30
- example: "buffer.transferToFixedLength(newByteLength)",
31
+ example: "map.getOrInsertComputed(key, fn)",
31
32
  astInfo: {
32
33
  nodeType: "CallExpression",
33
- property: "transferToFixedLength",
34
+ property: "getOrInsertComputed",
35
+ requireMapReceiver: true,
34
36
  },
35
37
  },
36
- IntlDurationFormat: {
38
+ IteratorConcat: {
37
39
  minVersion: 17,
38
- example: "new Intl.DurationFormat('en')",
40
+ example: "Iterator.concat(first, second)",
39
41
  astInfo: {
40
- nodeType: "NewExpression",
41
- object: "Intl",
42
- property: "DurationFormat",
42
+ nodeType: "CallExpression",
43
+ object: "Iterator",
44
+ property: "concat",
45
+ },
46
+ },
47
+ JSONRawJSON: {
48
+ minVersion: 17,
49
+ example: "JSON.rawJSON(text)",
50
+ astInfo: {
51
+ nodeType: "CallExpression",
52
+ object: "JSON",
53
+ property: "rawJSON",
54
+ },
55
+ },
56
+ JSONIsRawJSON: {
57
+ minVersion: 17,
58
+ example: "JSON.isRawJSON(value)",
59
+ astInfo: {
60
+ nodeType: "CallExpression",
61
+ object: "JSON",
62
+ property: "isRawJSON",
63
+ },
64
+ },
65
+ MathSumPrecise: {
66
+ minVersion: 17,
67
+ example: "Math.sumPrecise(values)",
68
+ astInfo: {
69
+ nodeType: "CallExpression",
70
+ object: "Math",
71
+ property: "sumPrecise",
72
+ },
73
+ },
74
+ Uint8ArrayFromBase64: {
75
+ minVersion: 17,
76
+ example: "Uint8Array.fromBase64(text)",
77
+ astInfo: {
78
+ nodeType: "CallExpression",
79
+ object: "Uint8Array",
80
+ property: "fromBase64",
81
+ },
82
+ },
83
+ Uint8ArrayFromHex: {
84
+ minVersion: 17,
85
+ example: "Uint8Array.fromHex(text)",
86
+ astInfo: {
87
+ nodeType: "CallExpression",
88
+ object: "Uint8Array",
89
+ property: "fromHex",
90
+ },
91
+ },
92
+ Uint8ArrayToBase64: {
93
+ minVersion: 17,
94
+ example: "bytes.toBase64()",
95
+ astInfo: {
96
+ nodeType: "CallExpression",
97
+ property: "toBase64",
98
+ },
99
+ },
100
+ Uint8ArrayToHex: {
101
+ minVersion: 17,
102
+ example: "bytes.toHex()",
103
+ astInfo: {
104
+ nodeType: "CallExpression",
105
+ property: "toHex",
106
+ },
107
+ },
108
+ Uint8ArraySetFromBase64: {
109
+ minVersion: 17,
110
+ example: "bytes.setFromBase64(text)",
111
+ astInfo: {
112
+ nodeType: "CallExpression",
113
+ property: "setFromBase64",
114
+ },
115
+ },
116
+ Uint8ArraySetFromHex: {
117
+ minVersion: 17,
118
+ example: "bytes.setFromHex(text)",
119
+ astInfo: {
120
+ nodeType: "CallExpression",
121
+ property: "setFromHex",
43
122
  },
44
123
  },
45
124
  };
@@ -11,7 +11,8 @@ const ES9_FEATURES = {
11
11
  minVersion: 9,
12
12
  example: "for await (const x of asyncIterable) {}",
13
13
  astInfo: {
14
- nodeType: "ForAwaitStatement",
14
+ nodeType: "ForOfStatement",
15
+ await: true,
15
16
  },
16
17
  },
17
18
  PromiseFinally: {
@@ -0,0 +1,71 @@
1
+ const ES_GLOBAL_MIN_VERSION = {
2
+ AggregateError: 12,
3
+ Array: 5,
4
+ ArrayBuffer: 6,
5
+ Atomics: 8,
6
+ BigInt: 11,
7
+ BigInt64Array: 11,
8
+ BigUint64Array: 11,
9
+ Boolean: 5,
10
+ DataView: 6,
11
+ Date: 5,
12
+ Error: 5,
13
+ EvalError: 5,
14
+ FinalizationRegistry: 12,
15
+ Float16Array: 16,
16
+ Float32Array: 6,
17
+ Float64Array: 6,
18
+ Function: 5,
19
+ Infinity: 5,
20
+ Int16Array: 6,
21
+ Int32Array: 6,
22
+ Int8Array: 6,
23
+ Intl: 6,
24
+ Iterator: 16,
25
+ JSON: 5,
26
+ Map: 6,
27
+ Math: 5,
28
+ NaN: 5,
29
+ Number: 5,
30
+ Object: 5,
31
+ Promise: 6,
32
+ Proxy: 6,
33
+ RangeError: 5,
34
+ ReferenceError: 5,
35
+ Reflect: 6,
36
+ RegExp: 5,
37
+ Set: 6,
38
+ SharedArrayBuffer: 8,
39
+ String: 5,
40
+ Symbol: 6,
41
+ SyntaxError: 5,
42
+ TypeError: 5,
43
+ URIError: 5,
44
+ Uint16Array: 6,
45
+ Uint32Array: 6,
46
+ Uint8Array: 6,
47
+ Uint8ClampedArray: 6,
48
+ WeakMap: 6,
49
+ WeakRef: 12,
50
+ WeakSet: 6,
51
+ decodeURI: 5,
52
+ decodeURIComponent: 5,
53
+ encodeURI: 5,
54
+ encodeURIComponent: 5,
55
+ escape: 5,
56
+ eval: 5,
57
+ globalThis: 11,
58
+ isFinite: 5,
59
+ isNaN: 5,
60
+ parseFloat: 5,
61
+ parseInt: 5,
62
+ undefined: 5,
63
+ unescape: 5,
64
+ };
65
+
66
+ const ES_GLOBALS_SOURCE = "https://github.com/sindresorhus/globals/blob/main/globals.json";
67
+
68
+ module.exports = {
69
+ ES_GLOBAL_MIN_VERSION,
70
+ ES_GLOBALS_SOURCE,
71
+ };