Provides abstract access to the file system.
An object containing potentially useful metadata.
Get additional information about the module in question.
Module information for that module. null if the module could not be found.
Adds additional files to be monitored in watch mode so that changes to these files will trigger rebuilds.
Emits a new file that is included in the build output. You can emit chunks, prebuilt chunks or assets.
A referenceId for the emitted file that can be used in various places to reference the emitted file.
Get the file name of a chunk or asset that has been emitted via
this.emitFile.
The file name of the emitted file. Relative to output.dir.
Get all module ids in the current module graph.
An iterator of module ids. It can be iterated via
for (const moduleId of this.getModuleIds()) {
// ...
}
or converted into an array via Array.from(this.getModuleIds()).
Loads and parses the module corresponding to the given id, attaching additional
meta information to the module if provided. This will trigger the same
load, transform and
moduleParsed hooks as if the module was imported
by another module.
Use Rolldown's internal parser to parse code to an ESTree-compatible AST.
Optionaloptions: ParserOptions | nullResolve imports to module ids (i.e. file names) using the same plugins that Rolldown uses, and determine if an import should be external.
When calling this function from a resolveId hook, you should
always check if it makes sense for you to pass along the
options.
Optionalimporter: stringOptionaloptions: PluginContextResolveOptionsIf Promise<null> is returned, the import could not be resolved by Rolldown or any plugin
but was not explicitly marked as external by the user.
If an absolute external id is returned that should remain absolute in the output either
via the
makeAbsoluteExternalsRelative
option or by explicit plugin choice in the resolveId hook,
external will be "absolute" instead of true.
Generate a "debug" level log.
code will be set to "PLUGIN_LOG" by Rolldown.
Make sure to add a distinctive pluginCode to
those logs for easy filtering.
Similar to this.warn, except that it will also abort
the bundling process with an error.
If an Error instance is passed, it will be used as-is, otherwise a new Error instance will be created with the given error message and all additional provided properties.
In all hooks except the onLog hook, the error will
be augmented with code: "PLUGIN_ERROR" and
plugin: plugin.name properties.
If a code property already exists and the code does not start with PLUGIN_,
it will be renamed to pluginCode.
Generate a "info" level log.
code will be set to "PLUGIN_LOG" by Rolldown.
As these logs are displayed by default, use them for information that is not a warning
but makes sense to display to all users on every build.
Generate a "warn" level log.
Just like internally generated warnings, these logs will be first passed to and
filtered by plugin onLog hooks before they are forwarded
to custom onLog or
onwarn handlers or printed to the console.
We encourage you to use objects with a pluginCode
property as that will allow users to easily filter for those logs in an onLog handler.
Vite-specific environment instance