On this page

new RuntimeTemplate(): RuntimeTemplate
Attributes
compilation:Compilation
contentHashReplacement:string
globalObject:string
requestShortener:RequestShortener
asyncModuleFactory({ block, chunkGraph, runtimeRequirements, request }): string
Attributes
the async block
chunkGraph:ChunkGraph
the chunk graph
request:string
request string used originally
runtimeRequirements:Set<string>
if set, will be filled with runtime requirements
Returns:string

Async module factory.


basicFunction(args, body): string
Attributes
args:string
body:string | string[]
Returns:string

Returns basic function.


blockPromise({ block, message, chunkGraph, runtimeRequirements }): string
Attributes
the async block
chunkGraph:ChunkGraph
the chunk graph
message:string
the message
runtimeRequirements:Set<string>
if set, will be filled with runtime requirements
Returns:string

Returns expression.


comment({ request, chunkName, chunkReason, message, exportName }): string
Attributes
chunkName:string | null
name of the chunk referenced
chunkReason:string
reason information of the chunk
exportName:string
name of the export
message:string
additional message
request:string
request string used originally
Returns:string

Returns comment.


concatenation(...args?): string
Attributes
args:(string | { expr: string })[]
Returns:string

Returns result expression.


defineEsModuleFlagStatement({ exportsArgument, runtimeRequirements }): string
Attributes
exportsArgument:string
the name of the exports object
runtimeRequirements:Set<string>
if set, will be filled with runtime requirements
Returns:string

Define es module flag statement.


destructureArray(items, value): string
Attributes
items:string[]
value:string
Returns:string

Returns destructure array code.


destructureObject(items, value): string
Attributes
items:string[]
value:string
Returns:string

Destructure object.


emptyFunction(): string
Returns:string

Returns empty function code.


exportFromImport({ moduleGraph, chunkGraph, module, request, exportName, originModule, asiSafe, isCall, callContext, defaultInterop, importVar, initFragments, runtime, runtimeRequirements, dependency }): string
Attributes
asiSafe:boolean
true, if location is safe for ASI, a bracket can be emitted
callContext:boolean | null
when false, call context will not be preserved
chunkGraph:ChunkGraph
the chunk graph
defaultInterop:boolean
when true and accessing the default exports, interop code will be generated
dependency:ModuleDependency
module dependency
exportName:string | string[]
the export name
importVar:string
the identifier name of the import variable
initFragments:InitFragment<GenerateContext>[]
init fragments will be added here
isCall:boolean
true, if expression will be called
module:Module
the module
moduleGraph:ModuleGraph
the module graph
originModule:Module
the origin module
request:string
the request
runtime:RuntimeSpec
runtime for which this code will be generated
runtimeRequirements:Set<string>
if set, will be filled with runtime requirements
Returns:string

Export from import.


expressionFunction(expression, args?): string
Attributes
expression:string
args:string
Returns:string

Expression function.


forEach(variable, array, body): string
Attributes
variable:string
array:string
body:string | string[]
Returns:string

Returns for each code.


iife(args, body): string
Attributes
args:string
body:string
Returns:string

Returns iIFE code.


importStatement({ update, module, originModule, moduleGraph, chunkGraph, runtimeRequirements, importVar, request, weak, dependency }): [string, string]
Attributes
chunkGraph:ChunkGraph
the chunk graph
dependency:ModuleDependency
module dependency
importVar:string
name of the import variable
module:Module
the module
moduleGraph:ModuleGraph
the module graph
originModule:Module
module in which the statement is emitted
request:string
the request that should be printed as comment
runtimeRequirements:Set<string>
if set, will be filled with runtime requirements
update:boolean
whether a new variable should be created or the existing one updated
weak:boolean
true, if this is a weak dependency
Returns:[string, string]

Returns the import statement and the compat statement.


isIIFE(): boolean
Returns:boolean

isModule(): boolean
Returns:boolean

isNeutralPlatform(): boolean
Returns:boolean

missingModule({ request }): string
Attributes
request:string
request string used originally
Returns:string

Returns generated error IIFE.


missingModulePromise({ request }): string
Attributes
request:string
request string used originally
Returns:string

Missing module promise.


missingModuleStatement({ request }): string
Attributes
request:string
request string used originally
Returns:string

Missing module statement.


