Skip to content

Commit ecad10f

Browse files
authored
Sync base.js to get goog.declareModuleId (bazelbuild#652)
1 parent 2e1c349 commit ecad10f

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

closure/private/base.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -435,6 +435,22 @@ goog.module.declareLegacyNamespace = function() {
435435
goog.moduleLoaderState_.declareLegacyNamespace = true;
436436
};
437437

438+
/**
439+
* Associates an ES6 module with a Closure module ID so that is available via
440+
* goog.require. The associated ID acts like a goog.module ID - it does not
441+
* create any global names, it is merely available via goog.require /
442+
* goog.module.get / goog.forwardDeclare / goog.requireType. goog.require and
443+
* goog.module.get will return the entire module as if it was import *'d. This
444+
* allows Closure files to reference ES6 modules for the sake of migration.
445+
*
446+
* @param {string} namespace
447+
* @suppress {missingProvide}
448+
*/
449+
goog.declareModuleId = function(namespace) {
450+
if (!COMPILED) {
451+
throw new Error('goog.declareModuleId is not supported in uncompiled mode');
452+
}
453+
};
438454

439455
/**
440456
* Marks that the current file should only be used for testing, and never for

0 commit comments

Comments
 (0)