update to latest standards
This commit is contained in:
parent
62b91adf0e
commit
32db51c49a
2
dist/index.d.ts
vendored
2
dist/index.d.ts
vendored
@ -12,7 +12,7 @@ export declare class LazyModule<T> {
|
||||
whenLoaded: q.Promise<T>;
|
||||
loader: TLoader;
|
||||
private whenLoadedDeferred;
|
||||
constructor(nameArg: string, cwdArg?: string);
|
||||
constructor(nameArg: string, cwdArg: string);
|
||||
setLoader(loaderArg: TLoader): void;
|
||||
/**
|
||||
* loads the module
|
||||
|
7
dist/index.js
vendored
7
dist/index.js
vendored
@ -17,8 +17,11 @@ class Smartsystem {
|
||||
// create the internal smartsystem
|
||||
let smartsystem = new Smartsystem();
|
||||
class LazyModule {
|
||||
constructor(nameArg, cwdArg = process.cwd()) {
|
||||
constructor(nameArg, cwdArg) {
|
||||
this.loader = 'npm';
|
||||
if (!cwdArg) {
|
||||
throw new Error('You must specify a directory to resolve from!');
|
||||
}
|
||||
this.name = nameArg;
|
||||
this.cwd = cwdArg;
|
||||
smartsystem.addLazyModule(this); // add module to smartsystem instance
|
||||
@ -62,4 +65,4 @@ class LazyModule {
|
||||
}
|
||||
}
|
||||
exports.LazyModule = LazyModule;
|
||||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBQUEsMEJBQXVCO0FBRXZCLDZCQUE0QjtBQUM1Qix1QkFBc0I7QUFDdEIsNkJBQStCO0FBRS9CO0lBQUE7UUFDSSxnQkFBVyxHQUFHLElBQUksZUFBUyxFQUFtQixDQUFBO0lBUWxELENBQUM7SUFORzs7T0FFRztJQUNILGFBQWEsQ0FBQyxhQUE4QjtRQUN4QyxJQUFJLENBQUMsV0FBVyxDQUFDLEdBQUcsQ0FBQyxhQUFhLENBQUMsQ0FBQTtJQUN2QyxDQUFDO0NBQ0o7QUFFRCx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sSUFBSSxDQUFDLE9BQU8sQ0FBQyxZQUFZLENBQUMsQ0FBQTtZQUM5QixDQUFDLENBQUMsQ0FBQyxLQUFLLENBQUMsR0FBRyxNQUFNLE9BQU8sQ0FBQyxHQUFHLENBQUMsR0FBRyxDQUFDLENBQUEsQ0FBQyxDQUFDLENBQUMsQ0FBQTtRQUN6QyxDQUFDO1FBQUMsSUFBSSxDQUFDLENBQUM7WUFDSixNQUFNLEtBQUssQ0FBQyxzQkFBc0IsQ0FBQyxDQUFBO1FBQ3ZDLENBQUM7UUFDRCxNQUFNLENBQUMsSUFBSSxDQUFDLE9BQU8sQ0FBQTtJQUN2QixDQUFDO0lBRUQ7O09BRUc7SUFDSCxRQUFRLENBQUMsR0FBRyxJQUF1QjtJQUVuQyxDQUFDO0NBQ0o7QUF0REQsZ0NBc0RDIn0=
|
@ -24,14 +24,14 @@
|
||||
"homepage": "https://gitlab.com/pushrocks/smartsystem#README",
|
||||
"dependencies": {
|
||||
"@types/q": "0.0.32",
|
||||
"lik": "^1.0.24",
|
||||
"lik": "^1.0.27",
|
||||
"q": "^1.4.1",
|
||||
"systemjs": "^0.19.39",
|
||||
"systemjs": "^0.19.41",
|
||||
"typings-global": "^1.0.14"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/should": "^8.1.30",
|
||||
"should": "^11.1.1",
|
||||
"should": "^11.1.2",
|
||||
"typings-test": "^1.0.3"
|
||||
}
|
||||
}
|
||||
|
@ -3,11 +3,11 @@ require("typings-test");
|
||||
const smartsystem = require("../dist/index");
|
||||
describe('smartsystem', function () {
|
||||
it('should load a module lazily', function (done) {
|
||||
let lazyModuleExample = new smartsystem.LazyModule('./test/moduleExample.js');
|
||||
let lazyModuleExample = new smartsystem.LazyModule('../test/moduleExample.js', __dirname);
|
||||
lazyModuleExample.load().then(m => {
|
||||
console.log(m.exportedTestBoolean);
|
||||
done();
|
||||
});
|
||||
});
|
||||
});
|
||||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9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UIsQ0FBQyxDQUFBO1lBQ2xDLElBQUksRUFBRSxDQUFBO1FBQ1YsQ0FBQyxDQUFDLENBQUE7SUFDTixDQUFDLENBQUMsQ0FBQTtBQUNOLENBQUMsQ0FBQyxDQUFBIn0=
|
@ -6,7 +6,7 @@ import * as _moduleExample from './moduleExample'
|
||||
|
||||
describe('smartsystem', function () {
|
||||
it('should load a module lazily', function (done) {
|
||||
let lazyModuleExample = new smartsystem.LazyModule<typeof _moduleExample>('./test/moduleExample.js')
|
||||
let lazyModuleExample = new smartsystem.LazyModule<typeof _moduleExample>('../test/moduleExample.js',__dirname)
|
||||
|
||||
lazyModuleExample.load().then(m => {
|
||||
console.log(m.exportedTestBoolean)
|
||||
|
@ -31,7 +31,10 @@ export class LazyModule<T> {
|
||||
whenLoaded: q.Promise<T>
|
||||
loader: TLoader = 'npm'
|
||||
private whenLoadedDeferred: q.Deferred<T>
|
||||
constructor(nameArg: string, cwdArg: string = process.cwd()) {
|
||||
constructor(nameArg: string, cwdArg: string) {
|
||||
if (!cwdArg) {
|
||||
throw new Error('You must specify a directory to resolve from!')
|
||||
}
|
||||
this.name = nameArg
|
||||
this.cwd = cwdArg
|
||||
smartsystem.addLazyModule(this) // add module to smartsystem instance
|
||||
|
Loading…
Reference in New Issue
Block a user