forked from enviPath/enviPy
Current Dev State
This commit is contained in:
127
static/js/ketcher2/node_modules/liftoff/CHANGELOG
generated
vendored
Normal file
127
static/js/ketcher2/node_modules/liftoff/CHANGELOG
generated
vendored
Normal file
@ -0,0 +1,127 @@
|
||||
v2.2.2:
|
||||
date: 2016-05-20
|
||||
changes:
|
||||
- Update dependencies.
|
||||
v2.2.1:
|
||||
date: 2016-03-23
|
||||
changes:
|
||||
- Make sure that v8 flags are passed properly through the `respawn` event
|
||||
v2.1.0:
|
||||
date: 2015-05-20
|
||||
changes:
|
||||
- Use rechoir to autoload modules.
|
||||
v2.0.3:
|
||||
date: 2015-03-31
|
||||
changes:
|
||||
- Internal bugfix, don't wrap callback error in another error, idiot.
|
||||
v2.0.2:
|
||||
date: 2015-02-24
|
||||
changes:
|
||||
- Support process.env.NODE_PATH when resolving module.
|
||||
v2.0.1:
|
||||
date: 2015-02-01
|
||||
changes:
|
||||
- Find modulePath correctly when devving against yourself.
|
||||
v2.0.0:
|
||||
date: 2015-01-15
|
||||
changes:
|
||||
- Rename `nodeFlags` to `v8Flags` and make it async.
|
||||
v1.0.4:
|
||||
date: 2015-01-04
|
||||
changes:
|
||||
- Detect config extension using basename, not full path.
|
||||
v1.0.0:
|
||||
date: 2014-12-16
|
||||
changes:
|
||||
- Update dependencies
|
||||
v0.13.6:
|
||||
date: 2014-11-07
|
||||
changes:
|
||||
- Don't include artwork on npm.
|
||||
v0.13.5:
|
||||
date: 2014-10-10
|
||||
changes:
|
||||
- Only attempt to resolve the real path of configFile if it is actually a symlink.
|
||||
v0.13.4:
|
||||
date: 2014-10-07
|
||||
changes:
|
||||
- Set configBase to the directory of the symlink, not the directory of its real location.
|
||||
v0.13.3:
|
||||
date: 2014-10-06
|
||||
changes:
|
||||
- Return the real location of symlinked config files.
|
||||
v0.13.2:
|
||||
date: 2014-09-12
|
||||
changes:
|
||||
- Include flags in respawn event. I really miss `npm publish --force`.
|
||||
v0.13.1:
|
||||
date: 2014-09-12
|
||||
changes:
|
||||
- Slight performance tweak.
|
||||
v0.13.0:
|
||||
date: 2014-09-12
|
||||
changes:
|
||||
- Support passing flags to node with `nodeFlags` option.
|
||||
v0.12.1:
|
||||
date: 2014-06-27
|
||||
changes:
|
||||
- Support preloading modules for compound extensions like `.coffee.md`.
|
||||
v0.12.0:
|
||||
date: 2014-06-27
|
||||
changes:
|
||||
- Respect order of extensions when searching for config.
|
||||
- Rename `configNameRegex` environment property to `configNameSearch`.
|
||||
v0.11.3:
|
||||
date: 2014-06-09
|
||||
changes:
|
||||
- Make cwd match configBase if cwd isn't explictly provided
|
||||
v0.11.2:
|
||||
date: 2014-06-04
|
||||
changes:
|
||||
- Regression fix: coerce preloads into array before attempting to push more
|
||||
v0.11.1:
|
||||
date: 2014-06-02
|
||||
changes:
|
||||
- Update dependencies.
|
||||
v0.11.0:
|
||||
date: 2014-05-27
|
||||
changes:
|
||||
- Refactor and remove options parsing.
|
||||
v0.10.0:
|
||||
date: 2014-05-06
|
||||
changes:
|
||||
- Remove `addExtension` in favor of `extension` option.
|
||||
- Support preloading modules based on extension.
|
||||
v0.9.7:
|
||||
date: 2014-04-28
|
||||
changes:
|
||||
- Locate local module in cwd even if config isn't present.
|
||||
v0.9.6:
|
||||
date: 2014-04-02
|
||||
changes:
|
||||
- Fix regression where external modules are not properly required.
|
||||
- Ignore configPathFlag / cwdFlag if the value isn't a string
|
||||
v0.9.3:
|
||||
date: 2014-02-28
|
||||
changes:
|
||||
- Fix regression where developing against self doesn't correctly set cwd.
|
||||
v0.9.0:
|
||||
date: 2014-02-28
|
||||
changes:
|
||||
- Use liftoff instance as context (`this`) for launch callback.
|
||||
- Support split --cwd and --configfile locations.
|
||||
- Rename `configLocationFlag` to `configPathFlag`
|
||||
- Support node 0.8+
|
||||
v0.8.7:
|
||||
date: 2014-02-24
|
||||
changes:
|
||||
- Pass environment as first argument to `launch`.
|
||||
v0.8.5:
|
||||
date: 2014-02-19
|
||||
changes:
|
||||
- Implement `addExtensions` option.
|
||||
- Default to `index.js` if `modulePackage` has no `main` property.
|
||||
v0.8.4:
|
||||
date: 2014-02-05
|
||||
changes:
|
||||
- Initial public release.
|
||||
22
static/js/ketcher2/node_modules/liftoff/LICENSE
generated
vendored
Normal file
22
static/js/ketcher2/node_modules/liftoff/LICENSE
generated
vendored
Normal file
@ -0,0 +1,22 @@
|
||||
Copyright (c) 2014 Tyler Kellen
|
||||
|
||||
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.
|
||||
429
static/js/ketcher2/node_modules/liftoff/README.md
generated
vendored
Normal file
429
static/js/ketcher2/node_modules/liftoff/README.md
generated
vendored
Normal file
@ -0,0 +1,429 @@
|
||||
<p align="center">
|
||||
<a href="http://liftoffjs.com">
|
||||
<img height="100" width="297" src="https://cdn.rawgit.com/tkellen/js-liftoff/master/artwork/liftoff.svg"/>
|
||||
</a>
|
||||
</p>
|
||||
|
||||
# liftoff [](http://travis-ci.org/js-cli/js-liftoff) [](https://ci.appveyor.com/project/js-cli/js-liftoff/branch/master)
|
||||
|
||||
> Launch your command line tool with ease.
|
||||
|
||||
[](https://nodei.co/npm/liftoff/)
|
||||
|
||||
## What is it?
|
||||
[See this blog post](http://weblog.bocoup.com/building-command-line-tools-in-node-with-liftoff/), [check out this proof of concept](https://github.com/js-cli/js-hacker), or read on.
|
||||
|
||||
Say you're writing a CLI tool. Let's call it [hacker](https://github.com/js-cli/js-hacker). You want to configure it using a `Hackerfile`. This is node, so you install `hacker` locally for each project you use it in. But, in order to get the `hacker` command in your PATH, you also install it globally.
|
||||
|
||||
Now, when you run `hacker`, you want to configure what it does using the `Hackerfile` in your current directory, and you want it to execute using the local installation of your tool. Also, it'd be nice if the `hacker` command was smart enough to traverse up your folders until it finds a `Hackerfile`—for those times when you're not in the root directory of your project. Heck, you might even want to launch `hacker` from a folder outside of your project by manually specifying a working directory. Liftoff manages this for you.
|
||||
|
||||
So, everything is working great. Now you can find your local `hacker` and `Hackerfile` with ease. Unfortunately, it turns out you've authored your `Hackerfile` in coffee-script, or some other JS variant. In order to support *that*, you have to load the compiler for it, and then register the extension for it with node. Good news, Liftoff can do that, and a whole lot more, too.
|
||||
|
||||
## API
|
||||
|
||||
### constructor(opts)
|
||||
|
||||
Create an instance of Liftoff to invoke your application.
|
||||
|
||||
An example utilizing all options:
|
||||
```js
|
||||
const Hacker = new Liftoff({
|
||||
name: 'hacker',
|
||||
processTitle: 'hacker',
|
||||
moduleName: 'hacker',
|
||||
configName: 'hackerfile',
|
||||
extensions: {
|
||||
'.js': null,
|
||||
'.json': null,
|
||||
'.coffee': 'coffee-script/register'
|
||||
},
|
||||
v8flags: ['--harmony'] // or v8flags: require('v8flags')
|
||||
});
|
||||
```
|
||||
|
||||
#### opts.name
|
||||
|
||||
Sugar for setting `processTitle`, `moduleName`, `configName` automatically.
|
||||
|
||||
Type: `String`
|
||||
Default: `null`
|
||||
|
||||
These are equivalent:
|
||||
```js
|
||||
const Hacker = Liftoff({
|
||||
processTitle: 'hacker',
|
||||
moduleName: 'hacker',
|
||||
configName: 'hackerfile'
|
||||
});
|
||||
```
|
||||
```js
|
||||
const Hacker = Liftoff({name:'hacker'});
|
||||
```
|
||||
|
||||
#### opts.moduleName
|
||||
|
||||
Sets which module your application expects to find locally when being run.
|
||||
|
||||
Type: `String`
|
||||
Default: `null`
|
||||
|
||||
#### opts.configName
|
||||
|
||||
Sets the name of the configuration file Liftoff will attempt to find. Case-insensitive.
|
||||
|
||||
Type: `String`
|
||||
Default: `null`
|
||||
|
||||
#### opts.extensions
|
||||
|
||||
Set extensions to include when searching for a configuration file. If an external module is needed to load a given extension (e.g. `.coffee`), the module name should be specified as the value for the key.
|
||||
|
||||
Type: `Object`
|
||||
Default: `{".js":null,".json":null}`
|
||||
|
||||
**Examples:**
|
||||
|
||||
In this example Liftoff will look for `myappfile{.js,.json,.coffee}`. If a config with the extension `.coffee` is found, Liftoff will try to require `coffee-script/require` from the current working directory.
|
||||
```js
|
||||
const MyApp = new Liftoff({
|
||||
name: 'myapp',
|
||||
extensions: {
|
||||
'.js': null,
|
||||
'.json': null,
|
||||
'.coffee': 'coffee-script/register'
|
||||
}
|
||||
});
|
||||
```
|
||||
|
||||
In this example, Liftoff will look for `.myapp{rc}`.
|
||||
```js
|
||||
const MyApp = new Liftoff({
|
||||
name: 'myapp',
|
||||
configName: '.myapp',
|
||||
extensions: {
|
||||
'rc': null
|
||||
}
|
||||
});
|
||||
```
|
||||
|
||||
In this example, Liftoff will automatically attempt to load the correct module for any javascript variant supported by [node-interpret](https://github.com/tkellen/node-interpret) (as long as it does not require a register method).
|
||||
|
||||
```js
|
||||
const MyApp = new Liftoff({
|
||||
name: 'myapp',
|
||||
extensions: require('interpret').jsVariants
|
||||
});
|
||||
```
|
||||
#### opts.v8flags
|
||||
|
||||
Any flag specified here will be applied to node, not your program. Useful for supporting invocations like `myapp --harmony command`, where `--harmony` should be passed to node, not your program. This functionality is implemented using [flagged-respawn](http://github.com/tkellen/node-flagged-respawn). To support all v8flags, see [node-v8flags](https://github.com/tkellen/node-v8flags).
|
||||
|
||||
Type: `Array|Function`
|
||||
Default: `null`
|
||||
|
||||
If this method is a function, it should take a node-style callback that yields an array of flags.
|
||||
|
||||
#### opts.processTitle
|
||||
|
||||
Sets what the [process title](http://nodejs.org/api/process.html#process_process_title) will be.
|
||||
|
||||
Type: `String`
|
||||
Default: `null`
|
||||
|
||||
#### opts.completions(type)
|
||||
|
||||
A method to handle bash/zsh/whatever completions.
|
||||
|
||||
Type: `Function`
|
||||
Default: `null`
|
||||
|
||||
#### opts.configFiles
|
||||
|
||||
An object of configuration files to find. Each property is keyed by the default basename of the file being found, and the value is an object of [path arguments](#path-arguments) keyed by unique names.
|
||||
|
||||
__Note:__ This option is useful if, for example, you want to support an `.apprc` file in addition to an `appfile.js`. If you only need a single configuration file, you probably don't need this. In addition to letting you find multiple files, this option allows more fine-grained control over how configuration files are located.
|
||||
|
||||
Type: `Object`
|
||||
Default: `null`
|
||||
|
||||
#### Path arguments
|
||||
|
||||
The [`fined`](https://github.com/js-cli/fined) module accepts a string representing the path to search or an object with the following keys:
|
||||
|
||||
* `path` __(required)__
|
||||
|
||||
The path to search. Using only a string expands to this property.
|
||||
|
||||
Type: `String`
|
||||
Default: `null`
|
||||
|
||||
* `name`
|
||||
|
||||
The basename of the file to find. Extensions are appended during lookup.
|
||||
|
||||
Type: `String`
|
||||
Default: Top-level key in `configFiles`
|
||||
|
||||
* `extensions`
|
||||
|
||||
The extensions to append to `name` during lookup. See also: [`opts.extensions`](#optsextensions).
|
||||
|
||||
Type: `String|Array|Object`
|
||||
Default: The value of [`opts.extensions`](#optsextensions)
|
||||
|
||||
* `cwd`
|
||||
|
||||
The base directory of `path` (if relative).
|
||||
|
||||
Type: `String`
|
||||
Default: The value of [`opts.cwd`](#optscwd)
|
||||
|
||||
* `findUp`
|
||||
|
||||
Whether the `path` should be traversed up to find the file.
|
||||
|
||||
Type: `Boolean`
|
||||
Default: `false`
|
||||
|
||||
**Examples:**
|
||||
|
||||
In this example Liftoff will look for the `.hacker.js` file relative to the `cwd` as declared in `configFiles`.
|
||||
```js
|
||||
const MyApp = new Liftoff({
|
||||
name: 'hacker',
|
||||
configFiles: {
|
||||
'.hacker': {
|
||||
cwd: '.'
|
||||
}
|
||||
}
|
||||
});
|
||||
```
|
||||
|
||||
In this example, Liftoff will look for `.hackerrc` in the home directory.
|
||||
```js
|
||||
const MyApp = new Liftoff({
|
||||
name: 'hacker',
|
||||
configFiles: {
|
||||
'.hacker': {
|
||||
home: {
|
||||
path: '~',
|
||||
extensions: {
|
||||
'rc': null
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
```
|
||||
|
||||
In this example, Liftoff will look in the `cwd` and then lookup the tree for the `.hacker.js` file.
|
||||
```js
|
||||
const MyApp = new Liftoff({
|
||||
name: 'hacker',
|
||||
configFiles: {
|
||||
'.hacker': {
|
||||
up: {
|
||||
path: '.',
|
||||
findUp: true
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
```
|
||||
|
||||
In this example, the `name` is overridden and the key is ignored so Liftoff looks for `.override.js`.
|
||||
```js
|
||||
const MyApp = new Liftoff({
|
||||
name: 'hacker',
|
||||
configFiles: {
|
||||
hacker: {
|
||||
override: {
|
||||
path: '.',
|
||||
name: '.override'
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
```
|
||||
|
||||
In this example, Liftoff will use the home directory as the `cwd` and looks for `~/.hacker.js`.
|
||||
```js
|
||||
const MyApp = new Liftoff({
|
||||
name: 'hacker',
|
||||
configFiles: {
|
||||
'.hacker': {
|
||||
home: {
|
||||
path: '.',
|
||||
cwd: '~'
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
```
|
||||
|
||||
## launch(opts, callback(env))
|
||||
Launches your application with provided options, builds an environment, and invokes your callback, passing the calculated environment as the first argument.
|
||||
|
||||
##### Example Configuration w/ Options Parsing:
|
||||
```js
|
||||
const Liftoff = require('liftoff');
|
||||
const MyApp = new Liftoff({name:'myapp'});
|
||||
const argv = require('minimist')(process.argv.slice(2));
|
||||
const invoke = function (env) {
|
||||
console.log('my environment is:', env);
|
||||
console.log('my cli options are:', argv);
|
||||
console.log('my liftoff config is:', this);
|
||||
};
|
||||
MyApp.launch({
|
||||
cwd: argv.cwd,
|
||||
configPath: argv.myappfile,
|
||||
require: argv.require,
|
||||
completion: argv.completion
|
||||
}, invoke);
|
||||
```
|
||||
|
||||
#### opts.cwd
|
||||
|
||||
Change the current working directory for this launch. Relative paths are calculated against `process.cwd()`.
|
||||
|
||||
Type: `String`
|
||||
Default: `process.cwd()`
|
||||
|
||||
**Example Configuration:**
|
||||
```js
|
||||
const argv = require('minimist')(process.argv.slice(2));
|
||||
MyApp.launch({
|
||||
cwd: argv.cwd
|
||||
}, invoke);
|
||||
```
|
||||
|
||||
**Matching CLI Invocation:**
|
||||
```
|
||||
myapp --cwd ../
|
||||
```
|
||||
|
||||
#### opts.configPath
|
||||
|
||||
Don't search for a config, use the one provided. **Note:** Liftoff will assume the current working directory is the directory containing the config file unless an alternate location is explicitly specified using `cwd`.
|
||||
|
||||
Type: `String`
|
||||
Default: `null`
|
||||
|
||||
**Example Configuration:**
|
||||
```js
|
||||
var argv = require('minimist')(process.argv.slice(2));
|
||||
MyApp.launch({
|
||||
configPath: argv.myappfile
|
||||
}, invoke);
|
||||
```
|
||||
|
||||
**Matching CLI Invocation:**
|
||||
```
|
||||
myapp --myappfile /var/www/project/Myappfile.js
|
||||
```
|
||||
|
||||
**Examples using `cwd` and `configPath` together:**
|
||||
|
||||
These are functionally identical:
|
||||
```
|
||||
myapp --myappfile /var/www/project/Myappfile.js
|
||||
myapp --cwd /var/www/project
|
||||
```
|
||||
|
||||
These can run myapp from a shared directory as though it were located in another project:
|
||||
```
|
||||
myapp --myappfile /Users/name/Myappfile.js --cwd /var/www/project1
|
||||
myapp --myappfile /Users/name/Myappfile.js --cwd /var/www/project2
|
||||
```
|
||||
|
||||
#### opts.require
|
||||
|
||||
A string or array of modules to attempt requiring from the local working directory before invoking the launch callback.
|
||||
|
||||
Type: `String|Array`
|
||||
Default: `null`
|
||||
|
||||
**Example Configuration:**
|
||||
```js
|
||||
var argv = require('minimist')(process.argv.slice(2));
|
||||
MyApp.launch({
|
||||
require: argv.require
|
||||
}, invoke);
|
||||
```
|
||||
|
||||
**Matching CLI Invocation:**
|
||||
```js
|
||||
myapp --require coffee-script/register
|
||||
```
|
||||
|
||||
#### callback(env)
|
||||
|
||||
A function to start your application. When invoked, `this` will be your instance of Liftoff. The `env` param will contain the following keys:
|
||||
|
||||
- `cwd`: the current working directory
|
||||
- `require`: an array of modules that liftoff tried to pre-load
|
||||
- `configNameSearch`: the config files searched for
|
||||
- `configPath`: the full path to your configuration file (if found)
|
||||
- `configBase`: the base directory of your configuration file (if found)
|
||||
- `modulePath`: the full path to the local module your project relies on (if found)
|
||||
- `modulePackage`: the contents of the local module's package.json (if found)
|
||||
- `configFiles`: an object of filepaths for each found config file (filepath values will be null if not found)
|
||||
|
||||
### events
|
||||
|
||||
#### require(name, module)
|
||||
|
||||
Emitted when a module is pre-loaded.
|
||||
|
||||
```js
|
||||
var Hacker = new Liftoff({name:'hacker'});
|
||||
Hacker.on('require', function (name, module) {
|
||||
console.log('Requiring external module: '+name+'...');
|
||||
// automatically register coffee-script extensions
|
||||
if (name === 'coffee-script') {
|
||||
module.register();
|
||||
}
|
||||
});
|
||||
```
|
||||
|
||||
#### requireFail(name, err)
|
||||
|
||||
Emitted when a requested module cannot be preloaded.
|
||||
|
||||
```js
|
||||
var Hacker = new Liftoff({name:'hacker'});
|
||||
Hacker.on('requireFail', function (name, err) {
|
||||
console.log('Unable to load:', name, err);
|
||||
});
|
||||
```
|
||||
|
||||
#### respawn(flags, child)
|
||||
|
||||
Emitted when Liftoff re-spawns your process (when a [`v8flags`](#optsv8flags) is detected).
|
||||
|
||||
```js
|
||||
var Hacker = new Liftoff({
|
||||
name: 'hacker',
|
||||
v8flags: ['--harmony']
|
||||
});
|
||||
Hacker.on('respawn', function (flags, child) {
|
||||
console.log('Detected node flags:', flags);
|
||||
console.log('Respawned to PID:', child.pid);
|
||||
});
|
||||
```
|
||||
|
||||
Event will be triggered for this command:
|
||||
`hacker --harmony commmand`
|
||||
|
||||
## Examples
|
||||
|
||||
Check out how [gulp](https://github.com/gulpjs/gulp/blob/master/bin/gulp.js) uses Liftoff.
|
||||
|
||||
For a bare-bones example, try [the hacker project](https://github.com/js-cli/js-hacker/blob/master/bin/hacker.js).
|
||||
|
||||
To try the example, do the following:
|
||||
|
||||
1. Install the sample project `hacker` with `npm install -g hacker`.
|
||||
2. Make a `Hackerfile.js` with some arbitrary javascript it.
|
||||
3. Install hacker next to it with `npm install hacker`.
|
||||
3. Run `hacker` while in the same parent folder.
|
||||
28
static/js/ketcher2/node_modules/liftoff/UPGRADING.md
generated
vendored
Normal file
28
static/js/ketcher2/node_modules/liftoff/UPGRADING.md
generated
vendored
Normal file
@ -0,0 +1,28 @@
|
||||
# 1.0.0 -> 2.0.0
|
||||
The option `nodeFlags` was renamed to `v8flags` for accuracy. It can now be a callback taking method that yields an array of flags, **or** an array literal.
|
||||
|
||||
# 0.11 -> 0.12
|
||||
For the environment passed into the `launch` callback, `configNameRegex` has been renamed to `configNameSearch`. It now returns an array of valid config names instead of a regular expression.
|
||||
|
||||
# 0.10 -> 0.11
|
||||
The method signature for `launch` was changed in this version of Liftoff.
|
||||
|
||||
You must now provide your own options parser and pass your desired params directly into `launch` as the first argument. The second argument is now the invocation callback that starts your application.
|
||||
|
||||
To replicate the default functionality of 0.10, use the following:
|
||||
```js
|
||||
const Liftoff = require('liftoff');
|
||||
const MyApp = new Liftoff({name:'myapp'});
|
||||
const argv = require('minimist')(process.argv.slice(2));
|
||||
const invoke = function (env) {
|
||||
console.log('my environment is:', env);
|
||||
console.log('my cli options are:', argv);
|
||||
console.log('my liftoff config is:', this);
|
||||
};
|
||||
MyApp.launch({
|
||||
cwd: argv.cwd,
|
||||
configPath: argv.myappfile,
|
||||
require: argv.require,
|
||||
completion: argv.completion
|
||||
}, invoke);
|
||||
```
|
||||
29
static/js/ketcher2/node_modules/liftoff/appveyor.yml
generated
vendored
Normal file
29
static/js/ketcher2/node_modules/liftoff/appveyor.yml
generated
vendored
Normal file
@ -0,0 +1,29 @@
|
||||
# http://www.appveyor.com/docs/appveyor-yml
|
||||
# http://www.appveyor.com/docs/lang/nodejs-iojs
|
||||
|
||||
environment:
|
||||
matrix:
|
||||
# node.js
|
||||
- nodejs_version: "0.10"
|
||||
- nodejs_version: "0.12"
|
||||
- nodejs_version: "4"
|
||||
- nodejs_version: "5"
|
||||
- nodejs_version: "6"
|
||||
|
||||
install:
|
||||
- IF %nodejs_version% EQU 0.10 npm -g install npm@2
|
||||
- IF %nodejs_version% EQU 0.10 set PATH=%APPDATA%\npm;%PATH%
|
||||
- ps: Install-Product node $env:nodejs_version
|
||||
- npm install
|
||||
|
||||
test_script:
|
||||
- node --version
|
||||
- npm --version
|
||||
# power shell
|
||||
- ps: "npm test"
|
||||
# standard command line
|
||||
- cmd: npm test
|
||||
|
||||
build: off
|
||||
|
||||
version: "{build}"
|
||||
210
static/js/ketcher2/node_modules/liftoff/index.js
generated
vendored
Normal file
210
static/js/ketcher2/node_modules/liftoff/index.js
generated
vendored
Normal file
@ -0,0 +1,210 @@
|
||||
const fs = require('fs');
|
||||
const util = require('util');
|
||||
const path = require('path');
|
||||
const EE = require('events').EventEmitter;
|
||||
|
||||
const extend = require('extend');
|
||||
const resolve = require('resolve');
|
||||
const flaggedRespawn = require('flagged-respawn');
|
||||
const isPlainObject = require('lodash.isplainobject');
|
||||
const mapValues = require('lodash.mapvalues');
|
||||
const fined = require('fined');
|
||||
|
||||
const findCwd = require('./lib/find_cwd');
|
||||
const findConfig = require('./lib/find_config');
|
||||
const fileSearch = require('./lib/file_search');
|
||||
const parseOptions = require('./lib/parse_options');
|
||||
const silentRequire = require('./lib/silent_require');
|
||||
const buildConfigName = require('./lib/build_config_name');
|
||||
const registerLoader = require('./lib/register_loader');
|
||||
|
||||
|
||||
function Liftoff (opts) {
|
||||
EE.call(this);
|
||||
extend(this, parseOptions(opts));
|
||||
}
|
||||
util.inherits(Liftoff, EE);
|
||||
|
||||
Liftoff.prototype.requireLocal = function (module, basedir) {
|
||||
try {
|
||||
var result = require(resolve.sync(module, {basedir: basedir}));
|
||||
this.emit('require', module, result);
|
||||
return result;
|
||||
} catch (e) {
|
||||
this.emit('requireFail', module, e);
|
||||
}
|
||||
};
|
||||
|
||||
Liftoff.prototype.buildEnvironment = function (opts) {
|
||||
opts = opts || {};
|
||||
|
||||
// get modules we want to preload
|
||||
var preload = opts.require || [];
|
||||
|
||||
// ensure items to preload is an array
|
||||
if (!Array.isArray(preload)) {
|
||||
preload = [preload];
|
||||
}
|
||||
|
||||
// make a copy of search paths that can be mutated for this run
|
||||
var searchPaths = this.searchPaths.slice();
|
||||
|
||||
// calculate current cwd
|
||||
var cwd = findCwd(opts);
|
||||
|
||||
// if cwd was provided explicitly, only use it for searching config
|
||||
if (opts.cwd) {
|
||||
searchPaths = [cwd];
|
||||
} else {
|
||||
// otherwise just search in cwd first
|
||||
searchPaths.unshift(cwd);
|
||||
}
|
||||
|
||||
// calculate the regex to use for finding the config file
|
||||
var configNameSearch = buildConfigName({
|
||||
configName: this.configName,
|
||||
extensions: Object.keys(this.extensions)
|
||||
});
|
||||
|
||||
// calculate configPath
|
||||
var configPath = findConfig({
|
||||
configNameSearch: configNameSearch,
|
||||
searchPaths: searchPaths,
|
||||
configPath: opts.configPath
|
||||
});
|
||||
|
||||
// if we have a config path, save the directory it resides in.
|
||||
var configBase;
|
||||
if (configPath) {
|
||||
configBase = path.dirname(configPath);
|
||||
// if cwd wasn't provided explicitly, it should match configBase
|
||||
if (!opts.cwd) {
|
||||
cwd = configBase;
|
||||
}
|
||||
// resolve symlink if needed
|
||||
if (fs.lstatSync(configPath).isSymbolicLink()) {
|
||||
configPath = fs.realpathSync(configPath);
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: break this out into lib/
|
||||
// locate local module and package next to config or explicitly provided cwd
|
||||
var modulePath, modulePackage;
|
||||
try {
|
||||
var delim = (process.platform === 'win32' ? ';' : ':'),
|
||||
paths = (process.env.NODE_PATH ? process.env.NODE_PATH.split(delim) : []);
|
||||
modulePath = resolve.sync(this.moduleName, {basedir: configBase || cwd, paths: paths});
|
||||
modulePackage = silentRequire(fileSearch('package.json', [modulePath]));
|
||||
} catch (e) {}
|
||||
|
||||
// if we have a configuration but we failed to find a local module, maybe
|
||||
// we are developing against ourselves?
|
||||
if (!modulePath && configPath) {
|
||||
// check the package.json sibling to our config to see if its `name`
|
||||
// matches the module we're looking for
|
||||
var modulePackagePath = fileSearch('package.json', [configBase]);
|
||||
modulePackage = silentRequire(modulePackagePath);
|
||||
if (modulePackage && modulePackage.name === this.moduleName) {
|
||||
// if it does, our module path is `main` inside package.json
|
||||
modulePath = path.join(path.dirname(modulePackagePath), modulePackage.main || 'index.js');
|
||||
cwd = configBase;
|
||||
} else {
|
||||
// clear if we just required a package for some other project
|
||||
modulePackage = {};
|
||||
}
|
||||
}
|
||||
|
||||
// load any modules which were requested to be required
|
||||
if (preload.length) {
|
||||
// unique results first
|
||||
preload.filter(function (value, index, self) {
|
||||
return self.indexOf(value) === index;
|
||||
}).forEach(function (dep) {
|
||||
this.requireLocal(dep, findCwd(opts));
|
||||
}, this);
|
||||
}
|
||||
|
||||
var exts = this.extensions;
|
||||
var eventEmitter = this;
|
||||
registerLoader(eventEmitter, exts, configPath, cwd);
|
||||
|
||||
var configFiles = {};
|
||||
if (isPlainObject(this.configFiles)) {
|
||||
var notfound = { path: null };
|
||||
configFiles = mapValues(this.configFiles, function(prop, name) {
|
||||
var defaultObj = { name: name, cwd: cwd, extensions: exts };
|
||||
return mapValues(prop, function(pathObj) {
|
||||
var found = fined(pathObj, defaultObj) || notfound;
|
||||
if (isPlainObject(found.extension)) {
|
||||
registerLoader(eventEmitter, found.extension, found.path, cwd);
|
||||
}
|
||||
return found.path;
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
return {
|
||||
cwd: cwd,
|
||||
require: preload,
|
||||
configNameSearch: configNameSearch,
|
||||
configPath: configPath,
|
||||
configBase: configBase,
|
||||
modulePath: modulePath,
|
||||
modulePackage: modulePackage || {},
|
||||
configFiles: configFiles
|
||||
};
|
||||
};
|
||||
|
||||
Liftoff.prototype.handleFlags = function (cb) {
|
||||
if (typeof this.v8flags === 'function') {
|
||||
this.v8flags(function (err, flags) {
|
||||
if (err) {
|
||||
cb(err);
|
||||
} else {
|
||||
cb(null, flags);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
process.nextTick(function () {
|
||||
cb(null, this.v8flags);
|
||||
}.bind(this));
|
||||
}
|
||||
};
|
||||
|
||||
Liftoff.prototype.launch = function (opts, fn) {
|
||||
if (typeof fn !== 'function') {
|
||||
throw new Error('You must provide a callback function.');
|
||||
}
|
||||
process.title = this.processTitle;
|
||||
|
||||
var completion = opts.completion;
|
||||
if (completion && this.completions) {
|
||||
return this.completions(completion);
|
||||
}
|
||||
|
||||
this.handleFlags(function (err, flags) {
|
||||
if (err) {
|
||||
throw err;
|
||||
} else {
|
||||
if (flags) {
|
||||
flaggedRespawn(flags, process.argv, function (ready, child) {
|
||||
if (child !== process) {
|
||||
this.emit('respawn', process.argv.filter(function (arg) {
|
||||
var flag = arg.split('=')[0];
|
||||
return flags.indexOf(flag) !== -1;
|
||||
}.bind(this)), child);
|
||||
}
|
||||
if (ready) {
|
||||
fn.call(this, this.buildEnvironment(opts));
|
||||
}
|
||||
}.bind(this));
|
||||
} else {
|
||||
fn.call(this, this.buildEnvironment(opts));
|
||||
}
|
||||
}
|
||||
}.bind(this));
|
||||
};
|
||||
|
||||
|
||||
|
||||
module.exports = Liftoff;
|
||||
17
static/js/ketcher2/node_modules/liftoff/lib/build_config_name.js
generated
vendored
Normal file
17
static/js/ketcher2/node_modules/liftoff/lib/build_config_name.js
generated
vendored
Normal file
@ -0,0 +1,17 @@
|
||||
module.exports = function (opts) {
|
||||
opts = opts || {};
|
||||
var configName = opts.configName;
|
||||
var extensions = opts.extensions;
|
||||
if (!configName) {
|
||||
throw new Error('Please specify a configName.');
|
||||
}
|
||||
if (configName instanceof RegExp) {
|
||||
return [configName];
|
||||
}
|
||||
if (!Array.isArray(extensions)) {
|
||||
throw new Error('Please provide an array of valid extensions.');
|
||||
}
|
||||
return extensions.map(function (ext) {
|
||||
return configName + ext;
|
||||
});
|
||||
};
|
||||
14
static/js/ketcher2/node_modules/liftoff/lib/file_search.js
generated
vendored
Normal file
14
static/js/ketcher2/node_modules/liftoff/lib/file_search.js
generated
vendored
Normal file
@ -0,0 +1,14 @@
|
||||
const findup = require('findup-sync');
|
||||
|
||||
module.exports = function (search, paths) {
|
||||
var path;
|
||||
var len = paths.length;
|
||||
for (var i = 0; i < len; i++) {
|
||||
if (path) {
|
||||
break;
|
||||
} else {
|
||||
path = findup(search, {cwd: paths[i], nocase: true});
|
||||
}
|
||||
}
|
||||
return path;
|
||||
};
|
||||
25
static/js/ketcher2/node_modules/liftoff/lib/find_config.js
generated
vendored
Normal file
25
static/js/ketcher2/node_modules/liftoff/lib/find_config.js
generated
vendored
Normal file
@ -0,0 +1,25 @@
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
const fileSearch = require('./file_search');
|
||||
|
||||
module.exports = function (opts) {
|
||||
opts = opts || {};
|
||||
var configNameSearch = opts.configNameSearch;
|
||||
var configPath = opts.configPath;
|
||||
var searchPaths = opts.searchPaths;
|
||||
// only search for a config if a path to one wasn't explicitly provided
|
||||
if (!configPath) {
|
||||
if (!Array.isArray(searchPaths)) {
|
||||
throw new Error('Please provide an array of paths to search for config in.');
|
||||
}
|
||||
if (!configNameSearch) {
|
||||
throw new Error('Please provide a configNameSearch.');
|
||||
}
|
||||
configPath = fileSearch(configNameSearch, searchPaths);
|
||||
}
|
||||
// confirm the configPath exists and return an absolute path to it
|
||||
if (fs.existsSync(configPath)) {
|
||||
return path.resolve(configPath);
|
||||
}
|
||||
return null;
|
||||
};
|
||||
18
static/js/ketcher2/node_modules/liftoff/lib/find_cwd.js
generated
vendored
Normal file
18
static/js/ketcher2/node_modules/liftoff/lib/find_cwd.js
generated
vendored
Normal file
@ -0,0 +1,18 @@
|
||||
const path = require('path');
|
||||
|
||||
module.exports = function (opts) {
|
||||
if (!opts) {
|
||||
opts = {};
|
||||
}
|
||||
var cwd = opts.cwd;
|
||||
var configPath = opts.configPath;
|
||||
// if a path to the desired config was specified
|
||||
// but no cwd was provided, use configPath dir
|
||||
if (typeof configPath === 'string' && !cwd) {
|
||||
cwd = path.dirname(path.resolve(configPath));
|
||||
}
|
||||
if (typeof cwd === 'string') {
|
||||
return path.resolve(cwd);
|
||||
}
|
||||
return process.cwd();
|
||||
};
|
||||
35
static/js/ketcher2/node_modules/liftoff/lib/parse_options.js
generated
vendored
Normal file
35
static/js/ketcher2/node_modules/liftoff/lib/parse_options.js
generated
vendored
Normal file
@ -0,0 +1,35 @@
|
||||
const extend = require('extend');
|
||||
|
||||
module.exports = function (opts) {
|
||||
var defaults = {
|
||||
extensions: {
|
||||
'.js': null,
|
||||
'.json': null
|
||||
},
|
||||
searchPaths: []
|
||||
};
|
||||
if (!opts) {
|
||||
opts = {};
|
||||
}
|
||||
if (opts.name) {
|
||||
if (!opts.processTitle) {
|
||||
opts.processTitle = opts.name;
|
||||
}
|
||||
if (!opts.configName) {
|
||||
opts.configName = opts.name + 'file';
|
||||
}
|
||||
if (!opts.moduleName) {
|
||||
opts.moduleName = opts.name;
|
||||
}
|
||||
}
|
||||
if (!opts.processTitle) {
|
||||
throw new Error('You must specify a processTitle.');
|
||||
}
|
||||
if (!opts.configName) {
|
||||
throw new Error('You must specify a configName.');
|
||||
}
|
||||
if (!opts.moduleName) {
|
||||
throw new Error('You must specify a moduleName.');
|
||||
}
|
||||
return extend(defaults, opts);
|
||||
};
|
||||
25
static/js/ketcher2/node_modules/liftoff/lib/register_loader.js
generated
vendored
Normal file
25
static/js/ketcher2/node_modules/liftoff/lib/register_loader.js
generated
vendored
Normal file
@ -0,0 +1,25 @@
|
||||
const rechoir = require('rechoir');
|
||||
const isString = require('lodash.isstring');
|
||||
|
||||
module.exports = function(eventEmitter, extensions, configPath, cwd) {
|
||||
extensions = extensions || {};
|
||||
|
||||
if (!isString(configPath)) {
|
||||
return;
|
||||
}
|
||||
|
||||
var autoloads = rechoir.prepare(extensions, configPath, cwd, true);
|
||||
if (autoloads instanceof Error) {
|
||||
autoloads = autoloads.failures;
|
||||
}
|
||||
|
||||
if (Array.isArray(autoloads)) {
|
||||
autoloads.forEach(function (attempt) {
|
||||
if (attempt.error) {
|
||||
eventEmitter.emit('requireFail', attempt.moduleName, attempt.error);
|
||||
} else {
|
||||
eventEmitter.emit('require', attempt.moduleName, attempt.module);
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
5
static/js/ketcher2/node_modules/liftoff/lib/silent_require.js
generated
vendored
Normal file
5
static/js/ketcher2/node_modules/liftoff/lib/silent_require.js
generated
vendored
Normal file
@ -0,0 +1,5 @@
|
||||
module.exports = function (path) {
|
||||
try {
|
||||
return require(path);
|
||||
} catch (e) {}
|
||||
};
|
||||
73
static/js/ketcher2/node_modules/liftoff/package.json
generated
vendored
Normal file
73
static/js/ketcher2/node_modules/liftoff/package.json
generated
vendored
Normal file
@ -0,0 +1,73 @@
|
||||
{
|
||||
"_from": "liftoff@^2.1.0",
|
||||
"_id": "liftoff@2.3.0",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha1-qY8v9nGD2Lp8+soQVIvX/wVQs4U=",
|
||||
"_location": "/liftoff",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "liftoff@^2.1.0",
|
||||
"name": "liftoff",
|
||||
"escapedName": "liftoff",
|
||||
"rawSpec": "^2.1.0",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^2.1.0"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/gulp"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/liftoff/-/liftoff-2.3.0.tgz",
|
||||
"_shasum": "a98f2ff67183d8ba7cfaca10548bd7ff0550b385",
|
||||
"_spec": "liftoff@^2.1.0",
|
||||
"_where": "/home/manfred/enviPath/ketcher2/ketcher/node_modules/gulp",
|
||||
"author": {
|
||||
"name": "Tyler Kellen",
|
||||
"url": "http://goingslowly.com/"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/js-cli/js-liftoff/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"dependencies": {
|
||||
"extend": "^3.0.0",
|
||||
"findup-sync": "^0.4.2",
|
||||
"fined": "^1.0.1",
|
||||
"flagged-respawn": "^0.3.2",
|
||||
"lodash.isplainobject": "^4.0.4",
|
||||
"lodash.isstring": "^4.0.1",
|
||||
"lodash.mapvalues": "^4.4.0",
|
||||
"rechoir": "^0.6.2",
|
||||
"resolve": "^1.1.7"
|
||||
},
|
||||
"deprecated": false,
|
||||
"description": "Launch your command line tool with ease.",
|
||||
"devDependencies": {
|
||||
"chai": "^3.5.0",
|
||||
"coffee-script": "^1.10.0",
|
||||
"istanbul": "^0.4.3",
|
||||
"jscs": "^2.11.0",
|
||||
"jshint": "^2.9.2",
|
||||
"mocha": "^2.4.5",
|
||||
"sinon": "~1.17.4"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.8"
|
||||
},
|
||||
"homepage": "https://github.com/js-cli/js-liftoff",
|
||||
"keywords": [
|
||||
"command line"
|
||||
],
|
||||
"license": "MIT",
|
||||
"main": "index.js",
|
||||
"name": "liftoff",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/js-cli/js-liftoff.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "jshint lib index.js && jscs lib index.js && mocha -t 5000 -b -R spec test/index"
|
||||
},
|
||||
"version": "2.3.0"
|
||||
}
|
||||
Reference in New Issue
Block a user