Class ModuleMetadataMap.ModuleMetadata

java.lang.Object
com.google.javascript.jscomp.modules.ModuleMetadataMap.ModuleMetadata
Enclosing class:
ModuleMetadataMap

public abstract static class ModuleMetadataMap.ModuleMetadata extends Object
Struct containing basic information about a module/script including its type and goog namespaces.
  • Constructor Details

    • ModuleMetadata

      public ModuleMetadata()
  • Method Details

    • moduleType

      public abstract ModuleMetadataMap.ModuleType moduleType()
    • isEs6Module

      public boolean isEs6Module()
    • isGoogModule

      public boolean isGoogModule()
    • isNonLegacyGoogModule

      public boolean isNonLegacyGoogModule()
    • isLegacyGoogModule

      public boolean isLegacyGoogModule()
    • isGoogProvide

      public boolean isGoogProvide()
    • hasLegacyGoogNamespaces

      public boolean hasLegacyGoogNamespaces()
    • isCommonJs

      public boolean isCommonJs()
    • isNonProvideScript

      public boolean isNonProvideScript()
    • isModule

      public boolean isModule()
      Whether this is a module (with it's own local scope).
    • rootNode

      public abstract @Nullable Node rootNode()
      AST node that represents the root of this module.

      May be null if this is a synthetic piece of metadata - e.g. in a test, or something used as a fallback.

    • usesClosure

      public abstract boolean usesClosure()
      Whether this file uses Closure Library at all. Note that a file could use Closure Library even without calling goog.provide/module/require - there are some primitives in base.js that can be used without being required like goog.isArray.

      If this is true this indicates the base.js is needed and is not part of this script - it is an EXTERNAL dependencym otherwise false. If this is also false if Closure Library is part of this script - e.g. a bundle with base.js. So something could be a "goog.provide'd file", but not use Closure if the bundle already contains Closure.

    • isTestOnly

      public abstract boolean isTestOnly()
      Whether goog.setTestOnly was called.
    • googNamespaces

      public abstract com.google.common.collect.ImmutableMultiset<String> googNamespaces()
      Closure namespaces that this file is associated with. Created by goog.provide, goog.module, and goog.declareModuleId.

      This is a multiset as it does not warn on duplicate namespaces, but will still encapsulate that information with this multiset.

    • stronglyRequiredGoogNamespaces

      public abstract com.google.common.collect.ImmutableMultiset<String> stronglyRequiredGoogNamespaces()
      Closure namespaces this file strongly requires, i.e., arguments to goog.require calls.

      This is a multiset as it does not warn on duplicate namespaces, but will still encapsulate that information with this multiset.

    • dynamicallyRequiredGoogNamespaces

      public abstract com.google.common.collect.ImmutableMultiset<String> dynamicallyRequiredGoogNamespaces()
      Closure namespaces this file dynamically require, i.e., arguments to goog.requireDynamic() calls.

      This is a multiset as it does not warn on duplicate namespaces, but will still encapsulate that information with this multiset.

    • maybeRequiredGoogNamespaces

      public abstract com.google.common.collect.ImmutableMultiset<String> maybeRequiredGoogNamespaces()
      Closure namespaces this file "maybe" require, i.e., arguments to goog.maybeRequireFrameworkInternalOnlyDoNotCallOrElse() calls.

      This is a multiset as it does not warn on duplicate namespaces, but will still encapsulate that information with this multiset.

    • weaklyRequiredGoogNamespaces

      public abstract com.google.common.collect.ImmutableMultiset<String> weaklyRequiredGoogNamespaces()
      Closure namespaces this file weakly requires, i.e., arguments to goog.requireType calls.

      This is a multiset as it does not warn on duplicate namespaces, but will still encapsulate that information with this multiset.

    • es6ImportSpecifiers

      public abstract com.google.common.collect.ImmutableMultiset<String> es6ImportSpecifiers()
      Raw text of all ES6 import specifiers (includes "export from" as well).
    • nestedModules

      public abstract com.google.common.collect.ImmutableList<ModuleMetadataMap.ModuleMetadata> nestedModules()
    • readToggles

      public abstract com.google.common.collect.ImmutableMultiset<String> readToggles()
      Arguments to goog.readToggleInternalDoNotCallDirectly() calls.

      This is a multiset as it does not warn on duplicate toggles, but will still encapsulate that information with this multiset.

    • path

      public abstract @Nullable ModuleLoader.ModulePath path()
    • builder

    • equals

      public final boolean equals(Object other)
      Overrides:
      equals in class Object
    • hashCode

      public final int hashCode()
      Overrides:
      hashCode in class Object