Completely updated React, fixed #11, (hopefully)

This commit is contained in:
2018-03-04 19:11:49 -05:00
parent 6e0afd6e2a
commit 34e5f5139a
13674 changed files with 333464 additions and 473223 deletions

View File

@@ -35,13 +35,16 @@ var dotenvFiles = [
// Load environment variables from .env* files. Suppress warnings using silent
// if this file is missing. dotenv will never modify any environment variables
// that have already been set.
// that have already been set. Variable expansion is supported in .env files.
// https://github.com/motdotla/dotenv
// https://github.com/motdotla/dotenv-expand
dotenvFiles.forEach(dotenvFile => {
if (fs.existsSync(dotenvFile)) {
require('dotenv').config({
path: dotenvFile,
});
require('dotenv-expand')(
require('dotenv').config({
path: dotenvFile,
})
);
}
});

View File

@@ -9,7 +9,7 @@
'use strict';
// This is a custom Jest transformer turning style imports into empty objects.
// http://facebook.github.io/jest/docs/tutorial-webpack.html
// http://facebook.github.io/jest/docs/en/webpack.html
module.exports = {
process() {

View File

@@ -11,7 +11,7 @@
const path = require('path');
// This is a custom Jest transformer turning file imports into filenames.
// http://facebook.github.io/jest/docs/tutorial-webpack.html
// http://facebook.github.io/jest/docs/en/webpack.html
module.exports = {
process(src, filename) {

View File

@@ -220,10 +220,10 @@ module.exports = {
// that fall through the other loaders.
{
// Exclude `js` files to keep "css" loader working as it injects
// it's runtime that would otherwise processed through "file" loader.
// its runtime that would otherwise processed through "file" loader.
// Also exclude `html` and `json` extensions so they get processed
// by webpacks internal loaders.
exclude: [/\.js$/, /\.html$/, /\.json$/],
exclude: [/\.(js|jsx|mjs)$/, /\.html$/, /\.json$/],
loader: require.resolve('file-loader'),
options: {
name: 'static/media/[name].[hash:8].[ext]',

View File

@@ -249,7 +249,7 @@ module.exports = {
// it's runtime that would otherwise processed through "file" loader.
// Also exclude `html` and `json` extensions so they get processed
// by webpacks internal loaders.
exclude: [/\.js$/, /\.html$/, /\.json$/],
exclude: [/\.(js|jsx|mjs)$/, /\.html$/, /\.json$/],
options: {
name: 'static/media/[name].[hash:8].[ext]',
},
@@ -301,7 +301,7 @@ module.exports = {
},
mangle: {
safari10: true,
},
},
output: {
comments: false,
// Turned on because emoji and regex is not minified properly using default

View File

@@ -10,7 +10,7 @@
const errorOverlayMiddleware = require('react-dev-utils/errorOverlayMiddleware');
const noopServiceWorkerMiddleware = require('react-dev-utils/noopServiceWorkerMiddleware');
const path = require('path');
const ignoredFiles = require('react-dev-utils/ignoredFiles');
const config = require('./webpack.config.dev');
const paths = require('./paths');
@@ -76,12 +76,7 @@ module.exports = function(proxy, allowedHost) {
// src/node_modules is not ignored to support absolute imports
// https://github.com/facebookincubator/create-react-app/issues/1065
watchOptions: {
ignored: new RegExp(
`^(?!${path
.normalize(paths.appSrc + '/')
.replace(/[\\]+/g, '\\\\')}).+[\\\\/]node_modules[\\\\/]`,
'g'
),
ignored: ignoredFiles(paths.appSrc),
},
// Enable HTTPS if the HTTPS environment variable is set to 'true'
https: protocol === 'https',

View File

@@ -7,13 +7,16 @@ The fastest JSON Schema validator for Node.js and browser with draft 6 support.
[![Build Status](https://travis-ci.org/epoberezkin/ajv.svg?branch=master)](https://travis-ci.org/epoberezkin/ajv)
[![npm version](https://badge.fury.io/js/ajv.svg)](https://www.npmjs.com/package/ajv)
[![npm@beta](https://img.shields.io/npm/v/ajv/beta.svg)](https://github.com/epoberezkin/ajv/tree/beta)
[![npm downloads](https://img.shields.io/npm/dm/ajv.svg)](https://www.npmjs.com/package/ajv)
[![Code Climate](https://codeclimate.com/github/epoberezkin/ajv/badges/gpa.svg)](https://codeclimate.com/github/epoberezkin/ajv)
[![Coverage Status](https://coveralls.io/repos/epoberezkin/ajv/badge.svg?branch=master&service=github)](https://coveralls.io/github/epoberezkin/ajv?branch=master)
[![Greenkeeper badge](https://badges.greenkeeper.io/epoberezkin/ajv.svg)](https://greenkeeper.io/)
[![Gitter](https://img.shields.io/gitter/room/ajv-validator/ajv.svg)](https://gitter.im/ajv-validator/ajv)
__Please note__: Ajv [version 6](https://github.com/epoberezkin/ajv/tree/beta) with [JSON Schema draft-07](http://json-schema.org/work-in-progress) support is released. Use `npm install ajv@beta` to install.
## Using version 5
[JSON Schema draft-06](https://trac.tools.ietf.org/html/draft-wright-json-schema-validation-01) is published.
@@ -71,7 +74,7 @@ Currently Ajv is the fastest and the most standard compliant validator according
Performance of different validators by [json-schema-benchmark](https://github.com/ebdrup/json-schema-benchmark):
[![performance](https://chart.googleapis.com/chart?chxt=x,y&cht=bhs&chco=76A4FB&chls=2.0&chbh=32,4,1&chs=600x416&chxl=-1:%7Cajv%7Cis-my-json-valid%7Cjsen%7Cschemasaurus%7Cthemis%7Cz-schema%7Cjsck%7Cjsonschema%7Cskeemas%7Ctv4%7Cjayschema&chd=t:100,68,61,22.8,17.6,6.6,2.7,0.9,0.7,0.4,0.1)](https://github.com/ebdrup/json-schema-benchmark/blob/master/README.md#performance)
[![performance](https://chart.googleapis.com/chart?chxt=x,y&cht=bhs&chco=76A4FB&chls=2.0&chbh=32,4,1&chs=600x416&chxl=-1:|djv|ajv|json-schema-validator-generator|jsen|is-my-json-valid|themis|z-schema|jsck|skeemas|json-schema-library|tv4&chd=t:100,98,72.1,66.8,50.1,15.1,6.1,3.8,1.2,0.7,0.2)](https://github.com/ebdrup/json-schema-benchmark/blob/master/README.md#performance)
## Features
@@ -107,6 +110,12 @@ Currently Ajv is the only validator that passes all the tests from [JSON Schema
npm install ajv
```
or to install [version 6](https://github.com/epoberezkin/ajv/tree/beta):
```
npm install ajv@beta
```
## <a name="usage"></a>Getting started
@@ -136,8 +145,8 @@ or
```javascript
// ...
ajv.addSchema(schema, 'mySchema');
var valid = ajv.validate('mySchema', data);
var valid = ajv.addSchema(schema, 'mySchema')
.validate('mySchema', data);
if (!valid) console.log(ajv.errorsText());
// ...
```
@@ -274,8 +283,8 @@ or use `addSchema` method:
```javascript
var ajv = new Ajv;
ajv.addSchema(defsSchema);
var validate = ajv.compile(schema);
var validate = ajv.addSchema(defsSchema)
.compile(schema);
```
See [Options](#options) and [addSchema](#api) method.
@@ -431,14 +440,17 @@ Ajv allows defining keywords with:
Example. `range` and `exclusiveRange` keywords using compiled schema:
```javascript
ajv.addKeyword('range', { type: 'number', compile: function (sch, parentSchema) {
var min = sch[0];
var max = sch[1];
ajv.addKeyword('range', {
type: 'number',
compile: function (sch, parentSchema) {
var min = sch[0];
var max = sch[1];
return parentSchema.exclusiveRange === true
? function (data) { return data > min && data < max; }
: function (data) { return data >= min && data <= max; }
} });
return parentSchema.exclusiveRange === true
? function (data) { return data > min && data < max; }
: function (data) { return data >= min && data <= max; }
}
});
var schema = { "range": [2, 4], "exclusiveRange": true };
var validate = ajv.compile(schema);
@@ -905,7 +917,7 @@ __Please note__: every time this method is called the errors are overwritten so
If the schema is asynchronous (has `$async` keyword on the top level) this method returns a Promise. See [Asynchronous validation](#asynchronous-validation).
##### .addSchema(Array&lt;Object&gt;|Object schema [, String key])
##### .addSchema(Array&lt;Object&gt;|Object schema [, String key]) -&gt; Ajv
Add schema(s) to validator instance. This method does not compile schemas (but it still validates them). Because of that dependencies can be added in any order and circular dependencies are supported. It also prevents unnecessary compilation of schemas that are containers for other schemas but not used as a whole.
@@ -920,8 +932,14 @@ Although `addSchema` does not compile schemas, explicit compilation is not requi
By default the schema is validated against meta-schema before it is added, and if the schema does not pass validation the exception is thrown. This behaviour is controlled by `validateSchema` option.
__Please note__: Ajv uses the [method chaining syntax](https://en.wikipedia.org/wiki/Method_chaining) for all methods with the prefix `add*` and `remove*`.
This allows you to do nice things like the following.
##### .addMetaSchema(Array&lt;Object&gt;|Object schema [, String key])
```javascript
var validate = new Ajv().addSchema(schema).addFormat(name, regex).getSchema(uri);
```
##### .addMetaSchema(Array&lt;Object&gt;|Object schema [, String key]) -&gt; Ajv
Adds meta schema(s) that can be used to validate other schemas. That function should be used instead of `addSchema` because there may be instance options that would compile a meta schema incorrectly (at the moment it is `removeAdditional` option).
@@ -946,7 +964,7 @@ Errors will be available at `ajv.errors`.
Retrieve compiled schema previously added with `addSchema` by the key passed to `addSchema` or by its full reference (id). The returned validating function has `schema` property with the reference to the original schema.
##### .removeSchema([Object schema|String key|String ref|RegExp pattern])
##### .removeSchema([Object schema|String key|String ref|RegExp pattern]) -&gt; Ajv
Remove added/cached schema. Even if schema is referenced by other schemas it can be safely removed as dependent schemas have local references.
@@ -959,7 +977,7 @@ Schema can be removed using:
If no parameter is passed all schemas but meta-schemas will be removed and the cache will be cleared.
##### <a name="api-addformat"></a>.addFormat(String name, String|RegExp|Function|Object format)
##### <a name="api-addformat"></a>.addFormat(String name, String|RegExp|Function|Object format) -&gt; Ajv
Add custom format to validate strings or numbers. It can also be used to replace pre-defined formats for Ajv instance.
@@ -977,7 +995,7 @@ If object is passed it should have properties `validate`, `compare` and `async`:
Custom formats can be also added via `formats` option.
##### <a name="api-addkeyword"></a>.addKeyword(String keyword, Object definition)
##### <a name="api-addkeyword"></a>.addKeyword(String keyword, Object definition) -&gt; Ajv
Add custom validation keyword to Ajv instance.
@@ -1018,7 +1036,7 @@ See [Defining custom keywords](#defining-custom-keywords) for more details.
Returns custom keyword definition, `true` for pre-defined keywords and `false` if the keyword is unknown.
##### .removeKeyword(String keyword)
##### .removeKeyword(String keyword) -&gt; Ajv
Removes custom or pre-defined keyword so you can redefine them.
@@ -1051,6 +1069,7 @@ Defaults:
formats: {},
unknownFormats: true,
schemas: {},
logger: undefined,
// referenced schema options:
schemaId: undefined // recommended '$id'
missingRefs: true,
@@ -1096,6 +1115,9 @@ Defaults:
- `[String]` - an array of unknown format names that will be ignored. This option can be used to allow usage of third party schemas with format(s) for which you don't have definitions, but still fail if another unknown format is used. If `format` keyword value is [$data reference](#data-reference) and it is not in this array the validation will fail.
- `"ignore"` - to log warning during schema compilation and always pass validation (the default behaviour in versions before 5.0.0). This option is not recommended, as it allows to mistype format name and it won't be validated without any error message. This behaviour is required by JSON-schema specification.
- _schemas_: an array or object of schemas that will be added to the instance. In case you pass the array the schemas must have IDs in them. When the object is passed the method `addSchema(value, key)` will be called for each schema in this object.
- _logger_: sets the logging method. Default is the global `console` object that should have methods `log`, `warn` and `error`. Option values:
- custom logger - it should have methods `log`, `warn` and `error`. If any of these methods is missing an exception will be thrown.
- `false` - logging is disabled.
##### Referenced schema options
@@ -1232,11 +1254,14 @@ Properties of `params` object in errors depend on the keyword that failed valida
## Related packages
- [ajv-cli](https://github.com/epoberezkin/ajv-cli) - command line interface for Ajv
- [ajv-async](https://github.com/epoberezkin/ajv-async) - configure async validation mode
- [ajv-cli](https://github.com/jessedc/ajv-cli) - command line interface
- [ajv-errors](https://github.com/epoberezkin/ajv-errors) - custom error messages
- [ajv-i18n](https://github.com/epoberezkin/ajv-i18n) - internationalised error messages
- [ajv-merge-patch](https://github.com/epoberezkin/ajv-merge-patch) - keywords $merge and $patch.
- [ajv-keywords](https://github.com/epoberezkin/ajv-keywords) - several custom keywords that can be used with Ajv (typeof, instanceof, range, propertyNames)
- [ajv-errors](https://github.com/epoberezkin/ajv-errors) - custom error messages for Ajv
- [ajv-istanbul](https://github.com/epoberezkin/ajv-istanbul) - instrument generated validation code to measure test coverage of your schemas
- [ajv-keywords](https://github.com/epoberezkin/ajv-keywords) - custom validation keywords (if/then/else, select, typeof, etc.)
- [ajv-merge-patch](https://github.com/epoberezkin/ajv-merge-patch) - keywords $merge and $patch
- [ajv-pack](https://github.com/epoberezkin/ajv-pack) - produces a compact module exporting validation functions
## Some packages using Ajv

View File

@@ -482,6 +482,7 @@ function compile(schema, root, localRefs, baseId) {
useCustomRule: useCustomRule,
opts: opts,
formats: formats,
logger: self.logger,
self: self
});
@@ -524,7 +525,7 @@ function compile(schema, root, localRefs, baseId) {
refVal[0] = validate;
} catch(e) {
console.error('Error compiling schema, function code:', sourceCode);
self.logger.error('Error compiling schema, function code:', sourceCode);
throw e;
}
@@ -638,7 +639,7 @@ function compile(schema, root, localRefs, baseId) {
var valid = validateSchema(schema);
if (!valid) {
var message = 'keyword schema is invalid: ' + self.errorsText(validateSchema.errors);
if (self._opts.validateSchema == 'log') console.error(message);
if (self._opts.validateSchema == 'log') self.logger.error(message);
else throw new Error(message);
}
}
@@ -1052,7 +1053,7 @@ module.exports = function rules() {
var ALL = [ 'type' ];
var KEYWORDS = [
'additionalItems', '$schema', 'id', 'title',
'additionalItems', '$schema', '$id', 'id', 'title',
'description', 'default', 'definitions'
];
var TYPES = [ 'number', 'integer', 'string', 'array', 'object', 'boolean', 'null' ];
@@ -2563,7 +2564,7 @@ module.exports = function generate_format(it, $keyword, $ruleType) {
var $format = it.formats[$schema];
if (!$format) {
if ($unknownFormats == 'ignore') {
console.warn('unknown format "' + $schema + '" ignored in schema at path "' + it.errSchemaPath + '"');
it.logger.warn('unknown format "' + $schema + '" ignored in schema at path "' + it.errSchemaPath + '"');
if ($breakOnError) {
out += ' if (true) { ';
}
@@ -3687,7 +3688,7 @@ module.exports = function generate_ref(it, $keyword, $ruleType) {
if ($refVal === undefined) {
var $message = it.MissingRefError.message(it.baseId, $schema);
if (it.opts.missingRefs == 'fail') {
console.error($message);
it.logger.error($message);
var $$outStack = $$outStack || [];
$$outStack.push(out);
out = ''; /* istanbul ignore else */
@@ -3718,7 +3719,7 @@ module.exports = function generate_ref(it, $keyword, $ruleType) {
out += ' if (false) { ';
}
} else if (it.opts.missingRefs == 'ignore') {
console.warn($message);
it.logger.warn($message);
if ($breakOnError) {
out += ' if (true) { ';
}
@@ -4256,7 +4257,7 @@ module.exports = function generate_validate(it, $keyword, $ruleType) {
throw new Error('$ref: validation keywords used in schema at path "' + it.errSchemaPath + '" (see option extendRefs)');
} else if (it.opts.extendRefs !== true) {
$refKeywords = false;
console.warn('$ref: keywords ignored in schema at path "' + it.errSchemaPath + '"');
it.logger.warn('$ref: keywords ignored in schema at path "' + it.errSchemaPath + '"');
}
}
if ($typeSchema) {
@@ -4414,7 +4415,7 @@ module.exports = function generate_validate(it, $keyword, $ruleType) {
}
} else {
if (it.opts.v5 && it.schema.patternGroups) {
console.warn('keyword "patternGroups" is deprecated and disabled. Use option patternGroups: true to enable.');
it.logger.warn('keyword "patternGroups" is deprecated and disabled. Use option patternGroups: true to enable.');
}
var arr2 = it.RULES;
if (arr2) {
@@ -4579,10 +4580,10 @@ module.exports = function generate_validate(it, $keyword, $ruleType) {
}
function $shouldUseRule($rule) {
return it.schema[$rule.keyword] !== undefined || ($rule.implements && $ruleImlementsSomeKeyword($rule));
return it.schema[$rule.keyword] !== undefined || ($rule.implements && $ruleImplementsSomeKeyword($rule));
}
function $ruleImlementsSomeKeyword($rule) {
function $ruleImplementsSomeKeyword($rule) {
var impl = $rule.implements;
for (var i = 0; i < impl.length; i++)
if (it.schema[impl[i]] !== undefined) return true;
@@ -4607,6 +4608,7 @@ module.exports = {
* @this Ajv
* @param {String} keyword custom keyword, should be unique (including different from all standard, custom and macro keywords).
* @param {Object} definition keyword definition object with properties `type` (type(s) which the keyword applies to), `validate` or `compile`.
* @return {Ajv} this for method chaining
*/
function addKeyword(keyword, definition) {
/* jshint validthis: true */
@@ -4684,6 +4686,8 @@ function addKeyword(keyword, definition) {
function checkDataType(dataType) {
if (!RULES.types[dataType]) throw new Error('Unknown type ' + dataType);
}
return this;
}
@@ -4704,6 +4708,7 @@ function getKeyword(keyword) {
* Remove keyword
* @this Ajv
* @param {String} keyword pre-defined or custom keyword.
* @return {Ajv} this for method chaining
*/
function removeKeyword(keyword) {
/* jshint validthis: true */
@@ -4720,6 +4725,7 @@ function removeKeyword(keyword) {
}
}
}
return this;
}
},{"./dotjs/custom":21}],37:[function(require,module,exports){
@@ -4839,6 +4845,10 @@ module.exports={
"type": "string"
},
"default": {},
"examples": {
"type": "array",
"items": {}
},
"multipleOf": {
"type": "number",
"exclusiveMinimum": 0
@@ -6882,6 +6892,7 @@ var META_SUPPORT_DATA = ['/properties'];
function Ajv(opts) {
if (!(this instanceof Ajv)) return new Ajv(opts);
opts = this._opts = util.copy(opts) || {};
setLogger(this);
this._schemas = {};
this._refs = {};
this._fragments = {};
@@ -6955,11 +6966,12 @@ function compile(schema, _meta) {
* @param {String} key Optional schema key. Can be passed to `validate` method instead of schema object or id/ref. One schema per instance can have empty `id` and `key`.
* @param {Boolean} _skipValidation true to skip schema validation. Used internally, option validateSchema should be used instead.
* @param {Boolean} _meta true if schema is a meta-schema. Used internally, addMetaSchema should be used instead.
* @return {Ajv} this for method chaining
*/
function addSchema(schema, key, _skipValidation, _meta) {
if (Array.isArray(schema)){
for (var i=0; i<schema.length; i++) this.addSchema(schema[i], undefined, _skipValidation, _meta);
return;
return this;
}
var id = this._getId(schema);
if (id !== undefined && typeof id != 'string')
@@ -6967,6 +6979,7 @@ function addSchema(schema, key, _skipValidation, _meta) {
key = resolve.normalizeId(key || id);
checkUnique(this, key);
this._schemas[key] = this._addSchema(schema, _skipValidation, _meta, true);
return this;
}
@@ -6977,9 +6990,11 @@ function addSchema(schema, key, _skipValidation, _meta) {
* @param {Object} schema schema object
* @param {String} key optional schema key
* @param {Boolean} skipValidation true to skip schema validation, can be used to override validateSchema option for meta-schema
* @return {Ajv} this for method chaining
*/
function addMetaSchema(schema, key, skipValidation) {
this.addSchema(schema, key, skipValidation, true);
return this;
}
@@ -6996,7 +7011,7 @@ function validateSchema(schema, throwOrLogError) {
throw new Error('$schema must be a string');
$schema = $schema || this._opts.defaultMeta || defaultMeta(this);
if (!$schema) {
console.warn('meta-schema not available');
this.logger.warn('meta-schema not available');
this.errors = null;
return true;
}
@@ -7009,7 +7024,7 @@ function validateSchema(schema, throwOrLogError) {
finally { this._formats.uri = currentUriFormat; }
if (!valid && throwOrLogError) {
var message = 'schema is invalid: ' + this.errorsText();
if (this._opts.validateSchema == 'log') console.error(message);
if (this._opts.validateSchema == 'log') this.logger.error(message);
else throw new Error(message);
}
return valid;
@@ -7076,25 +7091,26 @@ function _getSchemaObj(self, keyRef) {
* Even if schema is referenced by other schemas it still can be removed as other schemas have local references.
* @this Ajv
* @param {String|Object|RegExp} schemaKeyRef key, ref, pattern to match key/ref or schema object
* @return {Ajv} this for method chaining
*/
function removeSchema(schemaKeyRef) {
if (schemaKeyRef instanceof RegExp) {
_removeAllSchemas(this, this._schemas, schemaKeyRef);
_removeAllSchemas(this, this._refs, schemaKeyRef);
return;
return this;
}
switch (typeof schemaKeyRef) {
case 'undefined':
_removeAllSchemas(this, this._schemas);
_removeAllSchemas(this, this._refs);
this._cache.clear();
return;
return this;
case 'string':
var schemaObj = _getSchemaObj(this, schemaKeyRef);
if (schemaObj) this._cache.del(schemaObj.cacheKey);
delete this._schemas[schemaKeyRef];
delete this._refs[schemaKeyRef];
return;
return this;
case 'object':
var serialize = this._opts.serialize;
var cacheKey = serialize ? serialize(schemaKeyRef) : schemaKeyRef;
@@ -7106,6 +7122,7 @@ function removeSchema(schemaKeyRef) {
delete this._refs[id];
}
}
return this;
}
@@ -7208,15 +7225,15 @@ function chooseGetId(opts) {
}
}
/* @this Ajv */
function _getId(schema) {
if (schema.$id) console.warn('schema $id ignored', schema.$id);
if (schema.$id) this.logger.warn('schema $id ignored', schema.$id);
return schema.id;
}
/* @this Ajv */
function _get$Id(schema) {
if (schema.id) console.warn('schema id ignored', schema.id);
if (schema.id) this.logger.warn('schema id ignored', schema.id);
return schema.$id;
}
@@ -7256,10 +7273,12 @@ function errorsText(errors, options) {
* @this Ajv
* @param {String} name format name
* @param {String|RegExp|Function} format string is converted to RegExp; function should return boolean (true when valid)
* @return {Ajv} this for method chaining
*/
function addFormat(name, format) {
if (typeof format == 'string') format = new RegExp(format);
this._formats[name] = format;
return this;
}
@@ -7306,5 +7325,21 @@ function getMetaSchemaOptions(self) {
return metaOpts;
}
function setLogger(self) {
var logger = self._opts.logger;
if (logger === false) {
self.logger = {log: noop, warn: noop, error: noop};
} else {
if (logger === undefined) logger = console;
if (!(typeof logger == 'object' && logger.log && logger.warn && logger.error))
throw new Error('logger must implement log, warn and error methods');
self.logger = logger;
}
}
function noop() {}
},{"./$data":1,"./cache":2,"./compile":7,"./compile/async":4,"./compile/error_classes":5,"./compile/formats":6,"./compile/resolve":8,"./compile/rules":9,"./compile/schema_obj":10,"./compile/util":12,"./keyword":36,"./patternGroups":37,"./refs/$data.json":38,"./refs/json-schema-draft-06.json":39,"co":40,"fast-json-stable-stringify":42}]},{},[])("ajv")
});

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -3,7 +3,7 @@ declare var ajv: {
new (options?: ajv.Options): ajv.Ajv;
ValidationError: ValidationError;
MissingRefError: MissingRefError;
$dataMetaSchema: Object;
$dataMetaSchema: object;
}
declare namespace ajv {
@@ -11,49 +11,51 @@ declare namespace ajv {
/**
* Validate data using schema
* Schema will be compiled and cached (using serialized JSON as key, [fast-json-stable-stringify](https://github.com/epoberezkin/fast-json-stable-stringify) is used to serialize by default).
* @param {String|Object|Boolean} schemaKeyRef key, ref or schema object
* @param {string|object|Boolean} schemaKeyRef key, ref or schema object
* @param {Any} data to be validated
* @return {Boolean} validation result. Errors from the last validation will be available in `ajv.errors` (and also in compiled schema: `schema.errors`).
*/
validate(schemaKeyRef: Object | string | boolean, data: any): boolean | Thenable<any>;
validate(schemaKeyRef: object | string | boolean, data: any): boolean | Thenable<any>;
/**
* Create validating function for passed schema.
* @param {Object|Boolean} schema schema object
* @param {object|Boolean} schema schema object
* @return {Function} validating function
*/
compile(schema: Object | boolean): ValidateFunction;
compile(schema: object | boolean): ValidateFunction;
/**
* Creates validating function for passed schema with asynchronous loading of missing schemas.
* `loadSchema` option should be a function that accepts schema uri and node-style callback.
* @this Ajv
* @param {Object|Boolean} schema schema object
* @param {object|Boolean} schema schema object
* @param {Boolean} meta optional true to compile meta-schema; this parameter can be skipped
* @param {Function} callback optional node-style callback, it is always called with 2 parameters: error (or null) and validating function.
* @return {Thenable<ValidateFunction>} validating function
*/
compileAsync(schema: Object | boolean, meta?: Boolean, callback?: (err: Error, validate: ValidateFunction) => any): Thenable<ValidateFunction>;
compileAsync(schema: object | boolean, meta?: Boolean, callback?: (err: Error, validate: ValidateFunction) => any): Thenable<ValidateFunction>;
/**
* Adds schema to the instance.
* @param {Object|Array} schema schema or array of schemas. If array is passed, `key` and other parameters will be ignored.
* @param {String} key Optional schema key. Can be passed to `validate` method instead of schema object or id/ref. One schema per instance can have empty `id` and `key`.
* @param {object|Array} schema schema or array of schemas. If array is passed, `key` and other parameters will be ignored.
* @param {string} key Optional schema key. Can be passed to `validate` method instead of schema object or id/ref. One schema per instance can have empty `id` and `key`.
* @return {Ajv} this for method chaining
*/
addSchema(schema: Array<Object> | Object, key?: string): void;
addSchema(schema: Array<object> | object, key?: string): Ajv;
/**
* Add schema that will be used to validate other schemas
* options in META_IGNORE_OPTIONS are alway set to false
* @param {Object} schema schema object
* @param {String} key optional schema key
* @param {object} schema schema object
* @param {string} key optional schema key
* @return {Ajv} this for method chaining
*/
addMetaSchema(schema: Object, key?: string): void;
addMetaSchema(schema: object, key?: string): Ajv;
/**
* Validate schema
* @param {Object|Boolean} schema schema to validate
* @param {object|Boolean} schema schema to validate
* @return {Boolean} true if schema is valid
*/
validateSchema(schema: Object | boolean): boolean;
validateSchema(schema: object | boolean): boolean;
/**
* Get compiled schema from the instance by `key` or `ref`.
* @param {String} keyRef `key` that was passed to `addSchema` or full schema reference (`schema.id` or resolved id).
* @param {string} keyRef `key` that was passed to `addSchema` or full schema reference (`schema.id` or resolved id).
* @return {Function} schema validating function (with property `schema`).
*/
getSchema(keyRef: string): ValidateFunction;
@@ -62,40 +64,44 @@ declare namespace ajv {
* If no parameter is passed all schemas but meta-schemas are removed.
* If RegExp is passed all schemas with key/id matching pattern but meta-schemas are removed.
* Even if schema is referenced by other schemas it still can be removed as other schemas have local references.
* @param {String|Object|RegExp|Boolean} schemaKeyRef key, ref, pattern to match key/ref or schema object
* @param {string|object|RegExp|Boolean} schemaKeyRef key, ref, pattern to match key/ref or schema object
* @return {Ajv} this for method chaining
*/
removeSchema(schemaKeyRef?: Object | string | RegExp | boolean): void;
removeSchema(schemaKeyRef?: object | string | RegExp | boolean): Ajv;
/**
* Add custom format
* @param {String} name format name
* @param {String|RegExp|Function} format string is converted to RegExp; function should return boolean (true when valid)
* @param {string} name format name
* @param {string|RegExp|Function} format string is converted to RegExp; function should return boolean (true when valid)
* @return {Ajv} this for method chaining
*/
addFormat(name: string, format: FormatValidator | FormatDefinition): void;
addFormat(name: string, format: FormatValidator | FormatDefinition): Ajv;
/**
* Define custom keyword
* @this Ajv
* @param {String} keyword custom keyword, should be a valid identifier, should be different from all standard, custom and macro keywords.
* @param {Object} definition keyword definition object with properties `type` (type(s) which the keyword applies to), `validate` or `compile`.
* @param {string} keyword custom keyword, should be a valid identifier, should be different from all standard, custom and macro keywords.
* @param {object} definition keyword definition object with properties `type` (type(s) which the keyword applies to), `validate` or `compile`.
* @return {Ajv} this for method chaining
*/
addKeyword(keyword: string, definition: KeywordDefinition): void;
addKeyword(keyword: string, definition: KeywordDefinition): Ajv;
/**
* Get keyword definition
* @this Ajv
* @param {String} keyword pre-defined or custom keyword.
* @return {Object|Boolean} custom keyword definition, `true` if it is a predefined keyword, `false` otherwise.
* @param {string} keyword pre-defined or custom keyword.
* @return {object|Boolean} custom keyword definition, `true` if it is a predefined keyword, `false` otherwise.
*/
getKeyword(keyword: string): Object | boolean;
getKeyword(keyword: string): object | boolean;
/**
* Remove keyword
* @this Ajv
* @param {String} keyword pre-defined or custom keyword.
* @param {string} keyword pre-defined or custom keyword.
* @return {Ajv} this for method chaining
*/
removeKeyword(keyword: string): void;
removeKeyword(keyword: string): Ajv;
/**
* Convert array of error message objects to string
* @param {Array<Object>} errors optional array of validation errors, if not passed errors from the instance are used.
* @param {Object} options optional options with properties `separator` and `dataVar`.
* @return {String} human readable string with all errors descriptions
* @param {Array<object>} errors optional array of validation errors, if not passed errors from the instance are used.
* @param {object} options optional options with properties `separator` and `dataVar`.
* @return {string} human readable string with all errors descriptions
*/
errorsText(errors?: Array<ErrorObject>, options?: ErrorsTextOptions): string;
errors?: Array<ErrorObject>;
@@ -109,17 +115,17 @@ declare namespace ajv {
(
data: any,
dataPath?: string,
parentData?: Object | Array<any>,
parentData?: object | Array<any>,
parentDataProperty?: string | number,
rootData?: Object | Array<any>
rootData?: object | Array<any>
): boolean | Thenable<any>;
schema?: Object | boolean;
schema?: object | boolean;
errors?: null | Array<ErrorObject>;
refs?: Object;
refs?: object;
refVal?: Array<any>;
root?: ValidateFunction | Object;
root?: ValidateFunction | object;
$async?: true;
source?: Object;
source?: object;
}
interface Options {
@@ -130,19 +136,19 @@ declare namespace ajv {
uniqueItems?: boolean;
unicode?: boolean;
format?: string;
formats?: Object;
formats?: object;
unknownFormats?: true | string[] | 'ignore';
schemas?: Array<Object> | Object;
schemas?: Array<object> | object;
schemaId?: '$id' | 'id';
missingRefs?: true | 'ignore' | 'fail';
extendRefs?: true | 'ignore' | 'fail';
loadSchema?: (uri: string, cb?: (err: Error, schema: Object) => void) => Thenable<Object | boolean>;
loadSchema?: (uri: string, cb?: (err: Error, schema: object) => void) => Thenable<object | boolean>;
removeAdditional?: boolean | 'all' | 'failing';
useDefaults?: boolean | 'shared';
coerceTypes?: boolean | 'array';
async?: boolean | string;
transpile?: string | ((code: string) => string);
meta?: boolean | Object;
meta?: boolean | object;
validateSchema?: boolean | 'log';
addUsedSchema?: boolean;
inlineRefs?: boolean | number;
@@ -154,7 +160,7 @@ declare namespace ajv {
messages?: boolean;
sourceCode?: boolean;
processCode?: (code: string) => string;
cache?: Object;
cache?: object;
}
type FormatValidator = string | RegExp | ((data: string) => boolean | Thenable<any>);
@@ -170,27 +176,57 @@ declare namespace ajv {
async?: boolean;
$data?: boolean;
errors?: boolean | string;
metaSchema?: Object;
metaSchema?: object;
// schema: false makes validate not to expect schema (ValidateFunction)
schema?: boolean;
modifying?: boolean;
valid?: boolean;
// one and only one of the following properties should be present
validate?: SchemaValidateFunction | ValidateFunction;
compile?: (schema: any, parentSchema: Object) => ValidateFunction;
macro?: (schema: any, parentSchema: Object) => Object | boolean;
inline?: (it: Object, keyword: string, schema: any, parentSchema: Object) => string;
compile?: (schema: any, parentSchema: object, it: CompilationContext) => ValidateFunction;
macro?: (schema: any, parentSchema: object, it: CompilationContext) => object | boolean;
inline?: (it: CompilationContext, keyword: string, schema: any, parentSchema: object) => string;
}
interface CompilationContext {
level: number;
dataLevel: number;
schema: any;
schemaPath: string;
baseId: string;
async: boolean;
opts: Options;
formats: {
[index: string]: FormatDefinition | undefined;
};
compositeRule: boolean;
validate: (schema: object) => boolean;
util: {
copy(obj: any, target?: any): any;
toHash(source: string[]): { [index: string]: true | undefined };
equal(obj: any, target: any): boolean;
getProperty(str: string): string;
schemaHasRules(schema: object, rules: any): string;
escapeQuotes(str: string): string;
toQuotedString(str: string): string;
getData(jsonPointer: string, dataLevel: number, paths: string[]): string;
escapeJsonPointer(str: string): string;
unescapeJsonPointer(str: string): string;
escapeFragment(str: string): string;
unescapeFragment(str: string): string;
};
self: Ajv;
}
interface SchemaValidateFunction {
(
schema: any,
data: any,
parentSchema?: Object,
parentSchema?: object,
dataPath?: string,
parentData?: Object | Array<any>,
parentData?: object | Array<any>,
parentDataProperty?: string | number,
rootData?: Object | Array<any>
rootData?: object | Array<any>
): boolean | Thenable<any>;
errors?: Array<ErrorObject>;
}
@@ -211,7 +247,7 @@ declare namespace ajv {
message?: string;
// These are added with the `verbose` option.
schema?: any;
parentSchema?: Object;
parentSchema?: object;
data?: any;
}

View File

@@ -52,6 +52,7 @@ var META_SUPPORT_DATA = ['/properties'];
function Ajv(opts) {
if (!(this instanceof Ajv)) return new Ajv(opts);
opts = this._opts = util.copy(opts) || {};
setLogger(this);
this._schemas = {};
this._refs = {};
this._fragments = {};
@@ -125,11 +126,12 @@ function compile(schema, _meta) {
* @param {String} key Optional schema key. Can be passed to `validate` method instead of schema object or id/ref. One schema per instance can have empty `id` and `key`.
* @param {Boolean} _skipValidation true to skip schema validation. Used internally, option validateSchema should be used instead.
* @param {Boolean} _meta true if schema is a meta-schema. Used internally, addMetaSchema should be used instead.
* @return {Ajv} this for method chaining
*/
function addSchema(schema, key, _skipValidation, _meta) {
if (Array.isArray(schema)){
for (var i=0; i<schema.length; i++) this.addSchema(schema[i], undefined, _skipValidation, _meta);
return;
return this;
}
var id = this._getId(schema);
if (id !== undefined && typeof id != 'string')
@@ -137,6 +139,7 @@ function addSchema(schema, key, _skipValidation, _meta) {
key = resolve.normalizeId(key || id);
checkUnique(this, key);
this._schemas[key] = this._addSchema(schema, _skipValidation, _meta, true);
return this;
}
@@ -147,9 +150,11 @@ function addSchema(schema, key, _skipValidation, _meta) {
* @param {Object} schema schema object
* @param {String} key optional schema key
* @param {Boolean} skipValidation true to skip schema validation, can be used to override validateSchema option for meta-schema
* @return {Ajv} this for method chaining
*/
function addMetaSchema(schema, key, skipValidation) {
this.addSchema(schema, key, skipValidation, true);
return this;
}
@@ -166,7 +171,7 @@ function validateSchema(schema, throwOrLogError) {
throw new Error('$schema must be a string');
$schema = $schema || this._opts.defaultMeta || defaultMeta(this);
if (!$schema) {
console.warn('meta-schema not available');
this.logger.warn('meta-schema not available');
this.errors = null;
return true;
}
@@ -179,7 +184,7 @@ function validateSchema(schema, throwOrLogError) {
finally { this._formats.uri = currentUriFormat; }
if (!valid && throwOrLogError) {
var message = 'schema is invalid: ' + this.errorsText();
if (this._opts.validateSchema == 'log') console.error(message);
if (this._opts.validateSchema == 'log') this.logger.error(message);
else throw new Error(message);
}
return valid;
@@ -246,25 +251,26 @@ function _getSchemaObj(self, keyRef) {
* Even if schema is referenced by other schemas it still can be removed as other schemas have local references.
* @this Ajv
* @param {String|Object|RegExp} schemaKeyRef key, ref, pattern to match key/ref or schema object
* @return {Ajv} this for method chaining
*/
function removeSchema(schemaKeyRef) {
if (schemaKeyRef instanceof RegExp) {
_removeAllSchemas(this, this._schemas, schemaKeyRef);
_removeAllSchemas(this, this._refs, schemaKeyRef);
return;
return this;
}
switch (typeof schemaKeyRef) {
case 'undefined':
_removeAllSchemas(this, this._schemas);
_removeAllSchemas(this, this._refs);
this._cache.clear();
return;
return this;
case 'string':
var schemaObj = _getSchemaObj(this, schemaKeyRef);
if (schemaObj) this._cache.del(schemaObj.cacheKey);
delete this._schemas[schemaKeyRef];
delete this._refs[schemaKeyRef];
return;
return this;
case 'object':
var serialize = this._opts.serialize;
var cacheKey = serialize ? serialize(schemaKeyRef) : schemaKeyRef;
@@ -276,6 +282,7 @@ function removeSchema(schemaKeyRef) {
delete this._refs[id];
}
}
return this;
}
@@ -378,15 +385,15 @@ function chooseGetId(opts) {
}
}
/* @this Ajv */
function _getId(schema) {
if (schema.$id) console.warn('schema $id ignored', schema.$id);
if (schema.$id) this.logger.warn('schema $id ignored', schema.$id);
return schema.id;
}
/* @this Ajv */
function _get$Id(schema) {
if (schema.id) console.warn('schema id ignored', schema.id);
if (schema.id) this.logger.warn('schema id ignored', schema.id);
return schema.$id;
}
@@ -426,10 +433,12 @@ function errorsText(errors, options) {
* @this Ajv
* @param {String} name format name
* @param {String|RegExp|Function} format string is converted to RegExp; function should return boolean (true when valid)
* @return {Ajv} this for method chaining
*/
function addFormat(name, format) {
if (typeof format == 'string') format = new RegExp(format);
this._formats[name] = format;
return this;
}
@@ -475,3 +484,19 @@ function getMetaSchemaOptions(self) {
delete metaOpts[META_IGNORE_OPTIONS[i]];
return metaOpts;
}
function setLogger(self) {
var logger = self._opts.logger;
if (logger === false) {
self.logger = {log: noop, warn: noop, error: noop};
} else {
if (logger === undefined) logger = console;
if (!(typeof logger == 'object' && logger.log && logger.warn && logger.error))
throw new Error('logger must implement log, warn and error methods');
self.logger = logger;
}
}
function noop() {}

View File

@@ -104,6 +104,7 @@ function compile(schema, root, localRefs, baseId) {
useCustomRule: useCustomRule,
opts: opts,
formats: formats,
logger: self.logger,
self: self
});
@@ -146,7 +147,7 @@ function compile(schema, root, localRefs, baseId) {
refVal[0] = validate;
} catch(e) {
console.error('Error compiling schema, function code:', sourceCode);
self.logger.error('Error compiling schema, function code:', sourceCode);
throw e;
}
@@ -260,7 +261,7 @@ function compile(schema, root, localRefs, baseId) {
var valid = validateSchema(schema);
if (!valid) {
var message = 'keyword schema is invalid: ' + self.errorsText(validateSchema.errors);
if (self._opts.validateSchema == 'log') console.error(message);
if (self._opts.validateSchema == 'log') self.logger.error(message);
else throw new Error(message);
}
}

View File

@@ -20,7 +20,7 @@ module.exports = function rules() {
var ALL = [ 'type' ];
var KEYWORDS = [
'additionalItems', '$schema', 'id', 'title',
'additionalItems', '$schema', '$id', 'id', 'title',
'description', 'default', 'definitions'
];
var TYPES = [ 'number', 'integer', 'string', 'array', 'object', 'boolean', 'null' ];

View File

@@ -71,7 +71,7 @@
{{ var $format = it.formats[$schema]; }}
{{? !$format }}
{{? $unknownFormats == 'ignore' }}
{{ console.warn('unknown format "' + $schema + '" ignored in schema at path "' + it.errSchemaPath + '"'); }}
{{ it.logger.warn('unknown format "' + $schema + '" ignored in schema at path "' + it.errSchemaPath + '"'); }}
{{# def.skipFormat }}
{{?? $allowUnknown && $unknownFormats.indexOf($schema) >= 0 }}
{{# def.skipFormat }}

View File

@@ -27,11 +27,11 @@
{{? $refVal === undefined }}
{{ var $message = it.MissingRefError.message(it.baseId, $schema); }}
{{? it.opts.missingRefs == 'fail' }}
{{ console.error($message); }}
{{ it.logger.error($message); }}
{{# def.error:'$ref' }}
{{? $breakOnError }} if (false) { {{?}}
{{?? it.opts.missingRefs == 'ignore' }}
{{ console.warn($message); }}
{{ it.logger.warn($message); }}
{{? $breakOnError }} if (true) { {{?}}
{{??}}
{{ throw new it.MissingRefError(it.baseId, $schema, $message); }}

View File

@@ -140,7 +140,7 @@
{{?? it.opts.extendRefs !== true }}
{{
$refKeywords = false;
console.warn('$ref: keywords ignored in schema at path "' + it.errSchemaPath + '"');
it.logger.warn('$ref: keywords ignored in schema at path "' + it.errSchemaPath + '"');
}}
{{?}}
{{?}}
@@ -177,7 +177,7 @@
{{?}}
{{??}}
{{? it.opts.v5 && it.schema.patternGroups }}
{{ console.warn('keyword "patternGroups" is deprecated and disabled. Use option patternGroups: true to enable.'); }}
{{ it.logger.warn('keyword "patternGroups" is deprecated and disabled. Use option patternGroups: true to enable.'); }}
{{?}}
{{~ it.RULES:$rulesGroup }}
{{? $shouldUseGroup($rulesGroup) }}
@@ -260,10 +260,10 @@
function $shouldUseRule($rule) {
return it.schema[$rule.keyword] !== undefined ||
($rule.implements && $ruleImlementsSomeKeyword($rule));
($rule.implements && $ruleImplementsSomeKeyword($rule));
}
function $ruleImlementsSomeKeyword($rule) {
function $ruleImplementsSomeKeyword($rule) {
var impl = $rule.implements;
for (var i=0; i < impl.length; i++)
if (it.schema[impl[i]] !== undefined)

View File

@@ -55,7 +55,7 @@ module.exports = function generate_format(it, $keyword, $ruleType) {
var $format = it.formats[$schema];
if (!$format) {
if ($unknownFormats == 'ignore') {
console.warn('unknown format "' + $schema + '" ignored in schema at path "' + it.errSchemaPath + '"');
it.logger.warn('unknown format "' + $schema + '" ignored in schema at path "' + it.errSchemaPath + '"');
if ($breakOnError) {
out += ' if (true) { ';
}

View File

@@ -22,7 +22,7 @@ module.exports = function generate_ref(it, $keyword, $ruleType) {
if ($refVal === undefined) {
var $message = it.MissingRefError.message(it.baseId, $schema);
if (it.opts.missingRefs == 'fail') {
console.error($message);
it.logger.error($message);
var $$outStack = $$outStack || [];
$$outStack.push(out);
out = ''; /* istanbul ignore else */
@@ -53,7 +53,7 @@ module.exports = function generate_ref(it, $keyword, $ruleType) {
out += ' if (false) { ';
}
} else if (it.opts.missingRefs == 'ignore') {
console.warn($message);
it.logger.warn($message);
if ($breakOnError) {
out += ' if (true) { ';
}

View File

@@ -123,7 +123,7 @@ module.exports = function generate_validate(it, $keyword, $ruleType) {
throw new Error('$ref: validation keywords used in schema at path "' + it.errSchemaPath + '" (see option extendRefs)');
} else if (it.opts.extendRefs !== true) {
$refKeywords = false;
console.warn('$ref: keywords ignored in schema at path "' + it.errSchemaPath + '"');
it.logger.warn('$ref: keywords ignored in schema at path "' + it.errSchemaPath + '"');
}
}
if ($typeSchema) {
@@ -281,7 +281,7 @@ module.exports = function generate_validate(it, $keyword, $ruleType) {
}
} else {
if (it.opts.v5 && it.schema.patternGroups) {
console.warn('keyword "patternGroups" is deprecated and disabled. Use option patternGroups: true to enable.');
it.logger.warn('keyword "patternGroups" is deprecated and disabled. Use option patternGroups: true to enable.');
}
var arr2 = it.RULES;
if (arr2) {
@@ -446,10 +446,10 @@ module.exports = function generate_validate(it, $keyword, $ruleType) {
}
function $shouldUseRule($rule) {
return it.schema[$rule.keyword] !== undefined || ($rule.implements && $ruleImlementsSomeKeyword($rule));
return it.schema[$rule.keyword] !== undefined || ($rule.implements && $ruleImplementsSomeKeyword($rule));
}
function $ruleImlementsSomeKeyword($rule) {
function $ruleImplementsSomeKeyword($rule) {
var impl = $rule.implements;
for (var i = 0; i < impl.length; i++)
if (it.schema[impl[i]] !== undefined) return true;

View File

@@ -14,6 +14,7 @@ module.exports = {
* @this Ajv
* @param {String} keyword custom keyword, should be unique (including different from all standard, custom and macro keywords).
* @param {Object} definition keyword definition object with properties `type` (type(s) which the keyword applies to), `validate` or `compile`.
* @return {Ajv} this for method chaining
*/
function addKeyword(keyword, definition) {
/* jshint validthis: true */
@@ -91,6 +92,8 @@ function addKeyword(keyword, definition) {
function checkDataType(dataType) {
if (!RULES.types[dataType]) throw new Error('Unknown type ' + dataType);
}
return this;
}
@@ -111,6 +114,7 @@ function getKeyword(keyword) {
* Remove keyword
* @this Ajv
* @param {String} keyword pre-defined or custom keyword.
* @return {Ajv} this for method chaining
*/
function removeKeyword(keyword) {
/* jshint validthis: true */
@@ -127,4 +131,5 @@ function removeKeyword(keyword) {
}
}
}
return this;
}

View File

@@ -57,6 +57,10 @@
"type": "string"
},
"default": {},
"examples": {
"type": "array",
"items": {}
},
"multipleOf": {
"type": "number",
"exclusiveMinimum": 0

View File

@@ -1,25 +1,25 @@
{
"_args": [
[
"ajv@5.3.0",
"ajv@5.5.2",
"C:\\Users\\deranjer\\go\\src\\github.com\\deranjer\\goTorrent\\goTorrentWebUI"
]
],
"_from": "ajv@5.3.0",
"_id": "ajv@5.3.0",
"_from": "ajv@5.5.2",
"_id": "ajv@5.5.2",
"_inBundle": false,
"_integrity": "sha1-RBT/dKUIecII7l/cgm4ywwNUnto=",
"_integrity": "sha1-c7Xuyj+rZT49P5Qis0GtQiBdyWU=",
"_location": "/react-scripts/ajv",
"_phantomChildren": {},
"_requested": {
"type": "version",
"registry": true,
"raw": "ajv@5.3.0",
"raw": "ajv@5.5.2",
"name": "ajv",
"escapedName": "ajv",
"rawSpec": "5.3.0",
"rawSpec": "5.5.2",
"saveSpec": null,
"fetchSpec": "5.3.0"
"fetchSpec": "5.5.2"
},
"_requiredBy": [
"/react-scripts/eslint",
@@ -28,8 +28,8 @@
"/react-scripts/table",
"/react-scripts/webpack"
],
"_resolved": "https://registry.npmjs.org/ajv/-/ajv-5.3.0.tgz",
"_spec": "5.3.0",
"_resolved": "https://registry.npmjs.org/ajv/-/ajv-5.5.2.tgz",
"_spec": "5.5.2",
"_where": "C:\\Users\\deranjer\\go\\src\\github.com\\deranjer\\goTorrent\\goTorrentWebUI",
"author": {
"name": "Evgeny Poberezkin"
@@ -59,7 +59,7 @@
"if-node-version": "^1.0.0",
"js-beautify": "^1.7.3",
"jshint": "^2.9.4",
"json-schema-test": "^1.3.0",
"json-schema-test": "^2.0.0",
"karma": "^1.0.0",
"karma-chrome-launcher": "^2.0.0",
"karma-mocha": "^1.1.1",
@@ -70,9 +70,9 @@
"nyc": "^11.0.2",
"phantomjs-prebuilt": "^2.1.4",
"pre-commit": "^1.1.1",
"regenerator": "0.10.0",
"regenerator": "^0.12.2",
"require-globify": "^1.3.0",
"typescript": "^2.0.3",
"typescript": "^2.6.2",
"uglify-js": "^3.1.5",
"watch": "^1.0.0"
},
@@ -118,7 +118,7 @@
"bundle-beautify": "node ./scripts/bundle.js js-beautify",
"bundle-nodent": "node ./scripts/bundle.js nodent",
"bundle-regenerator": "node ./scripts/bundle.js regenerator",
"eslint": "if-node-version \">=4\" eslint lib/*.js lib/compile/*.js spec scripts",
"eslint": "if-node-version \">=4\" eslint lib/*.js lib/compile/*.js spec/*.js scripts",
"jshint": "jshint lib/*.js lib/**/*.js --exclude lib/dotjs/**/*",
"prepublish": "npm run build && npm run bundle-all",
"test": "npm run jshint && npm run eslint && npm run test-ts && npm run build && npm run test-cov && if-node-version 4 npm run test-browser",
@@ -133,5 +133,5 @@
},
"tonicExampleFilename": ".tonic_example.js",
"typings": "lib/ajv.d.ts",
"version": "5.3.0"
"version": "5.5.2"
}

View File

@@ -102,30 +102,43 @@ function assembleStyles() {
});
}
const ansi2ansi = n => n;
const rgb2rgb = (r, g, b) => [r, g, b];
styles.color.close = '\u001B[39m';
styles.bgColor.close = '\u001B[49m';
styles.color.ansi = {};
styles.color.ansi256 = {};
styles.color.ansi = {
ansi: wrapAnsi16(ansi2ansi, 0)
};
styles.color.ansi256 = {
ansi256: wrapAnsi256(ansi2ansi, 0)
};
styles.color.ansi16m = {
rgb: wrapAnsi16m(rgb2rgb, 0)
};
styles.bgColor.ansi = {};
styles.bgColor.ansi256 = {};
styles.bgColor.ansi = {
ansi: wrapAnsi16(ansi2ansi, 10)
};
styles.bgColor.ansi256 = {
ansi256: wrapAnsi256(ansi2ansi, 10)
};
styles.bgColor.ansi16m = {
rgb: wrapAnsi16m(rgb2rgb, 10)
};
for (const key of Object.keys(colorConvert)) {
for (let key of Object.keys(colorConvert)) {
if (typeof colorConvert[key] !== 'object') {
continue;
}
const suite = colorConvert[key];
if (key === 'ansi16') {
key = 'ansi';
}
if ('ansi16' in suite) {
styles.color.ansi[key] = wrapAnsi16(suite.ansi16, 0);
styles.bgColor.ansi[key] = wrapAnsi16(suite.ansi16, 10);

View File

@@ -1,25 +1,25 @@
{
"_args": [
[
"ansi-styles@3.2.0",
"ansi-styles@3.2.1",
"C:\\Users\\deranjer\\go\\src\\github.com\\deranjer\\goTorrent\\goTorrentWebUI"
]
],
"_from": "ansi-styles@3.2.0",
"_id": "ansi-styles@3.2.0",
"_from": "ansi-styles@3.2.1",
"_id": "ansi-styles@3.2.1",
"_inBundle": false,
"_integrity": "sha512-NnSOmMEYtVR2JVMIGTzynRkkaxtiq1xnFBcdQD/DnNCYPoEPsVJhM98BDyaoNOQIi7p4okdi3E27eN7GQbsUug==",
"_integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==",
"_location": "/react-scripts/ansi-styles",
"_phantomChildren": {},
"_requested": {
"type": "version",
"registry": true,
"raw": "ansi-styles@3.2.0",
"raw": "ansi-styles@3.2.1",
"name": "ansi-styles",
"escapedName": "ansi-styles",
"rawSpec": "3.2.0",
"rawSpec": "3.2.1",
"saveSpec": null,
"fetchSpec": "3.2.0"
"fetchSpec": "3.2.1"
},
"_requiredBy": [
"/react-scripts/eslint/chalk",
@@ -28,8 +28,8 @@
"/react-scripts/pretty-format",
"/react-scripts/table/chalk"
],
"_resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.0.tgz",
"_spec": "3.2.0",
"_resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz",
"_spec": "3.2.1",
"_where": "C:\\Users\\deranjer\\go\\src\\github.com\\deranjer\\goTorrent\\goTorrentWebUI",
"author": {
"name": "Sindre Sorhus",
@@ -49,6 +49,7 @@
"devDependencies": {
"ava": "*",
"babel-polyfill": "^6.23.0",
"svg-term-cli": "^2.1.1",
"xo": "*"
},
"engines": {
@@ -87,7 +88,8 @@
"url": "git+https://github.com/chalk/ansi-styles.git"
},
"scripts": {
"screenshot": "svg-term --command='node screenshot' --out=screenshot.svg --padding=3 --width=55 --height=3 --at=1000 --no-cursor",
"test": "xo && ava"
},
"version": "3.2.0"
"version": "3.2.1"
}

View File

@@ -4,7 +4,7 @@
You probably want the higher-level [chalk](https://github.com/chalk/chalk) module for styling your strings.
![](screenshot.png)
<img src="https://cdn.rawgit.com/chalk/ansi-styles/8261697c95bf34b6c7767e2cbe9941a851d59385/screenshot.svg" width="900">
## Install

View File

@@ -21,9 +21,7 @@
"saveSpec": null,
"fetchSpec": "3.1.0"
},
"_requiredBy": [
"/react-scripts"
],
"_requiredBy": [],
"_resolved": "https://registry.npmjs.org/babel-preset-react-app/-/babel-preset-react-app-3.1.0.tgz",
"_spec": "3.1.0",
"_where": "C:\\Users\\deranjer\\go\\src\\github.com\\deranjer\\goTorrent\\goTorrentWebUI",

View File

@@ -1,27 +1,64 @@
'use strict';
module.exports = function () {
var str = [].map.call(arguments, function (str) {
return str.trim();
}).filter(function (str) {
return str.length;
}).join('-');
if (!str.length) {
function preserveCamelCase(str) {
let isLastCharLower = false;
let isLastCharUpper = false;
let isLastLastCharUpper = false;
for (let i = 0; i < str.length; i++) {
const c = str[i];
if (isLastCharLower && /[a-zA-Z]/.test(c) && c.toUpperCase() === c) {
str = str.substr(0, i) + '-' + str.substr(i);
isLastCharLower = false;
isLastLastCharUpper = isLastCharUpper;
isLastCharUpper = true;
i++;
} else if (isLastCharUpper && isLastLastCharUpper && /[a-zA-Z]/.test(c) && c.toLowerCase() === c) {
str = str.substr(0, i - 1) + '-' + str.substr(i - 1);
isLastLastCharUpper = isLastCharUpper;
isLastCharUpper = false;
isLastCharLower = true;
} else {
isLastCharLower = c.toLowerCase() === c;
isLastLastCharUpper = isLastCharUpper;
isLastCharUpper = c.toUpperCase() === c;
}
}
return str;
}
module.exports = function (str) {
if (arguments.length > 1) {
str = Array.from(arguments)
.map(x => x.trim())
.filter(x => x.length)
.join('-');
} else {
str = str.trim();
}
if (str.length === 0) {
return '';
}
if (str.length === 1 || !(/[_.\- ]+/).test(str) ) {
if (str[0] === str[0].toLowerCase() && str.slice(1) !== str.slice(1).toLowerCase()) {
return str;
}
if (str.length === 1) {
return str.toLowerCase();
}
if (/^[a-z0-9]+$/.test(str)) {
return str;
}
const hasUpperCase = str !== str.toLowerCase();
if (hasUpperCase) {
str = preserveCamelCase(str);
}
return str
.replace(/^[_.\- ]+/, '')
.toLowerCase()
.replace(/[_.\- ]+(\w|$)/g, function (m, p1) {
return p1.toUpperCase();
});
.replace(/^[_.\- ]+/, '')
.toLowerCase()
.replace(/[_.\- ]+(\w|$)/g, (m, p1) => p1.toUpperCase());
};

View File

@@ -1,47 +1,45 @@
{
"_args": [
[
"camelcase@1.2.1",
"camelcase@4.1.0",
"C:\\Users\\deranjer\\go\\src\\github.com\\deranjer\\goTorrent\\goTorrentWebUI"
]
],
"_from": "camelcase@1.2.1",
"_id": "camelcase@1.2.1",
"_from": "camelcase@4.1.0",
"_id": "camelcase@4.1.0",
"_inBundle": false,
"_integrity": "sha1-m7UwTS4LVmmLLHWLCKPqqdqlijk=",
"_integrity": "sha1-1UVjW+HjPFQmScaRc+Xeas+uNN0=",
"_location": "/react-scripts/camelcase",
"_phantomChildren": {},
"_requested": {
"type": "version",
"registry": true,
"raw": "camelcase@1.2.1",
"raw": "camelcase@4.1.0",
"name": "camelcase",
"escapedName": "camelcase",
"rawSpec": "1.2.1",
"rawSpec": "4.1.0",
"saveSpec": null,
"fetchSpec": "1.2.1"
"fetchSpec": "4.1.0"
},
"_requiredBy": [
"/react-scripts/handlebars/yargs",
"/react-scripts/uglifyjs-webpack-plugin/yargs"
],
"_resolved": "https://registry.npmjs.org/camelcase/-/camelcase-1.2.1.tgz",
"_spec": "1.2.1",
"_requiredBy": [],
"_resolved": "https://registry.npmjs.org/camelcase/-/camelcase-4.1.0.tgz",
"_spec": "4.1.0",
"_where": "C:\\Users\\deranjer\\go\\src\\github.com\\deranjer\\goTorrent\\goTorrentWebUI",
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
"url": "http://sindresorhus.com"
"url": "sindresorhus.com"
},
"bugs": {
"url": "https://github.com/sindresorhus/camelcase/issues"
},
"description": "Convert a dash/dot/underscore/space separated string to camelCase: foo-bar → fooBar",
"devDependencies": {
"ava": "0.0.4"
"ava": "*",
"xo": "*"
},
"engines": {
"node": ">=0.10.0"
"node": ">=4"
},
"files": [
"index.js"
@@ -68,7 +66,10 @@
"url": "git+https://github.com/sindresorhus/camelcase.git"
},
"scripts": {
"test": "node test.js"
"test": "xo && ava"
},
"version": "1.2.1"
"version": "4.1.0",
"xo": {
"esnext": true
}
}

View File

@@ -5,7 +5,7 @@
## Install
```sh
```
$ npm install --save camelcase
```
@@ -13,44 +13,45 @@ $ npm install --save camelcase
## Usage
```js
var camelCase = require('camelcase');
const camelCase = require('camelcase');
camelCase('foo-bar');
//=> fooBar
//=> 'fooBar'
camelCase('foo_bar');
//=> fooBar
//=> 'fooBar'
camelCase('Foo-Bar');
//=> fooBar
//=> 'fooBar'
camelCase('--foo.bar');
//=> fooBar
//=> 'fooBar'
camelCase('__foo__bar__');
//=> fooBar
//=> 'fooBar'
camelCase('foo bar');
//=> fooBar
//=> 'fooBar'
console.log(process.argv[3]);
//=> --foo-bar
//=> '--foo-bar'
camelCase(process.argv[3]);
//=> fooBar
//=> 'fooBar'
camelCase('foo', 'bar');
//=> fooBar
//=> 'fooBar'
camelCase('__foo__', '--bar');
//=> fooBar
//=> 'fooBar'
```
## Related
See [`decamelize`](https://github.com/sindresorhus/decamelize) for the inverse.
- [decamelize](https://github.com/sindresorhus/decamelize) - The inverse of this module
- [uppercamelcase](https://github.com/SamVerschueren/uppercamelcase) - Like this module, but to PascalCase instead of camelCase
## License
MIT © [Sindre Sorhus](http://sindresorhus.com)
MIT © [Sindre Sorhus](https://sindresorhus.com)

View File

@@ -21,9 +21,7 @@
"saveSpec": null,
"fetchSpec": "0.1.3"
},
"_requiredBy": [
"/react-scripts/cliui"
],
"_requiredBy": [],
"_resolved": "https://registry.npmjs.org/center-align/-/center-align-0.1.3.tgz",
"_spec": "0.1.3",
"_where": "C:\\Users\\deranjer\\go\\src\\github.com\\deranjer\\goTorrent\\goTorrentWebUI",

View File

@@ -1 +0,0 @@
repo_token: NiRhyj91Z2vtgob6XdEAqs83rzNnbMZUu

View File

@@ -1,2 +0,0 @@
.DS_Store
node_modules

View File

@@ -1,7 +0,0 @@
language: node_js
node_js:
- "0.10"
- "0.11"
- "0.12"
- "iojs"
after_script: "NODE_ENV=test YOURPACKAGE_COVERAGE=1 ./node_modules/.bin/mocha --require patched-blanket --reporter mocha-lcov-reporter | ./node_modules/coveralls/bin/coveralls.js"

View File

@@ -0,0 +1,15 @@
# Change Log
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
<a name="3.2.0"></a>
# [3.2.0](https://github.com/yargs/cliui/compare/v3.1.2...v3.2.0) (2016-04-11)
### Bug Fixes
* reduces tarball size ([acc6c33](https://github.com/yargs/cliui/commit/acc6c33))
### Features
* adds standard-version for release management ([ff84e32](https://github.com/yargs/cliui/commit/ff84e32))

View File

@@ -1,8 +1,9 @@
# cliui
[![Build Status](https://travis-ci.org/bcoe/cliui.png)](https://travis-ci.org/bcoe/cliui)
[![Coverage Status](https://coveralls.io/repos/bcoe/cliui/badge.svg?branch=)](https://coveralls.io/r/bcoe/cliui?branch=)
[![Build Status](https://travis-ci.org/yargs/cliui.svg)](https://travis-ci.org/yargs/cliui)
[![Coverage Status](https://coveralls.io/repos/yargs/cliui/badge.svg?branch=)](https://coveralls.io/r/yargs/cliui?branch=)
[![NPM version](https://img.shields.io/npm/v/cliui.svg)](https://www.npmjs.com/package/cliui)
[![Standard Version](https://img.shields.io/badge/release-standard%20version-brightgreen.svg)](https://github.com/conventional-changelog/standard-version)
easily create complex multi-column command-line-interfaces.
@@ -23,15 +24,17 @@ ui.div({
ui.div(
{
text: "-f, --file",
width: 40,
width: 20,
padding: [0, 4, 0, 4]
},
{
text: "the file to load",
width: 25
text: "the file to load." +
chalk.green("(if this description is long it wraps).")
,
width: 20
},
{
text: "[required]",
text: chalk.red("[required]"),
align: 'right'
}
)
@@ -39,6 +42,8 @@ ui.div(
console.log(ui.toString())
```
<img width="500" src="screenshot.png">
## Layout DSL
cliui exposes a simple layout DSL:
@@ -48,7 +53,7 @@ object:
* `\n`: characters will be interpreted as new rows.
* `\t`: characters will be interpreted as new columns.
* ` `: characters will be interpreted as padding.
* `\s`: characters will be interpreted as padding.
**as an example...**
@@ -97,6 +102,7 @@ options:
* **width:** the width of a column.
* **align:** alignment, `right` or `center`.
* **padding:** `[top, right, bottom, left]`.
* **border:** should a border be placed around the div?
### cliui.span(column, column, column)

View File

@@ -1,12 +1,14 @@
var wrap = require('wordwrap'),
align = {
right: require('right-align'),
center: require('center-align')
},
top = 0,
right = 1,
bottom = 2,
left = 3
var stringWidth = require('string-width')
var stripAnsi = require('strip-ansi')
var wrap = require('wrap-ansi')
var align = {
right: alignRight,
center: alignCenter
}
var top = 0
var right = 1
var bottom = 2
var left = 3
function UI (opts) {
this.width = opts.width
@@ -42,9 +44,9 @@ UI.prototype._shouldApplyLayoutDSL = function () {
}
UI.prototype._applyLayoutDSL = function (str) {
var _this = this,
rows = str.split('\n'),
leftColumnWidth = 0
var _this = this
var rows = str.split('\n')
var leftColumnWidth = 0
// simple heuristic for layout, make sure the
// second column lines up along the left-hand.
@@ -52,10 +54,10 @@ UI.prototype._applyLayoutDSL = function (str) {
// than 50% of the screen.
rows.forEach(function (row) {
var columns = row.split('\t')
if (columns.length > 1 && columns[0].length > leftColumnWidth) {
if (columns.length > 1 && stringWidth(columns[0]) > leftColumnWidth) {
leftColumnWidth = Math.min(
Math.floor(_this.width * 0.5),
columns[0].length
stringWidth(columns[0])
)
}
})
@@ -68,7 +70,7 @@ UI.prototype._applyLayoutDSL = function (str) {
_this.div.apply(_this, columns.map(function (r, i) {
return {
text: r.trim(),
padding: [0, r.match(/\s*$/)[0].length, 0, r.match(/^\s*/)[0].length],
padding: _this._measurePadding(r),
width: (i === 0 && columns.length > 1) ? leftColumnWidth : undefined
}
}))
@@ -79,13 +81,20 @@ UI.prototype._applyLayoutDSL = function (str) {
UI.prototype._colFromString = function (str) {
return {
text: str
text: str,
padding: this._measurePadding(str)
}
}
UI.prototype._measurePadding = function (str) {
// measure padding without ansi escape codes
var noAnsi = stripAnsi(str)
return [0, noAnsi.match(/\s*$/)[0].length, 0, noAnsi.match(/^\s*/)[0].length]
}
UI.prototype.toString = function () {
var _this = this,
lines = []
var _this = this
var lines = []
_this.rows.forEach(function (row, i) {
_this.rowToString(row, lines)
@@ -103,13 +112,13 @@ UI.prototype.toString = function () {
}
UI.prototype.rowToString = function (row, lines) {
var _this = this,
paddingLeft,
rrows = this._rasterize(row),
str = '',
ts,
width,
wrapWidth
var _this = this
var padding
var rrows = this._rasterize(row)
var str = ''
var ts
var width
var wrapWidth
rrows.forEach(function (rrow, r) {
str = ''
@@ -118,27 +127,30 @@ UI.prototype.rowToString = function (row, lines) {
width = row[c].width // the width with padding.
wrapWidth = _this._negatePadding(row[c]) // the width without padding.
for (var i = 0; i < Math.max(wrapWidth, col.length); i++) {
ts += col.charAt(i) || ' '
ts += col
for (var i = 0; i < wrapWidth - stringWidth(col); i++) {
ts += ' '
}
// align the string within its column.
if (row[c].align && row[c].align !== 'left' && _this.wrap) {
ts = align[row[c].align](ts.trim() + '\n' + new Array(wrapWidth + 1).join(' '))
.split('\n')[0]
if (ts.length < wrapWidth) ts += new Array(width - ts.length).join(' ')
ts = align[row[c].align](ts, wrapWidth)
if (stringWidth(ts) < wrapWidth) ts += new Array(width - stringWidth(ts)).join(' ')
}
// add left/right padding and print string.
paddingLeft = (row[c].padding || [0, 0, 0, 0])[left]
if (paddingLeft) str += new Array(row[c].padding[left] + 1).join(' ')
// apply border and padding to string.
padding = row[c].padding || [0, 0, 0, 0]
if (padding[left]) str += new Array(padding[left] + 1).join(' ')
str += addBorder(row[c], ts, '| ')
str += ts
if (row[c].padding && row[c].padding[right]) str += new Array(row[c].padding[right] + 1).join(' ')
str += addBorder(row[c], ts, ' |')
if (padding[right]) str += new Array(padding[right] + 1).join(' ')
// if prior row is span, try to render the
// current row on the prior line.
if (r === 0 && lines.length > 0) {
str = _this._renderInline(str, lines[lines.length - 1], paddingLeft)
str = _this._renderInline(str, lines[lines.length - 1])
}
})
@@ -152,11 +164,21 @@ UI.prototype.rowToString = function (row, lines) {
return lines
}
function addBorder (col, ts, style) {
if (col.border) {
if (/[.']-+[.']/.test(ts)) return ''
else if (ts.trim().length) return style
else return ' '
}
return ''
}
// if the full 'source' can render in
// the target line, do so.
UI.prototype._renderInline = function (source, previousLine, paddingLeft) {
var target = previousLine.text,
str = ''
UI.prototype._renderInline = function (source, previousLine) {
var leadingWhitespace = source.match(/^ */)[0].length
var target = previousLine.text
var targetTextWidth = stringWidth(target.trimRight())
if (!previousLine.span) return source
@@ -167,39 +189,34 @@ UI.prototype._renderInline = function (source, previousLine, paddingLeft) {
return target + source
}
for (var i = 0, tc, sc; i < Math.max(source.length, target.length); i++) {
tc = target.charAt(i) || ' '
sc = source.charAt(i) || ' '
// we tried to overwrite a character in the other string.
if (tc !== ' ' && sc !== ' ') return source
// there is not enough whitespace to maintain padding.
if (sc !== ' ' && i < paddingLeft + target.length) return source
// :thumbsup:
if (tc === ' ') str += sc
else str += tc
}
if (leadingWhitespace < targetTextWidth) return source
previousLine.hidden = true
return str
return target.trimRight() + new Array(leadingWhitespace - targetTextWidth + 1).join(' ') + source.trimLeft()
}
UI.prototype._rasterize = function (row) {
var _this = this,
i,
rrow,
rrows = [],
widths = this._columnWidths(row),
wrapped
var _this = this
var i
var rrow
var rrows = []
var widths = this._columnWidths(row)
var wrapped
// word wrap all columns, and create
// a data-structure that is easy to rasterize.
row.forEach(function (col, c) {
// leave room for left and right padding.
col.width = widths[c]
if (_this.wrap) wrapped = wrap.hard(_this._negatePadding(col))(col.text).split('\n')
if (_this.wrap) wrapped = wrap(col.text, _this._negatePadding(col), {hard: true}).split('\n')
else wrapped = col.text.split('\n')
if (col.border) {
wrapped.unshift('.' + new Array(_this._negatePadding(col) + 3).join('-') + '.')
wrapped.push("'" + new Array(_this._negatePadding(col) + 3).join('-') + "'")
}
// add top and bottom padding.
if (col.padding) {
for (i = 0; i < (col.padding[top] || 0); i++) wrapped.unshift('')
@@ -224,15 +241,16 @@ UI.prototype._rasterize = function (row) {
UI.prototype._negatePadding = function (col) {
var wrapWidth = col.width
if (col.padding) wrapWidth -= (col.padding[left] || 0) + (col.padding[right] || 0)
if (col.border) wrapWidth -= 4
return wrapWidth
}
UI.prototype._columnWidths = function (row) {
var _this = this,
widths = [],
unset = row.length,
unsetWidth,
remainingWidth = this.width
var _this = this
var widths = []
var unset = row.length
var unsetWidth
var remainingWidth = this.width
// column widths can be set in config.
row.forEach(function (col, i) {
@@ -248,7 +266,7 @@ UI.prototype._columnWidths = function (row) {
// any unset widths should be calculated.
if (unset) unsetWidth = Math.floor(remainingWidth / unset)
widths.forEach(function (w, i) {
if (!_this.wrap) widths[i] = row[i].width || row[i].text.length
if (!_this.wrap) widths[i] = row[i].width || stringWidth(row[i].text)
else if (w === undefined) widths[i] = Math.max(unsetWidth, _minWidth(row[i]))
})
@@ -259,8 +277,33 @@ UI.prototype._columnWidths = function (row) {
// a column, based on padding preferences.
function _minWidth (col) {
var padding = col.padding || []
var minWidth = 1 + (padding[left] || 0) + (padding[right] || 0)
if (col.border) minWidth += 4
return minWidth
}
return 1 + (padding[left] || 0) + (padding[right] || 0)
function alignRight (str, width) {
str = str.trim()
var padding = ''
var strWidth = stringWidth(str)
if (strWidth < width) {
padding = new Array(width - strWidth + 1).join(' ')
}
return padding + str
}
function alignCenter (str, width) {
str = str.trim()
var padding = ''
var strWidth = stringWidth(str.trim())
if (strWidth < width) {
padding = new Array(parseInt((width - strWidth) / 2, 10) + 1).join(' ')
}
return padding + str
}
module.exports = function (opts) {

View File

@@ -0,0 +1,37 @@
'use strict';
var stripAnsi = require('strip-ansi');
var codePointAt = require('code-point-at');
var isFullwidthCodePoint = require('is-fullwidth-code-point');
// https://github.com/nodejs/io.js/blob/cff7300a578be1b10001f2d967aaedc88aee6402/lib/readline.js#L1345
module.exports = function (str) {
if (typeof str !== 'string' || str.length === 0) {
return 0;
}
var width = 0;
str = stripAnsi(str);
for (var i = 0; i < str.length; i++) {
var code = codePointAt(str, i);
// ignore control characters
if (code <= 0x1f || (code >= 0x7f && code <= 0x9f)) {
continue;
}
// surrogates
if (code >= 0x10000) {
i++;
}
if (isFullwidthCodePoint(code)) {
width += 2;
} else {
width++;
}
}
return width;
};

View File

@@ -0,0 +1,21 @@
The MIT License (MIT)
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.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.

View File

@@ -0,0 +1,91 @@
{
"_args": [
[
"string-width@1.0.2",
"C:\\Users\\deranjer\\go\\src\\github.com\\deranjer\\goTorrent\\goTorrentWebUI"
]
],
"_from": "string-width@1.0.2",
"_id": "string-width@1.0.2",
"_inBundle": false,
"_integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=",
"_location": "/react-scripts/cliui/string-width",
"_phantomChildren": {},
"_requested": {
"type": "version",
"registry": true,
"raw": "string-width@1.0.2",
"name": "string-width",
"escapedName": "string-width",
"rawSpec": "1.0.2",
"saveSpec": null,
"fetchSpec": "1.0.2"
},
"_requiredBy": [
"/react-scripts/cliui"
],
"_resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz",
"_spec": "1.0.2",
"_where": "C:\\Users\\deranjer\\go\\src\\github.com\\deranjer\\goTorrent\\goTorrentWebUI",
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
"url": "sindresorhus.com"
},
"bugs": {
"url": "https://github.com/sindresorhus/string-width/issues"
},
"dependencies": {
"code-point-at": "^1.0.0",
"is-fullwidth-code-point": "^1.0.0",
"strip-ansi": "^3.0.0"
},
"description": "Get the visual width of a string - the number of columns required to display it",
"devDependencies": {
"ava": "*",
"xo": "*"
},
"engines": {
"node": ">=0.10.0"
},
"files": [
"index.js"
],
"homepage": "https://github.com/sindresorhus/string-width#readme",
"keywords": [
"string",
"str",
"character",
"char",
"unicode",
"width",
"visual",
"column",
"columns",
"fullwidth",
"full-width",
"full",
"ansi",
"escape",
"codes",
"cli",
"command-line",
"terminal",
"console",
"cjk",
"chinese",
"japanese",
"korean",
"fixed-width"
],
"license": "MIT",
"name": "string-width",
"repository": {
"type": "git",
"url": "git+https://github.com/sindresorhus/string-width.git"
},
"scripts": {
"test": "xo && ava"
},
"version": "1.0.2"
}

View File

@@ -0,0 +1,42 @@
# string-width [![Build Status](https://travis-ci.org/sindresorhus/string-width.svg?branch=master)](https://travis-ci.org/sindresorhus/string-width)
> Get the visual width of a string - the number of columns required to display it
Some Unicode characters are [fullwidth](https://en.wikipedia.org/wiki/Halfwidth_and_fullwidth_forms) and use double the normal width. [ANSI escape codes](http://en.wikipedia.org/wiki/ANSI_escape_code) are stripped and doesn't affect the width.
Useful to be able to measure the actual width of command-line output.
## Install
```
$ npm install --save string-width
```
## Usage
```js
const stringWidth = require('string-width');
stringWidth('古');
//=> 2
stringWidth('\u001b[1m古\u001b[22m');
//=> 2
stringWidth('a');
//=> 1
```
## Related
- [string-width-cli](https://github.com/sindresorhus/string-width-cli) - CLI for this module
- [string-length](https://github.com/sindresorhus/string-length) - Get the real length of a string
- [widest-line](https://github.com/sindresorhus/widest-line) - Get the visual width of the widest line in a string
## License
MIT © [Sindre Sorhus](https://sindresorhus.com)

View File

@@ -21,9 +21,7 @@
"saveSpec": null,
"fetchSpec": "0.0.2"
},
"_requiredBy": [
"/react-scripts/cliui"
],
"_requiredBy": [],
"_resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-0.0.2.tgz",
"_spec": "0.0.2",
"_where": "C:\\Users\\deranjer\\go\\src\\github.com\\deranjer\\goTorrent\\goTorrentWebUI",

View File

@@ -1,39 +1,40 @@
{
"_args": [
[
"cliui@2.1.0",
"cliui@3.2.0",
"C:\\Users\\deranjer\\go\\src\\github.com\\deranjer\\goTorrent\\goTorrentWebUI"
]
],
"_from": "cliui@2.1.0",
"_id": "cliui@2.1.0",
"_from": "cliui@3.2.0",
"_id": "cliui@3.2.0",
"_inBundle": false,
"_integrity": "sha1-S0dXYP+AJkx2LDoXGQMukcf+oNE=",
"_integrity": "sha1-EgYBU3qRbSmUD5NNo7SNWFo5IT0=",
"_location": "/react-scripts/cliui",
"_phantomChildren": {},
"_phantomChildren": {
"code-point-at": "1.1.0",
"is-fullwidth-code-point": "1.0.0",
"strip-ansi": "3.0.1"
},
"_requested": {
"type": "version",
"registry": true,
"raw": "cliui@2.1.0",
"raw": "cliui@3.2.0",
"name": "cliui",
"escapedName": "cliui",
"rawSpec": "2.1.0",
"rawSpec": "3.2.0",
"saveSpec": null,
"fetchSpec": "2.1.0"
"fetchSpec": "3.2.0"
},
"_requiredBy": [
"/react-scripts/handlebars/yargs",
"/react-scripts/uglifyjs-webpack-plugin/yargs"
],
"_resolved": "https://registry.npmjs.org/cliui/-/cliui-2.1.0.tgz",
"_spec": "2.1.0",
"_requiredBy": [],
"_resolved": "https://registry.npmjs.org/cliui/-/cliui-3.2.0.tgz",
"_spec": "3.2.0",
"_where": "C:\\Users\\deranjer\\go\\src\\github.com\\deranjer\\goTorrent\\goTorrentWebUI",
"author": {
"name": "Ben Coe",
"email": "ben@npmjs.com"
},
"bugs": {
"url": "https://github.com/bcoe/cliui/issues"
"url": "https://github.com/yargs/cliui/issues"
},
"config": {
"blanket": {
@@ -48,22 +49,24 @@
}
},
"dependencies": {
"center-align": "^0.1.1",
"right-align": "^0.1.1",
"wordwrap": "0.0.2"
"string-width": "^1.0.1",
"strip-ansi": "^3.0.1",
"wrap-ansi": "^2.0.0"
},
"description": "easily create complex multi-column command-line-interfaces",
"devDependencies": {
"blanket": "^1.1.6",
"chai": "^2.2.0",
"coveralls": "^2.11.2",
"mocha": "^2.2.4",
"mocha-lcov-reporter": "0.0.2",
"mocoverage": "^1.0.0",
"patched-blanket": "^1.0.1",
"standard": "^3.6.1"
"chai": "^3.5.0",
"chalk": "^1.1.2",
"coveralls": "^2.11.8",
"mocha": "^2.4.5",
"nyc": "^6.4.0",
"standard": "^6.0.8",
"standard-version": "^2.1.2"
},
"homepage": "https://github.com/bcoe/cliui#readme",
"files": [
"index.js"
],
"homepage": "https://github.com/yargs/cliui#readme",
"keywords": [
"cli",
"command-line",
@@ -78,10 +81,13 @@
"name": "cliui",
"repository": {
"type": "git",
"url": "git+ssh://git@github.com/bcoe/cliui.git"
"url": "git+ssh://git@github.com/yargs/cliui.git"
},
"scripts": {
"test": "standard && mocha --check-leaks --ui exports --require patched-blanket -R mocoverage"
"coverage": "nyc --reporter=text-lcov mocha | coveralls",
"pretest": "standard",
"test": "nyc mocha",
"version": "standard-version"
},
"standard": {
"ignore": [
@@ -91,5 +97,5 @@
"it"
]
},
"version": "2.1.0"
"version": "3.2.0"
}

View File

@@ -1,349 +0,0 @@
/* global describe, it */
require('chai').should()
var cliui = require('../')
describe('cliui', function () {
describe('div', function () {
it("wraps text at 'width' if a single column is given", function () {
var ui = cliui({
width: 10
})
ui.div('i am a string that should be wrapped')
ui.toString().split('\n').forEach(function (row) {
row.length.should.be.lte(10)
})
})
it('evenly divides text across columns if multiple columns are given', function () {
var ui = cliui({
width: 40
})
ui.div(
{text: 'i am a string that should be wrapped', width: 15},
'i am a second string that should be wrapped',
'i am a third string that should be wrapped'
)
// total width of all columns is <=
// the width cliui is initialized with.
ui.toString().split('\n').forEach(function (row) {
row.length.should.be.lte(40)
})
// it should wrap each column appropriately.
var expected = [
'i am a string i am a i am a third',
'that should be second string that',
'wrapped string that should be',
' should be wrapped',
' wrapped'
]
ui.toString().split('\n').should.eql(expected)
})
it('allows for a blank row to be appended', function () {
var ui = cliui({
width: 40
})
ui.div()
// it should wrap each column appropriately.
var expected = ['']
ui.toString().split('\n').should.eql(expected)
})
})
describe('_columnWidths', function () {
it('uses same width for each column by default', function () {
var ui = cliui({
width: 40
}),
widths = ui._columnWidths([{}, {}, {}])
widths[0].should.equal(13)
widths[1].should.equal(13)
widths[2].should.equal(13)
})
it('divides width over remaining columns if first column has width specified', function () {
var ui = cliui({
width: 40
}),
widths = ui._columnWidths([{width: 20}, {}, {}])
widths[0].should.equal(20)
widths[1].should.equal(10)
widths[2].should.equal(10)
})
it('divides width over remaining columns if middle column has width specified', function () {
var ui = cliui({
width: 40
}),
widths = ui._columnWidths([{}, {width: 10}, {}])
widths[0].should.equal(15)
widths[1].should.equal(10)
widths[2].should.equal(15)
})
it('keeps track of remaining width if multiple columns have width specified', function () {
var ui = cliui({
width: 40
}),
widths = ui._columnWidths([{width: 20}, {width: 12}, {}])
widths[0].should.equal(20)
widths[1].should.equal(12)
widths[2].should.equal(8)
})
it('uses a sane default if impossible widths are specified', function () {
var ui = cliui({
width: 40
}),
widths = ui._columnWidths([{width: 30}, {width: 30}, {padding: [0, 2, 0, 1]}])
widths[0].should.equal(30)
widths[1].should.equal(30)
widths[2].should.equal(4)
})
})
describe('alignment', function () {
it('allows a column to be right aligned', function () {
var ui = cliui({
width: 40
})
ui.div(
'i am a string',
{text: 'i am a second string', align: 'right'},
'i am a third string that should be wrapped'
)
// it should right-align the second column.
var expected = [
'i am a stringi am a secondi am a third',
' stringstring that',
' should be',
' wrapped'
]
ui.toString().split('\n').should.eql(expected)
})
it('allows a column to be center aligned', function () {
var ui = cliui({
width: 60
})
ui.div(
'i am a string',
{text: 'i am a second string', align: 'center', padding: [0, 2, 0, 2]},
'i am a third string that should be wrapped'
)
// it should right-align the second column.
var expected = [
'i am a string i am a second i am a third string',
' string that should be',
' wrapped'
]
ui.toString().split('\n').should.eql(expected)
})
})
describe('padding', function () {
it('handles left/right padding', function () {
var ui = cliui({
width: 40
})
ui.div(
{text: 'i have padding on my left', padding: [0, 0, 0, 4]},
{text: 'i have padding on my right', padding: [0, 2, 0, 0], align: 'center'},
{text: 'i have no padding', padding: [0, 0, 0, 0]}
)
// it should add left/right padding to columns.
var expected = [
' i have i have i have no',
' padding padding on padding',
' on my my right',
' left'
]
ui.toString().split('\n').should.eql(expected)
})
it('handles top/bottom padding', function () {
var ui = cliui({
width: 40
})
ui.div(
'i am a string',
{text: 'i am a second string', padding: [2, 0, 0, 0]},
{text: 'i am a third string that should be wrapped', padding: [0, 0, 1, 0]}
)
// it should add top/bottom padding to second
// and third columns.
var expected = [
'i am a string i am a third',
' string that',
' i am a secondshould be',
' string wrapped',
''
]
ui.toString().split('\n').should.eql(expected)
})
})
describe('wrap', function () {
it('allows wordwrap to be disabled', function () {
var ui = cliui({
wrap: false
})
ui.div(
{text: 'i am a string', padding: [0, 1, 0, 0]},
{text: 'i am a second string', padding: [0, 2, 0, 0]},
{text: 'i am a third string that should not be wrapped', padding: [0, 0, 0, 2]}
)
ui.toString().should.equal('i am a string i am a second string i am a third string that should not be wrapped')
})
})
describe('span', function () {
it('appends the next row to the end of the prior row if it fits', function () {
var ui = cliui({
width: 40
})
ui.span(
{text: 'i am a string that will be wrapped', width: 30}
)
ui.div(
{text: ' [required] [default: 99]', align: 'right'}
)
var expected = [
'i am a string that will be',
'wrapped [required] [default: 99]'
]
ui.toString().split('\n').should.eql(expected)
})
it('does not append the string if it does not fit on the prior row', function () {
var ui = cliui({
width: 40
})
ui.span(
{text: 'i am a string that will be wrapped', width: 30}
)
ui.div(
{text: 'i am a second row', align: 'left'}
)
var expected = [
'i am a string that will be',
'wrapped',
'i am a second row'
]
ui.toString().split('\n').should.eql(expected)
})
it('always appends text to prior span if wrap is disabled', function () {
var ui = cliui({
wrap: false,
width: 40
})
ui.span(
{text: 'i am a string that will be wrapped', width: 30}
)
ui.div(
{text: 'i am a second row', align: 'left', padding: [0, 0, 0, 3]}
)
ui.div('a third line')
var expected = [
'i am a string that will be wrapped i am a second row',
'a third line'
]
ui.toString().split('\n').should.eql(expected)
})
})
describe('layoutDSL', function () {
it('turns tab into multiple columns', function () {
var ui = cliui({
width: 60
})
ui.div(
' <regex> \tmy awesome regex\n <my second thing> \tanother row\t a third column'
)
var expected = [
' <regex> my awesome regex',
' <my second thing> another row a third column'
]
ui.toString().split('\n').should.eql(expected)
})
it('turns newline into multiple rows', function () {
var ui = cliui({
width: 40
})
ui.div(
'Usage: $0\n <regex>\t my awesome regex\n <glob>\t my awesome glob\t [required]'
)
var expected = [
'Usage: $0',
' <regex> my awesome regex',
' <glob> my awesome [required]',
' glob'
]
ui.toString().split('\n').should.eql(expected)
})
it('does not apply DSL if wrap is false', function () {
var ui = cliui({
width: 40,
wrap: false
})
ui.div(
'Usage: $0\ttwo\tthree'
)
ui.toString().should.eql('Usage: $0\ttwo\tthree')
})
})
})

View File

@@ -24,6 +24,7 @@
"_requiredBy": [
"/react-scripts/ansi-align/string-width",
"/react-scripts/boxen/string-width",
"/react-scripts/cliui/string-width",
"/react-scripts/webpack-dev-server/string-width",
"/react-scripts/webpack/cliui/string-width",
"/react-scripts/widest-line/string-width",

View File

@@ -21,9 +21,7 @@
"saveSpec": null,
"fetchSpec": "2.0.1"
},
"_requiredBy": [
"/react-scripts"
],
"_requiredBy": [],
"_resolved": "https://registry.npmjs.org/eslint-config-react-app/-/eslint-config-react-app-2.0.1.tgz",
"_spec": "2.0.1",
"_where": "C:\\Users\\deranjer\\go\\src\\github.com\\deranjer\\goTorrent\\goTorrentWebUI",

View File

@@ -11,11 +11,10 @@
"_integrity": "sha512-MMVl8P/dYUFZEvolL8PYt7qc5LNdS2lwheq9BYa5Y07FblhcZqFyaUqlS8TW5QITGex21tV4Lk0a3fK8lsJIkA==",
"_location": "/react-scripts/eslint",
"_phantomChildren": {
"ansi-styles": "3.2.0",
"ansi-styles": "3.2.1",
"argparse": "1.0.9",
"escape-string-regexp": "1.0.5",
"ms": "2.0.0",
"supports-color": "4.5.0"
"ms": "2.0.0"
},
"_requested": {
"type": "version",

View File

@@ -22,6 +22,7 @@
"fetchSpec": "0.7.0"
},
"_requiredBy": [
"/react-scripts/os-locale",
"/react-scripts/webpack/os-locale"
],
"_resolved": "https://registry.npmjs.org/execa/-/execa-0.7.0.tgz",

View File

@@ -35,7 +35,6 @@
"/react-scripts/jsonfile",
"/react-scripts/klaw",
"/react-scripts/load-json-file",
"/react-scripts/path-type",
"/react-scripts/readdirp",
"/react-scripts/watchpack",
"/react-scripts/webpack-manifest-plugin/fs-extra",

View File

@@ -12,8 +12,6 @@
"_location": "/react-scripts/handlebars",
"_phantomChildren": {
"amdefine": "1.0.1",
"camelcase": "1.2.1",
"cliui": "2.1.0",
"decamelize": "1.2.0",
"uglify-to-browserify": "1.0.2",
"window-size": "0.1.0"

View File

@@ -1,10 +1,8 @@
'use strict';
module.exports = function (flag, argv) {
module.exports = (flag, argv) => {
argv = argv || process.argv;
var terminatorPos = argv.indexOf('--');
var prefix = /^-{1,2}/.test(flag) ? '' : '--';
var pos = argv.indexOf(prefix + flag);
const prefix = flag.startsWith('-') ? '' : (flag.length === 1 ? '-' : '--');
const pos = argv.indexOf(prefix + flag);
const terminatorPos = argv.indexOf('--');
return pos !== -1 && (terminatorPos === -1 ? true : pos < terminatorPos);
};

View File

@@ -1,21 +1,9 @@
The MIT License (MIT)
MIT License
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.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:
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 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.
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.

View File

@@ -1,31 +1,31 @@
{
"_args": [
[
"has-flag@2.0.0",
"has-flag@3.0.0",
"C:\\Users\\deranjer\\go\\src\\github.com\\deranjer\\goTorrent\\goTorrentWebUI"
]
],
"_from": "has-flag@2.0.0",
"_id": "has-flag@2.0.0",
"_from": "has-flag@3.0.0",
"_id": "has-flag@3.0.0",
"_inBundle": false,
"_integrity": "sha1-6CB68cx7MNRGzHC3NLXovhj4jVE=",
"_integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=",
"_location": "/react-scripts/has-flag",
"_phantomChildren": {},
"_requested": {
"type": "version",
"registry": true,
"raw": "has-flag@2.0.0",
"raw": "has-flag@3.0.0",
"name": "has-flag",
"escapedName": "has-flag",
"rawSpec": "2.0.0",
"rawSpec": "3.0.0",
"saveSpec": null,
"fetchSpec": "2.0.0"
"fetchSpec": "3.0.0"
},
"_requiredBy": [
"/react-scripts/supports-color"
],
"_resolved": "https://registry.npmjs.org/has-flag/-/has-flag-2.0.0.tgz",
"_spec": "2.0.0",
"_resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz",
"_spec": "3.0.0",
"_where": "C:\\Users\\deranjer\\go\\src\\github.com\\deranjer\\goTorrent\\goTorrentWebUI",
"author": {
"name": "Sindre Sorhus",
@@ -41,7 +41,7 @@
"xo": "*"
},
"engines": {
"node": ">=0.10.0"
"node": ">=4"
},
"files": [
"index.js"
@@ -67,23 +67,6 @@
"optimist"
],
"license": "MIT",
"maintainers": [
{
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
"url": "sindresorhus.com"
},
{
"name": "Joshua Appelman",
"email": "jappelman@xebia.com",
"url": "jbnicolai.com"
},
{
"name": "JD Ballard",
"email": "i.am.qix@gmail.com",
"url": "github.com/qix-"
}
],
"name": "has-flag",
"repository": {
"type": "git",
@@ -92,5 +75,5 @@
"scripts": {
"test": "xo && ava"
},
"version": "2.0.0"
"version": "3.0.0"
}

View File

@@ -8,7 +8,7 @@ Correctly stops looking after an `--` argument terminator.
## Install
```
$ npm install --save has-flag
$ npm install has-flag
```
@@ -24,6 +24,9 @@ hasFlag('unicorn');
hasFlag('--unicorn');
//=> true
hasFlag('f');
//=> true
hasFlag('-f');
//=> true
@@ -46,7 +49,7 @@ $ node foo.js -f --unicorn --foo=bar -- --rainbow
### hasFlag(flag, [argv])
Returns a boolean whether the flag exists.
Returns a boolean for whether the flag exists.
#### flag
@@ -56,7 +59,7 @@ CLI flag to look for. The `--` prefix is optional.
#### argv
Type: `array`<br>
Type: `string[]`<br>
Default: `process.argv`
CLI arguments.

View File

@@ -11,9 +11,8 @@
"_integrity": "sha512-h+xtnyk4EwKvFWHrUYsWErEVR+igKtLdchu+o0Z1RL7VU/jVMFbYir2bp6bAj8efFNxWqHX0dIss6fJQ+/+qeQ==",
"_location": "/react-scripts/inquirer",
"_phantomChildren": {
"ansi-styles": "3.2.0",
"escape-string-regexp": "1.0.5",
"supports-color": "4.5.0"
"ansi-styles": "3.2.1",
"escape-string-regexp": "1.0.5"
},
"_requested": {
"type": "version",

View File

@@ -1,46 +1,46 @@
'use strict';
/* eslint-disable yoda */
module.exports = x => {
if (Number.isNaN(x)) {
var numberIsNan = require('number-is-nan');
module.exports = function (x) {
if (numberIsNan(x)) {
return false;
}
// https://github.com/nodejs/io.js/blob/cff7300a578be1b10001f2d967aaedc88aee6402/lib/readline.js#L1369
// code points are derived from:
// http://www.unix.org/Public/UNIDATA/EastAsianWidth.txt
if (
x >= 0x1100 && (
x <= 0x115f || // Hangul Jamo
x === 0x2329 || // LEFT-POINTING ANGLE BRACKET
x === 0x232a || // RIGHT-POINTING ANGLE BRACKET
// CJK Radicals Supplement .. Enclosed CJK Letters and Months
(0x2e80 <= x && x <= 0x3247 && x !== 0x303f) ||
// Enclosed CJK Letters and Months .. CJK Unified Ideographs Extension A
(0x3250 <= x && x <= 0x4dbf) ||
// CJK Unified Ideographs .. Yi Radicals
(0x4e00 <= x && x <= 0xa4c6) ||
// Hangul Jamo Extended-A
(0xa960 <= x && x <= 0xa97c) ||
// Hangul Syllables
(0xac00 <= x && x <= 0xd7a3) ||
// CJK Compatibility Ideographs
(0xf900 <= x && x <= 0xfaff) ||
// Vertical Forms
(0xfe10 <= x && x <= 0xfe19) ||
// CJK Compatibility Forms .. Small Form Variants
(0xfe30 <= x && x <= 0xfe6b) ||
// Halfwidth and Fullwidth Forms
(0xff01 <= x && x <= 0xff60) ||
(0xffe0 <= x && x <= 0xffe6) ||
// Kana Supplement
(0x1b000 <= x && x <= 0x1b001) ||
// Enclosed Ideographic Supplement
(0x1f200 <= x && x <= 0x1f251) ||
// CJK Unified Ideographs Extension B .. Tertiary Ideographic Plane
(0x20000 <= x && x <= 0x3fffd)
)
) {
if (x >= 0x1100 && (
x <= 0x115f || // Hangul Jamo
0x2329 === x || // LEFT-POINTING ANGLE BRACKET
0x232a === x || // RIGHT-POINTING ANGLE BRACKET
// CJK Radicals Supplement .. Enclosed CJK Letters and Months
(0x2e80 <= x && x <= 0x3247 && x !== 0x303f) ||
// Enclosed CJK Letters and Months .. CJK Unified Ideographs Extension A
0x3250 <= x && x <= 0x4dbf ||
// CJK Unified Ideographs .. Yi Radicals
0x4e00 <= x && x <= 0xa4c6 ||
// Hangul Jamo Extended-A
0xa960 <= x && x <= 0xa97c ||
// Hangul Syllables
0xac00 <= x && x <= 0xd7a3 ||
// CJK Compatibility Ideographs
0xf900 <= x && x <= 0xfaff ||
// Vertical Forms
0xfe10 <= x && x <= 0xfe19 ||
// CJK Compatibility Forms .. Small Form Variants
0xfe30 <= x && x <= 0xfe6b ||
// Halfwidth and Fullwidth Forms
0xff01 <= x && x <= 0xff60 ||
0xffe0 <= x && x <= 0xffe6 ||
// Kana Supplement
0x1b000 <= x && x <= 0x1b001 ||
// Enclosed Ideographic Supplement
0x1f200 <= x && x <= 0x1f251 ||
// CJK Unified Ideographs Extension B .. Tertiary Ideographic Plane
0x20000 <= x && x <= 0x3fffd)) {
return true;
}
return false;
};
}

View File

@@ -1,32 +1,31 @@
{
"_args": [
[
"is-fullwidth-code-point@2.0.0",
"is-fullwidth-code-point@1.0.0",
"C:\\Users\\deranjer\\go\\src\\github.com\\deranjer\\goTorrent\\goTorrentWebUI"
]
],
"_from": "is-fullwidth-code-point@2.0.0",
"_id": "is-fullwidth-code-point@2.0.0",
"_from": "is-fullwidth-code-point@1.0.0",
"_id": "is-fullwidth-code-point@1.0.0",
"_inBundle": false,
"_integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=",
"_integrity": "sha1-754xOG8DGn8NZDr4L95QxFfvAMs=",
"_location": "/react-scripts/is-fullwidth-code-point",
"_phantomChildren": {},
"_requested": {
"type": "version",
"registry": true,
"raw": "is-fullwidth-code-point@2.0.0",
"raw": "is-fullwidth-code-point@1.0.0",
"name": "is-fullwidth-code-point",
"escapedName": "is-fullwidth-code-point",
"rawSpec": "2.0.0",
"rawSpec": "1.0.0",
"saveSpec": null,
"fetchSpec": "2.0.0"
"fetchSpec": "1.0.0"
},
"_requiredBy": [
"/react-scripts/slice-ansi",
"/react-scripts/string-width"
"/react-scripts/cliui/string-width"
],
"_resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz",
"_spec": "2.0.0",
"_resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz",
"_spec": "1.0.0",
"_where": "C:\\Users\\deranjer\\go\\src\\github.com\\deranjer\\goTorrent\\goTorrentWebUI",
"author": {
"name": "Sindre Sorhus",
@@ -36,13 +35,16 @@
"bugs": {
"url": "https://github.com/sindresorhus/is-fullwidth-code-point/issues"
},
"dependencies": {
"number-is-nan": "^1.0.0"
},
"description": "Check if the character represented by a given Unicode code point is fullwidth",
"devDependencies": {
"ava": "*",
"xo": "*"
"ava": "0.0.4",
"code-point-at": "^1.0.0"
},
"engines": {
"node": ">=4"
"node": ">=0.10.0"
},
"files": [
"index.js"
@@ -72,10 +74,7 @@
"url": "git+https://github.com/sindresorhus/is-fullwidth-code-point.git"
},
"scripts": {
"test": "xo && ava"
"test": "node test.js"
},
"version": "2.0.0",
"xo": {
"esnext": true
}
"version": "1.0.0"
}

View File

@@ -13,7 +13,7 @@ $ npm install --save is-fullwidth-code-point
## Usage
```js
const isFullwidthCodePoint = require('is-fullwidth-code-point');
var isFullwidthCodePoint = require('is-fullwidth-code-point');
isFullwidthCodePoint('谢'.codePointAt());
//=> true
@@ -36,4 +36,4 @@ Type: `number`
## License
MIT © [Sindre Sorhus](https://sindresorhus.com)
MIT © [Sindre Sorhus](http://sindresorhus.com)

View File

@@ -21,9 +21,7 @@
"saveSpec": null,
"fetchSpec": "0.2.1"
},
"_requiredBy": [
"/react-scripts/strip-bom"
],
"_requiredBy": [],
"_resolved": "https://registry.npmjs.org/is-utf8/-/is-utf8-0.2.1.tgz",
"_spec": "0.2.1",
"_where": "C:\\Users\\deranjer\\go\\src\\github.com\\deranjer\\goTorrent\\goTorrentWebUI",

View File

@@ -37,8 +37,7 @@
"string-length": "1.0.1",
"throat": "3.2.0",
"which": "1.3.0",
"worker-farm": "1.5.1",
"yargs": "7.1.0"
"worker-farm": "1.5.1"
},
"_requested": {
"type": "version",

View File

@@ -1,21 +1,11 @@
'use strict';
var path = require('path');
var fs = require('graceful-fs');
var stripBom = require('strip-bom');
var parseJson = require('parse-json');
var Promise = require('pinkie-promise');
var pify = require('pify');
const path = require('path');
const fs = require('graceful-fs');
const stripBom = require('strip-bom');
const parseJson = require('parse-json');
const pify = require('pify');
function parse(x, fp) {
return parseJson(stripBom(x), path.relative(process.cwd(), fp));
}
const parse = (data, fp) => parseJson(stripBom(data), path.relative('.', fp));
module.exports = function (fp) {
return pify(fs.readFile, Promise)(fp, 'utf8').then(function (data) {
return parse(data, fp);
});
};
module.exports.sync = function (fp) {
return parse(fs.readFileSync(fp, 'utf8'), fp);
};
module.exports = fp => pify(fs.readFile)(fp, 'utf8').then(data => parse(data, fp));
module.exports.sync = fp => parse(fs.readFileSync(fp, 'utf8'), fp);

View File

@@ -1,31 +1,31 @@
{
"_args": [
[
"load-json-file@1.1.0",
"load-json-file@2.0.0",
"C:\\Users\\deranjer\\go\\src\\github.com\\deranjer\\goTorrent\\goTorrentWebUI"
]
],
"_from": "load-json-file@1.1.0",
"_id": "load-json-file@1.1.0",
"_from": "load-json-file@2.0.0",
"_id": "load-json-file@2.0.0",
"_inBundle": false,
"_integrity": "sha1-lWkFcI1YtLq0wiYbBPWfMcmTdMA=",
"_integrity": "sha1-eUfkIUmvgNaWy/eXvKq8/h/inKg=",
"_location": "/react-scripts/load-json-file",
"_phantomChildren": {},
"_requested": {
"type": "version",
"registry": true,
"raw": "load-json-file@1.1.0",
"raw": "load-json-file@2.0.0",
"name": "load-json-file",
"escapedName": "load-json-file",
"rawSpec": "1.1.0",
"rawSpec": "2.0.0",
"saveSpec": null,
"fetchSpec": "1.1.0"
"fetchSpec": "2.0.0"
},
"_requiredBy": [
"/react-scripts/read-pkg"
],
"_resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-1.1.0.tgz",
"_spec": "1.1.0",
"_resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-2.0.0.tgz",
"_spec": "2.0.0",
"_where": "C:\\Users\\deranjer\\go\\src\\github.com\\deranjer\\goTorrent\\goTorrentWebUI",
"author": {
"name": "Sindre Sorhus",
@@ -39,8 +39,7 @@
"graceful-fs": "^4.1.2",
"parse-json": "^2.2.0",
"pify": "^2.0.0",
"pinkie-promise": "^2.0.0",
"strip-bom": "^2.0.0"
"strip-bom": "^3.0.0"
},
"description": "Read and parse a JSON file",
"devDependencies": {
@@ -48,15 +47,15 @@
"xo": "*"
},
"engines": {
"node": ">=0.10.0"
"node": ">=4"
},
"files": [
"index.js"
],
"homepage": "https://github.com/sindresorhus/load-json-file#readme",
"keywords": [
"json",
"read",
"json",
"parse",
"file",
"fs",
@@ -72,10 +71,8 @@
"scripts": {
"test": "xo && ava"
},
"version": "1.1.0",
"version": "2.0.0",
"xo": {
"ignores": [
"test.js"
]
"esnext": true
}
}

View File

@@ -28,7 +28,7 @@ loadJsonFile('foo.json').then(json => {
### loadJsonFile(filepath)
Returns a promise that resolves to the parsed JSON.
Returns a promise for the parsed JSON.
### loadJsonFile.sync(filepath)
@@ -42,4 +42,4 @@ Returns the parsed JSON.
## License
MIT © [Sindre Sorhus](http://sindresorhus.com)
MIT © [Sindre Sorhus](https://sindresorhus.com)

View File

@@ -22,6 +22,7 @@
"fetchSpec": "1.1.0"
},
"_requiredBy": [
"/react-scripts/os-locale",
"/react-scripts/webpack/os-locale"
],
"_resolved": "https://registry.npmjs.org/mem/-/mem-1.1.0.tgz",

View File

@@ -25,6 +25,7 @@
"/react-scripts/ansi-align/is-fullwidth-code-point",
"/react-scripts/boxen/is-fullwidth-code-point",
"/react-scripts/is-finite",
"/react-scripts/is-fullwidth-code-point",
"/react-scripts/webpack-dev-server/is-fullwidth-code-point",
"/react-scripts/webpack/is-fullwidth-code-point",
"/react-scripts/widest-line/is-fullwidth-code-point",

View File

@@ -1,127 +1,101 @@
'use strict';
var childProcess = require('child_process');
var execFileSync = childProcess.execFileSync;
var lcid = require('lcid');
var defaultOpts = {spawn: true};
var cache;
const execa = require('execa');
const lcid = require('lcid');
const mem = require('mem');
function fallback() {
cache = 'en_US';
return cache;
}
const defaultOpts = {spawn: true};
const defaultLocale = 'en_US';
function getEnvLocale(env) {
env = env || process.env;
var ret = env.LC_ALL || env.LC_MESSAGES || env.LANG || env.LANGUAGE;
cache = getLocale(ret);
return ret;
return env.LC_ALL || env.LC_MESSAGES || env.LANG || env.LANGUAGE;
}
function parseLocale(x) {
var env = x.split('\n').reduce(function (env, def) {
const env = x.split('\n').reduce((env, def) => {
def = def.split('=');
env[def[0]] = def[1];
env[def[0]] = def[1].replace(/^"|"$/g, '');
return env;
}, {});
return getEnvLocale(env);
}
function getLocale(str) {
return (str && str.replace(/[.:].*/, '')) || fallback();
return (str && str.replace(/[.:].*/, ''));
}
module.exports = function (opts, cb) {
if (typeof opts === 'function') {
cb = opts;
opts = defaultOpts;
} else {
opts = opts || defaultOpts;
function getAppleLocale() {
return execa.stdout('defaults', ['read', '-g', 'AppleLocale']);
}
function getAppleLocaleSync() {
return execa.sync('defaults', ['read', '-g', 'AppleLocale']).stdout;
}
function getUnixLocale() {
if (process.platform === 'darwin') {
return getAppleLocale();
}
if (cache || getEnvLocale() || opts.spawn === false) {
setImmediate(cb, null, cache);
return;
return execa.stdout('locale')
.then(stdout => getLocale(parseLocale(stdout)));
}
function getUnixLocaleSync() {
if (process.platform === 'darwin') {
return getAppleLocaleSync();
}
var getAppleLocale = function () {
childProcess.execFile('defaults', ['read', '-g', 'AppleLocale'], function (err, stdout) {
if (err) {
fallback();
return;
}
return getLocale(parseLocale(execa.sync('locale').stdout));
}
cache = stdout.trim() || fallback();
cb(null, cache);
function getWinLocale() {
return execa.stdout('wmic', ['os', 'get', 'locale'])
.then(stdout => {
const lcidCode = parseInt(stdout.replace('Locale', ''), 16);
return lcid.from(lcidCode);
});
};
}
if (process.platform === 'win32') {
childProcess.execFile('wmic', ['os', 'get', 'locale'], function (err, stdout) {
if (err) {
fallback();
return;
}
function getWinLocaleSync() {
const stdout = execa.sync('wmic', ['os', 'get', 'locale']).stdout;
const lcidCode = parseInt(stdout.replace('Locale', ''), 16);
return lcid.from(lcidCode);
}
var lcidCode = parseInt(stdout.replace('Locale', ''), 16);
cache = lcid.from(lcidCode) || fallback();
cb(null, cache);
});
} else {
childProcess.execFile('locale', function (err, stdout) {
if (err) {
fallback();
return;
}
var res = parseLocale(stdout);
if (!res && process.platform === 'darwin') {
getAppleLocale();
return;
}
cache = getLocale(res);
cb(null, cache);
});
}
};
module.exports.sync = function (opts) {
module.exports = mem(opts => {
opts = opts || defaultOpts;
const envLocale = getEnvLocale();
let thenable;
if (cache || getEnvLocale() || !execFileSync || opts.spawn === false) {
return cache;
if (envLocale || opts.spawn === false) {
thenable = Promise.resolve(getLocale(envLocale));
} else if (process.platform === 'win32') {
thenable = getWinLocale();
} else {
thenable = getUnixLocale();
}
if (process.platform === 'win32') {
var stdout;
return thenable.then(locale => locale || defaultLocale)
.catch(() => defaultLocale);
});
module.exports.sync = mem(opts => {
opts = opts || defaultOpts;
const envLocale = getEnvLocale();
let res;
if (envLocale || opts.spawn === false) {
res = getLocale(envLocale);
} else {
try {
stdout = execFileSync('wmic', ['os', 'get', 'locale'], {encoding: 'utf8'});
} catch (err) {
return fallback();
}
var lcidCode = parseInt(stdout.replace('Locale', ''), 16);
cache = lcid.from(lcidCode) || fallback();
return cache;
if (process.platform === 'win32') {
res = getWinLocaleSync();
} else {
res = getUnixLocaleSync();
}
} catch (err) {}
}
var res;
try {
res = parseLocale(execFileSync('locale', {encoding: 'utf8'}));
} catch (err) {}
if (!res && process.platform === 'darwin') {
try {
cache = execFileSync('defaults', ['read', '-g', 'AppleLocale'], {encoding: 'utf8'}).trim() || fallback();
return cache;
} catch (err) {
return fallback();
}
}
cache = getLocale(res);
return cache;
};
return res || defaultLocale;
});

View File

@@ -1,32 +1,31 @@
{
"_args": [
[
"os-locale@1.4.0",
"os-locale@2.1.0",
"C:\\Users\\deranjer\\go\\src\\github.com\\deranjer\\goTorrent\\goTorrentWebUI"
]
],
"_from": "os-locale@1.4.0",
"_id": "os-locale@1.4.0",
"_from": "os-locale@2.1.0",
"_id": "os-locale@2.1.0",
"_inBundle": false,
"_integrity": "sha1-IPnxeuKe00XoveWDsT0gCYA8FNk=",
"_integrity": "sha512-3sslG3zJbEYcaC4YVAvDorjGxc7tv6KVATnLPZONiljsUncvihe9BQoVCEs0RZ1kmf4Hk9OBqlZfJZWI4GanKA==",
"_location": "/react-scripts/os-locale",
"_phantomChildren": {},
"_requested": {
"type": "version",
"registry": true,
"raw": "os-locale@1.4.0",
"raw": "os-locale@2.1.0",
"name": "os-locale",
"escapedName": "os-locale",
"rawSpec": "1.4.0",
"rawSpec": "2.1.0",
"saveSpec": null,
"fetchSpec": "1.4.0"
"fetchSpec": "2.1.0"
},
"_requiredBy": [
"/react-scripts/webpack-dev-server/yargs",
"/react-scripts/yargs"
],
"_resolved": "https://registry.npmjs.org/os-locale/-/os-locale-1.4.0.tgz",
"_spec": "1.4.0",
"_resolved": "https://registry.npmjs.org/os-locale/-/os-locale-2.1.0.tgz",
"_spec": "2.1.0",
"_where": "C:\\Users\\deranjer\\go\\src\\github.com\\deranjer\\goTorrent\\goTorrentWebUI",
"author": {
"name": "Sindre Sorhus",
@@ -37,16 +36,18 @@
"url": "https://github.com/sindresorhus/os-locale/issues"
},
"dependencies": {
"lcid": "^1.0.0"
"execa": "^0.7.0",
"lcid": "^1.0.0",
"mem": "^1.1.0"
},
"description": "Get the system locale",
"devDependencies": {
"ava": "*",
"require-uncached": "^1.0.2",
"import-fresh": "^2.0.0",
"xo": "*"
},
"engines": {
"node": ">=0.10.0"
"node": ">=4"
},
"files": [
"index.js"
@@ -75,5 +76,5 @@
"scripts": {
"test": "xo && ava"
},
"version": "1.4.0"
"version": "2.1.0"
}

View File

@@ -1,6 +1,6 @@
# os-locale [![Build Status](https://travis-ci.org/sindresorhus/os-locale.svg?branch=master)](https://travis-ci.org/sindresorhus/os-locale)
> Get the system [locale](http://en.wikipedia.org/wiki/Locale)
> Get the system [locale](https://en.wikipedia.org/wiki/Locale_(computer_software))
Useful for localizing your module or app.
@@ -17,9 +17,9 @@ $ npm install --save os-locale
## Usage
```js
var osLocale = require('os-locale');
const osLocale = require('os-locale');
osLocale(function (err, locale) {
osLocale().then(locale => {
console.log(locale);
//=> 'en_US'
});
@@ -28,15 +28,21 @@ osLocale(function (err, locale) {
## API
### osLocale([options], callback(error, locale))
### osLocale([options])
Returns a `Promise` for the locale.
### osLocale.sync([options])
Returns the locale.
#### options.spawn
#### options
Type: `boolean`
Type: `Object`
##### spawn
Type: `boolean`<br>
Default: `true`
Set to `false` to avoid spawning subprocesses and instead only resolve the locale from environment variables.
@@ -44,4 +50,4 @@ Set to `false` to avoid spawning subprocesses and instead only resolve the local
## License
MIT © [Sindre Sorhus](http://sindresorhus.com)
MIT © [Sindre Sorhus](https://sindresorhus.com)

View File

@@ -1,21 +1,18 @@
'use strict';
var fs = require('graceful-fs');
var Promise = require('pinkie-promise');
var pify = require('pify');
const fs = require('fs');
const pify = require('pify');
function type(fn, fn2, fp) {
if (typeof fp !== 'string') {
return Promise.reject(new TypeError('Expected a string'));
return Promise.reject(new TypeError(`Expected a string, got ${typeof fp}`));
}
return pify(fs[fn], Promise)(fp).then(function (stats) {
return stats[fn2]();
});
return pify(fs[fn])(fp).then(stats => stats[fn2]());
}
function typeSync(fn, fn2, fp) {
if (typeof fp !== 'string') {
throw new TypeError('Expected a string');
throw new TypeError(`Expected a string, got ${typeof fp}`);
}
return fs[fn](fp)[fn2]();

View File

@@ -1,31 +1,31 @@
{
"_args": [
[
"path-type@1.1.0",
"path-type@2.0.0",
"C:\\Users\\deranjer\\go\\src\\github.com\\deranjer\\goTorrent\\goTorrentWebUI"
]
],
"_from": "path-type@1.1.0",
"_id": "path-type@1.1.0",
"_from": "path-type@2.0.0",
"_id": "path-type@2.0.0",
"_inBundle": false,
"_integrity": "sha1-WcRPfuSR2nBNpBXaWkBwuk+P5EE=",
"_integrity": "sha1-8BLMuEFbcJb8LaoQVMPXI4lZTHM=",
"_location": "/react-scripts/path-type",
"_phantomChildren": {},
"_requested": {
"type": "version",
"registry": true,
"raw": "path-type@1.1.0",
"raw": "path-type@2.0.0",
"name": "path-type",
"escapedName": "path-type",
"rawSpec": "1.1.0",
"rawSpec": "2.0.0",
"saveSpec": null,
"fetchSpec": "1.1.0"
"fetchSpec": "2.0.0"
},
"_requiredBy": [
"/react-scripts/read-pkg"
],
"_resolved": "https://registry.npmjs.org/path-type/-/path-type-1.1.0.tgz",
"_spec": "1.1.0",
"_resolved": "https://registry.npmjs.org/path-type/-/path-type-2.0.0.tgz",
"_spec": "2.0.0",
"_where": "C:\\Users\\deranjer\\go\\src\\github.com\\deranjer\\goTorrent\\goTorrentWebUI",
"author": {
"name": "Sindre Sorhus",
@@ -36,9 +36,7 @@
"url": "https://github.com/sindresorhus/path-type/issues"
},
"dependencies": {
"graceful-fs": "^4.1.2",
"pify": "^2.0.0",
"pinkie-promise": "^2.0.0"
"pify": "^2.0.0"
},
"description": "Check if a path is a file, directory, or symlink",
"devDependencies": {
@@ -46,7 +44,7 @@
"xo": "*"
},
"engines": {
"node": ">=0.10.0"
"node": ">=4"
},
"files": [
"index.js"
@@ -78,10 +76,8 @@
"scripts": {
"test": "xo && ava"
},
"version": "1.1.0",
"version": "2.0.0",
"xo": {
"ignores": [
"test.js"
]
"esnext": true
}
}

View File

@@ -13,9 +13,9 @@ $ npm install --save path-type
## Usage
```js
var pathType = require('path-type');
const pathType = require('path-type');
pathType.file('package.json').then(function (isFile) {
pathType.file('package.json').then(isFile => {
console.log(isFile);
//=> true
})
@@ -28,15 +28,15 @@ pathType.file('package.json').then(function (isFile) {
### .dir(path)
### .symlink(path)
Returns a promise that resolves to a boolean of whether the path is the checked type.
Returns a `Promise` for a `boolean` of whether the path is the checked type.
### .fileSync(path)
### .dirSync(path)
### .symlinkSync(path)
Returns a boolean of whether the path is the checked type.
Returns a `boolean` of whether the path is the checked type.
## License
MIT © [Sindre Sorhus](http://sindresorhus.com)
MIT © [Sindre Sorhus](https://sindresorhus.com)

View File

@@ -27,10 +27,8 @@
"/react-scripts/eslint-module-utils/path-exists",
"/react-scripts/globby",
"/react-scripts/got",
"/react-scripts/load-json-file",
"/react-scripts/loader-fs-cache/find-up",
"/react-scripts/loader-fs-cache/path-exists",
"/react-scripts/path-type",
"/react-scripts/read-all-stream",
"/react-scripts/read-pkg-up/find-up",
"/react-scripts/read-pkg-up/path-exists",

View File

@@ -1,6 +1,23 @@
# Change Log
This project adheres to [Semantic Versioning](http://semver.org/).
## 6.0.19
* Fix TypeScript definitions for source maps (by Oleh Kuchuk).
* Fix `source` field in TypeScript definitions (by Sylvain Pollet-Villard).
## 6.0.18
* Use primitive object in TypeScript definitions (by Sylvain Pollet-Villard).
## 6.0.17
* Fix parsing comment in selector between word tokens (by Oleh Kuchuk).
## 6.0.16
* Fix warning text (by Michael Keller).
## 6.0.15
* Add warning about missed `from` option on `process().then()` call.
* Add IE 10 support.
## 6.0.14
* Fix TypeScript definitions (by Jed Mao).

View File

@@ -104,7 +104,7 @@ next = string.indexOf('"', currentPosition + 1);
// Jump by RegExp
regexp.lastIndex = currentPosion + 1;
regexp.text(string);
regexp.test(string);
next = regexp.lastIndex;
```

View File

@@ -0,0 +1,97 @@
'use strict';
const gulp = require('gulp');
gulp.task('clean', () => {
let del = require('del');
return del(['lib/*.js', 'postcss.js', 'build/', 'api/']);
});
// Build
gulp.task('compile', () => {
let sourcemaps = require('gulp-sourcemaps');
let changed = require('gulp-changed');
let babel = require('gulp-babel');
return gulp.src('lib/*.es6')
.pipe(changed('lib', { extension: '.js' }))
.pipe(sourcemaps.init())
.pipe(babel({
presets: [
[
'env',
{
targets: {
browsers: 'last 2 version',
node: 4
},
loose: true
}
]
],
plugins: ['add-module-exports', 'precompile-charcodes']
}))
.pipe(sourcemaps.write())
.pipe(gulp.dest('lib'));
});
gulp.task('build:lib', ['compile'], () => {
return gulp.src(['lib/*.js', 'lib/*.d.ts']).pipe(gulp.dest('build/lib'));
});
gulp.task('build:package', () => {
const editor = require('gulp-json-editor');
return gulp.src('./package.json')
.pipe(editor((json) => {
delete json.babel;
delete json.scripts;
delete json.jest;
delete json.eslintConfig;
delete json['size-limit'];
delete json['pre-commit'];
delete json['lint-staged'];
delete json.devDependencies;
return json;
}))
.pipe(gulp.dest('build'));
});
gulp.task('build:docs', () => {
let ignore = require('fs').readFileSync('.npmignore').toString()
.trim().split(/\n+/)
.concat([
'package.json', '.npmignore', 'lib/*', 'test/*',
'node_modules/**/*', 'docs/api.md', 'docs/plugins.md',
'docs/writing-a-plugin.md'
]).map( i => '!' + i );
return gulp.src(['**/*'].concat(ignore))
.pipe(gulp.dest('build'));
});
gulp.task('build', done => {
let runSequence = require('run-sequence');
runSequence('clean', ['build:lib', 'build:docs', 'build:package'], done);
});
// Tests
gulp.task('integration', ['build'], done => {
let postcss = require('./build');
let real = require('postcss-parser-tests/real');
real(done, css => {
return postcss.parse(css).toResult({ map: { annotation: false } });
});
});
gulp.task('version', ['build:lib'], () => {
let Processor = require('./lib/processor');
let instance = new Processor();
let pkg = require('./package');
if ( pkg.version !== instance.version ) {
throw new Error('Version in Processor is not equal to package.json');
}
});
// Common
gulp.task('default', ['version', 'integration']);

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -1,3 +1,5 @@
import * as mozilla from 'source-map';
/**
* @param plugins Can also be included with the Processor#use method.
* @returns A processor that will apply plugins as CSS processors.
@@ -139,7 +141,7 @@ declare namespace postcss {
* @param defaults Properties for the new Root node.
* @returns The new node.
*/
function root(defaults?: Object): Root;
function root(defaults?: object): Root;
interface SourceMapOptions {
/**
* Indicates that the source map should be embedded in the output CSS as a
@@ -399,21 +401,7 @@ declare namespace postcss {
* @param mapping
* @returns {}
*/
addMapping(mapping: {
generated: {
line: number;
column: number;
};
original: {
line: number;
column: number;
};
/**
* The original source file (relative to the sourceRoot).
*/
source: string;
name?: string;
}): void;
addMapping(mapping: mozilla.Mapping): void;
/**
* Set the source content for an original source file.
* @param sourceFile The URL of the original source file.
@@ -436,11 +424,15 @@ declare namespace postcss {
* If omitted, it is assumed that both SourceMaps are in the same directory;
* thus, not needing any rewriting (Supplying '.' has the same effect).
*/
applySourceMap(sourceMapConsumer: any, sourceFile?: string, sourceMapPath?: string): void;
applySourceMap(
sourceMapConsumer: mozilla.SourceMapConsumer,
sourceFile?: string,
sourceMapPath?: string
): void;
/**
* Renders the source map being generated to JSON.
*/
toJSON: () => any;
toJSON: () => mozilla.RawSourceMap;
/**
* Renders the source map being generated to a string.
*/
@@ -573,12 +565,15 @@ declare namespace postcss {
text: string;
file: string;
constructor(css: any, opts: any);
consumer(): any;
consumer(): mozilla.SourceMapConsumer;
withContent(): boolean;
startWith(string: any, start: any): boolean;
loadAnnotation(css: any): void;
decodeInline(text: any): any;
loadMap(file: any, prev: any): any;
startWith(string: string, start: string): boolean;
loadAnnotation(css: string): void;
decodeInline(text: string): string;
loadMap(
file: any,
prev: string | Function | mozilla.SourceMapConsumer | mozilla.SourceMapGenerator | mozilla.RawSourceMap
): string;
isMap(map: any): boolean;
}
/**
@@ -667,26 +662,26 @@ declare namespace postcss {
prev(): ChildNode | void;
/**
* Insert new node before current node to current nodes parent.
*
*
* Just an alias for `node.parent.insertBefore(node, newNode)`.
*
*
* @returns this node for method chaining.
*
*
* @example
* decl.before('content: ""');
*/
before(newNode: Node | object | string | Node[]): this;
before(newNode: Node | object | string | Node[]): this;
/**
* Insert new node after current node to current nodes parent.
*
*
* Just an alias for `node.parent.insertAfter(node, newNode)`.
*
*
* @returns this node for method chaining.
*
*
* @example
* decl.after('color: black');
*/
after(newNode: Node | object | string | Node[]): this;
after(newNode: Node | object | string | Node[]): this;
/**
* @returns The Root instance of the node's tree.
*/
@@ -701,27 +696,27 @@ declare namespace postcss {
* Inserts node(s) before the current node and removes the current node.
* @returns This node for chaining.
*/
replaceWith(...nodes: (Node | Object)[]): this;
replaceWith(...nodes: (Node | object)[]): this;
/**
* @param overrides New properties to override in the clone.
* @returns A clone of this node. The node and its (cloned) children will
* have a clean parent and code style properties.
*/
clone(overrides?: Object): this;
clone(overrides?: object): this;
/**
* Shortcut to clone the node and insert the resulting cloned node before
* the current node.
* @param overrides New Properties to override in the clone.
* @returns The cloned node.
*/
cloneBefore(overrides?: Object): this;
cloneBefore(overrides?: object): this;
/**
* Shortcut to clone the node and insert the resulting cloned node after
* the current node.
* @param overrides New Properties to override in the clone.
* @returns The cloned node.
*/
cloneAfter(overrides?: Object): this;
cloneAfter(overrides?: object): this;
/**
* @param prop Name or code style property.
* @param defaultType Name of default value. It can be easily missed if the
@@ -734,6 +729,7 @@ declare namespace postcss {
raw(prop: string, defaultType?: string): any;
}
interface NodeNewProps {
source?: NodeSource;
raws?: NodeRaws;
}
interface NodeRaws {
@@ -855,7 +851,7 @@ declare namespace postcss {
* @returns A clone of this node. The node and its (cloned) children will
* have a clean parent and code style properties.
*/
clone(overrides?: Object): this;
clone(overrides?: object): this;
/**
* @param child Child of the current container.
* @returns The child's index within the container's "nodes" array.
@@ -990,7 +986,7 @@ declare namespace postcss {
* @param nodes New nodes.
* @returns This container for chaining.
*/
prepend(...nodes: (Node | Object | string)[]): this;
prepend(...nodes: (Node | object | string)[]): this;
/**
* Inserts new nodes to the end of the container.
* Because each node class is identifiable by unique properties, use the
@@ -1006,19 +1002,19 @@ declare namespace postcss {
* @param nodes New nodes.
* @returns This container for chaining.
*/
append(...nodes: (Node | Object | string)[]): this;
append(...nodes: (Node | object | string)[]): this;
/**
* Insert newNode before oldNode within the container.
* @param oldNode Child or child's index.
* @returns This container for chaining.
*/
insertBefore(oldNode: ChildNode | number, newNode: ChildNode | Object | string): this;
insertBefore(oldNode: ChildNode | number, newNode: ChildNode | object | string): this;
/**
* Insert newNode after oldNode within the container.
* @param oldNode Child or child's index.
* @returns This container for chaining.
*/
insertAfter(oldNode: ChildNode | number, newNode: ChildNode | Object | string): this;
insertAfter(oldNode: ChildNode | number, newNode: ChildNode | object | string): this;
/**
* Removes the container from its parent and cleans the parent property in the
* container and its children.
@@ -1077,7 +1073,7 @@ declare namespace postcss {
* @returns A clone of this node. The node and its (cloned) children will
* have a clean parent and code style properties.
*/
clone(overrides?: Object): this;
clone(overrides?: object): this;
/**
* @returns A Result instance representing the root's CSS.
*/
@@ -1125,7 +1121,7 @@ declare namespace postcss {
* @returns A clone of this node. The node and its (cloned) children will
* have a clean parent and code style properties.
*/
clone(overrides?: Object): this;
clone(overrides?: object): this;
}
interface AtRuleNewProps extends ContainerNewProps {
/**
@@ -1177,7 +1173,7 @@ declare namespace postcss {
* @returns A clone of this node. The node and its (cloned) children will
* have a clean parent and code style properties.
*/
clone(overrides?: Object): this;
clone(overrides?: object): this;
}
interface RuleNewProps extends ContainerNewProps {
/**
@@ -1240,7 +1236,7 @@ declare namespace postcss {
* @returns A clone of this node. The node and its (cloned) children will
* have a clean parent and code style properties.
*/
clone(overrides?: Object): this;
clone(overrides?: object): this;
}
interface DeclarationNewProps {
/**
@@ -1291,7 +1287,7 @@ declare namespace postcss {
* @returns A clone of this node. The node and its (cloned) children will
* have a clean parent and code style properties.
*/
clone(overrides?: Object): this;
clone(overrides?: object): this;
}
interface CommentNewProps {
/**

File diff suppressed because one or more lines are too long

View File

@@ -1,7 +1,7 @@
'use strict';
const escapeStringRegexp = require('escape-string-regexp');
const ansiStyles = require('ansi-styles');
const supportsColor = require('supports-color');
const stdoutColor = require('supports-color').stdout;
const template = require('./templates.js');
@@ -19,7 +19,7 @@ function applyOptions(obj, options) {
options = options || {};
// Detect level if not set manually
const scLevel = supportsColor ? supportsColor.level : 0;
const scLevel = stdoutColor ? stdoutColor.level : 0;
obj.level = options.level === undefined ? scLevel : options.level;
obj.enabled = 'enabled' in options ? options.enabled : obj.level > 0;
}
@@ -224,5 +224,5 @@ function chalkTag(chalk, strings) {
Object.defineProperties(Chalk.prototype, styles);
module.exports = Chalk(); // eslint-disable-line new-cap
module.exports.supportsColor = supportsColor;
module.exports.supportsColor = stdoutColor;
module.exports.default = module.exports; // For TypeScript

View File

@@ -1,45 +1,45 @@
{
"_args": [
[
"chalk@2.3.0",
"chalk@2.3.2",
"C:\\Users\\deranjer\\go\\src\\github.com\\deranjer\\goTorrent\\goTorrentWebUI"
]
],
"_from": "chalk@2.3.0",
"_id": "chalk@2.3.0",
"_from": "chalk@2.3.2",
"_id": "chalk@2.3.2",
"_inBundle": false,
"_integrity": "sha512-Az5zJR2CBujap2rqXGaJKaPHyJ0IrUimvYNX+ncCy8PJP4ltOGTrHUIo097ZaL2zMeKYpiCdqDvS6zdrTFok3Q==",
"_integrity": "sha512-ZM4j2/ld/YZDc3Ma8PgN7gyAk+kHMMMyzLNryCPGhWrsfAuDVeuid5bpRFTDgMH9JBK2lA4dyyAkkZYF/WcqDQ==",
"_location": "/react-scripts/postcss/chalk",
"_phantomChildren": {},
"_requested": {
"type": "version",
"registry": true,
"raw": "chalk@2.3.0",
"raw": "chalk@2.3.2",
"name": "chalk",
"escapedName": "chalk",
"rawSpec": "2.3.0",
"rawSpec": "2.3.2",
"saveSpec": null,
"fetchSpec": "2.3.0"
"fetchSpec": "2.3.2"
},
"_requiredBy": [
"/react-scripts/postcss"
],
"_resolved": "https://registry.npmjs.org/chalk/-/chalk-2.3.0.tgz",
"_spec": "2.3.0",
"_resolved": "https://registry.npmjs.org/chalk/-/chalk-2.3.2.tgz",
"_spec": "2.3.2",
"_where": "C:\\Users\\deranjer\\go\\src\\github.com\\deranjer\\goTorrent\\goTorrentWebUI",
"bugs": {
"url": "https://github.com/chalk/chalk/issues"
},
"dependencies": {
"ansi-styles": "^3.1.0",
"ansi-styles": "^3.2.1",
"escape-string-regexp": "^1.0.5",
"supports-color": "^4.0.0"
"supports-color": "^5.3.0"
},
"description": "Terminal string styling done right",
"devDependencies": {
"ava": "*",
"coveralls": "^3.0.0",
"execa": "^0.8.0",
"execa": "^0.9.0",
"import-fresh": "^2.0.0",
"matcha": "^0.7.0",
"nyc": "^11.0.2",
@@ -91,7 +91,7 @@
"test": "xo && tsc --project types && nyc ava"
},
"types": "types/index.d.ts",
"version": "2.3.0",
"version": "2.3.2",
"xo": {
"envs": [
"node",

View File

@@ -9,11 +9,11 @@
> Terminal string styling done right
[![Build Status](https://travis-ci.org/chalk/chalk.svg?branch=master)](https://travis-ci.org/chalk/chalk) [![Coverage Status](https://coveralls.io/repos/github/chalk/chalk/badge.svg?branch=master)](https://coveralls.io/github/chalk/chalk?branch=master) [![](https://img.shields.io/badge/unicorn-approved-ff69b4.svg)](https://www.youtube.com/watch?v=9auOCbH5Ns4) [![XO code style](https://img.shields.io/badge/code_style-XO-5ed9c7.svg)](https://github.com/sindresorhus/xo) [![Mentioned in Awesome Node.js](https://awesome.re/mentioned-badge.svg)](https://github.com/sindresorhus/awesome-nodejs)
[![Build Status](https://travis-ci.org/chalk/chalk.svg?branch=master)](https://travis-ci.org/chalk/chalk) [![Coverage Status](https://coveralls.io/repos/github/chalk/chalk/badge.svg?branch=master)](https://coveralls.io/github/chalk/chalk?branch=master) [![](https://img.shields.io/badge/unicorn-approved-ff69b4.svg)](https://www.youtube.com/watch?v=9auOCbH5Ns4) [![XO code style](https://img.shields.io/badge/code_style-XO-5ed9c7.svg)](https://github.com/xojs/xo) [![Mentioned in Awesome Node.js](https://awesome.re/mentioned-badge.svg)](https://github.com/sindresorhus/awesome-nodejs)
### [See what's new in Chalk 2](https://github.com/chalk/chalk/releases/tag/v2.0.0)
![](https://github.com/chalk/ansi-styles/raw/master/screenshot.png)
<img src="https://cdn.rawgit.com/chalk/ansi-styles/8261697c95bf34b6c7767e2cbe9941a851d59385/screenshot.svg" alt="" width="900">
## Highlights
@@ -26,7 +26,7 @@
- Doesn't extend `String.prototype`
- Clean and focused
- Actively maintained
- [Used by ~17,000 packages](https://www.npmjs.com/browse/depended/chalk) as of June 20th, 2017
- [Used by ~23,000 packages](https://www.npmjs.com/browse/depended/chalk) as of December 31, 2017
## Install
@@ -51,7 +51,7 @@ const chalk = require('chalk');
const log = console.log;
// Combine styled and normal strings
log(chalk.blue('Hello') + 'World' + chalk.red('!'));
log(chalk.blue('Hello') + ' World' + chalk.red('!'));
// Compose multiple styles using the chainable API
log(chalk.blue.bgRed.bold('Hello world!'));
@@ -124,7 +124,7 @@ Multiple arguments will be separated by space.
Color support is automatically detected, as is the level (see `chalk.level`). However, if you'd like to simply enable/disable Chalk, you can do so via the `.enabled` property.
Chalk is enabled by default unless expicitly disabled via the constructor or `chalk.level` is `0`.
Chalk is enabled by default unless explicitly disabled via the constructor or `chalk.level` is `0`.
If you need to change this in a reusable module, create a new instance:
@@ -265,8 +265,8 @@ The following color models can be used:
- [`hex`](https://en.wikipedia.org/wiki/Web_colors#Hex_triplet) - Example: `chalk.hex('#FF8800').bold('Orange!')`
- [`keyword`](https://www.w3.org/wiki/CSS/Properties/color/keywords) (CSS keywords) - Example: `chalk.keyword('orange').bold('Orange!')`
- [`hsl`](https://en.wikipedia.org/wiki/HSL_and_HSV) - Example: `chalk.hsl(32, 100, 50).bold('Orange!')`
- [`hsv`](https://en.wikipedia.org/wiki/HSL_and_HSV) - Example: `chalk.hsl(32, 1, 1).bold('Orange!')`
- [`hwb`](https://en.wikipedia.org/wiki/HWB_color_model) - Example: `chalk.hsl(32, 0, 50).bold('Orange!')`
- [`hsv`](https://en.wikipedia.org/wiki/HSL_and_HSV) - Example: `chalk.hsv(32, 100, 100).bold('Orange!')`
- [`hwb`](https://en.wikipedia.org/wiki/HWB_color_model) - Example: `chalk.hwb(32, 0, 50).bold('Orange!')`
- `ansi16`
- `ansi256`

View File

@@ -1,29 +1,29 @@
{
"_args": [
[
"postcss@6.0.14",
"postcss@6.0.19",
"C:\\Users\\deranjer\\go\\src\\github.com\\deranjer\\goTorrent\\goTorrentWebUI"
]
],
"_from": "postcss@6.0.14",
"_id": "postcss@6.0.14",
"_from": "postcss@6.0.19",
"_id": "postcss@6.0.19",
"_inBundle": false,
"_integrity": "sha512-NJ1z0f+1offCgadPhz+DvGm5Mkci+mmV5BqD13S992o0Xk9eElxUfPPF+t2ksH5R/17gz4xVK8KWocUQ5o3Rog==",
"_integrity": "sha512-f13HRz0HtVwVaEuW6J6cOUCBLFtymhgyLPV7t4QEk2UD3twRI9IluDcQNdzQdBpiixkXj2OmzejhhTbSbDxNTg==",
"_location": "/react-scripts/postcss",
"_phantomChildren": {
"ansi-styles": "3.2.0",
"ansi-styles": "3.2.1",
"escape-string-regexp": "1.0.5",
"supports-color": "4.5.0"
"supports-color": "5.3.0"
},
"_requested": {
"type": "version",
"registry": true,
"raw": "postcss@6.0.14",
"raw": "postcss@6.0.19",
"name": "postcss",
"escapedName": "postcss",
"rawSpec": "6.0.14",
"rawSpec": "6.0.19",
"saveSpec": null,
"fetchSpec": "6.0.14"
"fetchSpec": "6.0.19"
},
"_requiredBy": [
"/react-scripts/autoprefixer",
@@ -35,8 +35,8 @@
"/react-scripts/postcss-modules-scope",
"/react-scripts/postcss-modules-values"
],
"_resolved": "https://registry.npmjs.org/postcss/-/postcss-6.0.14.tgz",
"_spec": "6.0.14",
"_resolved": "https://registry.npmjs.org/postcss/-/postcss-6.0.19.tgz",
"_spec": "6.0.19",
"_where": "C:\\Users\\deranjer\\go\\src\\github.com\\deranjer\\goTorrent\\goTorrentWebUI",
"author": {
"name": "Andrey Sitnik",
@@ -51,63 +51,15 @@
"url": "https://github.com/postcss/postcss/issues"
},
"dependencies": {
"chalk": "^2.3.0",
"chalk": "^2.3.1",
"source-map": "^0.6.1",
"supports-color": "^4.4.0"
"supports-color": "^5.2.0"
},
"description": "Tool for transforming styles with JS plugins",
"devDependencies": {
"babel-core": "^6.26.0",
"babel-eslint": "^8.0.1",
"babel-plugin-add-module-exports": "^0.2.1",
"babel-plugin-precompile-charcodes": "^1.1.0",
"babel-preset-env": "^1.6.1",
"concat-with-sourcemaps": "^1.0.4",
"del": "^3.0.0",
"docdash": "^0.4.0",
"eslint": "^4.10.0",
"eslint-config-postcss": "^2.0.2",
"fs-extra": "^4.0.2",
"gulp": "^3.9.1",
"gulp-babel": "^7.0.0",
"gulp-changed": "^3.1.1",
"gulp-eslint": "^4.0.0",
"gulp-jest": "^2.0.0",
"gulp-run": "^1.7.1",
"gulp-sourcemaps": "^2.6.1",
"jest": "^21.2.1",
"jsdoc": "^3.5.5",
"lint-staged": "^4.3.0",
"postcss-parser-tests": "^6.1.0",
"pre-commit": "^1.2.2",
"run-sequence": "^2.2.0",
"size-limit": "^0.12.1",
"strip-ansi": "^4.0.0",
"yaspeller-ci": "^0.7.0"
},
"engines": {
"node": ">=4.0.0"
},
"eslintConfig": {
"parser": "babel-eslint",
"extends": "eslint-config-postcss",
"rules": {
"consistent-return": "off",
"valid-jsdoc": "error",
"complexity": "off",
"no-new": "off"
},
"env": {
"browser": true,
"jest": true
}
},
"homepage": "http://postcss.org/",
"jest": {
"modulePathIgnorePatterns": [
"build"
]
},
"keywords": [
"css",
"postcss",
@@ -120,30 +72,12 @@
"transpiler"
],
"license": "MIT",
"lint-staged": {
"test/*.js": "eslint",
"lib/*.es6": "eslint",
"*.md": "yaspeller-ci"
},
"main": "lib/postcss",
"name": "postcss",
"pre-commit": [
"lint-staged"
],
"repository": {
"type": "git",
"url": "git+https://github.com/postcss/postcss.git"
},
"scripts": {
"lint-staged": "lint-staged",
"test": "gulp"
},
"size-limit": [
{
"path": "lib/postcss.js",
"limit": "29 KB"
}
],
"types": "lib/postcss.d.ts",
"version": "6.0.14"
"version": "6.0.19"
}

View File

@@ -21,9 +21,7 @@
"saveSpec": null,
"fetchSpec": "4.2.1"
},
"_requiredBy": [
"/react-scripts"
],
"_requiredBy": [],
"_resolved": "https://registry.npmjs.org/react-dev-utils/-/react-dev-utils-4.2.1.tgz",
"_spec": "4.2.1",
"_where": "C:\\Users\\deranjer\\go\\src\\github.com\\deranjer\\goTorrent\\goTorrentWebUI",

View File

@@ -1,24 +1,19 @@
'use strict';
var findUp = require('find-up');
var readPkg = require('read-pkg');
const findUp = require('find-up');
const readPkg = require('read-pkg');
module.exports = function (opts) {
return findUp('package.json', opts).then(function (fp) {
module.exports = opts => {
return findUp('package.json', opts).then(fp => {
if (!fp) {
return {};
}
return readPkg(fp, opts).then(function (pkg) {
return {
pkg: pkg,
path: fp
};
});
return readPkg(fp, opts).then(pkg => ({pkg, path: fp}));
});
};
module.exports.sync = function (opts) {
var fp = findUp.sync('package.json', opts);
module.exports.sync = opts => {
const fp = findUp.sync('package.json', opts);
if (!fp) {
return {};

View File

@@ -21,9 +21,7 @@
"saveSpec": null,
"fetchSpec": "1.1.2"
},
"_requiredBy": [
"/react-scripts/read-pkg-up"
],
"_requiredBy": [],
"_resolved": "https://registry.npmjs.org/find-up/-/find-up-1.1.2.tgz",
"_spec": "1.1.2",
"_where": "C:\\Users\\deranjer\\go\\src\\github.com\\deranjer\\goTorrent\\goTorrentWebUI",

View File

@@ -1,14 +1,14 @@
{
"_args": [
[
"read-pkg-up@1.0.1",
"read-pkg-up@2.0.0",
"C:\\Users\\deranjer\\go\\src\\github.com\\deranjer\\goTorrent\\goTorrentWebUI"
]
],
"_from": "read-pkg-up@1.0.1",
"_id": "read-pkg-up@1.0.1",
"_from": "read-pkg-up@2.0.0",
"_id": "read-pkg-up@2.0.0",
"_inBundle": false,
"_integrity": "sha1-nWPBMnbAZZGNV/ACpX9AobZD+wI=",
"_integrity": "sha1-a3KoBImE4MQeeVEP1en6mbO1Sb4=",
"_location": "/react-scripts/read-pkg-up",
"_phantomChildren": {
"pinkie-promise": "2.0.1"
@@ -16,21 +16,18 @@
"_requested": {
"type": "version",
"registry": true,
"raw": "read-pkg-up@1.0.1",
"raw": "read-pkg-up@2.0.0",
"name": "read-pkg-up",
"escapedName": "read-pkg-up",
"rawSpec": "1.0.1",
"rawSpec": "2.0.0",
"saveSpec": null,
"fetchSpec": "1.0.1"
"fetchSpec": "2.0.0"
},
"_requiredBy": [
"/react-scripts/meow",
"/react-scripts/test-exclude",
"/react-scripts/webpack-dev-server/yargs",
"/react-scripts/yargs"
],
"_resolved": "https://registry.npmjs.org/read-pkg-up/-/read-pkg-up-1.0.1.tgz",
"_spec": "1.0.1",
"_resolved": "https://registry.npmjs.org/read-pkg-up/-/read-pkg-up-2.0.0.tgz",
"_spec": "2.0.0",
"_where": "C:\\Users\\deranjer\\go\\src\\github.com\\deranjer\\goTorrent\\goTorrentWebUI",
"author": {
"name": "Sindre Sorhus",
@@ -41,8 +38,8 @@
"url": "https://github.com/sindresorhus/read-pkg-up/issues"
},
"dependencies": {
"find-up": "^1.0.0",
"read-pkg": "^1.0.0"
"find-up": "^2.0.0",
"read-pkg": "^2.0.0"
},
"description": "Read the closest package.json file",
"devDependencies": {
@@ -50,7 +47,7 @@
"xo": "*"
},
"engines": {
"node": ">=0.10.0"
"node": ">=4"
},
"files": [
"index.js"
@@ -95,5 +92,8 @@
"scripts": {
"test": "xo && ava"
},
"version": "1.0.1"
"version": "2.0.0",
"xo": {
"esnext": true
}
}

View File

@@ -22,9 +22,9 @@ $ npm install --save read-pkg-up
## Usage
```js
var readPkgUp = require('read-pkg-up');
const readPkgUp = require('read-pkg-up');
readPkgUp().then(function (result) {
readPkgUp().then(result => {
console.log(result);
/*
{
@@ -33,7 +33,7 @@ readPkgUp().then(function (result) {
version: '1.0.0',
...
},
path: '/Users/sindresorhus/dev/awesome-package'
path: '/Users/sindresorhus/dev/awesome-package/package.json'
}
*/
});
@@ -44,24 +44,24 @@ readPkgUp().then(function (result) {
### readPkgUp([options])
Returns a promise that resolves to a result object.
Returns a `Promise` for the result object.
### readPkgUp.sync([options])
Returns a result object.
Returns the result object.
#### options
##### cwd
Type: `string`
Type: `string`<br>
Default: `.`
Directory to start looking for a package.json file.
##### normalize
Type: `boolean`
Type: `boolean`<br>
Default: `true`
[Normalize](https://github.com/npm/normalize-package-data#what-normalization-currently-entails) the package data.
@@ -70,10 +70,11 @@ Default: `true`
## Related
- [read-pkg](https://github.com/sindresorhus/read-pkg) - Read a package.json file
- [pkg-up](https://github.com/sindresorhus/pkg-up) - Find the closest package.json file
- [find-up](https://github.com/sindresorhus/find-up) - Find a file by walking up parent directories
- [pkg-conf](https://github.com/sindresorhus/pkg-conf) - Get namespaced config from the closest package.json
## License
MIT © [Sindre Sorhus](http://sindresorhus.com)
MIT © [Sindre Sorhus](https://sindresorhus.com)

View File

@@ -1,10 +1,9 @@
'use strict';
var path = require('path');
var loadJsonFile = require('load-json-file');
var normalizePackageData = require('normalize-package-data');
var pathType = require('path-type');
const path = require('path');
const loadJsonFile = require('load-json-file');
const pathType = require('path-type');
module.exports = function (fp, opts) {
module.exports = (fp, opts) => {
if (typeof fp !== 'string') {
opts = fp;
fp = '.';
@@ -13,23 +12,23 @@ module.exports = function (fp, opts) {
opts = opts || {};
return pathType.dir(fp)
.then(function (isDir) {
.then(isDir => {
if (isDir) {
fp = path.join(fp, 'package.json');
}
return loadJsonFile(fp);
})
.then(function (x) {
.then(x => {
if (opts.normalize !== false) {
normalizePackageData(x);
require('normalize-package-data')(x);
}
return x;
});
};
module.exports.sync = function (fp, opts) {
module.exports.sync = (fp, opts) => {
if (typeof fp !== 'string') {
opts = fp;
fp = '.';
@@ -38,10 +37,10 @@ module.exports.sync = function (fp, opts) {
opts = opts || {};
fp = pathType.dirSync(fp) ? path.join(fp, 'package.json') : fp;
var x = loadJsonFile.sync(fp);
const x = loadJsonFile.sync(fp);
if (opts.normalize !== false) {
normalizePackageData(x);
require('normalize-package-data')(x);
}
return x;

View File

@@ -1,31 +1,31 @@
{
"_args": [
[
"read-pkg@1.1.0",
"read-pkg@2.0.0",
"C:\\Users\\deranjer\\go\\src\\github.com\\deranjer\\goTorrent\\goTorrentWebUI"
]
],
"_from": "read-pkg@1.1.0",
"_id": "read-pkg@1.1.0",
"_from": "read-pkg@2.0.0",
"_id": "read-pkg@2.0.0",
"_inBundle": false,
"_integrity": "sha1-9f+qXs0pyzHAR0vKfXVra7KePyg=",
"_integrity": "sha1-jvHAYjxqbbDcZxPEv6xGMysjaPg=",
"_location": "/react-scripts/read-pkg",
"_phantomChildren": {},
"_requested": {
"type": "version",
"registry": true,
"raw": "read-pkg@1.1.0",
"raw": "read-pkg@2.0.0",
"name": "read-pkg",
"escapedName": "read-pkg",
"rawSpec": "1.1.0",
"rawSpec": "2.0.0",
"saveSpec": null,
"fetchSpec": "1.1.0"
"fetchSpec": "2.0.0"
},
"_requiredBy": [
"/react-scripts/read-pkg-up"
],
"_resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-1.1.0.tgz",
"_spec": "1.1.0",
"_resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-2.0.0.tgz",
"_spec": "2.0.0",
"_where": "C:\\Users\\deranjer\\go\\src\\github.com\\deranjer\\goTorrent\\goTorrentWebUI",
"author": {
"name": "Sindre Sorhus",
@@ -36,9 +36,9 @@
"url": "https://github.com/sindresorhus/read-pkg/issues"
},
"dependencies": {
"load-json-file": "^1.0.0",
"load-json-file": "^2.0.0",
"normalize-package-data": "^2.3.2",
"path-type": "^1.0.0"
"path-type": "^2.0.0"
},
"description": "Read a package.json file",
"devDependencies": {
@@ -46,7 +46,7 @@
"xo": "*"
},
"engines": {
"node": ">=0.10.0"
"node": ">=4"
},
"files": [
"index.js"
@@ -73,5 +73,8 @@
"scripts": {
"test": "xo && ava"
},
"version": "1.1.0"
"version": "2.0.0",
"xo": {
"esnext": true
}
}

View File

@@ -21,19 +21,19 @@ $ npm install --save read-pkg
## Usage
```js
var readPkg = require('read-pkg');
const readPkg = require('read-pkg');
readPkg().then(function (pkg) {
readPkg().then(pkg => {
console.log(pkg);
//=> {name: 'read-pkg', ...}
});
readPkg(__dirname).then(function (pkg) {
readPkg(__dirname).then(pkg => {
console.log(pkg);
//=> {name: 'read-pkg', ...}
});
readPkg(path.join('unicorn', 'package.json')).then(function (pkg) {
readPkg(path.join('unicorn', 'package.json')).then(pkg => {
console.log(pkg);
//=> {name: 'read-pkg', ...}
});
@@ -44,7 +44,7 @@ readPkg(path.join('unicorn', 'package.json')).then(function (pkg) {
### readPkg([path], [options])
Returns a promise that resolves to the parsed JSON.
Returns a `Promise` for the parsed JSON.
### readPkg.sync([path], [options])
@@ -52,7 +52,7 @@ Returns the parsed JSON.
#### path
Type: `string`
Type: `string`<br>
Default: `.`
Path to a `package.json` file or its directory.
@@ -61,7 +61,7 @@ Path to a `package.json` file or its directory.
##### normalize
Type: `boolean`
Type: `boolean`<br>
Default: `true`
[Normalize](https://github.com/npm/normalize-package-data#what-normalization-currently-entails) the package data.
@@ -76,4 +76,4 @@ Default: `true`
## License
MIT © [Sindre Sorhus](http://sindresorhus.com)
MIT © [Sindre Sorhus](https://sindresorhus.com)

View File

@@ -21,9 +21,7 @@
"saveSpec": null,
"fetchSpec": "0.1.3"
},
"_requiredBy": [
"/react-scripts/cliui"
],
"_requiredBy": [],
"_resolved": "https://registry.npmjs.org/right-align/-/right-align-0.1.3.tgz",
"_spec": "0.1.3",
"_where": "C:\\Users\\deranjer\\go\\src\\github.com\\deranjer\\goTorrent\\goTorrentWebUI",

View File

@@ -25,6 +25,8 @@
"/react-scripts/ansi-align/string-width",
"/react-scripts/boxen/string-width",
"/react-scripts/chalk",
"/react-scripts/cliui",
"/react-scripts/cliui/string-width",
"/react-scripts/react-dev-utils",
"/react-scripts/renderkid",
"/react-scripts/string-length",

View File

@@ -1,16 +1,13 @@
'use strict';
var isUtf8 = require('is-utf8');
module.exports = function (x) {
// Catches EFBBBF (UTF-8 BOM) because the buffer-to-string
// conversion translates it to FEFF (UTF-16 BOM)
if (typeof x === 'string' && x.charCodeAt(0) === 0xFEFF) {
return x.slice(1);
module.exports = x => {
if (typeof x !== 'string') {
throw new TypeError('Expected a string, got ' + typeof x);
}
if (Buffer.isBuffer(x) && isUtf8(x) &&
x[0] === 0xEF && x[1] === 0xBB && x[2] === 0xBF) {
return x.slice(3);
// Catches EFBBBF (UTF-8 BOM) because the buffer-to-string
// conversion translates it to FEFF (UTF-16 BOM)
if (x.charCodeAt(0) === 0xFEFF) {
return x.slice(1);
}
return x;

View File

@@ -1,32 +1,31 @@
{
"_args": [
[
"strip-bom@2.0.0",
"strip-bom@3.0.0",
"C:\\Users\\deranjer\\go\\src\\github.com\\deranjer\\goTorrent\\goTorrentWebUI"
]
],
"_from": "strip-bom@2.0.0",
"_id": "strip-bom@2.0.0",
"_from": "strip-bom@3.0.0",
"_id": "strip-bom@3.0.0",
"_inBundle": false,
"_integrity": "sha1-YhmoVhZSBJHzV4i9vxRHqZx+aw4=",
"_integrity": "sha1-IzTBjpx1n3vdVv3vfprj1YjmjtM=",
"_location": "/react-scripts/strip-bom",
"_phantomChildren": {},
"_requested": {
"type": "version",
"registry": true,
"raw": "strip-bom@2.0.0",
"raw": "strip-bom@3.0.0",
"name": "strip-bom",
"escapedName": "strip-bom",
"rawSpec": "2.0.0",
"rawSpec": "3.0.0",
"saveSpec": null,
"fetchSpec": "2.0.0"
"fetchSpec": "3.0.0"
},
"_requiredBy": [
"/react-scripts/default-require-extensions",
"/react-scripts/load-json-file"
],
"_resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-2.0.0.tgz",
"_spec": "2.0.0",
"_resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz",
"_spec": "3.0.0",
"_where": "C:\\Users\\deranjer\\go\\src\\github.com\\deranjer\\goTorrent\\goTorrentWebUI",
"author": {
"name": "Sindre Sorhus",
@@ -36,24 +35,23 @@
"bugs": {
"url": "https://github.com/sindresorhus/strip-bom/issues"
},
"dependencies": {
"is-utf8": "^0.2.0"
},
"description": "Strip UTF-8 byte order mark (BOM) from a string/buffer",
"description": "Strip UTF-8 byte order mark (BOM) from a string",
"devDependencies": {
"mocha": "*"
"ava": "*",
"xo": "*"
},
"engines": {
"node": ">=0.10.0"
"node": ">=4"
},
"files": [
"index.js"
],
"homepage": "https://github.com/sindresorhus/strip-bom#readme",
"keywords": [
"bom",
"strip",
"bom",
"byte",
"order",
"mark",
"unicode",
"utf8",
@@ -62,7 +60,6 @@
"delete",
"trim",
"text",
"buffer",
"string"
],
"license": "MIT",
@@ -72,7 +69,7 @@
"url": "git+https://github.com/sindresorhus/strip-bom.git"
},
"scripts": {
"test": "mocha"
"test": "xo && ava"
},
"version": "2.0.0"
"version": "3.0.0"
}

View File

@@ -1,6 +1,6 @@
# strip-bom [![Build Status](https://travis-ci.org/sindresorhus/strip-bom.svg?branch=master)](https://travis-ci.org/sindresorhus/strip-bom)
> Strip UTF-8 [byte order mark](http://en.wikipedia.org/wiki/Byte_order_mark#UTF-8) (BOM) from a string/buffer
> Strip UTF-8 [byte order mark](http://en.wikipedia.org/wiki/Byte_order_mark#UTF-8) (BOM) from a string
From Wikipedia:
@@ -17,23 +17,20 @@ $ npm install --save strip-bom
## Usage
```js
var fs = require('fs');
var stripBom = require('strip-bom');
const stripBom = require('strip-bom');
stripBom('\uFEFFunicorn');
//=> 'unicorn'
stripBom(fs.readFileSync('unicorn.txt'));
//=> 'unicorn'
```
## Related
- [strip-bom-cli](https://github.com/sindresorhus/strip-bom-cli) - CLI for this module
- [strip-bom-buf](https://github.com/sindresorhus/strip-bom-buf) - Buffer version of this module
- [strip-bom-stream](https://github.com/sindresorhus/strip-bom-stream) - Stream version of this module
## License
MIT © [Sindre Sorhus](http://sindresorhus.com)
MIT © [Sindre Sorhus](https://sindresorhus.com)

View File

@@ -1,2 +1,5 @@
'use strict';
module.exports = false;
module.exports = {
stdout: false,
stderr: false
};

Some files were not shown because too many files have changed in this diff Show More