@oazmi/superbuild - v0.1.0
    Preparing search index...

    Class SuperBuildContext

    a centralized context is created for each individual SuperBuild.build call.

    Index

    Constructors

    Properties

    onTransformHandlers: OnTransformHandler[] = []

    contains a list of transformation handlers that will be used for matching contents returned by the plugins' onLoad hooks, in order to transfer them to the registered SuperPluginBuild.onTransform hooks.

    onEmitHandlers: OnEmitHandler[] = []

    contains a list of onEmit handlers that will be called once the file contents of the bundle has been finalized by esbuild, but additional actions (such as linking, and re-incorporating imports for generic loaders) still need to be taken care of by the user's plugins. the callbacks accumulated here are registered by SuperPluginBuild.onEmit.

    onEndHandlers: OnEndHandler[] = []

    contains a list of onEnd handlers that will be called at the end of the build, after we have modified the contents of the resulting in-memory files. the callbacks accumulated here are registered by SuperPluginBuild.onEnd.

    resolvedResourceRegistry: Map<string, BundledInputFile> = ...

    holds all loaded resources, using ${namespace}:${resolved_path} for the key. this registry is needed in order to trace back the loaded input file(s) from which an emitted file originates from, in order to make the functionality of SuperPluginBuild.onEmit possible.

    longBuildController: LongBuildController

    the controller used for commanding the state of the "long build" plugin.

    shouldWrite: boolean = true

    indicates the original write option specified by the user when instantiating the build.

    shouldOverwrite: boolean = false

    indicates if the original allowOverwrite option was enabled when the build was started.

    a logging function for internal debugging. it gets called only when DEBUG.LOG is enabled.

    Methods

    • this method wraps a SuperPlugin on top of each of the user's base plugin, in addition to injecting two essential plugins at their correct position to make the new plugin apis work.

      the two internal plugins that get injected are:

      • nativeReplicaPlugin: this plugin mimics esbuild's native resource path resolution and loading, and it gets injected at the last, since esbuild only performs its native actions when other plugins don't return a viable result.
      • longBuildPlugin: this plugin gets injected at the beginning, and it book-keeps the number of resources/paths that have entered, the number of resources that have exited (i.e. loaded), and the number of resources that have been cached, in order to determine when esbuild has concluded processing all inputs, before esbuild exists out of the build and begins calling the build.onEnd callbacks. once this plugin has determined that all files in the current scope have been processed, it gathers all imports from the OnTransformResults, and compiles/bundles them in a new recursive scope (hence the name "long-build").

      Parameters

      • options: BuildOptions

      Returns BuildOptions