nope/lib/loader/getPackageLoader.nodejs.ts

34 lines
1.1 KiB
TypeScript
Raw Permalink Normal View History

2022-01-17 17:06:10 +00:00
/**
* @author Martin Karkowski
* @email m.karkowski@zema.de
* @desc [description]
*/
import { INopePackageLoaderConstructor } from "../index.browser";
import {
IDispatcherConstructor,
INopeDispatcherOptions,
} from "../types/nope/nopeDispatcher.interface";
2022-01-17 17:06:10 +00:00
import { getPackageLoader as getBrowserPackageLoader } from "./getPackageLoader.browser";
import { NopePackageLoaderFileAccess } from "./nopePackageLoader.nodejs";
/**
* Function to extract the Package-Loader. This one here includes file access.
* @param {INopeDispatcherOptions} dispatcherOptions The provided options for the Dispatcher
* @param options Settings for the creation of the Dispatcher etc.
* @returns {INopePackageLoader} The Package loader.
2022-01-17 17:06:10 +00:00
*/
export function getPackageLoader(
dispatcherOptions: INopeDispatcherOptions,
options: {
packageLoaderConstructorClass?: INopePackageLoaderConstructor;
dispatcherConstructorClass?: IDispatcherConstructor;
singleton?: boolean;
useBaseServices?: boolean;
} = {}
2022-01-17 17:06:10 +00:00
) {
options.packageLoaderConstructorClass = NopePackageLoaderFileAccess;
return getBrowserPackageLoader(dispatcherOptions, options);
2022-01-17 17:06:10 +00:00
}