Package com.google.javascript.jscomp
Class JSChunk
java.lang.Object
com.google.javascript.jscomp.JSChunk
- All Implemented Interfaces:
DependencyInfo,Serializable
A JavaScript chunk has a unique name, consists of a list of compiler inputs, and can depend on
other chunks.
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.google.javascript.jscomp.deps.DependencyInfo
DependencyInfo.Require, DependencyInfo.Util -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidadd(CompilerInput input) Adds a source code input to this chunk.voidadd(SourceFile file) Adds a source file input to this chunk.voidaddDependency(JSChunk dep) Adds a dependency on another chunk.Returns the transitive closure of dependencies starting from the dependencies of this chunk.Returns the input with the given name or null if none.com.google.common.collect.ImmutableList<JSChunk> Gets the list of chunks that this chunk depends on.intgetDepth()getFirst()Returns the first source code input.booleanWhether the file '@externs' annotation.booleanWhether the file has the '@nocompile' annotation.intgetIndex()intReturns the number of source code inputs.com.google.common.collect.ImmutableList<CompilerInput> Gets this chunk's list of source code inputs.Gets the loading information for this file.getName()Gets the chunk name.Gets the path of this file relative to Closure's base.js file.com.google.common.collect.ImmutableList<String> Gets the symbols provided by this file.com.google.common.collect.ImmutableList<DependencyInfo.Require> Gets the symbols required by this file.Returns this chunk and all of its dependencies in one list.com.google.common.collect.ImmutableList<String> Gets the symbols type-required by this file (i.e.booleanWhether the symbol is provided by an ES6 modulebooleanWhether the symbol is provided by a goog modulebooleanReturns whether this chunk is synthetic (i.e.booleanisWeak()voidremove(CompilerInput input) Removes an input from this chunk.voidRemoves all of the inputs from this chunk.booleanremoveByName(String name) Removes any input with the given name.voidsetDepth(int dep) voidsetIndex(int index) voidsortInputsByDeps(AbstractCompiler compiler) Puts the JS files into a topologically sorted order by their dependencies.toString()Returns the chunk name (primarily for debugging).Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface com.google.javascript.jscomp.deps.DependencyInfo
getRequiredSymbols
-
Field Details
-
STRONG_CHUNK_NAME
- See Also:
-
WEAK_CHUNK_NAME
- See Also:
-
-
Constructor Details
-
JSChunk
Creates an instance.- Parameters:
name- A unique name for the chunk
-
-
Method Details
-
getName
Gets the chunk name.- Specified by:
getNamein interfaceDependencyInfo
-
getProvides
Description copied from interface:DependencyInfoGets the symbols provided by this file.- Specified by:
getProvidesin interfaceDependencyInfo
-
getHasExternsAnnotation
public boolean getHasExternsAnnotation()Description copied from interface:DependencyInfoWhether the file '@externs' annotation.- Specified by:
getHasExternsAnnotationin interfaceDependencyInfo
-
getHasNoCompileAnnotation
public boolean getHasNoCompileAnnotation()Description copied from interface:DependencyInfoWhether the file has the '@nocompile' annotation.- Specified by:
getHasNoCompileAnnotationin interfaceDependencyInfo
-
getRequires
Description copied from interface:DependencyInfoGets the symbols required by this file.- Specified by:
getRequiresin interfaceDependencyInfo
-
getTypeRequires
Description copied from interface:DependencyInfoGets the symbols type-required by this file (i.e. for typechecking only).- Specified by:
getTypeRequiresin interfaceDependencyInfo
-
getPathRelativeToClosureBase
Description copied from interface:DependencyInfoGets the path of this file relative to Closure's base.js file.- Specified by:
getPathRelativeToClosureBasein interfaceDependencyInfo
-
getLoadFlags
Description copied from interface:DependencyInfoGets the loading information for this file.- Specified by:
getLoadFlagsin interfaceDependencyInfo
-
isGoogModule
public boolean isGoogModule()Description copied from interface:DependencyInfoWhether the symbol is provided by a goog module- Specified by:
isGoogModulein interfaceDependencyInfo
-
isEs6Module
public boolean isEs6Module()Description copied from interface:DependencyInfoWhether the symbol is provided by an ES6 module- Specified by:
isEs6Modulein interfaceDependencyInfo
-
add
Adds a source file input to this chunk. -
add
Adds a source code input to this chunk. -
addDependency
Adds a dependency on another chunk. -
remove
Removes an input from this chunk. -
removeAll
public void removeAll()Removes all of the inputs from this chunk. -
getDependencies
Gets the list of chunks that this chunk depends on.- Returns:
- A list that may be empty but not null
-
getAllDependencies
Returns the transitive closure of dependencies starting from the dependencies of this chunk. -
getThisAndAllDependencies
Returns this chunk and all of its dependencies in one list. -
getInputCount
public int getInputCount()Returns the number of source code inputs. -
getFirst
Returns the first source code input. -
getInputs
Gets this chunk's list of source code inputs.- Returns:
- A list that may be empty but not null
-
getInputsIterable
-
getByName
Returns the input with the given name or null if none. -
removeByName
Removes any input with the given name. Returns whether any were removed. -
isSynthetic
public boolean isSynthetic()Returns whether this chunk is synthetic (i.e. one of the special strong or weak chunks created by the compiler. -
isWeak
public boolean isWeak() -
toString
Returns the chunk name (primarily for debugging). -
sortInputsByDeps
Puts the JS files into a topologically sorted order by their dependencies. -
setDepth
public void setDepth(int dep) - Parameters:
dep- the depth to set
-
getDepth
public int getDepth()- Returns:
- the depth
-
setIndex
public void setIndex(int index) -
getIndex
public int getIndex()
-