Template Upload
This commit is contained in:
21
node_modules/typings-core/LICENSE
generated
vendored
Normal file
21
node_modules/typings-core/LICENSE
generated
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2015 Blake Embrey (hello@blakeembrey.com)
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
46
node_modules/typings-core/README.md
generated
vendored
Normal file
46
node_modules/typings-core/README.md
generated
vendored
Normal file
@ -0,0 +1,46 @@
|
||||
# Typings Core
|
||||
|
||||
[![NPM version][npm-image]][npm-url]
|
||||
[![NPM downloads][downloads-image]][downloads-url]
|
||||
[![Travis status][travis-image]][travis-url]
|
||||
[![Appveyor status][appveyor-image]][appveyor-url]
|
||||
[![Test coverage][coveralls-image]][coveralls-url]
|
||||
|
||||
> The core logic for Typings.
|
||||
|
||||
## Usage
|
||||
|
||||
```ts
|
||||
import * as typings from 'typings-core'
|
||||
```
|
||||
|
||||
## Contributing
|
||||
|
||||
```sh
|
||||
# Installation
|
||||
# Fork this repo (https://github.com/typings/core)
|
||||
# Clone the fork (E.g. `https://github.com/<your_username>/core.git`)
|
||||
cd core
|
||||
npm run bootstrap
|
||||
|
||||
# Build
|
||||
npm run build
|
||||
|
||||
# Test
|
||||
npm run test
|
||||
```
|
||||
|
||||
## License
|
||||
|
||||
MIT
|
||||
|
||||
[npm-image]: https://img.shields.io/npm/v/typings-core.svg?style=flat
|
||||
[npm-url]: https://npmjs.org/package/typings-core
|
||||
[downloads-image]: https://img.shields.io/npm/dm/typings-core.svg?style=flat
|
||||
[downloads-url]: https://npmjs.org/package/typings-core
|
||||
[travis-image]: https://img.shields.io/travis/typings/core.svg?style=flat
|
||||
[travis-url]: https://travis-ci.org/typings/core
|
||||
[coveralls-image]: https://img.shields.io/coveralls/typings/core.svg?style=flat
|
||||
[coveralls-url]: https://coveralls.io/r/typings/core?branch=master
|
||||
[appveyor-image]: https://ci.appveyor.com/api/projects/status/32r7s2skrgm9ubva/branch/master?svg=true
|
||||
[appveyor-url]: https://ci.appveyor.com/project/blakeembrey/core/branch/master
|
11
node_modules/typings-core/dist/bundle.d.ts
generated
vendored
Normal file
11
node_modules/typings-core/dist/bundle.d.ts
generated
vendored
Normal file
@ -0,0 +1,11 @@
|
||||
import Promise = require('any-promise');
|
||||
import { CompiledOutput } from './lib/compile';
|
||||
import { Emitter } from './interfaces';
|
||||
export interface BundleOptions {
|
||||
name?: string;
|
||||
cwd: string;
|
||||
ambient?: boolean;
|
||||
out: string;
|
||||
emitter?: Emitter;
|
||||
}
|
||||
export declare function bundle(options: BundleOptions): Promise<CompiledOutput>;
|
35
node_modules/typings-core/dist/bundle.js
generated
vendored
Normal file
35
node_modules/typings-core/dist/bundle.js
generated
vendored
Normal file
@ -0,0 +1,35 @@
|
||||
"use strict";
|
||||
var Promise = require('any-promise');
|
||||
var path_1 = require('path');
|
||||
var events_1 = require('events');
|
||||
var dependencies_1 = require('./lib/dependencies');
|
||||
var compile_1 = require('./lib/compile');
|
||||
var fs_1 = require('./utils/fs');
|
||||
function bundle(options) {
|
||||
var cwd = options.cwd, ambient = options.ambient, out = options.out;
|
||||
var emitter = options.emitter || new events_1.EventEmitter();
|
||||
if (out == null) {
|
||||
return Promise.reject(new TypeError('Out directory is required for bundle'));
|
||||
}
|
||||
return dependencies_1.resolveAllDependencies({ cwd: cwd, dev: false, ambient: false, emitter: emitter })
|
||||
.then(function (tree) {
|
||||
var name = options.name || tree.name;
|
||||
if (name == null) {
|
||||
return Promise.reject(new TypeError('Unable to infer typings name from project. Use the `--name` flag to specify it manually'));
|
||||
}
|
||||
return compile_1.default(tree, { cwd: cwd, name: name, ambient: ambient, emitter: emitter, meta: true });
|
||||
})
|
||||
.then(function (output) {
|
||||
var path = path_1.resolve(cwd, out);
|
||||
return fs_1.mkdirp(path)
|
||||
.then(function () {
|
||||
return Promise.all([
|
||||
fs_1.writeFile(path_1.join(path, 'main.d.ts'), output.main),
|
||||
fs_1.writeFile(path_1.join(path, 'browser.d.ts'), output.browser)
|
||||
]);
|
||||
})
|
||||
.then(function () { return output; });
|
||||
});
|
||||
}
|
||||
exports.bundle = bundle;
|
||||
//# sourceMappingURL=bundle.js.map
|
1
node_modules/typings-core/dist/bundle.js.map
generated
vendored
Normal file
1
node_modules/typings-core/dist/bundle.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"bundle.js","sourceRoot":"","sources":["../src/bundle.ts"],"names":[],"mappings":";AAAA,IAAO,OAAO,WAAW,aAAa,CAAC,CAAA;AACvC,qBAA8B,MAC9B,CAAC,CADmC;AACpC,uBAA6B,QAC7B,CAAC,CADoC;AACrC,6BAAuC,oBACvC,CAAC,CAD0D;AAC3D,wBAAwC,eACxC,CAAC,CADsD;AACvD,mBAAkC,YAClC,CAAC,CAD6C;AAiB9C,gBAAwB,OAAsB;IACpC,qBAAG,EAAE,yBAAO,EAAE,iBAAG,CAAY;IACrC,IAAM,OAAO,GAAG,OAAO,CAAC,OAAO,IAAI,IAAI,qBAAY,EAAE,CAAA;IAErD,EAAE,CAAC,CAAC,GAAG,IAAI,IAAI,CAAC,CAAC,CAAC;QAChB,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,SAAS,CAAC,sCAAsC,CAAC,CAAC,CAAA;IAC9E,CAAC;IAED,MAAM,CAAC,qCAAsB,CAAC,EAAE,KAAA,GAAG,EAAE,GAAG,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,SAAA,OAAO,EAAE,CAAC;SACxE,IAAI,CAAC,UAAA,IAAI;QACR,IAAM,IAAI,GAAG,OAAO,CAAC,IAAI,IAAI,IAAI,CAAC,IAAI,CAAA;QAEtC,EAAE,CAAC,CAAC,IAAI,IAAI,IAAI,CAAC,CAAC,CAAC;YACjB,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,SAAS,CACjC,yFAAyF,CAC1F,CAAC,CAAA;QACJ,CAAC;QAED,MAAM,CAAC,iBAAO,CAAC,IAAI,EAAE,EAAE,KAAA,GAAG,EAAE,MAAA,IAAI,EAAE,SAAA,OAAO,EAAE,SAAA,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAA;IACnE,CAAC,CAAC;SACD,IAAI,CAAC,UAAC,MAAsB;QAC3B,IAAM,IAAI,GAAG,cAAO,CAAC,GAAG,EAAE,GAAG,CAAC,CAAA;QAE9B,MAAM,CAAC,WAAM,CAAC,IAAI,CAAC;aAChB,IAAI,CAAC;YACJ,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC;gBACjB,cAAS,CAAC,WAAI,CAAC,IAAI,EAAE,WAAW,CAAC,EAAE,MAAM,CAAC,IAAI,CAAC;gBAC/C,cAAS,CAAC,WAAI,CAAC,IAAI,EAAE,cAAc,CAAC,EAAE,MAAM,CAAC,OAAO,CAAC;aACtD,CAAC,CAAA;QACJ,CAAC,CAAC;aACD,IAAI,CAAC,cAAM,OAAA,MAAM,EAAN,CAAM,CAAC,CAAA;IACvB,CAAC,CAAC,CAAA;AACN,CAAC;AAhCe,cAAM,SAgCrB,CAAA"}
|
9
node_modules/typings-core/dist/init.d.ts
generated
vendored
Normal file
9
node_modules/typings-core/dist/init.d.ts
generated
vendored
Normal file
@ -0,0 +1,9 @@
|
||||
import Promise = require('any-promise');
|
||||
export interface InitOptions {
|
||||
cwd: string;
|
||||
name?: string;
|
||||
main?: string;
|
||||
version?: string;
|
||||
upgrade?: boolean;
|
||||
}
|
||||
export declare function init(options: InitOptions): Promise<void>;
|
72
node_modules/typings-core/dist/init.js
generated
vendored
Normal file
72
node_modules/typings-core/dist/init.js
generated
vendored
Normal file
@ -0,0 +1,72 @@
|
||||
"use strict";
|
||||
var Promise = require('any-promise');
|
||||
var extend = require('xtend');
|
||||
var path_1 = require('path');
|
||||
var fs_1 = require('./utils/fs');
|
||||
var config_1 = require('./utils/config');
|
||||
var TSD_JSON_FILE = 'tsd.json';
|
||||
var DEFINITELYTYPED_REPO = 'DefinitelyTyped/DefinitelyTyped';
|
||||
var OLD_DEFINITELYTYPED_REPO = 'borisyankov/DefinitelyTyped';
|
||||
var DEFAULT_CONFIG = {
|
||||
dependencies: {}
|
||||
};
|
||||
var PACKAGE_FILES = [
|
||||
'package.json',
|
||||
'bower.json'
|
||||
];
|
||||
function upgradeTsdJson(tsdJson, config) {
|
||||
var typingsJson = extend(config);
|
||||
var repo = tsdJson.repo || DEFINITELYTYPED_REPO;
|
||||
if (repo === OLD_DEFINITELYTYPED_REPO) {
|
||||
repo = DEFINITELYTYPED_REPO;
|
||||
}
|
||||
if (tsdJson.installed) {
|
||||
typingsJson.ambientDependencies = {};
|
||||
Object.keys(tsdJson.installed).forEach(function (path) {
|
||||
var dependency = tsdJson.installed[path];
|
||||
var name = path_1.basename(path, '.d.ts');
|
||||
var location = "github:" + repo + "/" + path + "#" + dependency.commit;
|
||||
typingsJson.ambientDependencies[name] = location;
|
||||
});
|
||||
}
|
||||
return typingsJson;
|
||||
}
|
||||
function upgrade(options, config) {
|
||||
return fs_1.readJson(path_1.join(options.cwd, TSD_JSON_FILE)).then(function (tsdJson) { return upgradeTsdJson(tsdJson, config); });
|
||||
}
|
||||
function getProjectName(options) {
|
||||
if (options.name) {
|
||||
return Promise.resolve(options.name);
|
||||
}
|
||||
return PACKAGE_FILES.reduce(function (promise, packageFileName) {
|
||||
return promise.then(function (name) {
|
||||
if (name != null) {
|
||||
return name;
|
||||
}
|
||||
return fs_1.readJson(path_1.join(options.cwd, packageFileName))
|
||||
.then(function (packageJson) { return packageJson.name; }, function () { return undefined; });
|
||||
});
|
||||
}, Promise.resolve(undefined));
|
||||
}
|
||||
function init(options) {
|
||||
var path = path_1.join(options.cwd, config_1.CONFIG_FILE);
|
||||
var main = options.main, version = options.version;
|
||||
return fs_1.isFile(path)
|
||||
.then(function (exists) {
|
||||
if (exists) {
|
||||
return Promise.reject(new TypeError("A " + config_1.CONFIG_FILE + " file already exists"));
|
||||
}
|
||||
})
|
||||
.then(function () { return getProjectName(options); })
|
||||
.then(function (name) {
|
||||
if (options.upgrade) {
|
||||
return upgrade(options, { name: name, main: main, version: version });
|
||||
}
|
||||
return extend({ name: name, main: main, version: version }, DEFAULT_CONFIG);
|
||||
})
|
||||
.then(function (config) {
|
||||
return fs_1.writeJson(path, config, 2);
|
||||
});
|
||||
}
|
||||
exports.init = init;
|
||||
//# sourceMappingURL=init.js.map
|
1
node_modules/typings-core/dist/init.js.map
generated
vendored
Normal file
1
node_modules/typings-core/dist/init.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"init.js","sourceRoot":"","sources":["../src/init.ts"],"names":[],"mappings":";AAAA,IAAO,OAAO,WAAW,aAAa,CAAC,CAAA;AACvC,IAAO,MAAM,WAAW,OAAO,CAAC,CAAA;AAChC,qBAA+B,MAC/B,CAAC,CADoC;AAErC,mBAA4C,YAC5C,CAAC,CADuD;AACxD,uBAA4B,gBAE5B,CAAC,CAF2C;AAE5C,IAAM,aAAa,GAAG,UAAU,CAAA;AAChC,IAAM,oBAAoB,GAAG,iCAAiC,CAAA;AAC9D,IAAM,wBAAwB,GAAG,6BAA6B,CAAA;AAgB9D,IAAM,cAAc,GAAe;IACjC,YAAY,EAAE,EAAE;CACjB,CAAA;AAsBD,IAAM,aAAa,GAAa;IAC9B,cAAc;IACd,YAAY;CACb,CAAA;AAKD,wBAAyB,OAAgB,EAAE,MAAmB;IAC5D,IAAM,WAAW,GAAG,MAAM,CAAC,MAAM,CAAC,CAAA;IAClC,IAAI,IAAI,GAAG,OAAO,CAAC,IAAI,IAAI,oBAAoB,CAAA;IAG/C,EAAE,CAAC,CAAC,IAAI,KAAK,wBAAwB,CAAC,CAAC,CAAC;QACtC,IAAI,GAAG,oBAAoB,CAAA;IAC7B,CAAC;IAGD,EAAE,CAAC,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC;QACtB,WAAW,CAAC,mBAAmB,GAAG,EAAE,CAAA;QAEpC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,OAAO,CAAC,UAAU,IAAI;YACnD,IAAM,UAAU,GAAG,OAAO,CAAC,SAAS,CAAC,IAAI,CAAC,CAAA;YAC1C,IAAM,IAAI,GAAG,eAAQ,CAAC,IAAI,EAAE,OAAO,CAAC,CAAA;YACpC,IAAM,QAAQ,GAAG,YAAU,IAAI,SAAI,IAAI,SAAI,UAAU,CAAC,MAAQ,CAAA;YAE9D,WAAW,CAAC,mBAAmB,CAAC,IAAI,CAAC,GAAG,QAAQ,CAAA;QAClD,CAAC,CAAC,CAAA;IACJ,CAAC;IAED,MAAM,CAAC,WAAW,CAAA;AACpB,CAAC;AAKD,iBAAkB,OAAoB,EAAE,MAAmB;IACzD,MAAM,CAAC,aAAQ,CAAC,WAAI,CAAC,OAAO,CAAC,GAAG,EAAE,aAAa,CAAC,CAAC,CAAC,IAAI,CAAC,UAAA,OAAO,IAAI,OAAA,cAAc,CAAC,OAAO,EAAE,MAAM,CAAC,EAA/B,CAA+B,CAAC,CAAA;AACpG,CAAC;AAKD,wBAAyB,OAAoB;IAC3C,EAAE,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;QACjB,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAA;IACtC,CAAC;IAED,MAAM,CAAC,aAAa,CAAC,MAAM,CACzB,UAAU,OAAO,EAAE,eAAe;QAChC,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,UAAU,IAAI;YAChC,EAAE,CAAC,CAAC,IAAI,IAAI,IAAI,CAAC,CAAC,CAAC;gBACjB,MAAM,CAAC,IAAI,CAAA;YACb,CAAC;YAED,MAAM,CAAC,aAAQ,CAAC,WAAI,CAAC,OAAO,CAAC,GAAG,EAAE,eAAe,CAAC,CAAC;iBAChD,IAAI,CACH,UAAC,WAAW,IAAK,OAAA,WAAW,CAAC,IAAI,EAAhB,CAAgB,EACjC,cAAM,OAAA,SAAS,EAAT,CAAS,CAChB,CAAA;QACL,CAAC,CAAC,CAAA;IACJ,CAAC,EACD,OAAO,CAAC,OAAO,CAAS,SAAS,CAAC,CACnC,CAAA;AACH,CAAC;AAKD,cAAsB,OAAoB;IACxC,IAAM,IAAI,GAAG,WAAI,CAAC,OAAO,CAAC,GAAG,EAAE,oBAAW,CAAC,CAAA;IACnC,uBAAI,EAAE,yBAAO,CAAY;IAEjC,MAAM,CAAC,WAAM,CAAC,IAAI,CAAC;SAChB,IAAI,CAAa,UAAA,MAAM;QACtB,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC;YACX,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,SAAS,CAAC,OAAK,oBAAW,yBAAsB,CAAC,CAAC,CAAA;QAC9E,CAAC;IACH,CAAC,CAAC;SACD,IAAI,CAAC,cAAM,OAAA,cAAc,CAAC,OAAO,CAAC,EAAvB,CAAuB,CAAC;SACnC,IAAI,CAAC,UAAA,IAAI;QACR,EAAE,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC;YACpB,MAAM,CAAC,OAAO,CAAC,OAAO,EAAE,EAAE,MAAA,IAAI,EAAE,MAAA,IAAI,EAAE,SAAA,OAAO,EAAE,CAAC,CAAA;QAClD,CAAC;QAED,MAAM,CAAC,MAAM,CAAC,EAAE,MAAA,IAAI,EAAE,MAAA,IAAI,EAAE,SAAA,OAAO,EAAE,EAAE,cAAc,CAAC,CAAA;IACxD,CAAC,CAAC;SACD,IAAI,CAAC,UAAU,MAAM;QACpB,MAAM,CAAC,cAAS,CAAC,IAAI,EAAE,MAAM,EAAE,CAAC,CAAC,CAAA;IACnC,CAAC,CAAC,CAAA;AACN,CAAC;AArBe,YAAI,OAqBnB,CAAA"}
|
25
node_modules/typings-core/dist/install.d.ts
generated
vendored
Normal file
25
node_modules/typings-core/dist/install.d.ts
generated
vendored
Normal file
@ -0,0 +1,25 @@
|
||||
import Promise = require('any-promise');
|
||||
import { CompiledOutput } from './lib/compile';
|
||||
import { DependencyTree, Emitter } from './interfaces';
|
||||
export interface InstallDependencyOptions {
|
||||
save?: boolean;
|
||||
saveDev?: boolean;
|
||||
savePeer?: boolean;
|
||||
ambient?: boolean;
|
||||
cwd: string;
|
||||
emitter?: Emitter;
|
||||
}
|
||||
export interface InstallOptions {
|
||||
cwd: string;
|
||||
production?: boolean;
|
||||
emitter?: Emitter;
|
||||
}
|
||||
export declare function install(options: InstallOptions): Promise<{
|
||||
tree: DependencyTree;
|
||||
}>;
|
||||
export declare function installDependencyRaw(raw: string, options: InstallDependencyOptions): Promise<CompiledOutput>;
|
||||
export interface InstallExpression {
|
||||
name: string;
|
||||
location: string;
|
||||
}
|
||||
export declare function installDependency(expression: InstallExpression, options: InstallDependencyOptions): Promise<CompiledOutput>;
|
157
node_modules/typings-core/dist/install.js
generated
vendored
Normal file
157
node_modules/typings-core/dist/install.js
generated
vendored
Normal file
@ -0,0 +1,157 @@
|
||||
"use strict";
|
||||
var extend = require('xtend');
|
||||
var Promise = require('any-promise');
|
||||
var path_1 = require('path');
|
||||
var events_1 = require('events');
|
||||
var dependencies_1 = require('./lib/dependencies');
|
||||
var compile_1 = require('./lib/compile');
|
||||
var find_1 = require('./utils/find');
|
||||
var fs_1 = require('./utils/fs');
|
||||
var path_2 = require('./utils/path');
|
||||
var parse_1 = require('./utils/parse');
|
||||
function install(options) {
|
||||
var cwd = options.cwd, production = options.production;
|
||||
var emitter = options.emitter || new events_1.EventEmitter();
|
||||
return dependencies_1.resolveTypeDependencies({ cwd: cwd, emitter: emitter, ambient: true, peer: true, dev: !production })
|
||||
.then(function (tree) {
|
||||
var cwd = path_1.dirname(tree.src);
|
||||
var queue = [];
|
||||
function addToQueue(deps, ambient) {
|
||||
for (var _i = 0, _a = Object.keys(deps); _i < _a.length; _i++) {
|
||||
var name = _a[_i];
|
||||
var tree_1 = deps[name];
|
||||
queue.push(installDependencyTree(tree_1, { cwd: cwd, name: name, ambient: ambient, emitter: emitter, meta: true }));
|
||||
}
|
||||
}
|
||||
addToQueue(tree.dependencies, false);
|
||||
addToQueue(tree.devDependencies, false);
|
||||
addToQueue(tree.peerDependencies, false);
|
||||
addToQueue(tree.ambientDependencies, true);
|
||||
addToQueue(tree.ambientDevDependencies, true);
|
||||
return Promise.all(queue)
|
||||
.then(function (installed) {
|
||||
if (installed.length === 0) {
|
||||
var _a = path_2.getTypingsLocation({ cwd: cwd }), typingsDir = _a.typingsDir, mainDtsFile_1 = _a.mainDtsFile, browserDtsFile_1 = _a.browserDtsFile;
|
||||
return fs_1.mkdirp(typingsDir)
|
||||
.then(function () {
|
||||
return Promise.all([
|
||||
fs_1.touch(mainDtsFile_1, {}),
|
||||
fs_1.touch(browserDtsFile_1, {})
|
||||
]);
|
||||
});
|
||||
}
|
||||
})
|
||||
.then(function () { return ({ tree: tree }); });
|
||||
});
|
||||
}
|
||||
exports.install = install;
|
||||
function installDependencyRaw(raw, options) {
|
||||
return new Promise(function (resolve) {
|
||||
return resolve(installDependency(parse_1.parseDependencyExpression(raw, options), options));
|
||||
});
|
||||
}
|
||||
exports.installDependencyRaw = installDependencyRaw;
|
||||
function installDependency(expression, options) {
|
||||
return find_1.findProject(options.cwd)
|
||||
.then(function (cwd) { return installTo(expression, extend(options, { cwd: cwd })); }, function () { return installTo(expression, options); });
|
||||
}
|
||||
exports.installDependency = installDependency;
|
||||
function installTo(expression, options) {
|
||||
var dependency = parse_1.parseDependency(expression.location);
|
||||
var cwd = options.cwd, ambient = options.ambient;
|
||||
var emitter = options.emitter || new events_1.EventEmitter();
|
||||
return checkTypings(dependency, options)
|
||||
.then(function () { return dependencies_1.resolveDependency(dependency, { cwd: cwd, emitter: emitter, dev: false, peer: false, ambient: false }); })
|
||||
.then(function (tree) {
|
||||
var name = expression.name || dependency.meta.name || tree.name;
|
||||
if (!name) {
|
||||
return Promise.reject(new TypeError("Unable to install dependency from \"" + tree.raw + "\" without a name"));
|
||||
}
|
||||
return installDependencyTree(tree, {
|
||||
cwd: cwd,
|
||||
name: name,
|
||||
ambient: ambient,
|
||||
emitter: emitter,
|
||||
meta: true
|
||||
})
|
||||
.then(function (result) {
|
||||
return writeToConfig(name, tree.raw, options)
|
||||
.then(function () {
|
||||
if (tree.postmessage) {
|
||||
emitter.emit('postmessage', { name: name, message: tree.postmessage });
|
||||
}
|
||||
return result;
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
function installDependencyTree(tree, options) {
|
||||
return compile_1.default(tree, options).then(function (result) { return writeDependency(result, options); });
|
||||
}
|
||||
function writeToConfig(name, raw, options) {
|
||||
if (options.save || options.saveDev || options.savePeer) {
|
||||
return fs_1.transformConfig(options.cwd, function (config) {
|
||||
if (options.save) {
|
||||
if (options.ambient) {
|
||||
config.ambientDependencies = extend(config.ambientDependencies, (_a = {}, _a[name] = raw, _a));
|
||||
}
|
||||
else {
|
||||
config.dependencies = extend(config.dependencies, (_b = {}, _b[name] = raw, _b));
|
||||
}
|
||||
}
|
||||
else if (options.saveDev) {
|
||||
if (options.ambient) {
|
||||
config.ambientDevDependencies = extend(config.ambientDevDependencies, (_c = {}, _c[name] = raw, _c));
|
||||
}
|
||||
else {
|
||||
config.devDependencies = extend(config.devDependencies, (_d = {}, _d[name] = raw, _d));
|
||||
}
|
||||
}
|
||||
else if (options.savePeer) {
|
||||
if (options.ambient) {
|
||||
return Promise.reject(new TypeError('Unable to use `savePeer` with the `ambient` flag'));
|
||||
}
|
||||
else {
|
||||
config.peerDependencies = extend(config.peerDependencies, (_e = {}, _e[name] = raw, _e));
|
||||
}
|
||||
}
|
||||
return config;
|
||||
var _a, _b, _c, _d, _e;
|
||||
});
|
||||
}
|
||||
return Promise.resolve();
|
||||
}
|
||||
function writeDependency(output, options) {
|
||||
var location = path_2.getDependencyLocation(options);
|
||||
function create(path, file, contents, dtsFile) {
|
||||
return fs_1.mkdirp(path)
|
||||
.then(function () { return fs_1.writeFile(file, contents); })
|
||||
.then(function () { return fs_1.transformDtsFile(dtsFile, function (typings) { return typings.concat([file]); }); });
|
||||
}
|
||||
return Promise.all([
|
||||
create(location.mainPath, location.mainFile, output.main, location.mainDtsFile),
|
||||
create(location.browserPath, location.browserFile, output.browser, location.browserDtsFile)
|
||||
]).then(function () { return output; });
|
||||
}
|
||||
function checkTypings(dependency, options) {
|
||||
var type = dependency.type, meta = dependency.meta;
|
||||
if (type === 'registry' && meta.source === 'npm') {
|
||||
return find_1.findUp(options.cwd, path_1.join('node_modules', meta.name, 'package.json'))
|
||||
.then(function (path) {
|
||||
return fs_1.readJson(path)
|
||||
.then(function (packageJson) {
|
||||
if (packageJson && typeof packageJson.typings === 'string') {
|
||||
options.emitter.emit('hastypings', {
|
||||
name: meta.name,
|
||||
source: meta.source,
|
||||
path: path,
|
||||
typings: path_2.resolveFrom(path, packageJson.typings)
|
||||
});
|
||||
}
|
||||
});
|
||||
})
|
||||
.catch(function (err) { return undefined; });
|
||||
}
|
||||
return Promise.resolve();
|
||||
}
|
||||
//# sourceMappingURL=install.js.map
|
1
node_modules/typings-core/dist/install.js.map
generated
vendored
Normal file
1
node_modules/typings-core/dist/install.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
4
node_modules/typings-core/dist/interfaces.d.ts
generated
vendored
Normal file
4
node_modules/typings-core/dist/interfaces.d.ts
generated
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
export * from './interfaces/config';
|
||||
export * from './interfaces/rc';
|
||||
export * from './interfaces/emitter';
|
||||
export * from './interfaces/dependencies';
|
2
node_modules/typings-core/dist/interfaces.js
generated
vendored
Normal file
2
node_modules/typings-core/dist/interfaces.js
generated
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
"use strict";
|
||||
//# sourceMappingURL=interfaces.js.map
|
1
node_modules/typings-core/dist/interfaces.js.map
generated
vendored
Normal file
1
node_modules/typings-core/dist/interfaces.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../src/interfaces.ts"],"names":[],"mappings":";AAGyC"}
|
22
node_modules/typings-core/dist/interfaces/config.d.ts
generated
vendored
Normal file
22
node_modules/typings-core/dist/interfaces/config.d.ts
generated
vendored
Normal file
@ -0,0 +1,22 @@
|
||||
export interface ConfigJson {
|
||||
main?: string;
|
||||
browser?: Browser;
|
||||
version?: string;
|
||||
files?: string[];
|
||||
ambient?: boolean;
|
||||
postmessage?: string;
|
||||
name?: string;
|
||||
dependencies?: Dependencies;
|
||||
devDependencies?: Dependencies;
|
||||
peerDependencies?: Dependencies;
|
||||
ambientDependencies?: Dependencies;
|
||||
ambientDevDependencies?: Dependencies;
|
||||
}
|
||||
export declare type DependencyString = string;
|
||||
export declare type Browser = string | Overrides;
|
||||
export interface Overrides {
|
||||
[dependency: string]: string;
|
||||
}
|
||||
export interface Dependencies {
|
||||
[name: string]: DependencyString;
|
||||
}
|
2
node_modules/typings-core/dist/interfaces/config.js
generated
vendored
Normal file
2
node_modules/typings-core/dist/interfaces/config.js
generated
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
"use strict";
|
||||
//# sourceMappingURL=config.js.map
|
1
node_modules/typings-core/dist/interfaces/config.js.map
generated
vendored
Normal file
1
node_modules/typings-core/dist/interfaces/config.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/interfaces/config.ts"],"names":[],"mappings":""}
|
38
node_modules/typings-core/dist/interfaces/dependencies.d.ts
generated
vendored
Normal file
38
node_modules/typings-core/dist/interfaces/dependencies.d.ts
generated
vendored
Normal file
@ -0,0 +1,38 @@
|
||||
import { Browser } from './config';
|
||||
export interface Dependency {
|
||||
type: string;
|
||||
raw: string;
|
||||
location: string;
|
||||
meta: {
|
||||
name?: string;
|
||||
path?: string;
|
||||
org?: string;
|
||||
repo?: string;
|
||||
sha?: string;
|
||||
version?: string;
|
||||
tag?: string;
|
||||
source?: string;
|
||||
};
|
||||
}
|
||||
export interface DependencyTree {
|
||||
name?: string;
|
||||
version?: string;
|
||||
main?: string;
|
||||
browser?: Browser;
|
||||
typings?: string;
|
||||
browserTypings?: Browser;
|
||||
parent?: DependencyTree;
|
||||
files?: string[];
|
||||
postmessage?: string;
|
||||
src: string;
|
||||
raw: string;
|
||||
ambient: boolean;
|
||||
dependencies: DependencyBranch;
|
||||
devDependencies: DependencyBranch;
|
||||
peerDependencies: DependencyBranch;
|
||||
ambientDependencies: DependencyBranch;
|
||||
ambientDevDependencies: DependencyBranch;
|
||||
}
|
||||
export interface DependencyBranch {
|
||||
[name: string]: DependencyTree;
|
||||
}
|
2
node_modules/typings-core/dist/interfaces/dependencies.js
generated
vendored
Normal file
2
node_modules/typings-core/dist/interfaces/dependencies.js
generated
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
"use strict";
|
||||
//# sourceMappingURL=dependencies.js.map
|
1
node_modules/typings-core/dist/interfaces/dependencies.js.map
generated
vendored
Normal file
1
node_modules/typings-core/dist/interfaces/dependencies.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"dependencies.js","sourceRoot":"","sources":["../../src/interfaces/dependencies.ts"],"names":[],"mappings":""}
|
81
node_modules/typings-core/dist/interfaces/emitter.d.ts
generated
vendored
Normal file
81
node_modules/typings-core/dist/interfaces/emitter.d.ts
generated
vendored
Normal file
@ -0,0 +1,81 @@
|
||||
import { EventEmitter } from 'events';
|
||||
import { Dependencies } from './config';
|
||||
import { DependencyTree } from './dependencies';
|
||||
export interface Emitter extends EventEmitter {
|
||||
on(event: 'reference', listener: (e: ReferenceEvent) => any): this;
|
||||
on(event: 'resolve', listener: (e: ResolveEvent) => any): this;
|
||||
on(event: 'resolved', listener: (e: ResolvedEvent) => any): this;
|
||||
on(event: 'enoent', listener: (e: EnoentEvent) => any): this;
|
||||
on(event: 'compile', listener: (e: CompileEvent) => any): this;
|
||||
on(event: 'compiled', listener: (e: CompiledEvent) => any): this;
|
||||
on(event: 'hastypings', listener: (e: HasTypingsEvent) => any): this;
|
||||
on(event: 'postmessage', listener: (e: PostMessageEvent) => any): this;
|
||||
on(event: 'ambientdependencies', listener: (e: AmbientDependenciesEvent) => any): this;
|
||||
on(event: 'badlocation', listener: (e: BadLocationEvent) => any): this;
|
||||
on(event: 'deprecated', listener: (e: DeprecatedEvent) => any): this;
|
||||
on(event: string, listener: Function): this;
|
||||
emit(event: 'reference', e: ReferenceEvent): boolean;
|
||||
emit(event: 'resolve', e: ResolveEvent): boolean;
|
||||
emit(event: 'resolved', e: ResolvedEvent): boolean;
|
||||
emit(event: 'enoent', e: EnoentEvent): boolean;
|
||||
emit(event: 'compile', e: CompileEvent): boolean;
|
||||
emit(event: 'compiled', e: CompiledEvent): boolean;
|
||||
emit(event: 'hastypings', e: HasTypingsEvent): boolean;
|
||||
emit(event: 'postmessage', e: PostMessageEvent): boolean;
|
||||
emit(event: 'ambientdependencies', e: AmbientDependenciesEvent): boolean;
|
||||
emit(event: 'badlocation', e: BadLocationEvent): boolean;
|
||||
emit(event: 'deprecated', e: DeprecatedEvent): boolean;
|
||||
emit(event: string, ...args: any[]): boolean;
|
||||
}
|
||||
export interface ReferenceEvent {
|
||||
name: string;
|
||||
path: string;
|
||||
tree: DependencyTree;
|
||||
browser: boolean;
|
||||
reference: string;
|
||||
}
|
||||
export interface ResolveEvent {
|
||||
src: string;
|
||||
raw: string;
|
||||
parent?: DependencyTree;
|
||||
}
|
||||
export interface ResolvedEvent extends ResolveEvent {
|
||||
tree: DependencyTree;
|
||||
}
|
||||
export interface EnoentEvent {
|
||||
path: string;
|
||||
}
|
||||
export interface CompileEvent {
|
||||
name: string;
|
||||
path: string;
|
||||
tree: DependencyTree;
|
||||
browser: boolean;
|
||||
}
|
||||
export interface CompiledEvent extends CompileEvent {
|
||||
contents: string;
|
||||
}
|
||||
export interface HasTypingsEvent {
|
||||
source: string;
|
||||
name: string;
|
||||
path: string;
|
||||
typings: string;
|
||||
}
|
||||
export interface PostMessageEvent {
|
||||
name: string;
|
||||
message: string;
|
||||
}
|
||||
export interface AmbientDependenciesEvent {
|
||||
name: string;
|
||||
raw: string;
|
||||
dependencies: Dependencies;
|
||||
}
|
||||
export interface BadLocationEvent {
|
||||
type: string;
|
||||
raw: string;
|
||||
location: string;
|
||||
}
|
||||
export interface DeprecatedEvent {
|
||||
raw: string;
|
||||
date: Date;
|
||||
parent: DependencyTree;
|
||||
}
|
2
node_modules/typings-core/dist/interfaces/emitter.js
generated
vendored
Normal file
2
node_modules/typings-core/dist/interfaces/emitter.js
generated
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
"use strict";
|
||||
//# sourceMappingURL=emitter.js.map
|
1
node_modules/typings-core/dist/interfaces/emitter.js.map
generated
vendored
Normal file
1
node_modules/typings-core/dist/interfaces/emitter.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"emitter.js","sourceRoot":"","sources":["../../src/interfaces/emitter.ts"],"names":[],"mappings":""}
|
15
node_modules/typings-core/dist/interfaces/rc.d.ts
generated
vendored
Normal file
15
node_modules/typings-core/dist/interfaces/rc.d.ts
generated
vendored
Normal file
@ -0,0 +1,15 @@
|
||||
export interface RcConfig {
|
||||
proxy?: string;
|
||||
httpProxy?: string;
|
||||
httpsProxy?: string;
|
||||
noProxy?: string;
|
||||
rejectUnauthorized?: boolean;
|
||||
ca?: string | string[];
|
||||
key?: string;
|
||||
cert?: string;
|
||||
userAgent?: string;
|
||||
githubToken?: string;
|
||||
registryURL?: string;
|
||||
defaultSource?: string;
|
||||
defaultAmbientSource?: string;
|
||||
}
|
2
node_modules/typings-core/dist/interfaces/rc.js
generated
vendored
Normal file
2
node_modules/typings-core/dist/interfaces/rc.js
generated
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
"use strict";
|
||||
//# sourceMappingURL=rc.js.map
|
1
node_modules/typings-core/dist/interfaces/rc.js.map
generated
vendored
Normal file
1
node_modules/typings-core/dist/interfaces/rc.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"rc.js","sourceRoot":"","sources":["../../src/interfaces/rc.ts"],"names":[],"mappings":""}
|
16
node_modules/typings-core/dist/lib/compile.d.ts
generated
vendored
Normal file
16
node_modules/typings-core/dist/lib/compile.d.ts
generated
vendored
Normal file
@ -0,0 +1,16 @@
|
||||
import Promise = require('any-promise');
|
||||
import { DependencyTree, Emitter } from '../interfaces';
|
||||
export interface Options {
|
||||
cwd: string;
|
||||
name: string;
|
||||
ambient: boolean;
|
||||
meta: boolean;
|
||||
emitter: Emitter;
|
||||
}
|
||||
export interface CompiledOutput {
|
||||
name: string;
|
||||
tree: DependencyTree;
|
||||
main: string;
|
||||
browser: string;
|
||||
}
|
||||
export default function compile(tree: DependencyTree, options: Options): Promise<CompiledOutput>;
|
365
node_modules/typings-core/dist/lib/compile.js
generated
vendored
Normal file
365
node_modules/typings-core/dist/lib/compile.js
generated
vendored
Normal file
@ -0,0 +1,365 @@
|
||||
"use strict";
|
||||
var ts = require('typescript');
|
||||
var extend = require('xtend');
|
||||
var has = require('has');
|
||||
var Promise = require('any-promise');
|
||||
var path_1 = require('path');
|
||||
var fs_1 = require('../utils/fs');
|
||||
var path_2 = require('../utils/path');
|
||||
var path_3 = require('../utils/path');
|
||||
var references_1 = require('../utils/references');
|
||||
var config_1 = require('../utils/config');
|
||||
var error_1 = require('./error');
|
||||
function compile(tree, options) {
|
||||
var name = options.name;
|
||||
var readFiles = {};
|
||||
if (tree.ambient && !options.ambient) {
|
||||
return Promise.reject(new error_1.default(("Unable to compile \"" + options.name + "\", the typings are meant to be installed as ") +
|
||||
"ambient but attempted to be compiled as an external module"));
|
||||
}
|
||||
return Promise.all([
|
||||
compileDependencyTree(tree, extend(options, {
|
||||
browser: false,
|
||||
readFiles: readFiles,
|
||||
imported: {}
|
||||
})),
|
||||
compileDependencyTree(tree, extend(options, {
|
||||
browser: true,
|
||||
readFiles: readFiles,
|
||||
imported: {}
|
||||
}))
|
||||
])
|
||||
.then(function (_a) {
|
||||
var main = _a[0], browser = _a[1];
|
||||
return {
|
||||
name: name,
|
||||
tree: tree,
|
||||
main: main,
|
||||
browser: browser
|
||||
};
|
||||
});
|
||||
}
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.default = compile;
|
||||
function resolveFromOverride(src, to, tree) {
|
||||
if (typeof to === 'string') {
|
||||
if (path_3.isModuleName(to)) {
|
||||
var _a = getModuleNameParts(to, tree), moduleName = _a[0], modulePath = _a[1];
|
||||
return modulePath ? path_3.normalizeToDefinition(to) : moduleName;
|
||||
}
|
||||
return path_3.resolveFrom(src, path_3.normalizeToDefinition(to));
|
||||
}
|
||||
return to ? src : undefined;
|
||||
}
|
||||
function resolveFromWithModuleName(src, to, tree) {
|
||||
if (path_3.isModuleName(to)) {
|
||||
var _a = getModuleNameParts(to, tree), moduleName = _a[0], modulePath = _a[1];
|
||||
return modulePath ? path_3.toDefinition(to) : moduleName;
|
||||
}
|
||||
return path_3.resolveFrom(src, path_3.toDefinition(to));
|
||||
}
|
||||
function getStringifyOptions(tree, options, parent) {
|
||||
var overrides = {};
|
||||
var isTypings = typeof tree.typings === 'string';
|
||||
var main = isTypings ? tree.typings : tree.main;
|
||||
var browser = isTypings ? tree.browserTypings : tree.browser;
|
||||
if (options.browser && browser) {
|
||||
if (typeof browser === 'string') {
|
||||
var mainDefinition = path_3.resolveFrom(tree.src, path_3.normalizeToDefinition(main));
|
||||
var browserDefinition = path_3.resolveFrom(tree.src, path_3.normalizeToDefinition(browser));
|
||||
overrides[mainDefinition] = browserDefinition;
|
||||
}
|
||||
else {
|
||||
for (var _i = 0, _a = Object.keys(browser); _i < _a.length; _i++) {
|
||||
var key = _a[_i];
|
||||
var from = resolveFromOverride(tree.src, key, tree);
|
||||
var to = resolveFromOverride(tree.src, browser[key], tree);
|
||||
overrides[from] = to;
|
||||
}
|
||||
}
|
||||
}
|
||||
var referenced = {};
|
||||
var dependencies = {};
|
||||
var entry = main == null ? main : path_3.resolveFrom(tree.src, path_3.normalizeToDefinition(main));
|
||||
var prefix = "" + (parent ? parent.prefix : '') + config_1.DEPENDENCY_SEPARATOR + options.name;
|
||||
return extend(options, {
|
||||
tree: tree,
|
||||
entry: entry,
|
||||
prefix: prefix,
|
||||
isTypings: isTypings,
|
||||
overrides: overrides,
|
||||
referenced: referenced,
|
||||
dependencies: dependencies,
|
||||
parent: parent
|
||||
});
|
||||
}
|
||||
function compileDependencyTree(tree, options) {
|
||||
var stringifyOptions = getStringifyOptions(tree, options, undefined);
|
||||
var contents = [];
|
||||
if (Array.isArray(tree.files)) {
|
||||
for (var _i = 0, _a = tree.files; _i < _a.length; _i++) {
|
||||
var file = _a[_i];
|
||||
contents.push(compileDependencyPath(file, stringifyOptions));
|
||||
}
|
||||
}
|
||||
if (stringifyOptions.entry || contents.length === 0) {
|
||||
contents.push(compileDependencyPath(null, stringifyOptions));
|
||||
}
|
||||
return Promise.all(contents).then(function (out) { return out.join(path_2.EOL); });
|
||||
}
|
||||
function compileDependencyPath(path, options) {
|
||||
var tree = options.tree, entry = options.entry;
|
||||
if (path == null) {
|
||||
if (entry == null) {
|
||||
return Promise.reject(new error_1.default(("Unable to resolve entry \".d.ts\" file for \"" + options.name + "\", ") +
|
||||
'please make sure the module has a main or typings field'));
|
||||
}
|
||||
return stringifyDependencyPath(path_3.resolveFrom(tree.src, entry), options);
|
||||
}
|
||||
return stringifyDependencyPath(path_3.resolveFrom(tree.src, path), options);
|
||||
}
|
||||
function cachedReadFileFrom(path, options) {
|
||||
if (!has(options.readFiles, path)) {
|
||||
options.readFiles[path] = fs_1.readFileFrom(path);
|
||||
}
|
||||
return options.readFiles[path];
|
||||
}
|
||||
function cachedStringifyOptions(name, compileOptions, options) {
|
||||
var tree = getDependency(name, options);
|
||||
if (!has(options.dependencies, name)) {
|
||||
if (tree) {
|
||||
options.dependencies[name] = getStringifyOptions(tree, compileOptions, options);
|
||||
}
|
||||
else {
|
||||
options.dependencies[name] = null;
|
||||
}
|
||||
}
|
||||
return options.dependencies[name];
|
||||
}
|
||||
function getPath(path, options) {
|
||||
if (has(options.overrides, path)) {
|
||||
return options.overrides[path];
|
||||
}
|
||||
return path;
|
||||
}
|
||||
function getDependency(name, options) {
|
||||
var tree = options.tree, overrides = options.overrides;
|
||||
if (has(overrides, name)) {
|
||||
if (overrides[name]) {
|
||||
return tree.dependencies[overrides[name]];
|
||||
}
|
||||
}
|
||||
else if (has(tree.dependencies, name)) {
|
||||
return tree.dependencies[name];
|
||||
}
|
||||
}
|
||||
function stringifyDependencyPath(path, options) {
|
||||
var resolved = getPath(path, options);
|
||||
var tree = options.tree, ambient = options.ambient, cwd = options.cwd, browser = options.browser, name = options.name, readFiles = options.readFiles, imported = options.imported, meta = options.meta, entry = options.entry, emitter = options.emitter;
|
||||
var importedPath = importPath(path, path_3.pathFromDefinition(path), options);
|
||||
if (has(options.imported, importedPath)) {
|
||||
return Promise.resolve(null);
|
||||
}
|
||||
options.imported[importedPath] = true;
|
||||
emitter.emit('compile', { name: name, path: path, tree: tree, browser: browser });
|
||||
function loadByModuleName(path) {
|
||||
var _a = getModuleNameParts(path, tree), moduleName = _a[0], modulePath = _a[1];
|
||||
var compileOptions = { cwd: cwd, browser: browser, readFiles: readFiles, imported: imported, emitter: emitter, name: moduleName, ambient: false, meta: meta };
|
||||
var stringifyOptions = cachedStringifyOptions(moduleName, compileOptions, options);
|
||||
if (!stringifyOptions) {
|
||||
return Promise.resolve(null);
|
||||
}
|
||||
return compileDependencyPath(modulePath, stringifyOptions);
|
||||
}
|
||||
if (path_3.isModuleName(resolved)) {
|
||||
return loadByModuleName(resolved);
|
||||
}
|
||||
return cachedReadFileFrom(resolved, options)
|
||||
.then(function (rawContents) {
|
||||
var info = ts.preProcessFile(rawContents);
|
||||
if (info.isLibFile) {
|
||||
return;
|
||||
}
|
||||
var importedFiles = info.importedFiles.map(function (x) { return resolveFromWithModuleName(resolved, x.fileName, tree); });
|
||||
var referencedFiles = info.referencedFiles.map(function (x) { return path_3.resolveFrom(resolved, x.fileName); });
|
||||
if (ambient) {
|
||||
Object.keys(tree.dependencies).forEach(function (x) { return importedFiles.push(x); });
|
||||
}
|
||||
var imports = importedFiles.map(function (importedFile) {
|
||||
var path = getPath(importedFile, options);
|
||||
if (path_3.isModuleName(path)) {
|
||||
return loadByModuleName(path);
|
||||
}
|
||||
return stringifyDependencyPath(path, options);
|
||||
});
|
||||
return Promise.all(imports)
|
||||
.then(function (imports) {
|
||||
var stringified = stringifyFile(resolved, rawContents, path, options);
|
||||
for (var _i = 0, referencedFiles_1 = referencedFiles; _i < referencedFiles_1.length; _i++) {
|
||||
var reference = referencedFiles_1[_i];
|
||||
emitter.emit('reference', { name: name, path: path, reference: reference, tree: tree, browser: browser });
|
||||
}
|
||||
var out = imports.filter(function (x) { return x != null; });
|
||||
out.push(stringified);
|
||||
var contents = out.join(path_2.EOL);
|
||||
emitter.emit('compiled', { name: name, path: path, tree: tree, browser: browser, contents: contents });
|
||||
return contents;
|
||||
});
|
||||
}, function (cause) {
|
||||
var authorPhrase = options.parent ? "The author of \"" + options.parent.name + "\" needs to" : 'You should';
|
||||
var relativePath = path_3.relativeTo(tree.src, resolved);
|
||||
if (path === entry) {
|
||||
return Promise.reject(new error_1.default(("Unable to read typings for \"" + options.name + "\". ") +
|
||||
(authorPhrase + " check the entry paths in \"" + path_1.basename(tree.src) + "\" are up to date"), cause));
|
||||
}
|
||||
return Promise.reject(new error_1.default(("Unable to read \"" + relativePath + "\" from \"" + options.name + "\". ") +
|
||||
(authorPhrase + " validate all import paths are accurate (case sensitive and relative)"), cause));
|
||||
});
|
||||
}
|
||||
function getModuleNameParts(name, tree) {
|
||||
var parts = name.split(/[\\\/]/g);
|
||||
var len = parts.length;
|
||||
while (len--) {
|
||||
var name_1 = parts.slice(0, len).join('/');
|
||||
var path = parts.slice(len).join('/');
|
||||
if (tree.dependencies[name_1]) {
|
||||
return [name_1, path];
|
||||
}
|
||||
}
|
||||
return [parts.join('/'), null];
|
||||
}
|
||||
function importPath(path, name, options) {
|
||||
var prefix = options.prefix, tree = options.tree;
|
||||
var resolved = getPath(resolveFromWithModuleName(path, name, tree), options);
|
||||
if (path_3.isModuleName(resolved)) {
|
||||
var _a = getModuleNameParts(resolved, tree), moduleName = _a[0], modulePath = _a[1];
|
||||
if (tree.dependencies[moduleName] == null) {
|
||||
return name;
|
||||
}
|
||||
return "" + prefix + config_1.DEPENDENCY_SEPARATOR + (modulePath ? path_3.pathFromDefinition(resolved) : resolved);
|
||||
}
|
||||
var relativePath = path_3.relativeTo(tree.src, path_3.pathFromDefinition(resolved));
|
||||
return path_3.normalizeSlashes(path_1.join(prefix, relativePath));
|
||||
}
|
||||
function stringifyFile(path, rawContents, rawPath, options) {
|
||||
var contents = rawContents.replace(references_1.REFERENCE_REGEXP, '');
|
||||
var sourceFile = ts.createSourceFile(path, contents, ts.ScriptTarget.Latest, true);
|
||||
var tree = options.tree, name = options.name, prefix = options.prefix, parent = options.parent, isTypings = options.isTypings, cwd = options.cwd, ambient = options.ambient, entry = options.entry;
|
||||
var source = path_3.isHttp(path) ? path : path_3.normalizeSlashes(path_1.relative(cwd, path));
|
||||
var meta = options.meta ? "// Generated by " + config_1.PROJECT_NAME + path_2.EOL + "// Source: " + source + path_2.EOL : '';
|
||||
if (ambient) {
|
||||
if (sourceFile.externalModuleIndicator) {
|
||||
throw new error_1.default(("Attempted to compile \"" + name + "\" as an ambient ") +
|
||||
"module, but it looks like an external module.");
|
||||
}
|
||||
return "" + meta + path_2.normalizeEOL(contents.trim(), path_2.EOL);
|
||||
}
|
||||
var wasDeclared = false;
|
||||
var hasExports = false;
|
||||
var hasDefaultExport = false;
|
||||
var hasExportEquals = false;
|
||||
function replacer(node) {
|
||||
if (node.kind === ts.SyntaxKind.ExportAssignment) {
|
||||
hasDefaultExport = !node.isExportEquals;
|
||||
hasExportEquals = !hasDefaultExport;
|
||||
}
|
||||
else if (node.kind === ts.SyntaxKind.ExportDeclaration) {
|
||||
hasExports = true;
|
||||
}
|
||||
else {
|
||||
hasExports = hasExports || !!(node.flags & ts.NodeFlags.Export);
|
||||
hasDefaultExport = hasDefaultExport || !!(node.flags & ts.NodeFlags.Default);
|
||||
}
|
||||
if (node.kind === ts.SyntaxKind.StringLiteral &&
|
||||
(node.parent.kind === ts.SyntaxKind.ExportDeclaration ||
|
||||
node.parent.kind === ts.SyntaxKind.ImportDeclaration ||
|
||||
node.parent.kind === ts.SyntaxKind.ModuleDeclaration)) {
|
||||
return " '" + importPath(path, node.text, options) + "'";
|
||||
}
|
||||
if (node.kind === ts.SyntaxKind.DeclareKeyword) {
|
||||
wasDeclared = true;
|
||||
return sourceFile.text.slice(node.getFullStart(), node.getStart());
|
||||
}
|
||||
if (node.kind === ts.SyntaxKind.ExternalModuleReference) {
|
||||
var requirePath = importPath(path, node.expression.text, options);
|
||||
return " require('" + requirePath + "')";
|
||||
}
|
||||
}
|
||||
function read(start, end) {
|
||||
var text = sourceFile.text.slice(start, end);
|
||||
if (start === 0) {
|
||||
return text.replace(/^\s+$/, '');
|
||||
}
|
||||
if (end == null) {
|
||||
return text.replace(/\s+$/, '');
|
||||
}
|
||||
if (wasDeclared) {
|
||||
wasDeclared = false;
|
||||
return text.replace(/^\s+/, '');
|
||||
}
|
||||
return text;
|
||||
}
|
||||
function alias(name) {
|
||||
var imports = [];
|
||||
if (hasExportEquals) {
|
||||
imports.push("import main = require('" + modulePath + "');");
|
||||
imports.push("export = main;");
|
||||
}
|
||||
else {
|
||||
if (hasExports) {
|
||||
imports.push("export * from '" + modulePath + "';");
|
||||
}
|
||||
if (hasDefaultExport) {
|
||||
imports.push("export { default } from '" + modulePath + "';");
|
||||
}
|
||||
}
|
||||
if (imports.length === 0) {
|
||||
return '';
|
||||
}
|
||||
return declareText(name, imports.join(path_2.EOL));
|
||||
}
|
||||
var isEntry = rawPath === entry;
|
||||
var moduleText = path_2.normalizeEOL(processTree(sourceFile, replacer, read), path_2.EOL);
|
||||
var moduleName = parent && parent.ambient ? name : prefix;
|
||||
if (isEntry && isTypings) {
|
||||
return meta + declareText(parent ? moduleName : name, moduleText);
|
||||
}
|
||||
var modulePath = importPath(path, path_3.pathFromDefinition(path), options);
|
||||
var prettyPath = path_3.normalizeSlashes(path_1.join(name, path_3.relativeTo(tree.src, path_3.pathFromDefinition(path))));
|
||||
var declared = declareText(modulePath, moduleText);
|
||||
if (!isEntry) {
|
||||
return meta + declared + (parent ? '' : alias(prettyPath));
|
||||
}
|
||||
return meta + declared + (parent ? '' : alias(prettyPath)) + alias(parent ? moduleName : name);
|
||||
}
|
||||
function declareText(name, text) {
|
||||
return "declare module '" + name + "' {" + (text ? path_2.EOL + text + path_2.EOL : '') + "}" + path_2.EOL;
|
||||
}
|
||||
function processTree(sourceFile, replacer, reader) {
|
||||
var code = '';
|
||||
var position = 0;
|
||||
function skip(node) {
|
||||
position = node.end;
|
||||
}
|
||||
function readThrough(node) {
|
||||
if (node.pos > position) {
|
||||
code += reader(position, node.pos);
|
||||
position = node.pos;
|
||||
}
|
||||
}
|
||||
function visit(node) {
|
||||
readThrough(node);
|
||||
var replacement = replacer(node);
|
||||
if (replacement != null) {
|
||||
code += replacement;
|
||||
skip(node);
|
||||
}
|
||||
else {
|
||||
ts.forEachChild(node, visit);
|
||||
}
|
||||
}
|
||||
visit(sourceFile);
|
||||
code += reader(position);
|
||||
return code;
|
||||
}
|
||||
//# sourceMappingURL=compile.js.map
|
1
node_modules/typings-core/dist/lib/compile.js.map
generated
vendored
Normal file
1
node_modules/typings-core/dist/lib/compile.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
14
node_modules/typings-core/dist/lib/dependencies.d.ts
generated
vendored
Normal file
14
node_modules/typings-core/dist/lib/dependencies.d.ts
generated
vendored
Normal file
@ -0,0 +1,14 @@
|
||||
import Promise = require('any-promise');
|
||||
import { Dependency, DependencyTree, Emitter } from '../interfaces';
|
||||
export interface Options {
|
||||
cwd: string;
|
||||
emitter: Emitter;
|
||||
dev?: boolean;
|
||||
peer?: boolean;
|
||||
ambient?: boolean;
|
||||
}
|
||||
export declare function resolveAllDependencies(options: Options): Promise<DependencyTree>;
|
||||
export declare function resolveDependency(dependency: Dependency, options: Options, parent?: DependencyTree): Promise<DependencyTree>;
|
||||
export declare function resolveBowerDependencies(options: Options): Promise<DependencyTree>;
|
||||
export declare function resolveNpmDependencies(options: Options): Promise<DependencyTree>;
|
||||
export declare function resolveTypeDependencies(options: Options): Promise<DependencyTree>;
|
388
node_modules/typings-core/dist/lib/dependencies.js
generated
vendored
Normal file
388
node_modules/typings-core/dist/lib/dependencies.js
generated
vendored
Normal file
@ -0,0 +1,388 @@
|
||||
"use strict";
|
||||
var extend = require('xtend');
|
||||
var invariant = require('invariant');
|
||||
var zipObject = require('zip-object');
|
||||
var Promise = require('any-promise');
|
||||
var path_1 = require('path');
|
||||
var url_1 = require('url');
|
||||
var fs_1 = require('../utils/fs');
|
||||
var parse_1 = require('../utils/parse');
|
||||
var find_1 = require('../utils/find');
|
||||
var path_2 = require('../utils/path');
|
||||
var config_1 = require('../utils/config');
|
||||
var error_1 = require('./error');
|
||||
var DEFAULT_DEPENDENCY = {
|
||||
src: undefined,
|
||||
raw: undefined,
|
||||
main: undefined,
|
||||
browser: undefined,
|
||||
typings: undefined,
|
||||
browserTypings: undefined,
|
||||
version: undefined,
|
||||
files: undefined,
|
||||
ambient: undefined,
|
||||
postmessage: undefined,
|
||||
dependencies: {},
|
||||
devDependencies: {},
|
||||
peerDependencies: {},
|
||||
ambientDependencies: {},
|
||||
ambientDevDependencies: {}
|
||||
};
|
||||
function resolveAllDependencies(options) {
|
||||
return Promise.all([
|
||||
resolveBowerDependencies(options).catch(function () { return extend(DEFAULT_DEPENDENCY); }),
|
||||
resolveNpmDependencies(options).catch(function () { return extend(DEFAULT_DEPENDENCY); }),
|
||||
resolveTypeDependencies(options).catch(function () { return extend(DEFAULT_DEPENDENCY); })
|
||||
])
|
||||
.then(function (trees) { return mergeDependencies.apply(void 0, [DEFAULT_DEPENDENCY].concat(trees)); });
|
||||
}
|
||||
exports.resolveAllDependencies = resolveAllDependencies;
|
||||
function resolveDependency(dependency, options, parent) {
|
||||
var type = dependency.type, location = dependency.location, raw = dependency.raw, meta = dependency.meta;
|
||||
if (type === 'registry') {
|
||||
return resolveDependencyRegistry(dependency, options, parent);
|
||||
}
|
||||
if (type === 'github' || type === 'bitbucket') {
|
||||
if (meta.sha === 'master') {
|
||||
options.emitter.emit('badlocation', { type: type, raw: raw, location: location });
|
||||
}
|
||||
}
|
||||
return resolveDependencyInternally(type, location, raw, options, parent);
|
||||
}
|
||||
exports.resolveDependency = resolveDependency;
|
||||
function resolveDependencyInternally(type, location, raw, options, parent) {
|
||||
if (type === 'npm') {
|
||||
return resolveNpmDependency(location, raw, options, parent);
|
||||
}
|
||||
if (type === 'bower') {
|
||||
return resolveBowerDependency(location, raw, options, parent);
|
||||
}
|
||||
return resolveFileDependency(location, raw, options, parent);
|
||||
}
|
||||
function resolveDependencyRegistry(dependency, options, parent) {
|
||||
var location = dependency.location, meta = dependency.meta;
|
||||
return fs_1.readJsonFrom(location)
|
||||
.then(function (entry) {
|
||||
var _a = parse_1.parseDependency(entry.location), type = _a.type, location = _a.location;
|
||||
var raw = "registry:" + meta.source + "/" + meta.name + "#" + entry.tag;
|
||||
if (entry.deprecated) {
|
||||
options.emitter.emit('deprecated', {
|
||||
parent: parent,
|
||||
raw: dependency.raw,
|
||||
date: new Date(entry.deprecated)
|
||||
});
|
||||
}
|
||||
return resolveDependencyInternally(type, location, raw, options, parent);
|
||||
}, function (error) {
|
||||
if (error.code === 'EINVALIDSTATUS' && error.status === 404) {
|
||||
var prompt = parent ? '' : options.ambient ?
|
||||
'Have you checked for regular typings without using ambient? ' :
|
||||
'Did you want to install ambient typings with the ambient flag? ';
|
||||
var message = ("Unable to find \"" + meta.name + "\" for \"" + meta.source + "\" in the registry. ") +
|
||||
prompt + "If you can contribute these typings, please help us: " +
|
||||
"https://github.com/typings/registry";
|
||||
return Promise.reject(new error_1.default(message, error));
|
||||
}
|
||||
return Promise.reject(error);
|
||||
});
|
||||
}
|
||||
function resolveNpmDependency(name, raw, options, parent) {
|
||||
return find_1.findUp(options.cwd, path_1.join('node_modules', name))
|
||||
.then(function (modulePath) {
|
||||
if (path_2.isDefinition(modulePath)) {
|
||||
return resolveFileDependency(modulePath, raw, options, parent);
|
||||
}
|
||||
return resolveNpmDependencyFrom(modulePath, raw, options, parent);
|
||||
}, function (error) {
|
||||
return Promise.reject(resolveError(raw, error, parent));
|
||||
});
|
||||
}
|
||||
function resolveBowerDependency(name, raw, options, parent) {
|
||||
return resolveBowerComponentPath(options.cwd)
|
||||
.then(function (componentPath) {
|
||||
var modulePath = path_1.resolve(componentPath, name);
|
||||
if (path_2.isDefinition(modulePath)) {
|
||||
return resolveFileDependency(modulePath, raw, options, parent);
|
||||
}
|
||||
return resolveBowerDependencyFrom(modulePath, raw, componentPath, options, parent);
|
||||
}, function (error) {
|
||||
return Promise.reject(resolveError(raw, error, parent));
|
||||
});
|
||||
}
|
||||
function resolveFileDependency(location, raw, options, parent) {
|
||||
var src;
|
||||
if (path_2.isHttp(location)) {
|
||||
src = location;
|
||||
}
|
||||
else if (parent && path_2.isHttp(parent.src)) {
|
||||
src = url_1.resolve(parent.src, location);
|
||||
}
|
||||
else {
|
||||
src = path_1.resolve(options.cwd, location);
|
||||
}
|
||||
if (!path_2.isDefinition(src)) {
|
||||
return resolveTypeDependencyFrom(src, raw, options, parent);
|
||||
}
|
||||
options.emitter.emit('resolve', { src: src, raw: raw, parent: parent });
|
||||
var tree = extend(DEFAULT_DEPENDENCY, {
|
||||
typings: src,
|
||||
src: src,
|
||||
raw: raw,
|
||||
parent: parent
|
||||
});
|
||||
options.emitter.emit('resolved', { src: src, tree: tree, raw: raw, parent: parent });
|
||||
return Promise.resolve(tree);
|
||||
}
|
||||
function resolveBowerDependencies(options) {
|
||||
return find_1.findUp(options.cwd, 'bower.json')
|
||||
.then(function (bowerJsonPath) {
|
||||
return resolveBowerComponentPath(path_1.dirname(bowerJsonPath))
|
||||
.then(function (componentPath) {
|
||||
return resolveBowerDependencyFrom(bowerJsonPath, undefined, componentPath, options);
|
||||
});
|
||||
}, function (cause) {
|
||||
return Promise.reject(new error_1.default("Unable to resolve Bower dependencies", cause));
|
||||
});
|
||||
}
|
||||
exports.resolveBowerDependencies = resolveBowerDependencies;
|
||||
function resolveBowerDependencyFrom(src, raw, componentPath, options, parent) {
|
||||
checkCircularDependency(parent, src);
|
||||
options.emitter.emit('resolve', { src: src, raw: raw, parent: parent });
|
||||
return fs_1.readJson(src)
|
||||
.then(function (bowerJson) {
|
||||
if (bowerJson === void 0) { bowerJson = {}; }
|
||||
var tree = extend(DEFAULT_DEPENDENCY, {
|
||||
name: bowerJson.name,
|
||||
version: bowerJson.version,
|
||||
main: bowerJson.main,
|
||||
browser: bowerJson.browser,
|
||||
typings: bowerJson.typings,
|
||||
browserTypings: bowerJson.browserTypings,
|
||||
ambient: false,
|
||||
src: src,
|
||||
raw: raw,
|
||||
parent: parent
|
||||
});
|
||||
var dependencyMap = extend(bowerJson.dependencies);
|
||||
var devDependencyMap = extend(options.dev ? bowerJson.devDependencies : {});
|
||||
return Promise.all([
|
||||
resolveBowerDependencyMap(componentPath, dependencyMap, options, tree),
|
||||
resolveBowerDependencyMap(componentPath, devDependencyMap, options, tree),
|
||||
maybeResolveTypeDependencyFrom(path_1.join(src, '..', config_1.CONFIG_FILE), raw, options, parent)
|
||||
])
|
||||
.then(function (_a) {
|
||||
var dependencies = _a[0], devDependencies = _a[1], typedPackage = _a[2];
|
||||
tree.dependencies = dependencies;
|
||||
tree.devDependencies = devDependencies;
|
||||
options.emitter.emit('resolved', { src: src, tree: tree, raw: raw, parent: parent });
|
||||
return mergeDependencies(tree, typedPackage);
|
||||
});
|
||||
}, function (error) {
|
||||
return Promise.reject(resolveError(raw, error, parent));
|
||||
});
|
||||
}
|
||||
function resolveBowerComponentPath(path) {
|
||||
return fs_1.readJson(path_1.resolve(path, '.bowerrc'))
|
||||
.then(function (bowerrc) {
|
||||
if (bowerrc === void 0) { bowerrc = {}; }
|
||||
return path_1.resolve(path, bowerrc.directory || 'bower_components');
|
||||
}, function () {
|
||||
return path_1.resolve(path, 'bower_components');
|
||||
});
|
||||
}
|
||||
function resolveBowerDependencyMap(componentPath, dependencies, options, parent) {
|
||||
var keys = Object.keys(dependencies);
|
||||
var cwd = options.cwd, emitter = options.emitter;
|
||||
return Promise.all(keys.map(function (name) {
|
||||
var modulePath = path_1.resolve(componentPath, name, 'bower.json');
|
||||
var resolveOptions = { dev: false, ambient: false, peer: false, cwd: cwd, emitter: emitter };
|
||||
return resolveBowerDependencyFrom(modulePath, "bower:" + name, componentPath, resolveOptions, parent);
|
||||
}))
|
||||
.then(function (results) { return zipObject(keys, results); });
|
||||
}
|
||||
function resolveNpmDependencies(options) {
|
||||
return find_1.findUp(options.cwd, 'package.json')
|
||||
.then(function (packgeJsonPath) {
|
||||
return resolveNpmDependencyFrom(packgeJsonPath, undefined, options);
|
||||
}, function (cause) {
|
||||
return Promise.reject(new error_1.default("Unable to resolve NPM dependencies", cause));
|
||||
});
|
||||
}
|
||||
exports.resolveNpmDependencies = resolveNpmDependencies;
|
||||
function resolveNpmDependencyFrom(src, raw, options, parent) {
|
||||
checkCircularDependency(parent, src);
|
||||
options.emitter.emit('resolve', { src: src, raw: raw, parent: parent });
|
||||
return fs_1.readJson(src)
|
||||
.then(function (packageJson) {
|
||||
if (packageJson === void 0) { packageJson = {}; }
|
||||
var tree = extend(DEFAULT_DEPENDENCY, {
|
||||
name: packageJson.name,
|
||||
version: packageJson.version,
|
||||
main: packageJson.main,
|
||||
browser: packageJson.browser,
|
||||
typings: packageJson.typings,
|
||||
browserTypings: packageJson.browserTypings,
|
||||
ambient: false,
|
||||
src: src,
|
||||
raw: raw,
|
||||
parent: parent
|
||||
});
|
||||
var dependencyMap = extend(packageJson.dependencies);
|
||||
var devDependencyMap = extend(options.dev ? packageJson.devDependencies : {});
|
||||
var peerDependencyMap = extend(options.peer ? packageJson.peerDependencies : {});
|
||||
return Promise.all([
|
||||
resolveNpmDependencyMap(src, dependencyMap, options, tree),
|
||||
resolveNpmDependencyMap(src, devDependencyMap, options, tree),
|
||||
resolveNpmDependencyMap(src, peerDependencyMap, options, tree),
|
||||
maybeResolveTypeDependencyFrom(path_1.join(src, '..', config_1.CONFIG_FILE), raw, options, parent)
|
||||
])
|
||||
.then(function (_a) {
|
||||
var dependencies = _a[0], devDependencies = _a[1], peerDependencies = _a[2], typedPackage = _a[3];
|
||||
tree.dependencies = dependencies;
|
||||
tree.devDependencies = devDependencies;
|
||||
tree.peerDependencies = peerDependencies;
|
||||
options.emitter.emit('resolved', { src: src, tree: tree, raw: raw, parent: parent });
|
||||
return mergeDependencies(tree, typedPackage);
|
||||
});
|
||||
}, function (error) {
|
||||
return Promise.reject(resolveError(raw, error, parent));
|
||||
});
|
||||
}
|
||||
function resolveNpmDependencyMap(src, dependencies, options, parent) {
|
||||
var cwd = path_1.dirname(src);
|
||||
var keys = Object.keys(dependencies);
|
||||
return Promise.all(keys.map(function (name) {
|
||||
var resolveOptions = { dev: false, peer: false, ambient: false, cwd: cwd, emitter: options.emitter };
|
||||
return resolveNpmDependency(path_1.join(name, 'package.json'), "npm:" + name, resolveOptions, parent);
|
||||
}))
|
||||
.then(function (results) { return zipObject(keys, results); });
|
||||
}
|
||||
function resolveTypeDependencies(options) {
|
||||
return find_1.findConfigFile(options.cwd)
|
||||
.then(function (path) {
|
||||
return resolveTypeDependencyFrom(path, undefined, options);
|
||||
}, function (cause) {
|
||||
return Promise.reject(new error_1.default("Unable to resolve Typings dependencies", cause));
|
||||
});
|
||||
}
|
||||
exports.resolveTypeDependencies = resolveTypeDependencies;
|
||||
function resolveTypeDependencyFrom(src, raw, options, parent) {
|
||||
checkCircularDependency(parent, src);
|
||||
options.emitter.emit('resolve', { src: src, raw: raw, parent: parent });
|
||||
return fs_1.readConfigFrom(src)
|
||||
.then(function (config) {
|
||||
var tree = extend(DEFAULT_DEPENDENCY, {
|
||||
name: config.name,
|
||||
main: config.main,
|
||||
version: config.version,
|
||||
browser: config.browser,
|
||||
files: Array.isArray(config.files) ? config.files : undefined,
|
||||
type: config_1.PROJECT_NAME,
|
||||
ambient: !!config.ambient,
|
||||
postmessagee: typeof config.postmessage === 'string' ? config.postmessage : undefined,
|
||||
src: src,
|
||||
raw: raw,
|
||||
parent: parent
|
||||
});
|
||||
var ambient = options.ambient, dev = options.dev, peer = options.peer;
|
||||
var dependencyMap = extend(config.dependencies);
|
||||
var devDependencyMap = extend(dev ? config.devDependencies : {});
|
||||
var peerDependencyMap = extend(peer ? config.peerDependencies : {});
|
||||
var ambientDependencyMap = extend(ambient ? config.ambientDependencies : {});
|
||||
var ambientDevDependencyMap = extend(ambient && dev ? config.ambientDevDependencies : {});
|
||||
if (parent == null && config.ambientDependencies) {
|
||||
options.emitter.emit('ambientdependencies', {
|
||||
name: config.name,
|
||||
raw: raw,
|
||||
dependencies: config.ambientDependencies
|
||||
});
|
||||
}
|
||||
return Promise.all([
|
||||
resolveTypeDependencyMap(src, dependencyMap, options, tree),
|
||||
resolveTypeDependencyMap(src, devDependencyMap, options, tree),
|
||||
resolveTypeDependencyMap(src, peerDependencyMap, options, tree),
|
||||
resolveTypeDependencyMap(src, ambientDependencyMap, options, tree),
|
||||
resolveTypeDependencyMap(src, ambientDevDependencyMap, options, tree),
|
||||
])
|
||||
.then(function (_a) {
|
||||
var dependencies = _a[0], devDependencies = _a[1], peerDependencies = _a[2], ambientDependencies = _a[3], ambientDevDependencies = _a[4];
|
||||
tree.dependencies = dependencies;
|
||||
tree.devDependencies = devDependencies;
|
||||
tree.peerDependencies = peerDependencies;
|
||||
tree.ambientDependencies = ambientDependencies;
|
||||
tree.ambientDevDependencies = ambientDevDependencies;
|
||||
options.emitter.emit('resolved', { src: src, tree: tree, raw: raw, parent: parent });
|
||||
return tree;
|
||||
});
|
||||
}, function (error) {
|
||||
return Promise.reject(resolveError(raw, error, parent));
|
||||
});
|
||||
}
|
||||
function maybeResolveTypeDependencyFrom(src, raw, options, parent) {
|
||||
return resolveTypeDependencyFrom(src, raw, options, parent).catch(function () { return extend(DEFAULT_DEPENDENCY); });
|
||||
}
|
||||
function resolveTypeDependencyMap(src, dependencies, options, parent) {
|
||||
var cwd = path_1.dirname(src);
|
||||
var keys = Object.keys(dependencies);
|
||||
return Promise.all(keys.map(function (name) {
|
||||
var resolveOptions = { dev: false, ambient: false, peer: false, cwd: cwd, emitter: options.emitter };
|
||||
return resolveDependency(parse_1.parseDependency(dependencies[name]), resolveOptions, parent);
|
||||
}))
|
||||
.then(function (results) { return zipObject(keys, results); });
|
||||
}
|
||||
function checkCircularDependency(tree, filename) {
|
||||
if (tree) {
|
||||
var currentSrc = tree.src;
|
||||
do {
|
||||
invariant(tree.src !== filename, "Circular dependency detected using \"" + currentSrc + "\"");
|
||||
} while (tree = tree.parent);
|
||||
}
|
||||
}
|
||||
function resolveError(raw, cause, parent) {
|
||||
var message = "Unable to resolve " + (raw == null ? 'typings' : "\"" + raw + "\"");
|
||||
if (parent != null && parent.raw != null) {
|
||||
message += " from \"" + parent.raw + "\"";
|
||||
}
|
||||
return new error_1.default(message, cause);
|
||||
}
|
||||
function mergeDependencies(root) {
|
||||
var trees = [];
|
||||
for (var _i = 1; _i < arguments.length; _i++) {
|
||||
trees[_i - 1] = arguments[_i];
|
||||
}
|
||||
var dependency = extend(root);
|
||||
for (var _a = 0, trees_1 = trees; _a < trees_1.length; _a++) {
|
||||
var tree = trees_1[_a];
|
||||
if (tree == null) {
|
||||
continue;
|
||||
}
|
||||
var name = tree.name, raw = tree.raw, src = tree.src, main = tree.main, browser = tree.browser, typings = tree.typings, browserTypings = tree.browserTypings, parent = tree.parent, files = tree.files, ambient = tree.ambient;
|
||||
if (parent != null) {
|
||||
dependency.parent = parent;
|
||||
}
|
||||
if (ambient != null) {
|
||||
dependency.ambient = ambient;
|
||||
}
|
||||
if (typeof name === 'string') {
|
||||
dependency.name = name;
|
||||
}
|
||||
if (typeof raw === 'string') {
|
||||
dependency.raw = raw;
|
||||
}
|
||||
if (main != null || browser != null || typings != null || browserTypings != null || files != null) {
|
||||
dependency.src = src;
|
||||
dependency.main = main;
|
||||
dependency.files = files;
|
||||
dependency.browser = browser;
|
||||
dependency.typings = typings;
|
||||
dependency.browserTypings = browserTypings;
|
||||
}
|
||||
dependency.dependencies = extend(dependency.dependencies, tree.dependencies);
|
||||
dependency.devDependencies = extend(dependency.devDependencies, tree.devDependencies);
|
||||
dependency.peerDependencies = extend(dependency.peerDependencies, tree.peerDependencies);
|
||||
dependency.ambientDependencies = extend(dependency.ambientDependencies, tree.ambientDependencies);
|
||||
dependency.ambientDevDependencies = extend(dependency.ambientDevDependencies, tree.ambientDevDependencies);
|
||||
}
|
||||
return dependency;
|
||||
}
|
||||
//# sourceMappingURL=dependencies.js.map
|
1
node_modules/typings-core/dist/lib/dependencies.js.map
generated
vendored
Normal file
1
node_modules/typings-core/dist/lib/dependencies.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
4
node_modules/typings-core/dist/lib/error.d.ts
generated
vendored
Normal file
4
node_modules/typings-core/dist/lib/error.d.ts
generated
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
import { BaseError } from 'make-error-cause';
|
||||
export default class TypingsError extends BaseError {
|
||||
name: string;
|
||||
}
|
18
node_modules/typings-core/dist/lib/error.js
generated
vendored
Normal file
18
node_modules/typings-core/dist/lib/error.js
generated
vendored
Normal file
@ -0,0 +1,18 @@
|
||||
"use strict";
|
||||
var __extends = (this && this.__extends) || function (d, b) {
|
||||
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
|
||||
function __() { this.constructor = d; }
|
||||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||
};
|
||||
var make_error_cause_1 = require('make-error-cause');
|
||||
var TypingsError = (function (_super) {
|
||||
__extends(TypingsError, _super);
|
||||
function TypingsError() {
|
||||
_super.apply(this, arguments);
|
||||
this.name = 'TypingsError';
|
||||
}
|
||||
return TypingsError;
|
||||
}(make_error_cause_1.BaseError));
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.default = TypingsError;
|
||||
//# sourceMappingURL=error.js.map
|
1
node_modules/typings-core/dist/lib/error.js.map
generated
vendored
Normal file
1
node_modules/typings-core/dist/lib/error.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"error.js","sourceRoot":"","sources":["../../src/lib/error.ts"],"names":[],"mappings":";;;;;;AAAA,iCAA0B,kBAE1B,CAAC,CAF2C;AAE5C;IAA0C,gCAAS;IAAnD;QAA0C,8BAAS;QACjD,SAAI,GAAG,cAAc,CAAA;IACvB,CAAC;IAAD,mBAAC;AAAD,CAAC,AAFD,CAA0C,4BAAS,GAElD;AAFD;8BAEC,CAAA"}
|
8
node_modules/typings-core/dist/list.d.ts
generated
vendored
Normal file
8
node_modules/typings-core/dist/list.d.ts
generated
vendored
Normal file
@ -0,0 +1,8 @@
|
||||
import Promise = require('any-promise');
|
||||
import { Emitter, DependencyTree } from './interfaces';
|
||||
export interface ListOptions {
|
||||
cwd: string;
|
||||
production?: boolean;
|
||||
emitter?: Emitter;
|
||||
}
|
||||
export declare function list(options: ListOptions): Promise<DependencyTree>;
|
11
node_modules/typings-core/dist/list.js
generated
vendored
Normal file
11
node_modules/typings-core/dist/list.js
generated
vendored
Normal file
@ -0,0 +1,11 @@
|
||||
"use strict";
|
||||
var events_1 = require('events');
|
||||
var dependencies_1 = require('./lib/dependencies');
|
||||
function list(options) {
|
||||
var cwd = options.cwd;
|
||||
var dev = !options.production;
|
||||
var emitter = options.emitter || new events_1.EventEmitter();
|
||||
return dependencies_1.resolveTypeDependencies({ cwd: cwd, ambient: true, dev: dev, emitter: emitter });
|
||||
}
|
||||
exports.list = list;
|
||||
//# sourceMappingURL=list.js.map
|
1
node_modules/typings-core/dist/list.js.map
generated
vendored
Normal file
1
node_modules/typings-core/dist/list.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"list.js","sourceRoot":"","sources":["../src/list.ts"],"names":[],"mappings":";AAAA,uBAA6B,QAC7B,CAAC,CADoC;AAGrC,6BAAwC,oBAExC,CAAC,CAF2D;AAW5D,cAAsB,OAAoB;IAChC,qBAAG,CAAY;IACvB,IAAM,GAAG,GAAG,CAAC,OAAO,CAAC,UAAU,CAAA;IAC/B,IAAM,OAAO,GAAG,OAAO,CAAC,OAAO,IAAI,IAAI,qBAAY,EAAE,CAAA;IAGrD,MAAM,CAAC,sCAAuB,CAAC,EAAE,KAAA,GAAG,EAAE,OAAO,EAAE,IAAI,EAAE,KAAA,GAAG,EAAE,SAAA,OAAO,EAAE,CAAC,CAAA;AACtE,CAAC;AAPe,YAAI,OAOnB,CAAA"}
|
5
node_modules/typings-core/dist/open.d.ts
generated
vendored
Normal file
5
node_modules/typings-core/dist/open.d.ts
generated
vendored
Normal file
@ -0,0 +1,5 @@
|
||||
export interface OpenOptions {
|
||||
homepage?: boolean;
|
||||
issues?: boolean;
|
||||
}
|
||||
export declare function open(raw: string, options?: OpenOptions): string;
|
9
node_modules/typings-core/dist/open.js
generated
vendored
Normal file
9
node_modules/typings-core/dist/open.js
generated
vendored
Normal file
@ -0,0 +1,9 @@
|
||||
"use strict";
|
||||
var parse_1 = require('./utils/parse');
|
||||
function open(raw, options) {
|
||||
if (options === void 0) { options = {}; }
|
||||
var dependency = parse_1.parseDependency(raw);
|
||||
return dependency.location;
|
||||
}
|
||||
exports.open = open;
|
||||
//# sourceMappingURL=open.js.map
|
1
node_modules/typings-core/dist/open.js.map
generated
vendored
Normal file
1
node_modules/typings-core/dist/open.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"open.js","sourceRoot":"","sources":["../src/open.ts"],"names":[],"mappings":";AAAA,sBAAgC,eAEhC,CAAC,CAF8C;AAO/C,cAAsB,GAAW,EAAE,OAAyB;IAAzB,uBAAyB,GAAzB,YAAyB;IAC1D,IAAM,UAAU,GAAG,uBAAe,CAAC,GAAG,CAAC,CAAA;IAIvC,MAAM,CAAC,UAAU,CAAC,QAAQ,CAAA;AAC5B,CAAC;AANe,YAAI,OAMnB,CAAA"}
|
22
node_modules/typings-core/dist/search.d.ts
generated
vendored
Normal file
22
node_modules/typings-core/dist/search.d.ts
generated
vendored
Normal file
@ -0,0 +1,22 @@
|
||||
import Promise = require('any-promise');
|
||||
export interface SearchOptions {
|
||||
query?: string;
|
||||
name?: string;
|
||||
source?: string;
|
||||
offset?: string;
|
||||
limit?: string;
|
||||
order?: string;
|
||||
sort?: string;
|
||||
}
|
||||
export interface SearchResults {
|
||||
total: number;
|
||||
results: Array<{
|
||||
name: string;
|
||||
source: string;
|
||||
homepage: string;
|
||||
description: string;
|
||||
updated: string;
|
||||
versions: number;
|
||||
}>;
|
||||
}
|
||||
export declare function search(options?: SearchOptions): Promise<SearchResults>;
|
32
node_modules/typings-core/dist/search.js
generated
vendored
Normal file
32
node_modules/typings-core/dist/search.js
generated
vendored
Normal file
@ -0,0 +1,32 @@
|
||||
"use strict";
|
||||
var extend = require('xtend');
|
||||
var pick = require('object.pick');
|
||||
var querystring_1 = require('querystring');
|
||||
var url_1 = require('url');
|
||||
var fs_1 = require('./utils/fs');
|
||||
var rc_1 = require('./utils/rc');
|
||||
function tidyParams(params) {
|
||||
var result = extend(params);
|
||||
for (var _i = 0, _a = Object.keys(result); _i < _a.length; _i++) {
|
||||
var key = _a[_i];
|
||||
if (result[key] == null) {
|
||||
delete result[key];
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
function search(options) {
|
||||
if (options === void 0) { options = {}; }
|
||||
var query = tidyParams(pick(options, [
|
||||
'query',
|
||||
'name',
|
||||
'source',
|
||||
'offset',
|
||||
'limit',
|
||||
'order',
|
||||
'sort'
|
||||
]));
|
||||
return fs_1.readJsonFrom(url_1.resolve(rc_1.default.registryURL, "search?" + querystring_1.stringify(query)));
|
||||
}
|
||||
exports.search = search;
|
||||
//# sourceMappingURL=search.js.map
|
1
node_modules/typings-core/dist/search.js.map
generated
vendored
Normal file
1
node_modules/typings-core/dist/search.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"search.js","sourceRoot":"","sources":["../src/search.ts"],"names":[],"mappings":";AAAA,IAAO,MAAM,WAAW,OAAO,CAAC,CAAA;AAEhC,IAAO,IAAI,WAAW,aAAa,CAAC,CAAA;AACpC,4BAA0B,aAC1B,CAAC,CADsC;AACvC,oBAAwB,KACxB,CAAC,CAD4B;AAC7B,mBAA6B,YAC7B,CAAC,CADwC;AACzC,mBAAe,YAKf,CAAC,CAL0B;AAiC3B,oBAAqC,MAAS;IAC5C,IAAM,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,CAAA;IAG7B,GAAG,CAAC,CAAc,UAAmB,EAAnB,KAAA,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,EAAnB,cAAmB,EAAnB,IAAmB,CAAC;QAAjC,IAAM,GAAG,SAAA;QACZ,EAAE,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,IAAI,CAAC,CAAC,CAAC;YACxB,OAAO,MAAM,CAAC,GAAG,CAAC,CAAA;QACpB,CAAC;KACF;IAED,MAAM,CAAC,MAAM,CAAA;AACf,CAAC;AAKD,gBAAwB,OAA2B;IAA3B,uBAA2B,GAA3B,YAA2B;IACjD,IAAM,KAAK,GAAG,UAAU,CAAC,IAAI,CAAC,OAAO,EAAE;QACrC,OAAO;QACP,MAAM;QACN,QAAQ;QACR,QAAQ;QACR,OAAO;QACP,OAAO;QACP,MAAM;KACP,CAAC,CAAC,CAAA;IAEH,MAAM,CAAC,iBAAY,CAAC,aAAO,CAAC,YAAE,CAAC,WAAW,EAAE,YAAU,uBAAS,CAAC,KAAK,CAAG,CAAC,CAAC,CAAA;AAC5E,CAAC;AAZe,cAAM,SAYrB,CAAA"}
|
10
node_modules/typings-core/dist/typings.d.ts
generated
vendored
Normal file
10
node_modules/typings-core/dist/typings.d.ts
generated
vendored
Normal file
@ -0,0 +1,10 @@
|
||||
export * from './install';
|
||||
export * from './uninstall';
|
||||
export * from './init';
|
||||
export * from './bundle';
|
||||
export * from './search';
|
||||
export * from './interfaces';
|
||||
export * from './list';
|
||||
export * from './open';
|
||||
export * from './view';
|
||||
export declare const VERSION: any;
|
14
node_modules/typings-core/dist/typings.js
generated
vendored
Normal file
14
node_modules/typings-core/dist/typings.js
generated
vendored
Normal file
@ -0,0 +1,14 @@
|
||||
"use strict";
|
||||
function __export(m) {
|
||||
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
|
||||
}
|
||||
__export(require('./install'));
|
||||
__export(require('./uninstall'));
|
||||
__export(require('./init'));
|
||||
__export(require('./bundle'));
|
||||
__export(require('./search'));
|
||||
__export(require('./list'));
|
||||
__export(require('./open'));
|
||||
__export(require('./view'));
|
||||
exports.VERSION = require('../package.json').version;
|
||||
//# sourceMappingURL=typings.js.map
|
1
node_modules/typings-core/dist/typings.js.map
generated
vendored
Normal file
1
node_modules/typings-core/dist/typings.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"typings.js","sourceRoot":"","sources":["../src/typings.ts"],"names":[],"mappings":";;;;AAAA,iBAAc,WACd,CAAC,EADwB;AACzB,iBAAc,aACd,CAAC,EAD0B;AAC3B,iBAAc,QACd,CAAC,EADqB;AACtB,iBAAc,UACd,CAAC,EADuB;AACxB,iBAAc,UACd,CAAC,EADuB;AAExB,iBAAc,QACd,CAAC,EADqB;AACtB,iBAAc,QACd,CAAC,EADqB;AACtB,iBAAc,QAEd,CAAC,EAFqB;AAET,eAAO,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAC,OAAO,CAAA"}
|
11
node_modules/typings-core/dist/uninstall.d.ts
generated
vendored
Normal file
11
node_modules/typings-core/dist/uninstall.d.ts
generated
vendored
Normal file
@ -0,0 +1,11 @@
|
||||
import Promise = require('any-promise');
|
||||
import { Emitter } from './interfaces';
|
||||
export interface UninstallDependencyOptions {
|
||||
save?: boolean;
|
||||
saveDev?: boolean;
|
||||
savePeer?: boolean;
|
||||
ambient?: boolean;
|
||||
cwd: string;
|
||||
emitter?: Emitter;
|
||||
}
|
||||
export declare function uninstallDependency(name: string, options: UninstallDependencyOptions): Promise<void>;
|
90
node_modules/typings-core/dist/uninstall.js
generated
vendored
Normal file
90
node_modules/typings-core/dist/uninstall.js
generated
vendored
Normal file
@ -0,0 +1,90 @@
|
||||
"use strict";
|
||||
var extend = require('xtend');
|
||||
var Promise = require('any-promise');
|
||||
var promise_finally_1 = require('promise-finally');
|
||||
var events_1 = require('events');
|
||||
var fs_1 = require('./utils/fs');
|
||||
var find_1 = require('./utils/find');
|
||||
var path_1 = require('./utils/path');
|
||||
function uninstallDependency(name, options) {
|
||||
var emitter = options.emitter || new events_1.EventEmitter();
|
||||
function uninstall(name, options) {
|
||||
return removeDependency(name, options).then(function () { return writeToConfig(name, options); });
|
||||
}
|
||||
return find_1.findProject(options.cwd)
|
||||
.then(function (cwd) { return uninstall(name, extend({ emitter: emitter }, options, { cwd: cwd })); }, function () { return uninstall(name, extend({ emitter: emitter }, options)); });
|
||||
}
|
||||
exports.uninstallDependency = uninstallDependency;
|
||||
function writeToConfig(name, options) {
|
||||
if (options.save || options.saveDev) {
|
||||
return fs_1.transformConfig(options.cwd, function (config) {
|
||||
if (options.save) {
|
||||
if (options.ambient) {
|
||||
if (config.ambientDependencies && config.ambientDependencies[name]) {
|
||||
delete config.ambientDependencies[name];
|
||||
}
|
||||
else {
|
||||
return Promise.reject(new TypeError("Typings for \"" + name + "\" are not listed in ambient dependencies"));
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (config.dependencies && config.dependencies[name]) {
|
||||
delete config.dependencies[name];
|
||||
}
|
||||
else {
|
||||
return Promise.reject(new TypeError("Typings for \"" + name + "\" are not listed in dependencies"));
|
||||
}
|
||||
}
|
||||
}
|
||||
if (options.saveDev) {
|
||||
if (options.ambient) {
|
||||
if (config.ambientDevDependencies && config.ambientDevDependencies[name]) {
|
||||
delete config.ambientDevDependencies[name];
|
||||
}
|
||||
else {
|
||||
return Promise.reject(new TypeError("Typings for \"" + name + "\" are not listed in ambient dev dependencies"));
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (config.devDependencies && config.devDependencies[name]) {
|
||||
delete config.devDependencies[name];
|
||||
}
|
||||
else {
|
||||
return Promise.reject(new TypeError("Typings for \"" + name + "\" are not listed in dev dependencies"));
|
||||
}
|
||||
}
|
||||
}
|
||||
if (options.savePeer) {
|
||||
if (config.peerDependencies && config.peerDependencies[name]) {
|
||||
delete config.peerDependencies[name];
|
||||
}
|
||||
else {
|
||||
return Promise.reject(new TypeError("Typings for \"" + name + "\" are not listed in peer dependencies"));
|
||||
}
|
||||
}
|
||||
return config;
|
||||
});
|
||||
}
|
||||
}
|
||||
function removeDependency(name, options) {
|
||||
var cwd = options.cwd, ambient = options.ambient;
|
||||
var location = path_1.getDependencyLocation({ name: name, cwd: cwd, ambient: ambient });
|
||||
function remove(dir, path, dtsPath) {
|
||||
return fs_1.isFile(path)
|
||||
.then(function (exists) {
|
||||
if (!exists) {
|
||||
options.emitter.emit('enoent', { path: path });
|
||||
}
|
||||
return promise_finally_1.default(fs_1.rimraf(dir), function () {
|
||||
return fs_1.transformDtsFile(dtsPath, function (typings) {
|
||||
return typings.filter(function (x) { return x !== path; });
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
return Promise.all([
|
||||
remove(location.mainPath, location.mainFile, location.mainDtsFile),
|
||||
remove(location.browserPath, location.browserFile, location.browserDtsFile)
|
||||
]).then(function () { return undefined; });
|
||||
}
|
||||
//# sourceMappingURL=uninstall.js.map
|
1
node_modules/typings-core/dist/uninstall.js.map
generated
vendored
Normal file
1
node_modules/typings-core/dist/uninstall.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"uninstall.js","sourceRoot":"","sources":["../src/uninstall.ts"],"names":[],"mappings":"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"}
|
10
node_modules/typings-core/dist/utils/config.d.ts
generated
vendored
Normal file
10
node_modules/typings-core/dist/utils/config.d.ts
generated
vendored
Normal file
@ -0,0 +1,10 @@
|
||||
export declare const PROJECT_NAME: string;
|
||||
export declare const PRETTY_PROJECT_NAME: string;
|
||||
export declare const CONFIG_FILE: string;
|
||||
export declare const TYPINGS_DIR: string;
|
||||
export declare const DTS_MAIN_FILE: string;
|
||||
export declare const DTS_BROWSER_FILE: string;
|
||||
export declare const HOMEPAGE: string;
|
||||
export declare const ISSUES_HOMEPAGE: string;
|
||||
export declare const DEPENDENCY_SEPARATOR: string;
|
||||
export declare const REGISTRY_URL: string;
|
12
node_modules/typings-core/dist/utils/config.js
generated
vendored
Normal file
12
node_modules/typings-core/dist/utils/config.js
generated
vendored
Normal file
@ -0,0 +1,12 @@
|
||||
"use strict";
|
||||
exports.PROJECT_NAME = 'typings';
|
||||
exports.PRETTY_PROJECT_NAME = 'Typings';
|
||||
exports.CONFIG_FILE = exports.PROJECT_NAME + ".json";
|
||||
exports.TYPINGS_DIR = exports.PROJECT_NAME;
|
||||
exports.DTS_MAIN_FILE = 'main.d.ts';
|
||||
exports.DTS_BROWSER_FILE = 'browser.d.ts';
|
||||
exports.HOMEPAGE = 'https://github.com/typings/typings';
|
||||
exports.ISSUES_HOMEPAGE = 'https://github.com/typings/typings/issues';
|
||||
exports.DEPENDENCY_SEPARATOR = '~';
|
||||
exports.REGISTRY_URL = 'https://api.typings.org';
|
||||
//# sourceMappingURL=config.js.map
|
1
node_modules/typings-core/dist/utils/config.js.map
generated
vendored
Normal file
1
node_modules/typings-core/dist/utils/config.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/utils/config.ts"],"names":[],"mappings":";AAAa,oBAAY,GAAG,SAAS,CAAA;AACxB,2BAAmB,GAAG,SAAS,CAAA;AAC/B,mBAAW,GAAM,oBAAY,UAAO,CAAA;AACpC,mBAAW,GAAG,oBAAY,CAAA;AAC1B,qBAAa,GAAG,WAAW,CAAA;AAC3B,wBAAgB,GAAG,cAAc,CAAA;AAEjC,gBAAQ,GAAG,oCAAoC,CAAA;AAC/C,uBAAe,GAAG,2CAA2C,CAAA;AAE7D,4BAAoB,GAAG,GAAG,CAAA;AAE1B,oBAAY,GAAG,yBAAyB,CAAA"}
|
3
node_modules/typings-core/dist/utils/debug.d.ts
generated
vendored
Normal file
3
node_modules/typings-core/dist/utils/debug.d.ts
generated
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
import debug = require('debug');
|
||||
declare var _default: debug.Debugger;
|
||||
export default _default;
|
6
node_modules/typings-core/dist/utils/debug.js
generated
vendored
Normal file
6
node_modules/typings-core/dist/utils/debug.js
generated
vendored
Normal file
@ -0,0 +1,6 @@
|
||||
"use strict";
|
||||
var debug = require('debug');
|
||||
var config_1 = require('./config');
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.default = debug(config_1.PROJECT_NAME);
|
||||
//# sourceMappingURL=debug.js.map
|
1
node_modules/typings-core/dist/utils/debug.js.map
generated
vendored
Normal file
1
node_modules/typings-core/dist/utils/debug.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"debug.js","sourceRoot":"","sources":["../../src/utils/debug.ts"],"names":[],"mappings":";AAAA,IAAO,KAAK,WAAW,OAAO,CAAC,CAAA;AAC/B,uBAA6B,UAE7B,CAAC,CAFsC;AAEvC;kBAAe,KAAK,CAAC,qBAAY,CAAC,CAAA"}
|
4
node_modules/typings-core/dist/utils/find.d.ts
generated
vendored
Normal file
4
node_modules/typings-core/dist/utils/find.d.ts
generated
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
import Promise = require('any-promise');
|
||||
export declare function findProject(dir: string): Promise<string>;
|
||||
export declare function findConfigFile(dir: string): Promise<string>;
|
||||
export declare function findUp(dir: string, filename: string, from?: string): Promise<string>;
|
30
node_modules/typings-core/dist/utils/find.js
generated
vendored
Normal file
30
node_modules/typings-core/dist/utils/find.js
generated
vendored
Normal file
@ -0,0 +1,30 @@
|
||||
"use strict";
|
||||
var path_1 = require('path');
|
||||
var Promise = require('any-promise');
|
||||
var fs_1 = require('../utils/fs');
|
||||
var config_1 = require('./config');
|
||||
function findProject(dir) {
|
||||
return findConfigFile(dir).then(path_1.dirname);
|
||||
}
|
||||
exports.findProject = findProject;
|
||||
function findConfigFile(dir) {
|
||||
return findUp(dir, config_1.CONFIG_FILE);
|
||||
}
|
||||
exports.findConfigFile = findConfigFile;
|
||||
function findUp(dir, filename, from) {
|
||||
if (from === void 0) { from = dir; }
|
||||
var path = path_1.join(dir, filename);
|
||||
return fs_1.isFile(path)
|
||||
.then(function (exists) {
|
||||
return exists ? path : findUpParent(dir, filename, from);
|
||||
});
|
||||
}
|
||||
exports.findUp = findUp;
|
||||
function findUpParent(dir, filename, from) {
|
||||
var parentDir = path_1.dirname(dir);
|
||||
if (dir === parentDir) {
|
||||
return Promise.reject(new Error("Unable to find \"" + filename + "\" from \"" + from + "\""));
|
||||
}
|
||||
return findUp(parentDir, filename, from);
|
||||
}
|
||||
//# sourceMappingURL=find.js.map
|
1
node_modules/typings-core/dist/utils/find.js.map
generated
vendored
Normal file
1
node_modules/typings-core/dist/utils/find.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"find.js","sourceRoot":"","sources":["../../src/utils/find.ts"],"names":[],"mappings":";AAAA,qBAA8B,MAC9B,CAAC,CADmC;AACpC,IAAO,OAAO,WAAW,aAAa,CAAC,CAAA;AACvC,mBAAuB,aACvB,CAAC,CADmC;AACpC,uBAA4B,UAE5B,CAAC,CAFqC;AAEtC,qBAA6B,GAAW;IACtC,MAAM,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,cAAO,CAAC,CAAA;AAC1C,CAAC;AAFe,mBAAW,cAE1B,CAAA;AAED,wBAAgC,GAAW;IACzC,MAAM,CAAC,MAAM,CAAC,GAAG,EAAE,oBAAW,CAAC,CAAA;AACjC,CAAC;AAFe,sBAAc,iBAE7B,CAAA;AAED,gBAAwB,GAAW,EAAE,QAAgB,EAAE,IAAU;IAAV,oBAAU,GAAV,UAAU;IAC/D,IAAM,IAAI,GAAG,WAAI,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAA;IAEhC,MAAM,CAAC,WAAM,CAAC,IAAI,CAAC;SAChB,IAAI,CAAC,UAAU,MAAM;QACpB,MAAM,CAAC,MAAM,GAAG,IAAI,GAAG,YAAY,CAAC,GAAG,EAAE,QAAQ,EAAE,IAAI,CAAC,CAAA;IAC1D,CAAC,CAAC,CAAA;AACN,CAAC;AAPe,cAAM,SAOrB,CAAA;AAED,sBAAuB,GAAW,EAAE,QAAgB,EAAE,IAAY;IAChE,IAAM,SAAS,GAAG,cAAO,CAAC,GAAG,CAAC,CAAA;IAE9B,EAAE,CAAC,CAAC,GAAG,KAAK,SAAS,CAAC,CAAC,CAAC;QACtB,MAAM,CAAC,OAAO,CAAC,MAAM,CAAO,IAAI,KAAK,CAAC,sBAAmB,QAAQ,kBAAW,IAAI,OAAG,CAAC,CAAC,CAAA;IACvF,CAAC;IAED,MAAM,CAAC,MAAM,CAAC,SAAS,EAAE,QAAQ,EAAE,IAAI,CAAC,CAAA;AAC1C,CAAC"}
|
37
node_modules/typings-core/dist/utils/fs.d.ts
generated
vendored
Normal file
37
node_modules/typings-core/dist/utils/fs.d.ts
generated
vendored
Normal file
@ -0,0 +1,37 @@
|
||||
import * as fs from 'graceful-fs';
|
||||
import Promise = require('any-promise');
|
||||
import lockfile = require('lockfile');
|
||||
import Touch = require('touch');
|
||||
import { ConfigJson } from '../interfaces';
|
||||
export declare type Stats = fs.Stats;
|
||||
export declare type LockOp = (path: string, options?: lockfile.Options) => Promise<void>;
|
||||
export declare type TouchOp = (path: string, options?: Touch.Options) => Promise<void>;
|
||||
export declare type StatOp = (path: string) => Promise<Stats>;
|
||||
export declare type ReadFileOp = (path: string, encoding: string) => Promise<string>;
|
||||
export declare type WriteFileOp = (path: string, contents: string | Buffer) => Promise<void>;
|
||||
export declare type MkdirpOp = (path: string) => Promise<string>;
|
||||
export declare type PathOp = (path: string) => Promise<void>;
|
||||
export declare const touch: TouchOp;
|
||||
export declare const stat: StatOp;
|
||||
export declare const readFile: ReadFileOp;
|
||||
export declare const writeFile: WriteFileOp;
|
||||
export declare const mkdirp: MkdirpOp;
|
||||
export declare const unlink: PathOp;
|
||||
export declare const lock: LockOp;
|
||||
export declare const unlock: PathOp;
|
||||
export declare const rimraf: PathOp;
|
||||
export declare function isFile(path: string): Promise<boolean>;
|
||||
export declare function readJson(path: string, allowEmpty?: boolean): Promise<any>;
|
||||
export declare function writeJson(path: string, json: any, indent?: string | number, eol?: string): Promise<void>;
|
||||
export declare function readConfig(path: string): Promise<ConfigJson>;
|
||||
export declare function readConfigFrom(path: string): Promise<ConfigJson>;
|
||||
export declare function parseConfig(config: ConfigJson, path: string): ConfigJson;
|
||||
export declare const readHttp: (url: string) => Promise<string>;
|
||||
export declare function readFileFrom(from: string): Promise<string>;
|
||||
export declare function readJsonFrom(from: string, allowEmpty?: boolean): Promise<any>;
|
||||
export declare function stringifyJson(json: any, indent?: number | string, eol?: string): string;
|
||||
export declare function parseJson(contents: string, path: string, allowEmpty: boolean): any;
|
||||
export declare function transformFile(path: string, transform: (contents: string) => string | Promise<string>): Promise<void>;
|
||||
export declare function transformJson<T>(path: string, transform: (json: T) => T, allowEmpty?: boolean): Promise<void>;
|
||||
export declare function transformConfig(cwd: string, transform: (config: ConfigJson) => ConfigJson): Promise<void>;
|
||||
export declare function transformDtsFile(path: string, transform: (typings: string[]) => string[]): Promise<void>;
|
201
node_modules/typings-core/dist/utils/fs.js
generated
vendored
Normal file
201
node_modules/typings-core/dist/utils/fs.js
generated
vendored
Normal file
@ -0,0 +1,201 @@
|
||||
"use strict";
|
||||
var fs = require('graceful-fs');
|
||||
var Promise = require('any-promise');
|
||||
var thenify = require('thenify');
|
||||
var stripBom = require('strip-bom');
|
||||
var parse = require('parse-json');
|
||||
var popsicle = require('popsicle');
|
||||
var popsicleStatus = require('popsicle-status');
|
||||
var popsicleRetry = require('popsicle-retry');
|
||||
var detectIndent = require('detect-indent');
|
||||
var sortKeys = require('sort-keys');
|
||||
var Mkdirp = require('mkdirp');
|
||||
var uniq = require('array-uniq');
|
||||
var lockfile = require('lockfile');
|
||||
var Rimraf = require('rimraf');
|
||||
var popsicleProxy = require('popsicle-proxy-agent');
|
||||
var Throat = require('throat');
|
||||
var promise_finally_1 = require('promise-finally');
|
||||
var Touch = require('touch');
|
||||
var path_1 = require('path');
|
||||
var url_1 = require('url');
|
||||
var template = require('string-template');
|
||||
var config_1 = require('./config');
|
||||
var path_2 = require('./path');
|
||||
var references_1 = require('./references');
|
||||
var rc_1 = require('./rc');
|
||||
var store_1 = require('./store');
|
||||
var debug_1 = require('./debug');
|
||||
var pkg = require('../../package.json');
|
||||
var registryURL = url_1.parse(rc_1.default.registryURL);
|
||||
var throat = Throat(Promise);
|
||||
exports.touch = throat(10, thenify(Touch));
|
||||
exports.stat = throat(10, thenify(fs.stat));
|
||||
exports.readFile = throat(10, thenify(fs.readFile));
|
||||
exports.writeFile = thenify(fs.writeFile);
|
||||
exports.mkdirp = throat(10, thenify(Mkdirp));
|
||||
exports.unlink = throat(10, thenify(fs.unlink));
|
||||
exports.lock = throat(10, thenify(lockfile.lock));
|
||||
exports.unlock = throat(10, thenify(lockfile.unlock));
|
||||
exports.rimraf = throat(10, thenify(Rimraf));
|
||||
function isFile(path) {
|
||||
return exports.stat(path).then(function (stat) { return stat.isFile(); }, function () { return false; });
|
||||
}
|
||||
exports.isFile = isFile;
|
||||
function readJson(path, allowEmpty) {
|
||||
return exports.readFile(path, 'utf8')
|
||||
.then(stripBom)
|
||||
.then(function (contents) { return parseJson(contents, path, allowEmpty); });
|
||||
}
|
||||
exports.readJson = readJson;
|
||||
function writeJson(path, json, indent, eol) {
|
||||
return exports.writeFile(path, stringifyJson(json, indent, eol));
|
||||
}
|
||||
exports.writeJson = writeJson;
|
||||
function readConfig(path) {
|
||||
return readJson(path, true).then(function (data) { return parseConfig(data, path); });
|
||||
}
|
||||
exports.readConfig = readConfig;
|
||||
function readConfigFrom(path) {
|
||||
return readJsonFrom(path, true).then(function (data) { return parseConfig(data, path); });
|
||||
}
|
||||
exports.readConfigFrom = readConfigFrom;
|
||||
function parseConfig(config, path) {
|
||||
return config;
|
||||
}
|
||||
exports.parseConfig = parseConfig;
|
||||
exports.readHttp = throat(5, function readHttp(url) {
|
||||
var proxy = rc_1.default.proxy, httpProxy = rc_1.default.httpProxy, httpsProxy = rc_1.default.httpsProxy, noProxy = rc_1.default.noProxy, rejectUnauthorized = rc_1.default.rejectUnauthorized, ca = rc_1.default.ca, key = rc_1.default.key, cert = rc_1.default.cert, userAgent = rc_1.default.userAgent;
|
||||
return popsicle.get({
|
||||
url: url,
|
||||
headers: {
|
||||
'User-Agent': template(userAgent, {
|
||||
nodeVersion: process.version,
|
||||
platform: process.platform,
|
||||
arch: process.arch,
|
||||
typingsVersion: pkg.version
|
||||
})
|
||||
},
|
||||
options: {
|
||||
ca: ca,
|
||||
key: key,
|
||||
cert: cert,
|
||||
rejectUnauthorized: rejectUnauthorized
|
||||
},
|
||||
use: [
|
||||
popsicle.plugins.headers(),
|
||||
popsicle.plugins.unzip(),
|
||||
popsicle.plugins.concatStream('string')
|
||||
]
|
||||
})
|
||||
.use(popsicleProxy({ proxy: proxy, httpProxy: httpProxy, httpsProxy: httpsProxy, noProxy: noProxy }))
|
||||
.use(popsicleRetry())
|
||||
.use(popsicleStatus(200))
|
||||
.use(function (self) {
|
||||
var hostname = self.Url.hostname;
|
||||
if (self.Url.host === registryURL.host) {
|
||||
if (store_1.default.get('clientId')) {
|
||||
self.before(function (req) {
|
||||
req.set('Typings-Client-Id', store_1.default.get('clientId'));
|
||||
});
|
||||
}
|
||||
else {
|
||||
self.after(function (res) {
|
||||
store_1.default.set('clientId', res.get('Typings-Client-Id'));
|
||||
});
|
||||
}
|
||||
}
|
||||
if (rc_1.default.githubToken && (hostname === 'raw.githubusercontent.com' || hostname === 'api.github.com')) {
|
||||
self.before(function (req) {
|
||||
req.set('Authorization', "token " + rc_1.default.githubToken);
|
||||
});
|
||||
}
|
||||
})
|
||||
.then(function (response) {
|
||||
debug_1.default('http response', response.toJSON());
|
||||
return response.body;
|
||||
});
|
||||
});
|
||||
function readFileFrom(from) {
|
||||
return path_2.isHttp(from) ? exports.readHttp(from) : exports.readFile(from, 'utf8');
|
||||
}
|
||||
exports.readFileFrom = readFileFrom;
|
||||
function readJsonFrom(from, allowEmpty) {
|
||||
return readFileFrom(from)
|
||||
.then(stripBom)
|
||||
.then(function (contents) { return parseJson(contents, from, allowEmpty); });
|
||||
}
|
||||
exports.readJsonFrom = readJsonFrom;
|
||||
function stringifyJson(json, indent, eol) {
|
||||
if (eol === void 0) { eol = path_2.EOL; }
|
||||
return path_2.normalizeEOL(JSON.stringify(json, null, indent || 2), eol) + eol;
|
||||
}
|
||||
exports.stringifyJson = stringifyJson;
|
||||
function parseJson(contents, path, allowEmpty) {
|
||||
if (contents === '' && allowEmpty) {
|
||||
return {};
|
||||
}
|
||||
return parse(contents, null, path);
|
||||
}
|
||||
exports.parseJson = parseJson;
|
||||
function transformFile(path, transform) {
|
||||
function handle(contents) {
|
||||
return Promise.resolve(transform(contents))
|
||||
.then(function (contents) { return exports.writeFile(path, contents); });
|
||||
}
|
||||
var lockfile = path + ".lock";
|
||||
var lockOptions = { wait: 250, retries: 25, stale: 60000 };
|
||||
var result = exports.lock(lockfile, lockOptions)
|
||||
.then(function () {
|
||||
return exports.readFile(path, 'utf8');
|
||||
})
|
||||
.then(function (contents) { return handle(contents); }, function () { return handle(undefined); });
|
||||
return promise_finally_1.default(result, function () { return exports.unlock(lockfile); });
|
||||
}
|
||||
exports.transformFile = transformFile;
|
||||
function transformJson(path, transform, allowEmpty) {
|
||||
return transformFile(path, function (contents) {
|
||||
var indent = contents ? detectIndent(contents).indent : undefined;
|
||||
var json = contents ? parseJson(contents, path, allowEmpty) : undefined;
|
||||
var eol = contents ? path_2.detectEOL(contents) : undefined;
|
||||
return Promise.resolve(transform(json))
|
||||
.then(function (json) { return stringifyJson(json, indent, eol); });
|
||||
});
|
||||
}
|
||||
exports.transformJson = transformJson;
|
||||
function transformConfig(cwd, transform) {
|
||||
var path = path_1.join(cwd, config_1.CONFIG_FILE);
|
||||
return transformJson(path, function (config) {
|
||||
if (config === void 0) { config = {}; }
|
||||
return Promise.resolve(transform(parseConfig(config, path)))
|
||||
.then(function (config) {
|
||||
if (config.dependencies) {
|
||||
config.dependencies = sortKeys(config.dependencies);
|
||||
}
|
||||
if (config.peerDependencies) {
|
||||
config.peerDependencies = sortKeys(config.peerDependencies);
|
||||
}
|
||||
if (config.devDependencies) {
|
||||
config.devDependencies = sortKeys(config.devDependencies);
|
||||
}
|
||||
if (config.ambientDependencies) {
|
||||
config.ambientDependencies = sortKeys(config.ambientDependencies);
|
||||
}
|
||||
if (config.ambientDevDependencies) {
|
||||
config.ambientDevDependencies = sortKeys(config.ambientDevDependencies);
|
||||
}
|
||||
return config;
|
||||
});
|
||||
}, true);
|
||||
}
|
||||
exports.transformConfig = transformConfig;
|
||||
function transformDtsFile(path, transform) {
|
||||
var cwd = path_1.dirname(path);
|
||||
return transformFile(path, function (contents) {
|
||||
var typings = references_1.parseReferences(contents, cwd);
|
||||
return Promise.resolve(transform(typings))
|
||||
.then(function (typings) { return references_1.stringifyReferences(uniq(typings).sort(), cwd); });
|
||||
});
|
||||
}
|
||||
exports.transformDtsFile = transformDtsFile;
|
||||
//# sourceMappingURL=fs.js.map
|
1
node_modules/typings-core/dist/utils/fs.js.map
generated
vendored
Normal file
1
node_modules/typings-core/dist/utils/fs.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
12
node_modules/typings-core/dist/utils/parse.d.ts
generated
vendored
Normal file
12
node_modules/typings-core/dist/utils/parse.d.ts
generated
vendored
Normal file
@ -0,0 +1,12 @@
|
||||
import { Dependency } from '../interfaces';
|
||||
export declare function parseDependency(raw: string): Dependency;
|
||||
export declare function resolveDependency(raw: string, path: string): string;
|
||||
export declare function parseDependencyExpression(raw: string, options: {
|
||||
ambient?: boolean;
|
||||
}): {
|
||||
name: string;
|
||||
location: string;
|
||||
};
|
||||
export declare function expandRegistry(raw: string, options?: {
|
||||
ambient?: boolean;
|
||||
}): string;
|
194
node_modules/typings-core/dist/utils/parse.js
generated
vendored
Normal file
194
node_modules/typings-core/dist/utils/parse.js
generated
vendored
Normal file
@ -0,0 +1,194 @@
|
||||
"use strict";
|
||||
var invariant = require('invariant');
|
||||
var url_1 = require('url');
|
||||
var path_1 = require('path');
|
||||
var config_1 = require('./config');
|
||||
var path_2 = require('./path');
|
||||
var rc_1 = require('./rc');
|
||||
function gitFromPath(src) {
|
||||
var index = src.indexOf('#');
|
||||
var sha = index === -1 ? 'master' : src.substr(index + 1);
|
||||
var segments = index === -1 ? src.split('/') : src.substr(0, index).split('/');
|
||||
var org = segments.shift();
|
||||
var repo = segments.shift();
|
||||
var path = segments.join('/');
|
||||
var name;
|
||||
if (segments.length === 0) {
|
||||
path = config_1.CONFIG_FILE;
|
||||
}
|
||||
else if (path_2.isDefinition(path)) {
|
||||
name = path_1.basename(path_2.pathFromDefinition(path));
|
||||
}
|
||||
else if (segments[segments.length - 1] !== config_1.CONFIG_FILE) {
|
||||
path += "/" + config_1.CONFIG_FILE;
|
||||
}
|
||||
return { org: org, repo: repo, path: path, sha: sha, name: name };
|
||||
}
|
||||
function splitProtocol(raw) {
|
||||
var index = raw.indexOf(':');
|
||||
if (index === -1) {
|
||||
return [undefined, raw];
|
||||
}
|
||||
return [raw.substr(0, index), path_2.normalizeSlashes(raw.substr(index + 1))];
|
||||
}
|
||||
function parseDependency(raw) {
|
||||
var _a = splitProtocol(raw), type = _a[0], src = _a[1];
|
||||
if (type === 'file') {
|
||||
var location = path_1.normalize(src);
|
||||
var filename = path_1.basename(location);
|
||||
var name = path_2.isDefinition(filename) ? path_2.pathFromDefinition(filename) : undefined;
|
||||
invariant(filename === config_1.CONFIG_FILE || path_2.isDefinition(filename), "Only \".d.ts\" and \"" + config_1.CONFIG_FILE + "\" files are supported");
|
||||
return {
|
||||
raw: raw,
|
||||
type: type,
|
||||
meta: {
|
||||
name: name,
|
||||
path: location
|
||||
},
|
||||
location: location
|
||||
};
|
||||
}
|
||||
if (type === 'github') {
|
||||
var meta = gitFromPath(src);
|
||||
var org = meta.org, repo = meta.repo, path = meta.path, sha = meta.sha;
|
||||
var location = "https://raw.githubusercontent.com/" + org + "/" + repo + "/" + sha + "/" + path;
|
||||
return {
|
||||
raw: raw,
|
||||
meta: meta,
|
||||
type: type,
|
||||
location: location
|
||||
};
|
||||
}
|
||||
if (type === 'bitbucket') {
|
||||
var meta = gitFromPath(src);
|
||||
var org = meta.org, repo = meta.repo, path = meta.path, sha = meta.sha;
|
||||
var location = "https://bitbucket.org/" + org + "/" + repo + "/raw/" + sha + "/" + path;
|
||||
return {
|
||||
raw: raw,
|
||||
meta: meta,
|
||||
type: type,
|
||||
location: location
|
||||
};
|
||||
}
|
||||
if (type === 'npm') {
|
||||
var parts = src.split('/');
|
||||
var isScoped = parts.length > 0 && parts[0].charAt(0) === '@';
|
||||
var hasPath = isScoped ? parts.length > 2 : parts.length > 1;
|
||||
if (!hasPath) {
|
||||
parts.push('package.json');
|
||||
}
|
||||
return {
|
||||
raw: raw,
|
||||
type: 'npm',
|
||||
meta: {
|
||||
name: isScoped ? parts.slice(0, 2).join('/') : parts[0],
|
||||
path: path_1.join.apply(void 0, parts.slice(isScoped ? 2 : 1))
|
||||
},
|
||||
location: path_1.join.apply(void 0, parts)
|
||||
};
|
||||
}
|
||||
if (type === 'bower') {
|
||||
var parts = src.split('/');
|
||||
if (parts.length === 1) {
|
||||
parts.push('bower.json');
|
||||
}
|
||||
return {
|
||||
raw: raw,
|
||||
type: 'bower',
|
||||
meta: {
|
||||
name: parts[0],
|
||||
path: path_1.join.apply(void 0, parts.slice(1))
|
||||
},
|
||||
location: path_1.join.apply(void 0, parts)
|
||||
};
|
||||
}
|
||||
if (type === 'http' || type === 'https') {
|
||||
return {
|
||||
raw: raw,
|
||||
type: type,
|
||||
meta: {},
|
||||
location: raw
|
||||
};
|
||||
}
|
||||
if (type === 'registry') {
|
||||
var parts = /^([^\/]+)\/(.+?)(?:@(.*?)|#(.*?))?$/.exec(src);
|
||||
if (parts == null) {
|
||||
throw new TypeError("Unable to parse: " + raw);
|
||||
}
|
||||
var source = parts[1], name = parts[2], version = parts[3], tag = parts[4];
|
||||
if (version != null && tag != null) {
|
||||
throw new TypeError("Unable to use tag and version together: " + raw);
|
||||
}
|
||||
var path = "/entries/" + encodeURIComponent(source) + "/" + encodeURIComponent(name);
|
||||
if (tag) {
|
||||
path += "/tags/" + encodeURIComponent(tag);
|
||||
}
|
||||
else if (version) {
|
||||
path += "/versions/" + encodeURIComponent(version) + "/latest";
|
||||
}
|
||||
else {
|
||||
path += '/versions/latest';
|
||||
}
|
||||
return {
|
||||
raw: raw,
|
||||
type: type,
|
||||
meta: {
|
||||
source: source,
|
||||
name: name,
|
||||
version: version,
|
||||
tag: tag
|
||||
},
|
||||
location: url_1.resolve(rc_1.default.registryURL, path)
|
||||
};
|
||||
}
|
||||
throw new TypeError("Unknown dependency: " + raw);
|
||||
}
|
||||
exports.parseDependency = parseDependency;
|
||||
function resolveDependency(raw, path) {
|
||||
var _a = parseDependency(raw), type = _a.type, meta = _a.meta, location = _a.location;
|
||||
if (type === 'github' || type === 'bitbucket') {
|
||||
var org = meta.org, repo = meta.repo, sha = meta.sha;
|
||||
var resolvedPath = path_2.normalizeSlashes(path_1.join(path_1.dirname(meta.path), path));
|
||||
return type + ":" + org + "/" + repo + "/" + resolvedPath + (sha === 'master' ? '' : '#' + sha);
|
||||
}
|
||||
if (type === 'npm' || type === 'bower') {
|
||||
var resolvedPath = path_2.normalizeSlashes(path_1.join(path_1.dirname(meta.path), path));
|
||||
return type + ":" + meta.name + "/" + resolvedPath;
|
||||
}
|
||||
if (type === 'http' || type === 'https') {
|
||||
return url_1.resolve(location, path);
|
||||
}
|
||||
if (type === 'file') {
|
||||
return "file:" + path_2.normalizeSlashes(path_1.join(location, path));
|
||||
}
|
||||
throw new TypeError("Unable to resolve dependency from \"" + raw + "\"");
|
||||
}
|
||||
exports.resolveDependency = resolveDependency;
|
||||
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,
|
||||
location: location
|
||||
};
|
||||
}
|
||||
exports.parseDependencyExpression = parseDependencyExpression;
|
||||
function expandRegistry(raw, options) {
|
||||
if (options === void 0) { options = {}; }
|
||||
if (typeof raw !== 'string') {
|
||||
throw new TypeError("Expected registry name to be a string, not " + typeof raw);
|
||||
}
|
||||
var indexOf = raw.indexOf('!');
|
||||
var source = options.ambient ? rc_1.default.defaultAmbientSource : rc_1.default.defaultSource;
|
||||
var name;
|
||||
if (indexOf === -1) {
|
||||
name = raw;
|
||||
}
|
||||
else {
|
||||
source = raw.substr(0, indexOf);
|
||||
name = raw.substr(indexOf + 1);
|
||||
}
|
||||
return "registry:" + source + "/" + name;
|
||||
}
|
||||
exports.expandRegistry = expandRegistry;
|
||||
//# sourceMappingURL=parse.js.map
|
1
node_modules/typings-core/dist/utils/parse.js.map
generated
vendored
Normal file
1
node_modules/typings-core/dist/utils/parse.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
32
node_modules/typings-core/dist/utils/path.d.ts
generated
vendored
Normal file
32
node_modules/typings-core/dist/utils/path.d.ts
generated
vendored
Normal file
@ -0,0 +1,32 @@
|
||||
export declare const EOL: string;
|
||||
export declare function isHttp(url: string): boolean;
|
||||
export declare function isDefinition(path: string): boolean;
|
||||
export declare function isModuleName(value: string): boolean;
|
||||
export declare function normalizeSlashes(path: string): string;
|
||||
export declare function resolveFrom(from: string, to: string): string;
|
||||
export declare function relativeTo(from: string, to: string): string;
|
||||
export declare function toDefinition(path: string): string;
|
||||
export declare function pathFromDefinition(path: string): string;
|
||||
export declare function normalizeToDefinition(path: string): string;
|
||||
export declare function getTypingsLocation(options: {
|
||||
cwd: string;
|
||||
}): {
|
||||
typingsDir: string;
|
||||
mainDtsFile: string;
|
||||
browserDtsFile: string;
|
||||
};
|
||||
export interface DefinitionOptions {
|
||||
cwd: string;
|
||||
name: string;
|
||||
ambient?: boolean;
|
||||
}
|
||||
export declare function getDependencyLocation(options: DefinitionOptions): {
|
||||
mainFile: string;
|
||||
browserFile: string;
|
||||
mainPath: string;
|
||||
browserPath: string;
|
||||
mainDtsFile: string;
|
||||
browserDtsFile: string;
|
||||
};
|
||||
export declare function detectEOL(contents: string): string;
|
||||
export declare function normalizeEOL(contents: string, eol: string): string;
|
127
node_modules/typings-core/dist/utils/path.js
generated
vendored
Normal file
127
node_modules/typings-core/dist/utils/path.js
generated
vendored
Normal file
@ -0,0 +1,127 @@
|
||||
"use strict";
|
||||
var path_1 = require('path');
|
||||
var url_1 = require('url');
|
||||
var config_1 = require('./config');
|
||||
var isAbsolute = require('is-absolute');
|
||||
var mainTypingsDir = path_1.join(config_1.TYPINGS_DIR, 'main/definitions');
|
||||
var browserTypingsDir = path_1.join(config_1.TYPINGS_DIR, 'browser/definitions');
|
||||
var ambientMainTypingsDir = path_1.join(config_1.TYPINGS_DIR, 'main/ambient');
|
||||
var ambientBrowserTypingsDir = path_1.join(config_1.TYPINGS_DIR, 'browser/ambient');
|
||||
exports.EOL = '\n';
|
||||
function isHttp(url) {
|
||||
return /^https?\:\/\//i.test(url);
|
||||
}
|
||||
exports.isHttp = isHttp;
|
||||
function isDefinition(path) {
|
||||
if (isHttp(path)) {
|
||||
return isDefinition(url_1.parse(path).pathname);
|
||||
}
|
||||
return /\.d\.ts$/.test(path);
|
||||
}
|
||||
exports.isDefinition = isDefinition;
|
||||
function isModuleName(value) {
|
||||
return !isHttp(value) && !isAbsolute(value) && value.charAt(0) !== '.';
|
||||
}
|
||||
exports.isModuleName = isModuleName;
|
||||
function normalizeSlashes(path) {
|
||||
return path.replace(/\\/g, '/');
|
||||
}
|
||||
exports.normalizeSlashes = normalizeSlashes;
|
||||
function resolveFrom(from, to) {
|
||||
if (isHttp(to)) {
|
||||
return to;
|
||||
}
|
||||
if (isHttp(from)) {
|
||||
var url = url_1.parse(from);
|
||||
url.pathname = url_1.resolve(url.pathname, to);
|
||||
return url_1.format(url);
|
||||
}
|
||||
return path_1.resolve(path_1.dirname(from), to);
|
||||
}
|
||||
exports.resolveFrom = resolveFrom;
|
||||
function relativeTo(from, to) {
|
||||
if (isHttp(from)) {
|
||||
var fromUrl = url_1.parse(from);
|
||||
if (isHttp(to)) {
|
||||
var toUrl = url_1.parse(to);
|
||||
if (toUrl.auth !== fromUrl.auth || toUrl.host !== fromUrl.host) {
|
||||
return to;
|
||||
}
|
||||
var relativeUrl = relativeTo(fromUrl.pathname, toUrl.pathname);
|
||||
if (toUrl.search) {
|
||||
relativeUrl += toUrl.search;
|
||||
}
|
||||
if (toUrl.hash) {
|
||||
relativeUrl += toUrl.hash;
|
||||
}
|
||||
return relativeUrl;
|
||||
}
|
||||
return relativeTo(fromUrl.pathname, to);
|
||||
}
|
||||
return path_1.relative(path_1.dirname(from), to);
|
||||
}
|
||||
exports.relativeTo = relativeTo;
|
||||
function toDefinition(path) {
|
||||
if (isHttp(path)) {
|
||||
var url = url_1.parse(path);
|
||||
url.pathname = toDefinition(url.pathname);
|
||||
return url_1.format(url);
|
||||
}
|
||||
return path + ".d.ts";
|
||||
}
|
||||
exports.toDefinition = toDefinition;
|
||||
function pathFromDefinition(path) {
|
||||
if (isHttp(path)) {
|
||||
return pathFromDefinition(url_1.parse(path).pathname);
|
||||
}
|
||||
return path.replace(/\.d\.ts$/, '');
|
||||
}
|
||||
exports.pathFromDefinition = pathFromDefinition;
|
||||
function normalizeToDefinition(path) {
|
||||
if (isDefinition(path)) {
|
||||
return path;
|
||||
}
|
||||
if (isHttp(path)) {
|
||||
var url = url_1.parse(path);
|
||||
url.pathname = normalizeToDefinition(path);
|
||||
return url_1.format(url);
|
||||
}
|
||||
var ext = path_1.extname(path);
|
||||
return toDefinition(ext ? path.slice(0, -ext.length) : path);
|
||||
}
|
||||
exports.normalizeToDefinition = normalizeToDefinition;
|
||||
function getTypingsLocation(options) {
|
||||
var typingsDir = path_1.join(options.cwd, config_1.TYPINGS_DIR);
|
||||
var mainDtsFile = path_1.join(typingsDir, config_1.DTS_MAIN_FILE);
|
||||
var browserDtsFile = path_1.join(typingsDir, config_1.DTS_BROWSER_FILE);
|
||||
return { typingsDir: typingsDir, mainDtsFile: mainDtsFile, browserDtsFile: browserDtsFile };
|
||||
}
|
||||
exports.getTypingsLocation = getTypingsLocation;
|
||||
function getDependencyLocation(options) {
|
||||
var mainDir = options.ambient ? ambientMainTypingsDir : mainTypingsDir;
|
||||
var browserDir = options.ambient ? ambientBrowserTypingsDir : browserTypingsDir;
|
||||
var _a = getTypingsLocation(options), mainDtsFile = _a.mainDtsFile, browserDtsFile = _a.browserDtsFile;
|
||||
var mainPath = path_1.join(options.cwd, mainDir, options.name);
|
||||
var browserPath = path_1.join(options.cwd, browserDir, options.name);
|
||||
var mainFile = path_1.join(mainPath, 'index.d.ts');
|
||||
var browserFile = path_1.join(browserPath, 'index.d.ts');
|
||||
return {
|
||||
mainFile: mainFile,
|
||||
browserFile: browserFile,
|
||||
mainPath: mainPath,
|
||||
browserPath: browserPath,
|
||||
mainDtsFile: mainDtsFile,
|
||||
browserDtsFile: browserDtsFile
|
||||
};
|
||||
}
|
||||
exports.getDependencyLocation = getDependencyLocation;
|
||||
function detectEOL(contents) {
|
||||
var match = contents.match(/\r\n|\r|\n/);
|
||||
return match ? match[0] : undefined;
|
||||
}
|
||||
exports.detectEOL = detectEOL;
|
||||
function normalizeEOL(contents, eol) {
|
||||
return contents.replace(/\r\n|\r|\n/g, eol);
|
||||
}
|
||||
exports.normalizeEOL = normalizeEOL;
|
||||
//# sourceMappingURL=path.js.map
|
1
node_modules/typings-core/dist/utils/path.js.map
generated
vendored
Normal file
1
node_modules/typings-core/dist/utils/path.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"path.js","sourceRoot":"","sources":["../../src/utils/path.ts"],"names":[],"mappings":"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"}
|
9
node_modules/typings-core/dist/utils/rc.d.ts
generated
vendored
Normal file
9
node_modules/typings-core/dist/utils/rc.d.ts
generated
vendored
Normal file
@ -0,0 +1,9 @@
|
||||
import { RcConfig } from '../interfaces';
|
||||
export declare const DEFAULTS: {
|
||||
userAgent: string;
|
||||
registryURL: string;
|
||||
defaultSource: string;
|
||||
defaultAmbientSource: string;
|
||||
};
|
||||
declare var _default: RcConfig;
|
||||
export default _default;
|
13
node_modules/typings-core/dist/utils/rc.js
generated
vendored
Normal file
13
node_modules/typings-core/dist/utils/rc.js
generated
vendored
Normal file
@ -0,0 +1,13 @@
|
||||
"use strict";
|
||||
var rc = require('rc');
|
||||
var extend = require('xtend');
|
||||
var config_1 = require('./config');
|
||||
exports.DEFAULTS = {
|
||||
userAgent: config_1.PROJECT_NAME + "/{typingsVersion} node/{nodeVersion} {platform} {arch}",
|
||||
registryURL: config_1.REGISTRY_URL,
|
||||
defaultSource: 'npm',
|
||||
defaultAmbientSource: 'dt'
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.default = extend(exports.DEFAULTS, rc(config_1.PROJECT_NAME));
|
||||
//# sourceMappingURL=rc.js.map
|
1
node_modules/typings-core/dist/utils/rc.js.map
generated
vendored
Normal file
1
node_modules/typings-core/dist/utils/rc.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"rc.js","sourceRoot":"","sources":["../../src/utils/rc.ts"],"names":[],"mappings":";AAAA,IAAO,EAAE,WAAW,IAAI,CAAC,CAAA;AACzB,IAAO,MAAM,WAAW,OAAO,CAAC,CAAA;AAChC,uBAA2C,UAC3C,CAAC,CADoD;AAGxC,gBAAQ,GAAG;IACtB,SAAS,EAAK,qBAAY,2DAAwD;IAClF,WAAW,EAAE,qBAAY;IACzB,aAAa,EAAE,KAAK;IACpB,oBAAoB,EAAE,IAAI;CAC3B,CAAA;AAED;kBAAe,MAAM,CAAC,gBAAQ,EAAE,EAAE,CAAC,qBAAY,CAAC,CAAa,CAAA"}
|
10
node_modules/typings-core/dist/utils/references.d.ts
generated
vendored
Normal file
10
node_modules/typings-core/dist/utils/references.d.ts
generated
vendored
Normal file
@ -0,0 +1,10 @@
|
||||
export declare const REFERENCE_REGEXP: RegExp;
|
||||
export interface Reference {
|
||||
start: number;
|
||||
end: number;
|
||||
path: string;
|
||||
}
|
||||
export declare function extractReferences(contents: string, cwd: string): Reference[];
|
||||
export declare function parseReferences(contents: string, cwd: string): string[];
|
||||
export declare function stringifyReferences(paths: string[], cwd: string): string;
|
||||
export declare function toReference(path: string, cwd: string): string;
|
31
node_modules/typings-core/dist/utils/references.js
generated
vendored
Normal file
31
node_modules/typings-core/dist/utils/references.js
generated
vendored
Normal file
@ -0,0 +1,31 @@
|
||||
"use strict";
|
||||
var path_1 = require('path');
|
||||
var isAbsolute = require('is-absolute');
|
||||
var path_2 = require('./path');
|
||||
exports.REFERENCE_REGEXP = /^\/\/\/[ \t]*<reference[ \t]+path[ \t]*=("|')(.*?)\1.*?\/>[ \t]*\r?\n?/gm;
|
||||
function extractReferences(contents, cwd) {
|
||||
var refs = [];
|
||||
var m;
|
||||
while ((m = exports.REFERENCE_REGEXP.exec(contents)) != null) {
|
||||
refs.push({
|
||||
start: m.index,
|
||||
end: m.index + m[0].length,
|
||||
path: path_1.resolve(cwd, m[2])
|
||||
});
|
||||
}
|
||||
return refs;
|
||||
}
|
||||
exports.extractReferences = extractReferences;
|
||||
function parseReferences(contents, cwd) {
|
||||
return extractReferences(contents, cwd).map(function (ref) { return path_1.resolve(cwd, ref.path); });
|
||||
}
|
||||
exports.parseReferences = parseReferences;
|
||||
function stringifyReferences(paths, cwd) {
|
||||
return paths.map(function (path) { return toReference(path, cwd); }).join(path_2.EOL) + path_2.EOL;
|
||||
}
|
||||
exports.stringifyReferences = stringifyReferences;
|
||||
function toReference(path, cwd) {
|
||||
return "/// <reference path=\"" + path_2.normalizeSlashes(isAbsolute(path) ? path_1.relative(cwd, path) : path_1.normalize(path)) + "\" />";
|
||||
}
|
||||
exports.toReference = toReference;
|
||||
//# sourceMappingURL=references.js.map
|
1
node_modules/typings-core/dist/utils/references.js.map
generated
vendored
Normal file
1
node_modules/typings-core/dist/utils/references.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"references.js","sourceRoot":"","sources":["../../src/utils/references.ts"],"names":[],"mappings":";AAAA,qBAA6C,MAC7C,CAAC,CADkD;AACnD,IAAO,UAAU,WAAW,aAAa,CAAC,CAAA;AAC1C,qBAAsC,QAMtC,CAAC,CAN6C;AAMjC,wBAAgB,GAAG,0EAA0E,CAAA;AAY1G,2BAAmC,QAAgB,EAAE,GAAW;IAC9D,IAAM,IAAI,GAAgB,EAAE,CAAA;IAC5B,IAAI,CAAkB,CAAA;IAEtB,OAAO,CAAC,CAAC,GAAG,wBAAgB,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,IAAI,IAAI,EAAE,CAAC;QACrD,IAAI,CAAC,IAAI,CAAC;YACR,KAAK,EAAE,CAAC,CAAC,KAAK;YACd,GAAG,EAAE,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM;YAC1B,IAAI,EAAE,cAAO,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;SACzB,CAAC,CAAA;IACJ,CAAC;IAED,MAAM,CAAC,IAAI,CAAA;AACb,CAAC;AAbe,yBAAiB,oBAahC,CAAA;AAED,yBAAiC,QAAgB,EAAE,GAAW;IAC5D,MAAM,CAAC,iBAAiB,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC,GAAG,CAAC,UAAA,GAAG,IAAI,OAAA,cAAO,CAAC,GAAG,EAAE,GAAG,CAAC,IAAI,CAAC,EAAtB,CAAsB,CAAC,CAAA;AAC5E,CAAC;AAFe,uBAAe,kBAE9B,CAAA;AAED,6BAAqC,KAAe,EAAE,GAAW;IAC/D,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,UAAA,IAAI,IAAI,OAAA,WAAW,CAAC,IAAI,EAAE,GAAG,CAAC,EAAtB,CAAsB,CAAC,CAAC,IAAI,CAAC,UAAG,CAAC,GAAG,UAAG,CAAA;AAClE,CAAC;AAFe,2BAAmB,sBAElC,CAAA;AAED,qBAA6B,IAAY,EAAE,GAAW;IACpD,MAAM,CAAC,2BAAwB,uBAAgB,CAAC,UAAU,CAAC,IAAI,CAAC,GAAG,eAAQ,CAAC,GAAG,EAAE,IAAI,CAAC,GAAG,gBAAS,CAAC,IAAI,CAAC,CAAC,UAAM,CAAA;AACjH,CAAC;AAFe,mBAAW,cAE1B,CAAA"}
|
3
node_modules/typings-core/dist/utils/store.d.ts
generated
vendored
Normal file
3
node_modules/typings-core/dist/utils/store.d.ts
generated
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
import ConfigStore = require('configstore');
|
||||
declare var _default: ConfigStore;
|
||||
export default _default;
|
6
node_modules/typings-core/dist/utils/store.js
generated
vendored
Normal file
6
node_modules/typings-core/dist/utils/store.js
generated
vendored
Normal file
@ -0,0 +1,6 @@
|
||||
"use strict";
|
||||
var ConfigStore = require('configstore');
|
||||
var config_1 = require('./config');
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.default = new ConfigStore(config_1.PROJECT_NAME);
|
||||
//# sourceMappingURL=store.js.map
|
1
node_modules/typings-core/dist/utils/store.js.map
generated
vendored
Normal file
1
node_modules/typings-core/dist/utils/store.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"store.js","sourceRoot":"","sources":["../../src/utils/store.ts"],"names":[],"mappings":";AAAA,IAAO,WAAW,WAAW,aAAa,CAAC,CAAA;AAC3C,uBAA6B,UAE7B,CAAC,CAFsC;AAEvC;kBAAe,IAAI,WAAW,CAAC,qBAAY,CAAC,CAAA"}
|
6
node_modules/typings-core/dist/view.d.ts
generated
vendored
Normal file
6
node_modules/typings-core/dist/view.d.ts
generated
vendored
Normal file
@ -0,0 +1,6 @@
|
||||
import Promise = require('any-promise');
|
||||
export interface ViewOptions {
|
||||
ambient?: boolean;
|
||||
}
|
||||
export declare function viewEntry(raw: string, options?: ViewOptions): Promise<{}>;
|
||||
export declare function viewVersions(raw: string, options?: ViewOptions): Promise<{}>;
|
28
node_modules/typings-core/dist/view.js
generated
vendored
Normal file
28
node_modules/typings-core/dist/view.js
generated
vendored
Normal file
@ -0,0 +1,28 @@
|
||||
"use strict";
|
||||
var Promise = require('any-promise');
|
||||
var url_1 = require('url');
|
||||
var fs_1 = require('./utils/fs');
|
||||
var parse_1 = require('./utils/parse');
|
||||
var rc_1 = require('./utils/rc');
|
||||
function viewEntry(raw, options) {
|
||||
if (options === void 0) { options = {}; }
|
||||
return new Promise(function (resolve) {
|
||||
var meta = parse_1.parseDependency(parse_1.expandRegistry(raw, options)).meta;
|
||||
var path = "entries/" + encodeURIComponent(meta.source) + "/" + encodeURIComponent(meta.name);
|
||||
return resolve(fs_1.readJsonFrom(url_1.resolve(rc_1.default.registryURL, path)));
|
||||
});
|
||||
}
|
||||
exports.viewEntry = viewEntry;
|
||||
function viewVersions(raw, options) {
|
||||
if (options === void 0) { options = {}; }
|
||||
return new Promise(function (resolve) {
|
||||
var meta = parse_1.parseDependency(parse_1.expandRegistry(raw, options)).meta;
|
||||
var path = "entries/" + encodeURIComponent(meta.source) + "/" + encodeURIComponent(meta.name) + "/versions";
|
||||
if (meta.version) {
|
||||
path += "/" + encodeURIComponent(meta.version);
|
||||
}
|
||||
return resolve(fs_1.readJsonFrom(url_1.resolve(rc_1.default.registryURL, path)));
|
||||
});
|
||||
}
|
||||
exports.viewVersions = viewVersions;
|
||||
//# sourceMappingURL=view.js.map
|
1
node_modules/typings-core/dist/view.js.map
generated
vendored
Normal file
1
node_modules/typings-core/dist/view.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"view.js","sourceRoot":"","sources":["../src/view.ts"],"names":[],"mappings":";AAAA,IAAO,OAAO,WAAW,aAAa,CAAC,CAAA;AACvC,oBAAsC,KACtC,CAAC,CAD0C;AAC3C,mBAA6B,YAC7B,CAAC,CADwC;AACzC,sBAAgD,eAChD,CAAC,CAD8D;AAC/D,mBAAe,YAEf,CAAC,CAF0B;AAM3B,mBAA2B,GAAW,EAAE,OAAyB;IAAzB,uBAAyB,GAAzB,YAAyB;IAC/D,MAAM,CAAC,IAAI,OAAO,CAAC,UAAC,OAAO;QACjB,6EAAI,CAAkD;QAC9D,IAAM,IAAI,GAAG,aAAW,kBAAkB,CAAC,IAAI,CAAC,MAAM,CAAC,SAAI,kBAAkB,CAAC,IAAI,CAAC,IAAI,CAAG,CAAA;QAE1F,MAAM,CAAC,OAAO,CAAC,iBAAY,CAAC,aAAU,CAAC,YAAE,CAAC,WAAW,EAAE,IAAI,CAAC,CAAC,CAAC,CAAA;IAChE,CAAC,CAAC,CAAA;AACJ,CAAC;AAPe,iBAAS,YAOxB,CAAA;AAED,sBAA8B,GAAW,EAAE,OAAyB;IAAzB,uBAAyB,GAAzB,YAAyB;IAClE,MAAM,CAAC,IAAI,OAAO,CAAC,UAAC,OAAO;QACjB,6EAAI,CAAkD;QAC9D,IAAI,IAAI,GAAG,aAAW,kBAAkB,CAAC,IAAI,CAAC,MAAM,CAAC,SAAI,kBAAkB,CAAC,IAAI,CAAC,IAAI,CAAC,cAAW,CAAA;QAEjG,EAAE,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC;YACjB,IAAI,IAAI,MAAI,kBAAkB,CAAC,IAAI,CAAC,OAAO,CAAG,CAAA;QAChD,CAAC;QAED,MAAM,CAAC,OAAO,CAAC,iBAAY,CAAC,aAAU,CAAC,YAAE,CAAC,WAAW,EAAE,IAAI,CAAC,CAAC,CAAC,CAAA;IAChE,CAAC,CAAC,CAAA;AACJ,CAAC;AAXe,oBAAY,eAW3B,CAAA"}
|
15
node_modules/typings-core/node_modules/.bin/mkdirp
generated
vendored
Normal file
15
node_modules/typings-core/node_modules/.bin/mkdirp
generated
vendored
Normal file
@ -0,0 +1,15 @@
|
||||
#!/bin/sh
|
||||
basedir=`dirname "$0"`
|
||||
|
||||
case `uname` in
|
||||
*CYGWIN*) basedir=`cygpath -w "$basedir"`;;
|
||||
esac
|
||||
|
||||
if [ -x "$basedir/node" ]; then
|
||||
"$basedir/node" "$basedir/../mkdirp/bin/cmd.js" "$@"
|
||||
ret=$?
|
||||
else
|
||||
node "$basedir/../mkdirp/bin/cmd.js" "$@"
|
||||
ret=$?
|
||||
fi
|
||||
exit $ret
|
7
node_modules/typings-core/node_modules/.bin/mkdirp.cmd
generated
vendored
Normal file
7
node_modules/typings-core/node_modules/.bin/mkdirp.cmd
generated
vendored
Normal file
@ -0,0 +1,7 @@
|
||||
@IF EXIST "%~dp0\node.exe" (
|
||||
"%~dp0\node.exe" "%~dp0\..\mkdirp\bin\cmd.js" %*
|
||||
) ELSE (
|
||||
@SETLOCAL
|
||||
@SET PATHEXT=%PATHEXT:;.JS;=;%
|
||||
node "%~dp0\..\mkdirp\bin\cmd.js" %*
|
||||
)
|
15
node_modules/typings-core/node_modules/.bin/tsc
generated
vendored
Normal file
15
node_modules/typings-core/node_modules/.bin/tsc
generated
vendored
Normal file
@ -0,0 +1,15 @@
|
||||
#!/bin/sh
|
||||
basedir=`dirname "$0"`
|
||||
|
||||
case `uname` in
|
||||
*CYGWIN*) basedir=`cygpath -w "$basedir"`;;
|
||||
esac
|
||||
|
||||
if [ -x "$basedir/node" ]; then
|
||||
"$basedir/node" "$basedir/../typescript/bin/tsc" "$@"
|
||||
ret=$?
|
||||
else
|
||||
node "$basedir/../typescript/bin/tsc" "$@"
|
||||
ret=$?
|
||||
fi
|
||||
exit $ret
|
7
node_modules/typings-core/node_modules/.bin/tsc.cmd
generated
vendored
Normal file
7
node_modules/typings-core/node_modules/.bin/tsc.cmd
generated
vendored
Normal file
@ -0,0 +1,7 @@
|
||||
@IF EXIST "%~dp0\node.exe" (
|
||||
"%~dp0\node.exe" "%~dp0\..\typescript\bin\tsc" %*
|
||||
) ELSE (
|
||||
@SETLOCAL
|
||||
@SET PATHEXT=%PATHEXT:;.JS;=;%
|
||||
node "%~dp0\..\typescript\bin\tsc" %*
|
||||
)
|
15
node_modules/typings-core/node_modules/.bin/tsserver
generated
vendored
Normal file
15
node_modules/typings-core/node_modules/.bin/tsserver
generated
vendored
Normal file
@ -0,0 +1,15 @@
|
||||
#!/bin/sh
|
||||
basedir=`dirname "$0"`
|
||||
|
||||
case `uname` in
|
||||
*CYGWIN*) basedir=`cygpath -w "$basedir"`;;
|
||||
esac
|
||||
|
||||
if [ -x "$basedir/node" ]; then
|
||||
"$basedir/node" "$basedir/../typescript/bin/tsserver" "$@"
|
||||
ret=$?
|
||||
else
|
||||
node "$basedir/../typescript/bin/tsserver" "$@"
|
||||
ret=$?
|
||||
fi
|
||||
exit $ret
|
7
node_modules/typings-core/node_modules/.bin/tsserver.cmd
generated
vendored
Normal file
7
node_modules/typings-core/node_modules/.bin/tsserver.cmd
generated
vendored
Normal file
@ -0,0 +1,7 @@
|
||||
@IF EXIST "%~dp0\node.exe" (
|
||||
"%~dp0\node.exe" "%~dp0\..\typescript\bin\tsserver" %*
|
||||
) ELSE (
|
||||
@SETLOCAL
|
||||
@SET PATHEXT=%PATHEXT:;.JS;=;%
|
||||
node "%~dp0\..\typescript\bin\tsserver" %*
|
||||
)
|
111
node_modules/typings-core/node_modules/configstore/index.js
generated
vendored
Normal file
111
node_modules/typings-core/node_modules/configstore/index.js
generated
vendored
Normal file
@ -0,0 +1,111 @@
|
||||
'use strict';
|
||||
var path = require('path');
|
||||
var fs = require('graceful-fs');
|
||||
var osenv = require('osenv');
|
||||
var assign = require('object-assign');
|
||||
var mkdirp = require('mkdirp');
|
||||
var uuid = require('uuid');
|
||||
var xdgBasedir = require('xdg-basedir');
|
||||
var osTmpdir = require('os-tmpdir');
|
||||
var writeFileAtomic = require('write-file-atomic');
|
||||
var dotProp = require('dot-prop');
|
||||
|
||||
var user = (osenv.user() || uuid.v4()).replace(/\\/g, '');
|
||||
var configDir = xdgBasedir.config || path.join(osTmpdir(), user, '.config');
|
||||
var permissionError = 'You don\'t have access to this file.';
|
||||
var defaultPathMode = parseInt('0700', 8);
|
||||
var writeFileOptions = {mode: parseInt('0600', 8)};
|
||||
|
||||
function Configstore(id, defaults, opts) {
|
||||
opts = opts || {};
|
||||
|
||||
var pathPrefix = opts.globalConfigPath ?
|
||||
path.join(id, 'config.json') :
|
||||
path.join('configstore', id + '.json');
|
||||
|
||||
this.path = path.join(configDir, pathPrefix);
|
||||
|
||||
this.all = assign({}, defaults || {}, this.all || {});
|
||||
}
|
||||
|
||||
Configstore.prototype = Object.create(Object.prototype, {
|
||||
all: {
|
||||
get: function () {
|
||||
try {
|
||||
return JSON.parse(fs.readFileSync(this.path, 'utf8'));
|
||||
} catch (err) {
|
||||
// create dir if it doesn't exist
|
||||
if (err.code === 'ENOENT') {
|
||||
mkdirp.sync(path.dirname(this.path), defaultPathMode);
|
||||
return {};
|
||||
}
|
||||
|
||||
// improve the message of permission errors
|
||||
if (err.code === 'EACCES') {
|
||||
err.message = err.message + '\n' + permissionError + '\n';
|
||||
}
|
||||
|
||||
// empty the file if it encounters invalid JSON
|
||||
if (err.name === 'SyntaxError') {
|
||||
writeFileAtomic.sync(this.path, '', writeFileOptions);
|
||||
return {};
|
||||
}
|
||||
|
||||
throw err;
|
||||
}
|
||||
},
|
||||
set: function (val) {
|
||||
try {
|
||||
// make sure the folder exists as it
|
||||
// could have been deleted in the meantime
|
||||
mkdirp.sync(path.dirname(this.path), defaultPathMode);
|
||||
|
||||
writeFileAtomic.sync(this.path, JSON.stringify(val, null, '\t'), writeFileOptions);
|
||||
} catch (err) {
|
||||
// improve the message of permission errors
|
||||
if (err.code === 'EACCES') {
|
||||
err.message = err.message + '\n' + permissionError + '\n';
|
||||
}
|
||||
|
||||
throw err;
|
||||
}
|
||||
}
|
||||
},
|
||||
size: {
|
||||
get: function () {
|
||||
return Object.keys(this.all || {}).length;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
Configstore.prototype.get = function (key) {
|
||||
return dotProp.get(this.all, key);
|
||||
};
|
||||
|
||||
Configstore.prototype.set = function (key, val) {
|
||||
var config = this.all;
|
||||
if (arguments.length === 1) {
|
||||
Object.keys(key).forEach(function (k) {
|
||||
dotProp.set(config, k, key[k]);
|
||||
});
|
||||
} else {
|
||||
dotProp.set(config, key, val);
|
||||
}
|
||||
this.all = config;
|
||||
};
|
||||
|
||||
Configstore.prototype.has = function (key) {
|
||||
return dotProp.has(this.all, key);
|
||||
};
|
||||
|
||||
Configstore.prototype.delete = Configstore.prototype.del = function (key) {
|
||||
var config = this.all;
|
||||
dotProp.delete(config, key);
|
||||
this.all = config;
|
||||
};
|
||||
|
||||
Configstore.prototype.clear = function () {
|
||||
this.all = {};
|
||||
};
|
||||
|
||||
module.exports = Configstore;
|
138
node_modules/typings-core/node_modules/configstore/package.json
generated
vendored
Normal file
138
node_modules/typings-core/node_modules/configstore/package.json
generated
vendored
Normal file
@ -0,0 +1,138 @@
|
||||
{
|
||||
"_args": [
|
||||
[
|
||||
{
|
||||
"raw": "configstore@^2.0.0",
|
||||
"scope": null,
|
||||
"escapedName": "configstore",
|
||||
"name": "configstore",
|
||||
"rawSpec": "^2.0.0",
|
||||
"spec": ">=2.0.0 <3.0.0",
|
||||
"type": "range"
|
||||
},
|
||||
"C:\\Users\\x2mjbyrn\\Source\\Repos\\Skeleton\\node_modules\\typings-core"
|
||||
]
|
||||
],
|
||||
"_from": "configstore@>=2.0.0 <3.0.0",
|
||||
"_id": "configstore@2.1.0",
|
||||
"_inCache": true,
|
||||
"_location": "/typings-core/configstore",
|
||||
"_nodeVersion": "6.3.1",
|
||||
"_npmOperationalInternal": {
|
||||
"host": "packages-12-west.internal.npmjs.com",
|
||||
"tmp": "tmp/configstore-2.1.0.tgz_1472703568293_0.01155238808132708"
|
||||
},
|
||||
"_npmUser": {
|
||||
"name": "sboudrias",
|
||||
"email": "admin@simonboudrias.com"
|
||||
},
|
||||
"_npmVersion": "3.10.3",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"raw": "configstore@^2.0.0",
|
||||
"scope": null,
|
||||
"escapedName": "configstore",
|
||||
"name": "configstore",
|
||||
"rawSpec": "^2.0.0",
|
||||
"spec": ">=2.0.0 <3.0.0",
|
||||
"type": "range"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/typings-core"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/configstore/-/configstore-2.1.0.tgz",
|
||||
"_shasum": "737a3a7036e9886102aa6099e47bb33ab1aba1a1",
|
||||
"_shrinkwrap": null,
|
||||
"_spec": "configstore@^2.0.0",
|
||||
"_where": "C:\\Users\\x2mjbyrn\\Source\\Repos\\Skeleton\\node_modules\\typings-core",
|
||||
"author": {
|
||||
"name": "Sindre Sorhus",
|
||||
"email": "sindresorhus@gmail.com",
|
||||
"url": "sindresorhus.com"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/yeoman/configstore/issues"
|
||||
},
|
||||
"dependencies": {
|
||||
"dot-prop": "^3.0.0",
|
||||
"graceful-fs": "^4.1.2",
|
||||
"mkdirp": "^0.5.0",
|
||||
"object-assign": "^4.0.1",
|
||||
"os-tmpdir": "^1.0.0",
|
||||
"osenv": "^0.1.0",
|
||||
"uuid": "^2.0.1",
|
||||
"write-file-atomic": "^1.1.2",
|
||||
"xdg-basedir": "^2.0.0"
|
||||
},
|
||||
"description": "Easily load and save config without having to think about where and how",
|
||||
"devDependencies": {
|
||||
"ava": "*",
|
||||
"path-exists": "^2.0.0",
|
||||
"xo": "*"
|
||||
},
|
||||
"directories": {},
|
||||
"dist": {
|
||||
"shasum": "737a3a7036e9886102aa6099e47bb33ab1aba1a1",
|
||||
"tarball": "https://registry.npmjs.org/configstore/-/configstore-2.1.0.tgz"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
},
|
||||
"files": [
|
||||
"index.js"
|
||||
],
|
||||
"gitHead": "1a02879cc302b661d998af5a6390817660eef359",
|
||||
"homepage": "https://github.com/yeoman/configstore#readme",
|
||||
"keywords": [
|
||||
"config",
|
||||
"store",
|
||||
"storage",
|
||||
"conf",
|
||||
"configuration",
|
||||
"settings",
|
||||
"preferences",
|
||||
"json",
|
||||
"data",
|
||||
"persist",
|
||||
"persistent",
|
||||
"save"
|
||||
],
|
||||
"license": "BSD-2-Clause",
|
||||
"maintainers": [
|
||||
{
|
||||
"name": "sindresorhus",
|
||||
"email": "sindresorhus@gmail.com"
|
||||
},
|
||||
{
|
||||
"name": "addyosmani",
|
||||
"email": "addyosmani@gmail.com"
|
||||
},
|
||||
{
|
||||
"name": "passy",
|
||||
"email": "phartig@rdrei.net"
|
||||
},
|
||||
{
|
||||
"name": "sboudrias",
|
||||
"email": "admin@simonboudrias.com"
|
||||
},
|
||||
{
|
||||
"name": "eddiemonge",
|
||||
"email": "eddie+npm@eddiemonge.com"
|
||||
},
|
||||
{
|
||||
"name": "arthurvr",
|
||||
"email": "contact@arthurverschaeve.be"
|
||||
}
|
||||
],
|
||||
"name": "configstore",
|
||||
"optionalDependencies": {},
|
||||
"readme": "ERROR: No README data found!",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/yeoman/configstore.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "xo && ava"
|
||||
},
|
||||
"version": "2.1.0"
|
||||
}
|
114
node_modules/typings-core/node_modules/configstore/readme.md
generated
vendored
Normal file
114
node_modules/typings-core/node_modules/configstore/readme.md
generated
vendored
Normal file
@ -0,0 +1,114 @@
|
||||
# configstore [](https://travis-ci.org/yeoman/configstore)
|
||||
|
||||
> Easily load and persist config without having to think about where and how
|
||||
|
||||
Config is stored in a JSON file located in `$XDG_CONFIG_HOME` or `~/.config`.<br>
|
||||
Example: `~/.config/configstore/some-id.json`
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
const Configstore = require('configstore');
|
||||
const pkg = require('./package.json');
|
||||
|
||||
// create a Configstore instance with an unique ID e.g.
|
||||
// package name and optionally some default values
|
||||
const conf = new Configstore(pkg.name, {foo: 'bar'});
|
||||
|
||||
console.log(conf.get('foo'));
|
||||
//=> 'bar'
|
||||
|
||||
conf.set('awesome', true);
|
||||
console.log(conf.get('awesome'));
|
||||
//=> true
|
||||
|
||||
// use dot-notation to access nested properties
|
||||
conf.set('bar.baz', true);
|
||||
console.log(conf.get('bar'));
|
||||
//=> {baz: true}
|
||||
|
||||
conf.delete('awesome');
|
||||
console.log(conf.get('awesome'));
|
||||
//=> undefined
|
||||
```
|
||||
|
||||
|
||||
## API
|
||||
|
||||
### Configstore(packageName, [defaults], [options])
|
||||
|
||||
Returns a new instance.
|
||||
|
||||
#### packageName
|
||||
|
||||
Type: `string`
|
||||
|
||||
Name of your package.
|
||||
|
||||
#### defaults
|
||||
|
||||
Type: `Object`
|
||||
|
||||
Default config.
|
||||
|
||||
#### options
|
||||
|
||||
##### globalConfigPath
|
||||
|
||||
Type: `boolean`<br>
|
||||
Default: `false`
|
||||
|
||||
Store the config at `$CONFIG/package-name/config.json` instead of the default `$CONFIG/configstore/package-name.json`. This is not recommended as you might end up conflicting with other tools, rendering the "without having to think" idea moot.
|
||||
|
||||
### Instance
|
||||
|
||||
You can use [dot-notation](https://github.com/sindresorhus/dot-prop) in a `key` to access nested properties.
|
||||
|
||||
### .set(key, value)
|
||||
|
||||
Set an item.
|
||||
|
||||
### .set(object)
|
||||
|
||||
Set multiple items at once.
|
||||
|
||||
### .get(key)
|
||||
|
||||
Get an item.
|
||||
|
||||
### .has(key)
|
||||
|
||||
Check if an item exists.
|
||||
|
||||
### .delete(key)
|
||||
|
||||
Delete an item.
|
||||
|
||||
### .clear()
|
||||
|
||||
Delete all items.
|
||||
|
||||
### .size
|
||||
|
||||
Get the item count.
|
||||
|
||||
### .path
|
||||
|
||||
Get the path to the config file. Can be used to show the user where the config file is located or even better open it for them.
|
||||
|
||||
### .all
|
||||
|
||||
Get all the config as an object or replace the current config with an object:
|
||||
|
||||
```js
|
||||
conf.all = {
|
||||
hello: 'world'
|
||||
};
|
||||
```
|
||||
|
||||
|
||||
## License
|
||||
|
||||
[BSD license](http://opensource.org/licenses/bsd-license.php)<br>
|
||||
Copyright Google
|
4
node_modules/typings-core/node_modules/minimist/.travis.yml
generated
vendored
Normal file
4
node_modules/typings-core/node_modules/minimist/.travis.yml
generated
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
language: node_js
|
||||
node_js:
|
||||
- "0.8"
|
||||
- "0.10"
|
18
node_modules/typings-core/node_modules/minimist/LICENSE
generated
vendored
Normal file
18
node_modules/typings-core/node_modules/minimist/LICENSE
generated
vendored
Normal file
@ -0,0 +1,18 @@
|
||||
This software is released under the MIT license:
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
this software and associated documentation files (the "Software"), to deal in
|
||||
the Software without restriction, including without limitation the rights to
|
||||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
2
node_modules/typings-core/node_modules/minimist/example/parse.js
generated
vendored
Normal file
2
node_modules/typings-core/node_modules/minimist/example/parse.js
generated
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
var argv = require('../')(process.argv.slice(2));
|
||||
console.dir(argv);
|
187
node_modules/typings-core/node_modules/minimist/index.js
generated
vendored
Normal file
187
node_modules/typings-core/node_modules/minimist/index.js
generated
vendored
Normal file
@ -0,0 +1,187 @@
|
||||
module.exports = function (args, opts) {
|
||||
if (!opts) opts = {};
|
||||
|
||||
var flags = { bools : {}, strings : {} };
|
||||
|
||||
[].concat(opts['boolean']).filter(Boolean).forEach(function (key) {
|
||||
flags.bools[key] = true;
|
||||
});
|
||||
|
||||
[].concat(opts.string).filter(Boolean).forEach(function (key) {
|
||||
flags.strings[key] = true;
|
||||
});
|
||||
|
||||
var aliases = {};
|
||||
Object.keys(opts.alias || {}).forEach(function (key) {
|
||||
aliases[key] = [].concat(opts.alias[key]);
|
||||
aliases[key].forEach(function (x) {
|
||||
aliases[x] = [key].concat(aliases[key].filter(function (y) {
|
||||
return x !== y;
|
||||
}));
|
||||
});
|
||||
});
|
||||
|
||||
var defaults = opts['default'] || {};
|
||||
|
||||
var argv = { _ : [] };
|
||||
Object.keys(flags.bools).forEach(function (key) {
|
||||
setArg(key, defaults[key] === undefined ? false : defaults[key]);
|
||||
});
|
||||
|
||||
var notFlags = [];
|
||||
|
||||
if (args.indexOf('--') !== -1) {
|
||||
notFlags = args.slice(args.indexOf('--')+1);
|
||||
args = args.slice(0, args.indexOf('--'));
|
||||
}
|
||||
|
||||
function setArg (key, val) {
|
||||
var value = !flags.strings[key] && isNumber(val)
|
||||
? Number(val) : val
|
||||
;
|
||||
setKey(argv, key.split('.'), value);
|
||||
|
||||
(aliases[key] || []).forEach(function (x) {
|
||||
setKey(argv, x.split('.'), value);
|
||||
});
|
||||
}
|
||||
|
||||
for (var i = 0; i < args.length; i++) {
|
||||
var arg = args[i];
|
||||
|
||||
if (/^--.+=/.test(arg)) {
|
||||
// Using [\s\S] instead of . because js doesn't support the
|
||||
// 'dotall' regex modifier. See:
|
||||
// http://stackoverflow.com/a/1068308/13216
|
||||
var m = arg.match(/^--([^=]+)=([\s\S]*)$/);
|
||||
setArg(m[1], m[2]);
|
||||
}
|
||||
else if (/^--no-.+/.test(arg)) {
|
||||
var key = arg.match(/^--no-(.+)/)[1];
|
||||
setArg(key, false);
|
||||
}
|
||||
else if (/^--.+/.test(arg)) {
|
||||
var key = arg.match(/^--(.+)/)[1];
|
||||
var next = args[i + 1];
|
||||
if (next !== undefined && !/^-/.test(next)
|
||||
&& !flags.bools[key]
|
||||
&& (aliases[key] ? !flags.bools[aliases[key]] : true)) {
|
||||
setArg(key, next);
|
||||
i++;
|
||||
}
|
||||
else if (/^(true|false)$/.test(next)) {
|
||||
setArg(key, next === 'true');
|
||||
i++;
|
||||
}
|
||||
else {
|
||||
setArg(key, flags.strings[key] ? '' : true);
|
||||
}
|
||||
}
|
||||
else if (/^-[^-]+/.test(arg)) {
|
||||
var letters = arg.slice(1,-1).split('');
|
||||
|
||||
var broken = false;
|
||||
for (var j = 0; j < letters.length; j++) {
|
||||
var next = arg.slice(j+2);
|
||||
|
||||
if (next === '-') {
|
||||
setArg(letters[j], next)
|
||||
continue;
|
||||
}
|
||||
|
||||
if (/[A-Za-z]/.test(letters[j])
|
||||
&& /-?\d+(\.\d*)?(e-?\d+)?$/.test(next)) {
|
||||
setArg(letters[j], next);
|
||||
broken = true;
|
||||
break;
|
||||
}
|
||||
|
||||
if (letters[j+1] && letters[j+1].match(/\W/)) {
|
||||
setArg(letters[j], arg.slice(j+2));
|
||||
broken = true;
|
||||
break;
|
||||
}
|
||||
else {
|
||||
setArg(letters[j], flags.strings[letters[j]] ? '' : true);
|
||||
}
|
||||
}
|
||||
|
||||
var key = arg.slice(-1)[0];
|
||||
if (!broken && key !== '-') {
|
||||
if (args[i+1] && !/^(-|--)[^-]/.test(args[i+1])
|
||||
&& !flags.bools[key]
|
||||
&& (aliases[key] ? !flags.bools[aliases[key]] : true)) {
|
||||
setArg(key, args[i+1]);
|
||||
i++;
|
||||
}
|
||||
else if (args[i+1] && /true|false/.test(args[i+1])) {
|
||||
setArg(key, args[i+1] === 'true');
|
||||
i++;
|
||||
}
|
||||
else {
|
||||
setArg(key, flags.strings[key] ? '' : true);
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
argv._.push(
|
||||
flags.strings['_'] || !isNumber(arg) ? arg : Number(arg)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Object.keys(defaults).forEach(function (key) {
|
||||
if (!hasKey(argv, key.split('.'))) {
|
||||
setKey(argv, key.split('.'), defaults[key]);
|
||||
|
||||
(aliases[key] || []).forEach(function (x) {
|
||||
setKey(argv, x.split('.'), defaults[key]);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
notFlags.forEach(function(key) {
|
||||
argv._.push(key);
|
||||
});
|
||||
|
||||
return argv;
|
||||
};
|
||||
|
||||
function hasKey (obj, keys) {
|
||||
var o = obj;
|
||||
keys.slice(0,-1).forEach(function (key) {
|
||||
o = (o[key] || {});
|
||||
});
|
||||
|
||||
var key = keys[keys.length - 1];
|
||||
return key in o;
|
||||
}
|
||||
|
||||
function setKey (obj, keys, value) {
|
||||
var o = obj;
|
||||
keys.slice(0,-1).forEach(function (key) {
|
||||
if (o[key] === undefined) o[key] = {};
|
||||
o = o[key];
|
||||
});
|
||||
|
||||
var key = keys[keys.length - 1];
|
||||
if (o[key] === undefined || typeof o[key] === 'boolean') {
|
||||
o[key] = value;
|
||||
}
|
||||
else if (Array.isArray(o[key])) {
|
||||
o[key].push(value);
|
||||
}
|
||||
else {
|
||||
o[key] = [ o[key], value ];
|
||||
}
|
||||
}
|
||||
|
||||
function isNumber (x) {
|
||||
if (typeof x === 'number') return true;
|
||||
if (/^0x[0-9a-f]+$/i.test(x)) return true;
|
||||
return /^[-+]?(?:\d+(?:\.\d*)?|\.\d+)(e[-+]?\d+)?$/.test(x);
|
||||
}
|
||||
|
||||
function longest (xs) {
|
||||
return Math.max.apply(null, xs.map(function (x) { return x.length }));
|
||||
}
|
92
node_modules/typings-core/node_modules/minimist/package.json
generated
vendored
Normal file
92
node_modules/typings-core/node_modules/minimist/package.json
generated
vendored
Normal file
@ -0,0 +1,92 @@
|
||||
{
|
||||
"_args": [
|
||||
[
|
||||
"minimist@0.0.8",
|
||||
"C:\\Users\\x2mjbyrn\\Source\\Repos\\Skeleton\\node_modules\\typings-core\\node_modules\\mkdirp"
|
||||
]
|
||||
],
|
||||
"_from": "minimist@0.0.8",
|
||||
"_id": "minimist@0.0.8",
|
||||
"_inCache": true,
|
||||
"_location": "/typings-core/minimist",
|
||||
"_npmUser": {
|
||||
"email": "mail@substack.net",
|
||||
"name": "substack"
|
||||
},
|
||||
"_npmVersion": "1.4.3",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"name": "minimist",
|
||||
"raw": "minimist@0.0.8",
|
||||
"rawSpec": "0.0.8",
|
||||
"scope": null,
|
||||
"spec": "0.0.8",
|
||||
"type": "version"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/typings-core/mkdirp"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz",
|
||||
"_shasum": "857fcabfc3397d2625b8228262e86aa7a011b05d",
|
||||
"_shrinkwrap": null,
|
||||
"_spec": "minimist@0.0.8",
|
||||
"_where": "C:\\Users\\x2mjbyrn\\Source\\Repos\\Skeleton\\node_modules\\typings-core\\node_modules\\mkdirp",
|
||||
"author": {
|
||||
"email": "mail@substack.net",
|
||||
"name": "James Halliday",
|
||||
"url": "http://substack.net"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/substack/minimist/issues"
|
||||
},
|
||||
"dependencies": {},
|
||||
"description": "parse argument options",
|
||||
"devDependencies": {
|
||||
"tap": "~0.4.0",
|
||||
"tape": "~1.0.4"
|
||||
},
|
||||
"directories": {},
|
||||
"dist": {
|
||||
"shasum": "857fcabfc3397d2625b8228262e86aa7a011b05d",
|
||||
"tarball": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz"
|
||||
},
|
||||
"homepage": "https://github.com/substack/minimist",
|
||||
"installable": true,
|
||||
"keywords": [
|
||||
"argv",
|
||||
"getopt",
|
||||
"optimist",
|
||||
"parser"
|
||||
],
|
||||
"license": "MIT",
|
||||
"main": "index.js",
|
||||
"maintainers": [
|
||||
{
|
||||
"name": "substack",
|
||||
"email": "mail@substack.net"
|
||||
}
|
||||
],
|
||||
"name": "minimist",
|
||||
"optionalDependencies": {},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/substack/minimist.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "tap test/*.js"
|
||||
},
|
||||
"testling": {
|
||||
"browsers": [
|
||||
"chrome/10",
|
||||
"chrome/latest",
|
||||
"ff/5",
|
||||
"firefox/latest",
|
||||
"ie/6..latest",
|
||||
"opera/12",
|
||||
"safari/5.1",
|
||||
"safari/latest"
|
||||
],
|
||||
"files": "test/*.js"
|
||||
},
|
||||
"version": "0.0.8"
|
||||
}
|
73
node_modules/typings-core/node_modules/minimist/readme.markdown
generated
vendored
Normal file
73
node_modules/typings-core/node_modules/minimist/readme.markdown
generated
vendored
Normal file
@ -0,0 +1,73 @@
|
||||
# minimist
|
||||
|
||||
parse argument options
|
||||
|
||||
This module is the guts of optimist's argument parser without all the
|
||||
fanciful decoration.
|
||||
|
||||
[](http://ci.testling.com/substack/minimist)
|
||||
|
||||
[](http://travis-ci.org/substack/minimist)
|
||||
|
||||
# example
|
||||
|
||||
``` js
|
||||
var argv = require('minimist')(process.argv.slice(2));
|
||||
console.dir(argv);
|
||||
```
|
||||
|
||||
```
|
||||
$ node example/parse.js -a beep -b boop
|
||||
{ _: [], a: 'beep', b: 'boop' }
|
||||
```
|
||||
|
||||
```
|
||||
$ node example/parse.js -x 3 -y 4 -n5 -abc --beep=boop foo bar baz
|
||||
{ _: [ 'foo', 'bar', 'baz' ],
|
||||
x: 3,
|
||||
y: 4,
|
||||
n: 5,
|
||||
a: true,
|
||||
b: true,
|
||||
c: true,
|
||||
beep: 'boop' }
|
||||
```
|
||||
|
||||
# methods
|
||||
|
||||
``` js
|
||||
var parseArgs = require('minimist')
|
||||
```
|
||||
|
||||
## var argv = parseArgs(args, opts={})
|
||||
|
||||
Return an argument object `argv` populated with the array arguments from `args`.
|
||||
|
||||
`argv._` contains all the arguments that didn't have an option associated with
|
||||
them.
|
||||
|
||||
Numeric-looking arguments will be returned as numbers unless `opts.string` or
|
||||
`opts.boolean` is set for that argument name.
|
||||
|
||||
Any arguments after `'--'` will not be parsed and will end up in `argv._`.
|
||||
|
||||
options can be:
|
||||
|
||||
* `opts.string` - a string or array of strings argument names to always treat as
|
||||
strings
|
||||
* `opts.boolean` - a string or array of strings to always treat as booleans
|
||||
* `opts.alias` - an object mapping string names to strings or arrays of string
|
||||
argument names to use as aliases
|
||||
* `opts.default` - an object mapping string argument names to default values
|
||||
|
||||
# install
|
||||
|
||||
With [npm](https://npmjs.org) do:
|
||||
|
||||
```
|
||||
npm install minimist
|
||||
```
|
||||
|
||||
# license
|
||||
|
||||
MIT
|
24
node_modules/typings-core/node_modules/minimist/test/dash.js
generated
vendored
Normal file
24
node_modules/typings-core/node_modules/minimist/test/dash.js
generated
vendored
Normal file
@ -0,0 +1,24 @@
|
||||
var parse = require('../');
|
||||
var test = require('tape');
|
||||
|
||||
test('-', function (t) {
|
||||
t.plan(5);
|
||||
t.deepEqual(parse([ '-n', '-' ]), { n: '-', _: [] });
|
||||
t.deepEqual(parse([ '-' ]), { _: [ '-' ] });
|
||||
t.deepEqual(parse([ '-f-' ]), { f: '-', _: [] });
|
||||
t.deepEqual(
|
||||
parse([ '-b', '-' ], { boolean: 'b' }),
|
||||
{ b: true, _: [ '-' ] }
|
||||
);
|
||||
t.deepEqual(
|
||||
parse([ '-s', '-' ], { string: 's' }),
|
||||
{ s: '-', _: [] }
|
||||
);
|
||||
});
|
||||
|
||||
test('-a -- b', function (t) {
|
||||
t.plan(3);
|
||||
t.deepEqual(parse([ '-a', '--', 'b' ]), { a: true, _: [ 'b' ] });
|
||||
t.deepEqual(parse([ '--a', '--', 'b' ]), { a: true, _: [ 'b' ] });
|
||||
t.deepEqual(parse([ '--a', '--', 'b' ]), { a: true, _: [ 'b' ] });
|
||||
});
|
20
node_modules/typings-core/node_modules/minimist/test/default_bool.js
generated
vendored
Normal file
20
node_modules/typings-core/node_modules/minimist/test/default_bool.js
generated
vendored
Normal file
@ -0,0 +1,20 @@
|
||||
var test = require('tape');
|
||||
var parse = require('../');
|
||||
|
||||
test('boolean default true', function (t) {
|
||||
var argv = parse([], {
|
||||
boolean: 'sometrue',
|
||||
default: { sometrue: true }
|
||||
});
|
||||
t.equal(argv.sometrue, true);
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('boolean default false', function (t) {
|
||||
var argv = parse([], {
|
||||
boolean: 'somefalse',
|
||||
default: { somefalse: false }
|
||||
});
|
||||
t.equal(argv.somefalse, false);
|
||||
t.end();
|
||||
});
|
16
node_modules/typings-core/node_modules/minimist/test/dotted.js
generated
vendored
Normal file
16
node_modules/typings-core/node_modules/minimist/test/dotted.js
generated
vendored
Normal file
@ -0,0 +1,16 @@
|
||||
var parse = require('../');
|
||||
var test = require('tape');
|
||||
|
||||
test('dotted alias', function (t) {
|
||||
var argv = parse(['--a.b', '22'], {default: {'a.b': 11}, alias: {'a.b': 'aa.bb'}});
|
||||
t.equal(argv.a.b, 22);
|
||||
t.equal(argv.aa.bb, 22);
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('dotted default', function (t) {
|
||||
var argv = parse('', {default: {'a.b': 11}, alias: {'a.b': 'aa.bb'}});
|
||||
t.equal(argv.a.b, 11);
|
||||
t.equal(argv.aa.bb, 11);
|
||||
t.end();
|
||||
});
|
31
node_modules/typings-core/node_modules/minimist/test/long.js
generated
vendored
Normal file
31
node_modules/typings-core/node_modules/minimist/test/long.js
generated
vendored
Normal file
@ -0,0 +1,31 @@
|
||||
var test = require('tape');
|
||||
var parse = require('../');
|
||||
|
||||
test('long opts', function (t) {
|
||||
t.deepEqual(
|
||||
parse([ '--bool' ]),
|
||||
{ bool : true, _ : [] },
|
||||
'long boolean'
|
||||
);
|
||||
t.deepEqual(
|
||||
parse([ '--pow', 'xixxle' ]),
|
||||
{ pow : 'xixxle', _ : [] },
|
||||
'long capture sp'
|
||||
);
|
||||
t.deepEqual(
|
||||
parse([ '--pow=xixxle' ]),
|
||||
{ pow : 'xixxle', _ : [] },
|
||||
'long capture eq'
|
||||
);
|
||||
t.deepEqual(
|
||||
parse([ '--host', 'localhost', '--port', '555' ]),
|
||||
{ host : 'localhost', port : 555, _ : [] },
|
||||
'long captures sp'
|
||||
);
|
||||
t.deepEqual(
|
||||
parse([ '--host=localhost', '--port=555' ]),
|
||||
{ host : 'localhost', port : 555, _ : [] },
|
||||
'long captures eq'
|
||||
);
|
||||
t.end();
|
||||
});
|
318
node_modules/typings-core/node_modules/minimist/test/parse.js
generated
vendored
Normal file
318
node_modules/typings-core/node_modules/minimist/test/parse.js
generated
vendored
Normal file
@ -0,0 +1,318 @@
|
||||
var parse = require('../');
|
||||
var test = require('tape');
|
||||
|
||||
test('parse args', function (t) {
|
||||
t.deepEqual(
|
||||
parse([ '--no-moo' ]),
|
||||
{ moo : false, _ : [] },
|
||||
'no'
|
||||
);
|
||||
t.deepEqual(
|
||||
parse([ '-v', 'a', '-v', 'b', '-v', 'c' ]),
|
||||
{ v : ['a','b','c'], _ : [] },
|
||||
'multi'
|
||||
);
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('comprehensive', function (t) {
|
||||
t.deepEqual(
|
||||
parse([
|
||||
'--name=meowmers', 'bare', '-cats', 'woo',
|
||||
'-h', 'awesome', '--multi=quux',
|
||||
'--key', 'value',
|
||||
'-b', '--bool', '--no-meep', '--multi=baz',
|
||||
'--', '--not-a-flag', 'eek'
|
||||
]),
|
||||
{
|
||||
c : true,
|
||||
a : true,
|
||||
t : true,
|
||||
s : 'woo',
|
||||
h : 'awesome',
|
||||
b : true,
|
||||
bool : true,
|
||||
key : 'value',
|
||||
multi : [ 'quux', 'baz' ],
|
||||
meep : false,
|
||||
name : 'meowmers',
|
||||
_ : [ 'bare', '--not-a-flag', 'eek' ]
|
||||
}
|
||||
);
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('nums', function (t) {
|
||||
var argv = parse([
|
||||
'-x', '1234',
|
||||
'-y', '5.67',
|
||||
'-z', '1e7',
|
||||
'-w', '10f',
|
||||
'--hex', '0xdeadbeef',
|
||||
'789'
|
||||
]);
|
||||
t.deepEqual(argv, {
|
||||
x : 1234,
|
||||
y : 5.67,
|
||||
z : 1e7,
|
||||
w : '10f',
|
||||
hex : 0xdeadbeef,
|
||||
_ : [ 789 ]
|
||||
});
|
||||
t.deepEqual(typeof argv.x, 'number');
|
||||
t.deepEqual(typeof argv.y, 'number');
|
||||
t.deepEqual(typeof argv.z, 'number');
|
||||
t.deepEqual(typeof argv.w, 'string');
|
||||
t.deepEqual(typeof argv.hex, 'number');
|
||||
t.deepEqual(typeof argv._[0], 'number');
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('flag boolean', function (t) {
|
||||
var argv = parse([ '-t', 'moo' ], { boolean: 't' });
|
||||
t.deepEqual(argv, { t : true, _ : [ 'moo' ] });
|
||||
t.deepEqual(typeof argv.t, 'boolean');
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('flag boolean value', function (t) {
|
||||
var argv = parse(['--verbose', 'false', 'moo', '-t', 'true'], {
|
||||
boolean: [ 't', 'verbose' ],
|
||||
default: { verbose: true }
|
||||
});
|
||||
|
||||
t.deepEqual(argv, {
|
||||
verbose: false,
|
||||
t: true,
|
||||
_: ['moo']
|
||||
});
|
||||
|
||||
t.deepEqual(typeof argv.verbose, 'boolean');
|
||||
t.deepEqual(typeof argv.t, 'boolean');
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('flag boolean default false', function (t) {
|
||||
var argv = parse(['moo'], {
|
||||
boolean: ['t', 'verbose'],
|
||||
default: { verbose: false, t: false }
|
||||
});
|
||||
|
||||
t.deepEqual(argv, {
|
||||
verbose: false,
|
||||
t: false,
|
||||
_: ['moo']
|
||||
});
|
||||
|
||||
t.deepEqual(typeof argv.verbose, 'boolean');
|
||||
t.deepEqual(typeof argv.t, 'boolean');
|
||||
t.end();
|
||||
|
||||
});
|
||||
|
||||
test('boolean groups', function (t) {
|
||||
var argv = parse([ '-x', '-z', 'one', 'two', 'three' ], {
|
||||
boolean: ['x','y','z']
|
||||
});
|
||||
|
||||
t.deepEqual(argv, {
|
||||
x : true,
|
||||
y : false,
|
||||
z : true,
|
||||
_ : [ 'one', 'two', 'three' ]
|
||||
});
|
||||
|
||||
t.deepEqual(typeof argv.x, 'boolean');
|
||||
t.deepEqual(typeof argv.y, 'boolean');
|
||||
t.deepEqual(typeof argv.z, 'boolean');
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('newlines in params' , function (t) {
|
||||
var args = parse([ '-s', "X\nX" ])
|
||||
t.deepEqual(args, { _ : [], s : "X\nX" });
|
||||
|
||||
// reproduce in bash:
|
||||
// VALUE="new
|
||||
// line"
|
||||
// node program.js --s="$VALUE"
|
||||
args = parse([ "--s=X\nX" ])
|
||||
t.deepEqual(args, { _ : [], s : "X\nX" });
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('strings' , function (t) {
|
||||
var s = parse([ '-s', '0001234' ], { string: 's' }).s;
|
||||
t.equal(s, '0001234');
|
||||
t.equal(typeof s, 'string');
|
||||
|
||||
var x = parse([ '-x', '56' ], { string: 'x' }).x;
|
||||
t.equal(x, '56');
|
||||
t.equal(typeof x, 'string');
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('stringArgs', function (t) {
|
||||
var s = parse([ ' ', ' ' ], { string: '_' })._;
|
||||
t.same(s.length, 2);
|
||||
t.same(typeof s[0], 'string');
|
||||
t.same(s[0], ' ');
|
||||
t.same(typeof s[1], 'string');
|
||||
t.same(s[1], ' ');
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('empty strings', function(t) {
|
||||
var s = parse([ '-s' ], { string: 's' }).s;
|
||||
t.equal(s, '');
|
||||
t.equal(typeof s, 'string');
|
||||
|
||||
var str = parse([ '--str' ], { string: 'str' }).str;
|
||||
t.equal(str, '');
|
||||
t.equal(typeof str, 'string');
|
||||
|
||||
var letters = parse([ '-art' ], {
|
||||
string: [ 'a', 't' ]
|
||||
});
|
||||
|
||||
t.equal(letters.a, '');
|
||||
t.equal(letters.r, true);
|
||||
t.equal(letters.t, '');
|
||||
|
||||
t.end();
|
||||
});
|
||||
|
||||
|
||||
test('slashBreak', function (t) {
|
||||
t.same(
|
||||
parse([ '-I/foo/bar/baz' ]),
|
||||
{ I : '/foo/bar/baz', _ : [] }
|
||||
);
|
||||
t.same(
|
||||
parse([ '-xyz/foo/bar/baz' ]),
|
||||
{ x : true, y : true, z : '/foo/bar/baz', _ : [] }
|
||||
);
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('alias', function (t) {
|
||||
var argv = parse([ '-f', '11', '--zoom', '55' ], {
|
||||
alias: { z: 'zoom' }
|
||||
});
|
||||
t.equal(argv.zoom, 55);
|
||||
t.equal(argv.z, argv.zoom);
|
||||
t.equal(argv.f, 11);
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('multiAlias', function (t) {
|
||||
var argv = parse([ '-f', '11', '--zoom', '55' ], {
|
||||
alias: { z: [ 'zm', 'zoom' ] }
|
||||
});
|
||||
t.equal(argv.zoom, 55);
|
||||
t.equal(argv.z, argv.zoom);
|
||||
t.equal(argv.z, argv.zm);
|
||||
t.equal(argv.f, 11);
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('nested dotted objects', function (t) {
|
||||
var argv = parse([
|
||||
'--foo.bar', '3', '--foo.baz', '4',
|
||||
'--foo.quux.quibble', '5', '--foo.quux.o_O',
|
||||
'--beep.boop'
|
||||
]);
|
||||
|
||||
t.same(argv.foo, {
|
||||
bar : 3,
|
||||
baz : 4,
|
||||
quux : {
|
||||
quibble : 5,
|
||||
o_O : true
|
||||
}
|
||||
});
|
||||
t.same(argv.beep, { boop : true });
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('boolean and alias with chainable api', function (t) {
|
||||
var aliased = [ '-h', 'derp' ];
|
||||
var regular = [ '--herp', 'derp' ];
|
||||
var opts = {
|
||||
herp: { alias: 'h', boolean: true }
|
||||
};
|
||||
var aliasedArgv = parse(aliased, {
|
||||
boolean: 'herp',
|
||||
alias: { h: 'herp' }
|
||||
});
|
||||
var propertyArgv = parse(regular, {
|
||||
boolean: 'herp',
|
||||
alias: { h: 'herp' }
|
||||
});
|
||||
var expected = {
|
||||
herp: true,
|
||||
h: true,
|
||||
'_': [ 'derp' ]
|
||||
};
|
||||
|
||||
t.same(aliasedArgv, expected);
|
||||
t.same(propertyArgv, expected);
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('boolean and alias with options hash', function (t) {
|
||||
var aliased = [ '-h', 'derp' ];
|
||||
var regular = [ '--herp', 'derp' ];
|
||||
var opts = {
|
||||
alias: { 'h': 'herp' },
|
||||
boolean: 'herp'
|
||||
};
|
||||
var aliasedArgv = parse(aliased, opts);
|
||||
var propertyArgv = parse(regular, opts);
|
||||
var expected = {
|
||||
herp: true,
|
||||
h: true,
|
||||
'_': [ 'derp' ]
|
||||
};
|
||||
t.same(aliasedArgv, expected);
|
||||
t.same(propertyArgv, expected);
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('boolean and alias using explicit true', function (t) {
|
||||
var aliased = [ '-h', 'true' ];
|
||||
var regular = [ '--herp', 'true' ];
|
||||
var opts = {
|
||||
alias: { h: 'herp' },
|
||||
boolean: 'h'
|
||||
};
|
||||
var aliasedArgv = parse(aliased, opts);
|
||||
var propertyArgv = parse(regular, opts);
|
||||
var expected = {
|
||||
herp: true,
|
||||
h: true,
|
||||
'_': [ ]
|
||||
};
|
||||
|
||||
t.same(aliasedArgv, expected);
|
||||
t.same(propertyArgv, expected);
|
||||
t.end();
|
||||
});
|
||||
|
||||
// regression, see https://github.com/substack/node-optimist/issues/71
|
||||
test('boolean and --x=true', function(t) {
|
||||
var parsed = parse(['--boool', '--other=true'], {
|
||||
boolean: 'boool'
|
||||
});
|
||||
|
||||
t.same(parsed.boool, true);
|
||||
t.same(parsed.other, 'true');
|
||||
|
||||
parsed = parse(['--boool', '--other=false'], {
|
||||
boolean: 'boool'
|
||||
});
|
||||
|
||||
t.same(parsed.boool, true);
|
||||
t.same(parsed.other, 'false');
|
||||
t.end();
|
||||
});
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user