new license file version [CI SKIP]
This commit is contained in:
@@ -0,0 +1,3 @@
|
||||
'use strict';
|
||||
|
||||
module.exports = require('./async').apply;
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,31 @@
|
||||
import { Readable } from 'svelte/store';
|
||||
export declare function noop(): void;
|
||||
export declare const identity: (x: any) => any;
|
||||
export declare function assign<T, S>(tar: T, src: S): T & S;
|
||||
export declare function is_promise<T = any>(value: any): value is PromiseLike<T>;
|
||||
export declare function add_location(element: any, file: any, line: any, column: any, char: any): void;
|
||||
export declare function run(fn: any): any;
|
||||
export declare function blank_object(): any;
|
||||
export declare function run_all(fns: Function[]): void;
|
||||
export declare function is_function(thing: any): thing is Function;
|
||||
export declare function safe_not_equal(a: any, b: any): boolean;
|
||||
export declare function src_url_equal(element_src: any, url: any): boolean;
|
||||
export declare function not_equal(a: any, b: any): boolean;
|
||||
export declare function is_empty(obj: any): boolean;
|
||||
export declare function validate_store(store: any, name: any): void;
|
||||
export declare function subscribe(store: any, ...callbacks: any[]): any;
|
||||
export declare function get_store_value<T>(store: Readable<T>): T;
|
||||
export declare function component_subscribe(component: any, store: any, callback: any): void;
|
||||
export declare function create_slot(definition: any, ctx: any, $$scope: any, fn: any): any;
|
||||
export declare function get_slot_changes(definition: any, $$scope: any, dirty: any, fn: any): any;
|
||||
export declare function update_slot_base(slot: any, slot_definition: any, ctx: any, $$scope: any, slot_changes: any, get_slot_context_fn: any): void;
|
||||
export declare function update_slot(slot: any, slot_definition: any, ctx: any, $$scope: any, dirty: any, get_slot_changes_fn: any, get_slot_context_fn: any): void;
|
||||
export declare function get_all_dirty_from_scope($$scope: any): any[] | -1;
|
||||
export declare function exclude_internal_props(props: any): {};
|
||||
export declare function compute_rest_props(props: any, keys: any): {};
|
||||
export declare function compute_slots(slots: any): {};
|
||||
export declare function once(fn: any): (this: any, ...args: any[]) => void;
|
||||
export declare function null_to_empty(value: any): any;
|
||||
export declare function set_store_value(store: any, ret: any, value: any): any;
|
||||
export declare const has_prop: (obj: any, prop: any) => any;
|
||||
export declare function action_destroyer(action_result: any): any;
|
||||
@@ -0,0 +1,68 @@
|
||||
{
|
||||
"name": "stop-iteration-iterator",
|
||||
"version": "1.0.0",
|
||||
"description": "Firefox 17-26 iterators throw a StopIteration object to indicate \"done\". This normalizes it.",
|
||||
"main": "index.js",
|
||||
"exports": {
|
||||
".": "./index.js",
|
||||
"./package.json": "./package.json"
|
||||
},
|
||||
"scripts": {
|
||||
"prepack": "npmignore --auto --commentLines=autogenerated",
|
||||
"prepublish": "not-in-publish || npm run prepublishOnly",
|
||||
"prepublishOnly": "safe-publish-latest",
|
||||
"lint": "eslint --ext=js,mjs .",
|
||||
"pretest": "npm run lint",
|
||||
"tests-only": "nyc tape 'test/**/*.js'",
|
||||
"test": "npm run tests-only",
|
||||
"posttest": "aud --production",
|
||||
"version": "auto-changelog && git add CHANGELOG.md",
|
||||
"postversion": "auto-changelog && git add CHANGELOG.md && git commit --no-edit --amend && git tag -f \"v$(node -e \"console.log(require('./package.json').version)\")\""
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/ljharb/stop-iteration-iterator.git"
|
||||
},
|
||||
"keywords": [
|
||||
"stopiteration",
|
||||
"iterator",
|
||||
"firefox"
|
||||
],
|
||||
"author": "Jordan Harband <ljharb@gmail.com>",
|
||||
"license": "MIT",
|
||||
"bugs": {
|
||||
"url": "https://github.com/ljharb/stop-iteration-iterator/issues"
|
||||
},
|
||||
"homepage": "https://github.com/ljharb/stop-iteration-iterator#readme",
|
||||
"dependencies": {
|
||||
"internal-slot": "^1.0.4"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@ljharb/eslint-config": "^21.0.1",
|
||||
"aud": "^2.0.2",
|
||||
"auto-changelog": "^2.4.0",
|
||||
"eslint": "=8.8.0",
|
||||
"npmignore": "^0.3.0",
|
||||
"nyc": "^10.3.2",
|
||||
"safe-publish-latest": "^2.0.0",
|
||||
"tape": "^5.6.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
},
|
||||
"testling": {
|
||||
"files": "test/index.js"
|
||||
},
|
||||
"auto-changelog": {
|
||||
"output": "CHANGELOG.md",
|
||||
"template": "keepachangelog",
|
||||
"unreleased": false,
|
||||
"commitLimit": false,
|
||||
"backfillLimit": false
|
||||
},
|
||||
"publishConfig": {
|
||||
"ignore": [
|
||||
".github/workflows"
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
import type {JsonPrimitive, JsonValue} from './basic';
|
||||
|
||||
type JsonifiableObject = {[Key in string]?: Jsonifiable} | {toJSON: () => Jsonifiable};
|
||||
type JsonifiableArray = readonly Jsonifiable[];
|
||||
|
||||
/**
|
||||
Matches a value that can be losslessly converted to JSON.
|
||||
|
||||
Can be used to type values that you expect to pass to `JSON.stringify`.
|
||||
|
||||
`undefined` is allowed in object fields (for example, `{a?: number}`) as a special case even though `JSON.stringify({a: undefined})` is `{}` because it makes this class more widely useful and checking for undefined-but-present values is likely an anti-pattern.
|
||||
|
||||
@example
|
||||
```
|
||||
import type {Jsonifiable} from 'type-fest';
|
||||
|
||||
// @ts-expect-error
|
||||
const error: Jsonifiable = {
|
||||
map: new Map([['a', 1]]),
|
||||
};
|
||||
|
||||
JSON.stringify(error);
|
||||
//=> {"map": {}}
|
||||
|
||||
const good: Jsonifiable = {
|
||||
number: 3,
|
||||
date: new Date(),
|
||||
missing: undefined,
|
||||
}
|
||||
|
||||
JSON.stringify(good);
|
||||
//=> {"number": 3, "date": "2022-10-17T22:22:35.920Z"}
|
||||
```
|
||||
|
||||
@category JSON
|
||||
*/
|
||||
export type Jsonifiable = JsonPrimitive | JsonifiableObject | JsonifiableArray;
|
||||
@@ -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.00508,"46":0,"47":0,"48":0,"49":0,"50":0,"51":0,"52":0,"53":0,"54":0,"55":0,"56":0,"57":0,"58":0,"59":0,"60":0,"61":0,"62":0,"63":0,"64":0,"65":0,"66":0,"67":0,"68":0,"69":0,"70":0,"71":0,"72":0,"73":0,"74":0,"75":0,"76":0,"77":0,"78":0,"79":0,"80":0,"81":0,"82":0,"83":0,"84":0,"85":0,"86":0,"87":0.00508,"88":0,"89":0,"90":0,"91":0,"92":0,"93":0,"94":0,"95":0,"96":0,"97":0,"98":0,"99":0,"100":0,"101":0,"102":0.03047,"103":0.02032,"104":0,"105":0,"106":0.03555,"107":0.00508,"108":0.01524,"109":0.57901,"110":0.38093,"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,"36":0,"37":0,"38":0,"39":0,"40":0,"41":0,"42":0,"43":0,"44":0,"45":0,"46":0,"47":0.01524,"48":0,"49":0.00508,"50":0,"51":0,"52":0,"53":0,"54":0,"55":0,"56":0,"57":0,"58":0,"59":0,"60":0,"61":0,"62":0,"63":0,"64":0,"65":0,"66":0,"67":0,"68":0,"69":0,"70":0,"71":0,"72":0,"73":0,"74":0,"75":0,"76":0.01524,"77":0.00508,"78":0,"79":0.12698,"80":0.0254,"81":0.04063,"83":0.03555,"84":0.01016,"85":0,"86":0.00508,"87":0.00508,"88":0,"89":0.01016,"90":0,"91":0.01016,"92":0,"93":0.00508,"94":0,"95":0.01016,"96":0.00508,"97":0.00508,"98":0,"99":0.01016,"100":0.00508,"101":0.00508,"102":0.00508,"103":0.16253,"104":0.01524,"105":0.00508,"106":0.01016,"107":0.04063,"108":0.91422,"109":8.01974,"110":5.18566,"111":0.0254,"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.0254,"29":0,"30":0,"31":0,"32":0,"33":0,"34":0,"35":0,"36":0,"37":0,"38":0,"39":0,"40":0,"41":0,"42":0,"43":0,"44":0,"45":0,"46":0,"47":0,"48":0,"49":0,"50":0,"51":0,"52":0,"53":0,"54":0,"55":0,"56":0,"57":0,"58":0,"60":0,"62":0,"63":0,"64":0,"65":0,"66":0,"67":0.00508,"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.01524,"94":0.45711,"95":0.21332,"9.5-9.6":0,"10.0-10.1":0,"10.5":0,"10.6":0,"11.1":0,"11.5":0,"11.6":0,"12.1":0},B:{"12":0,"13":0,"14":0,"15":0,"16":0.00508,"17":0,"18":0,"79":0,"80":0,"81":0,"83":0,"84":0,"85":0,"86":0,"87":0,"88":0,"89":0.01016,"90":0,"91":0,"92":0,"93":0,"94":0,"95":0,"96":0,"97":0,"98":0,"99":0,"100":0,"101":0,"102":0,"103":0,"104":0,"105":0,"106":0,"107":0.07111,"108":0.14221,"109":2.38205,"110":2.37189},E:{"4":0,"5":0,"6":0,"7":0,"8":0,"9":0,"10":0,"11":0,"12":0,"13":0.00508,"14":0.01524,"15":0.00508,_:"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.00508,"12.1":0.00508,"13.1":0.08126,"14.1":0.13205,"15.1":0.01524,"15.2-15.3":0.01016,"15.4":0.04063,"15.5":0.08634,"15.6":0.50282,"16.0":0.04063,"16.1":0.2184,"16.2":0.76185,"16.3":0.4114,"16.4":0},G:{"8":0,"3.2":0,"4.0-4.1":0,"4.2-4.3":0,"5.0-5.1":0.00473,"6.0-6.1":0,"7.0-7.1":0.02838,"8.1-8.4":0,"9.0-9.2":0,"9.3":0.23884,"10.0-10.2":0,"10.3":0.09459,"11.0-11.2":0.01655,"11.3-11.4":0.01419,"12.0-12.1":0,"12.2-12.5":0.4564,"13.0-13.1":0,"13.2":0,"13.3":0,"13.4-13.7":0.02601,"14.0-14.4":0.10168,"14.5-14.8":0.29796,"15.0-15.1":0.0402,"15.2-15.3":0.37836,"15.4":0.18918,"15.5":0.26722,"15.6":1.49215,"16.0":2.50899,"16.1":4.42917,"16.2":8.60294,"16.3":3.06471,"16.4":0.01182},P:{"4":0.1085,"20":1.56239,"5.0-5.4":0,"6.2-6.4":0,"7.2-7.4":0.1736,"8.2":0,"9.2":0,"10.1":0,"11.1-11.2":0.0434,"12.0":0,"13.0":0.1519,"14.0":0.05425,"15.0":0.03255,"16.0":0.03255,"17.0":0.1302,"18.0":0.07595,"19.0":3.03798},I:{"0":0,"3":0,"4":0.17676,"2.1":0,"2.2":0,"2.3":0,"4.1":0,"4.2-4.3":0.06629,"4.4":0,"4.4.3-4.4.4":1.01639},K:{_:"0 10 11 12 11.1 11.5 12.1"},A:{"6":0,"7":0,"8":0,"9":0,"10":0.00508,"11":0.01016,"5.5":0},N:{"10":0,"11":0},S:{"2.5":0,_:"3.0-3.1"},J:{"7":0,"10":0},O:{"0":0.08366},H:{"0":0.19567},L:{"0":43.50494},R:{_:"0"},M:{"0":0.36908},Q:{"13.1":0}};
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"Subscriber.js","sourceRoot":"","sources":["../../../src/internal/Subscriber.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAE/C,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9D,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AACnE,OAAO,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AACnC,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AACrG,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAC9D,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAYnD,MAAM,OAAO,UAAc,SAAQ,YAAY;IA6B7C,YAAY,WAA6C;QACvD,KAAK,EAAE,CAAC;QATA,cAAS,GAAY,KAAK,CAAC;QAUnC,IAAI,WAAW,EAAE;YACf,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;YAG/B,IAAI,cAAc,CAAC,WAAW,CAAC,EAAE;gBAC/B,WAAW,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;aACvB;SACF;aAAM;YACL,IAAI,CAAC,WAAW,GAAG,cAAc,CAAC;SACnC;IACH,CAAC;IAzBD,MAAM,CAAC,MAAM,CAAI,IAAsB,EAAE,KAAyB,EAAE,QAAqB;QACvF,OAAO,IAAI,cAAc,CAAC,IAAI,EAAE,KAAK,EAAE,QAAQ,CAAC,CAAC;IACnD,CAAC;IAgCD,IAAI,CAAC,KAAS;QACZ,IAAI,IAAI,CAAC,SAAS,EAAE;YAClB,yBAAyB,CAAC,gBAAgB,CAAC,KAAK,CAAC,EAAE,IAAI,CAAC,CAAC;SAC1D;aAAM;YACL,IAAI,CAAC,KAAK,CAAC,KAAM,CAAC,CAAC;SACpB;IACH,CAAC;IASD,KAAK,CAAC,GAAS;QACb,IAAI,IAAI,CAAC,SAAS,EAAE;YAClB,yBAAyB,CAAC,iBAAiB,CAAC,GAAG,CAAC,EAAE,IAAI,CAAC,CAAC;SACzD;aAAM;YACL,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC;YACtB,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;SAClB;IACH,CAAC;IAQD,QAAQ;QACN,IAAI,IAAI,CAAC,SAAS,EAAE;YAClB,yBAAyB,CAAC,qBAAqB,EAAE,IAAI,CAAC,CAAC;SACxD;aAAM;YACL,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC;YACtB,IAAI,CAAC,SAAS,EAAE,CAAC;SAClB;IACH,CAAC;IAED,WAAW;QACT,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE;YAChB,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC;YACtB,KAAK,CAAC,WAAW,EAAE,CAAC;YACpB,IAAI,CAAC,WAAW,GAAG,IAAK,CAAC;SAC1B;IACH,CAAC;IAES,KAAK,CAAC,KAAQ;QACtB,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAC/B,CAAC;IAES,MAAM,CAAC,GAAQ;QACvB,IAAI;YACF,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;SAC7B;gBAAS;YACR,IAAI,CAAC,WAAW,EAAE,CAAC;SACpB;IACH,CAAC;IAES,SAAS;QACjB,IAAI;YACF,IAAI,CAAC,WAAW,CAAC,QAAQ,EAAE,CAAC;SAC7B;gBAAS;YACR,IAAI,CAAC,WAAW,EAAE,CAAC;SACpB;IACH,CAAC;CACF;AAOD,MAAM,KAAK,GAAG,QAAQ,CAAC,SAAS,CAAC,IAAI,CAAC;AAEtC,SAAS,IAAI,CAAqC,EAAM,EAAE,OAAY;IACpE,OAAO,KAAK,CAAC,IAAI,CAAC,EAAE,EAAE,OAAO,CAAC,CAAC;AACjC,CAAC;AAMD,MAAM,gBAAgB;IACpB,YAAoB,eAAqC;QAArC,oBAAe,GAAf,eAAe,CAAsB;IAAG,CAAC;IAE7D,IAAI,CAAC,KAAQ;QACX,MAAM,EAAE,eAAe,EAAE,GAAG,IAAI,CAAC;QACjC,IAAI,eAAe,CAAC,IAAI,EAAE;YACxB,IAAI;gBACF,eAAe,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;aAC7B;YAAC,OAAO,KAAK,EAAE;gBACd,oBAAoB,CAAC,KAAK,CAAC,CAAC;aAC7B;SACF;IACH,CAAC;IAED,KAAK,CAAC,GAAQ;QACZ,MAAM,EAAE,eAAe,EAAE,GAAG,IAAI,CAAC;QACjC,IAAI,eAAe,CAAC,KAAK,EAAE;YACzB,IAAI;gBACF,eAAe,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;aAC5B;YAAC,OAAO,KAAK,EAAE;gBACd,oBAAoB,CAAC,KAAK,CAAC,CAAC;aAC7B;SACF;aAAM;YACL,oBAAoB,CAAC,GAAG,CAAC,CAAC;SAC3B;IACH,CAAC;IAED,QAAQ;QACN,MAAM,EAAE,eAAe,EAAE,GAAG,IAAI,CAAC;QACjC,IAAI,eAAe,CAAC,QAAQ,EAAE;YAC5B,IAAI;gBACF,eAAe,CAAC,QAAQ,EAAE,CAAC;aAC5B;YAAC,OAAO,KAAK,EAAE;gBACd,oBAAoB,CAAC,KAAK,CAAC,CAAC;aAC7B;SACF;IACH,CAAC;CACF;AAED,MAAM,OAAO,cAAkB,SAAQ,UAAa;IAClD,YACE,cAAmE,EACnE,KAAkC,EAClC,QAA8B;QAE9B,KAAK,EAAE,CAAC;QAER,IAAI,eAAqC,CAAC;QAC1C,IAAI,UAAU,CAAC,cAAc,CAAC,IAAI,CAAC,cAAc,EAAE;YAGjD,eAAe,GAAG;gBAChB,IAAI,EAAE,CAAC,cAAc,aAAd,cAAc,cAAd,cAAc,GAAI,SAAS,CAAuC;gBACzE,KAAK,EAAE,KAAK,aAAL,KAAK,cAAL,KAAK,GAAI,SAAS;gBACzB,QAAQ,EAAE,QAAQ,aAAR,QAAQ,cAAR,QAAQ,GAAI,SAAS;aAChC,CAAC;SACH;aAAM;YAEL,IAAI,OAAY,CAAC;YACjB,IAAI,IAAI,IAAI,MAAM,CAAC,wBAAwB,EAAE;gBAI3C,OAAO,GAAG,MAAM,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC;gBACxC,OAAO,CAAC,WAAW,GAAG,GAAG,EAAE,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC;gBAC/C,eAAe,GAAG;oBAChB,IAAI,EAAE,cAAc,CAAC,IAAI,IAAI,IAAI,CAAC,cAAc,CAAC,IAAI,EAAE,OAAO,CAAC;oBAC/D,KAAK,EAAE,cAAc,CAAC,KAAK,IAAI,IAAI,CAAC,cAAc,CAAC,KAAK,EAAE,OAAO,CAAC;oBAClE,QAAQ,EAAE,cAAc,CAAC,QAAQ,IAAI,IAAI,CAAC,cAAc,CAAC,QAAQ,EAAE,OAAO,CAAC;iBAC5E,CAAC;aACH;iBAAM;gBAEL,eAAe,GAAG,cAAc,CAAC;aAClC;SACF;QAID,IAAI,CAAC,WAAW,GAAG,IAAI,gBAAgB,CAAC,eAAe,CAAC,CAAC;IAC3D,CAAC;CACF;AAED,SAAS,oBAAoB,CAAC,KAAU;IACtC,IAAI,MAAM,CAAC,qCAAqC,EAAE;QAChD,YAAY,CAAC,KAAK,CAAC,CAAC;KACrB;SAAM;QAGL,oBAAoB,CAAC,KAAK,CAAC,CAAC;KAC7B;AACH,CAAC;AAQD,SAAS,mBAAmB,CAAC,GAAQ;IACnC,MAAM,GAAG,CAAC;AACZ,CAAC;AAOD,SAAS,yBAAyB,CAAC,YAAyC,EAAE,UAA2B;IACvG,MAAM,EAAE,qBAAqB,EAAE,GAAG,MAAM,CAAC;IACzC,qBAAqB,IAAI,eAAe,CAAC,UAAU,CAAC,GAAG,EAAE,CAAC,qBAAqB,CAAC,YAAY,EAAE,UAAU,CAAC,CAAC,CAAC;AAC7G,CAAC;AAOD,MAAM,CAAC,MAAM,cAAc,GAA+C;IACxE,MAAM,EAAE,IAAI;IACZ,IAAI,EAAE,IAAI;IACV,KAAK,EAAE,mBAAmB;IAC1B,QAAQ,EAAE,IAAI;CACf,CAAC"}
|
||||
@@ -0,0 +1 @@
|
||||
{"name":"inquirer","version":"9.1.4","files":{"LICENSE":{"checkedAt":1678883671092,"integrity":"sha512-oHjeKxQVjDURSfxmot+Kfii0Bx4XKKwI2713KOSFtOqLWohHUCBRQdNrQxkxkbXKyngmptN8GNm16oK7dE0j4Q==","mode":420,"size":1058},"lib/prompts/base.js":{"checkedAt":1678883671092,"integrity":"sha512-B58z3e/5ls1Ogas5+NyAFmoXR/qiK0mwTqKHHkMvlb+jjgMtM58GNqw5HxH8Ahord+hw5u/+tiXtZSmx2cBI2w==","mode":420,"size":4624},"lib/ui/baseUI.js":{"checkedAt":1678883671092,"integrity":"sha512-EN9sHGgfrjGyf8/9zT9Lyghq32Qaa/REKXSU+hlN87iMJ+ygI8JJ7Vb9QlyG1xvJ5I27H+9MTAGZiqK0TBR01A==","mode":420,"size":2193},"lib/ui/bottom-bar.js":{"checkedAt":1678883671092,"integrity":"sha512-//wVratCwtBoGwmGVjORm8CZ3wBNWULJOHN+7+lkjEJgKUT83S9qE8g4ww8BZu5LVOmCcUAX5KzWYo1TXGW4nw==","mode":420,"size":2226},"lib/prompts/checkbox.js":{"checkedAt":1678883671094,"integrity":"sha512-6RcFs7T1z/c1Ni7MYaHnYihELW2z4Nwx3fz7AaUg582VMaZ+J3v6Sgo2AIR+OSbdMNEskXVVzQ5FmWrVaeHYBA==","mode":420,"size":6809},"lib/objects/choice.js":{"checkedAt":1678883671094,"integrity":"sha512-LOpaBTkAaxT+Tp4Yqu69Pzk4K4Q5HNENRhAhhjNshgjywGkbbUspPFgJXCuT5jqLgcNLRnA03g4eBBjxCv4b3Q==","mode":420,"size":1011},"lib/objects/choices.js":{"checkedAt":1678883671094,"integrity":"sha512-S7uXIPYdrH0To/JAFeqsJjmZrzzn4Wsv+VdQL2+j48FS0pBv5DND+BAKa8CisY2O+0WhpucIBKa6EpCHGWGihQ==","mode":420,"size":2796},"lib/prompts/confirm.js":{"checkedAt":1678883671094,"integrity":"sha512-O59j+b3chznJirRywJeairswOzd9aYOMzd+PsugO/5HBJXSVzDJ7RGVO24XpxUHMJt9nBmUuETFd2hAJnSRakQ==","mode":420,"size":1762},"lib/prompts/editor.js":{"checkedAt":1678883671094,"integrity":"sha512-1HYDmFc5IrvkamtTZibokCEV33lsopZvGMGbphUaratpKb/eJmwEP3bQpdRUVdOoXWO6Ql7wfwp0S2k7NldSNw==","mode":420,"size":2457},"lib/utils/events.js":{"checkedAt":1678883671096,"integrity":"sha512-+OGntPkdT49oJGOPDSxPsI7kaL30PSPaD8PgrtaNCBbhe307dGsDWJREDffVrMAPzGbo6Erv9LMhKxXhh+ILkQ==","mode":420,"size":1382},"lib/utils/incrementListIndex.js":{"checkedAt":1678883671096,"integrity":"sha512-70YoyZKDfqV97XBzZLFJTMNlEExip2u/kjU5ATFgJ6sMjzve9zYQYq2D1MpTyFUrWpQn+QaUIuINTOyHKP6Hlw==","mode":420,"size":462},"lib/prompts/expand.js":{"checkedAt":1678883671096,"integrity":"sha512-0uop1EdLOL8tRK/VmoE4MhXskxwOk9Ks3bu5mXYVzm213V8lKqxBBqTf++az8ss0+VrgLW/RwParKyuYCib9kQ==","mode":420,"size":6337},"lib/prompts/input.js":{"checkedAt":1678883671096,"integrity":"sha512-O+BXp6Bv/ZS3oWfqbDQBxVYI+wtRIdmjkybcAlQs4iorz77ZX1bGLRC/mEXT6uBG5/JvdpLATG0hLES3JxUMgw==","mode":420,"size":2153},"lib/inquirer.js":{"checkedAt":1678883671096,"integrity":"sha512-uFLP410g82ISn2ErmEeDqsj+om/s0LqdGF4w+6+SiBrqzI43TkSzTgjeLk1GifcHQGkaWBgmDlOLrHuZAb1Nxg==","mode":420,"size":2847},"lib/prompts/number.js":{"checkedAt":1678883671098,"integrity":"sha512-0fILxwjyJS5nryJMmVRcGYVh0iLqyseEwOETpHTk93JjfvaCU9xXh37UJoIQfzT2oECSq5m+1YE5q33ietAUXg==","mode":420,"size":668},"lib/prompts/list.js":{"checkedAt":1678883671098,"integrity":"sha512-QfSwLhl5acQIphSgqyYS3YGXGecbMZt8mAQRWrxzFtZtm19vn9OdZkDBQnTwsII7/WWHlTJAkwrBHvjEsrNd7g==","mode":420,"size":5166},"lib/prompts/password.js":{"checkedAt":1678883671098,"integrity":"sha512-t8HMQ1NiSl5Ah5YqFHYlGZjUBakK09ik8nL/v8qIchWW942YUQ3xbmkwyKxzFOE3So6TJK9TvOhaFPl/CIMOXQ==","mode":420,"size":2564},"lib/utils/paginator.js":{"checkedAt":1678883671098,"integrity":"sha512-0LDvGmz8CaZ3HlRzwlUpVCB3NpDa9ImiMr5WHYHRvxNNdm2lxUUZbr224H9YfnGVfQ+IVybMN+osB959IRd/Sw==","mode":420,"size":2180},"lib/ui/prompt.js":{"checkedAt":1678883671104,"integrity":"sha512-476zARKyx0O7HRH7oJbkqJtKuPrOAjNbBVIszWrqy0ecufoBQPGnU5XODuiF0qRraOwMQBowOnJffEY41ZHuaQ==","mode":420,"size":3752},"lib/prompts/rawlist.js":{"checkedAt":1678883671104,"integrity":"sha512-Ynkp1J6M/59spwjjxRmLK154PidOIY8JOQtsgkE/n1z1cLGfFhGCljwJexS/GJY62NznraKHxYpj11bJ1XIzoQ==","mode":420,"size":5260},"lib/utils/readline.js":{"checkedAt":1678883671104,"integrity":"sha512-ZDlxbxAhC6BITYi4/nFm6Oba3gCHm7cYR1R3ccExHMU0SMQPVwHgNkv4L90dMO3Dt5WvEwxYt0kZm51/wTFNsQ==","mode":420,"size":1192},"lib/utils/screen-manager.js":{"checkedAt":1678883671104,"integrity":"sha512-fu+3uf4W9/IH8Z7Fk23/9va9W/5VBc1J401goZdhb04o0jF/Sa2EnGytppPOgFOVnlcu9BgP97y+dsU7DOOFYw==","mode":420,"size":4673},"lib/objects/separator.js":{"checkedAt":1678883671105,"integrity":"sha512-JvITv6t2Y+UqlXypiNNhll8nWQScdpjkOGo9A319pH7rus8w2N/SxNdz+TVm/WGhtjn1Yh2/+cAD8IzOmXH10A==","mode":420,"size":745},"lib/utils/utils.js":{"checkedAt":1678883671105,"integrity":"sha512-jAvTACotdQhKwhjbwkfYELXDOLhPBLsGRIOGfzEqIweLz4S9P3BmXwgn77nGqQIT7ajuArPEF9GjeAcS2xrIkQ==","mode":420,"size":748},"package.json":{"checkedAt":1678883671105,"integrity":"sha512-HohtWr8ypzuAw/V7cInpS45D/vWoc+vdD/Gqn4oLLIpl76R9HtB+OWvUmJ6+3M4z2XwvzguRIcpzhGe+iUaFJw==","mode":420,"size":1993},"README.md":{"checkedAt":1678883671107,"integrity":"sha512-ykvGcVUahmy7N5dHDQiT5ryd5DHkrfV0yjsNa2eF1cUCq2RRahrg5H8Lg3LfjYgWFUic+EmlH5gPgcRzMJPpXQ==","mode":420,"size":21509}}}
|
||||
@@ -0,0 +1,12 @@
|
||||
"use strict";
|
||||
|
||||
var resolveException = require("../lib/resolve-exception")
|
||||
, is = require("./is");
|
||||
|
||||
module.exports = function (value/*, options*/) {
|
||||
if (is(value)) return value;
|
||||
var options = arguments[1];
|
||||
var errorMessage =
|
||||
options && options.name ? "Expected an error for %n, received %v" : "%v is not an error";
|
||||
return resolveException(value, errorMessage, options);
|
||||
};
|
||||
@@ -0,0 +1,126 @@
|
||||
var fs = require('fs');
|
||||
var path = require('path');
|
||||
|
||||
var isAllowedResource = require('./is-allowed-resource');
|
||||
|
||||
var hasProtocol = require('../utils/has-protocol');
|
||||
var isRemoteResource = require('../utils/is-remote-resource');
|
||||
|
||||
function loadOriginalSources(context, callback) {
|
||||
var loadContext = {
|
||||
callback: callback,
|
||||
fetch: context.options.fetch,
|
||||
index: 0,
|
||||
inline: context.options.inline,
|
||||
inlineRequest: context.options.inlineRequest,
|
||||
inlineTimeout: context.options.inlineTimeout,
|
||||
localOnly: context.localOnly,
|
||||
rebaseTo: context.options.rebaseTo,
|
||||
sourcesContent: context.sourcesContent,
|
||||
uriToSource: uriToSourceMapping(context.inputSourceMapTracker.all()),
|
||||
warnings: context.warnings
|
||||
};
|
||||
|
||||
return context.options.sourceMap && context.options.sourceMapInlineSources ?
|
||||
doLoadOriginalSources(loadContext) :
|
||||
callback();
|
||||
}
|
||||
|
||||
function uriToSourceMapping(allSourceMapConsumers) {
|
||||
var mapping = {};
|
||||
var consumer;
|
||||
var uri;
|
||||
var source;
|
||||
var i, l;
|
||||
|
||||
for (source in allSourceMapConsumers) {
|
||||
consumer = allSourceMapConsumers[source];
|
||||
|
||||
for (i = 0, l = consumer.sources.length; i < l; i++) {
|
||||
uri = consumer.sources[i];
|
||||
source = consumer.sourceContentFor(uri, true);
|
||||
|
||||
mapping[uri] = source;
|
||||
}
|
||||
}
|
||||
|
||||
return mapping;
|
||||
}
|
||||
|
||||
function doLoadOriginalSources(loadContext) {
|
||||
var uris = Object.keys(loadContext.uriToSource);
|
||||
var uri;
|
||||
var source;
|
||||
var total;
|
||||
|
||||
for (total = uris.length; loadContext.index < total; loadContext.index++) {
|
||||
uri = uris[loadContext.index];
|
||||
source = loadContext.uriToSource[uri];
|
||||
|
||||
if (source) {
|
||||
loadContext.sourcesContent[uri] = source;
|
||||
} else {
|
||||
return loadOriginalSource(uri, loadContext);
|
||||
}
|
||||
}
|
||||
|
||||
return loadContext.callback();
|
||||
}
|
||||
|
||||
function loadOriginalSource(uri, loadContext) {
|
||||
var content;
|
||||
|
||||
if (isRemoteResource(uri)) {
|
||||
return loadOriginalSourceFromRemoteUri(uri, loadContext, function (content) {
|
||||
loadContext.index++;
|
||||
loadContext.sourcesContent[uri] = content;
|
||||
return doLoadOriginalSources(loadContext);
|
||||
});
|
||||
} else {
|
||||
content = loadOriginalSourceFromLocalUri(uri, loadContext);
|
||||
loadContext.index++;
|
||||
loadContext.sourcesContent[uri] = content;
|
||||
return doLoadOriginalSources(loadContext);
|
||||
}
|
||||
}
|
||||
|
||||
function loadOriginalSourceFromRemoteUri(uri, loadContext, whenLoaded) {
|
||||
var isAllowed = isAllowedResource(uri, true, loadContext.inline);
|
||||
var isRuntimeResource = !hasProtocol(uri);
|
||||
|
||||
if (loadContext.localOnly) {
|
||||
loadContext.warnings.push('Cannot fetch remote resource from "' + uri + '" as no callback given.');
|
||||
return whenLoaded(null);
|
||||
} else if (isRuntimeResource) {
|
||||
loadContext.warnings.push('Cannot fetch "' + uri + '" as no protocol given.');
|
||||
return whenLoaded(null);
|
||||
} else if (!isAllowed) {
|
||||
loadContext.warnings.push('Cannot fetch "' + uri + '" as resource is not allowed.');
|
||||
return whenLoaded(null);
|
||||
}
|
||||
|
||||
loadContext.fetch(uri, loadContext.inlineRequest, loadContext.inlineTimeout, function (error, content) {
|
||||
if (error) {
|
||||
loadContext.warnings.push('Missing original source at "' + uri + '" - ' + error);
|
||||
}
|
||||
|
||||
whenLoaded(content);
|
||||
});
|
||||
}
|
||||
|
||||
function loadOriginalSourceFromLocalUri(relativeUri, loadContext) {
|
||||
var isAllowed = isAllowedResource(relativeUri, false, loadContext.inline);
|
||||
var absoluteUri = path.resolve(loadContext.rebaseTo, relativeUri);
|
||||
|
||||
if (!fs.existsSync(absoluteUri) || !fs.statSync(absoluteUri).isFile()) {
|
||||
loadContext.warnings.push('Ignoring local source map at "' + absoluteUri + '" as resource is missing.');
|
||||
return null;
|
||||
} else if (!isAllowed) {
|
||||
loadContext.warnings.push('Cannot fetch "' + absoluteUri + '" as resource is not allowed.');
|
||||
return null;
|
||||
}
|
||||
|
||||
return fs.readFileSync(absoluteUri, 'utf8');
|
||||
}
|
||||
|
||||
module.exports = loadOriginalSources;
|
||||
@@ -0,0 +1,64 @@
|
||||
import { CanonicalizeLocaleList } from '../CanonicalizeLocaleList';
|
||||
import { GetOption } from '../GetOption';
|
||||
import { ResolveLocale } from '@formatjs/intl-localematcher';
|
||||
import { SetNumberFormatUnitOptions } from './SetNumberFormatUnitOptions';
|
||||
import { CurrencyDigits } from './CurrencyDigits';
|
||||
import { SetNumberFormatDigitOptions } from './SetNumberFormatDigitOptions';
|
||||
import { invariant } from '../utils';
|
||||
import { CoerceOptionsToObject } from '../CoerceOptionsToObject';
|
||||
/**
|
||||
* https://tc39.es/ecma402/#sec-initializenumberformat
|
||||
*/
|
||||
export function InitializeNumberFormat(nf, locales, opts, _a) {
|
||||
var getInternalSlots = _a.getInternalSlots, localeData = _a.localeData, availableLocales = _a.availableLocales, numberingSystemNames = _a.numberingSystemNames, getDefaultLocale = _a.getDefaultLocale, currencyDigitsData = _a.currencyDigitsData;
|
||||
// @ts-ignore
|
||||
var requestedLocales = CanonicalizeLocaleList(locales);
|
||||
var options = CoerceOptionsToObject(opts);
|
||||
var opt = Object.create(null);
|
||||
var matcher = GetOption(options, 'localeMatcher', 'string', ['lookup', 'best fit'], 'best fit');
|
||||
opt.localeMatcher = matcher;
|
||||
var numberingSystem = GetOption(options, 'numberingSystem', 'string', undefined, undefined);
|
||||
if (numberingSystem !== undefined &&
|
||||
numberingSystemNames.indexOf(numberingSystem) < 0) {
|
||||
// 8.a. If numberingSystem does not match the Unicode Locale Identifier type nonterminal,
|
||||
// throw a RangeError exception.
|
||||
throw RangeError("Invalid numberingSystems: ".concat(numberingSystem));
|
||||
}
|
||||
opt.nu = numberingSystem;
|
||||
var r = ResolveLocale(availableLocales, requestedLocales, opt,
|
||||
// [[RelevantExtensionKeys]] slot, which is a constant
|
||||
['nu'], localeData, getDefaultLocale);
|
||||
var dataLocaleData = localeData[r.dataLocale];
|
||||
invariant(!!dataLocaleData, "Missing locale data for ".concat(r.dataLocale));
|
||||
var internalSlots = getInternalSlots(nf);
|
||||
internalSlots.locale = r.locale;
|
||||
internalSlots.dataLocale = r.dataLocale;
|
||||
internalSlots.numberingSystem = r.nu;
|
||||
internalSlots.dataLocaleData = dataLocaleData;
|
||||
SetNumberFormatUnitOptions(nf, options, { getInternalSlots: getInternalSlots });
|
||||
var style = internalSlots.style;
|
||||
var mnfdDefault;
|
||||
var mxfdDefault;
|
||||
if (style === 'currency') {
|
||||
var currency = internalSlots.currency;
|
||||
var cDigits = CurrencyDigits(currency, { currencyDigitsData: currencyDigitsData });
|
||||
mnfdDefault = cDigits;
|
||||
mxfdDefault = cDigits;
|
||||
}
|
||||
else {
|
||||
mnfdDefault = 0;
|
||||
mxfdDefault = style === 'percent' ? 0 : 3;
|
||||
}
|
||||
var notation = GetOption(options, 'notation', 'string', ['standard', 'scientific', 'engineering', 'compact'], 'standard');
|
||||
internalSlots.notation = notation;
|
||||
SetNumberFormatDigitOptions(internalSlots, options, mnfdDefault, mxfdDefault, notation);
|
||||
var compactDisplay = GetOption(options, 'compactDisplay', 'string', ['short', 'long'], 'short');
|
||||
if (notation === 'compact') {
|
||||
internalSlots.compactDisplay = compactDisplay;
|
||||
}
|
||||
var useGrouping = GetOption(options, 'useGrouping', 'boolean', undefined, true);
|
||||
internalSlots.useGrouping = useGrouping;
|
||||
var signDisplay = GetOption(options, 'signDisplay', 'string', ['auto', 'never', 'always', 'exceptZero'], 'auto');
|
||||
internalSlots.signDisplay = signDisplay;
|
||||
return nf;
|
||||
}
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,60 @@
|
||||
{
|
||||
"name": "@octokit/core",
|
||||
"description": "Extendable client for GitHub's REST & GraphQL APIs",
|
||||
"version": "4.2.0",
|
||||
"license": "MIT",
|
||||
"files": [
|
||||
"dist-*/",
|
||||
"bin/"
|
||||
],
|
||||
"source": "dist-src/index.js",
|
||||
"types": "dist-types/index.d.ts",
|
||||
"main": "dist-node/index.js",
|
||||
"module": "dist-web/index.js",
|
||||
"pika": true,
|
||||
"sideEffects": false,
|
||||
"keywords": [
|
||||
"octokit",
|
||||
"github",
|
||||
"api",
|
||||
"sdk",
|
||||
"toolkit"
|
||||
],
|
||||
"repository": "github:octokit/core.js",
|
||||
"dependencies": {
|
||||
"@octokit/auth-token": "^3.0.0",
|
||||
"@octokit/graphql": "^5.0.0",
|
||||
"@octokit/request": "^6.0.0",
|
||||
"@octokit/request-error": "^3.0.0",
|
||||
"@octokit/types": "^9.0.0",
|
||||
"before-after-hook": "^2.2.0",
|
||||
"universal-user-agent": "^6.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@octokit/auth": "^3.0.1",
|
||||
"@pika/pack": "^0.3.7",
|
||||
"@pika/plugin-build-node": "^0.9.0",
|
||||
"@pika/plugin-build-web": "^0.9.0",
|
||||
"@pika/plugin-ts-standard-pkg": "^0.9.0",
|
||||
"@types/fetch-mock": "^7.3.1",
|
||||
"@types/jest": "^29.0.0",
|
||||
"@types/lolex": "^5.1.0",
|
||||
"@types/node": "^18.0.0",
|
||||
"fetch-mock": "^9.0.0",
|
||||
"http-proxy-agent": "^5.0.0",
|
||||
"jest": "^29.0.0",
|
||||
"lolex": "^6.0.0",
|
||||
"prettier": "2.8.3",
|
||||
"proxy": "^1.0.1",
|
||||
"semantic-release": "^20.0.0",
|
||||
"semantic-release-plugin-update-version-in-files": "^1.0.0",
|
||||
"ts-jest": "^29.0.0",
|
||||
"typescript": "^4.0.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 14"
|
||||
},
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
function last(array) {
|
||||
return array[array.length - 1]
|
||||
}
|
||||
|
||||
let brackets = {
|
||||
/**
|
||||
* Parse string to nodes tree
|
||||
*/
|
||||
parse(str) {
|
||||
let current = ['']
|
||||
let stack = [current]
|
||||
|
||||
for (let sym of str) {
|
||||
if (sym === '(') {
|
||||
current = ['']
|
||||
last(stack).push(current)
|
||||
stack.push(current)
|
||||
continue
|
||||
}
|
||||
|
||||
if (sym === ')') {
|
||||
stack.pop()
|
||||
current = last(stack)
|
||||
current.push('')
|
||||
continue
|
||||
}
|
||||
|
||||
current[current.length - 1] += sym
|
||||
}
|
||||
|
||||
return stack[0]
|
||||
},
|
||||
|
||||
/**
|
||||
* Generate output string by nodes tree
|
||||
*/
|
||||
stringify(ast) {
|
||||
let result = ''
|
||||
for (let i of ast) {
|
||||
if (typeof i === 'object') {
|
||||
result += `(${brackets.stringify(i)})`
|
||||
continue
|
||||
}
|
||||
|
||||
result += i
|
||||
}
|
||||
return result
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = brackets
|
||||
@@ -0,0 +1,6 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
//# sourceMappingURL=types.js.map
|
||||
@@ -0,0 +1,50 @@
|
||||
import { scheduleObservable } from './scheduleObservable';
|
||||
import { schedulePromise } from './schedulePromise';
|
||||
import { scheduleArray } from './scheduleArray';
|
||||
import { scheduleIterable } from './scheduleIterable';
|
||||
import { scheduleAsyncIterable } from './scheduleAsyncIterable';
|
||||
import { isInteropObservable } from '../util/isInteropObservable';
|
||||
import { isPromise } from '../util/isPromise';
|
||||
import { isArrayLike } from '../util/isArrayLike';
|
||||
import { isIterable } from '../util/isIterable';
|
||||
import { ObservableInput, SchedulerLike } from '../types';
|
||||
import { Observable } from '../Observable';
|
||||
import { isAsyncIterable } from '../util/isAsyncIterable';
|
||||
import { createInvalidObservableTypeError } from '../util/throwUnobservableError';
|
||||
import { isReadableStreamLike } from '../util/isReadableStreamLike';
|
||||
import { scheduleReadableStreamLike } from './scheduleReadableStreamLike';
|
||||
|
||||
/**
|
||||
* Converts from a common {@link ObservableInput} type to an observable where subscription and emissions
|
||||
* are scheduled on the provided scheduler.
|
||||
*
|
||||
* @see {@link from}
|
||||
* @see {@link of}
|
||||
*
|
||||
* @param input The observable, array, promise, iterable, etc you would like to schedule
|
||||
* @param scheduler The scheduler to use to schedule the subscription and emissions from
|
||||
* the returned observable.
|
||||
*/
|
||||
export function scheduled<T>(input: ObservableInput<T>, scheduler: SchedulerLike): Observable<T> {
|
||||
if (input != null) {
|
||||
if (isInteropObservable(input)) {
|
||||
return scheduleObservable(input, scheduler);
|
||||
}
|
||||
if (isArrayLike(input)) {
|
||||
return scheduleArray(input, scheduler);
|
||||
}
|
||||
if (isPromise(input)) {
|
||||
return schedulePromise(input, scheduler);
|
||||
}
|
||||
if (isAsyncIterable(input)) {
|
||||
return scheduleAsyncIterable(input, scheduler);
|
||||
}
|
||||
if (isIterable(input)) {
|
||||
return scheduleIterable(input, scheduler);
|
||||
}
|
||||
if (isReadableStreamLike(input)) {
|
||||
return scheduleReadableStreamLike(input, scheduler);
|
||||
}
|
||||
}
|
||||
throw createInvalidObservableTypeError(input);
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
import Node from './shared/Node';
|
||||
import Expression from './shared/Expression';
|
||||
import { TemplateNode } from '../../interfaces';
|
||||
import TemplateScope from './shared/TemplateScope';
|
||||
import Component from '../Component';
|
||||
export default class Class extends Node {
|
||||
type: 'Class';
|
||||
name: string;
|
||||
expression: Expression;
|
||||
constructor(component: Component, parent: Node, scope: TemplateScope, info: TemplateNode);
|
||||
}
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1 @@
|
||||
module.exports={A:{A:{"2":"J D E F A CC","164":"B"},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","36":"C K L G M N O"},C:{"1":"KB LB MB 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":"DC tB I v J D E F A B C K L G M N EC FC","36":"0 1 2 3 4 5 6 7 8 9 O w g x y z AB BB CB DB EB FB GB HB IB JB"},D:{"1":"EB FB GB HB IB JB KB LB MB 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 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"},E:{"1":"9B OC","2":"I v J D E F A B C K L G HC zB IC JC KC LC 0B qB rB 1B MC NC 2B 3B 4B 5B sB 6B 7B 8B"},F:{"1":"1 2 3 4 5 6 7 8 9 AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB PB QB RB SB TB UB VB WB XB YB 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 F B C G M N O w g x y z PC QC RC SC qB AC TC rB"},G:{"1":"9B","2":"E zB UC BC VC WC XC YC ZC aC bC cC dC eC fC gC hC iC jC kC lC mC nC 2B 3B 4B 5B sB 6B 7B 8B"},H:{"2":"oC"},I:{"2":"tB I f 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","36":"B"},O:{"1":"vC"},P:{"1":"g wC xC yC zC 0C 0B 1C 2C 3C 4C 5C sB 6C 7C 8C","16":"I"},Q:{"1":"1B"},R:{"1":"9C"},S:{"1":"AD BD"}},B:5,C:"Screen Orientation"};
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"asap.js","sourceRoot":"","sources":["../../../../src/internal/scheduler/asap.ts"],"names":[],"mappings":";;;AAAA,2CAA0C;AAC1C,iDAAgD;AAqCnC,QAAA,aAAa,GAAG,IAAI,6BAAa,CAAC,uBAAU,CAAC,CAAC;AAK9C,QAAA,IAAI,GAAG,qBAAa,CAAC"}
|
||||
@@ -0,0 +1 @@
|
||||
module.exports={A:{A:{"2":"J D E F A B CC"},B:{"1":"N O 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"},C:{"2":"DC","194":"0 1 2 3 4 5 6 7 8 9 tB I v J D E F A B C K L G M N O w g x y z AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB PB QB RB SB TB UB VB WB 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 EC FC"},D:{"1":"0 1 2 3 4 5 6 7 8 9 G M N O w g x y z AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB PB QB RB SB TB UB VB WB XB YB uB 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","16":"I v J D E F A B C K L"},E:{"1":"J D E F A B C K L G JC KC LC 0B qB rB 1B MC NC 2B 3B 4B 5B sB 6B 7B 8B 9B OC","2":"I v HC zB IC"},F:{"1":"0 1 2 3 4 5 6 7 8 9 G M N O w g x y z AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB PB QB RB SB TB UB VB WB XB YB 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":"F B C PC QC RC SC qB AC TC rB"},G:{"1":"E VC WC XC YC 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":"zB UC BC"},H:{"2":"oC"},I:{"1":"f tC uC","2":"tB I pC qC rC sC BC"},J:{"2":"D A"},K:{"1":"h","2":"A B C qB AC rB"},L:{"1":"H"},M:{"194":"H"},N:{"2":"A B"},O:{"1":"vC"},P:{"1":"I g wC xC yC zC 0C 0B 1C 2C 3C 4C 5C sB 6C 7C 8C"},Q:{"1":"1B"},R:{"1":"9C"},S:{"194":"AD BD"}},B:1,C:"Ping attribute"};
|
||||
@@ -0,0 +1,17 @@
|
||||
import { RequestFn, StorageAdapter, CacheResponse, CacheValue, CacheableOptions, Emitter } from './types.js';
|
||||
type Func = (...args: any[]) => any;
|
||||
declare class CacheableRequest {
|
||||
cache: StorageAdapter;
|
||||
cacheRequest: RequestFn;
|
||||
hooks: Map<string, Func>;
|
||||
constructor(cacheRequest: RequestFn, cacheAdapter?: StorageAdapter | string);
|
||||
request: () => (options: CacheableOptions, cb?: (response: CacheResponse) => void) => Emitter;
|
||||
addHook: (name: string, fn: Func) => void;
|
||||
removeHook: (name: string) => boolean;
|
||||
getHook: (name: string) => Func;
|
||||
runHook: (name: string, ...args: any[]) => Promise<CacheValue>;
|
||||
}
|
||||
export default CacheableRequest;
|
||||
export * from './types.js';
|
||||
export declare const onResponse = "onResponse";
|
||||
//# sourceMappingURL=index.d.ts.map
|
||||
@@ -0,0 +1,53 @@
|
||||
{
|
||||
"Commands:": "Commandes :",
|
||||
"Options:": "Options :",
|
||||
"Examples:": "Exemples :",
|
||||
"boolean": "booléen",
|
||||
"count": "compteur",
|
||||
"string": "chaîne de caractères",
|
||||
"number": "nombre",
|
||||
"array": "tableau",
|
||||
"required": "requis",
|
||||
"default": "défaut",
|
||||
"default:": "défaut :",
|
||||
"choices:": "choix :",
|
||||
"aliases:": "alias :",
|
||||
"generated-value": "valeur générée",
|
||||
"Not enough non-option arguments: got %s, need at least %s": {
|
||||
"one": "Pas assez d'arguments (hors options) : reçu %s, besoin d'au moins %s",
|
||||
"other": "Pas assez d'arguments (hors options) : reçus %s, besoin d'au moins %s"
|
||||
},
|
||||
"Too many non-option arguments: got %s, maximum of %s": {
|
||||
"one": "Trop d'arguments (hors options) : reçu %s, maximum de %s",
|
||||
"other": "Trop d'arguments (hors options) : reçus %s, maximum de %s"
|
||||
},
|
||||
"Missing argument value: %s": {
|
||||
"one": "Argument manquant : %s",
|
||||
"other": "Arguments manquants : %s"
|
||||
},
|
||||
"Missing required argument: %s": {
|
||||
"one": "Argument requis manquant : %s",
|
||||
"other": "Arguments requis manquants : %s"
|
||||
},
|
||||
"Unknown argument: %s": {
|
||||
"one": "Argument inconnu : %s",
|
||||
"other": "Arguments inconnus : %s"
|
||||
},
|
||||
"Unknown command: %s": {
|
||||
"one": "Commande inconnue : %s",
|
||||
"other": "Commandes inconnues : %s"
|
||||
},
|
||||
"Invalid values:": "Valeurs invalides :",
|
||||
"Argument: %s, Given: %s, Choices: %s": "Argument : %s, donné : %s, choix : %s",
|
||||
"Argument check failed: %s": "Echec de la vérification de l'argument : %s",
|
||||
"Implications failed:": "Arguments dépendants manquants :",
|
||||
"Not enough arguments following: %s": "Pas assez d'arguments après : %s",
|
||||
"Invalid JSON config file: %s": "Fichier de configuration JSON invalide : %s",
|
||||
"Path to JSON config file": "Chemin du fichier de configuration JSON",
|
||||
"Show help": "Affiche l'aide",
|
||||
"Show version number": "Affiche le numéro de version",
|
||||
"Did you mean %s?": "Vouliez-vous dire %s ?",
|
||||
"Arguments %s and %s are mutually exclusive" : "Les arguments %s et %s sont mutuellement exclusifs",
|
||||
"Positionals:": "Arguments positionnels :",
|
||||
"command": "commande"
|
||||
}
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,81 @@
|
||||
|
||||
chardet [](https://travis-ci.org/runk/node-chardet)
|
||||
=====
|
||||
|
||||
Chardet is a character detection module for NodeJS written in pure Javascript.
|
||||
Module is based on ICU project http://site.icu-project.org/, which uses character
|
||||
occurency analysis to determine the most probable encoding.
|
||||
|
||||
## Installation
|
||||
|
||||
```
|
||||
npm i chardet
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
To return the encoding with the highest confidence:
|
||||
```javascript
|
||||
var chardet = require('chardet');
|
||||
chardet.detect(Buffer.alloc('hello there!'));
|
||||
// or
|
||||
chardet.detectFile('/path/to/file', function(err, encoding) {});
|
||||
// or
|
||||
chardet.detectFileSync('/path/to/file');
|
||||
```
|
||||
|
||||
|
||||
To return the full list of possible encodings:
|
||||
```javascript
|
||||
var chardet = require('chardet');
|
||||
chardet.detectAll(Buffer.alloc('hello there!'));
|
||||
// or
|
||||
chardet.detectFileAll('/path/to/file', function(err, encoding) {});
|
||||
// or
|
||||
chardet.detectFileAllSync('/path/to/file');
|
||||
|
||||
//Returned value is an array of objects sorted by confidence value in decending order
|
||||
//e.g. [{ confidence: 90, name: 'UTF-8'}, {confidence: 20, name: 'windows-1252', lang: 'fr'}]
|
||||
```
|
||||
|
||||
## Working with large data sets
|
||||
|
||||
Sometimes, when data set is huge and you want to optimize performace (in tradeoff of less accuracy),
|
||||
you can sample only first N bytes of the buffer:
|
||||
|
||||
```javascript
|
||||
chardet.detectFile('/path/to/file', { sampleSize: 32 }, function(err, encoding) {});
|
||||
```
|
||||
|
||||
## Supported Encodings:
|
||||
|
||||
* UTF-8
|
||||
* UTF-16 LE
|
||||
* UTF-16 BE
|
||||
* UTF-32 LE
|
||||
* UTF-32 BE
|
||||
* ISO-2022-JP
|
||||
* ISO-2022-KR
|
||||
* ISO-2022-CN
|
||||
* Shift-JIS
|
||||
* Big5
|
||||
* EUC-JP
|
||||
* EUC-KR
|
||||
* GB18030
|
||||
* ISO-8859-1
|
||||
* ISO-8859-2
|
||||
* ISO-8859-5
|
||||
* ISO-8859-6
|
||||
* ISO-8859-7
|
||||
* ISO-8859-8
|
||||
* ISO-8859-9
|
||||
* windows-1250
|
||||
* windows-1251
|
||||
* windows-1252
|
||||
* windows-1253
|
||||
* windows-1254
|
||||
* windows-1255
|
||||
* windows-1256
|
||||
* KOI8-R
|
||||
|
||||
Currently only these encodings are supported, more will be added soon.
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"repeat.d.ts","sourceRoot":"","sources":["../../../../src/internal/operators/repeat.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,wBAAwB,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAKrE,MAAM,WAAW,YAAY;IAC3B;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf;;;;;OAKG;IACH,KAAK,CAAC,EAAE,MAAM,GAAG,CAAC,CAAC,KAAK,EAAE,MAAM,KAAK,eAAe,CAAC,GAAG,CAAC,CAAC,CAAC;CAC5D;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2FG;AACH,wBAAgB,MAAM,CAAC,CAAC,EAAE,aAAa,CAAC,EAAE,MAAM,GAAG,YAAY,GAAG,wBAAwB,CAAC,CAAC,CAAC,CAwD5F"}
|
||||
@@ -0,0 +1,269 @@
|
||||
import dlv from 'dlv'
|
||||
import didYouMean from 'didyoumean'
|
||||
import transformThemeValue from '../util/transformThemeValue'
|
||||
import parseValue from 'postcss-value-parser'
|
||||
import { normalizeScreens } from '../util/normalizeScreens'
|
||||
import buildMediaQuery from '../util/buildMediaQuery'
|
||||
import { toPath } from '../util/toPath'
|
||||
import { withAlphaValue } from '../util/withAlphaVariable'
|
||||
import { parseColorFormat } from '../util/pluginUtils'
|
||||
import log from '../util/log'
|
||||
|
||||
function isObject(input) {
|
||||
return typeof input === 'object' && input !== null
|
||||
}
|
||||
|
||||
function findClosestExistingPath(theme, path) {
|
||||
let parts = toPath(path)
|
||||
do {
|
||||
parts.pop()
|
||||
|
||||
if (dlv(theme, parts) !== undefined) break
|
||||
} while (parts.length)
|
||||
|
||||
return parts.length ? parts : undefined
|
||||
}
|
||||
|
||||
function pathToString(path) {
|
||||
if (typeof path === 'string') return path
|
||||
return path.reduce((acc, cur, i) => {
|
||||
if (cur.includes('.')) return `${acc}[${cur}]`
|
||||
return i === 0 ? cur : `${acc}.${cur}`
|
||||
}, '')
|
||||
}
|
||||
|
||||
function list(items) {
|
||||
return items.map((key) => `'${key}'`).join(', ')
|
||||
}
|
||||
|
||||
function listKeys(obj) {
|
||||
return list(Object.keys(obj))
|
||||
}
|
||||
|
||||
function validatePath(config, path, defaultValue, themeOpts = {}) {
|
||||
const pathString = Array.isArray(path) ? pathToString(path) : path.replace(/^['"]+|['"]+$/g, '')
|
||||
const pathSegments = Array.isArray(path) ? path : toPath(pathString)
|
||||
const value = dlv(config.theme, pathSegments, defaultValue)
|
||||
|
||||
if (value === undefined) {
|
||||
let error = `'${pathString}' does not exist in your theme config.`
|
||||
const parentSegments = pathSegments.slice(0, -1)
|
||||
const parentValue = dlv(config.theme, parentSegments)
|
||||
|
||||
if (isObject(parentValue)) {
|
||||
const validKeys = Object.keys(parentValue).filter(
|
||||
(key) => validatePath(config, [...parentSegments, key]).isValid
|
||||
)
|
||||
const suggestion = didYouMean(pathSegments[pathSegments.length - 1], validKeys)
|
||||
if (suggestion) {
|
||||
error += ` Did you mean '${pathToString([...parentSegments, suggestion])}'?`
|
||||
} else if (validKeys.length > 0) {
|
||||
error += ` '${pathToString(parentSegments)}' has the following valid keys: ${list(
|
||||
validKeys
|
||||
)}`
|
||||
}
|
||||
} else {
|
||||
const closestPath = findClosestExistingPath(config.theme, pathString)
|
||||
if (closestPath) {
|
||||
const closestValue = dlv(config.theme, closestPath)
|
||||
if (isObject(closestValue)) {
|
||||
error += ` '${pathToString(closestPath)}' has the following keys: ${listKeys(
|
||||
closestValue
|
||||
)}`
|
||||
} else {
|
||||
error += ` '${pathToString(closestPath)}' is not an object.`
|
||||
}
|
||||
} else {
|
||||
error += ` Your theme has the following top-level keys: ${listKeys(config.theme)}`
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
isValid: false,
|
||||
error,
|
||||
}
|
||||
}
|
||||
|
||||
if (
|
||||
!(
|
||||
typeof value === 'string' ||
|
||||
typeof value === 'number' ||
|
||||
typeof value === 'function' ||
|
||||
value instanceof String ||
|
||||
value instanceof Number ||
|
||||
Array.isArray(value)
|
||||
)
|
||||
) {
|
||||
let error = `'${pathString}' was found but does not resolve to a string.`
|
||||
|
||||
if (isObject(value)) {
|
||||
let validKeys = Object.keys(value).filter(
|
||||
(key) => validatePath(config, [...pathSegments, key]).isValid
|
||||
)
|
||||
if (validKeys.length) {
|
||||
error += ` Did you mean something like '${pathToString([...pathSegments, validKeys[0]])}'?`
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
isValid: false,
|
||||
error,
|
||||
}
|
||||
}
|
||||
|
||||
const [themeSection] = pathSegments
|
||||
|
||||
return {
|
||||
isValid: true,
|
||||
value: transformThemeValue(themeSection)(value, themeOpts),
|
||||
}
|
||||
}
|
||||
|
||||
function extractArgs(node, vNodes, functions) {
|
||||
vNodes = vNodes.map((vNode) => resolveVNode(node, vNode, functions))
|
||||
|
||||
let args = ['']
|
||||
|
||||
for (let vNode of vNodes) {
|
||||
if (vNode.type === 'div' && vNode.value === ',') {
|
||||
args.push('')
|
||||
} else {
|
||||
args[args.length - 1] += parseValue.stringify(vNode)
|
||||
}
|
||||
}
|
||||
|
||||
return args
|
||||
}
|
||||
|
||||
function resolveVNode(node, vNode, functions) {
|
||||
if (vNode.type === 'function' && functions[vNode.value] !== undefined) {
|
||||
let args = extractArgs(node, vNode.nodes, functions)
|
||||
vNode.type = 'word'
|
||||
vNode.value = functions[vNode.value](node, ...args)
|
||||
}
|
||||
|
||||
return vNode
|
||||
}
|
||||
|
||||
function resolveFunctions(node, input, functions) {
|
||||
return parseValue(input)
|
||||
.walk((vNode) => {
|
||||
resolveVNode(node, vNode, functions)
|
||||
})
|
||||
.toString()
|
||||
}
|
||||
|
||||
let nodeTypePropertyMap = {
|
||||
atrule: 'params',
|
||||
decl: 'value',
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} path
|
||||
* @returns {Iterable<[path: string, alpha: string|undefined]>}
|
||||
*/
|
||||
function* toPaths(path) {
|
||||
// Strip quotes from beginning and end of string
|
||||
// This allows the alpha value to be present inside of quotes
|
||||
path = path.replace(/^['"]+|['"]+$/g, '')
|
||||
|
||||
let matches = path.match(/^([^\s]+)(?![^\[]*\])(?:\s*\/\s*([^\/\s]+))$/)
|
||||
let alpha = undefined
|
||||
|
||||
yield [path, undefined]
|
||||
|
||||
if (matches) {
|
||||
path = matches[1]
|
||||
alpha = matches[2]
|
||||
|
||||
yield [path, alpha]
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {any} config
|
||||
* @param {string} path
|
||||
* @param {any} defaultValue
|
||||
*/
|
||||
function resolvePath(config, path, defaultValue) {
|
||||
const results = Array.from(toPaths(path)).map(([path, alpha]) => {
|
||||
return Object.assign(validatePath(config, path, defaultValue, { opacityValue: alpha }), {
|
||||
resolvedPath: path,
|
||||
alpha,
|
||||
})
|
||||
})
|
||||
|
||||
return results.find((result) => result.isValid) ?? results[0]
|
||||
}
|
||||
|
||||
export default function (context) {
|
||||
let config = context.tailwindConfig
|
||||
|
||||
let functions = {
|
||||
theme: (node, path, ...defaultValue) => {
|
||||
let { isValid, value, error, alpha } = resolvePath(
|
||||
config,
|
||||
path,
|
||||
defaultValue.length ? defaultValue : undefined
|
||||
)
|
||||
|
||||
if (!isValid) {
|
||||
let parentNode = node.parent
|
||||
let candidate = parentNode?.raws.tailwind?.candidate
|
||||
|
||||
if (parentNode && candidate !== undefined) {
|
||||
// Remove this utility from any caches
|
||||
context.markInvalidUtilityNode(parentNode)
|
||||
|
||||
// Remove the CSS node from the markup
|
||||
parentNode.remove()
|
||||
|
||||
// Show a warning
|
||||
log.warn('invalid-theme-key-in-class', [
|
||||
`The utility \`${candidate}\` contains an invalid theme value and was not generated.`,
|
||||
])
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
throw node.error(error)
|
||||
}
|
||||
|
||||
let maybeColor = parseColorFormat(value)
|
||||
let isColorFunction = maybeColor !== undefined && typeof maybeColor === 'function'
|
||||
|
||||
if (alpha !== undefined || isColorFunction) {
|
||||
if (alpha === undefined) {
|
||||
alpha = 1.0
|
||||
}
|
||||
|
||||
value = withAlphaValue(maybeColor, alpha, maybeColor)
|
||||
}
|
||||
|
||||
return value
|
||||
},
|
||||
screen: (node, screen) => {
|
||||
screen = screen.replace(/^['"]+/g, '').replace(/['"]+$/g, '')
|
||||
let screens = normalizeScreens(config.theme.screens)
|
||||
let screenDefinition = screens.find(({ name }) => name === screen)
|
||||
|
||||
if (!screenDefinition) {
|
||||
throw node.error(`The '${screen}' screen does not exist in your theme.`)
|
||||
}
|
||||
|
||||
return buildMediaQuery(screenDefinition)
|
||||
},
|
||||
}
|
||||
return (root) => {
|
||||
root.walk((node) => {
|
||||
let property = nodeTypePropertyMap[node.type]
|
||||
|
||||
if (property === undefined) {
|
||||
return
|
||||
}
|
||||
|
||||
node[property] = resolveFunctions(node, node[property], functions)
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -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:{"2":"0 1 2 3 4 5 6 7 8 9 DC tB I v J D E F A B C K L G M N O w g x y z AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB PB QB RB SB TB UB VB WB 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 EC FC"},D:{"1":"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","66":"OB PB QB","129":"RB SB TB UB VB WB"},E:{"2":"I v J D E F A B C K L G HC zB IC JC KC LC 0B qB rB 1B MC NC 2B 3B 4B 5B sB 6B 7B 8B 9B OC"},F:{"1":"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 CB DB EB FB GB HB IB JB KB PC QC RC SC qB AC TC rB"},G:{"1":"lC mC nC 2B 3B 4B 5B sB 6B 7B 8B 9B","2":"E zB UC BC VC WC XC YC ZC aC bC cC dC eC fC gC hC iC jC kC"},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:{"2":"H"},N:{"2":"A B"},O:{"1":"vC"},P:{"1":"g yC zC 0C 0B 1C 2C 3C 4C 5C sB 6C 7C 8C","2":"I wC xC"},Q:{"1":"1B"},R:{"1":"9C"},S:{"2":"AD BD"}},B:5,C:"Credential Management API"};
|
||||
@@ -0,0 +1,17 @@
|
||||
import { EmptyError } from '../util/EmptyError';
|
||||
import { operate } from '../util/lift';
|
||||
import { createOperatorSubscriber } from './OperatorSubscriber';
|
||||
export function throwIfEmpty(errorFactory) {
|
||||
if (errorFactory === void 0) { errorFactory = defaultErrorFactory; }
|
||||
return operate(function (source, subscriber) {
|
||||
var hasValue = false;
|
||||
source.subscribe(createOperatorSubscriber(subscriber, function (value) {
|
||||
hasValue = true;
|
||||
subscriber.next(value);
|
||||
}, function () { return (hasValue ? subscriber.complete() : subscriber.error(errorFactory())); }));
|
||||
});
|
||||
}
|
||||
function defaultErrorFactory() {
|
||||
return new EmptyError();
|
||||
}
|
||||
//# sourceMappingURL=throwIfEmpty.js.map
|
||||
@@ -0,0 +1,96 @@
|
||||
"use strict";
|
||||
|
||||
// Dependencies
|
||||
var isSsh = require("../lib");
|
||||
|
||||
// Secure Shell Transport Protocol (SSH)
|
||||
console.log(isSsh("ssh://user@host.xz:port/path/to/repo.git/"));
|
||||
// true
|
||||
|
||||
console.log(isSsh("ssh://user@host.xz/path/to/repo.git/"));
|
||||
// true
|
||||
|
||||
console.log(isSsh("ssh://host.xz:port/path/to/repo.git/"));
|
||||
// true
|
||||
|
||||
console.log(isSsh("ssh://host.xz/path/to/repo.git/"));
|
||||
// true
|
||||
|
||||
console.log(isSsh("ssh://user@host.xz/path/to/repo.git/"));
|
||||
// true
|
||||
|
||||
console.log(isSsh("ssh://host.xz/path/to/repo.git/"));
|
||||
// true
|
||||
|
||||
console.log(isSsh("ssh://user@host.xz/~user/path/to/repo.git/"));
|
||||
// true
|
||||
|
||||
console.log(isSsh("ssh://host.xz/~user/path/to/repo.git/"));
|
||||
// true
|
||||
|
||||
console.log(isSsh("ssh://user@host.xz/~/path/to/repo.git"));
|
||||
// true
|
||||
|
||||
console.log(isSsh("ssh://host.xz/~/path/to/repo.git"));
|
||||
// true
|
||||
|
||||
|
||||
console.log(isSsh("user@host.xz:/path/to/repo.git/"));
|
||||
// true
|
||||
|
||||
console.log(isSsh("user@host.xz:~user/path/to/repo.git/"));
|
||||
// true
|
||||
|
||||
console.log(isSsh("user@host.xz:path/to/repo.git"));
|
||||
// true
|
||||
|
||||
|
||||
console.log(isSsh("host.xz:/path/to/repo.git/"));
|
||||
// true
|
||||
|
||||
console.log(isSsh("host.xz:path/to/repo.git"));
|
||||
// true
|
||||
|
||||
console.log(isSsh("host.xz:~user/path/to/repo.git/"));
|
||||
// true
|
||||
|
||||
|
||||
console.log(isSsh("rsync://host.xz/path/to/repo.git/"));
|
||||
// true
|
||||
|
||||
|
||||
// Git Transport Protocol
|
||||
console.log(isSsh("git://host.xz/path/to/repo.git/"));
|
||||
// false
|
||||
|
||||
console.log(isSsh("git://host.xz/~user/path/to/repo.git/"));
|
||||
// false
|
||||
|
||||
// HTTP/S Transport Protocol
|
||||
console.log(isSsh("http://host.xz/path/to/repo.git/"));
|
||||
// false
|
||||
|
||||
console.log(isSsh("https://host.xz/path/to/repo.git/"));
|
||||
// false
|
||||
|
||||
console.log(isSsh("http://host.xz:8000/path/to/repo.git/"));
|
||||
// false
|
||||
|
||||
console.log(isSsh("https://host.xz:8000/path/to/repo.git/"));
|
||||
// false
|
||||
|
||||
// Local (Filesystem) Transport Protocol
|
||||
console.log(isSsh("/path/to/repo.git/"));
|
||||
// false
|
||||
|
||||
console.log(isSsh("path/to/repo.git/"));
|
||||
// false
|
||||
|
||||
console.log(isSsh("~/path/to/repo.git"));
|
||||
// false
|
||||
|
||||
console.log(isSsh("file:///path/to/repo.git/"));
|
||||
// false
|
||||
|
||||
console.log(isSsh("file://~/path/to/repo.git/"));
|
||||
// false
|
||||
@@ -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.01576,"35":0,"36":0,"37":0,"38":0,"39":0,"40":0,"41":0,"42":0,"43":0,"44":0,"45":0.00525,"46":0.0105,"47":0.0105,"48":0.00525,"49":0.00525,"50":0.0105,"51":0.00525,"52":0.0105,"53":0,"54":0,"55":0,"56":0,"57":0,"58":0,"59":0,"60":0,"61":0,"62":0,"63":0,"64":0,"65":0,"66":0,"67":0,"68":0.00525,"69":0,"70":0,"71":0,"72":0,"73":0,"74":0,"75":0,"76":0,"77":0,"78":0.00525,"79":0,"80":0,"81":0,"82":0,"83":0,"84":0,"85":0,"86":0,"87":0,"88":0.00525,"89":0,"90":0,"91":0,"92":0,"93":0,"94":0,"95":0,"96":0,"97":0,"98":0,"99":0.00525,"100":0,"101":0,"102":0.00525,"103":0,"104":0.00525,"105":0.00525,"106":0.00525,"107":0.00525,"108":0.02101,"109":0.33088,"110":0.23634,"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.00525,"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.00525,"31":0,"32":0,"33":0,"34":0.01576,"35":0,"36":0,"37":0,"38":0.06302,"39":0,"40":0,"41":0,"42":0,"43":0,"44":0,"45":0,"46":0,"47":0,"48":0,"49":0.07353,"50":0.00525,"51":0.00525,"52":0.00525,"53":0.05777,"54":0.00525,"55":0.0105,"56":0.02101,"57":0,"58":0,"59":0,"60":0,"61":0.02626,"62":0.00525,"63":0.00525,"64":0.00525,"65":0.0105,"66":0.00525,"67":0.01576,"68":0.00525,"69":0.00525,"70":0.00525,"71":0.0105,"72":0.00525,"73":0.00525,"74":0.01576,"75":0.00525,"76":0.00525,"77":0.00525,"78":0.00525,"79":0.31512,"80":0.0105,"81":0.02626,"83":0.02101,"84":0.0105,"85":0.0105,"86":0.02101,"87":0.06302,"88":0.00525,"89":0.02626,"90":0.00525,"91":0.0105,"92":0.02101,"93":0.0105,"94":0.00525,"95":0.0105,"96":0.02101,"97":0.03676,"98":0.01576,"99":0.01576,"100":0.02101,"101":0.02101,"102":0.02626,"103":0.09454,"104":0.03151,"105":0.04202,"106":0.05777,"107":0.09454,"108":0.3834,"109":10.25716,"110":5.89274,"111":0.00525,"112":0.00525,"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.01576,"29":0,"30":0,"31":0,"32":0,"33":0,"34":0,"35":0,"36":0.0105,"37":0.00525,"38":0,"39":0,"40":0,"41":0,"42":0,"43":0,"44":0,"45":0,"46":0.05252,"47":0,"48":0,"49":0,"50":0,"51":0,"52":0,"53":0,"54":0,"55":0,"56":0,"57":0,"58":0,"60":0,"62":0,"63":0,"64":0,"65":0,"66":0,"67":0,"68":0,"69":0,"70":0,"71":0,"72":0,"73":0,"74":0,"75":0,"76":0,"77":0,"78":0,"79":0,"80":0,"81":0,"82":0,"83":0,"84":0,"85":0,"86":0,"87":0,"88":0,"89":0,"90":0,"91":0,"92":0,"93":0,"94":0.02626,"95":0.03676,"9.5-9.6":0,"10.0-10.1":0,"10.5":0,"10.6":0,"11.1":0,"11.5":0,"11.6":0,"12.1":0},B:{"12":0,"13":0,"14":0,"15":0,"16":0,"17":0.00525,"18":0.0105,"79":0,"80":0,"81":0,"83":0,"84":0.00525,"85":0.00525,"86":0,"87":0,"88":0,"89":0,"90":0,"91":0,"92":0,"93":0,"94":0,"95":0,"96":0,"97":0,"98":0,"99":0,"100":0,"101":0.00525,"102":0,"103":0.00525,"104":0.00525,"105":0.00525,"106":0.00525,"107":0.01576,"108":0.04202,"109":0.9191,"110":1.30775},E:{"4":0,"5":0,"6":0,"7":0,"8":0,"9":0,"10":0,"11":0,"12":0,"13":0.03676,"14":0.12605,"15":0.02101,_:"0","3.1":0,"3.2":0,"5.1":0,"6.1":0,"7.1":0,"9.1":0.00525,"10.1":0.00525,"11.1":0.00525,"12.1":0.02626,"13.1":0.08928,"14.1":0.34138,"15.1":0.03676,"15.2-15.3":0.03151,"15.4":0.13655,"15.5":0.26785,"15.6":1.0504,"16.0":0.03676,"16.1":0.20483,"16.2":0.7983,"16.3":0.32562,"16.4":0},G:{"8":0,"3.2":0,"4.0-4.1":0,"4.2-4.3":0,"5.0-5.1":0.04603,"6.0-6.1":0.02301,"7.0-7.1":0.18027,"8.1-8.4":0.06904,"9.0-9.2":0.02301,"9.3":0.34519,"10.0-10.2":0.02685,"10.3":0.37587,"11.0-11.2":0.04603,"11.3-11.4":0.04603,"12.0-12.1":0.09589,"12.2-12.5":1.08927,"13.0-13.1":0.0652,"13.2":0.03068,"13.3":0.10739,"13.4-13.7":0.26081,"14.0-14.4":1.43446,"14.5-14.8":2.121,"15.0-15.1":0.80928,"15.2-15.3":0.82462,"15.4":1.15831,"15.5":1.6991,"15.6":4.08092,"16.0":3.41355,"16.1":7.11859,"16.2":7.06873,"16.3":3.64751,"16.4":0.00384},P:{"4":0.68925,"20":0.919,"5.0-5.4":0.04376,"6.2-6.4":0,"7.2-7.4":0,"8.2":0.01094,"9.2":0.03282,"10.1":0.01094,"11.1-11.2":0.04376,"12.0":0.02188,"13.0":0.09846,"14.0":0.0547,"15.0":0.0547,"16.0":0.09846,"17.0":0.14223,"18.0":0.19693,"19.0":1.71766},I:{"0":0,"3":0,"4":0.01149,"2.1":0,"2.2":0,"2.3":0,"4.1":0,"4.2-4.3":0.02299,"4.4":0,"4.4.3-4.4.4":0.0843},K:{_:"0 10 11 12 11.1 11.5 12.1"},A:{"6":0,"7":0,"8":0,"9":0,"10":0,"11":0.08928,"5.5":0},N:{"10":0,"11":0},S:{"2.5":0,_:"3.0-3.1"},J:{"7":0,"10":0},O:{"0":0.1092},H:{"0":0.17081},L:{"0":31.75257},R:{_:"0"},M:{"0":0.09021},Q:{"13.1":0.0095}};
|
||||
@@ -0,0 +1,26 @@
|
||||
import registerBlockHelperMissing from './helpers/block-helper-missing';
|
||||
import registerEach from './helpers/each';
|
||||
import registerHelperMissing from './helpers/helper-missing';
|
||||
import registerIf from './helpers/if';
|
||||
import registerLog from './helpers/log';
|
||||
import registerLookup from './helpers/lookup';
|
||||
import registerWith from './helpers/with';
|
||||
|
||||
export function registerDefaultHelpers(instance) {
|
||||
registerBlockHelperMissing(instance);
|
||||
registerEach(instance);
|
||||
registerHelperMissing(instance);
|
||||
registerIf(instance);
|
||||
registerLog(instance);
|
||||
registerLookup(instance);
|
||||
registerWith(instance);
|
||||
}
|
||||
|
||||
export function moveHelperToHooks(instance, helperName, keepHelper) {
|
||||
if (instance.helpers[helperName]) {
|
||||
instance.hooks[helperName] = instance.helpers[helperName];
|
||||
if (!keepHelper) {
|
||||
delete instance.helpers[helperName];
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
module.exports = 'CY';
|
||||
@@ -0,0 +1,26 @@
|
||||
/**
|
||||
* Module dependencies.
|
||||
*/
|
||||
/**
|
||||
* True iff the IP address of the host matches the specified IP address pattern.
|
||||
*
|
||||
* Pattern and mask specification is done the same way as for SOCKS configuration.
|
||||
*
|
||||
* Examples:
|
||||
*
|
||||
* ``` js
|
||||
* isInNet(host, "198.95.249.79", "255.255.255.255")
|
||||
* // is true iff the IP address of host matches exactly 198.95.249.79.
|
||||
*
|
||||
* isInNet(host, "198.95.0.0", "255.255.0.0")
|
||||
* // is true iff the IP address of the host matches 198.95.*.*.
|
||||
* ```
|
||||
*
|
||||
* @param {String} host a DNS hostname, or IP address. If a hostname is passed,
|
||||
* it will be resoved into an IP address by this function.
|
||||
* @param {String} pattern an IP address pattern in the dot-separated format mask.
|
||||
* @param {String} mask for the IP address pattern informing which parts of the
|
||||
* IP address should be matched against. 0 means ignore, 255 means match.
|
||||
* @return {Boolean}
|
||||
*/
|
||||
export default function isInNet(host: string, pattern: string, mask: string): Promise<boolean>;
|
||||
@@ -0,0 +1,5 @@
|
||||
'use strict';
|
||||
|
||||
var inspect = require('../');
|
||||
var obj = [1, 2, function f(n) { return n + 5; }, 4];
|
||||
console.log(inspect(obj));
|
||||
@@ -0,0 +1,31 @@
|
||||
import { operate } from '../util/lift';
|
||||
import { createOperatorSubscriber } from './OperatorSubscriber';
|
||||
import { innerFrom } from '../observable/innerFrom';
|
||||
import { identity } from '../util/identity';
|
||||
import { noop } from '../util/noop';
|
||||
import { popResultSelector } from '../util/args';
|
||||
export function withLatestFrom(...inputs) {
|
||||
const project = popResultSelector(inputs);
|
||||
return operate((source, subscriber) => {
|
||||
const len = inputs.length;
|
||||
const otherValues = new Array(len);
|
||||
let hasValue = inputs.map(() => false);
|
||||
let ready = false;
|
||||
for (let i = 0; i < len; i++) {
|
||||
innerFrom(inputs[i]).subscribe(createOperatorSubscriber(subscriber, (value) => {
|
||||
otherValues[i] = value;
|
||||
if (!ready && !hasValue[i]) {
|
||||
hasValue[i] = true;
|
||||
(ready = hasValue.every(identity)) && (hasValue = null);
|
||||
}
|
||||
}, noop));
|
||||
}
|
||||
source.subscribe(createOperatorSubscriber(subscriber, (value) => {
|
||||
if (ready) {
|
||||
const values = [value, ...otherValues];
|
||||
subscriber.next(project ? project(...values) : values);
|
||||
}
|
||||
}));
|
||||
});
|
||||
}
|
||||
//# sourceMappingURL=withLatestFrom.js.map
|
||||
@@ -0,0 +1,227 @@
|
||||
<!-- badges/ -->
|
||||
[](http://travis-ci.org/tim-kos/node-retry "Check this project's build status on TravisCI")
|
||||
[](https://codecov.io/gh/tim-kos/node-retry)
|
||||
<!-- /badges -->
|
||||
|
||||
# retry
|
||||
|
||||
Abstraction for exponential and custom retry strategies for failed operations.
|
||||
|
||||
## Installation
|
||||
|
||||
npm install retry
|
||||
|
||||
## Current Status
|
||||
|
||||
This module has been tested and is ready to be used.
|
||||
|
||||
## Tutorial
|
||||
|
||||
The example below will retry a potentially failing `dns.resolve` operation
|
||||
`10` times using an exponential backoff strategy. With the default settings, this
|
||||
means the last attempt is made after `17 minutes and 3 seconds`.
|
||||
|
||||
``` javascript
|
||||
var dns = require('dns');
|
||||
var retry = require('retry');
|
||||
|
||||
function faultTolerantResolve(address, cb) {
|
||||
var operation = retry.operation();
|
||||
|
||||
operation.attempt(function(currentAttempt) {
|
||||
dns.resolve(address, function(err, addresses) {
|
||||
if (operation.retry(err)) {
|
||||
return;
|
||||
}
|
||||
|
||||
cb(err ? operation.mainError() : null, addresses);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
faultTolerantResolve('nodejs.org', function(err, addresses) {
|
||||
console.log(err, addresses);
|
||||
});
|
||||
```
|
||||
|
||||
Of course you can also configure the factors that go into the exponential
|
||||
backoff. See the API documentation below for all available settings.
|
||||
currentAttempt is an int representing the number of attempts so far.
|
||||
|
||||
``` javascript
|
||||
var operation = retry.operation({
|
||||
retries: 5,
|
||||
factor: 3,
|
||||
minTimeout: 1 * 1000,
|
||||
maxTimeout: 60 * 1000,
|
||||
randomize: true,
|
||||
});
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
### retry.operation([options])
|
||||
|
||||
Creates a new `RetryOperation` object. `options` is the same as `retry.timeouts()`'s `options`, with three additions:
|
||||
|
||||
* `forever`: Whether to retry forever, defaults to `false`.
|
||||
* `unref`: Whether to [unref](https://nodejs.org/api/timers.html#timers_unref) the setTimeout's, defaults to `false`.
|
||||
* `maxRetryTime`: The maximum time (in milliseconds) that the retried operation is allowed to run. Default is `Infinity`.
|
||||
|
||||
### retry.timeouts([options])
|
||||
|
||||
Returns an array of timeouts. All time `options` and return values are in
|
||||
milliseconds. If `options` is an array, a copy of that array is returned.
|
||||
|
||||
`options` is a JS object that can contain any of the following keys:
|
||||
|
||||
* `retries`: The maximum amount of times to retry the operation. Default is `10`. Seting this to `1` means `do it once, then retry it once`.
|
||||
* `factor`: The exponential factor to use. Default is `2`.
|
||||
* `minTimeout`: The number of milliseconds before starting the first retry. Default is `1000`.
|
||||
* `maxTimeout`: The maximum number of milliseconds between two retries. Default is `Infinity`.
|
||||
* `randomize`: Randomizes the timeouts by multiplying with a factor between `1` to `2`. Default is `false`.
|
||||
|
||||
The formula used to calculate the individual timeouts is:
|
||||
|
||||
```
|
||||
Math.min(random * minTimeout * Math.pow(factor, attempt), maxTimeout)
|
||||
```
|
||||
|
||||
Have a look at [this article][article] for a better explanation of approach.
|
||||
|
||||
If you want to tune your `factor` / `times` settings to attempt the last retry
|
||||
after a certain amount of time, you can use wolfram alpha. For example in order
|
||||
to tune for `10` attempts in `5 minutes`, you can use this equation:
|
||||
|
||||

|
||||
|
||||
Explaining the various values from left to right:
|
||||
|
||||
* `k = 0 ... 9`: The `retries` value (10)
|
||||
* `1000`: The `minTimeout` value in ms (1000)
|
||||
* `x^k`: No need to change this, `x` will be your resulting factor
|
||||
* `5 * 60 * 1000`: The desired total amount of time for retrying in ms (5 minutes)
|
||||
|
||||
To make this a little easier for you, use wolfram alpha to do the calculations:
|
||||
|
||||
<http://www.wolframalpha.com/input/?i=Sum%5B1000*x^k%2C+{k%2C+0%2C+9}%5D+%3D+5+*+60+*+1000>
|
||||
|
||||
[article]: http://dthain.blogspot.com/2009/02/exponential-backoff-in-distributed.html
|
||||
|
||||
### retry.createTimeout(attempt, opts)
|
||||
|
||||
Returns a new `timeout` (integer in milliseconds) based on the given parameters.
|
||||
|
||||
`attempt` is an integer representing for which retry the timeout should be calculated. If your retry operation was executed 4 times you had one attempt and 3 retries. If you then want to calculate a new timeout, you should set `attempt` to 4 (attempts are zero-indexed).
|
||||
|
||||
`opts` can include `factor`, `minTimeout`, `randomize` (boolean) and `maxTimeout`. They are documented above.
|
||||
|
||||
`retry.createTimeout()` is used internally by `retry.timeouts()` and is public for you to be able to create your own timeouts for reinserting an item, see [issue #13](https://github.com/tim-kos/node-retry/issues/13).
|
||||
|
||||
### retry.wrap(obj, [options], [methodNames])
|
||||
|
||||
Wrap all functions of the `obj` with retry. Optionally you can pass operation options and
|
||||
an array of method names which need to be wrapped.
|
||||
|
||||
```
|
||||
retry.wrap(obj)
|
||||
|
||||
retry.wrap(obj, ['method1', 'method2'])
|
||||
|
||||
retry.wrap(obj, {retries: 3})
|
||||
|
||||
retry.wrap(obj, {retries: 3}, ['method1', 'method2'])
|
||||
```
|
||||
The `options` object can take any options that the usual call to `retry.operation` can take.
|
||||
|
||||
### new RetryOperation(timeouts, [options])
|
||||
|
||||
Creates a new `RetryOperation` where `timeouts` is an array where each value is
|
||||
a timeout given in milliseconds.
|
||||
|
||||
Available options:
|
||||
* `forever`: Whether to retry forever, defaults to `false`.
|
||||
* `unref`: Wether to [unref](https://nodejs.org/api/timers.html#timers_unref) the setTimeout's, defaults to `false`.
|
||||
|
||||
If `forever` is true, the following changes happen:
|
||||
* `RetryOperation.errors()` will only output an array of one item: the last error.
|
||||
* `RetryOperation` will repeatedly use the `timeouts` array. Once all of its timeouts have been used up, it restarts with the first timeout, then uses the second and so on.
|
||||
|
||||
#### retryOperation.errors()
|
||||
|
||||
Returns an array of all errors that have been passed to `retryOperation.retry()` so far. The
|
||||
returning array has the errors ordered chronologically based on when they were passed to
|
||||
`retryOperation.retry()`, which means the first passed error is at index zero and the last is
|
||||
at the last index.
|
||||
|
||||
#### retryOperation.mainError()
|
||||
|
||||
A reference to the error object that occured most frequently. Errors are
|
||||
compared using the `error.message` property.
|
||||
|
||||
If multiple error messages occured the same amount of time, the last error
|
||||
object with that message is returned.
|
||||
|
||||
If no errors occured so far, the value is `null`.
|
||||
|
||||
#### retryOperation.attempt(fn, timeoutOps)
|
||||
|
||||
Defines the function `fn` that is to be retried and executes it for the first
|
||||
time right away. The `fn` function can receive an optional `currentAttempt` callback that represents the number of attempts to execute `fn` so far.
|
||||
|
||||
Optionally defines `timeoutOps` which is an object having a property `timeout` in miliseconds and a property `cb` callback function.
|
||||
Whenever your retry operation takes longer than `timeout` to execute, the timeout callback function `cb` is called.
|
||||
|
||||
|
||||
#### retryOperation.try(fn)
|
||||
|
||||
This is an alias for `retryOperation.attempt(fn)`. This is deprecated. Please use `retryOperation.attempt(fn)` instead.
|
||||
|
||||
#### retryOperation.start(fn)
|
||||
|
||||
This is an alias for `retryOperation.attempt(fn)`. This is deprecated. Please use `retryOperation.attempt(fn)` instead.
|
||||
|
||||
#### retryOperation.retry(error)
|
||||
|
||||
Returns `false` when no `error` value is given, or the maximum amount of retries
|
||||
has been reached.
|
||||
|
||||
Otherwise it returns `true`, and retries the operation after the timeout for
|
||||
the current attempt number.
|
||||
|
||||
#### retryOperation.stop()
|
||||
|
||||
Allows you to stop the operation being retried. Useful for aborting the operation on a fatal error etc.
|
||||
|
||||
#### retryOperation.reset()
|
||||
|
||||
Resets the internal state of the operation object, so that you can call `attempt()` again as if this was a new operation object.
|
||||
|
||||
#### retryOperation.attempts()
|
||||
|
||||
Returns an int representing the number of attempts it took to call `fn` before it was successful.
|
||||
|
||||
## License
|
||||
|
||||
retry is licensed under the MIT license.
|
||||
|
||||
|
||||
# Changelog
|
||||
|
||||
0.10.0 Adding `stop` functionality, thanks to @maxnachlinger.
|
||||
|
||||
0.9.0 Adding `unref` functionality, thanks to @satazor.
|
||||
|
||||
0.8.0 Implementing retry.wrap.
|
||||
|
||||
0.7.0 Some bug fixes and made retry.createTimeout() public. Fixed issues [#10](https://github.com/tim-kos/node-retry/issues/10), [#12](https://github.com/tim-kos/node-retry/issues/12), and [#13](https://github.com/tim-kos/node-retry/issues/13).
|
||||
|
||||
0.6.0 Introduced optional timeOps parameter for the attempt() function which is an object having a property timeout in milliseconds and a property cb callback function. Whenever your retry operation takes longer than timeout to execute, the timeout callback function cb is called.
|
||||
|
||||
0.5.0 Some minor refactoring.
|
||||
|
||||
0.4.0 Changed retryOperation.try() to retryOperation.attempt(). Deprecated the aliases start() and try() for it.
|
||||
|
||||
0.3.0 Added retryOperation.start() which is an alias for retryOperation.try().
|
||||
|
||||
0.2.0 Added attempts() function and parameter to retryOperation.try() representing the number of attempts it took to call fn().
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,5 @@
|
||||
import ConstTag from '../../../nodes/ConstTag';
|
||||
import Block from '../../Block';
|
||||
import Renderer from '../../Renderer';
|
||||
export declare function add_const_tags(block: Block, const_tags: ConstTag[], ctx: string): any[];
|
||||
export declare function add_const_tags_context(renderer: Renderer, const_tags: ConstTag[]): void;
|
||||
@@ -0,0 +1,21 @@
|
||||
'use strict';
|
||||
|
||||
var GetIntrinsic = require('get-intrinsic');
|
||||
var callBound = require('call-bind/callBound');
|
||||
var SLOT = require('internal-slot');
|
||||
|
||||
var $TypeError = GetIntrinsic('%TypeError%');
|
||||
|
||||
var ClearKeptObjects = require('./ClearKeptObjects');
|
||||
var Type = require('./Type');
|
||||
|
||||
var $push = callBound('Array.prototype.push');
|
||||
|
||||
// https://262.ecma-international.org/12.0/#sec-addtokeptobjects
|
||||
|
||||
module.exports = function AddToKeptObjects(object) {
|
||||
if (Type(object) !== 'Object') {
|
||||
throw new $TypeError('Assertion failed: `object` must be an Object');
|
||||
}
|
||||
$push(SLOT.get(ClearKeptObjects, '[[es-abstract internal: KeptAlive]]'), object);
|
||||
};
|
||||
@@ -0,0 +1,5 @@
|
||||
var isArray = Array.isArray;
|
||||
export function argsOrArgArray(args) {
|
||||
return args.length === 1 && isArray(args[0]) ? args[0] : args;
|
||||
}
|
||||
//# sourceMappingURL=argsOrArgArray.js.map
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"skipWhile.d.ts","sourceRoot":"","sources":["../../../../src/internal/operators/skipWhile.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,wBAAwB,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAI7E,wBAAgB,SAAS,CAAC,CAAC,EAAE,SAAS,EAAE,kBAAkB,GAAG,gBAAgB,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC,EAAE,KAAK,CAAC,SAAS,KAAK,GAAG,KAAK,GAAG,CAAC,CAAC,CAAC;AAC9H,wBAAgB,SAAS,CAAC,CAAC,EAAE,SAAS,EAAE,CAAC,KAAK,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,KAAK,IAAI,GAAG,gBAAgB,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC;AACvG,wBAAgB,SAAS,CAAC,CAAC,EAAE,SAAS,EAAE,CAAC,KAAK,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,KAAK,OAAO,GAAG,wBAAwB,CAAC,CAAC,CAAC,CAAC"}
|
||||
@@ -0,0 +1,488 @@
|
||||
const globalName = '___SVELTE_HMR_HOT_API'
|
||||
const globalAdapterName = '___SVELTE_HMR_HOT_API_PROXY_ADAPTER'
|
||||
|
||||
const defaultHotOptions = {
|
||||
// preserve all local state
|
||||
preserveLocalState: false,
|
||||
|
||||
// escape hatchs from preservation of local state
|
||||
//
|
||||
// disable preservation of state for this component
|
||||
noPreserveStateKey: ['@hmr:reset', '@!hmr'],
|
||||
// enable preservation of state for all variables in this component
|
||||
preserveAllLocalStateKey: '@hmr:keep-all',
|
||||
// enable preservation of state for a given variable (must be inline or
|
||||
// above the target variable or variables; can be repeated)
|
||||
preserveLocalStateKey: '@hmr:keep',
|
||||
|
||||
// don't reload on fatal error
|
||||
noReload: false,
|
||||
// try to recover after runtime errors during component init
|
||||
// defaults to false because some runtime errors are fatal and require a full reload
|
||||
optimistic: false,
|
||||
// auto accept modules of components that have named exports (i.e. exports
|
||||
// from context="module")
|
||||
acceptNamedExports: true,
|
||||
// auto accept modules of components have accessors (either accessors compile
|
||||
// option, or <svelte:option accessors={true} />) -- this means that if you
|
||||
// set accessors compile option globally, you must also set this option to
|
||||
// true, or no component will be hot reloaded (but there are a lot of edge
|
||||
// cases that HMR can't support correctly with accessors)
|
||||
acceptAccessors: true,
|
||||
// only inject CSS instead of recreating components when only CSS changes
|
||||
injectCss: false,
|
||||
// to mitigate FOUC between dispose (remove stylesheet) and accept
|
||||
cssEjectDelay: 100,
|
||||
|
||||
// Svelte Native mode
|
||||
native: false,
|
||||
// name of the adapter import binding
|
||||
importAdapterName: globalAdapterName,
|
||||
|
||||
// disable runtime error overlay
|
||||
noOverlay: false,
|
||||
|
||||
// set to true on systems that supports them, to avoid useless caught /
|
||||
// managed (but still...) exceptions, by using Svelte's current_component
|
||||
// instead of get_current_component
|
||||
allowLiveBinding: false,
|
||||
}
|
||||
|
||||
const defaultHotApi = 'hot-api-esm.js'
|
||||
|
||||
const json = JSON.stringify
|
||||
|
||||
const posixify = file => file.replace(/[/\\]/g, '/')
|
||||
|
||||
const renderApplyHmr = ({
|
||||
id,
|
||||
cssId,
|
||||
nonCssHash,
|
||||
hotOptions: { injectCss },
|
||||
hotOptionsJson,
|
||||
hotApiImport,
|
||||
adapterImport,
|
||||
importAdapterName,
|
||||
meta,
|
||||
acceptable,
|
||||
preserveLocalState,
|
||||
emitCss,
|
||||
imports = [
|
||||
`import * as ${globalName} from '${hotApiImport}'`,
|
||||
`import { adapter as ${importAdapterName} } from '${adapterImport}'`,
|
||||
],
|
||||
}) =>
|
||||
// this silly formatting keeps all original characters in their position,
|
||||
// thus saving us from having to provide a sourcemap
|
||||
//
|
||||
// NOTE the `if (false) accept()` line is for tools that wants to see the
|
||||
// accept call in the actual accepted module to enable HMR (Vite and, I
|
||||
// believe, Snowpack 3)
|
||||
//
|
||||
`${imports.join(';')};${`
|
||||
if (${meta} && ${meta}.hot) {
|
||||
${acceptable ? `if (false) ${meta}.hot.accept();` : ''};
|
||||
$2 = ${globalName}.applyHmr({
|
||||
m: ${meta},
|
||||
id: ${json(id)},
|
||||
hotOptions: ${hotOptionsJson},
|
||||
Component: $2,
|
||||
ProxyAdapter: ${importAdapterName},
|
||||
acceptable: ${json(acceptable)},
|
||||
preserveLocalState: ${json(preserveLocalState)},
|
||||
${cssId ? `cssId: ${json(cssId)},` : ''}
|
||||
${nonCssHash ? `nonCssHash: ${json(nonCssHash)},` : ''}
|
||||
emitCss: ${json(emitCss)},
|
||||
});
|
||||
}
|
||||
`
|
||||
.split('\n')
|
||||
.map(x => x.trim())
|
||||
.filter(Boolean)
|
||||
.join(' ')}
|
||||
export default $2;
|
||||
${
|
||||
// NOTE when doing CSS only voodoo, we have to inject the stylesheet as soon
|
||||
// as the component is loaded because Svelte normally do that when a component
|
||||
// is instantiated, but we might already have instances in the large when a
|
||||
// component is loaded with HMR
|
||||
cssId && injectCss && !emitCss
|
||||
? `
|
||||
if (typeof add_css !== 'undefined' && !document.getElementById(${json(
|
||||
cssId
|
||||
)})) add_css();`
|
||||
: ``
|
||||
}
|
||||
`
|
||||
|
||||
// replace from last occurrence of the splitter
|
||||
const replaceLast = (string, splitter, regex, replacer) => {
|
||||
const lastIndex = string.lastIndexOf(splitter)
|
||||
return (
|
||||
string.slice(0, lastIndex) +
|
||||
string.slice(lastIndex).replace(regex, replacer)
|
||||
)
|
||||
}
|
||||
|
||||
// https://github.com/darkskyapp/string-hash/blob/master/index.js
|
||||
// (via https://github.com/sveltejs/svelte/blob/91d758e35b2b2154512ddd11e6b6d9d65708a99e/src/compiler/compile/utils/hash.ts#L2)
|
||||
const stringHashcode = str => {
|
||||
let hash = 5381
|
||||
let i = str.length
|
||||
while (i--) hash = ((hash << 5) - hash) ^ str.charCodeAt(i)
|
||||
return (hash >>> 0).toString(36)
|
||||
}
|
||||
|
||||
const normalizeJsCode = (code, cssHash) =>
|
||||
code
|
||||
// ignore css hashes in the code (that have changed, necessarily)
|
||||
.replace(new RegExp('\\b' + cssHash + '\\b', 'g'), '')
|
||||
// Svelte now adds locations in dev mode, code locations can change when
|
||||
// CSS change, but we're unaffected (not real behaviour changes)
|
||||
.replace(/\badd_location\s*\([^)]*\)\s*;?/g, '')
|
||||
|
||||
const parseCssId = (code, compileOptions = {}, parseHash, originalCode) => {
|
||||
// the regex matching is very pretty conservative 'cause I don't want to
|
||||
// match something else by error... I'm probably make it more lax if I have
|
||||
// to fix it 3 times in a single week ¯\_(ツ)_/¯
|
||||
let match = /^function add_css\(\) \{[\s\S]*?^}/m.exec(code)
|
||||
|
||||
if (!match) {
|
||||
// guard: injectCss is off, no need to compute hashes
|
||||
if (!parseHash) return {}
|
||||
// guard: compile.css is true, so we should have found the add_css function,
|
||||
// something unexpected is unraveling here, fall back to caution
|
||||
if (compileOptions.css) return {}
|
||||
// trying to get CSS id the same way as Svelte does it
|
||||
match = /<style[^>]*>([\s\S]*)<\/\s*style\s*>/.exec(originalCode)
|
||||
const cssHash = match && match[1] ? stringHashcode(match[1]) : null
|
||||
if (!cssHash) return {}
|
||||
return {
|
||||
cssId: `svelte-${cssHash}-style`,
|
||||
nonCssHash: stringHashcode(normalizeJsCode(code, cssHash)),
|
||||
}
|
||||
}
|
||||
|
||||
const codeExceptCSS =
|
||||
code.slice(0, match.index) + code.slice(match.index + match[0].length)
|
||||
|
||||
match = /\bstyle\.id\s*=\s*(['"])([^'"]*)\1/.exec(match[0])
|
||||
const cssId = match ? match[2] : null
|
||||
|
||||
if (!parseHash || !cssId) return { cssId }
|
||||
|
||||
const cssHash = cssId.split('-')[1]
|
||||
const nonCssHash = stringHashcode(normalizeJsCode(codeExceptCSS, cssHash))
|
||||
|
||||
return { cssId, nonCssHash }
|
||||
}
|
||||
|
||||
const isNamedExport = v => v.export_name && v.module
|
||||
|
||||
const isProp = v => v.export_name && !v.module
|
||||
|
||||
const resolvePackageImport = (name = 'svelte-hmr', version = '') => {
|
||||
const versionSpec = version ? '@' + version : ''
|
||||
return target => `${name}${versionSpec}/${target}`
|
||||
}
|
||||
|
||||
const createMakeHot = ({ resolveAbsoluteImport, pkg = {} }) => ({
|
||||
// NOTE hotOptions can be customized by end user through plugin options, while
|
||||
// options passed to this function can only customized by the plugin implementer
|
||||
//
|
||||
// meta can be 'import.meta' or 'module'
|
||||
// const createMakeHot = (hotApi = defaultHotApi, options) => {
|
||||
walk,
|
||||
meta = 'import.meta',
|
||||
|
||||
hotApi: customHotApi = '',
|
||||
adapter: customAdapter = '',
|
||||
// use absolute file paths to import runtime deps of svelte-hmr
|
||||
// - pnpm needs absolute paths because svelte-hmr, being a transitive dep via
|
||||
// the bundler plugin, is not directly importable from user's project
|
||||
// (see https://github.com/rixo/svelte-hmr/issues/11)
|
||||
// - Snowpack source=remote needs a version number, otherwise it will try to
|
||||
// load import, resulting in a possible version mismatch between the code
|
||||
// transform and the runtime
|
||||
// (see: https://github.com/rixo/svelte-hmr/issues/27#issuecomment-800142127)
|
||||
absoluteImports = true,
|
||||
versionNonAbsoluteImports = true,
|
||||
|
||||
hotOptions: hotOptionsArg = {},
|
||||
}) => {
|
||||
const hotOptions = { ...defaultHotOptions, ...hotOptionsArg }
|
||||
|
||||
const hotOptionsJson = JSON.stringify(hotOptions)
|
||||
|
||||
// NOTE Native adapter cannot be required in code (as opposed to this
|
||||
// generated code) because it requires modules from NativeScript's code that
|
||||
// are not resolvable for non-native users (and those missing modules would
|
||||
// prevent webpack from building).
|
||||
//
|
||||
// careful with relative paths
|
||||
// (see https://github.com/rixo/svelte-hmr/issues/11)
|
||||
const defaultAdapter = hotOptions.native
|
||||
? 'svelte-native/proxy-adapter-native.js'
|
||||
: 'proxy-adapter-dom.js'
|
||||
|
||||
const resolveImport = absoluteImports
|
||||
? resolveAbsoluteImport
|
||||
: resolvePackageImport(pkg.name, versionNonAbsoluteImports && pkg.version)
|
||||
|
||||
const adapterImport = posixify(
|
||||
customAdapter || resolveImport('runtime/' + defaultAdapter)
|
||||
)
|
||||
|
||||
const hotApiImport = posixify(
|
||||
customHotApi || resolveImport('runtime/' + defaultHotApi)
|
||||
)
|
||||
|
||||
const resolvePreserveLocalStateKey = ({
|
||||
preserveLocalStateKey,
|
||||
compiled,
|
||||
}) => {
|
||||
const containsKey = comments =>
|
||||
comments &&
|
||||
comments.some(({ value }) => value.includes(preserveLocalStateKey))
|
||||
|
||||
const variables = new Set()
|
||||
|
||||
const addReference = node => {
|
||||
if (!node.name) {
|
||||
// eslint-disable-next-line no-console
|
||||
console.warn('Incorrect identifier for preserveLocalStateKey')
|
||||
}
|
||||
variables.add(node.name)
|
||||
}
|
||||
|
||||
const processNodes = targets => targets.forEach(processNode)
|
||||
|
||||
const processNode = node => {
|
||||
switch (node.type) {
|
||||
case 'Identifier':
|
||||
variables.add(node.name)
|
||||
return true
|
||||
case 'UpdateExpression':
|
||||
addReference(node.argument)
|
||||
return true
|
||||
case 'VariableDeclarator':
|
||||
addReference(node.id)
|
||||
return true
|
||||
case 'AssignmentExpression':
|
||||
processNode(node.left)
|
||||
return true
|
||||
case 'ExpressionStatement':
|
||||
processNode(node.expression)
|
||||
return true
|
||||
|
||||
case 'VariableDeclaration':
|
||||
processNodes(node.declarations)
|
||||
return true
|
||||
case 'SequenceExpression': // ++, --
|
||||
processNodes(node.expressions)
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
const stack = []
|
||||
|
||||
if (compiled.ast.instance) {
|
||||
walk(compiled.ast.instance, {
|
||||
leave() {
|
||||
stack.shift()
|
||||
},
|
||||
enter(node) {
|
||||
stack.unshift(node)
|
||||
if (
|
||||
containsKey(node.leadingComments) ||
|
||||
containsKey(node.trailingComments)
|
||||
) {
|
||||
stack
|
||||
.slice(0, 3)
|
||||
.reverse()
|
||||
.some(processNode)
|
||||
}
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
return [...variables]
|
||||
}
|
||||
|
||||
const resolvePreserveLocalState = ({
|
||||
hotOptions,
|
||||
originalCode,
|
||||
compiled,
|
||||
}) => {
|
||||
const {
|
||||
preserveLocalState,
|
||||
noPreserveStateKey,
|
||||
preserveLocalStateKey,
|
||||
preserveAllLocalStateKey,
|
||||
} = hotOptions
|
||||
if (originalCode) {
|
||||
const hasKey = key => {
|
||||
const test = k => originalCode.indexOf(k) !== -1
|
||||
return Array.isArray(key) ? key.some(test) : test(key)
|
||||
}
|
||||
// noPreserveStateKey
|
||||
if (noPreserveStateKey && hasKey(noPreserveStateKey)) {
|
||||
return false
|
||||
}
|
||||
// preserveAllLocalStateKey
|
||||
if (preserveAllLocalStateKey && hasKey(preserveAllLocalStateKey)) {
|
||||
return true
|
||||
}
|
||||
// preserveLocalStateKey
|
||||
if (preserveLocalStateKey && hasKey(preserveLocalStateKey)) {
|
||||
// returns an array of variable names to preserve
|
||||
return resolvePreserveLocalStateKey({ preserveLocalStateKey, compiled })
|
||||
}
|
||||
}
|
||||
// preserveLocalState
|
||||
if (preserveLocalState) {
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
const hasAccessorsOption = compiled => {
|
||||
if (!compiled.ast || !compiled.ast.html) return
|
||||
let accessors = false
|
||||
walk(compiled.ast.html, {
|
||||
enter(node) {
|
||||
if (accessors) return
|
||||
if (node.type !== 'Options') return
|
||||
if (!node.attributes) return
|
||||
accessors = node.attributes.some(
|
||||
({ name, value }) => name === 'accessors' && value
|
||||
)
|
||||
},
|
||||
})
|
||||
return accessors
|
||||
}
|
||||
|
||||
const isAcceptable = (hotOptions, compileOptions, compiled) => {
|
||||
if (!compiled || !compileOptions) {
|
||||
// this should never happen, since it's the bundler plugins that control
|
||||
// what version of svelte-hmr they embark, and they should be kept up to
|
||||
// date with our API
|
||||
//
|
||||
// eslint-disable-next-line no-console
|
||||
console.warn(
|
||||
'WARNING Your bundler plugin is outdated for this version of svelte-hmr'
|
||||
)
|
||||
return true
|
||||
}
|
||||
|
||||
const { vars } = compiled
|
||||
|
||||
// if the module has named exports (in context="module"), then we can't
|
||||
// auto accept the component, since all the consumers need to be aware of
|
||||
// the change (e.g. rerender with the new exports value)
|
||||
if (!hotOptions.acceptNamedExports && vars.some(isNamedExport)) {
|
||||
return false
|
||||
}
|
||||
|
||||
// ...same for accessors: if accessible props change, then we need to
|
||||
// rerender/rerun all the consumers to reflect the change
|
||||
//
|
||||
// NOTE we can still accept components with no props, since they won't
|
||||
// have accessors... this is actually all we can safely accept in this case
|
||||
//
|
||||
if (
|
||||
!hotOptions.acceptAccessors &&
|
||||
// we test is we have props first, because searching for the
|
||||
// <svelte:options /> tag in the AST is probably the most expensive here
|
||||
vars.some(isProp) &&
|
||||
(compileOptions.accessors || hasAccessorsOption(compiled))
|
||||
) {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
const parseMakeHotArgs = args => {
|
||||
// case: named args (object)
|
||||
if (args.length === 1) return args[0]
|
||||
// case: legacy (positional)
|
||||
const [
|
||||
id,
|
||||
compiledCode,
|
||||
hotOptions,
|
||||
compiled,
|
||||
originalCode,
|
||||
compileOptions,
|
||||
] = args
|
||||
return {
|
||||
id,
|
||||
compiledCode,
|
||||
hotOptions,
|
||||
compiled,
|
||||
originalCode,
|
||||
compileOptions,
|
||||
}
|
||||
}
|
||||
|
||||
function makeHot(...args) {
|
||||
const {
|
||||
id,
|
||||
compiledCode,
|
||||
compiled,
|
||||
originalCode,
|
||||
compileOptions,
|
||||
} = parseMakeHotArgs(args)
|
||||
|
||||
const { importAdapterName, injectCss } = hotOptions
|
||||
|
||||
const emitCss = compileOptions && compileOptions.css === false
|
||||
|
||||
const preserveLocalState = resolvePreserveLocalState({
|
||||
hotOptions,
|
||||
originalCode,
|
||||
compiled,
|
||||
})
|
||||
|
||||
const replacement = renderApplyHmr({
|
||||
id,
|
||||
// adds cssId & nonCssHash
|
||||
...((injectCss || !emitCss) &&
|
||||
parseCssId(compiledCode, compileOptions, injectCss, originalCode)),
|
||||
hotOptions,
|
||||
hotOptionsJson,
|
||||
preserveLocalState,
|
||||
hotApiImport,
|
||||
adapterImport,
|
||||
importAdapterName,
|
||||
meta,
|
||||
acceptable: isAcceptable(hotOptions, compileOptions, compiled),
|
||||
// CSS is handled outside of Svelte: don't tamper with it!
|
||||
emitCss,
|
||||
})
|
||||
|
||||
// NOTE export default can appear in strings in use code
|
||||
// see: https://github.com/rixo/svelte-hmr/issues/34
|
||||
return replaceLast(
|
||||
compiledCode,
|
||||
'export default',
|
||||
/(\n?export default ([^;]*);)/,
|
||||
(match, $1, $2) => replacement.replace(/\$2/g, () => $2)
|
||||
)
|
||||
}
|
||||
|
||||
// rollup-plugin-svelte-hot needs hotApi path (for tests)
|
||||
// makeHot.hotApi = hotApi
|
||||
Object.defineProperty(makeHot, 'hotApi', {
|
||||
get() {
|
||||
// TODO makeHot.hotApi has been lost in 0.12 => 0.13... still needed?
|
||||
debugger // eslint-disable-line no-debugger
|
||||
return undefined
|
||||
},
|
||||
})
|
||||
|
||||
return makeHot
|
||||
}
|
||||
|
||||
module.exports = createMakeHot
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"fetch.js","sourceRoot":"","sources":["../../../../../src/internal/observable/dom/fetch.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,oCAAoC,CAAC;AAC9E,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AA4FvD,MAAM,UAAU,SAAS,CACvB,KAAuB,EACvB,gBAEM;IAFN,iCAAA,EAAA,qBAEM;IAEE,IAAA,QAAQ,GAAc,gBAAgB,SAA9B,EAAK,IAAI,UAAK,gBAAgB,EAAxC,YAAqB,CAAF,CAAsB;IAC/C,OAAO,IAAI,UAAU,CAAe,UAAC,UAAU;QAK7C,IAAM,UAAU,GAAG,IAAI,eAAe,EAAE,CAAC;QACjC,IAAA,MAAM,GAAK,UAAU,OAAf,CAAgB;QAK9B,IAAI,SAAS,GAAG,IAAI,CAAC;QAKb,IAAQ,WAAW,GAAK,IAAI,OAAT,CAAU;QACrC,IAAI,WAAW,EAAE;YACf,IAAI,WAAW,CAAC,OAAO,EAAE;gBACvB,UAAU,CAAC,KAAK,EAAE,CAAC;aACpB;iBAAM;gBAGL,IAAM,oBAAkB,GAAG;oBACzB,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE;wBACnB,UAAU,CAAC,KAAK,EAAE,CAAC;qBACpB;gBACH,CAAC,CAAC;gBACF,WAAW,CAAC,gBAAgB,CAAC,OAAO,EAAE,oBAAkB,CAAC,CAAC;gBAC1D,UAAU,CAAC,GAAG,CAAC,cAAM,OAAA,WAAW,CAAC,mBAAmB,CAAC,OAAO,EAAE,oBAAkB,CAAC,EAA5D,CAA4D,CAAC,CAAC;aACpF;SACF;QAOD,IAAM,iBAAiB,yBAAqB,IAAI,KAAE,MAAM,QAAA,GAAE,CAAC;QAE3D,IAAM,WAAW,GAAG,UAAC,GAAQ;YAC3B,SAAS,GAAG,KAAK,CAAC;YAClB,UAAU,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QACxB,CAAC,CAAC;QAEF,KAAK,CAAC,KAAK,EAAE,iBAAiB,CAAC;aAC5B,IAAI,CAAC,UAAC,QAAQ;YACb,IAAI,QAAQ,EAAE;gBAIZ,SAAS,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS,CACrC,wBAAwB,CACtB,UAAU,EAEV,SAAS,EAET;oBACE,SAAS,GAAG,KAAK,CAAC;oBAClB,UAAU,CAAC,QAAQ,EAAE,CAAC;gBACxB,CAAC,EACD,WAAW,CACZ,CACF,CAAC;aACH;iBAAM;gBACL,SAAS,GAAG,KAAK,CAAC;gBAClB,UAAU,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;gBAC1B,UAAU,CAAC,QAAQ,EAAE,CAAC;aACvB;QACH,CAAC,CAAC;aACD,KAAK,CAAC,WAAW,CAAC,CAAC;QAEtB,OAAO;YACL,IAAI,SAAS,EAAE;gBACb,UAAU,CAAC,KAAK,EAAE,CAAC;aACpB;QACH,CAAC,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC"}
|
||||
@@ -0,0 +1,125 @@
|
||||
# dot-prop [](https://travis-ci.com/github/sindresorhus/dot-prop)
|
||||
|
||||
> Get, set, or delete a property from a nested object using a dot path
|
||||
|
||||
## Install
|
||||
|
||||
```
|
||||
$ npm install dot-prop
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
const dotProp = require('dot-prop');
|
||||
|
||||
// Getter
|
||||
dotProp.get({foo: {bar: 'unicorn'}}, 'foo.bar');
|
||||
//=> 'unicorn'
|
||||
|
||||
dotProp.get({foo: {bar: 'a'}}, 'foo.notDefined.deep');
|
||||
//=> undefined
|
||||
|
||||
dotProp.get({foo: {bar: 'a'}}, 'foo.notDefined.deep', 'default value');
|
||||
//=> 'default value'
|
||||
|
||||
dotProp.get({foo: {'dot.dot': 'unicorn'}}, 'foo.dot\\.dot');
|
||||
//=> 'unicorn'
|
||||
|
||||
// Setter
|
||||
const object = {foo: {bar: 'a'}};
|
||||
dotProp.set(object, 'foo.bar', 'b');
|
||||
console.log(object);
|
||||
//=> {foo: {bar: 'b'}}
|
||||
|
||||
const foo = dotProp.set({}, 'foo.bar', 'c');
|
||||
console.log(foo);
|
||||
//=> {foo: {bar: 'c'}}
|
||||
|
||||
dotProp.set(object, 'foo.baz', 'x');
|
||||
console.log(object);
|
||||
//=> {foo: {bar: 'b', baz: 'x'}}
|
||||
|
||||
// Has
|
||||
dotProp.has({foo: {bar: 'unicorn'}}, 'foo.bar');
|
||||
//=> true
|
||||
|
||||
// Deleter
|
||||
const object = {foo: {bar: 'a'}};
|
||||
dotProp.delete(object, 'foo.bar');
|
||||
console.log(object);
|
||||
//=> {foo: {}}
|
||||
|
||||
object.foo.bar = {x: 'y', y: 'x'};
|
||||
dotProp.delete(object, 'foo.bar.x');
|
||||
console.log(object);
|
||||
//=> {foo: {bar: {y: 'x'}}}
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
### get(object, path, defaultValue?)
|
||||
|
||||
Get the value of the property at the given path.
|
||||
|
||||
Returns the value if any.
|
||||
|
||||
### set(object, path, value)
|
||||
|
||||
Set the property at the given path to the given value.
|
||||
|
||||
Returns the object.
|
||||
|
||||
### has(object, path)
|
||||
|
||||
Check whether the property at the given path exists.
|
||||
|
||||
Returns a boolean.
|
||||
|
||||
### delete(object, path)
|
||||
|
||||
Delete the property at the given path.
|
||||
|
||||
Returns a boolean of whether the property existed before being deleted.
|
||||
|
||||
#### object
|
||||
|
||||
Type: `object`
|
||||
|
||||
Object to get, set, or delete the `path` value.
|
||||
|
||||
You are allowed to pass in `undefined` as the object to the `get` and `has` functions.
|
||||
|
||||
#### path
|
||||
|
||||
Type: `string`
|
||||
|
||||
Path of the property in the object, using `.` to separate each nested key.
|
||||
|
||||
Use `\\.` if you have a `.` in the key.
|
||||
|
||||
The following path components are invalid and results in `undefined` being returned: `__proto__`, `prototype`, `constructor`.
|
||||
|
||||
#### value
|
||||
|
||||
Type: `unknown`
|
||||
|
||||
Value to set at `path`.
|
||||
|
||||
#### defaultValue
|
||||
|
||||
Type: `unknown`
|
||||
|
||||
Default value.
|
||||
|
||||
---
|
||||
|
||||
<div align="center">
|
||||
<b>
|
||||
<a href="https://tidelift.com/subscription/pkg/npm-dot-prop?utm_source=npm-dot-prop&utm_medium=referral&utm_campaign=readme">Get professional support for this package with a Tidelift subscription</a>
|
||||
</b>
|
||||
<br>
|
||||
<sub>
|
||||
Tidelift helps make open source sustainable for maintainers while giving companies<br>assurances about security, maintenance, and licensing for their dependencies.
|
||||
</sub>
|
||||
</div>
|
||||
@@ -0,0 +1,40 @@
|
||||
var baseClone = require('./_baseClone');
|
||||
|
||||
/** Used to compose bitmasks for cloning. */
|
||||
var CLONE_DEEP_FLAG = 1,
|
||||
CLONE_SYMBOLS_FLAG = 4;
|
||||
|
||||
/**
|
||||
* This method is like `_.cloneWith` except that it recursively clones `value`.
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
* @since 4.0.0
|
||||
* @category Lang
|
||||
* @param {*} value The value to recursively clone.
|
||||
* @param {Function} [customizer] The function to customize cloning.
|
||||
* @returns {*} Returns the deep cloned value.
|
||||
* @see _.cloneWith
|
||||
* @example
|
||||
*
|
||||
* function customizer(value) {
|
||||
* if (_.isElement(value)) {
|
||||
* return value.cloneNode(true);
|
||||
* }
|
||||
* }
|
||||
*
|
||||
* var el = _.cloneDeepWith(document.body, customizer);
|
||||
*
|
||||
* console.log(el === document.body);
|
||||
* // => false
|
||||
* console.log(el.nodeName);
|
||||
* // => 'BODY'
|
||||
* console.log(el.childNodes.length);
|
||||
* // => 20
|
||||
*/
|
||||
function cloneDeepWith(value, customizer) {
|
||||
customizer = typeof customizer == 'function' ? customizer : undefined;
|
||||
return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG, customizer);
|
||||
}
|
||||
|
||||
module.exports = cloneDeepWith;
|
||||
@@ -0,0 +1,4 @@
|
||||
import Tag from './shared/Tag';
|
||||
export default class MustacheTag extends Tag {
|
||||
type: 'MustacheTag';
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
'use strict';
|
||||
|
||||
var has = require('has');
|
||||
|
||||
var Type = require('./Type');
|
||||
|
||||
var assertRecord = require('../helpers/assertRecord');
|
||||
|
||||
// https://262.ecma-international.org/5.1/#sec-8.10.2
|
||||
|
||||
module.exports = function IsDataDescriptor(Desc) {
|
||||
if (typeof Desc === 'undefined') {
|
||||
return false;
|
||||
}
|
||||
|
||||
assertRecord(Type, 'Property Descriptor', 'Desc', Desc);
|
||||
|
||||
if (!has(Desc, '[[Value]]') && !has(Desc, '[[Writable]]')) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
};
|
||||
@@ -0,0 +1,44 @@
|
||||
{
|
||||
"name": "@nodelib/fs.scandir",
|
||||
"version": "2.1.5",
|
||||
"description": "List files and directories inside the specified directory",
|
||||
"license": "MIT",
|
||||
"repository": "https://github.com/nodelib/nodelib/tree/master/packages/fs/fs.scandir",
|
||||
"keywords": [
|
||||
"NodeLib",
|
||||
"fs",
|
||||
"FileSystem",
|
||||
"file system",
|
||||
"scandir",
|
||||
"readdir",
|
||||
"dirent"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">= 8"
|
||||
},
|
||||
"files": [
|
||||
"out/**",
|
||||
"!out/**/*.map",
|
||||
"!out/**/*.spec.*"
|
||||
],
|
||||
"main": "out/index.js",
|
||||
"typings": "out/index.d.ts",
|
||||
"scripts": {
|
||||
"clean": "rimraf {tsconfig.tsbuildinfo,out}",
|
||||
"lint": "eslint \"src/**/*.ts\" --cache",
|
||||
"compile": "tsc -b .",
|
||||
"compile:watch": "tsc -p . --watch --sourceMap",
|
||||
"test": "mocha \"out/**/*.spec.js\" -s 0",
|
||||
"build": "npm run clean && npm run compile && npm run lint && npm test",
|
||||
"watch": "npm run clean && npm run compile:watch"
|
||||
},
|
||||
"dependencies": {
|
||||
"@nodelib/fs.stat": "2.0.5",
|
||||
"run-parallel": "^1.1.9"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@nodelib/fs.macchiato": "1.0.4",
|
||||
"@types/run-parallel": "^1.1.0"
|
||||
},
|
||||
"gitHead": "d6a7960d5281d3dd5f8e2efba49bb552d090f562"
|
||||
}
|
||||
@@ -0,0 +1,131 @@
|
||||
var getDelimiter = require("./getDelimiter");
|
||||
var filterRow=require("./filterRow");
|
||||
/**
|
||||
* Convert a line of string to csv columns according to its delimiter
|
||||
* the param._header may not be ready when this is called.
|
||||
* @param {[type]} rowStr [description]
|
||||
* @param {[type]} param [Converter param]
|
||||
* @return {[type]} {cols:["a","b","c"],closed:boolean} the closed field indicate if the row is a complete row
|
||||
*/
|
||||
module.exports = function rowSplit(rowStr, param) {
|
||||
if (rowStr === "") {
|
||||
return { cols: [], closed: true };
|
||||
}
|
||||
var quote = param.quote;
|
||||
var trim = param.trim;
|
||||
var escape = param.escape;
|
||||
if (param.delimiter instanceof Array || param.delimiter.toLowerCase() === "auto") {
|
||||
param.delimiter = getDelimiter(rowStr, param);
|
||||
}
|
||||
var delimiter = param.delimiter;
|
||||
var rowArr = rowStr.split(delimiter);
|
||||
if (quote === "off") {
|
||||
return { cols: rowArr, closed: true };
|
||||
}
|
||||
var row = [];
|
||||
var inquote = false;
|
||||
var quoteBuff = '';
|
||||
for (var i = 0, rowLen = rowArr.length; i < rowLen; i++) {
|
||||
var e = rowArr[i];
|
||||
if (!inquote && trim) {
|
||||
e = e.trim();
|
||||
}
|
||||
var len = e.length;
|
||||
if (!inquote) {
|
||||
if (isQuoteOpen(e, param)) { //quote open
|
||||
e = e.substr(1);
|
||||
if (isQuoteClose(e, param)) { //quote close
|
||||
e = e.substring(0, e.length - 1);
|
||||
e = _escapeQuote(e, quote, escape);
|
||||
row.push(e);
|
||||
continue;
|
||||
} else {
|
||||
inquote = true;
|
||||
quoteBuff += e;
|
||||
continue;
|
||||
}
|
||||
} else {
|
||||
row.push(e);
|
||||
continue;
|
||||
}
|
||||
} else { //previous quote not closed
|
||||
if (isQuoteClose(e, param)) { //close double quote
|
||||
inquote = false;
|
||||
e = e.substr(0, len - 1);
|
||||
quoteBuff += delimiter + e;
|
||||
quoteBuff = _escapeQuote(quoteBuff, quote, escape);
|
||||
if (trim) {
|
||||
quoteBuff = quoteBuff.replace(/\s+$/, "");
|
||||
}
|
||||
row.push(quoteBuff);
|
||||
quoteBuff = "";
|
||||
} else {
|
||||
quoteBuff += delimiter + e;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!inquote && param._needFilterRow) {
|
||||
row = filterRow(row, param);
|
||||
}
|
||||
|
||||
return { cols: row, closed: !inquote };
|
||||
// if (param.workerNum<=1){
|
||||
// }else{
|
||||
// if (inquote && quoteBuff.length>0){//for multi core, quote will be closed at the end of line
|
||||
// quoteBuff=_escapeQuote(quoteBuff,quote,escape);;
|
||||
// if (trim){
|
||||
// quoteBuff=quoteBuff.trimRight();
|
||||
// }
|
||||
// row.push(quoteBuff);
|
||||
// }
|
||||
// return {cols:row,closed:true};
|
||||
// }
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
function isQuoteOpen(str, param) {
|
||||
var quote = param.quote;
|
||||
var escape = param.escape;
|
||||
return str[0] === quote && (
|
||||
str[1] !== quote ||
|
||||
str[1] === escape && (str[2] === quote || str.length === 2));
|
||||
}
|
||||
function isQuoteClose(str, param) {
|
||||
var quote = param.quote;
|
||||
var count = 0;
|
||||
var idx = str.length - 1;
|
||||
var escape = param.escape;
|
||||
while (str[idx] === quote || str[idx] === escape) {
|
||||
idx--;
|
||||
count++;
|
||||
}
|
||||
return count % 2 !== 0;
|
||||
}
|
||||
|
||||
function twoDoubleQuote(str, quote) {
|
||||
var twoQuote = quote + quote;
|
||||
var curIndex = -1;
|
||||
while ((curIndex = str.indexOf(twoQuote, curIndex)) > -1) {
|
||||
str = str.substring(0, curIndex) + str.substring(++curIndex);
|
||||
}
|
||||
return str;
|
||||
}
|
||||
|
||||
var cachedRegExp = {};
|
||||
function _escapeQuote(segment, quote, escape) {
|
||||
|
||||
var key = "es|" + quote + "|" + escape;
|
||||
if (cachedRegExp[key] === undefined) {
|
||||
|
||||
// if (escape === "\\") {
|
||||
// escape = "\\\\";
|
||||
// }
|
||||
cachedRegExp[key] = new RegExp('\\'+escape + '\\'+quote, 'g');
|
||||
}
|
||||
var regExp = cachedRegExp[key];
|
||||
// console.log(regExp,segment);
|
||||
return segment.replace(regExp, quote);
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
/**
|
||||
* The base implementation of `_.conformsTo` which accepts `props` to check.
|
||||
*
|
||||
* @private
|
||||
* @param {Object} object The object to inspect.
|
||||
* @param {Object} source The object of property predicates to conform to.
|
||||
* @returns {boolean} Returns `true` if `object` conforms, else `false`.
|
||||
*/
|
||||
function baseConformsTo(object, source, props) {
|
||||
var length = props.length;
|
||||
if (object == null) {
|
||||
return !length;
|
||||
}
|
||||
object = Object(object);
|
||||
while (length--) {
|
||||
var key = props[length],
|
||||
predicate = source[key],
|
||||
value = object[key];
|
||||
|
||||
if ((value === undefined && !(key in object)) || !predicate(value)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
module.exports = baseConformsTo;
|
||||
@@ -0,0 +1,263 @@
|
||||
# postcss-value-parser
|
||||
|
||||
[](https://travis-ci.org/TrySound/postcss-value-parser)
|
||||
|
||||
Transforms CSS declaration values and at-rule parameters into a tree of nodes, and provides a simple traversal API.
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
var valueParser = require('postcss-value-parser');
|
||||
var cssBackgroundValue = 'url(foo.png) no-repeat 40px 73%';
|
||||
var parsedValue = valueParser(cssBackgroundValue);
|
||||
// parsedValue exposes an API described below,
|
||||
// e.g. parsedValue.walk(..), parsedValue.toString(), etc.
|
||||
```
|
||||
|
||||
For example, parsing the value `rgba(233, 45, 66, .5)` will return the following:
|
||||
|
||||
```js
|
||||
{
|
||||
nodes: [
|
||||
{
|
||||
type: 'function',
|
||||
value: 'rgba',
|
||||
before: '',
|
||||
after: '',
|
||||
nodes: [
|
||||
{ type: 'word', value: '233' },
|
||||
{ type: 'div', value: ',', before: '', after: ' ' },
|
||||
{ type: 'word', value: '45' },
|
||||
{ type: 'div', value: ',', before: '', after: ' ' },
|
||||
{ type: 'word', value: '66' },
|
||||
{ type: 'div', value: ',', before: ' ', after: '' },
|
||||
{ type: 'word', value: '.5' }
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
If you wanted to convert each `rgba()` value in `sourceCSS` to a hex value, you could do so like this:
|
||||
|
||||
```js
|
||||
var valueParser = require('postcss-value-parser');
|
||||
|
||||
var parsed = valueParser(sourceCSS);
|
||||
|
||||
// walk() will visit all the of the nodes in the tree,
|
||||
// invoking the callback for each.
|
||||
parsed.walk(function (node) {
|
||||
|
||||
// Since we only want to transform rgba() values,
|
||||
// we can ignore anything else.
|
||||
if (node.type !== 'function' && node.value !== 'rgba') return;
|
||||
|
||||
// We can make an array of the rgba() arguments to feed to a
|
||||
// convertToHex() function
|
||||
var color = node.nodes.filter(function (node) {
|
||||
return node.type === 'word';
|
||||
}).map(function (node) {
|
||||
return Number(node.value);
|
||||
}); // [233, 45, 66, .5]
|
||||
|
||||
// Now we will transform the existing rgba() function node
|
||||
// into a word node with the hex value
|
||||
node.type = 'word';
|
||||
node.value = convertToHex(color);
|
||||
})
|
||||
|
||||
parsed.toString(); // #E92D42
|
||||
```
|
||||
|
||||
## Nodes
|
||||
|
||||
Each node is an object with these common properties:
|
||||
|
||||
- **type**: The type of node (`word`, `string`, `div`, `space`, `comment`, or `function`).
|
||||
Each type is documented below.
|
||||
- **value**: Each node has a `value` property; but what exactly `value` means
|
||||
is specific to the node type. Details are documented for each type below.
|
||||
- **sourceIndex**: The starting index of the node within the original source
|
||||
string. For example, given the source string `10px 20px`, the `word` node
|
||||
whose value is `20px` will have a `sourceIndex` of `5`.
|
||||
|
||||
### word
|
||||
|
||||
The catch-all node type that includes keywords (e.g. `no-repeat`),
|
||||
quantities (e.g. `20px`, `75%`, `1.5`), and hex colors (e.g. `#e6e6e6`).
|
||||
|
||||
Node-specific properties:
|
||||
|
||||
- **value**: The "word" itself.
|
||||
|
||||
### string
|
||||
|
||||
A quoted string value, e.g. `"something"` in `content: "something";`.
|
||||
|
||||
Node-specific properties:
|
||||
|
||||
- **value**: The text content of the string.
|
||||
- **quote**: The quotation mark surrounding the string, either `"` or `'`.
|
||||
- **unclosed**: `true` if the string was not closed properly. e.g. `"unclosed string `.
|
||||
|
||||
### div
|
||||
|
||||
A divider, for example
|
||||
|
||||
- `,` in `animation-duration: 1s, 2s, 3s`
|
||||
- `/` in `border-radius: 10px / 23px`
|
||||
- `:` in `(min-width: 700px)`
|
||||
|
||||
Node-specific properties:
|
||||
|
||||
- **value**: The divider character. Either `,`, `/`, or `:` (see examples above).
|
||||
- **before**: Whitespace before the divider.
|
||||
- **after**: Whitespace after the divider.
|
||||
|
||||
### space
|
||||
|
||||
Whitespace used as a separator, e.g. ` ` occurring twice in `border: 1px solid black;`.
|
||||
|
||||
Node-specific properties:
|
||||
|
||||
- **value**: The whitespace itself.
|
||||
|
||||
### comment
|
||||
|
||||
A CSS comment starts with `/*` and ends with `*/`
|
||||
|
||||
Node-specific properties:
|
||||
|
||||
- **value**: The comment value without `/*` and `*/`
|
||||
- **unclosed**: `true` if the comment was not closed properly. e.g. `/* comment without an end `.
|
||||
|
||||
### function
|
||||
|
||||
A CSS function, e.g. `rgb(0,0,0)` or `url(foo.bar)`.
|
||||
|
||||
Function nodes have nodes nested within them: the function arguments.
|
||||
|
||||
Additional properties:
|
||||
|
||||
- **value**: The name of the function, e.g. `rgb` in `rgb(0,0,0)`.
|
||||
- **before**: Whitespace after the opening parenthesis and before the first argument,
|
||||
e.g. ` ` in `rgb( 0,0,0)`.
|
||||
- **after**: Whitespace before the closing parenthesis and after the last argument,
|
||||
e.g. ` ` in `rgb(0,0,0 )`.
|
||||
- **nodes**: More nodes representing the arguments to the function.
|
||||
- **unclosed**: `true` if the parentheses was not closed properly. e.g. `( unclosed-function `.
|
||||
|
||||
Media features surrounded by parentheses are considered functions with an
|
||||
empty value. For example, `(min-width: 700px)` parses to these nodes:
|
||||
|
||||
```js
|
||||
[
|
||||
{
|
||||
type: 'function', value: '', before: '', after: '',
|
||||
nodes: [
|
||||
{ type: 'word', value: 'min-width' },
|
||||
{ type: 'div', value: ':', before: '', after: ' ' },
|
||||
{ type: 'word', value: '700px' }
|
||||
]
|
||||
}
|
||||
]
|
||||
```
|
||||
|
||||
`url()` functions can be parsed a little bit differently depending on
|
||||
whether the first character in the argument is a quotation mark.
|
||||
|
||||
`url( /gfx/img/bg.jpg )` parses to:
|
||||
|
||||
```js
|
||||
{ type: 'function', sourceIndex: 0, value: 'url', before: ' ', after: ' ', nodes: [
|
||||
{ type: 'word', sourceIndex: 5, value: '/gfx/img/bg.jpg' }
|
||||
] }
|
||||
```
|
||||
|
||||
`url( "/gfx/img/bg.jpg" )`, on the other hand, parses to:
|
||||
|
||||
```js
|
||||
{ type: 'function', sourceIndex: 0, value: 'url', before: ' ', after: ' ', nodes: [
|
||||
type: 'string', sourceIndex: 5, quote: '"', value: '/gfx/img/bg.jpg' },
|
||||
] }
|
||||
```
|
||||
|
||||
### unicode-range
|
||||
|
||||
The unicode-range CSS descriptor sets the specific range of characters to be
|
||||
used from a font defined by @font-face and made available
|
||||
for use on the current page (`unicode-range: U+0025-00FF`).
|
||||
|
||||
Node-specific properties:
|
||||
|
||||
- **value**: The "unicode-range" itself.
|
||||
|
||||
## API
|
||||
|
||||
```
|
||||
var valueParser = require('postcss-value-parser');
|
||||
```
|
||||
|
||||
### valueParser.unit(quantity)
|
||||
|
||||
Parses `quantity`, distinguishing the number from the unit. Returns an object like the following:
|
||||
|
||||
```js
|
||||
// Given 2rem
|
||||
{
|
||||
number: '2',
|
||||
unit: 'rem'
|
||||
}
|
||||
```
|
||||
|
||||
If the `quantity` argument cannot be parsed as a number, returns `false`.
|
||||
|
||||
*This function does not parse complete values*: you cannot pass it `1px solid black` and expect `px` as
|
||||
the unit. Instead, you should pass it single quantities only. Parse `1px solid black`, then pass it
|
||||
the stringified `1px` node (a `word` node) to parse the number and unit.
|
||||
|
||||
### valueParser.stringify(nodes[, custom])
|
||||
|
||||
Stringifies a node or array of nodes.
|
||||
|
||||
The `custom` function is called for each `node`; return a string to override the default behaviour.
|
||||
|
||||
### valueParser.walk(nodes, callback[, bubble])
|
||||
|
||||
Walks each provided node, recursively walking all descendent nodes within functions.
|
||||
|
||||
Returning `false` in the `callback` will prevent traversal of descendent nodes (within functions).
|
||||
You can use this feature to for shallow iteration, walking over only the *immediate* children.
|
||||
*Note: This only applies if `bubble` is `false` (which is the default).*
|
||||
|
||||
By default, the tree is walked from the outermost node inwards.
|
||||
To reverse the direction, pass `true` for the `bubble` argument.
|
||||
|
||||
The `callback` is invoked with three arguments: `callback(node, index, nodes)`.
|
||||
|
||||
- `node`: The current node.
|
||||
- `index`: The index of the current node.
|
||||
- `nodes`: The complete nodes array passed to `walk()`.
|
||||
|
||||
Returns the `valueParser` instance.
|
||||
|
||||
### var parsed = valueParser(value)
|
||||
|
||||
Returns the parsed node tree.
|
||||
|
||||
### parsed.nodes
|
||||
|
||||
The array of nodes.
|
||||
|
||||
### parsed.toString()
|
||||
|
||||
Stringifies the node tree.
|
||||
|
||||
### parsed.walk(callback[, bubble])
|
||||
|
||||
Walks each node inside `parsed.nodes`. See the documentation for `valueParser.walk()` above.
|
||||
|
||||
# License
|
||||
|
||||
MIT © [Bogdan Chadkin](mailto:trysound@yandex.ru)
|
||||
@@ -0,0 +1,17 @@
|
||||
"use strict";
|
||||
|
||||
var validFunction = require("../valid-function");
|
||||
|
||||
var re1 = /^\s*function[\0-')-\uffff]*\(([\0-(*-\uffff]*)\)\s*\{([\0-\uffff]*)\}\s*$/
|
||||
, re2 = /^\s*\(?([\0-'*-\uffff]*)\)?\s*=>\s*(\{?[\0-\uffff]*\}?)\s*$/;
|
||||
|
||||
module.exports = function () {
|
||||
var str = String(validFunction(this)), data = str.match(re1);
|
||||
if (!data) {
|
||||
data = str.match(re2);
|
||||
if (!data) throw new Error("Unrecognized string format");
|
||||
data[1] = data[1].trim();
|
||||
if (data[2][0] === "{") data[2] = data[2].trim().slice(1, -1);
|
||||
}
|
||||
return { args: data[1], body: data[2] };
|
||||
};
|
||||
@@ -0,0 +1,6 @@
|
||||
import { mergeMap } from './mergeMap';
|
||||
import { identity } from '../util/identity';
|
||||
export function mergeAll(concurrent = Infinity) {
|
||||
return mergeMap(identity, concurrent);
|
||||
}
|
||||
//# sourceMappingURL=mergeAll.js.map
|
||||
@@ -0,0 +1 @@
|
||||
export const VERSION = "7.0.5";
|
||||
Reference in New Issue
Block a user