new license file version [CI SKIP]

This commit is contained in:
2023-03-15 12:34:41 +00:00
parent 0a6d92a1f3
commit 61328d20ed
13115 changed files with 1892314 additions and 1 deletions

View File

@@ -0,0 +1 @@
{"version":3,"file":"agent.js","sourceRoot":"","sources":["../src/agent.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,8CAAsB;AAEtB,8CAAsB;AACtB,8CAAsB;AACtB,kDAAgC;AAChC,2CAAkE;AAClE,iCAAoE;AAGpE,MAAM,KAAK,GAAG,eAAW,CAAC,mBAAmB,CAAC,CAAC;AAE/C,SAAS,SAAS,CAAC,IAAY;IAC9B,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QACtC,aAAG,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE;YAC7B,IAAI,GAAG,EAAE;gBACR,MAAM,CAAC,GAAG,CAAC,CAAC;aACZ;iBAAM;gBACN,OAAO,CAAC,GAAG,CAAC,CAAC;aACb;QACF,CAAC,CAAC,CAAC;IACJ,CAAC,CAAC,CAAC;AACJ,CAAC;AAED,SAAS,eAAe,CACvB,IAA4B;IAE5B,IAAI,IAAI,GAAG,CAAC,CAAC;IACb,IAAI,MAAM,GAAG,KAAK,CAAC;IACnB,IAAI,IAAI,GAAuB,CAAC,CAAC;IAEjC,0DAA0D;IAC1D,MAAM,IAAI,GAAG,IAAI,CAAC,QAAQ,IAAI,IAAI,CAAC,IAAI,CAAC;IACxC,IAAI,CAAC,IAAI,EAAE;QACV,MAAM,IAAI,SAAS,CAAC,WAAW,CAAC,CAAC;KACjC;IAED,IAAI,OAAO,IAAI,CAAC,IAAI,KAAK,QAAQ,EAAE;QAClC,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC;KACjB;SAAM,IAAI,OAAO,IAAI,CAAC,IAAI,KAAK,QAAQ,EAAE;QACzC,IAAI,GAAG,QAAQ,CAAC,IAAI,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;KAC/B;IAED,0EAA0E;IAC1E,iEAAiE;IACjE,IAAI,CAAC,IAAI,EAAE;QACV,IAAI,GAAG,IAAI,CAAC;KACZ;IAED,sEAAsE;IACtE,iBAAiB;IACjB,IAAI,IAAI,CAAC,QAAQ,EAAE;QAClB,QAAQ,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,CAAC,EAAE;YACvC,KAAK,QAAQ;gBACZ,MAAM,GAAG,IAAI,CAAC;YACf,eAAe;YACf,KAAK,SAAS;gBACb,IAAI,GAAG,CAAC,CAAC;gBACT,MAAM;YACP,KAAK,QAAQ;gBACZ,MAAM,GAAG,IAAI,CAAC;YACf,eAAe;YACf,KAAK,OAAO,CAAC,CAAC,sCAAsC;YACpD,KAAK,SAAS;gBACb,IAAI,GAAG,CAAC,CAAC;gBACT,MAAM;YACP;gBACC,MAAM,IAAI,SAAS,CAClB,8CAA8C,IAAI,CAAC,QAAQ,EAAE,CAC7D,CAAC;SACH;KACD;IAED,IAAI,OAAO,IAAI,CAAC,IAAI,KAAK,WAAW,EAAE;QACrC,IAAI,IAAI,CAAC,IAAI,KAAK,CAAC,IAAI,IAAI,CAAC,IAAI,KAAK,CAAC,EAAE;YACvC,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC;SACjB;aAAM;YACN,MAAM,IAAI,SAAS,CAAC,+BAA+B,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC;SAChE;KACD;IAED,MAAM,KAAK,GAAe;QACzB,IAAI;QACJ,IAAI;QACJ,IAAI;KACJ,CAAC;IAEF,IAAI,MAAM,GAAG,IAAI,CAAC,MAAM,IAAI,IAAI,CAAC,QAAQ,CAAC;IAC1C,IAAI,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC;IAC7B,IAAI,IAAI,CAAC,IAAI,EAAE;QACd,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QAClC,MAAM,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;QACjB,QAAQ,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;KACnB;IACD,IAAI,MAAM,EAAE;QACX,MAAM,CAAC,cAAc,CAAC,KAAK,EAAE,QAAQ,EAAE;YACtC,KAAK,EAAE,MAAM;YACb,UAAU,EAAE,KAAK;SACjB,CAAC,CAAC;KACH;IACD,IAAI,QAAQ,EAAE;QACb,MAAM,CAAC,cAAc,CAAC,KAAK,EAAE,UAAU,EAAE;YACxC,KAAK,EAAE,QAAQ;YACf,UAAU,EAAE,KAAK;SACjB,CAAC,CAAC;KACH;IAED,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC;AAC1B,CAAC;AAED;;;;GAIG;AACH,MAAqB,eAAgB,SAAQ,kBAAK;IAIjD,YAAY,KAAsC;QACjD,IAAI,IAA4B,CAAC;QACjC,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE;YAC9B,IAAI,GAAG,aAAG,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;SACxB;aAAM;YACN,IAAI,GAAG,KAAK,CAAC;SACb;QACD,IAAI,CAAC,IAAI,EAAE;YACV,MAAM,IAAI,SAAS,CAClB,2DAA2D,CAC3D,CAAC;SACF;QACD,KAAK,CAAC,IAAI,CAAC,CAAC;QAEZ,MAAM,WAAW,GAAG,eAAe,CAAC,IAAI,CAAC,CAAC;QAC1C,IAAI,CAAC,MAAM,GAAG,WAAW,CAAC,MAAM,CAAC;QACjC,IAAI,CAAC,KAAK,GAAG,WAAW,CAAC,KAAK,CAAC;IAChC,CAAC;IAED;;;;;OAKG;IACG,QAAQ,CACb,GAAkB,EAClB,IAAoB;;YAEpB,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,IAAI,CAAC;YAC/B,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC;YAEnC,IAAI,CAAC,IAAI,EAAE;gBACV,MAAM,IAAI,KAAK,CAAC,oBAAoB,CAAC,CAAC;aACtC;YAED,IAAI,MAAM,EAAE;gBACX,mEAAmE;gBACnE,IAAI,GAAG,MAAM,SAAS,CAAC,IAAI,CAAC,CAAC;aAC7B;YAED,MAAM,SAAS,GAAuB;gBACrC,KAAK;gBACL,WAAW,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE;gBAC3B,OAAO,EAAE,SAAS;gBAClB,OAAO;aACP,CAAC;YACF,KAAK,CAAC,qCAAqC,EAAE,SAAS,CAAC,CAAC;YACxD,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,mBAAW,CAAC,gBAAgB,CAAC,SAAS,CAAC,CAAC;YACjE,KAAK,CAAC,6CAA6C,CAAC,CAAC;YAErD,IAAI,IAAI,CAAC,cAAc,EAAE;gBACxB,sDAAsD;gBACtD,8CAA8C;gBAC9C,KAAK,CAAC,oCAAoC,CAAC,CAAC;gBAC5C,MAAM,UAAU,GAAG,IAAI,CAAC,UAAU,IAAI,IAAI,CAAC;gBAC3C,OAAO,aAAG,CAAC,OAAO,iCACd,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,CAAC,KACjD,MAAM;oBACN,UAAU,IACT,CAAC;aACH;YAED,OAAO,MAAM,CAAC;QACf,CAAC;KAAA;CACD;AArED,kCAqEC;AAED,SAAS,IAAI,CACZ,GAAM,EACN,GAAG,IAAO;IAIV,MAAM,GAAG,GAAG,EAEX,CAAC;IACF,IAAI,GAAqB,CAAC;IAC1B,KAAK,GAAG,IAAI,GAAG,EAAE;QAChB,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE;YACxB,GAAG,CAAC,GAAG,CAAC,GAAG,GAAG,CAAC,GAAG,CAAC,CAAC;SACpB;KACD;IACD,OAAO,GAAG,CAAC;AACZ,CAAC"}

View File

@@ -0,0 +1,5 @@
var convert = require('./convert'),
func = convert('isArray', require('../isArray'), require('./_falseOptions'));
func.placeholder = require('./placeholder');
module.exports = func;

View File

@@ -0,0 +1,101 @@
{
"name": "string.prototype.trim",
"version": "1.2.7",
"author": {
"name": "Jordan Harband",
"email": "ljharb@gmail.com",
"url": "http://ljharb.codes"
},
"funding": {
"url": "https://github.com/sponsors/ljharb"
},
"contributors": [
{
"name": "Jordan Harband",
"email": "ljharb@gmail.com",
"url": "http://ljharb.codes"
}
],
"description": "ES5 spec-compliant shim for String.prototype.trim",
"license": "MIT",
"main": "index.js",
"scripts": {
"prepack": "npmignore --auto --commentLines=autogenerated",
"prepublish": "not-in-publish || npm run prepublishOnly",
"prepublishOnly": "safe-publish-latest",
"pretest": "npm run lint",
"test": "npm run tests-only",
"posttest": "aud --production",
"tests-only": "nyc tape 'test/**/*.js'",
"lint": "eslint --ext=js,mjs .",
"postlint": "es-shim-api --bound",
"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://github.com/es-shims/String.prototype.trim.git"
},
"keywords": [
"String.prototype.trim",
"string",
"ES5",
"shim",
"trim",
"polyfill",
"es-shim API"
],
"dependencies": {
"call-bind": "^1.0.2",
"define-properties": "^1.1.4",
"es-abstract": "^1.20.4"
},
"devDependencies": {
"@es-shims/api": "^2.2.3",
"@ljharb/eslint-config": "^21.0.0",
"aud": "^2.0.1",
"auto-changelog": "^2.4.0",
"eslint": "=8.8.0",
"functions-have-names": "^1.2.3",
"has-strict-mode": "^1.0.1",
"in-publish": "^2.0.1",
"npmignore": "^0.3.0",
"nyc": "^10.3.2",
"safe-publish-latest": "^2.0.0",
"tape": "^5.6.1"
},
"testling": {
"files": "test/index.js",
"browsers": [
"iexplore/9.0..latest",
"firefox/4.0..6.0",
"firefox/15.0..latest",
"firefox/nightly",
"chrome/4.0..10.0",
"chrome/20.0..latest",
"chrome/canary",
"opera/11.6..latest",
"opera/next",
"safari/5.0..latest",
"ipad/6.0..latest",
"iphone/6.0..latest",
"android-browser/4.2"
]
},
"engines": {
"node": ">= 0.4"
},
"auto-changelog": {
"output": "CHANGELOG.md",
"template": "keepachangelog",
"unreleased": false,
"commitLimit": false,
"backfillLimit": false,
"hideCredit": true
},
"publishConfig": {
"ignore": [
".github/workflows"
]
}
}

View File

@@ -0,0 +1,14 @@
import Node from './shared/Node';
import Expression from './shared/Expression';
import Component from '../Component';
import TemplateScope from './shared/TemplateScope';
import { TemplateNode } from '../../interfaces';
import Element from './Element';
export default class Transition extends Node {
type: 'Transition';
name: string;
directive: string;
expression: Expression;
is_local: boolean;
constructor(component: Component, parent: Element, scope: TemplateScope, info: TemplateNode);
}

View File

@@ -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.01518,"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.0038,"48":0,"49":0,"50":0,"51":0,"52":0.08351,"53":0,"54":0,"55":0,"56":0.00759,"57":0,"58":0,"59":0,"60":0.0038,"61":0,"62":0,"63":0.0038,"64":0.0038,"65":0,"66":0,"67":0,"68":0.0038,"69":0,"70":0,"71":0,"72":0.01139,"73":0,"74":0,"75":0,"76":0,"77":0.04555,"78":0,"79":0,"80":0,"81":0,"82":0,"83":0,"84":0.00759,"85":0,"86":0,"87":0,"88":0.01898,"89":0.01518,"90":0.0038,"91":0.00759,"92":0,"93":0,"94":0,"95":0.0038,"96":0,"97":0.00759,"98":0.01139,"99":0.00759,"100":0,"101":0,"102":0.01518,"103":0.00759,"104":0.0038,"105":0.0038,"106":0.01139,"107":0.02657,"108":0.01898,"109":0.763,"110":0.55042,"111":0.08731,"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.01139,"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.0038,"32":0,"33":0.0038,"34":0,"35":0,"36":0,"37":0,"38":0.00759,"39":0,"40":0.01518,"41":0,"42":0.0038,"43":0.03416,"44":0,"45":0,"46":0.0038,"47":0,"48":0,"49":0,"50":0.0038,"51":0,"52":0,"53":0.0038,"54":0,"55":0.0038,"56":0.01898,"57":0.0038,"58":0.01518,"59":0,"60":0,"61":0,"62":0,"63":0.0038,"64":0.0038,"65":0.02278,"66":0.0038,"67":0.0038,"68":0,"69":0.00759,"70":0.03037,"71":0.01139,"72":0.01518,"73":0.01518,"74":0.02278,"75":0.00759,"76":0.00759,"77":0.00759,"78":0.0038,"79":0.2847,"80":0.01139,"81":0.05314,"83":0.01898,"84":0.0038,"85":0.0038,"86":0.01139,"87":0.01898,"88":0.00759,"89":0.00759,"90":0.01518,"91":0.01898,"92":0.02278,"93":0.03416,"94":0.00759,"95":0.02278,"96":0.02278,"97":0.01518,"98":0.16323,"99":0.00759,"100":0.01518,"101":0.00759,"102":0.02278,"103":0.04555,"104":0.03037,"105":0.04555,"106":0.03037,"107":0.04935,"108":0.16323,"109":4.82472,"110":2.40287,"111":0.01518,"112":0.00759,"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.0038,"25":0,"26":0.0038,"27":0.01518,"28":0.01898,"29":0,"30":0.00759,"31":0,"32":0.01139,"33":0.0038,"34":0,"35":0,"36":0,"37":0.0038,"38":0.0038,"39":0,"40":0,"41":0,"42":0.00759,"43":0,"44":0,"45":0,"46":0.0038,"47":0.0038,"48":0,"49":0,"50":0.00759,"51":0,"52":0,"53":0,"54":0.0038,"55":0,"56":0,"57":0.0038,"58":0.0038,"60":0.03796,"62":0,"63":0.01898,"64":0.00759,"65":0.0038,"66":0.01139,"67":0.186,"68":0,"69":0,"70":0.00759,"71":0,"72":0,"73":0.01518,"74":0.0038,"75":0,"76":0,"77":0,"78":0,"79":0.01139,"80":0,"81":0,"82":0,"83":0.0038,"84":0,"85":0.0038,"86":0.0038,"87":0,"88":0,"89":0,"90":0,"91":0.0038,"92":0.01139,"93":0.0038,"94":0.25813,"95":0.45172,"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.01898},B:{"12":0.00759,"13":0.0038,"14":0.0038,"15":0.0038,"16":0.0038,"17":0.0038,"18":0.06453,"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.01139,"93":0,"94":0,"95":0,"96":0,"97":0,"98":0,"99":0,"100":0,"101":0,"102":0.01518,"103":0.0038,"104":0.0038,"105":0.0038,"106":0,"107":0.00759,"108":0.03416,"109":0.53144,"110":0.5732},E:{"4":0,"5":0,"6":0,"7":0.01518,"8":0,"9":0,"10":0,"11":0,"12":0,"13":0,"14":0.0038,"15":0,_:"0","3.1":0,"3.2":0,"5.1":0,"6.1":0,"7.1":0,"9.1":0,"10.1":0,"11.1":0,"12.1":0.0038,"13.1":0.0038,"14.1":0.00759,"15.1":0,"15.2-15.3":0,"15.4":0,"15.5":0.0038,"15.6":0.08731,"16.0":0,"16.1":0,"16.2":0.0038,"16.3":0.0038,"16.4":0},G:{"8":0,"3.2":0,"4.0-4.1":0,"4.2-4.3":0,"5.0-5.1":0.01333,"6.0-6.1":0.01,"7.0-7.1":0.37128,"8.1-8.4":0.02066,"9.0-9.2":0.09399,"9.3":0.36928,"10.0-10.2":0.001,"10.3":0.12698,"11.0-11.2":0.04199,"11.3-11.4":0.03699,"12.0-12.1":0.04433,"12.2-12.5":0.6689,"13.0-13.1":0.01866,"13.2":0.00767,"13.3":0.04099,"13.4-13.7":0.03066,"14.0-14.4":0.12598,"14.5-14.8":0.15631,"15.0-15.1":0.07632,"15.2-15.3":0.09165,"15.4":0.06699,"15.5":0.09332,"15.6":0.14631,"16.0":0.08199,"16.1":0.15298,"16.2":0.16464,"16.3":0.09132,"16.4":0},P:{"4":0.72532,"20":0.07253,"5.0-5.4":0.01036,"6.2-6.4":0.03108,"7.2-7.4":0.27976,"8.2":0.01036,"9.2":0.03108,"10.1":0,"11.1-11.2":0.01036,"12.0":0.01036,"13.0":0.08289,"14.0":0.03108,"15.0":0.01036,"16.0":0.10362,"17.0":0.09325,"18.0":0.04145,"19.0":0.43519},I:{"0":0,"3":0,"4":0,"2.1":0,"2.2":0,"2.3":0,"4.1":0.00669,"4.2-4.3":0.08192,"4.4":0,"4.4.3-4.4.4":0.45184},K:{_:"0 10 11 12 11.1 11.5 12.1"},A:{"6":0,"7":0,"8":0,"9":0,"10":0,"11":0.02278,"5.5":0},N:{"10":0,"11":0},S:{"2.5":0.33502,_:"3.0-3.1"},J:{"7":0,"10":0},O:{"0":0.91199},H:{"0":4.27007},L:{"0":70.97862},R:{_:"0"},M:{"0":0.07445},Q:{"13.1":0.01861}};

View File

