goog.js 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. // Copyright 2018 The Closure Library Authors. All Rights Reserved.
  2. //
  3. // Licensed under the Apache License, Version 2.0 (the "License");
  4. // you may not use this file except in compliance with the License.
  5. // You may obtain a copy of the License at
  6. //
  7. // http://www.apache.org/licenses/LICENSE-2.0
  8. //
  9. // Unless required by applicable law or agreed to in writing, software
  10. // distributed under the License is distributed on an "AS-IS" BASIS,
  11. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. // See the License for the specific language governing permissions and
  13. // limitations under the License.
  14. /**
  15. * @fileoverview ES6 module that exports symbols from base.js so that ES6
  16. * modules do not need to use globals and so that is clear if a project is using
  17. * Closure's base.js file. It is also a subset of properties in base.js, meaning
  18. * it should be clearer what should not be used in ES6 modules
  19. * (goog.module/provide are not exported here, for example). Though that is not
  20. * to say that everything in this file should be used in an ES6 module; some
  21. * depreciated functions are exported to make migration easier (e.g.
  22. * goog.scope).
  23. *
  24. * Note that this does not load Closure's base.js file, it is still up to the
  25. * programmer to include it. Nor does the fact that this is an ES6 module mean
  26. * that projects no longer require deps.js files for debug loading - they do.
  27. * Closure will need to load your ES6 modules for you if you have any Closure
  28. * file (goog.provide/goog.module) dependencies, as they need to be available
  29. * before the ES6 module evaluates.
  30. *
  31. * Also note that this file has special compiler handling! It is okay to export
  32. * anything from this file, but the name also needs to exist on the global goog.
  33. * This special compiler pass enforces that you always import this file as
  34. * `import * as goog`, as many tools use regex based parsing to find
  35. * goog.require calls.
  36. */
  37. export const global = goog.global;
  38. export const require = goog.require;
  39. export const define = goog.define;
  40. export const DEBUG = goog.DEBUG;
  41. export const LOCALE = goog.LOCALE;
  42. export const TRUSTED_SITE = goog.TRUSTED_SITE;
  43. export const DISALLOW_TEST_ONLY_CODE = goog.DISALLOW_TEST_ONLY_CODE;
  44. export const getGoogModule = goog.module.get;
  45. export const setTestOnly = goog.setTestOnly;
  46. export const forwardDeclare = goog.forwardDeclare;
  47. export const getObjectByName = goog.getObjectByName;
  48. export const basePath = goog.basePath;
  49. export const addSingletonGetter = goog.addSingletonGetter;
  50. export const typeOf = goog.typeOf;
  51. export const isArray = goog.isArray;
  52. export const isArrayLike = goog.isArrayLike;
  53. export const isDateLike = goog.isDateLike;
  54. export const isFunction = goog.isFunction;
  55. export const isObject = goog.isObject;
  56. export const getUid = goog.getUid;
  57. export const hasUid = goog.hasUid;
  58. export const removeUid = goog.removeUid;
  59. export const mixin = goog.mixin;
  60. export const now = goog.now;
  61. export const globalEval = goog.globalEval;
  62. export const getCssName = goog.getCssName;
  63. export const setCssNameMapping = goog.setCssNameMapping;
  64. export const getMsg = goog.getMsg;
  65. export const getMsgWithFallback = goog.getMsgWithFallback;
  66. export const exportSymbol = goog.exportSymbol;
  67. export const exportProperty = goog.exportProperty;
  68. export const globalize = goog.globalize;
  69. export const nullFunction = goog.nullFunction;
  70. export const abstractMethod = goog.abstractMethod;
  71. export const removeHashCode = goog.removeHashCode;
  72. export const getHashCode = goog.getHashCode;
  73. export const cloneObject = goog.cloneObject;
  74. export const bind = goog.bind;
  75. export const partial = goog.partial;
  76. export const inherits = goog.inherits;
  77. export const scope = goog.scope;
  78. export const defineClass = goog.defineClass;
  79. export const declareModuleId = goog.declareModuleId;
  80. // Export select properties of module. Do not export the function itself or
  81. // goog.module.declareLegacyNamespace.
  82. export const module = {
  83. get: goog.module.get,
  84. };
  85. // Omissions include:
  86. // goog.ENABLE_DEBUG_LOADER - define only used in base.
  87. // goog.ENABLE_CHROME_APP_SAFE_SCRIPT_LOADING - define only used in base.
  88. // goog.provide - ES6 modules do not provide anything.
  89. // goog.module - ES6 modules cannot be goog.modules.
  90. // goog.module.declareLegacyNamespace - ES6 modules cannot declare namespaces.
  91. // goog.addDependency - meant to only be used by dependency files.
  92. // goog.DEPENDENCIES_ENABLED - constant only used in base.
  93. // goog.TRANSPILE - define only used in base.
  94. // goog.TRANSPILER - define only used in base.
  95. // goog.loadModule - should not be called by any ES6 module; exists for
  96. // generated bundles.
  97. // goog.LOAD_MODULE_USING_EVAL - define only used in base.
  98. // goog.SEAL_MODULE_EXPORTS - define only used in base.
  99. // goog.DebugLoader - used rarely, only outside of compiled code.
  100. // goog.Transpiler - used rarely, only outside of compiled code.