On this page

Source Code: lib/RuntimeTemplate.js#L133
new RuntimeTemplate(): RuntimeTemplate
Source Code: lib/RuntimeTemplate.js#L142
Source Code: lib/RuntimeTemplate.js#L151
Type:string
Source Code: lib/RuntimeTemplate.js#L147
Type:string
Source Code: lib/RuntimeTemplate.js#L143
Source Code: lib/RuntimeTemplate.js#L145
runtimeTemplate.assignOr(target, value): string
Source Code: lib/RuntimeTemplate.js#L503
Attributes
target:string
value:string
Returns:string

Returns a self-defaulting assignment, using the ||= logical assignment operator when supported and falling back to target = target || value otherwise. target is evaluated twice in the fallback, so it must be side-effect free. The expression evaluates to the resulting value. Models || only, so target must never hold a legitimate falsy value (0, "", false) — it would be overwritten; use it for object/array defaults.

runtimeTemplate.asyncModuleFactory(__namedParameters): string
Source Code: lib/RuntimeTemplate.js#L1807
Attributes
__namedParameters:Object
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.

runtimeTemplate.basicFunction(args, body): string
Source Code: lib/RuntimeTemplate.js#L341
Attributes
args:string
body:string | string[]
Returns:string

Returns basic function.

runtimeTemplate.blockPromise(__namedParameters): string
Source Code: lib/RuntimeTemplate.js#L1518
Attributes
__namedParameters:Object
the async block
chunkGraph:ChunkGraph
the chunk graph
message:string
the message
originModule:Module
the module the import() is emitted into
runtimeRequirements:Set<string>
if set, will be filled with runtime requirements
Returns:string

Returns expression.

runtimeTemplate.comment(__namedParameters): string
Source Code: lib/RuntimeTemplate.js#L576
Attributes
__namedParameters:Object
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.

runtimeTemplate.concatenation(...args?): string
Source Code: lib/RuntimeTemplate.js#L352
Attributes
...args:(string | { expr: string })[]
Returns:string

Returns result expression.

runtimeTemplate.cssServerStyleRegistry(): string
Source Code: lib/RuntimeTemplate.js#L198
Returns:string

Expression for the global registry that collects CSS server-side when there is no DOM (SSR). An SSR host reads it from globalThis; it is keyed by the style/chunk identifier and namespaced by output.uniqueName.

runtimeTemplate.defineEsModuleFlagStatement(__namedParameters): string
Source Code: lib/RuntimeTemplate.js#L1860
Attributes
__namedParameters:Object
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.

runtimeTemplate.destructureArray(items, value): string
Source Code: lib/RuntimeTemplate.js#L515
Attributes
items:string[]
value:string
Returns:string

Returns destructure array code.

runtimeTemplate.destructureObject(items, value): string
Source Code: lib/RuntimeTemplate.js#L530
Attributes
items:string[]
value:string
Returns:string

Destructure object.

runtimeTemplate.emptyFunction(): string
Source Code: lib/RuntimeTemplate.js#L431
Returns:string

Returns empty function code.

runtimeTemplate.exportFromImport(__namedParameters): string
Source Code: lib/RuntimeTemplate.js#L1229
Attributes
__namedParameters:Object
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
mangleableNamespace:boolean
true, when a whole-namespace value may use a decoupled namespace object that keeps the original export names
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.

runtimeTemplate.expressionFunction(expression, args?): string
Source Code: lib/RuntimeTemplate.js#L421
Attributes
expression:string
args:string
Returns:string

Expression function.

runtimeTemplate.forEach(variable, array, body): string
Source Code: lib/RuntimeTemplate.js#L558
Attributes
variable:string
array:string
body:string | string[]
Returns:string

Returns for each code.

runtimeTemplate.getBuiltinModule(request, access?): string
Source Code: lib/RuntimeTemplate.js#L457
Attributes
request:string
access:string
Returns:string

Reads a node builtin via process.getBuiltinModule(), guarded to stay falsy off node so universal ["node", "web"] bundles don't crash (also falsy on node <22.3).

runtimeTemplate.iife(args, body): string
Source Code: lib/RuntimeTemplate.js#L547
Attributes
args:string
body:string
Returns:string

