Skip to content

Commit 7c2463d

Browse files
Closure Teamcopybara-github
Closure Team
authored andcommitted
Add lib/goog.js to remove the implicit Closure Library goog.js dependency
PiperOrigin-RevId: 621928384
1 parent bf5ef4b commit 7c2463d

File tree

2 files changed

+39
-6
lines changed

2 files changed

+39
-6
lines changed

lib/base.js

+4-6
Original file line numberDiff line numberDiff line change
@@ -501,9 +501,8 @@ goog.getObjectByName_ = function(name, opt_obj) {
501501
* Note that all calls to goog.require will be stripped by the compiler.
502502
*
503503
* @see goog.provide
504-
* @param {string} namespace Namespace (as was given in goog.provide,
505-
* goog.module, or goog.declareModuleId) in the form
506-
* "goog.package.part".
504+
* @param {string} namespace Namespace (as was given in goog.provide or
505+
* goog.module) in the form "goog.package.part".
507506
* @return {?} The associated namespace or module for use in goog.module or ES6
508507
* module source files. NOT for use in goog.provide source files where using
509508
* this returned value will result in undefined behavior when compiled.
@@ -531,9 +530,8 @@ goog.require = function(namespace) {
531530
*
532531
* Note that all calls to goog.requireType will be stripped by the compiler.
533532
*
534-
* @param {string} namespace Namespace (as was given in goog.provide,
535-
* goog.module, or goog.declareModuleId) in the form
536-
* "goog.package.part".
533+
* @param {string} namespace Namespace (as was given in goog.provide or
534+
* goog.module in the form "goog.package.part".
537535
* @return {?}
538536
*/
539537
goog.requireType = function(namespace) {

lib/goog.js

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
/**
2+
* @license
3+
* Copyright The Closure Library Authors.
4+
* Copyright The Closure Compiler Authors.
5+
* SPDX-License-Identifier: Apache-2.0
6+
*/
7+
8+
/**
9+
* @fileoverview ES6 module exporting symbols from base.js. Provided here for
10+
* legacy applications that need to move off of Closure Library and need to
11+
* continue using ES6 modules. In general, `goog.module` files are recommended
12+
* as they are better supported in the Closure Compiler.
13+
*
14+
* A special compiler pass enforces that you always import this file as
15+
* `import * as goog`.
16+
*/
17+
18+
export const require = goog.require;
19+
export const define = goog.define;
20+
export const DEBUG = goog.DEBUG;
21+
export const LOCALE = goog.LOCALE;
22+
export const getGoogModule = goog.module.get;
23+
export const forwardDeclare = goog.forwardDeclare;
24+
export const getCssName = goog.getCssName;
25+
export const setCssNameMapping = goog.setCssNameMapping;
26+
export const getMsg = goog.getMsg;
27+
export const getMsgWithFallback = goog.getMsgWithFallback;
28+
export const exportSymbol = goog.exportSymbol;
29+
export const exportProperty = goog.exportProperty;
30+
31+
// Export select properties of module. Do not export the function itself or
32+
// goog.module.declareLegacyNamespace.
33+
export const module = {
34+
get: goog.module.get,
35+
};

0 commit comments

Comments
 (0)