Home Reference Source
public class | source

RollupMiddleware

This service creates, configures and manages an Express-like middleware for bundling Rollup.

Constructor Summary

Public Constructor
public

constructor(appLogger: Logger, events: Events, targets: Targets, rollupConfiguration: RollupConfiguration)

Class constructor.

Member Summary

Public Members
public

A local reference for the appLogger service.

public

A local reference for the events service.

public

A local reference for the rollupConfiguration service.

public

A local reference for the targets service.

Private Members
private

The instance of the Rollup watcher.

Method Summary

Public Methods
public

generate(targetToBuild: string, targetToServe: string): MiddlewareInformation

Generate the middleware for a given target.

Public Constructors

public constructor(appLogger: Logger, events: Events, targets: Targets, rollupConfiguration: RollupConfiguration) source

Class constructor.

Params:

NameTypeAttributeDescription
appLogger Logger

To log information messages.

events Events

To reduce the middlewares configuration.

targets Targets

To get targets information.

rollupConfiguration RollupConfiguration

To get a target Rollup configuration.

Public Members

public appLogger: Logger source

A local reference for the appLogger service.

public events: Events source

A local reference for the events service.

public rollupConfiguration: RollupConfiguration source

A local reference for the rollupConfiguration service.

public targets: Targets source

A local reference for the targets service.

Private Members

private _watcher: Object source

The instance of the Rollup watcher.

Public Methods

public generate(targetToBuild: string, targetToServe: string): MiddlewareInformation source

Generate the middleware for a given target.

Params:

NameTypeAttributeDescription
targetToBuild string

The name of the target that will be builded on the middleware.

targetToServe string

The name of the target that will implement the middleware. When the other target is builded, it will assume that is on the distribution directory, and if the target serving it is being executed from the source directory it won't be able to use the file system without hardcoding some relatives paths from the build to the source; to avoid that, the method gets the build path of this target, so when using getDirectory(), it will think they are both on the distribution directory and the paths can be created relative to that.