@@ -0,0 +1,408 @@
(function (global, factory) {
if (typeof define === "function" && define.amd) {
define('localforage', ['module', 'exports', './drivers/indexeddb', './drivers/websql', './drivers/localstorage', './utils/serializer', './utils/promise', './utils/executeCallback', './utils/executeTwoCallbacks', './utils/includes', './utils/isArray'], factory);
} else if (typeof exports !== "undefined") {
factory(module, exports, require('./drivers/indexeddb'), require('./drivers/websql'), require('./drivers/localstorage'), require('./utils/serializer'), require('./utils/promise'), require('./utils/executeCallback'), require('./utils/executeTwoCallbacks'), require('./utils/includes'), require('./utils/isArray'));
} else {
var mod = {
exports: {}
};
factory(mod, mod.exports, global.indexeddb, global.websql, global.localstorage, global.serializer, global.promise, global.executeCallback, global.executeTwoCallbacks, global.includes, global.isArray);
global.localforage = mod.exports;
}
})(this, function (module, exports, _indexeddb, _websql, _localstorage, _serializer, _promise, _executeCallback, _executeTwoCallbacks, _includes, _isArray) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _indexeddb2 = _interopRequireDefault(_indexeddb);
var _websql2 = _interopRequireDefault(_websql);
var _localstorage2 = _interopRequireDefault(_localstorage);
var _serializer2 = _interopRequireDefault(_serializer);
var _promise2 = _interopRequireDefault(_promise);
var _executeCallback2 = _interopRequireDefault(_executeCallback);
var _executeTwoCallbacks2 = _interopRequireDefault(_executeTwoCallbacks);
var _includes2 = _interopRequireDefault(_includes);
var _isArray2 = _interopRequireDefault(_isArray);
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
}
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) {
return typeof obj;
} : function (obj) {
return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
};
function _classCallCheck(instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError("Cannot call a class as a function");
}
}
// Drivers are stored here when `defineDriver()` is called.
// They are shared across all instances of localForage.
var DefinedDrivers = {};
var DriverSupport = {};
var DefaultDrivers = {
INDEXEDDB: _indexeddb2.default,
WEBSQL: _websql2.default,
LOCALSTORAGE: _localstorage2.default
};
var DefaultDriverOrder = [DefaultDrivers.INDEXEDDB._driver, DefaultDrivers.WEBSQL._driver, DefaultDrivers.LOCALSTORAGE._driver];
var OptionalDriverMethods = ['dropInstance'];
var LibraryMethods = ['clear', 'getItem', 'iterate', 'key', 'keys', 'length', 'removeItem', 'setItem'].concat(OptionalDriverMethods);
var DefaultConfig = {
description: '',
driver: DefaultDriverOrder.slice(),
name: 'localforage',
// Default DB size is _JUST UNDER_ 5MB, as it's the highest size
// we can use without a prompt.
size: 4980736,
storeName: 'keyvaluepairs',
version: 1.0
};
function callWhenReady(localForageInstance, libraryMethod) {
localForageInstance[libraryMethod] = function () {
var _args = arguments;
return localForageInstance.ready().then(function () {
return localForageInstance[libraryMethod].apply(localForageInstance, _args);
});
};
}
function extend() {
for (var i = 1; i < arguments.length; i++) {
var arg = arguments[i];
if (arg) {
for (var key in arg) {
if (arg.hasOwnProperty(key)) {
if ((0, _isArray2.default)(arg[key])) {
arguments[0][key] = arg[key].slice();
} else {
arguments[0][key] = arg[key];
}
}
}
}
}
return arguments[0];
}
var LocalForage = function () {
function LocalForage(options) {
_classCallCheck(this, LocalForage);
for (var driverTypeKey in DefaultDrivers) {
if (DefaultDrivers.hasOwnProperty(driverTypeKey)) {
var driver = DefaultDrivers[driverTypeKey];
var driverName = driver._driver;
this[driverTypeKey] = driverName;
if (!DefinedDrivers[driverName]) {
// we don't need to wait for the promise,
// since the default drivers can be defined
// in a blocking manner
this.defineDriver(driver);
}
}
}
this._defaultConfig = extend({}, DefaultConfig);
this._config = extend({}, this._defaultConfig, options);
this._driverSet = null;
this._initDriver = null;
this._ready = false;
this._dbInfo = null;
this._wrapLibraryMethodsWithReady();
this.setDriver(this._config.driver).catch(function () {});
}
// Set any config values for localForage; can be called anytime before
// the first API call (e.g. `getItem`, `setItem`).
// We loop through options so we don't overwrite existing config
// values.
LocalForage.prototype.config = function config(options) {
// If the options argument is an object, we use it to set values.
// Otherwise, we return either a specified config value or all
// config values.
if ((typeof options === 'undefined' ? 'undefined' : _typeof(options)) === 'object') {
// If localforage is ready and fully initialized, we can't set
// any new configuration values. Instead, we return an error.
if (this._ready) {
return new Error("Can't call config() after localforage " + 'has been used.');
}
for (var i in options) {
if (i === 'storeName') {
options[i] = options[i].replace(/\W/g, '_');
}
if (i === 'version' && typeof options[i] !== 'number') {
return new Error('Database version must be a number.');
}
this._config[i] = options[i];
}
// after all config options are set and
// the driver option is used, try setting it
if ('driver' in options && options.driver) {
return this.setDriver(this._config.driver);
}
return true;
} else if (typeof options === 'string') {
return this._config[options];
} else {
return this._config;
}
};
LocalForage.prototype.defineDriver = function defineDriver(driverObject, callback, errorCallback) {
var promise = new _promise2.default(function (resolve, reject) {
try {
var driverName = driverObject._driver;
var complianceError = new Error('Custom driver not compliant; see ' + 'https://mozilla.github.io/localForage/#definedriver');
// A driver name should be defined and not overlap with the
// library-defined, default drivers.
if (!driverObject._driver) {
reject(complianceError);
return;
}
var driverMethods = LibraryMethods.concat('_initStorage');
for (var i = 0, len = driverMethods.length; i < len; i++) {
var driverMethodName = driverMethods[i];
// when the property is there,
// it should be a method even when optional
var isRequired = !(0, _includes2.default)(OptionalDriverMethods, driverMethodName);
if ((isRequired || driverObject[driverMethodName]) && typeof driverObject[driverMethodName] !== 'function') {
reject(complianceError);
return;
}
}
var configureMissingMethods = function configureMissingMethods() {
var methodNotImplementedFactory = function methodNotImplementedFactory(methodName) {
return function () {
var error = new Error('Method ' + methodName + ' is not implemented by the current driver');
var promise = _promise2.default.reject(error);
(0, _executeCallback2.default)(promise, arguments[arguments.length - 1]);
return promise;
};
};
for (var _i = 0, _len = OptionalDriverMethods.length; _i < _len; _i++) {
var optionalDriverMethod = OptionalDriverMethods[_i];
if (!driverObject[optionalDriverMethod]) {
driverObject[optionalDriverMethod] = methodNotImplementedFactory(optionalDriverMethod);
}
}
};
configureMissingMethods();
var setDriverSupport = function setDriverSupport(support) {
if (DefinedDrivers[driverName]) {
console.info('Redefining LocalForage driver: ' + driverName);
}
DefinedDrivers[driverName] = driverObject;
DriverSupport[driverName] = support;
// don't use a then, so that we can define
// drivers that have simple _support methods
// in a blocking manner
resolve();
};
if ('_support' in driverObject) {
if (driverObject._support && typeof driverObject._support === 'function') {
driverObject._support().then(setDriverSupport, reject);
} else {
setDriverSupport(!!driverObject._support);
}
} else {
setDriverSupport(true);
}
} catch (e) {
reject(e);
}
});
(0, _executeTwoCallbacks2.default)(promise, callback, errorCallback);
return promise;
};
LocalForage.prototype.driver = function driver() {
return this._driver || null;
};
LocalForage.prototype.getDriver = function getDriver(driverName, callback, errorCallback) {
var getDriverPromise = DefinedDrivers[driverName] ? _promise2.default.resolve(DefinedDrivers[driverName]) : _promise2.default.reject(new Error('Driver not found.'));
(0, _executeTwoCallbacks2.default)(getDriverPromise, callback, errorCallback);
return getDriverPromise;
};
LocalForage.prototype.getSerializer = function getSerializer(callback) {
var serializerPromise = _promise2.default.resolve(_serializer2.default);
(0, _executeTwoCallbacks2.default)(serializerPromise, callback);
return serializerPromise;
};
LocalForage.prototype.ready = function ready(callback) {
var self = this;
var promise = self._driverSet.then(function () {
if (self._ready === null) {
self._ready = self._initDriver();
}
return self._ready;
});
(0, _executeTwoCallbacks2.default)(promise, callback, callback);
return promise;
};
LocalForage.prototype.setDriver = function setDriver(drivers, callback, errorCallback) {
var self = this;
if (!(0, _isArray2.default)(drivers)) {
drivers = [drivers];
}
var supportedDrivers = this._getSupportedDrivers(drivers);
function setDriverToConfig() {
self._config.driver = self.driver();
}
function extendSelfWithDriver(driver) {
self._extend(driver);
setDriverToConfig();
self._ready = self._initStorage(self._config);
return self._ready;
}
function initDriver(supportedDrivers) {
return function () {
var currentDriverIndex = 0;
function driverPromiseLoop() {
while (currentDriverIndex < supportedDrivers.length) {
var driverName = supportedDrivers[currentDriverIndex];
currentDriverIndex++;
self._dbInfo = null;
self._ready = null;
return self.getDriver(driverName).then(extendSelfWithDriver).catch(driverPromiseLoop);
}
setDriverToConfig();
var error = new Error('No available storage method found.');
self._driverSet = _promise2.default.reject(error);
return self._driverSet;
}
return driverPromiseLoop();
};
}
// There might be a driver initialization in progress
// so wait for it to finish in order to avoid a possible
// race condition to set _dbInfo
var oldDriverSetDone = this._driverSet !== null ? this._driverSet.catch(function () {
return _promise2.default.resolve();
}) : _promise2.default.resolve();
this._driverSet = oldDriverSetDone.then(function () {
var driverName = supportedDrivers[0];
self._dbInfo = null;
self._ready = null;
return self.getDriver(driverName).then(function (driver) {
self._driver = driver._driver;
setDriverToConfig();
self._wrapLibraryMethodsWithReady();
self._initDriver = initDriver(supportedDrivers);
});
}).catch(function () {
setDriverToConfig();
var error = new Error('No available storage method found.');
self._driverSet = _promise2.default.reject(error);
return self._driverSet;
});
(0, _executeTwoCallbacks2.default)(this._driverSet, callback, errorCallback);
return this._driverSet;
};
LocalForage.prototype.supports = function supports(driverName) {
return !!DriverSupport[driverName];
};
LocalForage.prototype._extend = function _extend(libraryMethodsAndProperties) {
extend(this, libraryMethodsAndProperties);
};
LocalForage.prototype._getSupportedDrivers = function _getSupportedDrivers(drivers) {
var supportedDrivers = [];
for (var i = 0, len = drivers.length; i < len; i++) {
var driverName = drivers[i];
if (this.supports(driverName)) {
supportedDrivers.push(driverName);
}
}
return supportedDrivers;
};
LocalForage.prototype._wrapLibraryMethodsWithReady = function _wrapLibraryMethodsWithReady() {
// Add a stub for each driver API method that delays the call to the
// corresponding driver method until localForage is ready. These stubs
// will be replaced by the driver methods as soon as the driver is
// loaded, so there is no performance impact.
for (var i = 0, len = LibraryMethods.length; i < len; i++) {
callWhenReady(this, LibraryMethods[i]);
}
};
LocalForage.prototype.createInstance = function createInstance(options) {
return new LocalForage(options);
};
return LocalForage;
}();
exports.default = new LocalForage();
module.exports = exports['default'];
});

View File

@@ -0,0 +1,105 @@
import prettier from 'prettier'
import { corePlugins } from '../src/corePlugins'
import colors from '../src/public/colors'
import defaultTheme from '../src/public/default-theme'
import fs from 'fs'
import path from 'path'
import * as types from './type-utils'
fs.writeFileSync(
path.join(process.cwd(), 'types', 'generated', 'corePluginList.d.ts'),
`export type CorePluginList = ${Object.keys(corePlugins)
.map((p) => `'${p}'`)
.join(' | ')}`
)
let colorsWithoutDeprecatedColors = Object.fromEntries(
Object.entries(Object.getOwnPropertyDescriptors(colors))
.filter(([_, { value }]) => {
return typeof value !== 'undefined'
})
.map(([name, definition]) => [name, definition.value])
)
let deprecatedColors = Object.entries(Object.getOwnPropertyDescriptors(colors))
.filter(([_, { value }]) => {
return typeof value === 'undefined'
})
.map(([name, definition]) => {
let warn = console.warn
let messages = []
console.warn = (...args) => messages.push(args.pop())
definition.get()
console.warn = warn
let message = messages.join(' ').trim()
let newColor = message.match(/renamed to `(.*)`/)[1]
return `/** @deprecated ${message} */${name}: DefaultColors['${newColor}'],`
})
.join('\n')
fs.writeFileSync(
path.join(process.cwd(), 'types', 'generated', 'colors.d.ts'),
prettier.format(
`export interface DefaultColors { ${JSON.stringify(colorsWithoutDeprecatedColors).slice(
1,
-1
)}\n${deprecatedColors}\n}`,
{
semi: false,
singleQuote: true,
printWidth: 100,
parser: 'typescript',
}
)
)
const defaultThemeTypes = Object.entries(defaultTheme)
.map(([name, value]) => {
// Special cases for slightly more accurate types
if (name === 'keyframes') {
return [name, `Record<${types.forKeys(value)}, Record<string, CSSDeclarationList>>`]
}
if (name === 'fontSize') {
return [name, `Record<${types.forKeys(value)}, [string, { lineHeight: string }]>`]
}
// General cases
if (typeof value === 'string') {
return [name, `string`]
}
if (typeof value === 'function') {
return [name, null]
}
if (typeof value === 'object') {
if (Object.keys(value).length === 0) {
return [name, null]
}
return [name, types.forValue(value)]
}
return [name, `unknown`]
})
.filter(([, type]) => type !== null)
.map(([name, type]) => `${name}: ${type}`)
.join('\n')
fs.writeFileSync(
path.join(process.cwd(), 'types', 'generated', 'default-theme.d.ts'),
prettier.format(
`
import { Config } from '../../types'
type CSSDeclarationList = Record<string, string>
export type DefaultTheme = Config['theme'] & { ${defaultThemeTypes} }
`,
{
semi: false,
singleQuote: true,
printWidth: 100,
parser: 'typescript',
}
)
)

View File

@@ -0,0 +1,17 @@
'use strict';
module.exports = self => {
const {username, password} = self.proxyOptions.url;
if (username || password) {
const data = `${username}:${password}`;
const authorization = `Basic ${Buffer.from(data).toString('base64')}`;
return {
'proxy-authorization': authorization,
authorization
};
}
return {};
};

View File

