Software zum Installieren eines Smart-Mirror Frameworks , zum Nutzen von hochschulrelevanten Informationen, auf einem Raspberry-Pi.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

environments.js 4.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180
  1. /**
  2. * @fileoverview Defines environment settings and globals.
  3. * @author Elan Shanker
  4. */
  5. "use strict";
  6. //------------------------------------------------------------------------------
  7. // Requirements
  8. //------------------------------------------------------------------------------
  9. const globals = require("globals");
  10. //------------------------------------------------------------------------------
  11. // Helpers
  12. //------------------------------------------------------------------------------
  13. /**
  14. * Get the object that has difference.
  15. * @param {Record<string,boolean>} current The newer object.
  16. * @param {Record<string,boolean>} prev The older object.
  17. * @returns {Record<string,boolean>} The difference object.
  18. */
  19. function getDiff(current, prev) {
  20. const retv = {};
  21. for (const [key, value] of Object.entries(current)) {
  22. if (!Object.hasOwnProperty.call(prev, key)) {
  23. retv[key] = value;
  24. }
  25. }
  26. return retv;
  27. }
  28. const newGlobals2015 = getDiff(globals.es2015, globals.es5); // 19 variables such as Promise, Map, ...
  29. const newGlobals2017 = {
  30. Atomics: false,
  31. SharedArrayBuffer: false
  32. };
  33. const newGlobals2020 = {
  34. BigInt: false,
  35. BigInt64Array: false,
  36. BigUint64Array: false,
  37. globalThis: false
  38. };
  39. const newGlobals2021 = {
  40. AggregateError: false,
  41. FinalizationRegistry: false,
  42. WeakRef: false
  43. };
  44. //------------------------------------------------------------------------------
  45. // Public Interface
  46. //------------------------------------------------------------------------------
  47. /** @type {Map<string, import("../lib/shared/types").Environment>} */
  48. module.exports = new Map(Object.entries({
  49. // Language
  50. builtin: {
  51. globals: globals.es5
  52. },
  53. es6: {
  54. globals: newGlobals2015,
  55. parserOptions: {
  56. ecmaVersion: 6
  57. }
  58. },
  59. es2015: {
  60. globals: newGlobals2015,
  61. parserOptions: {
  62. ecmaVersion: 6
  63. }
  64. },
  65. es2017: {
  66. globals: { ...newGlobals2015, ...newGlobals2017 },
  67. parserOptions: {
  68. ecmaVersion: 8
  69. }
  70. },
  71. es2020: {
  72. globals: { ...newGlobals2015, ...newGlobals2017, ...newGlobals2020 },
  73. parserOptions: {
  74. ecmaVersion: 11
  75. }
  76. },
  77. es2021: {
  78. globals: { ...newGlobals2015, ...newGlobals2017, ...newGlobals2020, ...newGlobals2021 },
  79. parserOptions: {
  80. ecmaVersion: 12
  81. }
  82. },
  83. // Platforms
  84. browser: {
  85. globals: globals.browser
  86. },
  87. node: {
  88. globals: globals.node,
  89. parserOptions: {
  90. ecmaFeatures: {
  91. globalReturn: true
  92. }
  93. }
  94. },
  95. "shared-node-browser": {
  96. globals: globals["shared-node-browser"]
  97. },
  98. worker: {
  99. globals: globals.worker
  100. },
  101. serviceworker: {
  102. globals: globals.serviceworker
  103. },
  104. // Frameworks
  105. commonjs: {
  106. globals: globals.commonjs,
  107. parserOptions: {
  108. ecmaFeatures: {
  109. globalReturn: true
  110. }
  111. }
  112. },
  113. amd: {
  114. globals: globals.amd
  115. },
  116. mocha: {
  117. globals: globals.mocha
  118. },
  119. jasmine: {
  120. globals: globals.jasmine
  121. },
  122. jest: {
  123. globals: globals.jest
  124. },
  125. phantomjs: {
  126. globals: globals.phantomjs
  127. },
  128. jquery: {
  129. globals: globals.jquery
  130. },
  131. qunit: {
  132. globals: globals.qunit
  133. },
  134. prototypejs: {
  135. globals: globals.prototypejs
  136. },
  137. shelljs: {
  138. globals: globals.shelljs
  139. },
  140. meteor: {
  141. globals: globals.meteor
  142. },
  143. mongo: {
  144. globals: globals.mongo
  145. },
  146. protractor: {
  147. globals: globals.protractor
  148. },
  149. applescript: {
  150. globals: globals.applescript
  151. },
  152. nashorn: {
  153. globals: globals.nashorn
  154. },
  155. atomtest: {
  156. globals: globals.atomtest
  157. },
  158. embertest: {
  159. globals: globals.embertest
  160. },
  161. webextensions: {
  162. globals: globals.webextensions
  163. },
  164. greasemonkey: {
  165. globals: globals.greasemonkey
  166. }
  167. }));