2 * @fileoverview Defines environment settings and globals.
7 //------------------------------------------------------------------------------
9 //------------------------------------------------------------------------------
11 const globals = require("globals");
13 //------------------------------------------------------------------------------
15 //------------------------------------------------------------------------------
18 * Get the object that has difference.
19 * @param {Record<string,boolean>} current The newer object.
20 * @param {Record<string,boolean>} prev The older object.
21 * @returns {Record<string,boolean>} The difference object.
23 function getDiff(current, prev) {
26 for (const [key, value] of Object.entries(current)) {
27 if (!Object.hasOwnProperty.call(prev, key)) {
35 const newGlobals2015 = getDiff(globals.es2015, globals.es5); // 19 variables such as Promise, Map, ...
36 const newGlobals2017 = {
38 SharedArrayBuffer: false
40 const newGlobals2020 = {
43 BigUint64Array: false,
47 const newGlobals2021 = {
48 AggregateError: false,
49 FinalizationRegistry: false,
53 //------------------------------------------------------------------------------
55 //------------------------------------------------------------------------------
57 /** @type {Map<string, import("../lib/shared/types").Environment>} */
58 module.exports = new Map(Object.entries({
65 globals: newGlobals2015,
71 globals: newGlobals2015,
77 globals: { ...newGlobals2015, ...newGlobals2017 },
83 globals: { ...newGlobals2015, ...newGlobals2017, ...newGlobals2020 },
89 globals: { ...newGlobals2015, ...newGlobals2017, ...newGlobals2020, ...newGlobals2021 },
97 globals: globals.browser
100 globals: globals.node,
107 "shared-node-browser": {
108 globals: globals["shared-node-browser"]
111 globals: globals.worker
114 globals: globals.serviceworker
119 globals: globals.commonjs,
130 globals: globals.mocha
133 globals: globals.jasmine
136 globals: globals.jest
139 globals: globals.phantomjs
142 globals: globals.jquery
145 globals: globals.qunit
148 globals: globals.prototypejs
151 globals: globals.shelljs
154 globals: globals.meteor
157 globals: globals.mongo
160 globals: globals.protractor
163 globals: globals.applescript
166 globals: globals.nashorn
169 globals: globals.atomtest
172 globals: globals.embertest
175 globals: globals.webextensions
178 globals: globals.greasemonkey