add keywords, add better path resolution

This commit is contained in:
Philipp Kunz 2016-10-12 15:41:09 +02:00
parent 46693c4bef
commit ecaaaee54a
3 changed files with 15 additions and 2 deletions

6
dist/index.js vendored
View File

@ -1,5 +1,6 @@
"use strict"; "use strict";
require("typings-global"); require("typings-global");
const path = require("path");
const q = require("q"); const q = require("q");
const lik_1 = require("lik"); const lik_1 = require("lik");
let systemjs = require('systemjs'); let systemjs = require('systemjs');
@ -25,6 +26,9 @@ class LazyModule {
this.cwd = cwdArg; this.cwd = cwdArg;
smartsystem.addLazyModule(this); // add module to smartsystem instance smartsystem.addLazyModule(this); // add module to smartsystem instance
this.nameIsPath = /\.\//.test(this.name); // figure out if name is path this.nameIsPath = /\.\//.test(this.name); // figure out if name is path
if (this.nameIsPath) {
this.name = path.join(this.cwd, this.name);
}
this.whenLoadedDeferred = q.defer(); this.whenLoadedDeferred = q.defer();
this.whenLoaded = this.whenLoadedDeferred.promise; this.whenLoaded = this.whenLoadedDeferred.promise;
} }
@ -48,4 +52,4 @@ class LazyModule {
} }
} }
exports.LazyModule = LazyModule; exports.LazyModule = LazyModule;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBQUEsMEJBQXVCO0FBRXZCLHVCQUFzQjtBQUN0Qiw2QkFBK0I7QUFDL0IsSUFBSSxRQUFRLEdBQUcsT0FBTyxDQUFDLFVBQVUsQ0FBQyxDQUFBO0FBRWxDO0lBQUE7UUFDSSxnQkFBVyxHQUFHLElBQUksZUFBUyxFQUFtQixDQUFBO0lBUWxELENBQUM7SUFORzs7T0FFRztJQUNILGFBQWEsQ0FBQyxhQUE4QjtRQUN4QyxJQUFJLENBQUMsV0FBVyxDQUFDLEdBQUcsQ0FBQyxhQUFhLENBQUMsQ0FBQTtJQUN2QyxDQUFDO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LENBQUMsR0FBRyxJQUF1QjtJQUVuQyxDQUFDO0NBQ0o7QUF0Q0QsZ0NBc0NDIn0=

View File

@ -1,7 +1,7 @@
{ {
"name": "smartsystem", "name": "smartsystem",
"version": "1.0.4", "version": "1.0.4",
"description": "wraps systemjs for smarter workflows", "description": "simplifies lazy loading with TypeScript",
"main": "dist/index.js", "main": "dist/index.js",
"typings": "dist/index.d.ts", "typings": "dist/index.d.ts",
"scripts": { "scripts": {
@ -11,6 +11,11 @@
"type": "git", "type": "git",
"url": "git+ssh://git@gitlab.com/pushrocks/smartsystem.git" "url": "git+ssh://git@gitlab.com/pushrocks/smartsystem.git"
}, },
"keywords": [
"TypeScript",
"lazy",
"module loader"
],
"author": "Lossless GmbH", "author": "Lossless GmbH",
"license": "MIT", "license": "MIT",
"bugs": { "bugs": {

View File

@ -1,5 +1,6 @@
import 'typings-global' import 'typings-global'
import * as path from 'path'
import * as q from 'q' import * as q from 'q'
import { Objectmap } from 'lik' import { Objectmap } from 'lik'
let systemjs = require('systemjs') let systemjs = require('systemjs')
@ -32,6 +33,9 @@ export class LazyModule<T> {
this.cwd = cwdArg this.cwd = cwdArg
smartsystem.addLazyModule(this) // add module to smartsystem instance smartsystem.addLazyModule(this) // add module to smartsystem instance
this.nameIsPath = /\.\//.test(this.name) // figure out if name is path this.nameIsPath = /\.\//.test(this.name) // figure out if name is path
if (this.nameIsPath) {
this.name = path.join(this.cwd,this.name)
}
this.whenLoadedDeferred = q.defer<T>() this.whenLoadedDeferred = q.defer<T>()
this.whenLoaded = this.whenLoadedDeferred.promise this.whenLoaded = this.whenLoadedDeferred.promise
} }