Returns iIFE code.

runtimeTemplate.importStatement(__namedParameters): [string, string]
Source Code: lib/RuntimeTemplate.js#L1108
Attributes
__namedParameters:Object
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.

runtimeTemplate.isIIFE(): boolean
Source Code: lib/RuntimeTemplate.js#L154
Returns:boolean
runtimeTemplate.isModule(): boolean
Source Code: lib/RuntimeTemplate.js#L158
Returns:boolean
runtimeTemplate.isNeutralPlatform(): boolean
Source Code: lib/RuntimeTemplate.js#L162
Returns:boolean
runtimeTemplate.isUniversalTarget(): boolean
Source Code: lib/RuntimeTemplate.js#L173
Returns:boolean

Whether the bundle targets node and web at once (universal ["node", "web"] + output.module), like isUniversalTarget in WebpackOptionsApply.

runtimeTemplate.isWebLikePlatformExpression(): string
Source Code: lib/RuntimeTemplate.js#L188
Returns:string

Runtime expression that is truthy in browser-like environments (a DOM document or a worker self) and falsy in Node.js. Single source of truth for branching a universal ("node-or-web") target at runtime.

runtimeTemplate.method(prop, args, body): string
Source Code: lib/RuntimeTemplate.js#L473
Attributes
prop:string
args:string
body:string | string[]
Returns:string

Renders an object-literal method, using method shorthand when supported and falling back to a prop: function/arrow property otherwise.

runtimeTemplate.missingModule(__namedParameters): string
Source Code: lib/RuntimeTemplate.js#L628
Attributes
__namedParameters:Object
request:string
request string used originally
Returns:string

Returns generated error IIFE.

runtimeTemplate.missingModulePromise(__namedParameters): string
Source Code: lib/RuntimeTemplate.js#L648
Attributes
__namedParameters:Object
request:string
request string used originally
Returns:string

Missing module promise.

runtimeTemplate.missingModuleStatement(__namedParameters): string
Source Code: lib/RuntimeTemplate.js#L638
Attributes
__namedParameters:Object
request:string
request string used originally
Returns:string

Missing module statement.

runtimeTemplate.moduleExports(__namedParameters): string
Source Code: lib/RuntimeTemplate.js#L773
Attributes
__namedParameters:Object
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.

runtimeTemplate.moduleId(__namedParameters): string
Source Code: lib/RuntimeTemplate.js#L698
Attributes
__namedParameters:Object
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.

runtimeTemplate.moduleNamespace(__namedParameters): string
Source Code: lib/RuntimeTemplate.js#L794
Attributes
__namedParameters:Object
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.

runtimeTemplate.moduleNamespacePromise(__namedParameters): string
Source Code: lib/RuntimeTemplate.js#L868
Attributes
__namedParameters:Object
the current dependencies block
chunkGraph:ChunkGraph
the chunk graph
dependency:Dependency
dependency
message:string
a message for the comment
module:Module
the module
originModule:Module
the module the import() is emitted into
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.

runtimeTemplate.moduleRaw(__namedParameters): string
Source Code: lib/RuntimeTemplate.js#L729
Attributes
__namedParameters:Object
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.

runtimeTemplate.objectHasOwn(object, property): string
Source Code: lib/RuntimeTemplate.js#L486
Attributes
object:string
property:string
Returns:string

Returns an own-property check, using Object.hasOwn when supported and falling back to Object.prototype.hasOwnProperty.call otherwise.

runtimeTemplate.optionalChaining(object, access): string
Source Code: lib/RuntimeTemplate.js#L443
Attributes
object:string
access:string
Returns:string

Guards an access/call on object with optional chaining when supported, otherwise an equivalent && short-circuit. object is evaluated twice in the fallback, so it must be side-effect free.

runtimeTemplate.renderConst(): "const" | "let" | "var"
Source Code: lib/RuntimeTemplate.js#L311
Returns:"const" | "let" | "var"

Renders return const when it is supported, otherwise let when supported, otherwise var.

runtimeTemplate.renderLet(): "let" | "var"
Source Code: lib/RuntimeTemplate.js#L319
Returns:"let" | "var"

Renders return let when it is supported, otherwise var.

