new license file version [CI SKIP]
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
var baseSet = require('./_baseSet'),
|
||||
baseZipObject = require('./_baseZipObject');
|
||||
|
||||
/**
|
||||
* This method is like `_.zipObject` except that it supports property paths.
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
* @since 4.1.0
|
||||
* @category Array
|
||||
* @param {Array} [props=[]] The property identifiers.
|
||||
* @param {Array} [values=[]] The property values.
|
||||
* @returns {Object} Returns the new object.
|
||||
* @example
|
||||
*
|
||||
* _.zipObjectDeep(['a.b[0].c', 'a.b[1].d'], [1, 2]);
|
||||
* // => { 'a': { 'b': [{ 'c': 1 }, { 'd': 2 }] } }
|
||||
*/
|
||||
function zipObjectDeep(props, values) {
|
||||
return baseZipObject(props || [], values || [], baseSet);
|
||||
}
|
||||
|
||||
module.exports = zipObjectDeep;
|
||||
@@ -0,0 +1,38 @@
|
||||
'use strict';
|
||||
|
||||
var GetIntrinsic = require('get-intrinsic');
|
||||
var callBound = require('call-bind/callBound');
|
||||
|
||||
var $TypeError = GetIntrinsic('%TypeError%');
|
||||
var $RegExpPrototype = GetIntrinsic('%RegExp.prototype%');
|
||||
|
||||
var SameValue = require('./SameValue');
|
||||
var Type = require('./Type');
|
||||
|
||||
var $indexOf = callBound('String.prototype.indexOf');
|
||||
|
||||
var hasRegExpMatcher = require('is-regex');
|
||||
var getFlags = require('regexp.prototype.flags');
|
||||
|
||||
// https://262.ecma-international.org/13.0/#sec-regexphasflag
|
||||
|
||||
module.exports = function RegExpHasFlag(R, codeUnit) {
|
||||
if (Type(codeUnit) !== 'String' || codeUnit.length !== 1) {
|
||||
throw new $TypeError('Assertion failed: `string` must be a code unit - a String of length 1');
|
||||
}
|
||||
|
||||
if (Type(R) !== 'Object') {
|
||||
throw new $TypeError('Assertion failed: Type(R) is not Object');
|
||||
}
|
||||
|
||||
if (!hasRegExpMatcher(R)) { // step 2
|
||||
if (SameValue(R, $RegExpPrototype)) {
|
||||
return void undefined; // step 2.a
|
||||
}
|
||||
throw new $TypeError('`R` must be a RegExp object'); // step 2.b
|
||||
}
|
||||
|
||||
var flags = getFlags(R); // step 3
|
||||
|
||||
return $indexOf(flags, codeUnit) > -1; // steps 4-5
|
||||
};
|
||||
@@ -0,0 +1,2 @@
|
||||
if(typeof cptable === 'undefined') cptable = {};
|
||||
cptable[1253] = (function(){ var d = "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007\b\t\n\u000b\f\r\u000e\u000f\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017\u0018\u0019\u001a\u001b\u001c\u001d\u001e\u001f !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~€<7F>‚ƒ„…†‡<E280A0>‰<EFBFBD>‹<EFBFBD><E280B9><EFBFBD><EFBFBD><EFBFBD>‘’“”•–—<E28093>™<EFBFBD>›<EFBFBD><E280BA><EFBFBD><EFBFBD> ΅Ά£¤¥¦§¨©<C2A8>«¬®―°±²³΄µ¶·ΈΉΊ»Ό½ΎΏΐΑΒΓΔΕΖΗΘΙΚΛΜΝΞΟΠΡ<CEA0>ΣΤΥΦΧΨΩΪΫάέήίΰαβγδεζηθικλμνξοπρςστυφχψωϊϋόύώ<CF8D>", D = [], e = {}; for(var i=0;i!=d.length;++i) { if(d.charCodeAt(i) !== 0xFFFD) e[d.charAt(i)] = i; D[i] = d.charAt(i); } return {"enc": e, "dec": D }; })();
|
||||
@@ -0,0 +1,168 @@
|
||||
Node.js - jsonfile
|
||||
================
|
||||
|
||||
Easily read/write JSON files.
|
||||
|
||||
[](https://www.npmjs.org/package/jsonfile)
|
||||
[](http://travis-ci.org/jprichardson/node-jsonfile)
|
||||
[](https://ci.appveyor.com/project/jprichardson/node-jsonfile/branch/master)
|
||||
|
||||
<a href="https://github.com/feross/standard"><img src="https://cdn.rawgit.com/feross/standard/master/sticker.svg" alt="Standard JavaScript" width="100"></a>
|
||||
|
||||
Why?
|
||||
----
|
||||
|
||||
Writing `JSON.stringify()` and then `fs.writeFile()` and `JSON.parse()` with `fs.readFile()` enclosed in `try/catch` blocks became annoying.
|
||||
|
||||
|
||||
|
||||
Installation
|
||||
------------
|
||||
|
||||
npm install --save jsonfile
|
||||
|
||||
|
||||
|
||||
API
|
||||
---
|
||||
|
||||
### readFile(filename, [options], callback)
|
||||
|
||||
`options` (`object`, default `undefined`): Pass in any `fs.readFile` options or set `reviver` for a [JSON reviver](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/parse).
|
||||
- `throws` (`boolean`, default: `true`). If `JSON.parse` throws an error, pass this error to the callback.
|
||||
If `false`, returns `null` for the object.
|
||||
|
||||
|
||||
```js
|
||||
var jsonfile = require('jsonfile')
|
||||
var file = '/tmp/data.json'
|
||||
jsonfile.readFile(file, function(err, obj) {
|
||||
console.dir(obj)
|
||||
})
|
||||
```
|
||||
|
||||
|
||||
### readFileSync(filename, [options])
|
||||
|
||||
`options` (`object`, default `undefined`): Pass in any `fs.readFileSync` options or set `reviver` for a [JSON reviver](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/parse).
|
||||
- `throws` (`boolean`, default: `true`). If an error is encountered reading or parsing the file, throw the error. If `false`, returns `null` for the object.
|
||||
|
||||
```js
|
||||
var jsonfile = require('jsonfile')
|
||||
var file = '/tmp/data.json'
|
||||
|
||||
console.dir(jsonfile.readFileSync(file))
|
||||
```
|
||||
|
||||
|
||||
### writeFile(filename, obj, [options], callback)
|
||||
|
||||
`options`: Pass in any `fs.writeFile` options or set `replacer` for a [JSON replacer](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify). Can also pass in `spaces` and override `EOL` string.
|
||||
|
||||
|
||||
```js
|
||||
var jsonfile = require('jsonfile')
|
||||
|
||||
var file = '/tmp/data.json'
|
||||
var obj = {name: 'JP'}
|
||||
|
||||
jsonfile.writeFile(file, obj, function (err) {
|
||||
console.error(err)
|
||||
})
|
||||
```
|
||||
|
||||
**formatting with spaces:**
|
||||
|
||||
```js
|
||||
var jsonfile = require('jsonfile')
|
||||
|
||||
var file = '/tmp/data.json'
|
||||
var obj = {name: 'JP'}
|
||||
|
||||
jsonfile.writeFile(file, obj, {spaces: 2}, function(err) {
|
||||
console.error(err)
|
||||
})
|
||||
```
|
||||
|
||||
**overriding EOL:**
|
||||
|
||||
```js
|
||||
var jsonfile = require('jsonfile')
|
||||
|
||||
var file = '/tmp/data.json'
|
||||
var obj = {name: 'JP'}
|
||||
|
||||
jsonfile.writeFile(file, obj, {spaces: 2, EOL: '\r\n'}, function(err) {
|
||||
console.error(err)
|
||||
})
|
||||
```
|
||||
|
||||
**appending to an existing JSON file:**
|
||||
|
||||
You can use `fs.writeFile` option `{flag: 'a'}` to achieve this.
|
||||
|
||||
```js
|
||||
var jsonfile = require('jsonfile')
|
||||
|
||||
var file = '/tmp/mayAlreadyExistedData.json'
|
||||
var obj = {name: 'JP'}
|
||||
|
||||
jsonfile.writeFile(file, obj, {flag: 'a'}, function (err) {
|
||||
console.error(err)
|
||||
})
|
||||
```
|
||||
|
||||
### writeFileSync(filename, obj, [options])
|
||||
|
||||
`options`: Pass in any `fs.writeFileSync` options or set `replacer` for a [JSON replacer](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify). Can also pass in `spaces` and override `EOL` string.
|
||||
|
||||
```js
|
||||
var jsonfile = require('jsonfile')
|
||||
|
||||
var file = '/tmp/data.json'
|
||||
var obj = {name: 'JP'}
|
||||
|
||||
jsonfile.writeFileSync(file, obj)
|
||||
```
|
||||
|
||||
**formatting with spaces:**
|
||||
|
||||
```js
|
||||
var jsonfile = require('jsonfile')
|
||||
|
||||
var file = '/tmp/data.json'
|
||||
var obj = {name: 'JP'}
|
||||
|
||||
jsonfile.writeFileSync(file, obj, {spaces: 2})
|
||||
```
|
||||
|
||||
**overriding EOL:**
|
||||
|
||||
```js
|
||||
var jsonfile = require('jsonfile')
|
||||
|
||||
var file = '/tmp/data.json'
|
||||
var obj = {name: 'JP'}
|
||||
|
||||
jsonfile.writeFileSync(file, obj, {spaces: 2, EOL: '\r\n'})
|
||||
```
|
||||
|
||||
**appending to an existing JSON file:**
|
||||
|
||||
You can use `fs.writeFileSync` option `{flag: 'a'}` to achieve this.
|
||||
|
||||
```js
|
||||
var jsonfile = require('jsonfile')
|
||||
|
||||
var file = '/tmp/mayAlreadyExistedData.json'
|
||||
var obj = {name: 'JP'}
|
||||
|
||||
jsonfile.writeFileSync(file, obj, {flag: 'a'})
|
||||
```
|
||||
|
||||
License
|
||||
-------
|
||||
|
||||
(MIT License)
|
||||
|
||||
Copyright 2012-2016, JP Richardson <jprichardson@gmail.com>
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"animationFrameProvider.js","sourceRoot":"","sources":["../../../../src/internal/scheduler/animationFrameProvider.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAc/C,MAAM,CAAC,MAAM,sBAAsB,GAA2B;IAG5D,QAAQ,CAAC,QAAQ;QACf,IAAI,OAAO,GAAG,qBAAqB,CAAC;QACpC,IAAI,MAAM,GAA4C,oBAAoB,CAAC;QAC3E,MAAM,EAAE,QAAQ,EAAE,GAAG,sBAAsB,CAAC;QAC5C,IAAI,QAAQ,EAAE;YACZ,OAAO,GAAG,QAAQ,CAAC,qBAAqB,CAAC;YACzC,MAAM,GAAG,QAAQ,CAAC,oBAAoB,CAAC;SACxC;QACD,MAAM,MAAM,GAAG,OAAO,CAAC,CAAC,SAAS,EAAE,EAAE;YAInC,MAAM,GAAG,SAAS,CAAC;YACnB,QAAQ,CAAC,SAAS,CAAC,CAAC;QACtB,CAAC,CAAC,CAAC;QACH,OAAO,IAAI,YAAY,CAAC,GAAG,EAAE,CAAC,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAG,MAAM,CAAC,CAAC,CAAC;IAClD,CAAC;IACD,qBAAqB,CAAC,GAAG,IAAI;QAC3B,MAAM,EAAE,QAAQ,EAAE,GAAG,sBAAsB,CAAC;QAC5C,OAAO,CAAC,CAAA,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,qBAAqB,KAAI,qBAAqB,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC;IAC7E,CAAC;IACD,oBAAoB,CAAC,GAAG,IAAI;QAC1B,MAAM,EAAE,QAAQ,EAAE,GAAG,sBAAsB,CAAC;QAC5C,OAAO,CAAC,CAAA,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,oBAAoB,KAAI,oBAAoB,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC;IAC3E,CAAC;IACD,QAAQ,EAAE,SAAS;CACpB,CAAC"}
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"AnyCatcher.js","sourceRoot":"","sources":["../../../src/internal/AnyCatcher.ts"],"names":[],"mappings":""}
|
||||
@@ -0,0 +1,282 @@
|
||||
var ProtoList = require('proto-list')
|
||||
, path = require('path')
|
||||
, fs = require('fs')
|
||||
, ini = require('ini')
|
||||
, EE = require('events').EventEmitter
|
||||
, url = require('url')
|
||||
, http = require('http')
|
||||
|
||||
var exports = module.exports = function () {
|
||||
var args = [].slice.call(arguments)
|
||||
, conf = new ConfigChain()
|
||||
|
||||
while(args.length) {
|
||||
var a = args.shift()
|
||||
if(a) conf.push
|
||||
( 'string' === typeof a
|
||||
? json(a)
|
||||
: a )
|
||||
}
|
||||
|
||||
return conf
|
||||
}
|
||||
|
||||
//recursively find a file...
|
||||
|
||||
var find = exports.find = function () {
|
||||
var rel = path.join.apply(null, [].slice.call(arguments))
|
||||
|
||||
function find(start, rel) {
|
||||
var file = path.join(start, rel)
|
||||
try {
|
||||
fs.statSync(file)
|
||||
return file
|
||||
} catch (err) {
|
||||
if(path.dirname(start) !== start) // root
|
||||
return find(path.dirname(start), rel)
|
||||
}
|
||||
}
|
||||
return find(__dirname, rel)
|
||||
}
|
||||
|
||||
var parse = exports.parse = function (content, file, type) {
|
||||
content = '' + content
|
||||
// if we don't know what it is, try json and fall back to ini
|
||||
// if we know what it is, then it must be that.
|
||||
if (!type) {
|
||||
try { return JSON.parse(content) }
|
||||
catch (er) { return ini.parse(content) }
|
||||
} else if (type === 'json') {
|
||||
if (this.emit) {
|
||||
try { return JSON.parse(content) }
|
||||
catch (er) { this.emit('error', er) }
|
||||
} else {
|
||||
return JSON.parse(content)
|
||||
}
|
||||
} else {
|
||||
return ini.parse(content)
|
||||
}
|
||||
}
|
||||
|
||||
var json = exports.json = function () {
|
||||
var args = [].slice.call(arguments).filter(function (arg) { return arg != null })
|
||||
var file = path.join.apply(null, args)
|
||||
var content
|
||||
try {
|
||||
content = fs.readFileSync(file,'utf-8')
|
||||
} catch (err) {
|
||||
return
|
||||
}
|
||||
return parse(content, file, 'json')
|
||||
}
|
||||
|
||||
var env = exports.env = function (prefix, env) {
|
||||
env = env || process.env
|
||||
var obj = {}
|
||||
var l = prefix.length
|
||||
for(var k in env) {
|
||||
if(k.indexOf(prefix) === 0)
|
||||
obj[k.substring(l)] = env[k]
|
||||
}
|
||||
|
||||
return obj
|
||||
}
|
||||
|
||||
exports.ConfigChain = ConfigChain
|
||||
function ConfigChain () {
|
||||
EE.apply(this)
|
||||
ProtoList.apply(this, arguments)
|
||||
this._awaiting = 0
|
||||
this._saving = 0
|
||||
this.sources = {}
|
||||
}
|
||||
|
||||
// multi-inheritance-ish
|
||||
var extras = {
|
||||
constructor: { value: ConfigChain }
|
||||
}
|
||||
Object.keys(EE.prototype).forEach(function (k) {
|
||||
extras[k] = Object.getOwnPropertyDescriptor(EE.prototype, k)
|
||||
})
|
||||
ConfigChain.prototype = Object.create(ProtoList.prototype, extras)
|
||||
|
||||
ConfigChain.prototype.del = function (key, where) {
|
||||
// if not specified where, then delete from the whole chain, scorched
|
||||
// earth style
|
||||
if (where) {
|
||||
var target = this.sources[where]
|
||||
target = target && target.data
|
||||
if (!target) {
|
||||
return this.emit('error', new Error('not found '+where))
|
||||
}
|
||||
delete target[key]
|
||||
} else {
|
||||
for (var i = 0, l = this.list.length; i < l; i ++) {
|
||||
delete this.list[i][key]
|
||||
}
|
||||
}
|
||||
return this
|
||||
}
|
||||
|
||||
ConfigChain.prototype.set = function (key, value, where) {
|
||||
var target
|
||||
|
||||
if (where) {
|
||||
target = this.sources[where]
|
||||
target = target && target.data
|
||||
if (!target) {
|
||||
return this.emit('error', new Error('not found '+where))
|
||||
}
|
||||
} else {
|
||||
target = this.list[0]
|
||||
if (!target) {
|
||||
return this.emit('error', new Error('cannot set, no confs!'))
|
||||
}
|
||||
}
|
||||
target[key] = value
|
||||
return this
|
||||
}
|
||||
|
||||
ConfigChain.prototype.get = function (key, where) {
|
||||
if (where) {
|
||||
where = this.sources[where]
|
||||
if (where) where = where.data
|
||||
if (where && Object.hasOwnProperty.call(where, key)) return where[key]
|
||||
return undefined
|
||||
}
|
||||
return this.list[0][key]
|
||||
}
|
||||
|
||||
ConfigChain.prototype.save = function (where, type, cb) {
|
||||
if (typeof type === 'function') cb = type, type = null
|
||||
var target = this.sources[where]
|
||||
if (!target || !(target.path || target.source) || !target.data) {
|
||||
// TODO: maybe save() to a url target could be a PUT or something?
|
||||
// would be easy to swap out with a reddis type thing, too
|
||||
return this.emit('error', new Error('bad save target: '+where))
|
||||
}
|
||||
|
||||
if (target.source) {
|
||||
var pref = target.prefix || ''
|
||||
Object.keys(target.data).forEach(function (k) {
|
||||
target.source[pref + k] = target.data[k]
|
||||
})
|
||||
return this
|
||||
}
|
||||
|
||||
var type = type || target.type
|
||||
var data = target.data
|
||||
if (target.type === 'json') {
|
||||
data = JSON.stringify(data)
|
||||
} else {
|
||||
data = ini.stringify(data)
|
||||
}
|
||||
|
||||
this._saving ++
|
||||
fs.writeFile(target.path, data, 'utf8', function (er) {
|
||||
this._saving --
|
||||
if (er) {
|
||||
if (cb) return cb(er)
|
||||
else return this.emit('error', er)
|
||||
}
|
||||
if (this._saving === 0) {
|
||||
if (cb) cb()
|
||||
this.emit('save')
|
||||
}
|
||||
}.bind(this))
|
||||
return this
|
||||
}
|
||||
|
||||
ConfigChain.prototype.addFile = function (file, type, name) {
|
||||
name = name || file
|
||||
var marker = {__source__:name}
|
||||
this.sources[name] = { path: file, type: type }
|
||||
this.push(marker)
|
||||
this._await()
|
||||
fs.readFile(file, 'utf8', function (er, data) {
|
||||
if (er) this.emit('error', er)
|
||||
this.addString(data, file, type, marker)
|
||||
}.bind(this))
|
||||
return this
|
||||
}
|
||||
|
||||
ConfigChain.prototype.addEnv = function (prefix, env, name) {
|
||||
name = name || 'env'
|
||||
var data = exports.env(prefix, env)
|
||||
this.sources[name] = { data: data, source: env, prefix: prefix }
|
||||
return this.add(data, name)
|
||||
}
|
||||
|
||||
ConfigChain.prototype.addUrl = function (req, type, name) {
|
||||
this._await()
|
||||
var href = url.format(req)
|
||||
name = name || href
|
||||
var marker = {__source__:name}
|
||||
this.sources[name] = { href: href, type: type }
|
||||
this.push(marker)
|
||||
http.request(req, function (res) {
|
||||
var c = []
|
||||
var ct = res.headers['content-type']
|
||||
if (!type) {
|
||||
type = ct.indexOf('json') !== -1 ? 'json'
|
||||
: ct.indexOf('ini') !== -1 ? 'ini'
|
||||
: href.match(/\.json$/) ? 'json'
|
||||
: href.match(/\.ini$/) ? 'ini'
|
||||
: null
|
||||
marker.type = type
|
||||
}
|
||||
|
||||
res.on('data', c.push.bind(c))
|
||||
.on('end', function () {
|
||||
this.addString(Buffer.concat(c), href, type, marker)
|
||||
}.bind(this))
|
||||
.on('error', this.emit.bind(this, 'error'))
|
||||
|
||||
}.bind(this))
|
||||
.on('error', this.emit.bind(this, 'error'))
|
||||
.end()
|
||||
|
||||
return this
|
||||
}
|
||||
|
||||
ConfigChain.prototype.addString = function (data, file, type, marker) {
|
||||
data = this.parse(data, file, type)
|
||||
this.add(data, marker)
|
||||
return this
|
||||
}
|
||||
|
||||
ConfigChain.prototype.add = function (data, marker) {
|
||||
if (marker && typeof marker === 'object') {
|
||||
var i = this.list.indexOf(marker)
|
||||
if (i === -1) {
|
||||
return this.emit('error', new Error('bad marker'))
|
||||
}
|
||||
this.splice(i, 1, data)
|
||||
marker = marker.__source__
|
||||
this.sources[marker] = this.sources[marker] || {}
|
||||
this.sources[marker].data = data
|
||||
// we were waiting for this. maybe emit 'load'
|
||||
this._resolve()
|
||||
} else {
|
||||
if (typeof marker === 'string') {
|
||||
this.sources[marker] = this.sources[marker] || {}
|
||||
this.sources[marker].data = data
|
||||
}
|
||||
// trigger the load event if nothing was already going to do so.
|
||||
this._await()
|
||||
this.push(data)
|
||||
process.nextTick(this._resolve.bind(this))
|
||||
}
|
||||
return this
|
||||
}
|
||||
|
||||
ConfigChain.prototype.parse = exports.parse
|
||||
|
||||
ConfigChain.prototype._await = function () {
|
||||
this._awaiting++
|
||||
}
|
||||
|
||||
ConfigChain.prototype._resolve = function () {
|
||||
this._awaiting--
|
||||
if (this._awaiting === 0) this.emit('load', this)
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"immediateProvider.d.ts","sourceRoot":"","sources":["../../../../src/internal/scheduler/immediateProvider.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAGjD,aAAK,oBAAoB,GAAG,CAAC,OAAO,EAAE,MAAM,IAAI,EAAE,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,WAAW,CAAC;AACjF,aAAK,sBAAsB,GAAG,CAAC,MAAM,EAAE,WAAW,KAAK,IAAI,CAAC;AAE5D,UAAU,iBAAiB;IACzB,YAAY,EAAE,oBAAoB,CAAC;IACnC,cAAc,EAAE,sBAAsB,CAAC;IACvC,QAAQ,EACJ;QACE,YAAY,EAAE,oBAAoB,CAAC;QACnC,cAAc,EAAE,sBAAsB,CAAC;KACxC,GACD,SAAS,CAAC;CACf;AAED,eAAO,MAAM,iBAAiB,EAAE,iBAY/B,CAAC"}
|
||||
@@ -0,0 +1 @@
|
||||
{"name":"@babel/code-frame","version":"7.18.6","files":{"LICENSE":{"checkedAt":1678883670552,"integrity":"sha512-KYRMN3MVTuiy5XkFDHd5PnQmHaQnt3z16nsBDePxZ9YNmq7IFlslpBBlR3UI+zvlbEemzowOYeKil9a0ZkOYxQ==","mode":420,"size":1106},"package.json":{"checkedAt":1678883670552,"integrity":"sha512-s8iwtfkpg9udvuEsiD1wORZFMowhdczGEzZxhMDjH+MTCl7kugGYsockjhXtGsatpBXz7hREyb7jocRjhURfag==","mode":420,"size":823},"README.md":{"checkedAt":1678883670552,"integrity":"sha512-6mq4/BqhmcDcJCnaEkbAEqzcBOekgwJczS6RhUEbw2JvqDS3zO4DVScZFlIEpg3yUfOL/OWHSZlHa3HExxbgQA==","mode":420,"size":337},"lib/index.js":{"checkedAt":1678883670552,"integrity":"sha512-Afz3aidziTtWtR98Kye+qKQvQKZ5D1LutrZbRsls0rSTWBkV9LcjjUzdwn+gdtT0EWmSeH+4S1EkQ+YhP5k9NA==","mode":420,"size":4713}}}
|
||||
@@ -0,0 +1,5 @@
|
||||
var convert = require('./convert'),
|
||||
func = convert('findLastFrom', require('../findLast'));
|
||||
|
||||
func.placeholder = require('./placeholder');
|
||||
module.exports = func;
|
||||
@@ -0,0 +1,7 @@
|
||||
import { Observable } from './Observable';
|
||||
export interface FirstValueFromConfig<T> {
|
||||
defaultValue: T;
|
||||
}
|
||||
export declare function firstValueFrom<T, D>(source: Observable<T>, config: FirstValueFromConfig<D>): Promise<T | D>;
|
||||
export declare function firstValueFrom<T>(source: Observable<T>): Promise<T>;
|
||||
//# sourceMappingURL=firstValueFrom.d.ts.map
|
||||
@@ -0,0 +1,951 @@
|
||||
// Copyright Joyent, Inc. and other Node contributors.
|
||||
//
|
||||
// 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.
|
||||
|
||||
module.exports = Readable;
|
||||
|
||||
/*<replacement>*/
|
||||
var isArray = require('isarray');
|
||||
/*</replacement>*/
|
||||
|
||||
|
||||
/*<replacement>*/
|
||||
var Buffer = require('buffer').Buffer;
|
||||
/*</replacement>*/
|
||||
|
||||
Readable.ReadableState = ReadableState;
|
||||
|
||||
var EE = require('events').EventEmitter;
|
||||
|
||||
/*<replacement>*/
|
||||
if (!EE.listenerCount) EE.listenerCount = function(emitter, type) {
|
||||
return emitter.listeners(type).length;
|
||||
};
|
||||
/*</replacement>*/
|
||||
|
||||
var Stream = require('stream');
|
||||
|
||||
/*<replacement>*/
|
||||
var util = require('core-util-is');
|
||||
util.inherits = require('inherits');
|
||||
/*</replacement>*/
|
||||
|
||||
var StringDecoder;
|
||||
|
||||
|
||||
/*<replacement>*/
|
||||
var debug = require('util');
|
||||
if (debug && debug.debuglog) {
|
||||
debug = debug.debuglog('stream');
|
||||
} else {
|
||||
debug = function () {};
|
||||
}
|
||||
/*</replacement>*/
|
||||
|
||||
|
||||
util.inherits(Readable, Stream);
|
||||
|
||||
function ReadableState(options, stream) {
|
||||
var Duplex = require('./_stream_duplex');
|
||||
|
||||
options = options || {};
|
||||
|
||||
// the point at which it stops calling _read() to fill the buffer
|
||||
// Note: 0 is a valid value, means "don't call _read preemptively ever"
|
||||
var hwm = options.highWaterMark;
|
||||
var defaultHwm = options.objectMode ? 16 : 16 * 1024;
|
||||
this.highWaterMark = (hwm || hwm === 0) ? hwm : defaultHwm;
|
||||
|
||||
// cast to ints.
|
||||
this.highWaterMark = ~~this.highWaterMark;
|
||||
|
||||
this.buffer = [];
|
||||
this.length = 0;
|
||||
this.pipes = null;
|
||||
this.pipesCount = 0;
|
||||
this.flowing = null;
|
||||
this.ended = false;
|
||||
this.endEmitted = false;
|
||||
this.reading = false;
|
||||
|
||||
// a flag to be able to tell if the onwrite cb is called immediately,
|
||||
// or on a later tick. We set this to true at first, because any
|
||||
// actions that shouldn't happen until "later" should generally also
|
||||
// not happen before the first write call.
|
||||
this.sync = true;
|
||||
|
||||
// whenever we return null, then we set a flag to say
|
||||
// that we're awaiting a 'readable' event emission.
|
||||
this.needReadable = false;
|
||||
this.emittedReadable = false;
|
||||
this.readableListening = false;
|
||||
|
||||
|
||||
// object stream flag. Used to make read(n) ignore n and to
|
||||
// make all the buffer merging and length checks go away
|
||||
this.objectMode = !!options.objectMode;
|
||||
|
||||
if (stream instanceof Duplex)
|
||||
this.objectMode = this.objectMode || !!options.readableObjectMode;
|
||||
|
||||
// Crypto is kind of old and crusty. Historically, its default string
|
||||
// encoding is 'binary' so we have to make this configurable.
|
||||
// Everything else in the universe uses 'utf8', though.
|
||||
this.defaultEncoding = options.defaultEncoding || 'utf8';
|
||||
|
||||
// when piping, we only care about 'readable' events that happen
|
||||
// after read()ing all the bytes and not getting any pushback.
|
||||
this.ranOut = false;
|
||||
|
||||
// the number of writers that are awaiting a drain event in .pipe()s
|
||||
this.awaitDrain = 0;
|
||||
|
||||
// if true, a maybeReadMore has been scheduled
|
||||
this.readingMore = false;
|
||||
|
||||
this.decoder = null;
|
||||
this.encoding = null;
|
||||
if (options.encoding) {
|
||||
if (!StringDecoder)
|
||||
StringDecoder = require('string_decoder/').StringDecoder;
|
||||
this.decoder = new StringDecoder(options.encoding);
|
||||
this.encoding = options.encoding;
|
||||
}
|
||||
}
|
||||
|
||||
function Readable(options) {
|
||||
var Duplex = require('./_stream_duplex');
|
||||
|
||||
if (!(this instanceof Readable))
|
||||
return new Readable(options);
|
||||
|
||||
this._readableState = new ReadableState(options, this);
|
||||
|
||||
// legacy
|
||||
this.readable = true;
|
||||
|
||||
Stream.call(this);
|
||||
}
|
||||
|
||||
// Manually shove something into the read() buffer.
|
||||
// This returns true if the highWaterMark has not been hit yet,
|
||||
// similar to how Writable.write() returns true if you should
|
||||
// write() some more.
|
||||
Readable.prototype.push = function(chunk, encoding) {
|
||||
var state = this._readableState;
|
||||
|
||||
if (util.isString(chunk) && !state.objectMode) {
|
||||
encoding = encoding || state.defaultEncoding;
|
||||
if (encoding !== state.encoding) {
|
||||
chunk = new Buffer(chunk, encoding);
|
||||
encoding = '';
|
||||
}
|
||||
}
|
||||
|
||||
return readableAddChunk(this, state, chunk, encoding, false);
|
||||
};
|
||||
|
||||
// Unshift should *always* be something directly out of read()
|
||||
Readable.prototype.unshift = function(chunk) {
|
||||
var state = this._readableState;
|
||||
return readableAddChunk(this, state, chunk, '', true);
|
||||
};
|
||||
|
||||
function readableAddChunk(stream, state, chunk, encoding, addToFront) {
|
||||
var er = chunkInvalid(state, chunk);
|
||||
if (er) {
|
||||
stream.emit('error', er);
|
||||
} else if (util.isNullOrUndefined(chunk)) {
|
||||
state.reading = false;
|
||||
if (!state.ended)
|
||||
onEofChunk(stream, state);
|
||||
} else if (state.objectMode || chunk && chunk.length > 0) {
|
||||
if (state.ended && !addToFront) {
|
||||
var e = new Error('stream.push() after EOF');
|
||||
stream.emit('error', e);
|
||||
} else if (state.endEmitted && addToFront) {
|
||||
var e = new Error('stream.unshift() after end event');
|
||||
stream.emit('error', e);
|
||||
} else {
|
||||
if (state.decoder && !addToFront && !encoding)
|
||||
chunk = state.decoder.write(chunk);
|
||||
|
||||
if (!addToFront)
|
||||
state.reading = false;
|
||||
|
||||
// if we want the data now, just emit it.
|
||||
if (state.flowing && state.length === 0 && !state.sync) {
|
||||
stream.emit('data', chunk);
|
||||
stream.read(0);
|
||||
} else {
|
||||
// update the buffer info.
|
||||
state.length += state.objectMode ? 1 : chunk.length;
|
||||
if (addToFront)
|
||||
state.buffer.unshift(chunk);
|
||||
else
|
||||
state.buffer.push(chunk);
|
||||
|
||||
if (state.needReadable)
|
||||
emitReadable(stream);
|
||||
}
|
||||
|
||||
maybeReadMore(stream, state);
|
||||
}
|
||||
} else if (!addToFront) {
|
||||
state.reading = false;
|
||||
}
|
||||
|
||||
return needMoreData(state);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// if it's past the high water mark, we can push in some more.
|
||||
// Also, if we have no data yet, we can stand some
|
||||
// more bytes. This is to work around cases where hwm=0,
|
||||
// such as the repl. Also, if the push() triggered a
|
||||
// readable event, and the user called read(largeNumber) such that
|
||||
// needReadable was set, then we ought to push more, so that another
|
||||
// 'readable' event will be triggered.
|
||||
function needMoreData(state) {
|
||||
return !state.ended &&
|
||||
(state.needReadable ||
|
||||
state.length < state.highWaterMark ||
|
||||
state.length === 0);
|
||||
}
|
||||
|
||||
// backwards compatibility.
|
||||
Readable.prototype.setEncoding = function(enc) {
|
||||
if (!StringDecoder)
|
||||
StringDecoder = require('string_decoder/').StringDecoder;
|
||||
this._readableState.decoder = new StringDecoder(enc);
|
||||
this._readableState.encoding = enc;
|
||||
return this;
|
||||
};
|
||||
|
||||
// Don't raise the hwm > 128MB
|
||||
var MAX_HWM = 0x800000;
|
||||
function roundUpToNextPowerOf2(n) {
|
||||
if (n >= MAX_HWM) {
|
||||
n = MAX_HWM;
|
||||
} else {
|
||||
// Get the next highest power of 2
|
||||
n--;
|
||||
for (var p = 1; p < 32; p <<= 1) n |= n >> p;
|
||||
n++;
|
||||
}
|
||||
return n;
|
||||
}
|
||||
|
||||
function howMuchToRead(n, state) {
|
||||
if (state.length === 0 && state.ended)
|
||||
return 0;
|
||||
|
||||
if (state.objectMode)
|
||||
return n === 0 ? 0 : 1;
|
||||
|
||||
if (isNaN(n) || util.isNull(n)) {
|
||||
// only flow one buffer at a time
|
||||
if (state.flowing && state.buffer.length)
|
||||
return state.buffer[0].length;
|
||||
else
|
||||
return state.length;
|
||||
}
|
||||
|
||||
if (n <= 0)
|
||||
return 0;
|
||||
|
||||
// If we're asking for more than the target buffer level,
|
||||
// then raise the water mark. Bump up to the next highest
|
||||
// power of 2, to prevent increasing it excessively in tiny
|
||||
// amounts.
|
||||
if (n > state.highWaterMark)
|
||||
state.highWaterMark = roundUpToNextPowerOf2(n);
|
||||
|
||||
// don't have that much. return null, unless we've ended.
|
||||
if (n > state.length) {
|
||||
if (!state.ended) {
|
||||
state.needReadable = true;
|
||||
return 0;
|
||||
} else
|
||||
return state.length;
|
||||
}
|
||||
|
||||
return n;
|
||||
}
|
||||
|
||||
// you can override either this method, or the async _read(n) below.
|
||||
Readable.prototype.read = function(n) {
|
||||
debug('read', n);
|
||||
var state = this._readableState;
|
||||
var nOrig = n;
|
||||
|
||||
if (!util.isNumber(n) || n > 0)
|
||||
state.emittedReadable = false;
|
||||
|
||||
// if we're doing read(0) to trigger a readable event, but we
|
||||
// already have a bunch of data in the buffer, then just trigger
|
||||
// the 'readable' event and move on.
|
||||
if (n === 0 &&
|
||||
state.needReadable &&
|
||||
(state.length >= state.highWaterMark || state.ended)) {
|
||||
debug('read: emitReadable', state.length, state.ended);
|
||||
if (state.length === 0 && state.ended)
|
||||
endReadable(this);
|
||||
else
|
||||
emitReadable(this);
|
||||
return null;
|
||||
}
|
||||
|
||||
n = howMuchToRead(n, state);
|
||||
|
||||
// if we've ended, and we're now clear, then finish it up.
|
||||
if (n === 0 && state.ended) {
|
||||
if (state.length === 0)
|
||||
endReadable(this);
|
||||
return null;
|
||||
}
|
||||
|
||||
// All the actual chunk generation logic needs to be
|
||||
// *below* the call to _read. The reason is that in certain
|
||||
// synthetic stream cases, such as passthrough streams, _read
|
||||
// may be a completely synchronous operation which may change
|
||||
// the state of the read buffer, providing enough data when
|
||||
// before there was *not* enough.
|
||||
//
|
||||
// So, the steps are:
|
||||
// 1. Figure out what the state of things will be after we do
|
||||
// a read from the buffer.
|
||||
//
|
||||
// 2. If that resulting state will trigger a _read, then call _read.
|
||||
// Note that this may be asynchronous, or synchronous. Yes, it is
|
||||
// deeply ugly to write APIs this way, but that still doesn't mean
|
||||
// that the Readable class should behave improperly, as streams are
|
||||
// designed to be sync/async agnostic.
|
||||
// Take note if the _read call is sync or async (ie, if the read call
|
||||
// has returned yet), so that we know whether or not it's safe to emit
|
||||
// 'readable' etc.
|
||||
//
|
||||
// 3. Actually pull the requested chunks out of the buffer and return.
|
||||
|
||||
// if we need a readable event, then we need to do some reading.
|
||||
var doRead = state.needReadable;
|
||||
debug('need readable', doRead);
|
||||
|
||||
// if we currently have less than the highWaterMark, then also read some
|
||||
if (state.length === 0 || state.length - n < state.highWaterMark) {
|
||||
doRead = true;
|
||||
debug('length less than watermark', doRead);
|
||||
}
|
||||
|
||||
// however, if we've ended, then there's no point, and if we're already
|
||||
// reading, then it's unnecessary.
|
||||
if (state.ended || state.reading) {
|
||||
doRead = false;
|
||||
debug('reading or ended', doRead);
|
||||
}
|
||||
|
||||
if (doRead) {
|
||||
debug('do read');
|
||||
state.reading = true;
|
||||
state.sync = true;
|
||||
// if the length is currently zero, then we *need* a readable event.
|
||||
if (state.length === 0)
|
||||
state.needReadable = true;
|
||||
// call internal read method
|
||||
this._read(state.highWaterMark);
|
||||
state.sync = false;
|
||||
}
|
||||
|
||||
// If _read pushed data synchronously, then `reading` will be false,
|
||||
// and we need to re-evaluate how much data we can return to the user.
|
||||
if (doRead && !state.reading)
|
||||
n = howMuchToRead(nOrig, state);
|
||||
|
||||
var ret;
|
||||
if (n > 0)
|
||||
ret = fromList(n, state);
|
||||
else
|
||||
ret = null;
|
||||
|
||||
if (util.isNull(ret)) {
|
||||
state.needReadable = true;
|
||||
n = 0;
|
||||
}
|
||||
|
||||
state.length -= n;
|
||||
|
||||
// If we have nothing in the buffer, then we want to know
|
||||
// as soon as we *do* get something into the buffer.
|
||||
if (state.length === 0 && !state.ended)
|
||||
state.needReadable = true;
|
||||
|
||||
// If we tried to read() past the EOF, then emit end on the next tick.
|
||||
if (nOrig !== n && state.ended && state.length === 0)
|
||||
endReadable(this);
|
||||
|
||||
if (!util.isNull(ret))
|
||||
this.emit('data', ret);
|
||||
|
||||
return ret;
|
||||
};
|
||||
|
||||
function chunkInvalid(state, chunk) {
|
||||
var er = null;
|
||||
if (!util.isBuffer(chunk) &&
|
||||
!util.isString(chunk) &&
|
||||
!util.isNullOrUndefined(chunk) &&
|
||||
!state.objectMode) {
|
||||
er = new TypeError('Invalid non-string/buffer chunk');
|
||||
}
|
||||
return er;
|
||||
}
|
||||
|
||||
|
||||
function onEofChunk(stream, state) {
|
||||
if (state.decoder && !state.ended) {
|
||||
var chunk = state.decoder.end();
|
||||
if (chunk && chunk.length) {
|
||||
state.buffer.push(chunk);
|
||||
state.length += state.objectMode ? 1 : chunk.length;
|
||||
}
|
||||
}
|
||||
state.ended = true;
|
||||
|
||||
// emit 'readable' now to make sure it gets picked up.
|
||||
emitReadable(stream);
|
||||
}
|
||||
|
||||
// Don't emit readable right away in sync mode, because this can trigger
|
||||
// another read() call => stack overflow. This way, it might trigger
|
||||
// a nextTick recursion warning, but that's not so bad.
|
||||
function emitReadable(stream) {
|
||||
var state = stream._readableState;
|
||||
state.needReadable = false;
|
||||
if (!state.emittedReadable) {
|
||||
debug('emitReadable', state.flowing);
|
||||
state.emittedReadable = true;
|
||||
if (state.sync)
|
||||
process.nextTick(function() {
|
||||
emitReadable_(stream);
|
||||
});
|
||||
else
|
||||
emitReadable_(stream);
|
||||
}
|
||||
}
|
||||
|
||||
function emitReadable_(stream) {
|
||||
debug('emit readable');
|
||||
stream.emit('readable');
|
||||
flow(stream);
|
||||
}
|
||||
|
||||
|
||||
// at this point, the user has presumably seen the 'readable' event,
|
||||
// and called read() to consume some data. that may have triggered
|
||||
// in turn another _read(n) call, in which case reading = true if
|
||||
// it's in progress.
|
||||
// However, if we're not ended, or reading, and the length < hwm,
|
||||
// then go ahead and try to read some more preemptively.
|
||||
function maybeReadMore(stream, state) {
|
||||
if (!state.readingMore) {
|
||||
state.readingMore = true;
|
||||
process.nextTick(function() {
|
||||
maybeReadMore_(stream, state);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function maybeReadMore_(stream, state) {
|
||||
var len = state.length;
|
||||
while (!state.reading && !state.flowing && !state.ended &&
|
||||
state.length < state.highWaterMark) {
|
||||
debug('maybeReadMore read 0');
|
||||
stream.read(0);
|
||||
if (len === state.length)
|
||||
// didn't get any data, stop spinning.
|
||||
break;
|
||||
else
|
||||
len = state.length;
|
||||
}
|
||||
state.readingMore = false;
|
||||
}
|
||||
|
||||
// abstract method. to be overridden in specific implementation classes.
|
||||
// call cb(er, data) where data is <= n in length.
|
||||
// for virtual (non-string, non-buffer) streams, "length" is somewhat
|
||||
// arbitrary, and perhaps not very meaningful.
|
||||
Readable.prototype._read = function(n) {
|
||||
this.emit('error', new Error('not implemented'));
|
||||
};
|
||||
|
||||
Readable.prototype.pipe = function(dest, pipeOpts) {
|
||||
var src = this;
|
||||
var state = this._readableState;
|
||||
|
||||
switch (state.pipesCount) {
|
||||
case 0:
|
||||
state.pipes = dest;
|
||||
break;
|
||||
case 1:
|
||||
state.pipes = [state.pipes, dest];
|
||||
break;
|
||||
default:
|
||||
state.pipes.push(dest);
|
||||
break;
|
||||
}
|
||||
state.pipesCount += 1;
|
||||
debug('pipe count=%d opts=%j', state.pipesCount, pipeOpts);
|
||||
|
||||
var doEnd = (!pipeOpts || pipeOpts.end !== false) &&
|
||||
dest !== process.stdout &&
|
||||
dest !== process.stderr;
|
||||
|
||||
var endFn = doEnd ? onend : cleanup;
|
||||
if (state.endEmitted)
|
||||
process.nextTick(endFn);
|
||||
else
|
||||
src.once('end', endFn);
|
||||
|
||||
dest.on('unpipe', onunpipe);
|
||||
function onunpipe(readable) {
|
||||
debug('onunpipe');
|
||||
if (readable === src) {
|
||||
cleanup();
|
||||
}
|
||||
}
|
||||
|
||||
function onend() {
|
||||
debug('onend');
|
||||
dest.end();
|
||||
}
|
||||
|
||||
// when the dest drains, it reduces the awaitDrain counter
|
||||
// on the source. This would be more elegant with a .once()
|
||||
// handler in flow(), but adding and removing repeatedly is
|
||||
// too slow.
|
||||
var ondrain = pipeOnDrain(src);
|
||||
dest.on('drain', ondrain);
|
||||
|
||||
function cleanup() {
|
||||
debug('cleanup');
|
||||
// cleanup event handlers once the pipe is broken
|
||||
dest.removeListener('close', onclose);
|
||||
dest.removeListener('finish', onfinish);
|
||||
dest.removeListener('drain', ondrain);
|
||||
dest.removeListener('error', onerror);
|
||||
dest.removeListener('unpipe', onunpipe);
|
||||
src.removeListener('end', onend);
|
||||
src.removeListener('end', cleanup);
|
||||
src.removeListener('data', ondata);
|
||||
|
||||
// if the reader is waiting for a drain event from this
|
||||
// specific writer, then it would cause it to never start
|
||||
// flowing again.
|
||||
// So, if this is awaiting a drain, then we just call it now.
|
||||
// If we don't know, then assume that we are waiting for one.
|
||||
if (state.awaitDrain &&
|
||||
(!dest._writableState || dest._writableState.needDrain))
|
||||
ondrain();
|
||||
}
|
||||
|
||||
src.on('data', ondata);
|
||||
function ondata(chunk) {
|
||||
debug('ondata');
|
||||
var ret = dest.write(chunk);
|
||||
if (false === ret) {
|
||||
debug('false write response, pause',
|
||||
src._readableState.awaitDrain);
|
||||
src._readableState.awaitDrain++;
|
||||
src.pause();
|
||||
}
|
||||
}
|
||||
|
||||
// if the dest has an error, then stop piping into it.
|
||||
// however, don't suppress the throwing behavior for this.
|
||||
function onerror(er) {
|
||||
debug('onerror', er);
|
||||
unpipe();
|
||||
dest.removeListener('error', onerror);
|
||||
if (EE.listenerCount(dest, 'error') === 0)
|
||||
dest.emit('error', er);
|
||||
}
|
||||
// This is a brutally ugly hack to make sure that our error handler
|
||||
// is attached before any userland ones. NEVER DO THIS.
|
||||
if (!dest._events || !dest._events.error)
|
||||
dest.on('error', onerror);
|
||||
else if (isArray(dest._events.error))
|
||||
dest._events.error.unshift(onerror);
|
||||
else
|
||||
dest._events.error = [onerror, dest._events.error];
|
||||
|
||||
|
||||
|
||||
// Both close and finish should trigger unpipe, but only once.
|
||||
function onclose() {
|
||||
dest.removeListener('finish', onfinish);
|
||||
unpipe();
|
||||
}
|
||||
dest.once('close', onclose);
|
||||
function onfinish() {
|
||||
debug('onfinish');
|
||||
dest.removeListener('close', onclose);
|
||||
unpipe();
|
||||
}
|
||||
dest.once('finish', onfinish);
|
||||
|
||||
function unpipe() {
|
||||
debug('unpipe');
|
||||
src.unpipe(dest);
|
||||
}
|
||||
|
||||
// tell the dest that it's being piped to
|
||||
dest.emit('pipe', src);
|
||||
|
||||
// start the flow if it hasn't been started already.
|
||||
if (!state.flowing) {
|
||||
debug('pipe resume');
|
||||
src.resume();
|
||||
}
|
||||
|
||||
return dest;
|
||||
};
|
||||
|
||||
function pipeOnDrain(src) {
|
||||
return function() {
|
||||
var state = src._readableState;
|
||||
debug('pipeOnDrain', state.awaitDrain);
|
||||
if (state.awaitDrain)
|
||||
state.awaitDrain--;
|
||||
if (state.awaitDrain === 0 && EE.listenerCount(src, 'data')) {
|
||||
state.flowing = true;
|
||||
flow(src);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Readable.prototype.unpipe = function(dest) {
|
||||
var state = this._readableState;
|
||||
|
||||
// if we're not piping anywhere, then do nothing.
|
||||
if (state.pipesCount === 0)
|
||||
return this;
|
||||
|
||||
// just one destination. most common case.
|
||||
if (state.pipesCount === 1) {
|
||||
// passed in one, but it's not the right one.
|
||||
if (dest && dest !== state.pipes)
|
||||
return this;
|
||||
|
||||
if (!dest)
|
||||
dest = state.pipes;
|
||||
|
||||
// got a match.
|
||||
state.pipes = null;
|
||||
state.pipesCount = 0;
|
||||
state.flowing = false;
|
||||
if (dest)
|
||||
dest.emit('unpipe', this);
|
||||
return this;
|
||||
}
|
||||
|
||||
// slow case. multiple pipe destinations.
|
||||
|
||||
if (!dest) {
|
||||
// remove all.
|
||||
var dests = state.pipes;
|
||||
var len = state.pipesCount;
|
||||
state.pipes = null;
|
||||
state.pipesCount = 0;
|
||||
state.flowing = false;
|
||||
|
||||
for (var i = 0; i < len; i++)
|
||||
dests[i].emit('unpipe', this);
|
||||
return this;
|
||||
}
|
||||
|
||||
// try to find the right one.
|
||||
var i = indexOf(state.pipes, dest);
|
||||
if (i === -1)
|
||||
return this;
|
||||
|
||||
state.pipes.splice(i, 1);
|
||||
state.pipesCount -= 1;
|
||||
if (state.pipesCount === 1)
|
||||
state.pipes = state.pipes[0];
|
||||
|
||||
dest.emit('unpipe', this);
|
||||
|
||||
return this;
|
||||
};
|
||||
|
||||
// set up data events if they are asked for
|
||||
// Ensure readable listeners eventually get something
|
||||
Readable.prototype.on = function(ev, fn) {
|
||||
var res = Stream.prototype.on.call(this, ev, fn);
|
||||
|
||||
// If listening to data, and it has not explicitly been paused,
|
||||
// then call resume to start the flow of data on the next tick.
|
||||
if (ev === 'data' && false !== this._readableState.flowing) {
|
||||
this.resume();
|
||||
}
|
||||
|
||||
if (ev === 'readable' && this.readable) {
|
||||
var state = this._readableState;
|
||||
if (!state.readableListening) {
|
||||
state.readableListening = true;
|
||||
state.emittedReadable = false;
|
||||
state.needReadable = true;
|
||||
if (!state.reading) {
|
||||
var self = this;
|
||||
process.nextTick(function() {
|
||||
debug('readable nexttick read 0');
|
||||
self.read(0);
|
||||
});
|
||||
} else if (state.length) {
|
||||
emitReadable(this, state);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return res;
|
||||
};
|
||||
Readable.prototype.addListener = Readable.prototype.on;
|
||||
|
||||
// pause() and resume() are remnants of the legacy readable stream API
|
||||
// If the user uses them, then switch into old mode.
|
||||
Readable.prototype.resume = function() {
|
||||
var state = this._readableState;
|
||||
if (!state.flowing) {
|
||||
debug('resume');
|
||||
state.flowing = true;
|
||||
if (!state.reading) {
|
||||
debug('resume read 0');
|
||||
this.read(0);
|
||||
}
|
||||
resume(this, state);
|
||||
}
|
||||
return this;
|
||||
};
|
||||
|
||||
function resume(stream, state) {
|
||||
if (!state.resumeScheduled) {
|
||||
state.resumeScheduled = true;
|
||||
process.nextTick(function() {
|
||||
resume_(stream, state);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function resume_(stream, state) {
|
||||
state.resumeScheduled = false;
|
||||
stream.emit('resume');
|
||||
flow(stream);
|
||||
if (state.flowing && !state.reading)
|
||||
stream.read(0);
|
||||
}
|
||||
|
||||
Readable.prototype.pause = function() {
|
||||
debug('call pause flowing=%j', this._readableState.flowing);
|
||||
if (false !== this._readableState.flowing) {
|
||||
debug('pause');
|
||||
this._readableState.flowing = false;
|
||||
this.emit('pause');
|
||||
}
|
||||
return this;
|
||||
};
|
||||
|
||||
function flow(stream) {
|
||||
var state = stream._readableState;
|
||||
debug('flow', state.flowing);
|
||||
if (state.flowing) {
|
||||
do {
|
||||
var chunk = stream.read();
|
||||
} while (null !== chunk && state.flowing);
|
||||
}
|
||||
}
|
||||
|
||||
// wrap an old-style stream as the async data source.
|
||||
// This is *not* part of the readable stream interface.
|
||||
// It is an ugly unfortunate mess of history.
|
||||
Readable.prototype.wrap = function(stream) {
|
||||
var state = this._readableState;
|
||||
var paused = false;
|
||||
|
||||
var self = this;
|
||||
stream.on('end', function() {
|
||||
debug('wrapped end');
|
||||
if (state.decoder && !state.ended) {
|
||||
var chunk = state.decoder.end();
|
||||
if (chunk && chunk.length)
|
||||
self.push(chunk);
|
||||
}
|
||||
|
||||
self.push(null);
|
||||
});
|
||||
|
||||
stream.on('data', function(chunk) {
|
||||
debug('wrapped data');
|
||||
if (state.decoder)
|
||||
chunk = state.decoder.write(chunk);
|
||||
if (!chunk || !state.objectMode && !chunk.length)
|
||||
return;
|
||||
|
||||
var ret = self.push(chunk);
|
||||
if (!ret) {
|
||||
paused = true;
|
||||
stream.pause();
|
||||
}
|
||||
});
|
||||
|
||||
// proxy all the other methods.
|
||||
// important when wrapping filters and duplexes.
|
||||
for (var i in stream) {
|
||||
if (util.isFunction(stream[i]) && util.isUndefined(this[i])) {
|
||||
this[i] = function(method) { return function() {
|
||||
return stream[method].apply(stream, arguments);
|
||||
}}(i);
|
||||
}
|
||||
}
|
||||
|
||||
// proxy certain important events.
|
||||
var events = ['error', 'close', 'destroy', 'pause', 'resume'];
|
||||
forEach(events, function(ev) {
|
||||
stream.on(ev, self.emit.bind(self, ev));
|
||||
});
|
||||
|
||||
// when we try to consume some more bytes, simply unpause the
|
||||
// underlying stream.
|
||||
self._read = function(n) {
|
||||
debug('wrapped _read', n);
|
||||
if (paused) {
|
||||
paused = false;
|
||||
stream.resume();
|
||||
}
|
||||
};
|
||||
|
||||
return self;
|
||||
};
|
||||
|
||||
|
||||
|
||||
// exposed for testing purposes only.
|
||||
Readable._fromList = fromList;
|
||||
|
||||
// Pluck off n bytes from an array of buffers.
|
||||
// Length is the combined lengths of all the buffers in the list.
|
||||
function fromList(n, state) {
|
||||
var list = state.buffer;
|
||||
var length = state.length;
|
||||
var stringMode = !!state.decoder;
|
||||
var objectMode = !!state.objectMode;
|
||||
var ret;
|
||||
|
||||
// nothing in the list, definitely empty.
|
||||
if (list.length === 0)
|
||||
return null;
|
||||
|
||||
if (length === 0)
|
||||
ret = null;
|
||||
else if (objectMode)
|
||||
ret = list.shift();
|
||||
else if (!n || n >= length) {
|
||||
// read it all, truncate the array.
|
||||
if (stringMode)
|
||||
ret = list.join('');
|
||||
else
|
||||
ret = Buffer.concat(list, length);
|
||||
list.length = 0;
|
||||
} else {
|
||||
// read just some of it.
|
||||
if (n < list[0].length) {
|
||||
// just take a part of the first list item.
|
||||
// slice is the same for buffers and strings.
|
||||
var buf = list[0];
|
||||
ret = buf.slice(0, n);
|
||||
list[0] = buf.slice(n);
|
||||
} else if (n === list[0].length) {
|
||||
// first list is a perfect match
|
||||
ret = list.shift();
|
||||
} else {
|
||||
// complex case.
|
||||
// we have enough to cover it, but it spans past the first buffer.
|
||||
if (stringMode)
|
||||
ret = '';
|
||||
else
|
||||
ret = new Buffer(n);
|
||||
|
||||
var c = 0;
|
||||
for (var i = 0, l = list.length; i < l && c < n; i++) {
|
||||
var buf = list[0];
|
||||
var cpy = Math.min(n - c, buf.length);
|
||||
|
||||
if (stringMode)
|
||||
ret += buf.slice(0, cpy);
|
||||
else
|
||||
buf.copy(ret, c, 0, cpy);
|
||||
|
||||
if (cpy < buf.length)
|
||||
list[0] = buf.slice(cpy);
|
||||
else
|
||||
list.shift();
|
||||
|
||||
c += cpy;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
function endReadable(stream) {
|
||||
var state = stream._readableState;
|
||||
|
||||
// If we get here before consuming all the bytes, then that is a
|
||||
// bug in node. Should never happen.
|
||||
if (state.length > 0)
|
||||
throw new Error('endReadable called on non-empty stream');
|
||||
|
||||
if (!state.endEmitted) {
|
||||
state.ended = true;
|
||||
process.nextTick(function() {
|
||||
// Check that we didn't get one last unshift.
|
||||
if (!state.endEmitted && state.length === 0) {
|
||||
state.endEmitted = true;
|
||||
stream.readable = false;
|
||||
stream.emit('end');
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function forEach (xs, f) {
|
||||
for (var i = 0, l = xs.length; i < l; i++) {
|
||||
f(xs[i], i);
|
||||
}
|
||||
}
|
||||
|
||||
function indexOf (xs, x) {
|
||||
for (var i = 0, l = xs.length; i < l; i++) {
|
||||
if (xs[i] === x) return i;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
module.exports={C:{"2":0,"3":0,"4":0,"5":0,"6":0,"7":0,"8":0,"9":0,"10":0,"11":0,"12":0,"13":0,"14":0,"15":0,"16":0,"17":0,"18":0,"19":0,"20":0,"21":0,"22":0,"23":0,"24":0,"25":0,"26":0,"27":0,"28":0,"29":0,"30":0,"31":0,"32":0,"33":0,"34":0,"35":0,"36":0,"37":0,"38":0,"39":0,"40":0,"41":0,"42":0,"43":0,"44":0,"45":0,"46":0,"47":0.0046,"48":0,"49":0,"50":0,"51":0,"52":0.01379,"53":0,"54":0,"55":0,"56":0,"57":0,"58":0,"59":0,"60":0,"61":0,"62":0,"63":0,"64":0,"65":0,"66":0,"67":0,"68":0,"69":0,"70":0.0046,"71":0,"72":0,"73":0,"74":0,"75":0,"76":0,"77":0,"78":0,"79":0,"80":0,"81":0,"82":0,"83":0,"84":0,"85":0,"86":0,"87":0,"88":0,"89":0,"90":0,"91":0,"92":0,"93":0,"94":0,"95":0,"96":0,"97":0,"98":0,"99":0,"100":0,"101":0,"102":0,"103":0,"104":0,"105":0,"106":0.0092,"107":0,"108":0,"109":0.6805,"110":0.469,"111":0.02759,"112":0,"3.5":0,"3.6":0},D:{"4":0,"5":0,"6":0,"7":0,"8":0,"9":0,"10":0,"11":0,"12":0,"13":0,"14":0,"15":0,"16":0,"17":0,"18":0,"19":0,"20":0,"21":0,"22":0,"23":0,"24":0,"25":0,"26":0,"27":0,"28":0,"29":0.0046,"30":0,"31":0,"32":0,"33":0,"34":0,"35":0,"36":0,"37":0,"38":0,"39":0,"40":0,"41":0.0046,"42":0,"43":0,"44":0,"45":0,"46":0,"47":0,"48":0,"49":0.0046,"50":0,"51":0,"52":0,"53":0,"54":0,"55":0,"56":0,"57":0,"58":0,"59":0,"60":0,"61":0,"62":0,"63":0,"64":0,"65":0,"66":0.0046,"67":0,"68":0,"69":0,"70":0,"71":0,"72":0,"73":0,"74":0,"75":0,"76":0.02299,"77":0,"78":0,"79":0,"80":0,"81":0.01379,"83":0.08276,"84":0,"85":0,"86":0,"87":0.0046,"88":0.01839,"89":0.0046,"90":0,"91":0.0092,"92":0,"93":0.02759,"94":0.01379,"95":0,"96":0.0046,"97":0.0046,"98":0.0046,"99":0,"100":0.01379,"101":0,"102":0.01379,"103":0.14714,"104":0.01839,"105":0.0092,"106":0.0092,"107":0.05518,"108":0.55176,"109":5.61416,"110":3.2094,"111":0.0046,"112":0.0046,"113":0},F:{"9":0,"11":0,"12":0,"15":0,"16":0,"17":0,"18":0,"19":0,"20":0,"21":0,"22":0,"23":0,"24":0,"25":0,"26":0,"27":0,"28":0.0046,"29":0,"30":0,"31":0,"32":0,"33":0,"34":0,"35":0,"36":0,"37":0,"38":0,"39":0,"40":0,"41":0,"42":0,"43":0,"44":0,"45":0,"46":0,"47":0,"48":0,"49":0,"50":0,"51":0,"52":0,"53":0,"54":0,"55":0,"56":0,"57":0,"58":0,"60":0,"62":0,"63":0,"64":0,"65":0,"66":0,"67":0,"68":0,"69":0,"70":0,"71":0,"72":0,"73":0,"74":0,"75":0,"76":0,"77":0,"78":0,"79":0,"80":0,"81":0,"82":0,"83":0,"84":0,"85":0,"86":0,"87":0,"88":0,"89":0,"90":0,"91":0,"92":0,"93":0.0092,"94":0.17013,"95":0.17013,"9.5-9.6":0,"10.0-10.1":0,"10.5":0,"10.6":0,"11.1":0,"11.5":0,"11.6":0,"12.1":0},B:{"12":0,"13":0,"14":0,"15":0,"16":0,"17":0,"18":0.0046,"79":0,"80":0,"81":0,"83":0,"84":0,"85":0,"86":0,"87":0,"88":0,"89":0,"90":0,"91":0,"92":0.0046,"93":0,"94":0,"95":0,"96":0,"97":0,"98":0,"99":0,"100":0,"101":0,"102":0,"103":0,"104":0,"105":0,"106":0,"107":0.01839,"108":0.01839,"109":1.18169,"110":1.53113},E:{"4":0,"5":0,"6":0,"7":0,"8":0,"9":0,"10":0,"11":0,"12":0,"13":0.0046,"14":0.01839,"15":0,_:"0","3.1":0,"3.2":0,"5.1":0.0046,"6.1":0,"7.1":0,"9.1":0,"10.1":0,"11.1":0,"12.1":0.0046,"13.1":0.12874,"14.1":0.09656,"15.1":0,"15.2-15.3":0.03219,"15.4":0.01839,"15.5":0.05518,"15.6":0.47819,"16.0":0.01379,"16.1":0.15633,"16.2":0.29887,"16.3":0.44141,"16.4":0},G:{"8":0,"3.2":0,"4.0-4.1":0,"4.2-4.3":0,"5.0-5.1":0.0119,"6.0-6.1":0,"7.0-7.1":0.03767,"8.1-8.4":0.07336,"9.0-9.2":0,"9.3":0.02974,"10.0-10.2":0.00793,"10.3":0.08526,"11.0-11.2":0,"11.3-11.4":0,"12.0-12.1":0,"12.2-12.5":0.75345,"13.0-13.1":0.00397,"13.2":0,"13.3":0,"13.4-13.7":0.0119,"14.0-14.4":0.04362,"14.5-14.8":0.12095,"15.0-15.1":0.68603,"15.2-15.3":0.03767,"15.4":0.11698,"15.5":2.93646,"15.6":1.70715,"16.0":1.6556,"16.1":2.89086,"16.2":5.12939,"16.3":2.09577,"16.4":0.00793},P:{"4":0.26888,"20":0.81784,"5.0-5.4":0,"6.2-6.4":0,"7.2-7.4":0.10083,"8.2":0,"9.2":0.0112,"10.1":0,"11.1-11.2":0.02241,"12.0":0.0112,"13.0":0.0112,"14.0":0.04481,"15.0":0.03361,"16.0":0.02241,"17.0":0.04481,"18.0":0.02241,"19.0":1.16514},I:{"0":0,"3":0,"4":0,"2.1":0,"2.2":0,"2.3":0,"4.1":0.22219,"4.2-4.3":0,"4.4":0,"4.4.3-4.4.4":0.49992},K:{_:"0 10 11 12 11.1 11.5 12.1"},A:{"6":0,"7":0,"8":0,"9":0,"10":0.0092,"11":0.01839,"5.5":0},N:{"10":0,"11":0},S:{"2.5":0.01621,_:"3.0-3.1"},J:{"7":0,"10":0},O:{"0":0.09724},H:{"0":0.02046},L:{"0":60.69093},R:{_:"0"},M:{"0":0.10804},Q:{"13.1":0}};
|
||||
@@ -0,0 +1,35 @@
|
||||
'use strict';
|
||||
|
||||
var assert = require('assert');
|
||||
var path = require('path');
|
||||
var resolve = require('resolve');
|
||||
|
||||
var basedir = __dirname + '/node_modules/@my-scope/package-b';
|
||||
|
||||
var expected = path.join(__dirname, '../../node_modules/jquery/dist/jquery.js');
|
||||
|
||||
/*
|
||||
* preserveSymlinks === false
|
||||
* will search NPM package from
|
||||
* - packages/package-b/node_modules
|
||||
* - packages/node_modules
|
||||
* - node_modules
|
||||
*/
|
||||
assert.equal(resolve.sync('jquery', { basedir: basedir, preserveSymlinks: false }), expected);
|
||||
assert.equal(resolve.sync('../../node_modules/jquery', { basedir: basedir, preserveSymlinks: false }), expected);
|
||||
|
||||
/*
|
||||
* preserveSymlinks === true
|
||||
* will search NPM package from
|
||||
* - packages/package-a/node_modules/@my-scope/packages/package-b/node_modules
|
||||
* - packages/package-a/node_modules/@my-scope/packages/node_modules
|
||||
* - packages/package-a/node_modules/@my-scope/node_modules
|
||||
* - packages/package-a/node_modules/node_modules
|
||||
* - packages/package-a/node_modules
|
||||
* - packages/node_modules
|
||||
* - node_modules
|
||||
*/
|
||||
assert.equal(resolve.sync('jquery', { basedir: basedir, preserveSymlinks: true }), expected);
|
||||
assert.equal(resolve.sync('../../../../../node_modules/jquery', { basedir: basedir, preserveSymlinks: true }), expected);
|
||||
|
||||
console.log(' * all monorepo paths successfully resolved through symlinks');
|
||||
@@ -0,0 +1,43 @@
|
||||
var Token = require('../../tokenizer/token');
|
||||
|
||||
var serializeBody = require('../../writer/one-time').body;
|
||||
var serializeRules = require('../../writer/one-time').rules;
|
||||
|
||||
function removeDuplicates(tokens) {
|
||||
var matched = {};
|
||||
var moreThanOnce = [];
|
||||
var id, token;
|
||||
var body, bodies;
|
||||
|
||||
for (var i = 0, l = tokens.length; i < l; i++) {
|
||||
token = tokens[i];
|
||||
if (token[0] != Token.RULE)
|
||||
continue;
|
||||
|
||||
id = serializeRules(token[1]);
|
||||
|
||||
if (matched[id] && matched[id].length == 1)
|
||||
moreThanOnce.push(id);
|
||||
else
|
||||
matched[id] = matched[id] || [];
|
||||
|
||||
matched[id].push(i);
|
||||
}
|
||||
|
||||
for (i = 0, l = moreThanOnce.length; i < l; i++) {
|
||||
id = moreThanOnce[i];
|
||||
bodies = [];
|
||||
|
||||
for (var j = matched[id].length - 1; j >= 0; j--) {
|
||||
token = tokens[matched[id][j]];
|
||||
body = serializeBody(token[2]);
|
||||
|
||||
if (bodies.indexOf(body) > -1)
|
||||
token[2] = [];
|
||||
else
|
||||
bodies.push(body);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = removeDuplicates;
|
||||
@@ -0,0 +1,203 @@
|
||||
'use strict';
|
||||
|
||||
var fs = require('fs');
|
||||
var util = require('util');
|
||||
var path = require('path');
|
||||
|
||||
let shim;
|
||||
class Y18N {
|
||||
constructor(opts) {
|
||||
// configurable options.
|
||||
opts = opts || {};
|
||||
this.directory = opts.directory || './locales';
|
||||
this.updateFiles = typeof opts.updateFiles === 'boolean' ? opts.updateFiles : true;
|
||||
this.locale = opts.locale || 'en';
|
||||
this.fallbackToLanguage = typeof opts.fallbackToLanguage === 'boolean' ? opts.fallbackToLanguage : true;
|
||||
// internal stuff.
|
||||
this.cache = Object.create(null);
|
||||
this.writeQueue = [];
|
||||
}
|
||||
__(...args) {
|
||||
if (typeof arguments[0] !== 'string') {
|
||||
return this._taggedLiteral(arguments[0], ...arguments);
|
||||
}
|
||||
const str = args.shift();
|
||||
let cb = function () { }; // start with noop.
|
||||
if (typeof args[args.length - 1] === 'function')
|
||||
cb = args.pop();
|
||||
cb = cb || function () { }; // noop.
|
||||
if (!this.cache[this.locale])
|
||||
this._readLocaleFile();
|
||||
// we've observed a new string, update the language file.
|
||||
if (!this.cache[this.locale][str] && this.updateFiles) {
|
||||
this.cache[this.locale][str] = str;
|
||||
// include the current directory and locale,
|
||||
// since these values could change before the
|
||||
// write is performed.
|
||||
this._enqueueWrite({
|
||||
directory: this.directory,
|
||||
locale: this.locale,
|
||||
cb
|
||||
});
|
||||
}
|
||||
else {
|
||||
cb();
|
||||
}
|
||||
return shim.format.apply(shim.format, [this.cache[this.locale][str] || str].concat(args));
|
||||
}
|
||||
__n() {
|
||||
const args = Array.prototype.slice.call(arguments);
|
||||
const singular = args.shift();
|
||||
const plural = args.shift();
|
||||
const quantity = args.shift();
|
||||
let cb = function () { }; // start with noop.
|
||||
if (typeof args[args.length - 1] === 'function')
|
||||
cb = args.pop();
|
||||
if (!this.cache[this.locale])
|
||||
this._readLocaleFile();
|
||||
let str = quantity === 1 ? singular : plural;
|
||||
if (this.cache[this.locale][singular]) {
|
||||
const entry = this.cache[this.locale][singular];
|
||||
str = entry[quantity === 1 ? 'one' : 'other'];
|
||||
}
|
||||
// we've observed a new string, update the language file.
|
||||
if (!this.cache[this.locale][singular] && this.updateFiles) {
|
||||
this.cache[this.locale][singular] = {
|
||||
one: singular,
|
||||
other: plural
|
||||
};
|
||||
// include the current directory and locale,
|
||||
// since these values could change before the
|
||||
// write is performed.
|
||||
this._enqueueWrite({
|
||||
directory: this.directory,
|
||||
locale: this.locale,
|
||||
cb
|
||||
});
|
||||
}
|
||||
else {
|
||||
cb();
|
||||
}
|
||||
// if a %d placeholder is provided, add quantity
|
||||
// to the arguments expanded by util.format.
|
||||
const values = [str];
|
||||
if (~str.indexOf('%d'))
|
||||
values.push(quantity);
|
||||
return shim.format.apply(shim.format, values.concat(args));
|
||||
}
|
||||
setLocale(locale) {
|
||||
this.locale = locale;
|
||||
}
|
||||
getLocale() {
|
||||
return this.locale;
|
||||
}
|
||||
updateLocale(obj) {
|
||||
if (!this.cache[this.locale])
|
||||
this._readLocaleFile();
|
||||
for (const key in obj) {
|
||||
if (Object.prototype.hasOwnProperty.call(obj, key)) {
|
||||
this.cache[this.locale][key] = obj[key];
|
||||
}
|
||||
}
|
||||
}
|
||||
_taggedLiteral(parts, ...args) {
|
||||
let str = '';
|
||||
parts.forEach(function (part, i) {
|
||||
const arg = args[i + 1];
|
||||
str += part;
|
||||
if (typeof arg !== 'undefined') {
|
||||
str += '%s';
|
||||
}
|
||||
});
|
||||
return this.__.apply(this, [str].concat([].slice.call(args, 1)));
|
||||
}
|
||||
_enqueueWrite(work) {
|
||||
this.writeQueue.push(work);
|
||||
if (this.writeQueue.length === 1)
|
||||
this._processWriteQueue();
|
||||
}
|
||||
_processWriteQueue() {
|
||||
const _this = this;
|
||||
const work = this.writeQueue[0];
|
||||
// destructure the enqueued work.
|
||||
const directory = work.directory;
|
||||
const locale = work.locale;
|
||||
const cb = work.cb;
|
||||
const languageFile = this._resolveLocaleFile(directory, locale);
|
||||
const serializedLocale = JSON.stringify(this.cache[locale], null, 2);
|
||||
shim.fs.writeFile(languageFile, serializedLocale, 'utf-8', function (err) {
|
||||
_this.writeQueue.shift();
|
||||
if (_this.writeQueue.length > 0)
|
||||
_this._processWriteQueue();
|
||||
cb(err);
|
||||
});
|
||||
}
|
||||
_readLocaleFile() {
|
||||
let localeLookup = {};
|
||||
const languageFile = this._resolveLocaleFile(this.directory, this.locale);
|
||||
try {
|
||||
// When using a bundler such as webpack, readFileSync may not be defined:
|
||||
if (shim.fs.readFileSync) {
|
||||
localeLookup = JSON.parse(shim.fs.readFileSync(languageFile, 'utf-8'));
|
||||
}
|
||||
}
|
||||
catch (err) {
|
||||
if (err instanceof SyntaxError) {
|
||||
err.message = 'syntax error in ' + languageFile;
|
||||
}
|
||||
if (err.code === 'ENOENT')
|
||||
localeLookup = {};
|
||||
else
|
||||
throw err;
|
||||
}
|
||||
this.cache[this.locale] = localeLookup;
|
||||
}
|
||||
_resolveLocaleFile(directory, locale) {
|
||||
let file = shim.resolve(directory, './', locale + '.json');
|
||||
if (this.fallbackToLanguage && !this._fileExistsSync(file) && ~locale.lastIndexOf('_')) {
|
||||
// attempt fallback to language only
|
||||
const languageFile = shim.resolve(directory, './', locale.split('_')[0] + '.json');
|
||||
if (this._fileExistsSync(languageFile))
|
||||
file = languageFile;
|
||||
}
|
||||
return file;
|
||||
}
|
||||
_fileExistsSync(file) {
|
||||
return shim.exists(file);
|
||||
}
|
||||
}
|
||||
function y18n$1(opts, _shim) {
|
||||
shim = _shim;
|
||||
const y18n = new Y18N(opts);
|
||||
return {
|
||||
__: y18n.__.bind(y18n),
|
||||
__n: y18n.__n.bind(y18n),
|
||||
setLocale: y18n.setLocale.bind(y18n),
|
||||
getLocale: y18n.getLocale.bind(y18n),
|
||||
updateLocale: y18n.updateLocale.bind(y18n),
|
||||
locale: y18n.locale
|
||||
};
|
||||
}
|
||||
|
||||
var nodePlatformShim = {
|
||||
fs: {
|
||||
readFileSync: fs.readFileSync,
|
||||
writeFile: fs.writeFile
|
||||
},
|
||||
format: util.format,
|
||||
resolve: path.resolve,
|
||||
exists: (file) => {
|
||||
try {
|
||||
return fs.statSync(file).isFile();
|
||||
}
|
||||
catch (err) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
const y18n = (opts) => {
|
||||
return y18n$1(opts, nodePlatformShim);
|
||||
};
|
||||
|
||||
module.exports = y18n;
|
||||
@@ -0,0 +1 @@
|
||||
module.exports={A:{A:{"2":"J D E F A B CC"},B:{"1":"P Q R S T U V W X Y Z","2":"C K L G","194":"M N O","513":"a b c d e i j k l m n o p q r s t u f H"},C:{"2":"0 1 2 3 4 5 6 7 8 9 DC tB I v J D E F A B C K L G M N O w g x y z AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB PB QB RB SB TB UB VB WB EC FC","194":"XB YB uB ZB vB aB bB cB dB eB fB gB hB iB jB kB h","450":"lB mB nB oB pB","513":"P Q R wB S T U V W X Y Z a b c d e i j k l m n o p q r s t u f H xB yB"},D:{"1":"gB hB iB jB kB h lB mB nB oB pB P Q R S T U V W X Y Z","2":"0 1 2 3 4 5 6 7 8 9 I v J D E F A B C K L G M N O w g x y z AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB PB QB RB SB TB UB VB WB XB YB uB","194":"ZB vB aB bB cB dB eB fB","513":"a b c d e i j k l m n o p q r s t u f H xB yB GC"},E:{"2":"I v J D E F A HC zB IC JC KC LC","194":"B C K L G 0B qB rB 1B MC NC","513":"2B 3B 4B 5B sB 6B 7B 8B 9B OC"},F:{"1":"cB dB eB fB gB hB iB jB kB h lB mB nB oB pB P Q R wB S T U V W X Y Z a b c d e","2":"0 1 2 3 4 5 6 7 8 9 F B C G M N O w g x y z AB BB CB DB EB FB GB HB IB JB KB LB MB PC QC RC SC qB AC TC rB","194":"NB OB PB QB RB SB TB UB VB WB XB YB ZB aB bB"},G:{"2":"E zB UC BC VC WC XC YC ZC aC bC","194":"cC dC eC fC gC hC iC jC kC lC mC nC","513":"2B 3B 4B 5B sB 6B 7B 8B 9B"},H:{"2":"oC"},I:{"2":"tB I f pC qC rC sC BC tC uC"},J:{"2":"D A"},K:{"2":"A B C qB AC rB","513":"h"},L:{"513":"H"},M:{"513":"H"},N:{"2":"A B"},O:{"1":"vC"},P:{"2":"I wC xC yC zC 0C 0B 1C 2C 3C 4C","513":"g 5C sB 6C 7C 8C"},Q:{"2":"1B"},R:{"513":"9C"},S:{"2":"AD","513":"BD"}},B:6,C:"Shared Array Buffer"};
|
||||
@@ -0,0 +1,17 @@
|
||||
let Declaration = require('../declaration')
|
||||
|
||||
class Animation extends Declaration {
|
||||
/**
|
||||
* Don’t add prefixes for modern values.
|
||||
*/
|
||||
check(decl) {
|
||||
return !decl.value.split(/\s+/).some(i => {
|
||||
let lower = i.toLowerCase()
|
||||
return lower === 'reverse' || lower === 'alternate-reverse'
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
Animation.names = ['animation', 'animation-direction']
|
||||
|
||||
module.exports = Animation
|
||||
@@ -0,0 +1,9 @@
|
||||
"use strict";
|
||||
|
||||
var callable = require("../../object/valid-callable")
|
||||
, apply = Function.prototype.apply;
|
||||
|
||||
module.exports = function () {
|
||||
var fn = callable(this);
|
||||
return function (args) { return apply.call(fn, this, args); };
|
||||
};
|
||||
@@ -0,0 +1,9 @@
|
||||
import { Observable } from '../Observable';
|
||||
import { Falsy, OperatorFunction } from '../types';
|
||||
export declare function findIndex<T>(predicate: BooleanConstructor): OperatorFunction<T, T extends Falsy ? -1 : number>;
|
||||
/** @deprecated Use a closure instead of a `thisArg`. Signatures accepting a `thisArg` will be removed in v8. */
|
||||
export declare function findIndex<T>(predicate: BooleanConstructor, thisArg: any): OperatorFunction<T, T extends Falsy ? -1 : number>;
|
||||
/** @deprecated Use a closure instead of a `thisArg`. Signatures accepting a `thisArg` will be removed in v8. */
|
||||
export declare function findIndex<T, A>(predicate: (this: A, value: T, index: number, source: Observable<T>) => boolean, thisArg: A): OperatorFunction<T, number>;
|
||||
export declare function findIndex<T>(predicate: (value: T, index: number, source: Observable<T>) => boolean): OperatorFunction<T, number>;
|
||||
//# sourceMappingURL=findIndex.d.ts.map
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,5 @@
|
||||
var convert = require('./convert'),
|
||||
func = convert('curry', require('../curry'));
|
||||
|
||||
func.placeholder = require('./placeholder');
|
||||
module.exports = func;
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,12 @@
|
||||
# These are supported funding model platforms
|
||||
|
||||
github: [ljharb]
|
||||
patreon: # Replace with a single Patreon username
|
||||
open_collective: # Replace with a single Open Collective username
|
||||
ko_fi: # Replace with a single Ko-fi username
|
||||
tidelift: npm/safe-regex-test
|
||||
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
|
||||
liberapay: # Replace with a single Liberapay username
|
||||
issuehunt: # Replace with a single IssueHunt username
|
||||
otechie: # Replace with a single Otechie username
|
||||
custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
|
||||
@@ -0,0 +1,70 @@
|
||||
{
|
||||
"name": "has-property-descriptors",
|
||||
"version": "1.0.0",
|
||||
"description": "Does the environment have full property descriptor support? Handles IE 8's broken defineProperty/gOPD.",
|
||||
"main": "index.js",
|
||||
"exports": {
|
||||
".": "./index.js",
|
||||
"./package.json": "./package.json"
|
||||
},
|
||||
"sideEffects": false,
|
||||
"scripts": {
|
||||
"prepublishOnly": "safe-publish-latest",
|
||||
"prepublish": "not-in-publish || npm run prepublishOnly",
|
||||
"pretest": "npm run lint",
|
||||
"prelint": "evalmd README.md",
|
||||
"lint": "eslint --ext=js,mjs .",
|
||||
"tests-only": "nyc tape 'test/**/*.js'",
|
||||
"test": "npm run tests-only",
|
||||
"posttest": "aud --production",
|
||||
"version": "auto-changelog && git add CHANGELOG.md",
|
||||
"postversion": "auto-changelog && git add CHANGELOG.md && git commit --no-edit --amend && git tag -f \"v$(node -e \"console.log(require('./package.json').version)\")\""
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/inspect-js/has-property-descriptors.git"
|
||||
},
|
||||
"keywords": [
|
||||
"property",
|
||||
"descriptors",
|
||||
"has",
|
||||
"environment",
|
||||
"env",
|
||||
"defineProperty",
|
||||
"getOwnPropertyDescriptor"
|
||||
],
|
||||
"author": "Jordan Harband <ljharb@gmail.com>",
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/ljharb"
|
||||
},
|
||||
"license": "MIT",
|
||||
"bugs": {
|
||||
"url": "https://github.com/inspect-js/has-property-descriptors/issues"
|
||||
},
|
||||
"homepage": "https://github.com/inspect-js/has-property-descriptors#readme",
|
||||
"devDependencies": {
|
||||
"@ljharb/eslint-config": "^21.0.0",
|
||||
"aud": "^2.0.0",
|
||||
"auto-changelog": "^2.4.0",
|
||||
"eslint": "=8.8.0",
|
||||
"in-publish": "^2.0.1",
|
||||
"evalmd": "^0.0.19",
|
||||
"nyc": "^10.3.2",
|
||||
"safe-publish-latest": "^2.0.0",
|
||||
"tape": "^5.5.3"
|
||||
},
|
||||
"dependencies": {
|
||||
"get-intrinsic": "^1.1.1"
|
||||
},
|
||||
"testling": {
|
||||
"files": "test/index.js"
|
||||
},
|
||||
"auto-changelog": {
|
||||
"output": "CHANGELOG.md",
|
||||
"template": "keepachangelog",
|
||||
"unreleased": false,
|
||||
"commitLimit": false,
|
||||
"backfillLimit": false,
|
||||
"hideCredit": true
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,78 @@
|
||||
var conversions = require('./conversions');
|
||||
var route = require('./route');
|
||||
|
||||
var convert = {};
|
||||
|
||||
var models = Object.keys(conversions);
|
||||
|
||||
function wrapRaw(fn) {
|
||||
var wrappedFn = function (args) {
|
||||
if (args === undefined || args === null) {
|
||||
return args;
|
||||
}
|
||||
|
||||
if (arguments.length > 1) {
|
||||
args = Array.prototype.slice.call(arguments);
|
||||
}
|
||||
|
||||
return fn(args);
|
||||
};
|
||||
|
||||
// preserve .conversion property if there is one
|
||||
if ('conversion' in fn) {
|
||||
wrappedFn.conversion = fn.conversion;
|
||||
}
|
||||
|
||||
return wrappedFn;
|
||||
}
|
||||
|
||||
function wrapRounded(fn) {
|
||||
var wrappedFn = function (args) {
|
||||
if (args === undefined || args === null) {
|
||||
return args;
|
||||
}
|
||||
|
||||
if (arguments.length > 1) {
|
||||
args = Array.prototype.slice.call(arguments);
|
||||
}
|
||||
|
||||
var result = fn(args);
|
||||
|
||||
// we're assuming the result is an array here.
|
||||
// see notice in conversions.js; don't use box types
|
||||
// in conversion functions.
|
||||
if (typeof result === 'object') {
|
||||
for (var len = result.length, i = 0; i < len; i++) {
|
||||
result[i] = Math.round(result[i]);
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
};
|
||||
|
||||
// preserve .conversion property if there is one
|
||||
if ('conversion' in fn) {
|
||||
wrappedFn.conversion = fn.conversion;
|
||||
}
|
||||
|
||||
return wrappedFn;
|
||||
}
|
||||
|
||||
models.forEach(function (fromModel) {
|
||||
convert[fromModel] = {};
|
||||
|
||||
Object.defineProperty(convert[fromModel], 'channels', {value: conversions[fromModel].channels});
|
||||
Object.defineProperty(convert[fromModel], 'labels', {value: conversions[fromModel].labels});
|
||||
|
||||
var routes = route(fromModel);
|
||||
var routeModels = Object.keys(routes);
|
||||
|
||||
routeModels.forEach(function (toModel) {
|
||||
var fn = routes[toModel];
|
||||
|
||||
convert[fromModel][toModel] = wrapRounded(fn);
|
||||
convert[fromModel][toModel].raw = wrapRaw(fn);
|
||||
});
|
||||
});
|
||||
|
||||
module.exports = convert;
|
||||
Binary file not shown.
@@ -0,0 +1,13 @@
|
||||
# Pause/unpause
|
||||
|
||||
This extension allows Mousetrap to be paused and unpaused without having to reset keyboard shortcuts and rebind them.
|
||||
|
||||
Usage looks like:
|
||||
|
||||
```javascript
|
||||
// stop Mousetrap events from firing
|
||||
Mousetrap.pause();
|
||||
|
||||
// allow Mousetrap events to fire again
|
||||
Mousetrap.unpause();
|
||||
```
|
||||
@@ -0,0 +1,48 @@
|
||||
{
|
||||
"name": "registry-auth-token",
|
||||
"version": "5.0.2",
|
||||
"description": "Get the auth token set for an npm registry (if any)",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"test": "mocha --require test/global-hooks.js",
|
||||
"posttest": "standard",
|
||||
"coverage": "istanbul cover _mocha"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+ssh://git@github.com/rexxars/registry-auth-token.git"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=14"
|
||||
},
|
||||
"keywords": [
|
||||
"npm",
|
||||
"conf",
|
||||
"config",
|
||||
"npmconf",
|
||||
"registry",
|
||||
"auth",
|
||||
"token",
|
||||
"authtoken"
|
||||
],
|
||||
"author": "Espen Hovlandsdal <espen@hovlandsdal.com>",
|
||||
"license": "MIT",
|
||||
"bugs": {
|
||||
"url": "https://github.com/rexxars/registry-auth-token/issues"
|
||||
},
|
||||
"homepage": "https://github.com/rexxars/registry-auth-token#readme",
|
||||
"dependencies": {
|
||||
"@pnpm/npm-conf": "^2.1.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"istanbul": "^0.4.2",
|
||||
"mocha": "^10.0.0",
|
||||
"require-uncached": "^1.0.2",
|
||||
"standard": "^12.0.1"
|
||||
},
|
||||
"standard": {
|
||||
"ignore": [
|
||||
"coverage/**"
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
# Array Like
|
||||
|
||||
_Array-like_ value (any value with `length` property)
|
||||
|
||||
## `array-like/is`
|
||||
|
||||
Restricted _array-like_ confirmation. Returns true for every value that meets following contraints
|
||||
|
||||
- is an _object_ (or with `allowString` option, a _string_)
|
||||
- is not a _function_
|
||||
- Exposes `length` that meets [`array-length`](array-length.md#array-lengthcoerce) constraints
|
||||
|
||||
```javascript
|
||||
const isArrayLike = require("type/array-like/is");
|
||||
|
||||
isArrayLike([]); // true
|
||||
isArrayLike({}); // false
|
||||
isArrayLike({ length: 0 }); // true
|
||||
isArrayLike("foo"); // false
|
||||
isArrayLike("foo", { allowString: true }); // true
|
||||
```
|
||||
|
||||
## `array-like/ensure`
|
||||
|
||||
If given argument is an _array-like_, it is returned back. Otherwise `TypeError` is thrown.
|
||||
|
||||
```javascript
|
||||
const ensureArrayLike = require("type/array-like/ensure");
|
||||
|
||||
ensureArrayLike({ length: 0 }); // { length: 0 }
|
||||
ensureArrayLike("foo", { allowString: true }); // "foo"
|
||||
ensureArrayLike({}); // Thrown TypeError: null is not an iterable
|
||||
```
|
||||
@@ -0,0 +1,88 @@
|
||||
import { argsert } from './argsert.js';
|
||||
import { isPromise } from './utils/is-promise.js';
|
||||
export class GlobalMiddleware {
|
||||
constructor(yargs) {
|
||||
this.globalMiddleware = [];
|
||||
this.frozens = [];
|
||||
this.yargs = yargs;
|
||||
}
|
||||
addMiddleware(callback, applyBeforeValidation, global = true, mutates = false) {
|
||||
argsert('<array|function> [boolean] [boolean] [boolean]', [callback, applyBeforeValidation, global], arguments.length);
|
||||
if (Array.isArray(callback)) {
|
||||
for (let i = 0; i < callback.length; i++) {
|
||||
if (typeof callback[i] !== 'function') {
|
||||
throw Error('middleware must be a function');
|
||||
}
|
||||
const m = callback[i];
|
||||
m.applyBeforeValidation = applyBeforeValidation;
|
||||
m.global = global;
|
||||
}
|
||||
Array.prototype.push.apply(this.globalMiddleware, callback);
|
||||
}
|
||||
else if (typeof callback === 'function') {
|
||||
const m = callback;
|
||||
m.applyBeforeValidation = applyBeforeValidation;
|
||||
m.global = global;
|
||||
m.mutates = mutates;
|
||||
this.globalMiddleware.push(callback);
|
||||
}
|
||||
return this.yargs;
|
||||
}
|
||||
addCoerceMiddleware(callback, option) {
|
||||
const aliases = this.yargs.getAliases();
|
||||
this.globalMiddleware = this.globalMiddleware.filter(m => {
|
||||
const toCheck = [...(aliases[option] || []), option];
|
||||
if (!m.option)
|
||||
return true;
|
||||
else
|
||||
return !toCheck.includes(m.option);
|
||||
});
|
||||
callback.option = option;
|
||||
return this.addMiddleware(callback, true, true, true);
|
||||
}
|
||||
getMiddleware() {
|
||||
return this.globalMiddleware;
|
||||
}
|
||||
freeze() {
|
||||
this.frozens.push([...this.globalMiddleware]);
|
||||
}
|
||||
unfreeze() {
|
||||
const frozen = this.frozens.pop();
|
||||
if (frozen !== undefined)
|
||||
this.globalMiddleware = frozen;
|
||||
}
|
||||
reset() {
|
||||
this.globalMiddleware = this.globalMiddleware.filter(m => m.global);
|
||||
}
|
||||
}
|
||||
export function commandMiddlewareFactory(commandMiddleware) {
|
||||
if (!commandMiddleware)
|
||||
return [];
|
||||
return commandMiddleware.map(middleware => {
|
||||
middleware.applyBeforeValidation = false;
|
||||
return middleware;
|
||||
});
|
||||
}
|
||||
export function applyMiddleware(argv, yargs, middlewares, beforeValidation) {
|
||||
return middlewares.reduce((acc, middleware) => {
|
||||
if (middleware.applyBeforeValidation !== beforeValidation) {
|
||||
return acc;
|
||||
}
|
||||
if (middleware.mutates) {
|
||||
if (middleware.applied)
|
||||
return acc;
|
||||
middleware.applied = true;
|
||||
}
|
||||
if (isPromise(acc)) {
|
||||
return acc
|
||||
.then(initialObj => Promise.all([initialObj, middleware(initialObj, yargs)]))
|
||||
.then(([initialObj, middlewareObj]) => Object.assign(initialObj, middlewareObj));
|
||||
}
|
||||
else {
|
||||
const result = middleware(acc, yargs);
|
||||
return isPromise(result)
|
||||
? result.then(middlewareObj => Object.assign(acc, middlewareObj))
|
||||
: Object.assign(acc, result);
|
||||
}
|
||||
}, argv);
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.isEmpty = exports.isString = void 0;
|
||||
function isString(input) {
|
||||
return typeof input === 'string';
|
||||
}
|
||||
exports.isString = isString;
|
||||
function isEmpty(input) {
|
||||
return input === '';
|
||||
}
|
||||
exports.isEmpty = isEmpty;
|
||||
@@ -0,0 +1,5 @@
|
||||
var convert = require('./convert'),
|
||||
func = convert('trimChars', require('../trim'));
|
||||
|
||||
func.placeholder = require('./placeholder');
|
||||
module.exports = func;
|
||||
@@ -0,0 +1,9 @@
|
||||
'use strict';
|
||||
|
||||
var IsInteger = require('./IsInteger');
|
||||
|
||||
// https://262.ecma-international.org/11.0/#sec-isnonnegativeinteger
|
||||
|
||||
module.exports = function IsNonNegativeInteger(argument) {
|
||||
return !!IsInteger(argument) && argument >= 0;
|
||||
};
|
||||
@@ -0,0 +1,22 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.scheduleArray = void 0;
|
||||
var Observable_1 = require("../Observable");
|
||||
function scheduleArray(input, scheduler) {
|
||||
return new Observable_1.Observable(function (subscriber) {
|
||||
var i = 0;
|
||||
return scheduler.schedule(function () {
|
||||
if (i === input.length) {
|
||||
subscriber.complete();
|
||||
}
|
||||
else {
|
||||
subscriber.next(input[i++]);
|
||||
if (!subscriber.closed) {
|
||||
this.schedule();
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
exports.scheduleArray = scheduleArray;
|
||||
//# sourceMappingURL=scheduleArray.js.map
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"combineLatestAll.js","sourceRoot":"","sources":["../../../../src/internal/operators/combineLatestAll.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAE5D,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AA6CtD,MAAM,UAAU,gBAAgB,CAAI,OAAsC;IACxE,OAAO,gBAAgB,CAAC,aAAa,EAAE,OAAO,CAAC,CAAC;AAClD,CAAC"}
|
||||
@@ -0,0 +1,11 @@
|
||||
// This file is read by tools that parse documentation comments conforming to the TSDoc standard.
|
||||
// It should be published with your NPM package. It should not be tracked by Git.
|
||||
{
|
||||
"tsdocVersion": "0.12",
|
||||
"toolPackages": [
|
||||
{
|
||||
"packageName": "@microsoft/api-extractor",
|
||||
"packageVersion": "7.13.4"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
var baseIsEqualDeep = require('./_baseIsEqualDeep'),
|
||||
isObjectLike = require('./isObjectLike');
|
||||
|
||||
/**
|
||||
* The base implementation of `_.isEqual` which supports partial comparisons
|
||||
* and tracks traversed objects.
|
||||
*
|
||||
* @private
|
||||
* @param {*} value The value to compare.
|
||||
* @param {*} other The other value to compare.
|
||||
* @param {boolean} bitmask The bitmask flags.
|
||||
* 1 - Unordered comparison
|
||||
* 2 - Partial comparison
|
||||
* @param {Function} [customizer] The function to customize comparisons.
|
||||
* @param {Object} [stack] Tracks traversed `value` and `other` objects.
|
||||
* @returns {boolean} Returns `true` if the values are equivalent, else `false`.
|
||||
*/
|
||||
function baseIsEqual(value, other, bitmask, customizer, stack) {
|
||||
if (value === other) {
|
||||
return true;
|
||||
}
|
||||
if (value == null || other == null || (!isObjectLike(value) && !isObjectLike(other))) {
|
||||
return value !== value && other !== other;
|
||||
}
|
||||
return baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual, stack);
|
||||
}
|
||||
|
||||
module.exports = baseIsEqual;
|
||||
@@ -0,0 +1,6 @@
|
||||
import { reduce } from './reduce';
|
||||
import { isFunction } from '../util/isFunction';
|
||||
export function max(comparer) {
|
||||
return reduce(isFunction(comparer) ? (x, y) => (comparer(x, y) > 0 ? x : y) : (x, y) => (x > y ? x : y));
|
||||
}
|
||||
//# sourceMappingURL=max.js.map
|
||||
@@ -0,0 +1,9 @@
|
||||
"use strict";
|
||||
|
||||
var indexOf = String.prototype.indexOf, slice = String.prototype.slice;
|
||||
|
||||
module.exports = function (search, replace) {
|
||||
var index = indexOf.call(this, search);
|
||||
if (index === -1) return String(this);
|
||||
return slice.call(this, 0, index) + replace + slice.call(this, index + String(search).length);
|
||||
};
|
||||
@@ -0,0 +1,32 @@
|
||||
var toInteger = require('./toInteger'),
|
||||
toLength = require('./toLength');
|
||||
|
||||
/**
|
||||
* The base implementation of `_.fill` without an iteratee call guard.
|
||||
*
|
||||
* @private
|
||||
* @param {Array} array The array to fill.
|
||||
* @param {*} value The value to fill `array` with.
|
||||
* @param {number} [start=0] The start position.
|
||||
* @param {number} [end=array.length] The end position.
|
||||
* @returns {Array} Returns `array`.
|
||||
*/
|
||||
function baseFill(array, value, start, end) {
|
||||
var length = array.length;
|
||||
|
||||
start = toInteger(start);
|
||||
if (start < 0) {
|
||||
start = -start > length ? 0 : (length + start);
|
||||
}
|
||||
end = (end === undefined || end > length) ? length : toInteger(end);
|
||||
if (end < 0) {
|
||||
end += length;
|
||||
}
|
||||
end = start > end ? 0 : toLength(end);
|
||||
while (start < end) {
|
||||
array[start++] = value;
|
||||
}
|
||||
return array;
|
||||
}
|
||||
|
||||
module.exports = baseFill;
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"animationFrameProvider.d.ts","sourceRoot":"","sources":["../../../../src/internal/scheduler/animationFrameProvider.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE/C,UAAU,sBAAsB;IAC9B,QAAQ,CAAC,QAAQ,EAAE,oBAAoB,GAAG,YAAY,CAAC;IACvD,qBAAqB,EAAE,OAAO,qBAAqB,CAAC;IACpD,oBAAoB,EAAE,OAAO,oBAAoB,CAAC;IAClD,QAAQ,EACJ;QACE,qBAAqB,EAAE,OAAO,qBAAqB,CAAC;QACpD,oBAAoB,EAAE,OAAO,oBAAoB,CAAC;KACnD,GACD,SAAS,CAAC;CACf;AAED,eAAO,MAAM,sBAAsB,EAAE,sBA6BpC,CAAC"}
|
||||
@@ -0,0 +1,12 @@
|
||||
var baseProperty = require('./_baseProperty');
|
||||
|
||||
/**
|
||||
* Gets the size of an ASCII `string`.
|
||||
*
|
||||
* @private
|
||||
* @param {string} string The string inspect.
|
||||
* @returns {number} Returns the string size.
|
||||
*/
|
||||
var asciiSize = baseProperty('length');
|
||||
|
||||
module.exports = asciiSize;
|
||||
@@ -0,0 +1 @@
|
||||
{"name":"@octokit/request","version":"6.2.3","files":{"LICENSE":{"checkedAt":1678883670405,"integrity":"sha512-8FFmjOGzS4YsHoIqH94puCnrt52IbgXvyeCeydF8pso7rWBBQUq/ucDlumRLaH81XnrOqtE31m4OeKzAtd9ESA==","mode":420,"size":1081},"dist-src/get-buffer-response.js":{"checkedAt":1678883670405,"integrity":"sha512-R4cVeuusp6BIrPoY4empzUHfAOs1s9ye1Fltq0gVR572ZDVr+mSZnfELqE473vH9PuvBXpCL53H2xvwckNsPSQ==","mode":420,"size":91},"dist-src/fetch-wrapper.js":{"checkedAt":1678883670405,"integrity":"sha512-oJEPpJaDuZ3Locp+7JR/8oyB/IZ2GQzO6+bduaFZpM39tJlUWGiwuGIIw+ep1P1kpF+GDfodnKkb8RS6ubJoRA==","mode":420,"size":4263},"dist-src/index.js":{"checkedAt":1678883670405,"integrity":"sha512-/zkz+lBQIpUJqtaIlVHvYQASdCWAlDxBQS4UawhcNsb2sm5N+2S0kdwK3pbwFFQeh5ZT5rJ7efvubrgykTtdsA==","mode":420,"size":327},"dist-node/index.js":{"checkedAt":1678883670405,"integrity":"sha512-L9Qx4Auq4YDeSNEGcpCDOk7mFpU1nO7GtsF8rA5XuVixoF1JoWru7r3kIdobMuei/wkEXWyjLhaCg5Hbq0KmpQ==","mode":420,"size":5055},"dist-web/index.js":{"checkedAt":1678883670408,"integrity":"sha512-v6QYvjFHMVK1vc1FZNcMyaLNNu8kazKyppwJTF8CIREl1AW74MKjmlooHzxaSlmMx1UlOwYma7YgsASWxVvrrw==","mode":420,"size":5443},"dist-src/with-defaults.js":{"checkedAt":1678883670412,"integrity":"sha512-ViYIHbAUe0ihuLAqIrScKj7yNx2DODwqA7UVID7gewEKQX0rXSwp0mGkpXKjVjPMvTnwaSUs+MIH4dxb3LipKQ==","mode":420,"size":893},"dist-src/version.js":{"checkedAt":1678883670412,"integrity":"sha512-+o3mX+yL/9dcpOQoUFEm3gGJU7H8URYCZow5M3GxQSaNLrunuZoUpOq3A8417WMAY27KK5xe6ADrAVi+OqE04A==","mode":420,"size":32},"package.json":{"checkedAt":1678883670412,"integrity":"sha512-Eul0ZnyxxvmmFevrDmsSELQJ8eqJWG1J19+ODa40AxBPX/vGk3TrBuYnqKuTTJK8VfR4aJOmTVPd9phdbJ82Og==","mode":420,"size":1504},"dist-node/index.js.map":{"checkedAt":1678883670414,"integrity":"sha512-KjJQImyi8TYr1qOuEJ3AS47LFW3BKw1MU7HtEOUm9pXiFxbVtRz803LLfYSEBDtekgw3zjZtt/ZjI2117mtg1g==","mode":420,"size":11011},"dist-web/index.js.map":{"checkedAt":1678883670415,"integrity":"sha512-jxPUFkXRMeOm1loUhxTmtakfN7Qp7wAFN4gM8vkFijMm2+6q02gfPHqRbbawPS6r0XQxs5292VQJUtQUNSKkGw==","mode":420,"size":11205},"README.md":{"checkedAt":1678883670420,"integrity":"sha512-RuxqfUXSbp8seyGdjqhLfxB6CZb8eO1FvbxuQSGn/NaokmUxaDvuXyLEIZm70jtzz5dQG+foYxtZWN612R17lg==","mode":420,"size":16340},"dist-types/fetch-wrapper.d.ts":{"checkedAt":1678883670420,"integrity":"sha512-OnOvovhjy71/ZPeCiHxF6Clss9jB+bDM+oDIbm19sm6UhPVEtVnao8aUxbd3dF01bB7+kX4d+OImPtAEs0Ap9w==","mode":420,"size":311},"dist-types/get-buffer-response.d.ts":{"checkedAt":1678883670420,"integrity":"sha512-VAO2FMq8rHWdEeF3H2g02b3XnX6ZpR84g3szggxwYFfQq5pUyjADN9ZMGSvphs8b+kXykSVSjBHei16iNIzT9Q==","mode":420,"size":124},"dist-types/index.d.ts":{"checkedAt":1678883670420,"integrity":"sha512-eaGoIgcQ2F9KBBE0XPzlDpeCFLhrxY1IHs9kIUd6LdAQrWOgDO15gVlm6g9aLp7A5A1mUycEEa4/J8ScBmFl6A==","mode":420,"size":81},"dist-types/version.d.ts":{"checkedAt":1678883670420,"integrity":"sha512-NpTPdluClaVWmfGNbQ6KMNXzCMheeDh+GEFAl8imEcW7mROqGcKAmrTAkEYkGKfOIE/8vHQnsSLKHVo93dQvNg==","mode":420,"size":40},"dist-types/with-defaults.d.ts":{"checkedAt":1678883670420,"integrity":"sha512-EneLytkUhxrMq60FuCCkBd1XYF50b547U7jYFjleFFTSXazmhYehRv15+w4lAdQVQxrG3zqbmfbOjdEtN84aDg==","mode":420,"size":209}}}
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"throwUnobservableError.js","sourceRoot":"","sources":["../../../../src/internal/util/throwUnobservableError.ts"],"names":[],"mappings":";;;AAIA,SAAgB,gCAAgC,CAAC,KAAU;IAEzD,OAAO,IAAI,SAAS,CAClB,mBACE,KAAK,KAAK,IAAI,IAAI,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,mBAAmB,CAAC,CAAC,CAAC,MAAI,KAAK,MAAG,8HACwC,CAC3H,CAAC;AACJ,CAAC;AAPD,4EAOC"}
|
||||
@@ -0,0 +1,24 @@
|
||||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const path_1 = __importDefault(require("path"));
|
||||
const ca_file_1 = require("./ca-file");
|
||||
it('should read CA file', () => {
|
||||
expect((0, ca_file_1.readCAFileSync)(path_1.default.join(__dirname, 'fixtures/ca-file1.txt'))).toStrictEqual([
|
||||
`-----BEGIN CERTIFICATE-----
|
||||
XXXX
|
||||
-----END CERTIFICATE-----`,
|
||||
`-----BEGIN CERTIFICATE-----
|
||||
YYYY
|
||||
-----END CERTIFICATE-----`,
|
||||
`-----BEGIN CERTIFICATE-----
|
||||
ZZZZ
|
||||
-----END CERTIFICATE-----`,
|
||||
]);
|
||||
});
|
||||
it('should not fail when the file does not exist', () => {
|
||||
expect((0, ca_file_1.readCAFileSync)(path_1.default.join(__dirname, 'not-exists.txt'))).toEqual(undefined);
|
||||
});
|
||||
//# sourceMappingURL=ca-file.spec.js.map
|
||||
@@ -0,0 +1 @@
|
||||
module.exports={C:{"2":0,"3":0,"4":0,"5":0,"6":0,"7":0,"8":0,"9":0,"10":0,"11":0,"12":0,"13":0,"14":0,"15":0,"16":0,"17":0,"18":0,"19":0,"20":0,"21":0,"22":0,"23":0,"24":0,"25":0,"26":0,"27":0,"28":0,"29":0,"30":0,"31":0,"32":0,"33":0,"34":0,"35":0,"36":0,"37":0,"38":0,"39":0,"40":0,"41":0,"42":0,"43":0,"44":0,"45":0,"46":0,"47":0,"48":0,"49":0,"50":0,"51":0,"52":0,"53":0,"54":0,"55":0,"56":0,"57":0,"58":0,"59":0,"60":0,"61":0,"62":0,"63":0,"64":0,"65":0,"66":0,"67":0,"68":0,"69":0,"70":0,"71":0,"72":0,"73":0,"74":0,"75":0,"76":0,"77":0,"78":0,"79":0,"80":0,"81":0,"82":0,"83":0,"84":0,"85":0,"86":0,"87":0,"88":0,"89":0,"90":0,"91":0,"92":0,"93":0,"94":0,"95":0,"96":0,"97":0,"98":0,"99":0,"100":0,"101":0,"102":0,"103":0,"104":0,"105":0.00658,"106":0,"107":0,"108":0.00658,"109":0.1097,"110":0.1097,"111":0.00878,"112":0,"3.5":0,"3.6":0},D:{"4":0,"5":0,"6":0,"7":0,"8":0,"9":0,"10":0,"11":0,"12":0,"13":0,"14":0,"15":0,"16":0,"17":0,"18":0,"19":0,"20":0,"21":0,"22":0,"23":0,"24":0,"25":0,"26":0,"27":0,"28":0,"29":0,"30":0,"31":0,"32":0,"33":0,"34":0,"35":0,"36":0,"37":0,"38":0,"39":0,"40":0,"41":0,"42":0,"43":0.00219,"44":0,"45":0,"46":0,"47":0,"48":0,"49":0,"50":0,"51":0,"52":0,"53":0.00219,"54":0,"55":0,"56":0,"57":0,"58":0,"59":0,"60":0,"61":0,"62":0,"63":0,"64":0.00219,"65":0,"66":0,"67":0.00219,"68":0.02413,"69":0.01316,"70":0.00439,"71":0,"72":0.00219,"73":0,"74":0.00878,"75":0.04169,"76":0,"77":0.00439,"78":0,"79":0.01097,"80":0.00219,"81":0.01755,"83":0.00439,"84":0,"85":0,"86":0,"87":0.05704,"88":0.00219,"89":0,"90":0.00219,"91":0.00878,"92":0.00658,"93":0.00878,"94":0.01755,"95":0.00219,"96":0.01975,"97":0,"98":0.00219,"99":0.0373,"100":0.00219,"101":0.00658,"102":0.01097,"103":0.04169,"104":0.02413,"105":0.01755,"106":0.00878,"107":0.03072,"108":0.13164,"109":1.63453,"110":1.38661,"111":0.00439,"112":0,"113":0},F:{"9":0,"11":0,"12":0,"15":0,"16":0,"17":0,"18":0,"19":0,"20":0,"21":0,"22":0,"23":0,"24":0,"25":0,"26":0,"27":0,"28":0,"29":0,"30":0,"31":0,"32":0,"33":0,"34":0,"35":0,"36":0,"37":0,"38":0,"39":0,"40":0,"41":0,"42":0.00219,"43":0,"44":0,"45":0,"46":0,"47":0,"48":0,"49":0,"50":0,"51":0,"52":0,"53":0,"54":0,"55":0,"56":0,"57":0,"58":0.01097,"60":0.01097,"62":0,"63":0.01316,"64":0.00439,"65":0.00219,"66":0.00658,"67":0.1821,"68":0.00219,"69":0,"70":0,"71":0,"72":0.00219,"73":0.00219,"74":0.00439,"75":0,"76":0,"77":0,"78":0,"79":0,"80":0,"81":0,"82":0,"83":0,"84":0,"85":0,"86":0,"87":0,"88":0,"89":0,"90":0,"91":0,"92":0,"93":0.00658,"94":0.05046,"95":0.05266,"9.5-9.6":0,"10.0-10.1":0,"10.5":0,"10.6":0,"11.1":0,"11.5":0,"11.6":0,"12.1":0},B:{"12":0.00439,"13":0,"14":0,"15":0,"16":0,"17":0.00219,"18":0.00658,"79":0,"80":0,"81":0,"83":0,"84":0.00219,"85":0,"86":0,"87":0,"88":0,"89":0.00219,"90":0.00219,"91":0,"92":0.00878,"93":0,"94":0,"95":0,"96":0,"97":0,"98":0,"99":0,"100":0,"101":0,"102":0,"103":0,"104":0,"105":0.00219,"106":0.00219,"107":0.00439,"108":0.01316,"109":0.17991,"110":0.23256},E:{"4":0,"5":0,"6":0,"7":0,"8":0,"9":0,"10":0,"11":0,"12":0,"13":0.00219,"14":0.00658,"15":0.00439,_:"0","3.1":0,"3.2":0,"5.1":0.00658,"6.1":0,"7.1":0,"9.1":0,"10.1":0,"11.1":0,"12.1":0,"13.1":0.00219,"14.1":0.02413,"15.1":0.00219,"15.2-15.3":0.00219,"15.4":0.00439,"15.5":0.00439,"15.6":0.04827,"16.0":0.00439,"16.1":0.01097,"16.2":0.01536,"16.3":0.02413,"16.4":0},G:{"8":0,"3.2":0,"4.0-4.1":0,"4.2-4.3":0,"5.0-5.1":0,"6.0-6.1":0.00258,"7.0-7.1":0.00258,"8.1-8.4":0,"9.0-9.2":0,"9.3":0.02453,"10.0-10.2":0,"10.3":0.03614,"11.0-11.2":0.00516,"11.3-11.4":0.01678,"12.0-12.1":0.02065,"12.2-12.5":0.70865,"13.0-13.1":0.02582,"13.2":0.01162,"13.3":0.07616,"13.4-13.7":0.20136,"14.0-14.4":0.67509,"14.5-14.8":0.78997,"15.0-15.1":0.38595,"15.2-15.3":0.29172,"15.4":0.33044,"15.5":0.63378,"15.6":0.74092,"16.0":1.56315,"16.1":1.85745,"16.2":1.76193,"16.3":1.6548,"16.4":0.01033},P:{"4":0.16247,"20":0.49756,"5.0-5.4":0.02031,"6.2-6.4":0.05077,"7.2-7.4":0.86311,"8.2":0,"9.2":0.19293,"10.1":0,"11.1-11.2":0.08123,"12.0":0.01015,"13.0":0.06093,"14.0":0.15231,"15.0":0.15231,"16.0":0.27417,"17.0":0.22339,"18.0":0.29447,"19.0":1.85823},I:{"0":0,"3":0,"4":0,"2.1":0,"2.2":0,"2.3":0,"4.1":0,"4.2-4.3":0.049,"4.4":0,"4.4.3-4.4.4":0.17294},K:{_:"0 10 11 12 11.1 11.5 12.1"},A:{"6":0,"7":0,"8":0,"9":0,"10":0,"11":0.00219,"5.5":0},N:{"10":0,"11":0},S:{"2.5":0,_:"3.0-3.1"},J:{"7":0,"10":0},O:{"0":1.56901},H:{"0":2.16533},L:{"0":72.3238},R:{_:"0"},M:{"0":0.04684},Q:{"13.1":0}};
|
||||
@@ -0,0 +1,31 @@
|
||||
# Polyfill for `Object.setPrototypeOf`
|
||||
|
||||
[](https://npmjs.org/package/setprototypeof)
|
||||
[](https://npmjs.org/package/setprototypeof)
|
||||
[](https://github.com/standard/standard)
|
||||
|
||||
A simple cross platform implementation to set the prototype of an instianted object. Supports all modern browsers and at least back to IE8.
|
||||
|
||||
## Usage:
|
||||
|
||||
```
|
||||
$ npm install --save setprototypeof
|
||||
```
|
||||
|
||||
```javascript
|
||||
var setPrototypeOf = require('setprototypeof')
|
||||
|
||||
var obj = {}
|
||||
setPrototypeOf(obj, {
|
||||
foo: function () {
|
||||
return 'bar'
|
||||
}
|
||||
})
|
||||
obj.foo() // bar
|
||||
```
|
||||
|
||||
TypeScript is also supported:
|
||||
|
||||
```typescript
|
||||
import setPrototypeOf from 'setprototypeof'
|
||||
```
|
||||
@@ -0,0 +1,22 @@
|
||||
'use strict'
|
||||
|
||||
const browsers = require('./browsers').browsers
|
||||
|
||||
function unpackRegion(packed) {
|
||||
return Object.keys(packed).reduce((list, browser) => {
|
||||
let data = packed[browser]
|
||||
list[browsers[browser]] = Object.keys(data).reduce((memo, key) => {
|
||||
let stats = data[key]
|
||||
if (key === '_') {
|
||||
stats.split(' ').forEach(version => (memo[version] = null))
|
||||
} else {
|
||||
memo[key] = stats
|
||||
}
|
||||
return memo
|
||||
}, {})
|
||||
return list
|
||||
}, {})
|
||||
}
|
||||
|
||||
module.exports = unpackRegion
|
||||
module.exports.default = unpackRegion
|
||||
@@ -0,0 +1,53 @@
|
||||
let flexSpec = require('./flex-spec')
|
||||
let Declaration = require('../declaration')
|
||||
|
||||
class FlexFlow extends Declaration {
|
||||
/**
|
||||
* Use two properties for 2009 spec
|
||||
*/
|
||||
insert(decl, prefix, prefixes) {
|
||||
let spec
|
||||
;[spec, prefix] = flexSpec(prefix)
|
||||
if (spec !== 2009) {
|
||||
return super.insert(decl, prefix, prefixes)
|
||||
}
|
||||
let values = decl.value
|
||||
.split(/\s+/)
|
||||
.filter(i => i !== 'wrap' && i !== 'nowrap' && 'wrap-reverse')
|
||||
if (values.length === 0) {
|
||||
return undefined
|
||||
}
|
||||
|
||||
let already = decl.parent.some(
|
||||
i =>
|
||||
i.prop === prefix + 'box-orient' || i.prop === prefix + 'box-direction'
|
||||
)
|
||||
if (already) {
|
||||
return undefined
|
||||
}
|
||||
|
||||
let value = values[0]
|
||||
let orient = value.includes('row') ? 'horizontal' : 'vertical'
|
||||
let dir = value.includes('reverse') ? 'reverse' : 'normal'
|
||||
|
||||
let cloned = this.clone(decl)
|
||||
cloned.prop = prefix + 'box-orient'
|
||||
cloned.value = orient
|
||||
if (this.needCascade(decl)) {
|
||||
cloned.raws.before = this.calcBefore(prefixes, decl, prefix)
|
||||
}
|
||||
decl.parent.insertBefore(decl, cloned)
|
||||
|
||||
cloned = this.clone(decl)
|
||||
cloned.prop = prefix + 'box-direction'
|
||||
cloned.value = dir
|
||||
if (this.needCascade(decl)) {
|
||||
cloned.raws.before = this.calcBefore(prefixes, decl, prefix)
|
||||
}
|
||||
return decl.parent.insertBefore(decl, cloned)
|
||||
}
|
||||
}
|
||||
|
||||
FlexFlow.names = ['flex-flow', 'box-direction', 'box-orient']
|
||||
|
||||
module.exports = FlexFlow
|
||||
@@ -0,0 +1,5 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.isArrayLike = void 0;
|
||||
exports.isArrayLike = (function (x) { return x && typeof x.length === 'number' && typeof x !== 'function'; });
|
||||
//# sourceMappingURL=isArrayLike.js.map
|
||||
@@ -0,0 +1,2 @@
|
||||
if(typeof cptable === 'undefined') cptable = {};
|
||||
cptable[20838] = (function(){ var d = "\u0002\u0003\t\u000b\f\r\u000e\u000f\u0010\u0011\u0012\u0013
\b\u0018\u0019\u001c\u001d\u001e\u001f\n\u0017\u001b\u0005\u0006\u0007\u0016\u0004\u0014\u0015\u001a กขฃคฅฆง[¢.<(+|&<26>จฉชซฌญฎ]!$*);¬-/ฏฐฑฒณดต^¦,%_>?฿๎ถทธนบปผ`:#@'=\"๏abcdefghiฝพฟภมย๚jklmnopqrรฤลฦวศ๛~stuvwxyzษสหฬอฮ๐๑๒๓๔๕๖๗๘๙ฯะัาำิ{ABCDEFGHI<48>ีึืุู}JKLMNOPQRฺเแโใไ\\<5C>STUVWXYZๅๆ็่้๊0123456789๋์ํ<E0B98C><E0B98D>", D = [], e = {}; for(var i=0;i!=d.length;++i) { if(d.charCodeAt(i) !== 0xFFFD) e[d.charAt(i)] = i; D[i] = d.charAt(i); } return {"enc": e, "dec": D }; })();
|
||||
@@ -0,0 +1,52 @@
|
||||
# is-interactive
|
||||
|
||||
> Check if stdout or stderr is [interactive](https://unix.stackexchange.com/a/43389/7678)
|
||||
|
||||
It checks that the stream is [TTY](https://jameshfisher.com/2017/12/09/what-is-a-tty/), not a dumb terminal, and not running in a CI.
|
||||
|
||||
This can be useful to decide whether to present interactive UI or animations in the terminal.
|
||||
|
||||
## Install
|
||||
|
||||
```
|
||||
$ npm install is-interactive
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
import isInteractive from 'is-interactive';
|
||||
|
||||
isInteractive();
|
||||
//=> true
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
### isInteractive(options?)
|
||||
|
||||
#### options
|
||||
|
||||
Type: `object`
|
||||
|
||||
##### stream
|
||||
|
||||
Type: [`stream.Writable`](https://nodejs.org/api/stream.html#stream_class_stream_writable)\
|
||||
Default: [`process.stdout`](https://nodejs.org/api/process.html#process_process_stdout)
|
||||
|
||||
The stream to check.
|
||||
|
||||
## FAQ
|
||||
|
||||
#### Why are you not using [`ci-info`](https://github.com/watson/ci-info) for the CI check?
|
||||
|
||||
It's silly to have to detect individual CIs. They should identify themselves with the `CI` environment variable, and most do just that. A manually maintained list of detections will easily get out of date. And if a package using `ci-info` doesn't update to the latest version all the time, they will not support certain CIs. It also creates unpredictability as you might assume a CI is not supported and then suddenly it gets supported and you didn't account for that. In addition, some of the manual detections are loose and might cause false-positives which could create hard-to-debug bugs.
|
||||
|
||||
#### Why does this even exist? It's just a few lines.
|
||||
|
||||
It's not about the number of lines, but rather discoverability and documentation. A lot of people wouldn't even know they need this. Feel free to copy-paste the code if you don't want the dependency. You might also want to read [this blog post](https://blog.sindresorhus.com/small-focused-modules-9238d977a92a).
|
||||
|
||||
## Related
|
||||
|
||||
- [is-unicode-supported](https://github.com/sindresorhus/is-unicode-supported) - Detect whether the terminal supports Unicode
|
||||
- [supports-color](https://github.com/chalk/supports-color) - Detect whether a terminal supports color
|
||||
@@ -0,0 +1,61 @@
|
||||
var tap = require("tap")
|
||||
, test = tap.test
|
||||
, ProtoList = require("../proto-list.js")
|
||||
|
||||
tap.plan(1)
|
||||
|
||||
tap.test("protoList tests", function (t) {
|
||||
var p = new ProtoList
|
||||
p.push({foo:"bar"})
|
||||
p.push({})
|
||||
p.set("foo", "baz")
|
||||
t.equal(p.get("foo"), "baz")
|
||||
|
||||
var p = new ProtoList
|
||||
p.push({foo:"bar"})
|
||||
p.set("foo", "baz")
|
||||
t.equal(p.get("foo"), "baz")
|
||||
t.equal(p.length, 1)
|
||||
p.pop()
|
||||
t.equal(p.length, 0)
|
||||
p.set("foo", "asdf")
|
||||
t.equal(p.length, 1)
|
||||
t.equal(p.get("foo"), "asdf")
|
||||
p.push({bar:"baz"})
|
||||
t.equal(p.length, 2)
|
||||
t.equal(p.get("foo"), "asdf")
|
||||
p.shift()
|
||||
t.equal(p.length, 1)
|
||||
t.equal(p.get("foo"), undefined)
|
||||
|
||||
|
||||
p.unshift({foo:"blo", bar:"rab"})
|
||||
p.unshift({foo:"boo"})
|
||||
t.equal(p.length, 3)
|
||||
t.equal(p.get("foo"), "boo")
|
||||
t.equal(p.get("bar"), "rab")
|
||||
|
||||
var ret = p.splice(1, 1, {bar:"bar"})
|
||||
t.same(ret, [{foo:"blo", bar:"rab"}])
|
||||
t.equal(p.get("bar"), "bar")
|
||||
|
||||
// should not inherit default object properties
|
||||
t.equal(p.get('hasOwnProperty'), undefined)
|
||||
|
||||
// unless we give it those.
|
||||
p.root = {}
|
||||
t.equal(p.get('hasOwnProperty'), {}.hasOwnProperty)
|
||||
|
||||
p.root = {default:'monkey'}
|
||||
t.equal(p.get('default'), 'monkey')
|
||||
|
||||
p.push({red:'blue'})
|
||||
p.push({red:'blue'})
|
||||
p.push({red:'blue'})
|
||||
while (p.length) {
|
||||
t.equal(p.get('default'), 'monkey')
|
||||
p.shift()
|
||||
}
|
||||
|
||||
t.end()
|
||||
})
|
||||
@@ -0,0 +1,11 @@
|
||||
"use strict";;
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var tslib_1 = require("tslib");
|
||||
var babel_core_1 = tslib_1.__importDefault(require("./babel-core"));
|
||||
var flow_1 = tslib_1.__importDefault(require("./flow"));
|
||||
function default_1(fork) {
|
||||
fork.use(babel_core_1.default);
|
||||
fork.use(flow_1.default);
|
||||
}
|
||||
exports.default = default_1;
|
||||
module.exports = exports["default"];
|
||||
Reference in New Issue
Block a user