diff --git a/conf/environments.js b/conf/environments.js index 50d1b1d..2b11638 100644 --- a/conf/environments.js +++ b/conf/environments.js @@ -31,185 +31,114 @@ function getDiff(current, prev) { return retv; } -const newGlobals2015 = getDiff(globals.es2015, globals.es5); // 19 variables such as Promise, Map, ... -const newGlobals2017 = { - Atomics: false, - SharedArrayBuffer: false -}; -const newGlobals2020 = { - BigInt: false, - BigInt64Array: false, - BigUint64Array: false, - globalThis: false -}; - -const newGlobals2021 = { - AggregateError: false, - FinalizationRegistry: false, - WeakRef: false -}; +const newGlobals2015 = getDiff(globals.es2015, globals.es5); // 20 variables such as Promise, Map, ... //------------------------------------------------------------------------------ // Public Interface //------------------------------------------------------------------------------ /** @type {Map} */ -export default new Map(Object.entries({ +export default new Map([ // Language - builtin: { - globals: globals.es5 - }, - es6: { - globals: newGlobals2015, - parserOptions: { - ecmaVersion: 6 - } - }, - es2015: { - globals: newGlobals2015, - parserOptions: { - ecmaVersion: 6 - } - }, - es2016: { - globals: newGlobals2015, - parserOptions: { - ecmaVersion: 7 - } - }, - es2017: { - globals: { ...newGlobals2015, ...newGlobals2017 }, - parserOptions: { - ecmaVersion: 8 - } - }, - es2018: { - globals: { ...newGlobals2015, ...newGlobals2017 }, - parserOptions: { - ecmaVersion: 9 - } - }, - es2019: { - globals: { ...newGlobals2015, ...newGlobals2017 }, - parserOptions: { - ecmaVersion: 10 - } - }, - es2020: { - globals: { ...newGlobals2015, ...newGlobals2017, ...newGlobals2020 }, - parserOptions: { - ecmaVersion: 11 - } - }, - es2021: { - globals: { ...newGlobals2015, ...newGlobals2017, ...newGlobals2020, ...newGlobals2021 }, - parserOptions: { - ecmaVersion: 12 - } - }, - es2022: { - globals: { ...newGlobals2015, ...newGlobals2017, ...newGlobals2020, ...newGlobals2021 }, - parserOptions: { - ecmaVersion: 13 - } - }, - es2023: { - globals: { ...newGlobals2015, ...newGlobals2017, ...newGlobals2020, ...newGlobals2021 }, - parserOptions: { - ecmaVersion: 14 - } - }, - es2024: { - globals: { ...newGlobals2015, ...newGlobals2017, ...newGlobals2020, ...newGlobals2021 }, - parserOptions: { - ecmaVersion: 15 - } - }, + ["builtin", { globals: globals.es5 }], + ["es6", { globals: newGlobals2015, parserOptions: { ecmaVersion: 6 } }], + ...Array.from({ length: 2024 - 2015 + 1 }, (_, index) => { + const ecmaVersion = index + 6; + const environment = `es${2015 + index}`; - // Platforms - browser: { - globals: globals.browser - }, - node: { - globals: globals.node, - parserOptions: { - ecmaFeatures: { - globalReturn: true + return [environment, { + globals: getDiff(globals[environment], globals.es5), + parserOptions: { ecmaVersion } + }]; + }), + + ...Object.entries({ + + // Platforms + browser: { + globals: globals.browser + }, + node: { + globals: globals.node, + parserOptions: { + ecmaFeatures: { + globalReturn: true + } } - } - }, - "shared-node-browser": { - globals: globals["shared-node-browser"] - }, - worker: { - globals: globals.worker - }, - serviceworker: { - globals: globals.serviceworker - }, + }, + "shared-node-browser": { + globals: globals["shared-node-browser"] + }, + worker: { + globals: globals.worker + }, + serviceworker: { + globals: globals.serviceworker + }, - // Frameworks - commonjs: { - globals: globals.commonjs, - parserOptions: { - ecmaFeatures: { - globalReturn: true + // Frameworks + commonjs: { + globals: globals.commonjs, + parserOptions: { + ecmaFeatures: { + globalReturn: true + } } + }, + amd: { + globals: globals.amd + }, + mocha: { + globals: globals.mocha + }, + jasmine: { + globals: globals.jasmine + }, + jest: { + globals: globals.jest + }, + phantomjs: { + globals: globals.phantomjs + }, + jquery: { + globals: globals.jquery + }, + qunit: { + globals: globals.qunit + }, + prototypejs: { + globals: globals.prototypejs + }, + shelljs: { + globals: globals.shelljs + }, + meteor: { + globals: globals.meteor + }, + mongo: { + globals: globals.mongo + }, + protractor: { + globals: globals.protractor + }, + applescript: { + globals: globals.applescript + }, + nashorn: { + globals: globals.nashorn + }, + atomtest: { + globals: globals.atomtest + }, + embertest: { + globals: globals.embertest + }, + webextensions: { + globals: globals.webextensions + }, + greasemonkey: { + globals: globals.greasemonkey } - }, - amd: { - globals: globals.amd - }, - mocha: { - globals: globals.mocha - }, - jasmine: { - globals: globals.jasmine - }, - jest: { - globals: globals.jest - }, - phantomjs: { - globals: globals.phantomjs - }, - jquery: { - globals: globals.jquery - }, - qunit: { - globals: globals.qunit - }, - prototypejs: { - globals: globals.prototypejs - }, - shelljs: { - globals: globals.shelljs - }, - meteor: { - globals: globals.meteor - }, - mongo: { - globals: globals.mongo - }, - protractor: { - globals: globals.protractor - }, - applescript: { - globals: globals.applescript - }, - nashorn: { - globals: globals.nashorn - }, - atomtest: { - globals: globals.atomtest - }, - embertest: { - globals: globals.embertest - }, - webextensions: { - globals: globals.webextensions - }, - greasemonkey: { - globals: globals.greasemonkey - } -})); + }) +]); diff --git a/package.json b/package.json index fea77e2..ca1051c 100644 --- a/package.json +++ b/package.json @@ -69,7 +69,7 @@ "ajv": "^6.12.4", "debug": "^4.3.2", "espree": "^10.0.1", - "globals": "^14.0.0", + "globals": "^15.4.0", "ignore": "^5.2.0", "import-fresh": "^3.2.1", "js-yaml": "^4.1.0",