@@ -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.00506,"49":0,"50":0,"51":0,"52":0.01011,"53":0,"54":0,"55":0,"56":0,"57":0,"58":0,"59":0.01011,"60":0,"61":0,"62":0,"63":0,"64":0,"65":0,"66":0,"67":0,"68":0.00506,"69":0,"70":0,"71":0,"72":0,"73":0,"74":0,"75":0,"76":0,"77":0,"78":0.01517,"79":0,"80":0,"81":0.00506,"82":0,"83":0.00506,"84":0,"85":0,"86":0,"87":0.01011,"88":0,"89":0.00506,"90":0.01011,"91":0,"92":0,"93":0,"94":0,"95":0,"96":0,"97":0,"98":0,"99":0,"100":0,"101":0,"102":0.02528,"103":0.00506,"104":0.00506,"105":0.01011,"106":0.01011,"107":0.00506,"108":0.04045,"109":0.632,"110":0.3792,"111":0,"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.00506,"36":0,"37":0,"38":0,"39":0,"40":0.11123,"41":0,"42":0,"43":0,"44":0,"45":0,"46":0,"47":0,"48":0,"49":0.01517,"50":0,"51":0,"52":0,"53":0,"54":0,"55":0,"56":0,"57":0,"58":0,"59":0,"60":0.02022,"61":0,"62":0,"63":0,"64":0,"65":0.00506,"66":0.0455,"67":0.00506,"68":0,"69":0,"70":0,"71":0.00506,"72":0,"73":0.00506,"74":0.01011,"75":0.00506,"76":0.01011,"77":0.00506,"78":0.00506,"79":0.02022,"80":0.01517,"81":0.02022,"83":0.04045,"84":0.02022,"85":0.02022,"86":0.02528,"87":0.05056,"88":0.01011,"89":0.01011,"90":0.01011,"91":0.02022,"92":0.02022,"93":0.05056,"94":0.01011,"95":0.00506,"96":0.04045,"97":0.01011,"98":0.01011,"99":0.01011,"100":0.02022,"101":0.04045,"102":0.02528,"103":0.24774,"104":0.0455,"105":0.07584,"106":0.0809,"107":0.12134,"108":0.72806,"109":7.49299,"110":4.56051,"111":0.00506,"112":0.00506,"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,"43":0,"44":0,"45":0,"46":0.00506,"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.01011,"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.03539,"94":0.31853,"95":0.15168,"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.00506,"16":0,"17":0.00506,"18":0.02022,"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.00506,"93":0,"94":0,"95":0,"96":0.00506,"97":0,"98":0,"99":0.00506,"100":0,"101":0.00506,"102":0,"103":0.00506,"104":0.00506,"105":0.00506,"106":0.00506,"107":0.06067,"108":0.09101,"109":1.84038,"110":2.4016},E:{"4":0,"5":0,"6":0,"7":0,"8":0,"9":0,"10":0,"11":0,"12":0,"13":0.01517,"14":0.07584,"15":0.01517,_:"0","3.1":0,"3.2":0,"5.1":0,"6.1":0,"7.1":0,"9.1":0.01011,"10.1":0,"11.1":0.01011,"12.1":0.02528,"13.1":0.10618,"14.1":0.23258,"15.1":0.03034,"15.2-15.3":0.03034,"15.4":0.06573,"15.5":0.13146,"15.6":0.83424,"16.0":0.07078,"16.1":0.22752,"16.2":0.99098,"16.3":0.56627,"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.00399,"7.0-7.1":0.01594,"8.1-8.4":0.01196,"9.0-9.2":0.00399,"9.3":0.31488,"10.0-10.2":0.00399,"10.3":0.26705,"11.0-11.2":0.03986,"11.3-11.4":0.07972,"12.0-12.1":0.0279,"12.2-12.5":1.23163,"13.0-13.1":0.01594,"13.2":0.00797,"13.3":0.03986,"13.4-13.7":0.12356,"14.0-14.4":0.3388,"14.5-14.8":1.06422,"15.0-15.1":0.19132,"15.2-15.3":0.29495,"15.4":0.33481,"15.5":0.7613,"15.6":3.71083,"16.0":3.47168,"16.1":10.00051,"16.2":10.19183,"16.3":4.63555,"16.4":0.01993},P:{"4":0.0742,"20":1.35683,"5.0-5.4":0,"6.2-6.4":0,"7.2-7.4":0.0106,"8.2":0,"9.2":0,"10.1":0,"11.1-11.2":0.0106,"12.0":0.0106,"13.0":0.0318,"14.0":0.0212,"15.0":0.0106,"16.0":0.0318,"17.0":0.053,"18.0":0.0636,"19.0":2.07765},I:{"0":0,"3":0,"4":0.24259,"2.1":0,"2.2":0,"2.3":0,"4.1":0.0099,"4.2-4.3":0.07426,"4.4":0,"4.4.3-4.4.4":0.22773},K:{_:"0 10 11 12 11.1 11.5 12.1"},A:{"6":0,"7":0,"8":0.01074,"9":0.01074,"10":0.00537,"11":0.05909,"5.5":0},N:{"10":0,"11":0},S:{"2.5":0,_:"3.0-3.1"},J:{"7":0,"10":0},O:{"0":0.09888},H:{"0":0.19191},L:{"0":31.384},R:{_:"0"},M:{"0":0.31147},Q:{"13.1":0}};

View File

@@ -0,0 +1,70 @@
// @ts-check
import packageJson from '../../../package.json'
export function help({ message, usage, commands, options }) {
let indent = 2
// Render header
console.log()
console.log(`${packageJson.name} v${packageJson.version}`)
// Render message
if (message) {
console.log()
for (let msg of message.split('\n')) {
console.log(msg)
}
}
// Render usage
if (usage && usage.length > 0) {
console.log()
console.log('Usage:')
for (let example of usage) {
console.log(' '.repeat(indent), example)
}
}
// Render commands
if (commands && commands.length > 0) {
console.log()
console.log('Commands:')
for (let command of commands) {
console.log(' '.repeat(indent), command)
}
}
// Render options
if (options) {
let groupedOptions = {}
for (let [key, value] of Object.entries(options)) {
if (typeof value === 'object') {
groupedOptions[key] = { ...value, flags: [key] }
} else {
groupedOptions[value].flags.push(key)
}
}
console.log()
console.log('Options:')
for (let { flags, description, deprecated } of Object.values(groupedOptions)) {
if (deprecated) continue
if (flags.length === 1) {
console.log(
' '.repeat(indent + 4 /* 4 = "-i, ".length */),
flags.slice().reverse().join(', ').padEnd(20, ' '),
description
)
} else {
console.log(
' '.repeat(indent),
flags.slice().reverse().join(', ').padEnd(24, ' '),
description
)
}
}
}
console.log()
}

View File

@@ -0,0 +1,20 @@
import path from 'path'
import { readCAFileSync } from './ca-file';
it('should read CA file', () => {
expect(readCAFileSync(path.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(readCAFileSync(path.join(__dirname, 'not-exists.txt'))).toEqual(undefined)
})

View File

@@ -0,0 +1,68 @@
{
"name": "readable-stream",
"version": "3.6.0",
"description": "Streams3, a user-land copy of the stream library from Node.js",
"main": "readable.js",
"engines": {
"node": ">= 6"
},
"dependencies": {
"inherits": "^2.0.3",
"string_decoder": "^1.1.1",
"util-deprecate": "^1.0.1"
},
"devDependencies": {
"@babel/cli": "^7.2.0",
"@babel/core": "^7.2.0",
"@babel/polyfill": "^7.0.0",
"@babel/preset-env": "^7.2.0",
"airtap": "0.0.9",
"assert": "^1.4.0",
"bl": "^2.0.0",
"deep-strict-equal": "^0.2.0",
"events.once": "^2.0.2",
"glob": "^7.1.2",
"gunzip-maybe": "^1.4.1",
"hyperquest": "^2.1.3",
"lolex": "^2.6.0",
"nyc": "^11.0.0",
"pump": "^3.0.0",
"rimraf": "^2.6.2",
"tap": "^12.0.0",
"tape": "^4.9.0",
"tar-fs": "^1.16.2",
"util-promisify": "^2.1.0"
},
"scripts": {
"test": "tap -J --no-esm test/parallel/*.js test/ours/*.js",
"ci": "TAP=1 tap --no-esm test/parallel/*.js test/ours/*.js | tee test.tap",
"test-browsers": "airtap --sauce-connect --loopback airtap.local -- test/browser.js",
"test-browser-local": "airtap --open --local -- test/browser.js",
"cover": "nyc npm test",
"report": "nyc report --reporter=lcov",
"update-browser-errors": "babel -o errors-browser.js errors.js"
},
"repository": {
"type": "git",
"url": "git://github.com/nodejs/readable-stream"
},
"keywords": [
"readable",
"stream",
"pipe"
],
"browser": {
"util": false,
"worker_threads": false,
"./errors": "./errors-browser.js",
"./readable.js": "./readable-browser.js",
"./lib/internal/streams/from.js": "./lib/internal/streams/from-browser.js",
"./lib/internal/streams/stream.js": "./lib/internal/streams/stream-browser.js"
},
"nyc": {
"include": [
"lib/**.js"
]
},
"license": "MIT"
}

View File

@@ -0,0 +1,13 @@
export function wrapHelper(helper, transformOptionsFn) {
if (typeof helper !== 'function') {
// This should not happen, but apparently it does in https://github.com/wycats/handlebars.js/issues/1639
// We try to make the wrapper least-invasive by not wrapping it, if the helper is not a function.
return helper;
}
let wrapper = function(/* dynamic arguments */) {
const options = arguments[arguments.length - 1];
arguments[arguments.length - 1] = transformOptionsFn(options);
return helper.apply(this, arguments);
};
return wrapper;
}

View File

@@ -0,0 +1 @@
{"version":3,"file":"mergeAll.js","sourceRoot":"","sources":["../../../../src/internal/operators/mergeAll.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AA8D5C,MAAM,UAAU,QAAQ,CAAiC,aAAqB,QAAQ;IACpF,OAAO,QAAQ,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAC;AACxC,CAAC"}

View File

@@ -0,0 +1,43 @@
{
"name": "onetime",
"version": "5.1.2",
"description": "Ensure a function is only called once",
"license": "MIT",
"repository": "sindresorhus/onetime",
"funding": "https://github.com/sponsors/sindresorhus",
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
"url": "https://sindresorhus.com"
},
"engines": {
"node": ">=6"
},
"scripts": {
"test": "xo && ava && tsd"
},
"files": [
"index.js",
"index.d.ts"
],
"keywords": [
"once",
"function",
"one",
"onetime",
"func",
"fn",
"single",
"call",
"called",
"prevent"
],
"dependencies": {
"mimic-fn": "^2.1.0"
},
"devDependencies": {
"ava": "^1.4.1",
"tsd": "^0.7.1",
"xo": "^0.24.0"
}
}

View File

@@ -0,0 +1,202 @@
// Note: since nyc uses this module to output coverage, any lines
// that are in the direct sync flow of nyc's outputCoverage are
// ignored, since we can never get coverage for them.
// grab a reference to node's real process object right away
var process = global.process
const processOk = function (process) {
return process &&
typeof process === 'object' &&
typeof process.removeListener === 'function' &&
typeof process.emit === 'function' &&
typeof process.reallyExit === 'function' &&
typeof process.listeners === 'function' &&
typeof process.kill === 'function' &&
typeof process.pid === 'number' &&
typeof process.on === 'function'
}
// some kind of non-node environment, just no-op
/* istanbul ignore if */
if (!processOk(process)) {
module.exports = function () {
return function () {}
}
} else {
var assert = require('assert')
var signals = require('./signals.js')
var isWin = /^win/i.test(process.platform)
var EE = require('events')
/* istanbul ignore if */
if (typeof EE !== 'function') {
EE = EE.EventEmitter
}
var emitter
if (process.__signal_exit_emitter__) {
emitter = process.__signal_exit_emitter__
} else {
emitter = process.__signal_exit_emitter__ = new EE()
emitter.count = 0
emitter.emitted = {}
}
// Because this emitter is a global, we have to check to see if a
// previous version of this library failed to enable infinite listeners.
// I know what you're about to say. But literally everything about
// signal-exit is a compromise with evil. Get used to it.
if (!emitter.infinite) {
emitter.setMaxListeners(Infinity)
emitter.infinite = true
}
module.exports = function (cb, opts) {
/* istanbul ignore if */
if (!processOk(global.process)) {
return function () {}
}
assert.equal(typeof cb, 'function', 'a callback must be provided for exit handler')
if (loaded === false) {
load()
}
var ev = 'exit'
if (opts && opts.alwaysLast) {
ev = 'afterexit'
}
var remove = function () {
emitter.removeListener(ev, cb)
if (emitter.listeners('exit').length === 0 &&
emitter.listeners('afterexit').length === 0) {
unload()
}
}
emitter.on(ev, cb)
return remove
}
var unload = function unload () {
if (!loaded || !processOk(global.process)) {
return
}
loaded = false
signals.forEach(function (sig) {
try {
process.removeListener(sig, sigListeners[sig])
} catch (er) {}
})
process.emit = originalProcessEmit
process.reallyExit = originalProcessReallyExit
emitter.count -= 1
}
module.exports.unload = unload
var emit = function emit (event, code, signal) {
/* istanbul ignore if */
if (emitter.emitted[event]) {
return
}
emitter.emitted[event] = true
emitter.emit(event, code, signal)
}
// { <signal>: <listener fn>, ... }
var sigListeners = {}
signals.forEach(function (sig) {
sigListeners[sig] = function listener () {
/* istanbul ignore if */
if (!processOk(global.process)) {
return
}
// If there are no other listeners, an exit is coming!
// Simplest way: remove us and then re-send the signal.
// We know that this will kill the process, so we can
// safely emit now.
var listeners = process.listeners(sig)
if (listeners.length === emitter.count) {
unload()
emit('exit', null, sig)
/* istanbul ignore next */
emit('afterexit', null, sig)
/* istanbul ignore next */
if (isWin && sig === 'SIGHUP') {
// "SIGHUP" throws an `ENOSYS` error on Windows,
// so use a supported signal instead
sig = 'SIGINT'
}
/* istanbul ignore next */
process.kill(process.pid, sig)
}
}
})
module.exports.signals = function () {
return signals
}
var loaded = false
var load = function load () {
if (loaded || !processOk(global.process)) {
return
}
loaded = true
// This is the number of onSignalExit's that are in play.
// It's important so that we can count the correct number of
// listeners on signals, and don't wait for the other one to
// handle it instead of us.
emitter.count += 1
signals = signals.filter(function (sig) {
try {
process.on(sig, sigListeners[sig])
return true
} catch (er) {
return false
}
})
process.emit = processEmit
process.reallyExit = processReallyExit
}
module.exports.load = load
var originalProcessReallyExit = process.reallyExit
var processReallyExit = function processReallyExit (code) {
/* istanbul ignore if */
if (!processOk(global.process)) {
return
}
process.exitCode = code || /* istanbul ignore next */ 0
emit('exit', process.exitCode, null)
/* istanbul ignore next */
emit('afterexit', process.exitCode, null)
/* istanbul ignore next */
originalProcessReallyExit.call(process, process.exitCode)
}
var originalProcessEmit = process.emit
var processEmit = function processEmit (ev, arg) {
if (ev === 'exit' && processOk(global.process)) {
/* istanbul ignore else */
if (arg !== undefined) {
process.exitCode = arg
}
var ret = originalProcessEmit.apply(this, arguments)
/* istanbul ignore next */
emit('exit', process.exitCode, null)
/* istanbul ignore next */
emit('afterexit', process.exitCode, null)
/* istanbul ignore next */
return ret
} else {
return originalProcessEmit.apply(this, arguments)
}
}
}

View File

@@ -0,0 +1,167 @@
long2ip = (long) ->
a = (long & (0xff << 24)) >>> 24;
b = (long & (0xff << 16)) >>> 16;
c = (long & (0xff << 8)) >>> 8;
d = long & 0xff;
return [a, b, c, d].join('.')
ip2long = (ip) ->
b = []
for i in [0..3]
if ip.length == 0
break
if i > 0
if ip[0] != '.'
throw new Error('Invalid IP')
ip = ip.substring(1)
[n, c] = atob(ip)
ip = ip.substring(c)
b.push(n)
if ip.length != 0
throw new Error('Invalid IP')
switch b.length
when 1
# Long input notation
if b[0] > 0xFFFFFFFF
throw new Error('Invalid IP')
return b[0] >>> 0
when 2
# Class A notation
if b[0] > 0xFF or b[1] > 0xFFFFFF
throw new Error('Invalid IP')
return (b[0] << 24 | b[1]) >>> 0
when 3
# Class B notation
if b[0] > 0xFF or b[1] > 0xFF or b[2] > 0xFFFF
throw new Error('Invalid IP')
return (b[0] << 24 | b[1] << 16 | b[2]) >>> 0
when 4
# Dotted quad notation
if b[0] > 0xFF or b[1] > 0xFF or b[2] > 0xFF or b[3] > 0xFF
throw new Error('Invalid IP')
return (b[0] << 24 | b[1] << 16 | b[2] << 8 | b[3]) >>> 0
else
throw new Error('Invalid IP')
chr = (b) ->
return b.charCodeAt(0)
chr0 = chr('0')
chra = chr('a')
chrA = chr('A')
atob = (s) ->
n = 0
base = 10
dmax = '9'
i = 0
if s.length > 1 and s[i] == '0'
if s[i+1] == 'x' or s[i+1] == 'X'
i += 2
base = 16
else if '0' <= s[i+1] and s[i+1] <= '9'
i++
base = 8
dmax = '7'
start = i
while i < s.length
if '0' <= s[i] and s[i] <= dmax
n = (n*base + (chr(s[i])-chr0)) >>> 0
else if base == 16
if 'a' <= s[i] and s[i] <= 'f'
n = (n*base + (10+chr(s[i])-chra)) >>> 0
else if 'A' <= s[i] and s[i] <= 'F'
n = (n*base + (10+chr(s[i])-chrA)) >>> 0
else
break
else
break
if n > 0xFFFFFFFF
throw new Error('too large')
i++
if i == start
throw new Error('empty octet')
return [n, i]
class Netmask
constructor: (net, mask) ->
throw new Error("Missing `net' parameter") unless typeof net is 'string'
unless mask
# try to find the mask in the net (i.e.: 1.2.3.4/24 or 1.2.3.4/255.255.255.0)
[net, mask] = net.split('/', 2)
unless mask
mask = 32
if typeof mask is 'string' and mask.indexOf('.') > -1
# Compute bitmask, the netmask as a number of bits in the network portion of the address for this block (eg.: 24)
try
@maskLong = ip2long(mask)
catch error
throw new Error("Invalid mask: #{mask}")
for i in [32..0]
if @maskLong == (0xffffffff << (32 - i)) >>> 0
@bitmask = i
break
else if mask or mask == 0
# The mask was passed as bitmask, compute the mask as long from it
@bitmask = parseInt(mask, 10)
@maskLong = 0
if @bitmask > 0
@maskLong = (0xffffffff << (32 - @bitmask)) >>> 0
else
throw new Error("Invalid mask: empty")
try
@netLong = (ip2long(net) & @maskLong) >>> 0
catch error
throw new Error("Invalid net address: #{net}")
throw new Error("Invalid mask for ip4: #{mask}") unless @bitmask <= 32
# The number of IP address in the block (eg.: 254)
@size = Math.pow(2, 32 - @bitmask)
# The address of the network block as a string (eg.: 216.240.32.0)
@base = long2ip(@netLong)
# The netmask as a string (eg.: 255.255.255.0)
@mask = long2ip(@maskLong)
# The host mask, the opposite of the netmask (eg.: 0.0.0.255)
@hostmask = long2ip(~@maskLong)
# The first usable address of the block
@first = if @bitmask <= 30 then long2ip(@netLong + 1) else @base
# The last usable address of the block
@last = if @bitmask <= 30 then long2ip(@netLong + @size - 2) else long2ip(@netLong + @size - 1)
# The block's broadcast address: the last address of the block (eg.: 192.168.1.255)
@broadcast = if @bitmask <= 30 then long2ip(@netLong + @size - 1)
# Returns true if the given ip or netmask is contained in the block
contains: (ip) ->
if typeof ip is 'string' and (ip.indexOf('/') > 0 or ip.split('.').length isnt 4)
ip = new Netmask(ip)
if ip instanceof Netmask
return @contains(ip.base) and @contains((ip.broadcast || ip.last))
else
return (ip2long(ip) & @maskLong) >>> 0 == ((@netLong & @maskLong)) >>> 0
# Returns the Netmask object for the block which follow this one
next: (count=1) ->
return new Netmask(long2ip(@netLong + (@size * count)), @mask)
forEach: (fn) ->
# this implementation is not idiomatic but avoids large memory allocations (2 arrays, one for range and one for the results) in cases when then netmask is large
long = ip2long(@first)
lastLong = ip2long(@last)
index = 0
while long <= lastLong
fn long2ip(long), long, index
index++
long++
return
# Returns the complete netmask formatted as `base/bitmask`
toString: ->
return @base + "/" + @bitmask
exports.ip2long = ip2long
exports.long2ip = long2ip
exports.Netmask = Netmask

View File

@@ -0,0 +1 @@
{"name":"get-intrinsic","version":"1.2.0","files":{".nycrc":{"checkedAt":1678883669555,"integrity":"sha512-2vm1RFz8Ajl/OYrfoCWPJIm3Bpnf7Gyn5bha/lZx/cq+We3uMy9xj15XeP6x4wF3jf/pO7KMHAkU9mllm605xg==","mode":420,"size":139},".eslintrc":{"checkedAt":1678883671537,"integrity":"sha512-K+tSV9KTEwdNn+UoNndm+VIi+28h9N3wcTHnOfV4FtHjdpIZNUZO/G0/nSn4jJylb5+JVsoeOtHns4+J0F41wg==","mode":420,"size":603},"LICENSE":{"checkedAt":1678883671537,"integrity":"sha512-EqKjvyq6+l4/ZpJ47jMsh+ShZM/lTvYBnKi189QfOPECJNUvRx0CVqrWYA3sn7Oh7fPITzjMnxz9Trmir4oAZg==","mode":420,"size":1071},"test/GetIntrinsic.js":{"checkedAt":1678883671537,"integrity":"sha512-a0chW8iRpaVbEf5O0Y4WMwBEEwOFhY3zyEeqbtuPt/vTH7FvnR26l+1Mo9bcW6iE8HFmZ/IOV3pz7TyJaT/JYA==","mode":420,"size":8767},"package.json":{"checkedAt":1678883671540,"integrity":"sha512-cUVFnLvKKBL1qDtaKOXHBM6O3ZzMZ6x+HC6x7p4RM66MZ9SNDKkHNEd+qOHDE2DbS0KVkh6KZJEB5TMU/dnpyA==","mode":420,"size":2349},"index.js":{"checkedAt":1678883671540,"integrity":"sha512-cjpJCgrKyqYtr/59rKidTbkSrAO5WQ+LXN5Du4OQcCRmLCrstgyGYf+zIkh3HESnQ7H9bI2ziJ5TelxTmnRgOg==","mode":420,"size":13145},"CHANGELOG.md":{"checkedAt":1678883671543,"integrity":"sha512-qqLfrLiBAQkpl5ozvs4P03tpEqeNVUNCByNnZ1GkqapOGCo022715eSJCzuJvzBeynYgXtPabW0nbpGJele61A==","mode":420,"size":9242},"README.md":{"checkedAt":1678883671543,"integrity":"sha512-gKK4MJlg4s3igKOgb5XPHrBwny4xevN+sa9Bpxf5YZ21w+rBVIKj/sLck+EUw8PIeZrRbQFtaJ+Ad+jc8fWkgA==","mode":420,"size":2791},".github/FUNDING.yml":{"checkedAt":1678883671543,"integrity":"sha512-+BzZlaIXAreXEY4BcYRIQlQek7xGFFUzmxseFhgeblZ2UxajzDssgW6H0zehV1QjFAXiUQOGMp8FYXMxZTVvyA==","mode":420,"size":584}}}

View File

@@ -0,0 +1,126 @@
export {}; // Don't export anything!
//// DOM-like Events
// NB: The Event / EventTarget / EventListener implementations below were copied
// from lib.dom.d.ts, then edited to reflect Node's documentation at
// https://nodejs.org/api/events.html#class-eventtarget.
// Please read that link to understand important implementation differences.
// This conditional type will be the existing global Event in a browser, or
// the copy below in a Node environment.
type __Event = typeof globalThis extends { onmessage: any, Event: any }
? {}
: {
/** This is not used in Node.js and is provided purely for completeness. */
readonly bubbles: boolean;
/** Alias for event.stopPropagation(). This is not used in Node.js and is provided purely for completeness. */
cancelBubble: () => void;
/** True if the event was created with the cancelable option */
readonly cancelable: boolean;
/** This is not used in Node.js and is provided purely for completeness. */
readonly composed: boolean;
/** Returns an array containing the current EventTarget as the only entry or empty if the event is not being dispatched. This is not used in Node.js and is provided purely for completeness. */
composedPath(): [EventTarget?]
/** Alias for event.target. */
readonly currentTarget: EventTarget | null;
/** Is true if cancelable is true and event.preventDefault() has been called. */
readonly defaultPrevented: boolean;
/** This is not used in Node.js and is provided purely for completeness. */
readonly eventPhase: 0 | 2;
/** The `AbortSignal` "abort" event is emitted with `isTrusted` set to `true`. The value is `false` in all other cases. */
readonly isTrusted: boolean;
/** Sets the `defaultPrevented` property to `true` if `cancelable` is `true`. */
preventDefault(): void;
/** This is not used in Node.js and is provided purely for completeness. */
returnValue: boolean;
/** Alias for event.target. */
readonly srcElement: EventTarget | null;
/** Stops the invocation of event listeners after the current one completes. */
stopImmediatePropagation(): void;
/** This is not used in Node.js and is provided purely for completeness. */
stopPropagation(): void;
/** The `EventTarget` dispatching the event */
readonly target: EventTarget | null;
/** The millisecond timestamp when the Event object was created. */
readonly timeStamp: number;
/** Returns the type of event, e.g. "click", "hashchange", or "submit". */
readonly type: string;
};
// See comment above explaining conditional type
type __EventTarget = typeof globalThis extends { onmessage: any, EventTarget: any }
? {}
: {
/**
* Adds a new handler for the `type` event. Any given `listener` is added only once per `type` and per `capture` option value.
*
* If the `once` option is true, the `listener` is removed after the next time a `type` event is dispatched.
*
* The `capture` option is not used by Node.js in any functional way other than tracking registered event listeners per the `EventTarget` specification.
* Specifically, the `capture` option is used as part of the key when registering a `listener`.
* Any individual `listener` may be added once with `capture = false`, and once with `capture = true`.
*/
addEventListener(
type: string,
listener: EventListener | EventListenerObject,
options?: AddEventListenerOptions | boolean,
): void;
/** Dispatches a synthetic event event to target and returns true if either event's cancelable attribute value is false or its preventDefault() method was not invoked, and false otherwise. */
dispatchEvent(event: Event): boolean;
/** Removes the event listener in target's event listener list with the same type, callback, and options. */
removeEventListener(
type: string,
listener: EventListener | EventListenerObject,
options?: EventListenerOptions | boolean,
): void;
};
interface EventInit {
bubbles?: boolean;
cancelable?: boolean;
composed?: boolean;
}
interface EventListenerOptions {
/** Not directly used by Node.js. Added for API completeness. Default: `false`. */
capture?: boolean;
}
interface AddEventListenerOptions extends EventListenerOptions {
/** When `true`, the listener is automatically removed when it is first invoked. Default: `false`. */
once?: boolean;
/** When `true`, serves as a hint that the listener will not call the `Event` object's `preventDefault()` method. Default: false. */
passive?: boolean;
}
interface EventListener {
(evt: Event): void;
}
interface EventListenerObject {
handleEvent(object: Event): void;
}
import {} from 'events'; // Make this an ambient declaration
declare global {
/** An event which takes place in the DOM. */
interface Event extends __Event {}
var Event: typeof globalThis extends { onmessage: any, Event: infer T }
? T
: {
prototype: __Event;
new (type: string, eventInitDict?: EventInit): __Event;
};
/**
* EventTarget is a DOM interface implemented by objects that can
* receive events and may have listeners for them.
*/
interface EventTarget extends __EventTarget {}
var EventTarget: typeof globalThis extends { onmessage: any, EventTarget: infer T }
? T
: {
prototype: __EventTarget;
new (): __EventTarget;
};
}

View File

@@ -0,0 +1,61 @@
/* Generated by `npm run build`, do not edit! */
"use strict"
module.exports = function(Parser) {
return /*@__PURE__*/(function (Parser) {
function anonymous () {
Parser.apply(this, arguments);
}
if ( Parser ) anonymous.__proto__ = Parser;
anonymous.prototype = Object.create( Parser && Parser.prototype );
anonymous.prototype.constructor = anonymous;
anonymous.prototype.readInt = function readInt (radix, len) {
// Hack: len is only != null for unicode escape sequences,
// where numeric separators are not allowed
if (len != null) { return Parser.prototype.readInt.call(this, radix, len) }
var start = this.pos, total = 0, acceptUnderscore = false
for (;;) {
var code = this.input.charCodeAt(this.pos), val = (void 0)
if (code >= 97) { val = code - 97 + 10 } // a
else if (code == 95) {
if (!acceptUnderscore) { this.raise(this.pos, "Invalid numeric separator") }
++this.pos
acceptUnderscore = false
continue
} else if (code >= 65) { val = code - 65 + 10 } // A
else if (code >= 48 && code <= 57) { val = code - 48 } // 0-9
else { val = Infinity }
if (val >= radix) { break }
++this.pos
total = total * radix + val
acceptUnderscore = true
}
if (this.pos === start) { return null }
if (!acceptUnderscore) { this.raise(this.pos - 1, "Invalid numeric separator") }
return total
};
anonymous.prototype.readNumber = function readNumber (startsWithDot) {
var token = Parser.prototype.readNumber.call(this, startsWithDot)
var octal = this.end - this.start >= 2 && this.input.charCodeAt(this.start) === 48
var stripped = this.getNumberInput(this.start, this.end)
if (stripped.length < this.end - this.start) {
if (octal) { this.raise(this.start, "Invalid number") }
this.value = parseFloat(stripped)
}
return token
};
// This is used by acorn-bigint
anonymous.prototype.getNumberInput = function getNumberInput (start, end) {
return this.input.slice(start, end).replace(/_/g, "")
};
return anonymous;
}(Parser))
}

View File

@@ -0,0 +1,72 @@
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
var strip_bom_1 = __importDefault(require("strip-bom"));
/**
* For each data chunk coming to parser:
* 1. append the data to the buffer that is left from last chunk
* 2. check if utf8 chars being split, if does, stripe the bytes and add to left buffer.
* 3. stripBom
*/
function prepareData(chunk, runtime) {
var workChunk = concatLeftChunk(chunk, runtime);
runtime.csvLineBuffer = undefined;
var cleanCSVString = cleanUtf8Split(workChunk, runtime).toString("utf8");
if (runtime.started === false) {
return strip_bom_1.default(cleanCSVString);
}
else {
return cleanCSVString;
}
}
exports.prepareData = prepareData;
/**
* append data to buffer that is left form last chunk
*/
function concatLeftChunk(chunk, runtime) {
if (runtime.csvLineBuffer && runtime.csvLineBuffer.length > 0) {
return Buffer.concat([runtime.csvLineBuffer, chunk]);
}
else {
return chunk;
}
}
/**
* check if utf8 chars being split, if does, stripe the bytes and add to left buffer.
*/
function cleanUtf8Split(chunk, runtime) {
var idx = chunk.length - 1;
/**
* From Keyang:
* The code below is to check if a single utf8 char (which could be multiple bytes) being split.
* If the char being split, the buffer from two chunk needs to be concat
* check how utf8 being encoded to understand the code below.
* If anyone has any better way to do this, please let me know.
*/
if ((chunk[idx] & 1 << 7) != 0) {
while ((chunk[idx] & 3 << 6) === 128) {
idx--;
}
idx--;
}
if (idx != chunk.length - 1) {
runtime.csvLineBuffer = chunk.slice(idx + 1);
return chunk.slice(0, idx + 1);
// var _cb=cb;
// var self=this;
// cb=function(){
// if (self._csvLineBuffer){
// self._csvLineBuffer=Buffer.concat([bufFromString(self._csvLineBuffer,"utf8"),left]);
// }else{
// self._csvLineBuffer=left;
// }
// _cb();
// }
}
else {
return chunk;
}
}
//# sourceMappingURL=dataClean.js.map

View File

@@ -0,0 +1 @@
{"name":"emoji-regex","version":"9.2.2","files":{"es2015/index.js":{"checkedAt":1678883671349,"integrity":"sha512-kOOuwXxdIR4cXb5q3+RMwvojBsupPCR5AcANlBJQN91kc2FaEccgZoyspBZ7fvXeJ408KHm+jzV7nuXW54Pysw==","mode":420,"size":17405},"LICENSE-MIT.txt":{"checkedAt":1678883669272,"integrity":"sha512-fWtEu2WGJSgbSBlOWj06B0Ur6h8lZQbdFveiGUHvPw0lnhvNDMYgJkK/H9EpvBh+ajkh04LVaNMSvYPzAjl5oA==","mode":420,"size":1077},"index.js":{"checkedAt":1678883671351,"integrity":"sha512-XzNnTLtCKC2CnpzjOtY4mWFm+9hClYhuyYaCQsOzwYpoXPIsrTJWPGBxgurRQbhy86nWm4YIss9wAzbh1I6t5Q==","mode":420,"size":15735},"es2015/RGI_Emoji.js":{"checkedAt":1678883671351,"integrity":"sha512-e3GMCexSN1vcMhhlpSMPUvA4y+//Fwpx2FZwh26LujSk82q96op8B6wcRGwvT7aBrMDjQPkDyNwvCEEEre583g==","mode":420,"size":14024},"RGI_Emoji.js":{"checkedAt":1678883671353,"integrity":"sha512-/8XTBY2Uue0aayWfiglTY7qhwcmAmJBVLLRNKIf43hRIQEu9HVFcNxMXPKzJrb4qRwOflPuQi9mgKauAXQEaWQ==","mode":420,"size":12976},"es2015/text.js":{"checkedAt":1678883671365,"integrity":"sha512-+famGvN9GSTjqXhaoEoz+gEHeR1UywdmPG6opo7frjdmaC6RS2r68Zjrl8f3OrU6pQC0ZhzavevSV2UmZkFm9A==","mode":420,"size":15796},"package.json":{"checkedAt":1678883671366,"integrity":"sha512-2CNLjSUMqPWn/Gyi03pBCCTh+f0T3su+SIzVm/E4relvketxKCVTn4QkX7bxoveEFZyKnRnKiA3CcQZh4ygvMA==","mode":420,"size":1331},"text.js":{"checkedAt":1678883671366,"integrity":"sha512-ItpkHDlvmXKxNtShjrB0d0clLPfV2J9hmpKMVHXXk3X7vkLU6RghEC4nHqFE+JJn/zB81GSU/ffWACzpdot72Q==","mode":420,"size":14468},"RGI_Emoji.d.ts":{"checkedAt":1678883671371,"integrity":"sha512-tRTxXtVPfXad1REMyp3FxXnGeyiV8NwokoSWj9Q12uaqexBSicK1JqYIm+DRmKdqkNZiXfbn6FR2dLbm8FsCjg==","mode":420,"size":100},"es2015/index.d.ts":{"checkedAt":1678883671371,"integrity":"sha512-sCRwTNLVPFUWGy3TX9VPcE/lDNqgyB3ZeBet6cenZ4bXN7RQ4yKD9/yLGD8yYTDXMqKFTSFa8yL2L+FoWKCIJg==","mode":420,"size":97},"README.md":{"checkedAt":1678883671371,"integrity":"sha512-h+Fr3sG34d5+BZaYsMmRCIFzlFqvuM51YX5agcRKyFwe7VpCk4/1YQ+vE07+/z2deV/lWKgGYdIXQYJ+GI58LA==","mode":420,"size":4513},"text.d.ts":{"checkedAt":1678883671371,"integrity":"sha512-4AO//mFVrPNs/VrfGuV7jY6Q684Lk+xX+cAsGL6W8Dkgb8SIfFaygaUDd8WJI+iiOlQHhEANob++pNFgTIU3ww==","mode":420,"size":95},"es2015/text.d.ts":{"checkedAt":1678883671371,"integrity":"sha512-J28REtM6D3AhA+DFHnZNbakj1ppTC9uV+GCvO6mVNrhf0939cS+tf8oPf86GFc8pnqwHr2lQKfA8jYZ5nUseQg==","mode":420,"size":102},"es2015/RGI_Emoji.d.ts":{"checkedAt":1678883671371,"integrity":"sha512-HdvoglTJmaMoQkQCzk4BNIL3zoBYtpNuuLKAM+/cPc5QYhS2mu/a8MshEVby6e7z4Tk+N9Kc6PlwcCwKEnB6HA==","mode":420,"size":107},"index.d.ts":{"checkedAt":1678883671372,"integrity":"sha512-Dq8TlFKi2hh6zFXgjYh5sxseg8OXQwiMRW6rJcMOT6eUZALmGCvsAt69ZUWBnEYNYB99NO6efvfS3SGduqgVSg==","mode":420,"size":90}}}

View File

@@ -0,0 +1,14 @@
/**
* Checks if a stack value for `key` exists.
*
* @private
* @name has
* @memberOf Stack
* @param {string} key The key of the entry to check.
* @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
*/
function stackHas(key) {
return this.__data__.has(key);
}
module.exports = stackHas;

View File

@@ -0,0 +1 @@
{"version":3,"file":"delayWhen.js","sourceRoot":"","sources":["../../../../src/internal/operators/delayWhen.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAC9C,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC9B,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAoFpD,MAAM,UAAU,SAAS,CACvB,qBAAwE,EACxE,iBAAmC;IAEnC,IAAI,iBAAiB,EAAE;QAErB,OAAO,CAAC,MAAqB,EAAE,EAAE,CAC/B,MAAM,CAAC,iBAAiB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,cAAc,EAAE,CAAC,EAAE,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,qBAAqB,CAAC,CAAC,CAAC,CAAC;KAC5G;IAED,OAAO,QAAQ,CAAC,CAAC,KAAK,EAAE,KAAK,EAAE,EAAE,CAAC,SAAS,CAAC,qBAAqB,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;AAChH,CAAC"}

View File

@@ -0,0 +1,15 @@
# prelude.ls [![Build Status](https://travis-ci.org/gkz/prelude-ls.png?branch=master)](https://travis-ci.org/gkz/prelude-ls)
is a functionally oriented utility library. It is powerful and flexible. Almost all of its functions are curried. It is written in, and is the recommended base library for, <a href="http://livescript.net">LiveScript</a>.
See **[the prelude.ls site](http://preludels.com)** for examples, a reference, and more.
You can install via npm `npm install prelude-ls`
### Development
`make test` to test
`make build` to build `lib` from `src`
`make build-browser` to build browser versions

View File

@@ -0,0 +1,8 @@
export function getSymbolIterator() {
if (typeof Symbol !== 'function' || !Symbol.iterator) {
return '@@iterator';
}
return Symbol.iterator;
}
export var iterator = getSymbolIterator();
//# sourceMappingURL=iterator.js.map

View File

@@ -0,0 +1,58 @@
import test from 'ava';
import sinon from 'sinon';
import Spinner from '../lib/spinner.js';
import Config from '../lib/config.js';
test.beforeEach(t => {
t.context.ora = sinon.spy();
});
const getConfig = options => {
const testConfig = {
ci: false,
config: false
};
return new Config(Object.assign({}, testConfig, options));
};
test('should not show spinner and not execute task if disabled', async t => {
const { ora } = t.context;
const task = sinon.spy();
const spinner = new Spinner({ container: { ora } });
await spinner.show({ enabled: false, task });
t.is(task.callCount, 0);
t.is(ora.callCount, 0);
});
test('should show spinner and run task by default', async t => {
const { ora } = t.context;
const task = sinon.stub().resolves();
const label = 'foo';
const config = getConfig({ ci: true });
const spinner = new Spinner({ container: { ora, config } });
await spinner.show({ task, label });
t.is(task.callCount, 1);
t.is(ora.callCount, 1);
t.is(ora.firstCall.args[0], task.firstCall.returnValue);
t.is(ora.firstCall.args[1], label);
});
test('should run task, but not show spinner if interactive', async t => {
const { ora } = t.context;
const task = sinon.stub().resolves();
const config = getConfig({ ci: false });
const spinner = new Spinner({ container: { ora, config } });
await spinner.show({ task });
t.is(task.callCount, 1);
t.is(ora.callCount, 0);
});
test('should run task and show spinner if interactive, but external', async t => {
const { ora } = t.context;
const task = sinon.stub().resolves();
const config = getConfig({ ci: false });
const spinner = new Spinner({ container: { ora, config } });
await spinner.show({ task, external: true });
t.is(task.callCount, 1);
t.is(ora.callCount, 1);
});

View File

@@ -0,0 +1,22 @@
'use strict';
var GetIntrinsic = require('get-intrinsic');
var $TypeError = GetIntrinsic('%TypeError%');
var SameValue = require('./SameValue');
var ToNumber = require('./ToNumber');
var ToString = require('./ToString');
var Type = require('./Type');
// https://262.ecma-international.org/6.0/#sec-canonicalnumericindexstring
module.exports = function CanonicalNumericIndexString(argument) {
if (Type(argument) !== 'String') {
throw new $TypeError('Assertion failed: `argument` must be a String');
}
if (argument === '-0') { return -0; }
var n = ToNumber(argument);
if (SameValue(ToString(n), argument)) { return n; }
return void 0;
};

View File

@@ -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 a b c d e i j k l m n o p q r s t u f H","2":"C K L G M N O"},C:{"1":"NB OB PB QB RB SB TB UB VB WB XB YB uB ZB vB aB bB 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 i j k l m n o p q r s t u f H xB yB","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 EC FC"},D:{"1":"PB QB RB SB TB UB VB WB XB YB uB ZB vB aB bB cB dB eB fB gB hB iB jB kB h lB mB nB oB pB P Q R 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 GC","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"},E:{"1":"F A B C K L G LC 0B qB rB 1B MC NC 2B 3B 4B 5B sB 6B 7B 8B 9B OC","2":"I v J D E HC zB IC JC KC"},F:{"1":"CB DB EB FB GB HB IB JB KB LB MB NB OB PB QB RB SB TB UB VB WB XB YB ZB aB bB 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 PC QC RC SC qB AC TC rB"},G:{"1":"ZC aC bC cC dC eC fC gC hC iC jC kC lC mC nC 2B 3B 4B 5B sB 6B 7B 8B 9B","2":"E zB UC BC VC WC XC YC"},H:{"2":"oC"},I:{"1":"f","2":"tB I pC qC rC sC BC tC uC"},J:{"2":"D A"},K:{"1":"h","2":"A B C qB AC rB"},L:{"1":"H"},M:{"1":"H"},N:{"2":"A B"},O:{"1":"vC"},P:{"1":"g wC xC yC zC 0C 0B 1C 2C 3C 4C 5C sB 6C 7C 8C","2":"I"},Q:{"1":"1B"},R:{"1":"9C"},S:{"1":"AD BD"}},B:5,C:"Case-insensitive CSS attribute selectors"};

View File

@@ -0,0 +1,4 @@
export type PermissionIdsNotMatchingError = {
name: string;
message: string;
};

View File

@@ -0,0 +1,4 @@
export {
renderToString,
renderToString as renderToStaticMarkup
} from 'preact-render-to-string';

View File

@@ -0,0 +1,182 @@
const { MAX_SAFE_COMPONENT_LENGTH } = require('./constants')
const debug = require('./debug')
exports = module.exports = {}
// The actual regexps go on exports.re
const re = exports.re = []
const src = exports.src = []
const t = exports.t = {}
let R = 0
const createToken = (name, value, isGlobal) => {
const index = R++
debug(name, index, value)
t[name] = index
src[index] = value
re[index] = new RegExp(value, isGlobal ? 'g' : undefined)
}
// The following Regular Expressions can be used for tokenizing,
// validating, and parsing SemVer version strings.
// ## Numeric Identifier
// A single `0`, or a non-zero digit followed by zero or more digits.
createToken('NUMERICIDENTIFIER', '0|[1-9]\\d*')
createToken('NUMERICIDENTIFIERLOOSE', '[0-9]+')
// ## Non-numeric Identifier
// Zero or more digits, followed by a letter or hyphen, and then zero or
// more letters, digits, or hyphens.
createToken('NONNUMERICIDENTIFIER', '\\d*[a-zA-Z-][a-zA-Z0-9-]*')
// ## Main Version
// Three dot-separated numeric identifiers.
createToken('MAINVERSION', `(${src[t.NUMERICIDENTIFIER]})\\.` +
`(${src[t.NUMERICIDENTIFIER]})\\.` +
`(${src[t.NUMERICIDENTIFIER]})`)
createToken('MAINVERSIONLOOSE', `(${src[t.NUMERICIDENTIFIERLOOSE]})\\.` +
`(${src[t.NUMERICIDENTIFIERLOOSE]})\\.` +
`(${src[t.NUMERICIDENTIFIERLOOSE]})`)
// ## Pre-release Version Identifier
// A numeric identifier, or a non-numeric identifier.
createToken('PRERELEASEIDENTIFIER', `(?:${src[t.NUMERICIDENTIFIER]
}|${src[t.NONNUMERICIDENTIFIER]})`)
createToken('PRERELEASEIDENTIFIERLOOSE', `(?:${src[t.NUMERICIDENTIFIERLOOSE]
}|${src[t.NONNUMERICIDENTIFIER]})`)
// ## Pre-release Version
// Hyphen, followed by one or more dot-separated pre-release version
// identifiers.
createToken('PRERELEASE', `(?:-(${src[t.PRERELEASEIDENTIFIER]
}(?:\\.${src[t.PRERELEASEIDENTIFIER]})*))`)
createToken('PRERELEASELOOSE', `(?:-?(${src[t.PRERELEASEIDENTIFIERLOOSE]
}(?:\\.${src[t.PRERELEASEIDENTIFIERLOOSE]})*))`)
// ## Build Metadata Identifier
// Any combination of digits, letters, or hyphens.
createToken('BUILDIDENTIFIER', '[0-9A-Za-z-]+')
// ## Build Metadata
// Plus sign, followed by one or more period-separated build metadata
// identifiers.
createToken('BUILD', `(?:\\+(${src[t.BUILDIDENTIFIER]
}(?:\\.${src[t.BUILDIDENTIFIER]})*))`)
// ## Full Version String
// A main version, followed optionally by a pre-release version and
// build metadata.
// Note that the only major, minor, patch, and pre-release sections of
// the version string are capturing groups. The build metadata is not a
// capturing group, because it should not ever be used in version
// comparison.
createToken('FULLPLAIN', `v?${src[t.MAINVERSION]
}${src[t.PRERELEASE]}?${
src[t.BUILD]}?`)
createToken('FULL', `^${src[t.FULLPLAIN]}$`)
// like full, but allows v1.2.3 and =1.2.3, which people do sometimes.
// also, 1.0.0alpha1 (prerelease without the hyphen) which is pretty
// common in the npm registry.
createToken('LOOSEPLAIN', `[v=\\s]*${src[t.MAINVERSIONLOOSE]
}${src[t.PRERELEASELOOSE]}?${
src[t.BUILD]}?`)
createToken('LOOSE', `^${src[t.LOOSEPLAIN]}$`)
createToken('GTLT', '((?:<|>)?=?)')
// Something like "2.*" or "1.2.x".
// Note that "x.x" is a valid xRange identifer, meaning "any version"
// Only the first item is strictly required.
createToken('XRANGEIDENTIFIERLOOSE', `${src[t.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`)
createToken('XRANGEIDENTIFIER', `${src[t.NUMERICIDENTIFIER]}|x|X|\\*`)
createToken('XRANGEPLAIN', `[v=\\s]*(${src[t.XRANGEIDENTIFIER]})` +
`(?:\\.(${src[t.XRANGEIDENTIFIER]})` +
`(?:\\.(${src[t.XRANGEIDENTIFIER]})` +
`(?:${src[t.PRERELEASE]})?${
src[t.BUILD]}?` +
`)?)?`)
createToken('XRANGEPLAINLOOSE', `[v=\\s]*(${src[t.XRANGEIDENTIFIERLOOSE]})` +
`(?:\\.(${src[t.XRANGEIDENTIFIERLOOSE]})` +
`(?:\\.(${src[t.XRANGEIDENTIFIERLOOSE]})` +
`(?:${src[t.PRERELEASELOOSE]})?${
src[t.BUILD]}?` +
`)?)?`)
createToken('XRANGE', `^${src[t.GTLT]}\\s*${src[t.XRANGEPLAIN]}$`)
createToken('XRANGELOOSE', `^${src[t.GTLT]}\\s*${src[t.XRANGEPLAINLOOSE]}$`)
// Coercion.
// Extract anything that could conceivably be a part of a valid semver
createToken('COERCE', `${'(^|[^\\d])' +
'(\\d{1,'}${MAX_SAFE_COMPONENT_LENGTH}})` +
`(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?` +
`(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?` +
`(?:$|[^\\d])`)
createToken('COERCERTL', src[t.COERCE], true)
// Tilde ranges.
// Meaning is "reasonably at or greater than"
createToken('LONETILDE', '(?:~>?)')
createToken('TILDETRIM', `(\\s*)${src[t.LONETILDE]}\\s+`, true)
exports.tildeTrimReplace = '$1~'
createToken('TILDE', `^${src[t.LONETILDE]}${src[t.XRANGEPLAIN]}$`)
createToken('TILDELOOSE', `^${src[t.LONETILDE]}${src[t.XRANGEPLAINLOOSE]}$`)
// Caret ranges.
// Meaning is "at least and backwards compatible with"
createToken('LONECARET', '(?:\\^)')
createToken('CARETTRIM', `(\\s*)${src[t.LONECARET]}\\s+`, true)
exports.caretTrimReplace = '$1^'
createToken('CARET', `^${src[t.LONECARET]}${src[t.XRANGEPLAIN]}$`)
createToken('CARETLOOSE', `^${src[t.LONECARET]}${src[t.XRANGEPLAINLOOSE]}$`)
// A simple gt/lt/eq thing, or just "" to indicate "any version"
createToken('COMPARATORLOOSE', `^${src[t.GTLT]}\\s*(${src[t.LOOSEPLAIN]})$|^$`)
createToken('COMPARATOR', `^${src[t.GTLT]}\\s*(${src[t.FULLPLAIN]})$|^$`)
// An expression to strip any whitespace between the gtlt and the thing
// it modifies, so that `> 1.2.3` ==> `>1.2.3`
createToken('COMPARATORTRIM', `(\\s*)${src[t.GTLT]
}\\s*(${src[t.LOOSEPLAIN]}|${src[t.XRANGEPLAIN]})`, true)
exports.comparatorTrimReplace = '$1$2$3'
// Something like `1.2.3 - 1.2.4`
// Note that these all use the loose form, because they'll be
// checked against either the strict or loose comparator form
// later.
createToken('HYPHENRANGE', `^\\s*(${src[t.XRANGEPLAIN]})` +
`\\s+-\\s+` +
`(${src[t.XRANGEPLAIN]})` +
`\\s*$`)
createToken('HYPHENRANGELOOSE', `^\\s*(${src[t.XRANGEPLAINLOOSE]})` +
`\\s+-\\s+` +
`(${src[t.XRANGEPLAINLOOSE]})` +
`\\s*$`)
// Star ranges basically just allow anything at all.
createToken('STAR', '(<|>)?=?\\s*\\*')
// >=0.0.0 is like a star
createToken('GTE0', '^\\s*>=\\s*0\\.0\\.0\\s*$')
createToken('GTE0PRE', '^\\s*>=\\s*0\\.0\\.0-0\\s*$')

View File

@@ -0,0 +1,183 @@
import { bytes as assertBytes } from './_assert.js';
import { hkdf } from './hkdf.js';
import { sha256 } from './sha256.js';
import { pbkdf2 as _pbkdf2 } from './pbkdf2.js';
import { scrypt as _scrypt } from './scrypt.js';
import { bytesToHex, createView, hexToBytes, toBytes } from './utils.js';
// A tiny KDF for various applications like AES key-gen.
// Uses HKDF in a non-standard way, so it's not "KDF-secure", only "PRF-secure".
// Which is good enough: assume sha2-256 retained preimage resistance.
const SCRYPT_FACTOR = 2 ** 19;
const PBKDF2_FACTOR = 2 ** 17;
// Scrypt KDF
export function scrypt(password: string, salt: string): Uint8Array {
return _scrypt(password, salt, { N: SCRYPT_FACTOR, r: 8, p: 1, dkLen: 32 });
}
// PBKDF2-HMAC-SHA256
export function pbkdf2(password: string, salt: string): Uint8Array {
return _pbkdf2(sha256, password, salt, { c: PBKDF2_FACTOR, dkLen: 32 });
}
// Combines two 32-byte byte arrays
function xor32(a: Uint8Array, b: Uint8Array): Uint8Array {
assertBytes(a, 32);
assertBytes(b, 32);
const arr = new Uint8Array(32);
for (let i = 0; i < 32; i++) {
arr[i] = a[i] ^ b[i];
}
return arr;
}
function strHasLength(str: string, min: number, max: number): boolean {
return typeof str === 'string' && str.length >= min && str.length <= max;
}
/**
* Derives main seed. Takes a lot of time. Prefer `eskdf` method instead.
*/
export function deriveMainSeed(username: string, password: string): Uint8Array {
if (!strHasLength(username, 8, 255)) throw new Error('invalid username');
if (!strHasLength(password, 8, 255)) throw new Error('invalid password');
const scr = scrypt(password + '\u{1}', username + '\u{1}');
const pbk = pbkdf2(password + '\u{2}', username + '\u{2}');
const res = xor32(scr, pbk);
scr.fill(0);
pbk.fill(0);
return res;
}
type AccountID = number | string;
/**
* Converts protocol & accountId pair to HKDF salt & info params.
*/
function getSaltInfo(protocol: string, accountId: AccountID = 0) {
// Note that length here also repeats two lines below
// We do an additional length check here to reduce the scope of DoS attacks
if (!(strHasLength(protocol, 3, 15) && /^[a-z0-9]{3,15}$/.test(protocol))) {
throw new Error('invalid protocol');
}
// Allow string account ids for some protocols
const allowsStr = /^password\d{0,3}|ssh|tor|file$/.test(protocol);
let salt: Uint8Array; // Extract salt. Default is undefined.
if (typeof accountId === 'string') {
if (!allowsStr) throw new Error('accountId must be a number');
if (!strHasLength(accountId, 1, 255)) throw new Error('accountId must be valid string');
salt = toBytes(accountId);
} else if (Number.isSafeInteger(accountId)) {
if (accountId < 0 || accountId > 2 ** 32 - 1) throw new Error('invalid accountId');
// Convert to Big Endian Uint32
salt = new Uint8Array(4);
createView(salt).setUint32(0, accountId, false);
} else {
throw new Error(`accountId must be a number${allowsStr ? ' or string' : ''}`);
}
const info = toBytes(protocol);
return { salt, info };
}
type OptsLength = { keyLength: number };
type OptsMod = { modulus: bigint };
type KeyOpts = undefined | OptsLength | OptsMod;
function countBytes(num: bigint): number {
if (typeof num !== 'bigint' || num <= BigInt(128)) throw new Error('invalid number');
return Math.ceil(num.toString(2).length / 8);
}
/**
* Parses keyLength and modulus options to extract length of result key.
* If modulus is used, adds 64 bits to it as per FIPS 186 B.4.1 to combat modulo bias.
*/
function getKeyLength(options: KeyOpts): number {
if (!options || typeof options !== 'object') return 32;
const hasLen = 'keyLength' in options;
const hasMod = 'modulus' in options;
if (hasLen && hasMod) throw new Error('cannot combine keyLength and modulus options');
if (!hasLen && !hasMod) throw new Error('must have either keyLength or modulus option');
// FIPS 186 B.4.1 requires at least 64 more bits
const l = hasMod ? countBytes(options.modulus) + 8 : options.keyLength;
if (!(typeof l === 'number' && l >= 16 && l <= 8192)) throw new Error('invalid keyLength');
return l;
}
/**
* Converts key to bigint and divides it by modulus. Big Endian.
* Implements FIPS 186 B.4.1, which removes 0 and modulo bias from output.
*/
function modReduceKey(key: Uint8Array, modulus: bigint): Uint8Array {
const _1 = BigInt(1);
const num = BigInt('0x' + bytesToHex(key)); // check for ui8a, then bytesToNumber()
const res = (num % (modulus - _1)) + _1; // Remove 0 from output
if (res < _1) throw new Error('expected positive number'); // Guard against bad values
const len = key.length - 8; // FIPS requires 64 more bits = 8 bytes
const hex = res.toString(16).padStart(len * 2, '0'); // numberToHex()
const bytes = hexToBytes(hex);
if (bytes.length !== len) throw new Error('invalid length of result key');
return bytes;
}
// We are not using classes because constructor cannot be async
type ESKDF = Promise<
Readonly<{
/**
* Derives a child key. Child key will not be associated with any
* other child key because of properties of underlying KDF.
*
* @param protocol - 3-15 character protocol name
* @param accountId - numeric identifier of account
* @param options - `keyLength: 64` or `modulus: 41920438n`
* @example deriveChildKey('aes', 0)
*/
deriveChildKey: (protocol: string, accountId: AccountID, options?: KeyOpts) => Uint8Array;
/**
* Deletes the main seed from eskdf instance
*/
expire: () => void;
/**
* Account fingerprint
*/
fingerprint: string;
}>
>;
/**
* ESKDF
* @param username - username, email, or identifier, min: 8 characters, should have enough entropy
* @param password - password, min: 8 characters, should have enough entropy
* @example
* const kdf = await eskdf('example-university', 'beginning-new-example');
* const key = kdf.deriveChildKey('aes', 0);
* console.log(kdf.fingerprint);
* kdf.expire();
*/
export async function eskdf(username: string, password: string): ESKDF {
// We are using closure + object instead of class because
// we want to make `seed` non-accessible for any external function.
let seed: Uint8Array | undefined = deriveMainSeed(username, password);
function deriveCK(protocol: string, accountId: AccountID = 0, options?: KeyOpts): Uint8Array {
assertBytes(seed, 32);
const { salt, info } = getSaltInfo(protocol, accountId); // validate protocol & accountId
const keyLength = getKeyLength(options); // validate options
const key = hkdf(sha256, seed!, salt, info, keyLength);
// Modulus has already been validated
return options && 'modulus' in options ? modReduceKey(key, options.modulus) : key;
}
function expire() {
if (seed) seed.fill(1);
seed = undefined;
}
// prettier-ignore
const fingerprint = Array.from(deriveCK('fingerprint', 0))
.slice(0, 6)
.map((char) => char.toString(16).padStart(2, '0').toUpperCase())
.join(':');
return Object.freeze({ deriveChildKey: deriveCK, expire, fingerprint });
}

View File

@@ -0,0 +1,69 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = isISBN;
var _assertString = _interopRequireDefault(require("./util/assertString"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var possibleIsbn10 = /^(?:[0-9]{9}X|[0-9]{10})$/;
var possibleIsbn13 = /^(?:[0-9]{13})$/;
var factor = [1, 3];
function isISBN(isbn, options) {
(0, _assertString.default)(isbn); // For backwards compatibility:
// isISBN(str [, version]), i.e. `options` could be used as argument for the legacy `version`
var version = String((options === null || options === void 0 ? void 0 : options.version) || options);
if (!(options !== null && options !== void 0 && options.version || options)) {
return isISBN(isbn, {
version: 10
}) || isISBN(isbn, {
version: 13
});
}
var sanitizedIsbn = isbn.replace(/[\s-]+/g, '');
var checksum = 0;
if (version === '10') {
if (!possibleIsbn10.test(sanitizedIsbn)) {
return false;
}
for (var i = 0; i < version - 1; i++) {
checksum += (i + 1) * sanitizedIsbn.charAt(i);
}
if (sanitizedIsbn.charAt(9) === 'X') {
checksum += 10 * 10;
} else {
checksum += 10 * sanitizedIsbn.charAt(9);
}
if (checksum % 11 === 0) {
return true;
}
} else if (version === '13') {
if (!possibleIsbn13.test(sanitizedIsbn)) {
return false;
}
for (var _i = 0; _i < 12; _i++) {
checksum += factor[_i % 2] * sanitizedIsbn.charAt(_i);
}
if (sanitizedIsbn.charAt(12) - (10 - checksum % 10) % 10 === 0) {
return true;
}
}
return false;
}
module.exports = exports.default;
module.exports.default = exports.default;

View File

@@ -0,0 +1,42 @@
{
"name": "postcss-js",
"version": "4.0.1",
"description": "PostCSS for CSS-in-JS and styles in JS objects",
"keywords": [
"postcss",
"postcss-runner",
"js",
"inline",
"react",
"css",
"cssinjs"
],
"author": "Andrey Sitnik <andrey@sitnik.ru>",
"license": "MIT",
"repository": "postcss/postcss-js",
"engines": {
"node": "^12 || ^14 || >= 16"
},
"exports": {
".": {
"require": "./index.js",
"import": "./index.mjs"
},
"./package.json": "./package.json",
"./async": "./async.js",
"./objectifier": "./objectifier.js",
"./parser": "./parser.js",
"./process-result": "./process-result.js",
"./sync": "./sync.js"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/postcss/"
},
"peerDependencies": {
"postcss": "^8.4.21"
},
"dependencies": {
"camelcase-css": "^2.0.1"
}
}

View File

@@ -0,0 +1,8 @@
export const normalizeValue = (value) => String(value)
.replace(/\r|\n/g, (match, i, str) => {
if ((match === "\r" && str[i + 1] !== "\n")
|| (match === "\n" && str[i - 1] !== "\r")) {
return "\r\n";
}
return match;
});

View File

@@ -0,0 +1,88 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.sha1 = void 0;
const _sha2_js_1 = require("./_sha2.js");
const utils_js_1 = require("./utils.js");
// SHA1 was cryptographically broken.
// It is still widely used in legacy apps. Don't use it for a new protocol.
// RFC 3174
const rotl = (word, shift) => (word << shift) | ((word >>> (32 - shift)) >>> 0);
// Choice: a ? b : c
const Chi = (a, b, c) => (a & b) ^ (~a & c);
// Majority function, true if any two inpust is true
const Maj = (a, b, c) => (a & b) ^ (a & c) ^ (b & c);
// Initial state
const IV = new Uint32Array([0x67452301, 0xefcdab89, 0x98badcfe, 0x10325476, 0xc3d2e1f0]);
// Temporary buffer, not used to store anything between runs
// Named this way because it matches specification.
const SHA1_W = new Uint32Array(80);
class SHA1 extends _sha2_js_1.SHA2 {
constructor() {
super(64, 20, 8, false);
this.A = IV[0] | 0;
this.B = IV[1] | 0;
this.C = IV[2] | 0;
this.D = IV[3] | 0;
this.E = IV[4] | 0;
}
get() {
const { A, B, C, D, E } = this;
return [A, B, C, D, E];
}
set(A, B, C, D, E) {
this.A = A | 0;
this.B = B | 0;
this.C = C | 0;
this.D = D | 0;
this.E = E | 0;
}
process(view, offset) {
for (let i = 0; i < 16; i++, offset += 4)
SHA1_W[i] = view.getUint32(offset, false);
for (let i = 16; i < 80; i++)
SHA1_W[i] = rotl(SHA1_W[i - 3] ^ SHA1_W[i - 8] ^ SHA1_W[i - 14] ^ SHA1_W[i - 16], 1);
// Compression function main loop, 80 rounds
let { A, B, C, D, E } = this;
for (let i = 0; i < 80; i++) {
let F, K;
if (i < 20) {
F = Chi(B, C, D);
K = 0x5a827999;
}
else if (i < 40) {
F = B ^ C ^ D;
K = 0x6ed9eba1;
}
else if (i < 60) {
F = Maj(B, C, D);
K = 0x8f1bbcdc;
}
else {
F = B ^ C ^ D;
K = 0xca62c1d6;
}
const T = (rotl(A, 5) + F + E + K + SHA1_W[i]) | 0;
E = D;
D = C;
C = rotl(B, 30);
B = A;
A = T;
}
// Add the compressed chunk to the current hash value
A = (A + this.A) | 0;
B = (B + this.B) | 0;
C = (C + this.C) | 0;
D = (D + this.D) | 0;
E = (E + this.E) | 0;
this.set(A, B, C, D, E);
}
roundClean() {
SHA1_W.fill(0);
}
destroy() {
this.set(0, 0, 0, 0, 0);
this.buffer.fill(0);
}
}
exports.sha1 = (0, utils_js_1.wrapConstructor)(() => new SHA1());
//# sourceMappingURL=sha1.js.map

View File

@@ -0,0 +1,25 @@
var LazyWrapper = require('./_LazyWrapper'),
arrayPush = require('./_arrayPush'),
arrayReduce = require('./_arrayReduce');
/**
* The base implementation of `wrapperValue` which returns the result of
* performing a sequence of actions on the unwrapped `value`, where each
* successive action is supplied the return value of the previous.
*
* @private
* @param {*} value The unwrapped value.
* @param {Array} actions Actions to perform to resolve the unwrapped value.
* @returns {*} Returns the resolved value.
*/
function baseWrapperValue(value, actions) {
var result = value;
if (result instanceof LazyWrapper) {
result = result.value();
}
return arrayReduce(actions, function(result, action) {
return action.func.apply(action.thisArg, arrayPush([result], action.args));
}, result);
}
module.exports = baseWrapperValue;

View File

@@ -0,0 +1,9 @@
function tidyAtRule(value) {
return value
.replace(/\s+/g, ' ')
.replace(/url\(\s+/g, 'url(')
.replace(/\s+\)/g, ')')
.trim();
}
module.exports = tidyAtRule;

View File

@@ -0,0 +1,30 @@
import { getXHRResponse } from './getXHRResponse';
import { createErrorClass } from '../util/createErrorClass';
export var AjaxError = createErrorClass(function (_super) {
return function AjaxErrorImpl(message, xhr, request) {
this.message = message;
this.name = 'AjaxError';
this.xhr = xhr;
this.request = request;
this.status = xhr.status;
this.responseType = xhr.responseType;
var response;
try {
response = getXHRResponse(xhr);
}
catch (err) {
response = xhr.responseText;
}
this.response = response;
};
});
export var AjaxTimeoutError = (function () {
function AjaxTimeoutErrorImpl(xhr, request) {
AjaxError.call(this, 'ajax timeout', xhr, request);
this.name = 'AjaxTimeoutError';
return this;
}
AjaxTimeoutErrorImpl.prototype = Object.create(AjaxError.prototype);
return AjaxTimeoutErrorImpl;
})();
//# sourceMappingURL=errors.js.map

View File

@@ -0,0 +1,3 @@
import { PaginatingEndpoints } from "./generated/paginating-endpoints";
export { paginatingEndpoints } from "./generated/paginating-endpoints";
export declare function isPaginatingEndpoint(arg: unknown): arg is keyof PaginatingEndpoints;

View File

@@ -0,0 +1,178 @@
'use strict';
var test = require('tape');
var Test = require('tape/lib/test');
var inspect = require('object-inspect');
// eslint-disable-next-line global-require
var hasSymbols = require('has-symbols')() || require('has-symbols/shams')();
var hasBigInts = require('has-bigints')();
var forEach = require('for-each');
var getIterator = process.env.TEST_VARIANT === 'node' ? require('../node') : require('../');
Test.prototype.iterate = function (value, expected, message) {
var i = 0;
this.test(message, function (t) {
var iterator = getIterator(value);
if (!iterator) {
t.fail(inspect(value) + ' is not iterable');
return t.end();
}
if (typeof iterator.next !== 'function') {
t.fail('iterator does not have a next function, got ' + inspect(iterator));
return t.end();
}
var result;
while ((result = iterator.next()) && !result.done) {
var expectedDebug = typeof expected[i] === 'string' ? expected[i].charCodeAt(0) : expected[i];
var actualDebug = typeof result.value === 'string' ? result.value.charCodeAt(0) : result.value;
t.deepEqual(result.value, expected[i], 'index ' + i + ': expected ' + inspect(expectedDebug) + ', got ' + inspect(actualDebug));
i += 1;
}
t.equal(i, expected.length, 'expected ' + expected.length + ' values, got ' + i + ' values');
t.end();
});
};
Test.prototype.noIterate = function (value) {
this.equal(getIterator(value), undefined, inspect(value) + ' is not iterable');
};
Test.prototype.fakeIterator = function (value) {
this.test(inspect(value) + ' with a fake iterator', { skip: !hasSymbols }, function (t) {
var fakeValues = ['fake', 'iterator', 'scary'];
var o = Object(value);
o[Symbol.iterator] = function () {
return getIterator(fakeValues);
};
t.iterate(o, fakeValues, inspect(o) + ' with an overwritten iterator method, yields those values instead');
t.end();
});
};
var getArguments = function () { return arguments; };
var getSloppyArguments = Function('return arguments');
var collect = function createCollection(C, items) {
var c = new C();
forEach(items, function (item) {
if (c.add) {
c.add(item);
} else {
c.set(item[0], item[1]);
}
});
return c;
};
var runTests = function runTests(t) {
t.test('strings', function (st) {
st.iterate('', [], '"" yields nothing');
st.iterate(Object(''), [], inspect(Object('')) + ' yields nothing');
st.iterate('foo', ['f', 'o', 'o'], '"foo" yields three chars');
st.iterate(Object('foo'), ['f', 'o', 'o'], inspect(Object('foo')) + ' yields three chars');
st.iterate('a💩z', ['a', '💩', 'z'], '"a💩z" yields three code points');
st.iterate(Object('a💩z'), ['a', '💩', 'z'], inspect(Object('a💩z')) + ' yields three code points');
st.iterate('\ud83dX', ['\ud83d', 'X'], '(lone surrogate followed by "not a lone surrogate ending") yields one code point');
st.fakeIterator('abc');
st.end();
});
t.test('arrays', function (st) {
st.iterate([], [], '[] yields nothing');
st.iterate([1, 2], [1, 2], '[1, 2] yields [1, 2]');
// eslint-disable-next-line no-sparse-arrays
st.iterate([1, , 3], [1, undefined, 3], 'sparse array does not skip holes');
st.fakeIterator([1, 2, 3]);
st.end();
});
t.test('arguments', function (st) {
st.iterate(getArguments(), [], 'empty arguments object yields nothing');
st.iterate(getSloppyArguments(), [], 'empty sloppy arguments object yields nothing');
st.iterate(getArguments(1, 2, 3), [1, 2, 3], 'arguments object yields all args');
st.iterate(getSloppyArguments(1, 2, 3), [1, 2, 3], 'sloppy arguments object yields all args');
st.fakeIterator(getArguments(1, 2, 3));
st.fakeIterator(getSloppyArguments(1, 2, 3));
st.end();
});
t.test('non-iterables', function (st) {
var numbers = [0, -0, NaN, Infinity, 42];
var nonIterables = [
undefined,
null,
true,
false,
{},
/a/g,
function () {}
];
if (hasSymbols) {
nonIterables.push(Symbol.iterator);
}
if (hasBigInts) {
nonIterables.push(BigInt(42), BigInt(0));
}
forEach(nonIterables, function (nonIterable) {
st.noIterate(nonIterable);
if (nonIterable != null) {
st.fakeIterator(nonIterable);
}
});
if (hasSymbols && NaN[Symbol.iterator]) {
st.comment('# SKIP core-js v2 makes numbers iterable, in violation of the spec');
}
forEach(numbers, function (number) {
if (!hasSymbols || !number[Symbol.iterator]) {
st.noIterate(number);
}
st.fakeIterator(number);
});
st.end();
});
t.test('Map', { skip: typeof Map !== 'function' }, function (st) {
st.iterate(new Map(), [], 'empty Map yields nothing');
var entries = [
[1, 'a'],
[2, 'b'],
[3, 'c']
];
var m = collect(Map, entries);
st.iterate(m, entries, inspect(m) + ' yields expected entries');
st.fakeIterator(collect(Map, entries));
st.end();
});
t.test('Set', { skip: typeof Set !== 'function' }, function (st) {
st.iterate(new Set(), [], 'empty Set yields nothing');
var values = [
1,
2,
3
];
var s = collect(Set, values);
st.iterate(s, values, inspect(s) + ' yields expected values');
st.fakeIterator(collect(Set, values));
st.end();
});
};
test((process.env.TEST_VARIANT || 'standard') + ': getIterator tests', function (t) {
runTests(t);
t.end();
});

View File

@@ -0,0 +1,129 @@
import semver from 'semver';
import chalk from 'chalk';
import Plugin from '../Plugin.js';
const { green, red, redBright } = chalk;
const RELEASE_TYPES = ['patch', 'minor', 'major'];
const PRERELEASE_TYPES = ['prepatch', 'preminor', 'premajor'];
const CONTINUATION_TYPES = ['prerelease', 'pre'];
const ALL_RELEASE_TYPES = [...RELEASE_TYPES, ...PRERELEASE_TYPES, ...CONTINUATION_TYPES];
const CHOICES = {
latestIsPreRelease: [...RELEASE_TYPES, CONTINUATION_TYPES[0]],
preRelease: PRERELEASE_TYPES,
default: [...RELEASE_TYPES, ...PRERELEASE_TYPES]
};
const getIncrementChoices = context => {
const { latestIsPreRelease, isPreRelease, preReleaseId } = context.version;
const types = latestIsPreRelease ? CHOICES.latestIsPreRelease : isPreRelease ? CHOICES.preRelease : CHOICES.default;
const choices = types.map(increment => ({
name: `${increment} (${semver.inc(context.latestVersion, increment, preReleaseId)})`,
value: increment
}));
const otherChoice = {
name: 'Other, please specify...',
value: null
};
return [...choices, otherChoice];
};
const versionTransformer = context => input =>
semver.valid(input) ? (semver.gt(input, context.latestVersion) ? green(input) : red(input)) : redBright(input);
const prompts = {
incrementList: {
type: 'list',
message: () => 'Select increment (next version):',
choices: context => getIncrementChoices(context),
pageSize: 9
},
version: {
type: 'input',
message: () => `Please enter a valid version:`,
transformer: context => versionTransformer(context),
validate: input => !!semver.valid(input) || 'The version must follow the semver standard.'
}
};
class Version extends Plugin {
constructor(...args) {
super(...args);
this.registerPrompts(prompts);
}
getIncrement(options) {
return options.increment;
}
getIncrementedVersionCI(options) {
return this.incrementVersion(options);
}
async getIncrementedVersion(options) {
const { isCI } = this.config;
const version = this.incrementVersion(options);
return version || (isCI ? null : await this.promptIncrementVersion(options));
}
promptIncrementVersion(options) {
return new Promise(resolve => {
this.step({
prompt: 'incrementList',
task: increment =>
increment
? resolve(this.incrementVersion(Object.assign({}, options, { increment })))
: this.step({ prompt: 'version', task: resolve })
});
});
}
isPreRelease(version) {
return Boolean(semver.prerelease(version));
}
isValid(version) {
return Boolean(semver.valid(version));
}
incrementVersion({ latestVersion, increment, isPreRelease, preReleaseId }) {
if (increment === false) return latestVersion;
const latestIsPreRelease = this.isPreRelease(latestVersion);
const isValidVersion = this.isValid(increment);
if (latestVersion) {
this.setContext({ latestIsPreRelease });
}
if (isValidVersion && semver.gte(increment, latestVersion)) {
return increment;
}
if (isPreRelease && !increment && latestIsPreRelease) {
return semver.inc(latestVersion, 'prerelease', preReleaseId);
}
if (this.config.isCI && !increment) {
if (isPreRelease) {
return semver.inc(latestVersion, 'prepatch', preReleaseId);
} else {
return semver.inc(latestVersion, 'patch');
}
}
const normalizedType = RELEASE_TYPES.includes(increment) && isPreRelease ? `pre${increment}` : increment;
if (ALL_RELEASE_TYPES.includes(normalizedType)) {
return semver.inc(latestVersion, normalizedType, preReleaseId);
}
const coercedVersion = !isValidVersion && semver.coerce(increment);
if (coercedVersion) {
this.log.warn(`Coerced invalid semver version "${increment}" into "${coercedVersion}".`);
return coercedVersion.toString();
}
}
}
export default Version;

View File

@@ -0,0 +1,156 @@
'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }
var endpoint = require('@octokit/endpoint');
var universalUserAgent = require('universal-user-agent');
var isPlainObject = require('is-plain-object');
var nodeFetch = _interopDefault(require('node-fetch'));
var requestError = require('@octokit/request-error');
const VERSION = "6.2.3";
function getBufferResponse(response) {
return response.arrayBuffer();
}
function fetchWrapper(requestOptions) {
const log = requestOptions.request && requestOptions.request.log ? requestOptions.request.log : console;
if (isPlainObject.isPlainObject(requestOptions.body) || Array.isArray(requestOptions.body)) {
requestOptions.body = JSON.stringify(requestOptions.body);
}
let headers = {};
let status;
let url;
const fetch = requestOptions.request && requestOptions.request.fetch || globalThis.fetch || /* istanbul ignore next */nodeFetch;
return fetch(requestOptions.url, Object.assign({
method: requestOptions.method,
body: requestOptions.body,
headers: requestOptions.headers,
redirect: requestOptions.redirect
},
// `requestOptions.request.agent` type is incompatible
// see https://github.com/octokit/types.ts/pull/264
requestOptions.request)).then(async response => {
url = response.url;
status = response.status;
for (const keyAndValue of response.headers) {
headers[keyAndValue[0]] = keyAndValue[1];
}
if ("deprecation" in headers) {
const matches = headers.link && headers.link.match(/<([^>]+)>; rel="deprecation"/);
const deprecationLink = matches && matches.pop();
log.warn(`[@octokit/request] "${requestOptions.method} ${requestOptions.url}" is deprecated. It is scheduled to be removed on ${headers.sunset}${deprecationLink ? `. See ${deprecationLink}` : ""}`);
}
if (status === 204 || status === 205) {
return;
}
// GitHub API returns 200 for HEAD requests
if (requestOptions.method === "HEAD") {
if (status < 400) {
return;
}
throw new requestError.RequestError(response.statusText, status, {
response: {
url,
status,
headers,
data: undefined
},
request: requestOptions
});
}
if (status === 304) {
throw new requestError.RequestError("Not modified", status, {
response: {
url,
status,
headers,
data: await getResponseData(response)
},
request: requestOptions
});
}
if (status >= 400) {
const data = await getResponseData(response);
const error = new requestError.RequestError(toErrorMessage(data), status, {
response: {
url,
status,
headers,
data
},
request: requestOptions
});
throw error;
}
return getResponseData(response);
}).then(data => {
return {
status,
url,
headers,
data
};
}).catch(error => {
if (error instanceof requestError.RequestError) throw error;else if (error.name === "AbortError") throw error;
throw new requestError.RequestError(error.message, 500, {
request: requestOptions
});
});
}
async function getResponseData(response) {
const contentType = response.headers.get("content-type");
if (/application\/json/.test(contentType)) {
return response.json();
}
if (!contentType || /^text\/|charset=utf-8$/.test(contentType)) {
return response.text();
}
return getBufferResponse(response);
}
function toErrorMessage(data) {
if (typeof data === "string") return data;
// istanbul ignore else - just in case
if ("message" in data) {
if (Array.isArray(data.errors)) {
return `${data.message}: ${data.errors.map(JSON.stringify).join(", ")}`;
}
return data.message;
}
// istanbul ignore next - just in case
return `Unknown error: ${JSON.stringify(data)}`;
}
function withDefaults(oldEndpoint, newDefaults) {
const endpoint = oldEndpoint.defaults(newDefaults);
const newApi = function (route, parameters) {
const endpointOptions = endpoint.merge(route, parameters);
if (!endpointOptions.request || !endpointOptions.request.hook) {
return fetchWrapper(endpoint.parse(endpointOptions));
}
const request = (route, parameters) => {
return fetchWrapper(endpoint.parse(endpoint.merge(route, parameters)));
};
Object.assign(request, {
endpoint,
defaults: withDefaults.bind(null, endpoint)
});
return endpointOptions.request.hook(request, endpointOptions);
};
return Object.assign(newApi, {
endpoint,
defaults: withDefaults.bind(null, endpoint)
});
}
const request = withDefaults(endpoint.endpoint, {
headers: {
"user-agent": `octokit-request.js/${VERSION} ${universalUserAgent.getUserAgent()}`
}
});
exports.request = request;
//# sourceMappingURL=index.js.map

View File

@@ -0,0 +1,127 @@
# y18n
[![NPM version][npm-image]][npm-url]
[![js-standard-style][standard-image]][standard-url]
[![Conventional Commits](https://img.shields.io/badge/Conventional%20Commits-1.0.0-yellow.svg)](https://conventionalcommits.org)
The bare-bones internationalization library used by yargs.
Inspired by [i18n](https://www.npmjs.com/package/i18n).
## Examples
_simple string translation:_
```js
const __ = require('y18n')().__;
console.log(__('my awesome string %s', 'foo'));
```
output:
`my awesome string foo`
_using tagged template literals_
```js
const __ = require('y18n')().__;
const str = 'foo';
console.log(__`my awesome string ${str}`);
```
output:
`my awesome string foo`
_pluralization support:_
```js
const __n = require('y18n')().__n;
console.log(__n('one fish %s', '%d fishes %s', 2, 'foo'));
```
output:
`2 fishes foo`
## Deno Example
As of `v5` `y18n` supports [Deno](https://github.com/denoland/deno):
```typescript
import y18n from "https://deno.land/x/y18n/deno.ts";
const __ = y18n({
locale: 'pirate',
directory: './test/locales'
}).__
console.info(__`Hi, ${'Ben'} ${'Coe'}!`)
```
You will need to run with `--allow-read` to load alternative locales.
## JSON Language Files
The JSON language files should be stored in a `./locales` folder.
File names correspond to locales, e.g., `en.json`, `pirate.json`.
When strings are observed for the first time they will be
added to the JSON file corresponding to the current locale.
## Methods
### require('y18n')(config)
Create an instance of y18n with the config provided, options include:
* `directory`: the locale directory, default `./locales`.
* `updateFiles`: should newly observed strings be updated in file, default `true`.
* `locale`: what locale should be used.
* `fallbackToLanguage`: should fallback to a language-only file (e.g. `en.json`)
be allowed if a file matching the locale does not exist (e.g. `en_US.json`),
default `true`.
### y18n.\_\_(str, arg, arg, arg)
Print a localized string, `%s` will be replaced with `arg`s.
This function can also be used as a tag for a template literal. You can use it
like this: <code>__&#96;hello ${'world'}&#96;</code>. This will be equivalent to
`__('hello %s', 'world')`.
### y18n.\_\_n(singularString, pluralString, count, arg, arg, arg)
Print a localized string with appropriate pluralization. If `%d` is provided
in the string, the `count` will replace this placeholder.
### y18n.setLocale(str)
Set the current locale being used.
### y18n.getLocale()
What locale is currently being used?
### y18n.updateLocale(obj)
Update the current locale with the key value pairs in `obj`.
## Supported Node.js Versions
Libraries in this ecosystem make a best effort to track
[Node.js' release schedule](https://nodejs.org/en/about/releases/). Here's [a
post on why we think this is important](https://medium.com/the-node-js-collection/maintainers-should-consider-following-node-js-release-schedule-ab08ed4de71a).
## License
ISC
[npm-url]: https://npmjs.org/package/y18n
[npm-image]: https://img.shields.io/npm/v/y18n.svg
[standard-image]: https://img.shields.io/badge/code%20style-standard-brightgreen.svg
[standard-url]: https://github.com/feross/standard

View File

@@ -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.06857,"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.00361,"53":0,"54":0,"55":0,"56":0.00361,"57":0,"58":0,"59":0,"60":0.00361,"61":0,"62":0,"63":0,"64":0,"65":0,"66":0,"67":0,"68":0,"69":0,"70":0,"71":0,"72":0.00361,"73":0,"74":0,"75":0,"76":0,"77":0,"78":0.00361,"79":0,"80":0,"81":0,"82":0,"83":0,"84":0,"85":0,"86":0,"87":0,"88":0.00722,"89":0,"90":0,"91":0.00361,"92":0,"93":0,"94":0,"95":0,"96":0,"97":0,"98":0,"99":0.00361,"100":0.00361,"101":0.00361,"102":0.01083,"103":0.00361,"104":0.00361,"105":0.00361,"106":0.00722,"107":0.01083,"108":0.02526,"109":0.62436,"110":0.41864,"111":0.01083,"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.00361,"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.00361,"42":0,"43":0,"44":0,"45":0,"46":0,"47":0,"48":0,"49":0.00361,"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.00361,"64":0,"65":0.00361,"66":0,"67":0.00361,"68":0,"69":0.00361,"70":0.00361,"71":0.00361,"72":0.00361,"73":0.00361,"74":0.01444,"75":0.00361,"76":0.00361,"77":0.00361,"78":0.00361,"79":0.01083,"80":0.0397,"81":0.01444,"83":0.01444,"84":0.01805,"85":0.00722,"86":0.01083,"87":0.01083,"88":0.00361,"89":0.00722,"90":0.00361,"91":0.00722,"92":0.01083,"93":0.00361,"94":0.00722,"95":0.00722,"96":0.01083,"97":0.00722,"98":0.00722,"99":0.00722,"100":0.02526,"101":0.01083,"102":0.01444,"103":0.03248,"104":0.01805,"105":0.01805,"106":0.02165,"107":0.0397,"108":0.16962,"109":5.21861,"110":3.42133,"111":0.00361,"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.01083,"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.00361,"62":0,"63":0.00722,"64":0.00722,"65":0.00361,"66":0.00361,"67":0.09023,"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.00722,"94":0.08301,"95":0.0794,"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.00361,"13":0,"14":0,"15":0,"16":0,"17":0,"18":0.00361,"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.00361,"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.00361,"107":0.00722,"108":0.01805,"109":0.42225,"110":0.59909},E:{"4":0,"5":0,"6":0,"7":0,"8":0,"9":0,"10":0,"11":0,"12":0,"13":0.00361,"14":0.01444,"15":0.00361,_:"0","3.1":0,"3.2":0,"5.1":0.02165,"6.1":0,"7.1":0,"9.1":0,"10.1":0,"11.1":0,"12.1":0.00361,"13.1":0.01805,"14.1":0.03248,"15.1":0.00722,"15.2-15.3":0.00361,"15.4":0.01083,"15.5":0.01805,"15.6":0.05053,"16.0":0.01083,"16.1":0.03248,"16.2":0.05053,"16.3":0.0397,"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,"7.0-7.1":0,"8.1-8.4":0,"9.0-9.2":0,"9.3":0.01296,"10.0-10.2":0.001,"10.3":0.01197,"11.0-11.2":0.00499,"11.3-11.4":0.00199,"12.0-12.1":0.01296,"12.2-12.5":0.22636,"13.0-13.1":0.00798,"13.2":0.00598,"13.3":0.02493,"13.4-13.7":0.06083,"14.0-14.4":0.23334,"14.5-14.8":0.37693,"15.0-15.1":0.17251,"15.2-15.3":0.20442,"15.4":0.34103,"15.5":0.4926,"15.6":0.86056,"16.0":1.42196,"16.1":1.68522,"16.2":1.60046,"16.3":1.20757,"16.4":0.00199},P:{"4":0.15592,"20":0.34302,"5.0-5.4":0,"6.2-6.4":0,"7.2-7.4":0.05197,"8.2":0,"9.2":0.01039,"10.1":0,"11.1-11.2":0.04158,"12.0":0.01039,"13.0":0.04158,"14.0":0.03118,"15.0":0.02079,"16.0":0.08316,"17.0":0.09355,"18.0":0.09355,"19.0":0.83156},I:{"0":0,"3":0,"4":0,"2.1":0,"2.2":0,"2.3":0,"4.1":0,"4.2-4.3":0,"4.4":0,"4.4.3-4.4.4":0.04361},K:{_:"0 10 11 12 11.1 11.5 12.1"},A:{"6":0,"7":0,"8":0,"9":0,"10":0,"11":0.02165,"5.5":0},N:{"10":0,"11":0},S:{"2.5":0,_:"3.0-3.1"},J:{"7":0,"10":0},O:{"0":1.1376},H:{"0":0.86523},L:{"0":73.0433},R:{_:"0"},M:{"0":0.10865},Q:{"13.1":0}};

View File

@@ -0,0 +1,20 @@
"use strict";
module.exports.mixin = function mixin(target, source) {
const keys = Object.getOwnPropertyNames(source);
for (let i = 0; i < keys.length; ++i) {
Object.defineProperty(target, keys[i], Object.getOwnPropertyDescriptor(source, keys[i]));
}
};
module.exports.wrapperSymbol = Symbol("wrapper");
module.exports.implSymbol = Symbol("impl");
module.exports.wrapperForImpl = function (impl) {
return impl[module.exports.wrapperSymbol];
};
module.exports.implForWrapper = function (wrapper) {
return wrapper[module.exports.implSymbol];
};

View File

@@ -0,0 +1,16 @@
"use strict";
module.exports = function (length) {
if (!length) {
return function () {
return "";
};
}
return function (args) {
var id = String(args[0]), i = 0, currentLength = length;
while (--currentLength) {
id += "\u0001" + args[++i];
}
return id;
};
};

View File

@@ -0,0 +1,177 @@
'use strict';
var parse = require('../');
var test = require('tape');
test('flag boolean default false', function (t) {
var argv = parse(['moo'], {
boolean: ['t', 'verbose'],
default: { verbose: false, t: false },
});
t.deepEqual(argv, {
verbose: false,
t: false,
_: ['moo'],
});
t.deepEqual(typeof argv.verbose, 'boolean');
t.deepEqual(typeof argv.t, 'boolean');
t.end();
});
test('boolean groups', function (t) {
var argv = parse(['-x', '-z', 'one', 'two', 'three'], {
boolean: ['x', 'y', 'z'],
});
t.deepEqual(argv, {
x: true,
y: false,
z: true,
_: ['one', 'two', 'three'],
});
t.deepEqual(typeof argv.x, 'boolean');
t.deepEqual(typeof argv.y, 'boolean');
t.deepEqual(typeof argv.z, 'boolean');
t.end();
});
test('boolean and alias with chainable api', function (t) {
var aliased = ['-h', 'derp'];
var regular = ['--herp', 'derp'];
var aliasedArgv = parse(aliased, {
boolean: 'herp',
alias: { h: 'herp' },
});
var propertyArgv = parse(regular, {
boolean: 'herp',
alias: { h: 'herp' },
});
var expected = {
herp: true,
h: true,
_: ['derp'],
};
t.same(aliasedArgv, expected);
t.same(propertyArgv, expected);
t.end();
});
test('boolean and alias with options hash', function (t) {
var aliased = ['-h', 'derp'];
var regular = ['--herp', 'derp'];
var opts = {
alias: { h: 'herp' },
boolean: 'herp',
};
var aliasedArgv = parse(aliased, opts);
var propertyArgv = parse(regular, opts);
var expected = {
herp: true,
h: true,
_: ['derp'],
};
t.same(aliasedArgv, expected);
t.same(propertyArgv, expected);
t.end();
});
test('boolean and alias array with options hash', function (t) {
var aliased = ['-h', 'derp'];
var regular = ['--herp', 'derp'];
var alt = ['--harp', 'derp'];
var opts = {
alias: { h: ['herp', 'harp'] },
boolean: 'h',
};
var aliasedArgv = parse(aliased, opts);
var propertyArgv = parse(regular, opts);
var altPropertyArgv = parse(alt, opts);
var expected = {
harp: true,
herp: true,
h: true,
_: ['derp'],
};
t.same(aliasedArgv, expected);
t.same(propertyArgv, expected);
t.same(altPropertyArgv, expected);
t.end();
});
test('boolean and alias using explicit true', function (t) {
var aliased = ['-h', 'true'];
var regular = ['--herp', 'true'];
var opts = {
alias: { h: 'herp' },
boolean: 'h',
};
var aliasedArgv = parse(aliased, opts);
var propertyArgv = parse(regular, opts);
var expected = {
herp: true,
h: true,
_: [],
};
t.same(aliasedArgv, expected);
t.same(propertyArgv, expected);
t.end();
});
// regression, see https://github.com/substack/node-optimist/issues/71
test('boolean and --x=true', function (t) {
var parsed = parse(['--boool', '--other=true'], {
boolean: 'boool',
});
t.same(parsed.boool, true);
t.same(parsed.other, 'true');
parsed = parse(['--boool', '--other=false'], {
boolean: 'boool',
});
t.same(parsed.boool, true);
t.same(parsed.other, 'false');
t.end();
});
test('boolean --boool=true', function (t) {
var parsed = parse(['--boool=true'], {
default: {
boool: false,
},
boolean: ['boool'],
});
t.same(parsed.boool, true);
t.end();
});
test('boolean --boool=false', function (t) {
var parsed = parse(['--boool=false'], {
default: {
boool: true,
},
boolean: ['boool'],
});
t.same(parsed.boool, false);
t.end();
});
test('boolean using something similar to true', function (t) {
var opts = { boolean: 'h' };
var result = parse(['-h', 'true.txt'], opts);
var expected = {
h: true,
_: ['true.txt'],
};
t.same(result, expected);
t.end();
});

View File

@@ -0,0 +1,21 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.connect = void 0;
var Subject_1 = require("../Subject");
var innerFrom_1 = require("../observable/innerFrom");
var lift_1 = require("../util/lift");
var fromSubscribable_1 = require("../observable/fromSubscribable");
var DEFAULT_CONFIG = {
connector: function () { return new Subject_1.Subject(); },
};
function connect(selector, config) {
if (config === void 0) { config = DEFAULT_CONFIG; }
var connector = config.connector;
return lift_1.operate(function (source, subscriber) {
var subject = connector();
innerFrom_1.innerFrom(selector(fromSubscribable_1.fromSubscribable(subject))).subscribe(subscriber);
subscriber.add(source.subscribe(subject));
});
}
exports.connect = connect;
//# sourceMappingURL=connect.js.map

View File

@@ -0,0 +1,273 @@
<h1 align="center">Neo-Async</h1>
<p align="center">
<img src="https://raw.githubusercontent.com/wiki/suguru03/neo-async/images/neo_async_v2.png" width="250px" />
</p>
<p align="center">
<a href="https://www.npmjs.com/package/neo-async"><img alt="npm" src="https://img.shields.io/npm/v/neo-async.svg"></a>
<a href="https://travis-ci.org/suguru03/neo-async"><img alt="Travis Status" src="https://img.shields.io/travis/suguru03/neo-async.svg"></a>
<a href="https://codecov.io/gh/suguru03/neo-async"><img alt="Coverage Status" src="https://img.shields.io/codecov/c/github/suguru03/neo-async/master.svg"></a>
<a href="https://www.npmjs.com/package/neo-async"><img alt="download" src="https://img.shields.io/npm/dm/neo-async.svg"></a>
<a href="https://lgtm.com/projects/g/suguru03/neo-async/context:javascript"><img src="https://img.shields.io/lgtm/grade/javascript/g/suguru03/neo-async.svg?logo=lgtm&logoWidth=18" alt="Code Quality: Javascript" height="18"></a>
<a href="https://lgtm.com/projects/g/suguru03/neo-async/alerts"><img src="https://img.shields.io/lgtm/alerts/g/suguru03/neo-async.svg?logo=lgtm&logoWidth=18" alt="Total Alerts" height="18"></a>
<a href="https://app.fossa.io/projects/git%2Bgithub.com%2Fsuguru03%2Fneo-async?ref=badge_shield"><img src="https://app.fossa.io/api/projects/git%2Bgithub.com%2Fsuguru03%2Fneo-async.svg?type=shield" alt="FOSSA" height="18"></a>
</p>
Neo-Async is thought to be used as a drop-in replacement for [Async](https://github.com/caolan/async), it almost fully covers its functionality and runs [faster](#benchmark).
Benchmark is [here](#benchmark)!
Bluebird's benchmark is [here](https://github.com/suguru03/bluebird/tree/aigle/benchmark)!
## Code Coverage
![coverage](https://raw.githubusercontent.com/wiki/suguru03/neo-async/images/coverage.png)
## Installation
### In a browser
```html
<script src="async.min.js"></script>
```
### In an AMD loader
```js
require(['async'], function(async) {});
```
### Promise and async/await
I recommend to use [`Aigle`](https://github.com/suguru03/aigle).
It is optimized for Promise handling and has almost the same functionality as `neo-async`.
### Node.js
#### standard
```bash
$ npm install neo-async
```
```js
var async = require('neo-async');
```
#### replacement
```bash
$ npm install neo-async
$ ln -s ./node_modules/neo-async ./node_modules/async
```
```js
var async = require('async');
```
### Bower
```bash
bower install neo-async
```
## Feature
[JSDoc](http://suguru03.github.io/neo-async/doc/async.html)
\* not in Async
### Collections
- [`each`](http://suguru03.github.io/neo-async/doc/async.each.html)
- [`eachSeries`](http://suguru03.github.io/neo-async/doc/async.eachSeries.html)
- [`eachLimit`](http://suguru03.github.io/neo-async/doc/async.eachLimit.html)
- [`forEach`](http://suguru03.github.io/neo-async/doc/async.each.html) -> [`each`](http://suguru03.github.io/neo-async/doc/async.each.html)
- [`forEachSeries`](http://suguru03.github.io/neo-async/doc/async.eachSeries.html) -> [`eachSeries`](http://suguru03.github.io/neo-async/doc/async.eachSeries.html)
- [`forEachLimit`](http://suguru03.github.io/neo-async/doc/async.eachLimit.html) -> [`eachLimit`](http://suguru03.github.io/neo-async/doc/async.eachLimit.html)
- [`eachOf`](http://suguru03.github.io/neo-async/doc/async.each.html) -> [`each`](http://suguru03.github.io/neo-async/doc/async.each.html)
- [`eachOfSeries`](http://suguru03.github.io/neo-async/doc/async.eachSeries.html) -> [`eachSeries`](http://suguru03.github.io/neo-async/doc/async.eachSeries.html)
- [`eachOfLimit`](http://suguru03.github.io/neo-async/doc/async.eachLimit.html) -> [`eachLimit`](http://suguru03.github.io/neo-async/doc/async.eachLimit.html)
- [`forEachOf`](http://suguru03.github.io/neo-async/doc/async.each.html) -> [`each`](http://suguru03.github.io/neo-async/doc/async.each.html)
- [`forEachOfSeries`](http://suguru03.github.io/neo-async/doc/async.eachSeries.html) -> [`eachSeries`](http://suguru03.github.io/neo-async/doc/async.eachSeries.html)
- [`eachOfLimit`](http://suguru03.github.io/neo-async/doc/async.eachLimit.html) -> [`forEachLimit`](http://suguru03.github.io/neo-async/doc/async.eachLimit.html)
- [`map`](http://suguru03.github.io/neo-async/doc/async.map.html)
- [`mapSeries`](http://suguru03.github.io/neo-async/doc/async.mapSeries.html)
- [`mapLimit`](http://suguru03.github.io/neo-async/doc/async.mapLimit.html)
- [`mapValues`](http://suguru03.github.io/neo-async/doc/async.mapValues.html)
- [`mapValuesSeries`](http://suguru03.github.io/neo-async/doc/async.mapValuesSeries.html)
- [`mapValuesLimit`](http://suguru03.github.io/neo-async/doc/async.mapValuesLimit.html)
- [`filter`](http://suguru03.github.io/neo-async/doc/async.filter.html)
- [`filterSeries`](http://suguru03.github.io/neo-async/doc/async.filterSeries.html)
- [`filterLimit`](http://suguru03.github.io/neo-async/doc/async.filterLimit.html)
- [`select`](http://suguru03.github.io/neo-async/doc/async.filter.html) -> [`filter`](http://suguru03.github.io/neo-async/doc/async.filter.html)
- [`selectSeries`](http://suguru03.github.io/neo-async/doc/async.filterSeries.html) -> [`filterSeries`](http://suguru03.github.io/neo-async/doc/async.filterSeries.html)
- [`selectLimit`](http://suguru03.github.io/neo-async/doc/async.filterLimit.html) -> [`filterLimit`](http://suguru03.github.io/neo-async/doc/async.filterLimit.html)
- [`reject`](http://suguru03.github.io/neo-async/doc/async.reject.html)
- [`rejectSeries`](http://suguru03.github.io/neo-async/doc/async.rejectSeries.html)
- [`rejectLimit`](http://suguru03.github.io/neo-async/doc/async.rejectLimit.html)
- [`detect`](http://suguru03.github.io/neo-async/doc/async.detect.html)
- [`detectSeries`](http://suguru03.github.io/neo-async/doc/async.detectSeries.html)
- [`detectLimit`](http://suguru03.github.io/neo-async/doc/async.detectLimit.html)
- [`find`](http://suguru03.github.io/neo-async/doc/async.detect.html) -> [`detect`](http://suguru03.github.io/neo-async/doc/async.detect.html)
- [`findSeries`](http://suguru03.github.io/neo-async/doc/async.detectSeries.html) -> [`detectSeries`](http://suguru03.github.io/neo-async/doc/async.detectSeries.html)
- [`findLimit`](http://suguru03.github.io/neo-async/doc/async.detectLimit.html) -> [`detectLimit`](http://suguru03.github.io/neo-async/doc/async.detectLimit.html)
- [`pick`](http://suguru03.github.io/neo-async/doc/async.pick.html) *
- [`pickSeries`](http://suguru03.github.io/neo-async/doc/async.pickSeries.html) *
- [`pickLimit`](http://suguru03.github.io/neo-async/doc/async.pickLimit.html) *
- [`omit`](http://suguru03.github.io/neo-async/doc/async.omit.html) *
- [`omitSeries`](http://suguru03.github.io/neo-async/doc/async.omitSeries.html) *
- [`omitLimit`](http://suguru03.github.io/neo-async/doc/async.omitLimit.html) *
- [`reduce`](http://suguru03.github.io/neo-async/doc/async.reduce.html)
- [`inject`](http://suguru03.github.io/neo-async/doc/async.reduce.html) -> [`reduce`](http://suguru03.github.io/neo-async/doc/async.reduce.html)
- [`foldl`](http://suguru03.github.io/neo-async/doc/async.reduce.html) -> [`reduce`](http://suguru03.github.io/neo-async/doc/async.reduce.html)
- [`reduceRight`](http://suguru03.github.io/neo-async/doc/async.reduceRight.html)
- [`foldr`](http://suguru03.github.io/neo-async/doc/async.reduceRight.html) -> [`reduceRight`](http://suguru03.github.io/neo-async/doc/async.reduceRight.html)
- [`transform`](http://suguru03.github.io/neo-async/doc/async.transform.html)
- [`transformSeries`](http://suguru03.github.io/neo-async/doc/async.transformSeries.html) *
- [`transformLimit`](http://suguru03.github.io/neo-async/doc/async.transformLimit.html) *
- [`sortBy`](http://suguru03.github.io/neo-async/doc/async.sortBy.html)
- [`sortBySeries`](http://suguru03.github.io/neo-async/doc/async.sortBySeries.html) *
- [`sortByLimit`](http://suguru03.github.io/neo-async/doc/async.sortByLimit.html) *
- [`some`](http://suguru03.github.io/neo-async/doc/async.some.html)
- [`someSeries`](http://suguru03.github.io/neo-async/doc/async.someSeries.html)
- [`someLimit`](http://suguru03.github.io/neo-async/doc/async.someLimit.html)
- [`any`](http://suguru03.github.io/neo-async/doc/async.some.html) -> [`some`](http://suguru03.github.io/neo-async/doc/async.some.html)
- [`anySeries`](http://suguru03.github.io/neo-async/doc/async.someSeries.html) -> [`someSeries`](http://suguru03.github.io/neo-async/doc/async.someSeries.html)
- [`anyLimit`](http://suguru03.github.io/neo-async/doc/async.someLimit.html) -> [`someLimit`](http://suguru03.github.io/neo-async/doc/async.someLimit.html)
- [`every`](http://suguru03.github.io/neo-async/doc/async.every.html)
- [`everySeries`](http://suguru03.github.io/neo-async/doc/async.everySeries.html)
- [`everyLimit`](http://suguru03.github.io/neo-async/doc/async.everyLimit.html)
- [`all`](http://suguru03.github.io/neo-async/doc/async.every.html) -> [`every`](http://suguru03.github.io/neo-async/doc/async.every.html)
- [`allSeries`](http://suguru03.github.io/neo-async/doc/async.everySeries.html) -> [`every`](http://suguru03.github.io/neo-async/doc/async.everySeries.html)
- [`allLimit`](http://suguru03.github.io/neo-async/doc/async.everyLimit.html) -> [`every`](http://suguru03.github.io/neo-async/doc/async.everyLimit.html)
- [`concat`](http://suguru03.github.io/neo-async/doc/async.concat.html)
- [`concatSeries`](http://suguru03.github.io/neo-async/doc/async.concatSeries.html)
- [`concatLimit`](http://suguru03.github.io/neo-async/doc/async.concatLimit.html) *
### Control Flow
- [`parallel`](http://suguru03.github.io/neo-async/doc/async.parallel.html)
- [`series`](http://suguru03.github.io/neo-async/doc/async.series.html)
- [`parallelLimit`](http://suguru03.github.io/neo-async/doc/async.series.html)
- [`tryEach`](http://suguru03.github.io/neo-async/doc/async.tryEach.html)
- [`waterfall`](http://suguru03.github.io/neo-async/doc/async.waterfall.html)
- [`angelFall`](http://suguru03.github.io/neo-async/doc/async.angelFall.html) *
- [`angelfall`](http://suguru03.github.io/neo-async/doc/async.angelFall.html) -> [`angelFall`](http://suguru03.github.io/neo-async/doc/async.angelFall.html) *
- [`whilst`](#whilst)
- [`doWhilst`](#doWhilst)
- [`until`](#until)
- [`doUntil`](#doUntil)
- [`during`](#during)
- [`doDuring`](#doDuring)
- [`forever`](#forever)
- [`compose`](#compose)
- [`seq`](#seq)
- [`applyEach`](#applyEach)
- [`applyEachSeries`](#applyEachSeries)
- [`queue`](#queue)
- [`priorityQueue`](#priorityQueue)
- [`cargo`](#cargo)
- [`auto`](#auto)
- [`autoInject`](#autoInject)
- [`retry`](#retry)
- [`retryable`](#retryable)
- [`iterator`](#iterator)
- [`times`](http://suguru03.github.io/neo-async/doc/async.times.html)
- [`timesSeries`](http://suguru03.github.io/neo-async/doc/async.timesSeries.html)
- [`timesLimit`](http://suguru03.github.io/neo-async/doc/async.timesLimit.html)
- [`race`](#race)
### Utils
- [`apply`](#apply)
- [`setImmediate`](#setImmediate)
- [`nextTick`](#nextTick)
- [`memoize`](#memoize)
- [`unmemoize`](#unmemoize)
- [`ensureAsync`](#ensureAsync)
- [`constant`](#constant)
- [`asyncify`](#asyncify)
- [`wrapSync`](#asyncify) -> [`asyncify`](#asyncify)
- [`log`](#log)
- [`dir`](#dir)
- [`timeout`](http://suguru03.github.io/neo-async/doc/async.timeout.html)
- [`reflect`](#reflect)
- [`reflectAll`](#reflectAll)
- [`createLogger`](#createLogger)
## Mode
- [`safe`](#safe) *
- [`fast`](#fast) *
## Benchmark
[Benchmark: Async vs Neo-Async](http://suguru03.hatenablog.com/entry/2016/06/10/135559)
### How to check
```bash
$ node perf
```
### Environment
* Darwin 17.3.0 x64
* Node.js v8.9.4
* async v2.6.0
* neo-async v2.5.0
* benchmark v2.1.4
### Result
The value is the ratio (Neo-Async/Async) of the average speed.
#### Collections
|function|benchmark|
|---|--:|
|each/forEach|2.43|
|eachSeries/forEachSeries|1.75|
|eachLimit/forEachLimit|1.68|
|eachOf|3.29|
|eachOfSeries|1.50|
|eachOfLimit|1.59|
|map|3.95|
|mapSeries|1.81|
|mapLimit|1.27|
|mapValues|2.73|
|mapValuesSeries|1.59|
|mapValuesLimit|1.23|
|filter|3.00|
|filterSeries|1.74|
|filterLimit|1.17|
|reject|4.59|
|rejectSeries|2.31|
|rejectLimit|1.58|
|detect|4.30|
|detectSeries|1.86|
|detectLimit|1.32|
|reduce|1.82|
|transform|2.46|
|sortBy|4.08|
|some|2.19|
|someSeries|1.83|
|someLimit|1.32|
|every|2.09|
|everySeries|1.84|
|everyLimit|1.35|
|concat|3.79|
|concatSeries|4.45|
#### Control Flow
|funciton|benchmark|
|---|--:|
|parallel|2.93|
|series|1.96|
|waterfall|1.29|
|whilst|1.00|
|doWhilst|1.12|
|until|1.12|
|doUntil|1.12|
|during|1.18|
|doDuring|2.42|
|times|4.25|
|auto|1.97|
## License
[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fsuguru03%2Fneo-async.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fsuguru03%2Fneo-async?ref=badge_large)

View File

@@ -0,0 +1,207 @@
'use strict';
var _Object$setPrototypeO;
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
var finished = require('./end-of-stream');
var kLastResolve = Symbol('lastResolve');
var kLastReject = Symbol('lastReject');
var kError = Symbol('error');
var kEnded = Symbol('ended');
var kLastPromise = Symbol('lastPromise');
var kHandlePromise = Symbol('handlePromise');
var kStream = Symbol('stream');
function createIterResult(value, done) {
return {
value: value,
done: done
};
}
function readAndResolve(iter) {
var resolve = iter[kLastResolve];
if (resolve !== null) {
var data = iter[kStream].read(); // we defer if data is null
// we can be expecting either 'end' or
// 'error'
if (data !== null) {
iter[kLastPromise] = null;
iter[kLastResolve] = null;
iter[kLastReject] = null;
resolve(createIterResult(data, false));
}
}
}
function onReadable(iter) {
// we wait for the next tick, because it might
// emit an error with process.nextTick
process.nextTick(readAndResolve, iter);
}
function wrapForNext(lastPromise, iter) {
return function (resolve, reject) {
lastPromise.then(function () {
if (iter[kEnded]) {
resolve(createIterResult(undefined, true));
return;
}
iter[kHandlePromise](resolve, reject);
}, reject);
};
}
var AsyncIteratorPrototype = Object.getPrototypeOf(function () {});
var ReadableStreamAsyncIteratorPrototype = Object.setPrototypeOf((_Object$setPrototypeO = {
get stream() {
return this[kStream];
},
next: function next() {
var _this = this;
// if we have detected an error in the meanwhile
// reject straight away
var error = this[kError];
if (error !== null) {
return Promise.reject(error);
}
if (this[kEnded]) {
return Promise.resolve(createIterResult(undefined, true));
}
if (this[kStream].destroyed) {
// We need to defer via nextTick because if .destroy(err) is
// called, the error will be emitted via nextTick, and
// we cannot guarantee that there is no error lingering around
// waiting to be emitted.
return new Promise(function (resolve, reject) {
process.nextTick(function () {
if (_this[kError]) {
reject(_this[kError]);
} else {
resolve(createIterResult(undefined, true));
}
});
});
} // if we have multiple next() calls
// we will wait for the previous Promise to finish
// this logic is optimized to support for await loops,
// where next() is only called once at a time
var lastPromise = this[kLastPromise];
var promise;
if (lastPromise) {
promise = new Promise(wrapForNext(lastPromise, this));
} else {
// fast path needed to support multiple this.push()
// without triggering the next() queue
var data = this[kStream].read();
if (data !== null) {
return Promise.resolve(createIterResult(data, false));
}
promise = new Promise(this[kHandlePromise]);
}
this[kLastPromise] = promise;
return promise;
}
}, _defineProperty(_Object$setPrototypeO, Symbol.asyncIterator, function () {
return this;
}), _defineProperty(_Object$setPrototypeO, "return", function _return() {
var _this2 = this;
// destroy(err, cb) is a private API
// we can guarantee we have that here, because we control the
// Readable class this is attached to
return new Promise(function (resolve, reject) {
_this2[kStream].destroy(null, function (err) {
if (err) {
reject(err);
return;
}
resolve(createIterResult(undefined, true));
});
});
}), _Object$setPrototypeO), AsyncIteratorPrototype);
var createReadableStreamAsyncIterator = function createReadableStreamAsyncIterator(stream) {
var _Object$create;
var iterator = Object.create(ReadableStreamAsyncIteratorPrototype, (_Object$create = {}, _defineProperty(_Object$create, kStream, {
value: stream,
writable: true
}), _defineProperty(_Object$create, kLastResolve, {
value: null,
writable: true
}), _defineProperty(_Object$create, kLastReject, {
value: null,
writable: true
}), _defineProperty(_Object$create, kError, {
value: null,
writable: true
}), _defineProperty(_Object$create, kEnded, {
value: stream._readableState.endEmitted,
writable: true
}), _defineProperty(_Object$create, kHandlePromise, {
value: function value(resolve, reject) {
var data = iterator[kStream].read();
if (data) {
iterator[kLastPromise] = null;
iterator[kLastResolve] = null;
iterator[kLastReject] = null;
resolve(createIterResult(data, false));
} else {
iterator[kLastResolve] = resolve;
iterator[kLastReject] = reject;
}
},
writable: true
}), _Object$create));
iterator[kLastPromise] = null;
finished(stream, function (err) {
if (err && err.code !== 'ERR_STREAM_PREMATURE_CLOSE') {
var reject = iterator[kLastReject]; // reject if we are waiting for data in the Promise
// returned by next() and store the error
if (reject !== null) {
iterator[kLastPromise] = null;
iterator[kLastResolve] = null;
iterator[kLastReject] = null;
reject(err);
}
iterator[kError] = err;
return;
}
var resolve = iterator[kLastResolve];
if (resolve !== null) {
iterator[kLastPromise] = null;
iterator[kLastResolve] = null;
iterator[kLastReject] = null;
resolve(createIterResult(undefined, true));
}
iterator[kEnded] = true;
});
stream.on('readable', onReadable.bind(null, iterator));
return iterator;
};
module.exports = createReadableStreamAsyncIterator;

View File

@@ -0,0 +1,45 @@
{
"name": "@tootallnate/once",
"version": "1.1.2",
"description": "Creates a Promise that waits for a single event",
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
"files": [
"dist"
],
"scripts": {
"prebuild": "rimraf dist",
"build": "tsc",
"test": "mocha --reporter spec",
"test-lint": "eslint src --ext .js,.ts",
"prepublishOnly": "npm run build"
},
"repository": {
"type": "git",
"url": "git://github.com/TooTallNate/once.git"
},
"keywords": [],
"author": "Nathan Rajlich <nathan@tootallnate.net> (http://n8.io/)",
"license": "MIT",
"bugs": {
"url": "https://github.com/TooTallNate/once/issues"
},
"devDependencies": {
"@types/node": "^12.12.11",
"@typescript-eslint/eslint-plugin": "1.6.0",
"@typescript-eslint/parser": "1.1.0",
"eslint": "5.16.0",
"eslint-config-airbnb": "17.1.0",
"eslint-config-prettier": "4.1.0",
"eslint-import-resolver-typescript": "1.1.1",
"eslint-plugin-import": "2.16.0",
"eslint-plugin-jsx-a11y": "6.2.1",
"eslint-plugin-react": "7.12.4",
"mocha": "^6.2.2",
"rimraf": "^3.0.0",
"typescript": "^3.7.3"
},
"engines": {
"node": ">= 6"
}
}

View File

@@ -0,0 +1,4 @@
export type InvalidCredentialsError = {
name: string;
message: string;
};

View File

@@ -0,0 +1,9 @@
"use strict";
var ensureString = require("type/string/ensure");
module.exports = function () {
var input = ensureString(this);
if (!input) return input;
return input.charAt(0).toUpperCase() + input.slice(1);
};