2 * @fileoverview Defines environment settings and globals.
7 //------------------------------------------------------------------------------
9 //------------------------------------------------------------------------------
11 const globals = require("globals");
13 //------------------------------------------------------------------------------
15 //------------------------------------------------------------------------------
18 * Get the object that has differentce.
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 = {
46 //------------------------------------------------------------------------------
48 //------------------------------------------------------------------------------
50 /** @type {Map<string, import("../lib/shared/types").Environment>} */
51 module.exports = new Map(Object.entries({
58 globals: newGlobals2015,
64 globals: newGlobals2015,
70 globals: { ...newGlobals2015, ...newGlobals2017 },
76 globals: { ...newGlobals2015, ...newGlobals2017, ...newGlobals2020 },
84 globals: globals.browser
87 globals: globals.node,
94 "shared-node-browser": {
95 globals: globals["shared-node-browser"]
98 globals: globals.worker
101 globals: globals.serviceworker
106 globals: globals.commonjs,
117 globals: globals.mocha
120 globals: globals.jasmine
123 globals: globals.jest
126 globals: globals.phantomjs
129 globals: globals.jquery
132 globals: globals.qunit
135 globals: globals.prototypejs
138 globals: globals.shelljs
141 globals: globals.meteor
144 globals: globals.mongo
147 globals: globals.protractor
150 globals: globals.applescript
153 globals: globals.nashorn
156 globals: globals.atomtest
159 globals: globals.embertest
162 globals: globals.webextensions
165 globals: globals.greasemonkey