typings-core
Advanced tools
Comparing version 0.2.5 to 0.2.6
import Promise = require('any-promise'); | ||
import { Options as CompileOptions, CompiledOutput } from './lib/compile'; | ||
import { DependencyTree, Emitter, DependencyExpression } from './interfaces'; | ||
import { DependencyTree, Emitter } from './interfaces'; | ||
export interface InstallDependencyOptions { | ||
@@ -21,3 +21,7 @@ save?: boolean; | ||
export declare function installDependencyRaw(raw: string, options: InstallDependencyOptions): Promise<CompiledOutput>; | ||
export declare function installDependency(expression: DependencyExpression, options: InstallDependencyOptions): Promise<CompiledOutput>; | ||
export interface InstallExpression { | ||
name: string; | ||
location: string; | ||
} | ||
export declare function installDependency(expression: InstallExpression, options: InstallDependencyOptions): Promise<CompiledOutput>; | ||
export declare function writeDependency(output: CompiledOutput, options: CompileOptions): Promise<CompiledOutput>; |
@@ -50,3 +50,3 @@ "use strict"; | ||
return new Promise(function (resolve) { | ||
return resolve(installDependency(parse_1.parseDependencyRaw(raw, options), options)); | ||
return resolve(installDependency(parse_1.parseDependencyExpression(raw, options), options)); | ||
}); | ||
@@ -61,3 +61,3 @@ } | ||
function installTo(expression, options) { | ||
var dependency = expression.dependency; | ||
var dependency = parse_1.parseDependency(expression.location); | ||
var cwd = options.cwd, ambient = options.ambient; | ||
@@ -67,3 +67,3 @@ var emitter = options.emitter || new events_1.EventEmitter(); | ||
.then(function (tree) { | ||
var name = expression.name || tree.name; | ||
var name = expression.name || tree.name || dependency.meta.name; | ||
if (!name) { | ||
@@ -70,0 +70,0 @@ return Promise.reject(new TypeError("Unable to install dependency from \"" + tree.raw + "\" without a name")); |
@@ -32,8 +32,13 @@ import { EventEmitter } from 'events'; | ||
location: string; | ||
meta: any; | ||
meta: { | ||
name?: string; | ||
path?: string; | ||
org?: string; | ||
repo?: string; | ||
sha?: string; | ||
version?: string; | ||
tag?: string; | ||
source?: string; | ||
}; | ||
} | ||
export interface DependencyExpression { | ||
name: string; | ||
dependency: Dependency; | ||
} | ||
export interface DependencyTree { | ||
@@ -40,0 +45,0 @@ name?: string; |
@@ -1,9 +0,12 @@ | ||
import { Dependency, DependencyExpression } from '../interfaces'; | ||
import { Dependency } from '../interfaces'; | ||
export declare function parseDependency(raw: string): Dependency; | ||
export declare function resolveDependency(raw: string, path: string): string; | ||
export declare function parseDependencyRaw(raw: string, options: { | ||
export declare function parseDependencyExpression(raw: string, options: { | ||
ambient?: boolean; | ||
}): DependencyExpression; | ||
export declare function parseRegistryRaw(raw: string, options: { | ||
}): { | ||
name: string; | ||
location: string; | ||
}; | ||
export declare function expandRegistry(raw: string, options?: { | ||
ambient?: boolean; | ||
}): Dependency; | ||
}): string; |
@@ -158,13 +158,13 @@ "use strict"; | ||
exports.resolveDependency = resolveDependency; | ||
function parseDependencyRaw(raw, options) { | ||
var _a = /^(?:([^=!:#]+)=)?(?:([\w]+\:.+)|((?:[\w]+\!)?.+))$/.exec(raw), overrideName = _a[1], scheme = _a[2], registry = _a[3]; | ||
var dependency = scheme ? parseDependency(scheme) : parseRegistryRaw(registry, options); | ||
var name = overrideName || dependency.meta.name; | ||
function parseDependencyExpression(raw, options) { | ||
var _a = /^(?:([^=!:#]+)=)?(?:([\w]+\:.+)|((?:[\w]+\!)?.+))$/.exec(raw), name = _a[1], scheme = _a[2], registry = _a[3]; | ||
var location = scheme || expandRegistry(registry, options); | ||
return { | ||
name: name, | ||
dependency: dependency | ||
location: location | ||
}; | ||
} | ||
exports.parseDependencyRaw = parseDependencyRaw; | ||
function parseRegistryRaw(raw, options) { | ||
exports.parseDependencyExpression = parseDependencyExpression; | ||
function expandRegistry(raw, options) { | ||
if (options === void 0) { options = {}; } | ||
if (typeof raw !== 'string') { | ||
@@ -183,5 +183,5 @@ throw new TypeError("Expected registry name to be a string, not " + typeof raw); | ||
} | ||
return parseDependency("registry:" + source + "/" + name); | ||
return "registry:" + source + "/" + name; | ||
} | ||
exports.parseRegistryRaw = parseRegistryRaw; | ||
exports.expandRegistry = expandRegistry; | ||
//# sourceMappingURL=parse.js.map |
@@ -10,3 +10,3 @@ "use strict"; | ||
return new Promise(function (resolve) { | ||
var meta = parse_1.parseRegistryRaw(raw, options).meta; | ||
var meta = parse_1.parseDependency(parse_1.expandRegistry(raw, options)).meta; | ||
var path = "entries/" + encodeURIComponent(meta.source) + "/" + encodeURIComponent(meta.name); | ||
@@ -20,3 +20,3 @@ return resolve(fs_1.readJsonFrom(url_1.resolve(rc_1.default.registryURL, path))); | ||
return new Promise(function (resolve) { | ||
var meta = parse_1.parseRegistryRaw(raw, options).meta; | ||
var meta = parse_1.parseDependency(parse_1.expandRegistry(raw, options)).meta; | ||
var path = "entries/" + encodeURIComponent(meta.source) + "/" + encodeURIComponent(meta.name) + "/versions"; | ||
@@ -23,0 +23,0 @@ if (meta.version) { |
{ | ||
"name": "typings-core", | ||
"version": "0.2.5", | ||
"version": "0.2.6", | ||
"description": "The logic of Typings", | ||
@@ -14,3 +14,3 @@ "main": "dist/typings.js", | ||
"build": "rm -rf dist/ && tsc", | ||
"dependency-check": "dependency-check . --unused --no-dev -i bluebird", | ||
"dependency-check": "dependency-check . --unused --no-dev && dependency-check . --missing --no-dev", | ||
"test-spec": "ts-node node_modules/blue-tape/bin/blue-tape.js \"src/**/*.spec.ts\" | tap-diff", | ||
@@ -48,3 +48,2 @@ "test-cov": "ts-node node_modules/istanbul/lib/cli.js cover -e .ts --print none -x \"*.d.ts\" -x \"*.spec.ts\" blue-tape -- \"src/**/*.spec.ts\" | tap-diff", | ||
"array-uniq": "^1.0.2", | ||
"bluebird": "^3.1.1", | ||
"configstore": "^2.0.0", | ||
@@ -80,2 +79,3 @@ "debug": "^2.2.0", | ||
"blue-tape": "^0.2.0", | ||
"bluebird": "^3.3.4", | ||
"dependency-check": "^2.5.1", | ||
@@ -82,0 +82,0 @@ "istanbul": "1.0.0-alpha.2", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
163286
29
2144
8
- Removedbluebird@^3.1.1
- Removedbluebird@3.7.2(transitive)