UNPKG

nope-js-browser

Version:

NoPE Runtime for the Browser. For nodejs please use nope-js-node

45 lines (44 loc) 1.84 kB
/** * @author Martin Karkowski * @email m.karkowski@zema.de * @desc [description] */ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; import { injectable } from "inversify"; import { resolve } from "path"; import "reflect-metadata"; import { NopePackageLoader } from "./nopePackageLoader"; /** * Helper Class to Build an inversify Container. * * @export * @class NopePackageLoader * @implements {INopePackageLoader} */ let NopePackageLoaderFileAccess = class NopePackageLoaderFileAccess extends NopePackageLoader { /** * A Method, to load a package file, located at the given path. * @param path Path to the `javascript` file * @param useAutostart Flag to enable / disable the Autostart * @param useInstance Flag to enable / disable considering the Instances. */ async loadPackageFile(path, useAutostart = true, useInstance = true) { const loadedPackage = (await import(resolve(path))) .DESCRIPTION; if (!useAutostart) { loadedPackage.autostart = {}; } if (!useInstance) { loadedPackage.defaultInstances = []; } } }; NopePackageLoaderFileAccess = __decorate([ injectable() ], NopePackageLoaderFileAccess); export { NopePackageLoaderFileAccess };