moduleExports({ module, chunkGraph, request, weak, runtimeRequirements }): string
Attributes
chunkGraph:ChunkGraph
the chunk graph
module:Module | null
the module
request:string
the request that should be printed as comment
runtimeRequirements:Set<string>
if set, will be filled with runtime requirements
weak:boolean
if the dependency is weak (will create a nice error message)
Returns:string

Returns the expression.


moduleId({ module, chunkGraph, request, weak }): string
Attributes
chunkGraph:ChunkGraph
the chunk graph
module:Module
the module
request:string
the request that should be printed as comment
weak:boolean
if the dependency is weak (will create a nice error message)
Returns:string

Returns the expression.


moduleNamespace({ module, chunkGraph, request, strict, weak, runtimeRequirements }): string
Attributes
chunkGraph:ChunkGraph
the chunk graph
module:Module
the module
request:string
the request that should be printed as comment
runtimeRequirements:Set<string>
if set, will be filled with runtime requirements
strict:boolean
if the current module is in strict esm mode
weak:boolean
if the dependency is weak (will create a nice error message)
Returns:string

Returns the expression.


moduleNamespacePromise({ chunkGraph, block, module, request, message, strict, weak, dependency, runtimeRequirements }): string
Attributes
the current dependencies block
chunkGraph:ChunkGraph
the chunk graph
dependency:Dependency
dependency
message:string
a message for the comment
module:Module
the module
request:string
the request that should be printed as comment
runtimeRequirements:Set<string>
if set, will be filled with runtime requirements
strict:boolean
if the current module is in strict esm mode
weak:boolean
if the dependency is weak (will create a nice error message)
Returns:string

Module namespace promise.


moduleRaw({ module, chunkGraph, request, weak, runtimeRequirements }): string
Attributes
chunkGraph:ChunkGraph
the chunk graph
module:Module | null
the module
request:string
the request that should be printed as comment
runtimeRequirements:Set<string>
if set, will be filled with runtime requirements
weak:boolean
if the dependency is weak (will create a nice error message)
Returns:string

Returns the expression.


renderConst(): "const" | "var"
Returns:"const" | "var"

Renders return const when it is supported, otherwise var.


renderNodePrefixForCoreModule(mod): string
Attributes
mod:string
Returns:string

Renders node prefix for core module.


returningFunction(returnValue, args?): string
Attributes
returnValue:string
args:string
Returns:string

Returning function.


runtimeConditionExpression({ chunkGraph, runtime, runtimeCondition, runtimeRequirements }): string
Attributes
chunkGraph:ChunkGraph
the chunk graph
runtime:RuntimeSpec
runtime for which this code will be generated
runtimeCondition:string | boolean | SortableSet<string>
only execute the statement in some runtimes
runtimeRequirements:Set<string>
if set, will be filled with runtime requirements
Returns:string

Runtime condition expression.


supportNodePrefixForCoreModules(): boolean
Returns:boolean

supportsArrowFunction(): boolean
Returns:boolean

supportsAsyncFunction(): boolean
Returns:boolean

supportsBigIntLiteral(): boolean
Returns:boolean

supportsConst(): boolean
Returns:boolean

supportsDestructuring(): boolean
Returns:boolean

supportsDynamicImport(): boolean
Returns:boolean

supportsEcmaScriptModuleSyntax(): boolean
Returns:boolean

supportsForOf(): boolean
Returns:boolean

supportsMethodShorthand(): boolean
Returns:boolean

supportsOptionalChaining(): boolean
Returns:boolean

supportTemplateLiteral(): boolean
Returns:boolean

syncModuleFactory({ dependency, chunkGraph, runtimeRequirements, request }): string
Attributes
chunkGraph:ChunkGraph
the chunk graph
dependency:Dependency
the dependency
request:string
request string used originally
runtimeRequirements:Set<string>
if set, will be filled with runtime requirements
Returns:string

Sync module factory.


throwMissingModuleErrorBlock({ request }): string
Attributes
request:string
request string used originally
Returns:string

Throw missing module error block.


throwMissingModuleErrorFunction({ request }): string
Attributes
request:string
request string used originally
Returns:string

Throw missing module error function.


weakError({ chunkGraph, module, request, idExpr, type }): string
Attributes
chunkGraph:ChunkGraph
the chunk graph
idExpr:string
expression to use as id expression
module:Module
the module
request:string
the request that should be printed as comment
type:"promise" | "expression" | "statements"
which kind of code should be returned
Returns:string

Returns the code.