public abstract class Module
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
Module.Builder
Builder for
Module . |
Modifier and Type | Method and Description |
---|---|
abstract com.google.common.collect.ImmutableMap<java.lang.String,Binding> |
boundNames()
Map of local identifiers to originating binding.
|
static Module.Builder |
builder()
Creates a new builder.
|
abstract java.lang.String |
closureNamespace()
The specific Closure namespace this module represents, if any.
|
abstract com.google.common.collect.ImmutableMap<java.lang.String,Export> |
localNameToLocalExport()
Map of local identifier name to local export definition.
|
abstract ModuleMetadataMap.ModuleMetadata |
metadata() |
abstract com.google.common.collect.ImmutableMap<java.lang.String,Binding> |
namespace()
Map of exported identifiers to originating binding.
|
abstract ModuleLoader.ModulePath |
path()
Path of this module.
|
abstract Module.Builder |
toBuilder()
Returns this module in builder form.
|
public abstract ModuleMetadataMap.ModuleMetadata metadata()
@Nullable public abstract ModuleLoader.ModulePath path()
goog.loadModule
.public abstract com.google.common.collect.ImmutableMap<java.lang.String,Binding> namespace()
Note that the keys are different than boundNames()
. Here the keys are the exported
name, not the local name.
Examples:
export let x;
, let x; export {x as v};
) creates an entry with the exported name for the local module's export
definition.
export default function foo() {};
creates an entry with the name "default"
for the local module's default export definition.
export {x as v} from 'mod';
creates an entry with the name "v" for the
export definition x from 'mod'.
import
statements make no entries on their own. If imported values are
exported with export {};
then an entry is created like export {} from
.
exports.foo = bar;
creates an entry with the name "foo" for the expression
on the right-hand side. This is not bound to a local name.
public abstract com.google.common.collect.ImmutableMap<java.lang.String,Binding> boundNames()
This includes all names bound by import and exported names which originate in this module. Used for rewriting in later stages of the compiler.
ES modules may have names bound by both imports and exports. Closure modules only have names bound by imports, as it is impossible to create a new local identifier in an export.
Examples:
import {x as v} from 'mod';
creates an entry with the name "v" for the
export definition x from 'mod'.
import * as ns from 'mod';
creates an entry with the name "ns" with a
binding containing all of mod's bindings.
export default function foo() {}
creates an entry with the name "foo" for
the local module's export definition.
export {x as v} from 'mod';
does not create any entry in this module.
const C = goog.require('mod.C')
creates an entry with the name "C" for the
binding containing the default export of 'mod.C'
public abstract com.google.common.collect.ImmutableMap<java.lang.String,Export> localNameToLocalExport()
@Nullable public abstract java.lang.String closureNamespace()
goog.provide
, goog.module
, or goog.module.declareNamespace
. Null otherwise.public static Module.Builder builder()
public abstract Module.Builder toBuilder()
Copyright © 2009-2019 Google. All Rights Reserved.