runtimeTemplate.renderNodePrefixForCoreModule(mod): string
Source Code: lib/RuntimeTemplate.js#L301
Attributes
mod:string
Returns:string

Renders node prefix for core module.

runtimeTemplate.returningFunction(returnValue, args?): string
Source Code: lib/RuntimeTemplate.js#L329
Attributes
returnValue:string
args:string
Returns:string

Returning function.

runtimeTemplate.runtimeConditionExpression(__namedParameters): string
Source Code: lib/RuntimeTemplate.js#L1064
Attributes
__namedParameters:Object
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.

runtimeTemplate.supportNodePrefixForCoreModules(): boolean
Source Code: lib/RuntimeTemplate.js#L292
Returns:boolean
runtimeTemplate.supportsAnalyzableEsm(): boolean
Source Code: lib/RuntimeTemplate.js#L274
Returns:boolean
runtimeTemplate.supportsArrowFunction(): boolean
Source Code: lib/RuntimeTemplate.js#L222
Returns:boolean
runtimeTemplate.supportsAsyncFunction(): boolean
Source Code: lib/RuntimeTemplate.js#L226
Returns:boolean
runtimeTemplate.supportsBigIntLiteral(): boolean
Source Code: lib/RuntimeTemplate.js#L258
Returns:boolean
runtimeTemplate.supportsConst(): boolean
Source Code: lib/RuntimeTemplate.js#L206
Returns:boolean
runtimeTemplate.supportsDestructuring(): boolean
Source Code: lib/RuntimeTemplate.js#L254
Returns:boolean
runtimeTemplate.supportsDynamicImport(): boolean
Source Code: lib/RuntimeTemplate.js#L262
Returns:boolean
runtimeTemplate.supportsEcmaScriptModuleSyntax(): boolean
Source Code: lib/RuntimeTemplate.js#L266
Returns:boolean
runtimeTemplate.supportsForOf(): boolean
Source Code: lib/RuntimeTemplate.js#L250
Returns:boolean
runtimeTemplate.supportsGenerator(): boolean
Source Code: lib/RuntimeTemplate.js#L230
Returns:boolean
runtimeTemplate.supportsLet(): boolean
Source Code: lib/RuntimeTemplate.js#L210
Returns:boolean
runtimeTemplate.supportsLogicalAssignment(): boolean
Source Code: lib/RuntimeTemplate.js#L218
Returns:boolean
runtimeTemplate.supportsMethodShorthand(): boolean
Source Code: lib/RuntimeTemplate.js#L214
Returns:boolean
runtimeTemplate.supportsModulePreload(): boolean
Source Code: lib/RuntimeTemplate.js#L270
Returns:boolean
runtimeTemplate.supportsObjectHasOwn(): boolean
Source Code: lib/RuntimeTemplate.js#L242
Returns:boolean
runtimeTemplate.supportsOptionalChaining(): boolean
Source Code: lib/RuntimeTemplate.js#L234
Returns:boolean
runtimeTemplate.supportsSpread(): boolean
Source Code: lib/RuntimeTemplate.js#L238
Returns:boolean
runtimeTemplate.supportsSymbol(): boolean
Source Code: lib/RuntimeTemplate.js#L246
Returns:boolean
runtimeTemplate.supportTemplateLiteral(): boolean
Source Code: lib/RuntimeTemplate.js#L288
Returns:boolean
runtimeTemplate.syncModuleFactory(__namedParameters): string
Source Code: lib/RuntimeTemplate.js#L1840
Attributes
__namedParameters:Object
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.

runtimeTemplate.throwMissingModuleErrorBlock(__namedParameters): string
Source Code: lib/RuntimeTemplate.js#L603
Attributes
__namedParameters:Object
request:string
request string used originally
Returns:string

Throw missing module error block.

runtimeTemplate.throwMissingModuleErrorFunction(__namedParameters): string
Source Code: lib/RuntimeTemplate.js#L616
Attributes
__namedParameters:Object
request:string
request string used originally
Returns:string

Throw missing module error function.

runtimeTemplate.weakError(__namedParameters): string
Source Code: lib/RuntimeTemplate.js#L664
Attributes
__namedParameters:Object
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.