new license file version [CI SKIP]

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

View File

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

View File

@@ -0,0 +1,19 @@
import {
PipelineProcessor,
PipelineProcessorProps,
ProcessorType,
} from '../processor';
import { ServerStorageOptions } from '../../storage/server';
interface ServerGlobalSearchFilterProps extends PipelineProcessorProps {
keyword?: string;
url?: (prevUrl: string, keyword: string) => string;
body?: (prevBody: BodyInit, keyword: string) => BodyInit;
}
declare class ServerGlobalSearchFilter extends PipelineProcessor<
ServerStorageOptions,
ServerGlobalSearchFilterProps
> {
get type(): ProcessorType;
_process(options?: ServerStorageOptions): ServerStorageOptions;
}
export default ServerGlobalSearchFilter;

View File

@@ -0,0 +1,334 @@
'use strict'
// A linked list to keep track of recently-used-ness
const Yallist = require('yallist')
const MAX = Symbol('max')
const LENGTH = Symbol('length')
const LENGTH_CALCULATOR = Symbol('lengthCalculator')
const ALLOW_STALE = Symbol('allowStale')
const MAX_AGE = Symbol('maxAge')
const DISPOSE = Symbol('dispose')
const NO_DISPOSE_ON_SET = Symbol('noDisposeOnSet')
const LRU_LIST = Symbol('lruList')
const CACHE = Symbol('cache')
const UPDATE_AGE_ON_GET = Symbol('updateAgeOnGet')
const naiveLength = () => 1
// lruList is a yallist where the head is the youngest
// item, and the tail is the oldest. the list contains the Hit
// objects as the entries.
// Each Hit object has a reference to its Yallist.Node. This
// never changes.
//
// cache is a Map (or PseudoMap) that matches the keys to
// the Yallist.Node object.
class LRUCache {
constructor (options) {
if (typeof options === 'number')
options = { max: options }
if (!options)
options = {}
if (options.max && (typeof options.max !== 'number' || options.max < 0))
throw new TypeError('max must be a non-negative number')
// Kind of weird to have a default max of Infinity, but oh well.
const max = this[MAX] = options.max || Infinity
const lc = options.length || naiveLength
this[LENGTH_CALCULATOR] = (typeof lc !== 'function') ? naiveLength : lc
this[ALLOW_STALE] = options.stale || false
if (options.maxAge && typeof options.maxAge !== 'number')
throw new TypeError('maxAge must be a number')
this[MAX_AGE] = options.maxAge || 0
this[DISPOSE] = options.dispose
this[NO_DISPOSE_ON_SET] = options.noDisposeOnSet || false
this[UPDATE_AGE_ON_GET] = options.updateAgeOnGet || false
this.reset()
}
// resize the cache when the max changes.
set max (mL) {
if (typeof mL !== 'number' || mL < 0)
throw new TypeError('max must be a non-negative number')
this[MAX] = mL || Infinity
trim(this)
}
get max () {
return this[MAX]
}
set allowStale (allowStale) {
this[ALLOW_STALE] = !!allowStale
}
get allowStale () {
return this[ALLOW_STALE]
}
set maxAge (mA) {
if (typeof mA !== 'number')
throw new TypeError('maxAge must be a non-negative number')
this[MAX_AGE] = mA
trim(this)
}
get maxAge () {
return this[MAX_AGE]
}
// resize the cache when the lengthCalculator changes.
set lengthCalculator (lC) {
if (typeof lC !== 'function')
lC = naiveLength
if (lC !== this[LENGTH_CALCULATOR]) {
this[LENGTH_CALCULATOR] = lC
this[LENGTH] = 0
this[LRU_LIST].forEach(hit => {
hit.length = this[LENGTH_CALCULATOR](hit.value, hit.key)
this[LENGTH] += hit.length
})
}
trim(this)
}
get lengthCalculator () { return this[LENGTH_CALCULATOR] }
get length () { return this[LENGTH] }
get itemCount () { return this[LRU_LIST].length }
rforEach (fn, thisp) {
thisp = thisp || this
for (let walker = this[LRU_LIST].tail; walker !== null;) {
const prev = walker.prev
forEachStep(this, fn, walker, thisp)
walker = prev
}
}
forEach (fn, thisp) {
thisp = thisp || this
for (let walker = this[LRU_LIST].head; walker !== null;) {
const next = walker.next
forEachStep(this, fn, walker, thisp)
walker = next
}
}
keys () {
return this[LRU_LIST].toArray().map(k => k.key)
}
values () {
return this[LRU_LIST].toArray().map(k => k.value)
}
reset () {
if (this[DISPOSE] &&
this[LRU_LIST] &&
this[LRU_LIST].length) {
this[LRU_LIST].forEach(hit => this[DISPOSE](hit.key, hit.value))
}
this[CACHE] = new Map() // hash of items by key
this[LRU_LIST] = new Yallist() // list of items in order of use recency
this[LENGTH] = 0 // length of items in the list
}
dump () {
return this[LRU_LIST].map(hit =>
isStale(this, hit) ? false : {
k: hit.key,
v: hit.value,
e: hit.now + (hit.maxAge || 0)
}).toArray().filter(h => h)
}
dumpLru () {
return this[LRU_LIST]
}
set (key, value, maxAge) {
maxAge = maxAge || this[MAX_AGE]
if (maxAge && typeof maxAge !== 'number')
throw new TypeError('maxAge must be a number')
const now = maxAge ? Date.now() : 0
const len = this[LENGTH_CALCULATOR](value, key)
if (this[CACHE].has(key)) {
if (len > this[MAX]) {
del(this, this[CACHE].get(key))
return false
}
const node = this[CACHE].get(key)
const item = node.value
// dispose of the old one before overwriting
// split out into 2 ifs for better coverage tracking
if (this[DISPOSE]) {
if (!this[NO_DISPOSE_ON_SET])
this[DISPOSE](key, item.value)
}
item.now = now
item.maxAge = maxAge
item.value = value
this[LENGTH] += len - item.length
item.length = len
this.get(key)
trim(this)
return true
}
const hit = new Entry(key, value, len, now, maxAge)
// oversized objects fall out of cache automatically.
if (hit.length > this[MAX]) {
if (this[DISPOSE])
this[DISPOSE](key, value)
return false
}
this[LENGTH] += hit.length
this[LRU_LIST].unshift(hit)
this[CACHE].set(key, this[LRU_LIST].head)
trim(this)
return true
}
has (key) {
if (!this[CACHE].has(key)) return false
const hit = this[CACHE].get(key).value
return !isStale(this, hit)
}
get (key) {
return get(this, key, true)
}
peek (key) {
return get(this, key, false)
}
pop () {
const node = this[LRU_LIST].tail
if (!node)
return null
del(this, node)
return node.value
}
del (key) {
del(this, this[CACHE].get(key))
}
load (arr) {
// reset the cache
this.reset()
const now = Date.now()
// A previous serialized cache has the most recent items first
for (let l = arr.length - 1; l >= 0; l--) {
const hit = arr[l]
const expiresAt = hit.e || 0
if (expiresAt === 0)
// the item was created without expiration in a non aged cache
this.set(hit.k, hit.v)
else {
const maxAge = expiresAt - now
// dont add already expired items
if (maxAge > 0) {
this.set(hit.k, hit.v, maxAge)
}
}
}
}
prune () {
this[CACHE].forEach((value, key) => get(this, key, false))
}
}
const get = (self, key, doUse) => {
const node = self[CACHE].get(key)
if (node) {
const hit = node.value
if (isStale(self, hit)) {
del(self, node)
if (!self[ALLOW_STALE])
return undefined
} else {
if (doUse) {
if (self[UPDATE_AGE_ON_GET])
node.value.now = Date.now()
self[LRU_LIST].unshiftNode(node)
}
}
return hit.value
}
}
const isStale = (self, hit) => {
if (!hit || (!hit.maxAge && !self[MAX_AGE]))
return false
const diff = Date.now() - hit.now
return hit.maxAge ? diff > hit.maxAge
: self[MAX_AGE] && (diff > self[MAX_AGE])
}
const trim = self => {
if (self[LENGTH] > self[MAX]) {
for (let walker = self[LRU_LIST].tail;
self[LENGTH] > self[MAX] && walker !== null;) {
// We know that we're about to delete this one, and also
// what the next least recently used key will be, so just
// go ahead and set it now.
const prev = walker.prev
del(self, walker)
walker = prev
}
}
}
const del = (self, node) => {
if (node) {
const hit = node.value
if (self[DISPOSE])
self[DISPOSE](hit.key, hit.value)
self[LENGTH] -= hit.length
self[CACHE].delete(hit.key)
self[LRU_LIST].removeNode(node)
}
}
class Entry {
constructor (key, value, length, now, maxAge) {
this.key = key
this.value = value
this.length = length
this.now = now
this.maxAge = maxAge || 0
}
}
const forEachStep = (self, fn, node, thisp) => {
let hit = node.value
if (isStale(self, hit)) {
del(self, node)
if (!self[ALLOW_STALE])
hit = undefined
}
if (hit)
fn.call(thisp, hit.value, hit.key, self)
}
module.exports = LRUCache

View File

@@ -0,0 +1,4 @@
// eslint-disable-next-line @typescript-eslint/naming-convention
export default function isUnixSocketURL(url) {
return url.protocol === 'unix:' || url.hostname === 'unix';
}

View File

@@ -0,0 +1,9 @@
import { createErrorClass } from './createErrorClass';
export var ArgumentOutOfRangeError = createErrorClass(function (_super) {
return function ArgumentOutOfRangeErrorImpl() {
_super(this);
this.name = 'ArgumentOutOfRangeError';
this.message = 'argument out of range';
};
});
//# sourceMappingURL=ArgumentOutOfRangeError.js.map

View File

@@ -0,0 +1,3 @@
'use strict';
module.exports = require('./async').detectLimit;

View File

@@ -0,0 +1 @@
{"version":3,"file":"fromEvent.js","sourceRoot":"","sources":["../../../../src/internal/observable/fromEvent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACpD,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACjD,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAG5D,MAAM,uBAAuB,GAAG,CAAC,aAAa,EAAE,gBAAgB,CAAU,CAAC;AAC3E,MAAM,kBAAkB,GAAG,CAAC,kBAAkB,EAAE,qBAAqB,CAAU,CAAC;AAChF,MAAM,aAAa,GAAG,CAAC,IAAI,EAAE,KAAK,CAAU,CAAC;AA8N7C,MAAM,UAAU,SAAS,CACvB,MAAW,EACX,SAAiB,EACjB,OAAwD,EACxD,cAAsC;IAEtC,IAAI,UAAU,CAAC,OAAO,CAAC,EAAE;QACvB,cAAc,GAAG,OAAO,CAAC;QACzB,OAAO,GAAG,SAAS,CAAC;KACrB;IACD,IAAI,cAAc,EAAE;QAClB,OAAO,SAAS,CAAI,MAAM,EAAE,SAAS,EAAE,OAA+B,CAAC,CAAC,IAAI,CAAC,gBAAgB,CAAC,cAAc,CAAC,CAAC,CAAC;KAChH;IASD,MAAM,CAAC,GAAG,EAAE,MAAM,CAAC,GAEjB,aAAa,CAAC,MAAM,CAAC;QACnB,CAAC,CAAC,kBAAkB,CAAC,GAAG,CAAC,CAAC,UAAU,EAAE,EAAE,CAAC,CAAC,OAAY,EAAE,EAAE,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,SAAS,EAAE,OAAO,EAAE,OAA+B,CAAC,CAAC;QACnI,CAAC;YACD,uBAAuB,CAAC,MAAM,CAAC;gBAC/B,CAAC,CAAC,uBAAuB,CAAC,GAAG,CAAC,uBAAuB,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;gBACzE,CAAC,CAAC,yBAAyB,CAAC,MAAM,CAAC;oBACnC,CAAC,CAAC,aAAa,CAAC,GAAG,CAAC,uBAAuB,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;oBAC/D,CAAC,CAAC,EAAE,CAAC;IAOT,IAAI,CAAC,GAAG,EAAE;QACR,IAAI,WAAW,CAAC,MAAM,CAAC,EAAE;YACvB,OAAO,QAAQ,CAAC,CAAC,SAAc,EAAE,EAAE,CAAC,SAAS,CAAC,SAAS,EAAE,SAAS,EAAE,OAA+B,CAAC,CAAC,CACnG,SAAS,CAAC,MAAM,CAAC,CACD,CAAC;SACpB;KACF;IAID,IAAI,CAAC,GAAG,EAAE;QACR,MAAM,IAAI,SAAS,CAAC,sBAAsB,CAAC,CAAC;KAC7C;IAED,OAAO,IAAI,UAAU,CAAI,CAAC,UAAU,EAAE,EAAE;QAItC,MAAM,OAAO,GAAG,CAAC,GAAG,IAAW,EAAE,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;QAEtF,GAAG,CAAC,OAAO,CAAC,CAAC;QAEb,OAAO,GAAG,EAAE,CAAC,MAAO,CAAC,OAAO,CAAC,CAAC;IAChC,CAAC,CAAC,CAAC;AACL,CAAC;AASD,SAAS,uBAAuB,CAAC,MAAW,EAAE,SAAiB;IAC7D,OAAO,CAAC,UAAkB,EAAE,EAAE,CAAC,CAAC,OAAY,EAAE,EAAE,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;AAC1F,CAAC;AAOD,SAAS,uBAAuB,CAAC,MAAW;IAC1C,OAAO,UAAU,CAAC,MAAM,CAAC,WAAW,CAAC,IAAI,UAAU,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC;AAC7E,CAAC;AAOD,SAAS,yBAAyB,CAAC,MAAW;IAC5C,OAAO,UAAU,CAAC,MAAM,CAAC,EAAE,CAAC,IAAI,UAAU,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;AACzD,CAAC;AAOD,SAAS,aAAa,CAAC,MAAW;IAChC,OAAO,UAAU,CAAC,MAAM,CAAC,gBAAgB,CAAC,IAAI,UAAU,CAAC,MAAM,CAAC,mBAAmB,CAAC,CAAC;AACvF,CAAC"}

View File

@@ -0,0 +1,19 @@
'use strict';
// TODO, semver-major: delete this
var isPropertyDescriptor = require('../helpers/isPropertyDescriptor');
var Type = require('./Type');
var IsDataDescriptor = require('./IsDataDescriptor');
var IsAccessorDescriptor = require('./IsAccessorDescriptor');
// https://262.ecma-international.org/6.0/#sec-property-descriptor-specification-type
module.exports = function IsPropertyDescriptor(Desc) {
return isPropertyDescriptor({
IsDataDescriptor: IsDataDescriptor,
IsAccessorDescriptor: IsAccessorDescriptor,
Type: Type
}, Desc);
};

View File

@@ -0,0 +1 @@
{"version":3,"file":"executeSchedule.d.ts","sourceRoot":"","sources":["../../../../src/internal/util/executeSchedule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAmB,aAAa,EAAE,MAAM,UAAU,CAAC;AAE1D,wBAAgB,eAAe,CAC7B,kBAAkB,EAAE,YAAY,EAChC,SAAS,EAAE,aAAa,EACxB,IAAI,EAAE,MAAM,IAAI,EAChB,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,IAAI,GACX,IAAI,CAAC;AACR,wBAAgB,eAAe,CAC7B,kBAAkB,EAAE,YAAY,EAChC,SAAS,EAAE,aAAa,EACxB,IAAI,EAAE,MAAM,IAAI,EAChB,KAAK,CAAC,EAAE,MAAM,EACd,MAAM,CAAC,EAAE,KAAK,GACb,YAAY,CAAC"}

View File

@@ -0,0 +1,550 @@
'use strict'
let { isClean, my } = require('./symbols')
let MapGenerator = require('./map-generator')
let stringify = require('./stringify')
let Container = require('./container')
let Document = require('./document')
let warnOnce = require('./warn-once')
let Result = require('./result')
let parse = require('./parse')
let Root = require('./root')
const TYPE_TO_CLASS_NAME = {
document: 'Document',
root: 'Root',
atrule: 'AtRule',
rule: 'Rule',
decl: 'Declaration',
comment: 'Comment'
}
const PLUGIN_PROPS = {
postcssPlugin: true,
prepare: true,
Once: true,
Document: true,
Root: true,
Declaration: true,
Rule: true,
AtRule: true,
Comment: true,
DeclarationExit: true,
RuleExit: true,
AtRuleExit: true,
CommentExit: true,
RootExit: true,
DocumentExit: true,
OnceExit: true
}
const NOT_VISITORS = {
postcssPlugin: true,
prepare: true,
Once: true
}
const CHILDREN = 0
function isPromise(obj) {
return typeof obj === 'object' && typeof obj.then === 'function'
}
function getEvents(node) {
let key = false
let type = TYPE_TO_CLASS_NAME[node.type]
if (node.type === 'decl') {
key = node.prop.toLowerCase()
} else if (node.type === 'atrule') {
key = node.name.toLowerCase()
}
if (key && node.append) {
return [
type,
type + '-' + key,
CHILDREN,
type + 'Exit',
type + 'Exit-' + key
]
} else if (key) {
return [type, type + '-' + key, type + 'Exit', type + 'Exit-' + key]
} else if (node.append) {
return [type, CHILDREN, type + 'Exit']
} else {
return [type, type + 'Exit']
}
}
function toStack(node) {
let events
if (node.type === 'document') {
events = ['Document', CHILDREN, 'DocumentExit']
} else if (node.type === 'root') {
events = ['Root', CHILDREN, 'RootExit']
} else {
events = getEvents(node)
}
return {
node,
events,
eventIndex: 0,
visitors: [],
visitorIndex: 0,
iterator: 0
}
}
function cleanMarks(node) {
node[isClean] = false
if (node.nodes) node.nodes.forEach(i => cleanMarks(i))
return node
}
let postcss = {}
class LazyResult {
constructor(processor, css, opts) {
this.stringified = false
this.processed = false
let root
if (
typeof css === 'object' &&
css !== null &&
(css.type === 'root' || css.type === 'document')
) {
root = cleanMarks(css)
} else if (css instanceof LazyResult || css instanceof Result) {
root = cleanMarks(css.root)
if (css.map) {
if (typeof opts.map === 'undefined') opts.map = {}
if (!opts.map.inline) opts.map.inline = false
opts.map.prev = css.map
}
} else {
let parser = parse
if (opts.syntax) parser = opts.syntax.parse
if (opts.parser) parser = opts.parser
if (parser.parse) parser = parser.parse
try {
root = parser(css, opts)
} catch (error) {
this.processed = true
this.error = error
}
if (root && !root[my]) {
/* c8 ignore next 2 */
Container.rebuild(root)
}
}
this.result = new Result(processor, root, opts)
this.helpers = { ...postcss, result: this.result, postcss }
this.plugins = this.processor.plugins.map(plugin => {
if (typeof plugin === 'object' && plugin.prepare) {
return { ...plugin, ...plugin.prepare(this.result) }
} else {
return plugin
}
})
}
get [Symbol.toStringTag]() {
return 'LazyResult'
}
get processor() {
return this.result.processor
}
get opts() {
return this.result.opts
}
get css() {
return this.stringify().css
}
get content() {
return this.stringify().content
}
get map() {
return this.stringify().map
}
get root() {
return this.sync().root
}
get messages() {
return this.sync().messages
}
warnings() {
return this.sync().warnings()
}
toString() {
return this.css
}
then(onFulfilled, onRejected) {
if (process.env.NODE_ENV !== 'production') {
if (!('from' in this.opts)) {
warnOnce(
'Without `from` option PostCSS could generate wrong source map ' +
'and will not find Browserslist config. Set it to CSS file path ' +
'or to `undefined` to prevent this warning.'
)
}
}
return this.async().then(onFulfilled, onRejected)
}
catch(onRejected) {
return this.async().catch(onRejected)
}
finally(onFinally) {
return this.async().then(onFinally, onFinally)
}
async() {
if (this.error) return Promise.reject(this.error)
if (this.processed) return Promise.resolve(this.result)
if (!this.processing) {
this.processing = this.runAsync()
}
return this.processing
}
sync() {
if (this.error) throw this.error
if (this.processed) return this.result
this.processed = true
if (this.processing) {
throw this.getAsyncError()
}
for (let plugin of this.plugins) {
let promise = this.runOnRoot(plugin)
if (isPromise(promise)) {
throw this.getAsyncError()
}
}
this.prepareVisitors()
if (this.hasListener) {
let root = this.result.root
while (!root[isClean]) {
root[isClean] = true
this.walkSync(root)
}
if (this.listeners.OnceExit) {
if (root.type === 'document') {
for (let subRoot of root.nodes) {
this.visitSync(this.listeners.OnceExit, subRoot)
}
} else {
this.visitSync(this.listeners.OnceExit, root)
}
}
}
return this.result
}
stringify() {
if (this.error) throw this.error
if (this.stringified) return this.result
this.stringified = true
this.sync()
let opts = this.result.opts
let str = stringify
if (opts.syntax) str = opts.syntax.stringify
if (opts.stringifier) str = opts.stringifier
if (str.stringify) str = str.stringify
let map = new MapGenerator(str, this.result.root, this.result.opts)
let data = map.generate()
this.result.css = data[0]
this.result.map = data[1]
return this.result
}
walkSync(node) {
node[isClean] = true
let events = getEvents(node)
for (let event of events) {
if (event === CHILDREN) {
if (node.nodes) {
node.each(child => {
if (!child[isClean]) this.walkSync(child)
})
}
} else {
let visitors = this.listeners[event]
if (visitors) {
if (this.visitSync(visitors, node.toProxy())) return
}
}
}
}
visitSync(visitors, node) {
for (let [plugin, visitor] of visitors) {
this.result.lastPlugin = plugin
let promise
try {
promise = visitor(node, this.helpers)
} catch (e) {
throw this.handleError(e, node.proxyOf)
}
if (node.type !== 'root' && node.type !== 'document' && !node.parent) {
return true
}
if (isPromise(promise)) {
throw this.getAsyncError()
}
}
}
runOnRoot(plugin) {
this.result.lastPlugin = plugin
try {
if (typeof plugin === 'object' && plugin.Once) {
if (this.result.root.type === 'document') {
let roots = this.result.root.nodes.map(root =>
plugin.Once(root, this.helpers)
)
if (isPromise(roots[0])) {
return Promise.all(roots)
}
return roots
}
return plugin.Once(this.result.root, this.helpers)
} else if (typeof plugin === 'function') {
return plugin(this.result.root, this.result)
}
} catch (error) {
throw this.handleError(error)
}
}
getAsyncError() {
throw new Error('Use process(css).then(cb) to work with async plugins')
}
handleError(error, node) {
let plugin = this.result.lastPlugin
try {
if (node) node.addToError(error)
this.error = error
if (error.name === 'CssSyntaxError' && !error.plugin) {
error.plugin = plugin.postcssPlugin
error.setMessage()
} else if (plugin.postcssVersion) {
if (process.env.NODE_ENV !== 'production') {
let pluginName = plugin.postcssPlugin
let pluginVer = plugin.postcssVersion
let runtimeVer = this.result.processor.version
let a = pluginVer.split('.')
let b = runtimeVer.split('.')
if (a[0] !== b[0] || parseInt(a[1]) > parseInt(b[1])) {
// eslint-disable-next-line no-console
console.error(
'Unknown error from PostCSS plugin. Your current PostCSS ' +
'version is ' +
runtimeVer +
', but ' +
pluginName +
' uses ' +
pluginVer +
'. Perhaps this is the source of the error below.'
)
}
}
}
} catch (err) {
/* c8 ignore next 3 */
// eslint-disable-next-line no-console
if (console && console.error) console.error(err)
}
return error
}
async runAsync() {
this.plugin = 0
for (let i = 0; i < this.plugins.length; i++) {
let plugin = this.plugins[i]
let promise = this.runOnRoot(plugin)
if (isPromise(promise)) {
try {
await promise
} catch (error) {
throw this.handleError(error)
}
}
}
this.prepareVisitors()
if (this.hasListener) {
let root = this.result.root
while (!root[isClean]) {
root[isClean] = true
let stack = [toStack(root)]
while (stack.length > 0) {
let promise = this.visitTick(stack)
if (isPromise(promise)) {
try {
await promise
} catch (e) {
let node = stack[stack.length - 1].node
throw this.handleError(e, node)
}
}
}
}
if (this.listeners.OnceExit) {
for (let [plugin, visitor] of this.listeners.OnceExit) {
this.result.lastPlugin = plugin
try {
if (root.type === 'document') {
let roots = root.nodes.map(subRoot =>
visitor(subRoot, this.helpers)
)
await Promise.all(roots)
} else {
await visitor(root, this.helpers)
}
} catch (e) {
throw this.handleError(e)
}
}
}
}
this.processed = true
return this.stringify()
}
prepareVisitors() {
this.listeners = {}
let add = (plugin, type, cb) => {
if (!this.listeners[type]) this.listeners[type] = []
this.listeners[type].push([plugin, cb])
}
for (let plugin of this.plugins) {
if (typeof plugin === 'object') {
for (let event in plugin) {
if (!PLUGIN_PROPS[event] && /^[A-Z]/.test(event)) {
throw new Error(
`Unknown event ${event} in ${plugin.postcssPlugin}. ` +
`Try to update PostCSS (${this.processor.version} now).`
)
}
if (!NOT_VISITORS[event]) {
if (typeof plugin[event] === 'object') {
for (let filter in plugin[event]) {
if (filter === '*') {
add(plugin, event, plugin[event][filter])
} else {
add(
plugin,
event + '-' + filter.toLowerCase(),
plugin[event][filter]
)
}
}
} else if (typeof plugin[event] === 'function') {
add(plugin, event, plugin[event])
}
}
}
}
}
this.hasListener = Object.keys(this.listeners).length > 0
}
visitTick(stack) {
let visit = stack[stack.length - 1]
let { node, visitors } = visit
if (node.type !== 'root' && node.type !== 'document' && !node.parent) {
stack.pop()
return
}
if (visitors.length > 0 && visit.visitorIndex < visitors.length) {
let [plugin, visitor] = visitors[visit.visitorIndex]
visit.visitorIndex += 1
if (visit.visitorIndex === visitors.length) {
visit.visitors = []
visit.visitorIndex = 0
}
this.result.lastPlugin = plugin
try {
return visitor(node.toProxy(), this.helpers)
} catch (e) {
throw this.handleError(e, node)
}
}
if (visit.iterator !== 0) {
let iterator = visit.iterator
let child
while ((child = node.nodes[node.indexes[iterator]])) {
node.indexes[iterator] += 1
if (!child[isClean]) {
child[isClean] = true
stack.push(toStack(child))
return
}
}
visit.iterator = 0
delete node.indexes[iterator]
}
let events = visit.events
while (visit.eventIndex < events.length) {
let event = events[visit.eventIndex]
visit.eventIndex += 1
if (event === CHILDREN) {
if (node.nodes && node.nodes.length) {
node[isClean] = true
visit.iterator = node.getIterator()
}
return
} else if (this.listeners[event]) {
visit.visitors = this.listeners[event]
return
}
}
stack.pop()
}
}
LazyResult.registerPostcss = dependant => {
postcss = dependant
}
module.exports = LazyResult
LazyResult.default = LazyResult
Root.registerLazyResult(LazyResult)
Document.registerLazyResult(LazyResult)

View File

@@ -0,0 +1,11 @@
"use strict";
var isFunction = require("../function/is");
var classRe = /^\s*class[\s{/}]/, functionToString = Function.prototype.toString;
module.exports = function (value) {
if (!isFunction(value)) return false;
if (classRe.test(functionToString.call(value))) return false;
return true;
};

View File

@@ -0,0 +1,77 @@
var path = require('path');
var url = require('url');
var isRemoteResource = require('../utils/is-remote-resource');
var hasProtocol = require('../utils/has-protocol');
var HTTP_PROTOCOL = 'http:';
function isAllowedResource(uri, isRemote, rules) {
var match;
var absoluteUri;
var allowed = isRemote ? false : true;
var rule;
var isNegated;
var normalizedRule;
var i;
if (rules.length === 0) {
return false;
}
if (isRemote && !hasProtocol(uri)) {
uri = HTTP_PROTOCOL + uri;
}
match = isRemote ?
url.parse(uri).host :
uri;
absoluteUri = isRemote ?
uri :
path.resolve(uri);
for (i = 0; i < rules.length; i++) {
rule = rules[i];
isNegated = rule[0] == '!';
normalizedRule = rule.substring(1);
if (isNegated && isRemote && isRemoteRule(normalizedRule)) {
allowed = allowed && !isAllowedResource(uri, true, [normalizedRule]);
} else if (isNegated && !isRemote && !isRemoteRule(normalizedRule)) {
allowed = allowed && !isAllowedResource(uri, false, [normalizedRule]);
} else if (isNegated) {
allowed = allowed && true;
} else if (rule == 'all') {
allowed = true;
} else if (isRemote && rule == 'local') {
allowed = allowed || false;
} else if (isRemote && rule == 'remote') {
allowed = true;
} else if (!isRemote && rule == 'remote') {
allowed = false;
} else if (!isRemote && rule == 'local') {
allowed = true;
} else if (rule === match) {
allowed = true;
} else if (rule === uri) {
allowed = true;
} else if (isRemote && absoluteUri.indexOf(rule) === 0) {
allowed = true;
} else if (!isRemote && absoluteUri.indexOf(path.resolve(rule)) === 0) {
allowed = true;
} else if (isRemote != isRemoteRule(normalizedRule)) {
allowed = allowed && true;
} else {
allowed = false;
}
}
return allowed;
}
function isRemoteRule(rule) {
return isRemoteResource(rule) || url.parse(HTTP_PROTOCOL + '//' + rule).host == rule;
}
module.exports = isAllowedResource;

View File

@@ -0,0 +1,97 @@
"use strict";
var d = require("../")
, getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
module.exports = function (t, a) {
var Foo = function () {}, i = 1, o, o2, desc;
Object.defineProperties(
Foo.prototype,
t({
bar: d(function () { return ++i; }),
bar2: d(function () { return this.bar + 23; }),
bar3: d(function () { return this.bar2 + 34; }, { desc: "ew" }),
bar4: d(function () { return this.bar3 + 12; }, { cacheName: "_bar4_" }),
bar5: d(function () { return this.bar4 + 3; }, { cacheName: "_bar5_", desc: "e" })
})
);
desc = getOwnPropertyDescriptor(Foo.prototype, "bar");
a(desc.configurable, true, "Configurable: default");
a(desc.enumerable, false, "Enumerable: default");
o = new Foo();
a.deep([o.bar, o.bar2, o.bar3, o.bar4, o.bar5], [2, 25, 59, 71, 74], "Values");
a.deep(
getOwnPropertyDescriptor(o, "bar3"),
{ configurable: false, enumerable: true, writable: true, value: 59 }, "Desc"
);
a(o.hasOwnProperty("bar4"), false, "Cache not exposed");
desc = getOwnPropertyDescriptor(o, "bar5");
a.deep(
desc, { configurable: false, enumerable: true, get: desc.get, set: desc.set },
"Cache & Desc: desc"
);
o2 = Object.create(o);
o2.bar = 30;
o2.bar3 = 100;
a.deep(
[o2.bar, o2.bar2, o2.bar3, o2.bar4, o2.bar5], [30, 25, 100, 112, 115], "Extension Values"
);
Foo = function () {};
Object.defineProperties(
Foo.prototype,
t({
test: d("w", function () { return "raz"; }),
test2: d("", function () { return "raz"; }, { desc: "w" }),
test3: d("", function () { return "raz"; }, { cacheName: "__test3__", desc: "w" }),
test4: d("w", "bar")
})
);
o = new Foo();
o.test = "marko";
a.deep(
getOwnPropertyDescriptor(o, "test"),
{ configurable: false, enumerable: false, writable: true, value: "marko" }, "Set before get"
);
o.test2 = "marko2";
a.deep(
getOwnPropertyDescriptor(o, "test2"),
{ configurable: false, enumerable: false, writable: true, value: "marko2" },
"Set before get: Custom desc"
);
o.test3 = "marko3";
a.deep(
getOwnPropertyDescriptor(o, "__test3__"),
{ configurable: false, enumerable: false, writable: true, value: "marko3" },
"Set before get: Custom cache name"
);
a(o.test4, "bar", "Resolve by value");
a.h1("Flat");
Object.defineProperties(
Foo.prototype,
t({
flat: d(function () { return "foo"; }, { flat: true }),
flat2: d(function () { return "bar"; }, { flat: true })
})
);
a.h2("Instance");
a(o.flat, "foo", "Value");
a(o.hasOwnProperty("flat"), false, "Instance");
a(Foo.prototype.flat, "foo", "Prototype");
a.h2("Direct");
a(Foo.prototype.flat2, "bar");
a.h2("Reset direct");
Object.defineProperties(Foo.prototype, t({ testResetDirect: d(false) }));
a.throws(function () { Foo.prototype.testResetDirect = false; }, TypeError);
};

View File

@@ -0,0 +1,23 @@
var baseAt = require('./_baseAt'),
flatRest = require('./_flatRest');
/**
* Creates an array of values corresponding to `paths` of `object`.
*
* @static
* @memberOf _
* @since 1.0.0
* @category Object
* @param {Object} object The object to iterate over.
* @param {...(string|string[])} [paths] The property paths to pick.
* @returns {Array} Returns the picked values.
* @example
*
* var object = { 'a': [{ 'b': { 'c': 3 } }, 4] };
*
* _.at(object, ['a[0].b.c', 'a[1]']);
* // => [3, 4]
*/
var at = flatRest(baseAt);
module.exports = at;

View File

@@ -0,0 +1,2 @@
declare const _default: (position?: number) => any;
export = _default;

View File

@@ -0,0 +1,45 @@
v2.0.2 -- 2017.03.15
* Update dependencies
v2.0.1 -- 2015.10.02
* Update to use es6-symbol at v3
v2.0.0 -- 2015.09.04
* Relax native implementation detection, stringification of instance should returm
expected result (not necesarily prototype)
v1.0.2 -- 2015.05.07
* Add "ponyfill" keyword to meta description. Fixes #7
v1.0.1 -- 2015.04.14
* Fix isNativeImplemented, so it's not affected by #3619 V8 bug
* Fix internal prototype resolution, in case where isNativeImplemented was true, and
native implementation was shadowed it got into stack overflow
v1.0.0 -- 2015.04.13
* It's v0.1.3 republished as v1.0.0
v0.1.4 -- 2015.04.13
* Republish v0.1.2 as v0.1.4 due to breaking changes
(v0.1.3 should have been published as next major)
v0.1.3 -- 2015.04.12
* Update up to changes in specification (require new, remove clear method)
* Improve native implementation validation
* Configure lint scripts
* Rename LICENCE to LICENSE
v0.1.2 -- 2014.09.01
* Use internal random and unique id generator instead of external (time-uuid based).
Global uniqueness is not needed in scope of this module. Fixes #1
v0.1.1 -- 2014.05.15
* Improve valid WeakMap detection
v0.1.0 -- 2014.04.29
* Assure to depend only npm hosted dependencies
* Update to use latest versions of dependencies
* Use ES6 symbols internally
v0.0.0 -- 2013.10.24
Initial (dev version)

View File

@@ -0,0 +1,77 @@
{
"name": "word-wrap",
"description": "Wrap words to a specified length.",
"version": "1.2.3",
"homepage": "https://github.com/jonschlinkert/word-wrap",
"author": "Jon Schlinkert (https://github.com/jonschlinkert)",
"contributors": [
"Danilo Sampaio <danilo.sampaio@gmail.com> (localhost:8080)",
"Fede Ramirez <i@2fd.me> (https://2fd.github.io)",
"Joe Hildebrand <joe-github@cursive.net> (https://twitter.com/hildjj)",
"Jon Schlinkert <jon.schlinkert@sellside.com> (http://twitter.com/jonschlinkert)",
"Todd Kennedy (https://tck.io)",
"Waldemar Reusch (https://github.com/lordvlad)",
"Wolfgang Faust (http://www.linestarve.com)",
"Zach Hale <zachhale@gmail.com> (http://zachhale.com)"
],
"repository": "jonschlinkert/word-wrap",
"bugs": {
"url": "https://github.com/jonschlinkert/word-wrap/issues"
},
"license": "MIT",
"files": [
"index.js",
"index.d.ts"
],
"main": "index.js",
"engines": {
"node": ">=0.10.0"
},
"scripts": {
"test": "mocha"
},
"devDependencies": {
"gulp-format-md": "^0.1.11",
"mocha": "^3.2.0"
},
"keywords": [
"break",
"carriage",
"line",
"new-line",
"newline",
"return",
"soft",
"text",
"word",
"word-wrap",
"words",
"wrap"
],
"typings": "index.d.ts",
"verb": {
"toc": false,
"layout": "default",
"tasks": [
"readme"
],
"plugins": [
"gulp-format-md"
],
"lint": {
"reflinks": true
},
"related": {
"list": [
"common-words",
"shuffle-words",
"unique-words",
"wordcount"
]
},
"reflinks": [
"verb",
"verb-generate-readme"
]
}
}

View File

@@ -0,0 +1,40 @@
import { CompleteNotification, NextNotification, ErrorNotification } from './types';
/**
* A completion object optimized for memory use and created to be the
* same "shape" as other notifications in v8.
* @internal
*/
export const COMPLETE_NOTIFICATION = (() => createNotification('C', undefined, undefined) as CompleteNotification)();
/**
* Internal use only. Creates an optimized error notification that is the same "shape"
* as other notifications.
* @internal
*/
export function errorNotification(error: any): ErrorNotification {
return createNotification('E', undefined, error) as any;
}
/**
* Internal use only. Creates an optimized next notification that is the same "shape"
* as other notifications.
* @internal
*/
export function nextNotification<T>(value: T) {
return createNotification('N', value, undefined) as NextNotification<T>;
}
/**
* Ensures that all notifications created internally have the same "shape" in v8.
*
* TODO: This is only exported to support a crazy legacy test in `groupBy`.
* @internal
*/
export function createNotification(kind: 'N' | 'E' | 'C', value: any, error: any) {
return {
kind,
value,
error,
};
}

View File

@@ -0,0 +1,36 @@
{
"author": "Olivier Poitrey <rs@rhapsodyk.net>",
"name": "netmask",
"description": "Parse and lookup IP network blocks",
"version": "2.0.2",
"homepage": "https://github.com/rs/node-netmask",
"bugs": "https://github.com/rs/node-netmask/issues",
"license": "MIT",
"repository": {
"type": "git",
"url": "git://github.com/rs/node-netmask.git"
},
"keywords": [
"net",
"mask",
"ip",
"network",
"cidr",
"netmask",
"subnet",
"ipcalc"
],
"main": "./lib/netmask",
"scripts": {
"prepublish": "coffee -c lib/*.coffee",
"test": "coffee -c lib/*.coffee && vows --spec test/* && mocha tests/*"
},
"engines": {
"node": ">= 0.4.0"
},
"devDependencies": {
"coffee-script": ">=1.2.0",
"mocha": "^8.3.2",
"vows": "*"
}
}

View File

@@ -0,0 +1,25 @@
let Declaration = require('../declaration')
const BASIC = [
'none',
'underline',
'overline',
'line-through',
'blink',
'inherit',
'initial',
'unset'
]
class TextDecoration extends Declaration {
/**
* Do not add prefixes for basic values.
*/
check(decl) {
return decl.value.split(/\s+/).some(i => !BASIC.includes(i))
}
}
TextDecoration.names = ['text-decoration']
module.exports = TextDecoration

View File

@@ -0,0 +1,17 @@
var baseIsNative = require('./_baseIsNative'),
getValue = require('./_getValue');
/**
* Gets the native function at `key` of `object`.
*
* @private
* @param {Object} object The object to query.
* @param {string} key The key of the method to get.
* @returns {*} Returns the function if it's native, else `undefined`.
*/
function getNative(object, key) {
var value = getValue(object, key);
return baseIsNative(value) ? value : undefined;
}
module.exports = getNative;

View File

@@ -0,0 +1,22 @@
import type {IsEqual} from './is-equal';
/**
Returns a boolean for whether the given array includes the given item.
This can be useful if another type wants to make a decision based on whether the array includes that item.
@example
```
import type {Includes} from 'type-fest';
type hasRed<array extends any[]> = Includes<array, 'red'>;
```
@category Array
*/
export type Includes<Value extends readonly any[], Item> =
Value extends readonly [Value[0], ...infer rest]
? IsEqual<Value[0], Item> extends true
? true
: Includes<rest, Item>
: false;

View File

@@ -0,0 +1,511 @@
/*
@license
Rollup.js v2.79.1
Thu, 22 Sep 2022 04:55:29 GMT - commit 69ff4181e701a0fe0026d0ba147f31bc86beffa8
https://github.com/rollup/rollup
Released under the MIT License.
*/
'use strict';
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
const require$$0$2 = require('fs');
const process$2 = require('process');
const index = require('./index.js');
const cli = require('../bin/rollup');
const rollup = require('./rollup.js');
const require$$0 = require('assert');
const require$$0$1 = require('events');
const loadConfigFile_js = require('./loadConfigFile.js');
const child_process = require('child_process');
require('util');
require('stream');
require('path');
require('os');
require('./mergeOptions.js');
require('perf_hooks');
require('crypto');
require('url');
require('tty');
function timeZone(date = new Date()) {
const offset = date.getTimezoneOffset();
const absOffset = Math.abs(offset);
const hours = Math.floor(absOffset / 60);
const minutes = absOffset % 60;
const minutesOut = minutes > 0 ? ':' + ('0' + minutes).slice(-2) : '';
return (offset < 0 ? '+' : '-') + hours + minutesOut;
}
function dateTime(options = {}) {
let {
date = new Date(),
local = true,
showTimeZone = false,
showMilliseconds = false
} = options;
if (local) {
// Offset the date so it will return the correct value when getting the ISO string.
date = new Date(date.getTime() - (date.getTimezoneOffset() * 60000));
}
let end = '';
if (showTimeZone) {
end = ' UTC' + (local ? timeZone(date) : '');
}
if (showMilliseconds && date.getUTCMilliseconds() > 0) {
end = ` ${date.getUTCMilliseconds()}ms${end}`;
}
return date
.toISOString()
.replace(/T/, ' ')
.replace(/\..+/, end);
}
var signalExit = {exports: {}};
var signals$1 = {exports: {}};
var hasRequiredSignals;
function requireSignals () {
if (hasRequiredSignals) return signals$1.exports;
hasRequiredSignals = 1;
(function (module) {
// This is not the set of all possible signals.
//
// It IS, however, the set of all signals that trigger
// an exit on either Linux or BSD systems. Linux is a
// superset of the signal names supported on BSD, and
// the unknown signals just fail to register, so we can
// catch that easily enough.
//
// Don't bother with SIGKILL. It's uncatchable, which
// means that we can't fire any callbacks anyway.
//
// If a user does happen to register a handler on a non-
// fatal signal like SIGWINCH or something, and then
// exit, it'll end up firing `process.emit('exit')`, so
// the handler will be fired anyway.
//
// SIGBUS, SIGFPE, SIGSEGV and SIGILL, when not raised
// artificially, inherently leave the process in a
// state from which it is not safe to try and enter JS
// listeners.
module.exports = [
'SIGABRT',
'SIGALRM',
'SIGHUP',
'SIGINT',
'SIGTERM'
];
if (process.platform !== 'win32') {
module.exports.push(
'SIGVTALRM',
'SIGXCPU',
'SIGXFSZ',
'SIGUSR2',
'SIGTRAP',
'SIGSYS',
'SIGQUIT',
'SIGIOT'
// should detect profiler and enable/disable accordingly.
// see #21
// 'SIGPROF'
);
}
if (process.platform === 'linux') {
module.exports.push(
'SIGIO',
'SIGPOLL',
'SIGPWR',
'SIGSTKFLT',
'SIGUNUSED'
);
}
} (signals$1));
return signals$1.exports;
}
// Note: since nyc uses this module to output coverage, any lines
// that are in the direct sync flow of nyc's outputCoverage are
// ignored, since we can never get coverage for them.
// grab a reference to node's real process object right away
var process$1 = rollup.commonjsGlobal.process;
const processOk = function (process) {
return process &&
typeof process === 'object' &&
typeof process.removeListener === 'function' &&
typeof process.emit === 'function' &&
typeof process.reallyExit === 'function' &&
typeof process.listeners === 'function' &&
typeof process.kill === 'function' &&
typeof process.pid === 'number' &&
typeof process.on === 'function'
};
// some kind of non-node environment, just no-op
/* istanbul ignore if */
if (!processOk(process$1)) {
signalExit.exports = function () {
return function () {}
};
} else {
var assert = require$$0;
var signals = requireSignals();
var isWin = /^win/i.test(process$1.platform);
var EE = require$$0$1;
/* istanbul ignore if */
if (typeof EE !== 'function') {
EE = EE.EventEmitter;
}
var emitter;
if (process$1.__signal_exit_emitter__) {
emitter = process$1.__signal_exit_emitter__;
} else {
emitter = process$1.__signal_exit_emitter__ = new EE();
emitter.count = 0;
emitter.emitted = {};
}
// Because this emitter is a global, we have to check to see if a
// previous version of this library failed to enable infinite listeners.
// I know what you're about to say. But literally everything about
// signal-exit is a compromise with evil. Get used to it.
if (!emitter.infinite) {
emitter.setMaxListeners(Infinity);
emitter.infinite = true;
}
signalExit.exports = function (cb, opts) {
/* istanbul ignore if */
if (!processOk(rollup.commonjsGlobal.process)) {
return function () {}
}
assert.equal(typeof cb, 'function', 'a callback must be provided for exit handler');
if (loaded === false) {
load();
}
var ev = 'exit';
if (opts && opts.alwaysLast) {
ev = 'afterexit';
}
var remove = function () {
emitter.removeListener(ev, cb);
if (emitter.listeners('exit').length === 0 &&
emitter.listeners('afterexit').length === 0) {
unload();
}
};
emitter.on(ev, cb);
return remove
};
var unload = function unload () {
if (!loaded || !processOk(rollup.commonjsGlobal.process)) {
return
}
loaded = false;
signals.forEach(function (sig) {
try {
process$1.removeListener(sig, sigListeners[sig]);
} catch (er) {}
});
process$1.emit = originalProcessEmit;
process$1.reallyExit = originalProcessReallyExit;
emitter.count -= 1;
};
signalExit.exports.unload = unload;
var emit = function emit (event, code, signal) {
/* istanbul ignore if */
if (emitter.emitted[event]) {
return
}
emitter.emitted[event] = true;
emitter.emit(event, code, signal);
};
// { <signal>: <listener fn>, ... }
var sigListeners = {};
signals.forEach(function (sig) {
sigListeners[sig] = function listener () {
/* istanbul ignore if */
if (!processOk(rollup.commonjsGlobal.process)) {
return
}
// If there are no other listeners, an exit is coming!
// Simplest way: remove us and then re-send the signal.
// We know that this will kill the process, so we can
// safely emit now.
var listeners = process$1.listeners(sig);
if (listeners.length === emitter.count) {
unload();
emit('exit', null, sig);
/* istanbul ignore next */
emit('afterexit', null, sig);
/* istanbul ignore next */
if (isWin && sig === 'SIGHUP') {
// "SIGHUP" throws an `ENOSYS` error on Windows,
// so use a supported signal instead
sig = 'SIGINT';
}
/* istanbul ignore next */
process$1.kill(process$1.pid, sig);
}
};
});
signalExit.exports.signals = function () {
return signals
};
var loaded = false;
var load = function load () {
if (loaded || !processOk(rollup.commonjsGlobal.process)) {
return
}
loaded = true;
// This is the number of onSignalExit's that are in play.
// It's important so that we can count the correct number of
// listeners on signals, and don't wait for the other one to
// handle it instead of us.
emitter.count += 1;
signals = signals.filter(function (sig) {
try {
process$1.on(sig, sigListeners[sig]);
return true
} catch (er) {
return false
}
});
process$1.emit = processEmit;
process$1.reallyExit = processReallyExit;
};
signalExit.exports.load = load;
var originalProcessReallyExit = process$1.reallyExit;
var processReallyExit = function processReallyExit (code) {
/* istanbul ignore if */
if (!processOk(rollup.commonjsGlobal.process)) {
return
}
process$1.exitCode = code || /* istanbul ignore next */ 0;
emit('exit', process$1.exitCode, null);
/* istanbul ignore next */
emit('afterexit', process$1.exitCode, null);
/* istanbul ignore next */
originalProcessReallyExit.call(process$1, process$1.exitCode);
};
var originalProcessEmit = process$1.emit;
var processEmit = function processEmit (ev, arg) {
if (ev === 'exit' && processOk(rollup.commonjsGlobal.process)) {
/* istanbul ignore else */
if (arg !== undefined) {
process$1.exitCode = arg;
}
var ret = originalProcessEmit.apply(this, arguments);
/* istanbul ignore next */
emit('exit', process$1.exitCode, null);
/* istanbul ignore next */
emit('afterexit', process$1.exitCode, null);
/* istanbul ignore next */
return ret
} else {
return originalProcessEmit.apply(this, arguments)
}
};
}
const CLEAR_SCREEN = '\u001Bc';
function getResetScreen(configs, allowClearScreen) {
let clearScreen = allowClearScreen;
for (const config of configs) {
if (config.watch && config.watch.clearScreen === false) {
clearScreen = false;
}
}
if (clearScreen) {
return (heading) => loadConfigFile_js.stderr(CLEAR_SCREEN + heading);
}
let firstRun = true;
return (heading) => {
if (firstRun) {
loadConfigFile_js.stderr(heading);
firstRun = false;
}
};
}
function extractWatchHooks(command) {
if (!Array.isArray(command.watch))
return {};
return command.watch
.filter(value => typeof value === 'object')
.reduce((acc, keyValueOption) => ({ ...acc, ...keyValueOption }), {});
}
function createWatchHooks(command) {
const watchHooks = extractWatchHooks(command);
return function (hook) {
if (watchHooks[hook]) {
const cmd = watchHooks[hook];
if (!command.silent) {
loadConfigFile_js.stderr(loadConfigFile_js.cyan(`watch.${hook} ${loadConfigFile_js.bold(`$ ${cmd}`)}`));
}
try {
// !! important - use stderr for all writes from execSync
const stdio = [process.stdin, process.stderr, process.stderr];
child_process.execSync(cmd, { stdio: command.silent ? 'ignore' : stdio });
}
catch (e) {
loadConfigFile_js.stderr(e.message);
}
}
};
}
async function watch(command) {
process$2.env.ROLLUP_WATCH = 'true';
const isTTY = process$2.stderr.isTTY;
const silent = command.silent;
let watcher;
let configWatcher;
let resetScreen;
const configFile = command.config ? await cli.getConfigPath(command.config) : null;
const runWatchHook = createWatchHooks(command);
signalExit.exports(close);
process$2.on('uncaughtException', close);
if (!process$2.stdin.isTTY) {
process$2.stdin.on('end', close);
process$2.stdin.resume();
}
async function loadConfigFromFileAndTrack(configFile) {
let configFileData = null;
let configFileRevision = 0;
configWatcher = index.chokidar.watch(configFile).on('change', reloadConfigFile);
await reloadConfigFile();
async function reloadConfigFile() {
try {
const newConfigFileData = await require$$0$2.promises.readFile(configFile, 'utf8');
if (newConfigFileData === configFileData) {
return;
}
configFileRevision++;
const currentConfigFileRevision = configFileRevision;
if (configFileData) {
loadConfigFile_js.stderr(`\nReloading updated config...`);
}
configFileData = newConfigFileData;
const { options, warnings } = await loadConfigFile_js.loadAndParseConfigFile(configFile, command);
if (currentConfigFileRevision !== configFileRevision) {
return;
}
if (watcher) {
await watcher.close();
}
start(options, warnings);
}
catch (err) {
loadConfigFile_js.handleError(err, true);
}
}
}
if (configFile) {
await loadConfigFromFileAndTrack(configFile);
}
else {
const { options, warnings } = await cli.loadConfigFromCommand(command);
start(options, warnings);
}
function start(configs, warnings) {
try {
watcher = rollup.watch(configs);
}
catch (err) {
return loadConfigFile_js.handleError(err);
}
watcher.on('event', event => {
switch (event.code) {
case 'ERROR':
warnings.flush();
loadConfigFile_js.handleError(event.error, true);
runWatchHook('onError');
break;
case 'START':
if (!silent) {
if (!resetScreen) {
resetScreen = getResetScreen(configs, isTTY);
}
resetScreen(loadConfigFile_js.underline(`rollup v${rollup.version}`));
}
runWatchHook('onStart');
break;
case 'BUNDLE_START':
if (!silent) {
let input = event.input;
if (typeof input !== 'string') {
input = Array.isArray(input)
? input.join(', ')
: Object.values(input).join(', ');
}
loadConfigFile_js.stderr(loadConfigFile_js.cyan(`bundles ${loadConfigFile_js.bold(input)} → ${loadConfigFile_js.bold(event.output.map(rollup.relativeId).join(', '))}...`));
}
runWatchHook('onBundleStart');
break;
case 'BUNDLE_END':
warnings.flush();
if (!silent)
loadConfigFile_js.stderr(loadConfigFile_js.green(`created ${loadConfigFile_js.bold(event.output.map(rollup.relativeId).join(', '))} in ${loadConfigFile_js.bold(cli.ms(event.duration))}`));
runWatchHook('onBundleEnd');
if (event.result && event.result.getTimings) {
cli.printTimings(event.result.getTimings());
}
break;
case 'END':
runWatchHook('onEnd');
if (!silent && isTTY) {
loadConfigFile_js.stderr(`\n[${dateTime()}] waiting for changes...`);
}
}
if ('result' in event && event.result) {
event.result.close().catch(error => loadConfigFile_js.handleError(error, true));
}
});
}
async function close(code) {
process$2.removeListener('uncaughtException', close);
// removing a non-existent listener is a no-op
process$2.stdin.removeListener('end', close);
if (watcher)
await watcher.close();
if (configWatcher)
configWatcher.close();
if (code) {
process$2.exit(code);
}
}
}
exports.watch = watch;
//# sourceMappingURL=watch-cli.js.map

View File

@@ -0,0 +1 @@
module.exports={C:{"15":0.00207,"34":0.00413,"43":0.00413,"47":0.00207,"48":0.00207,"52":0.03927,"56":0.00207,"60":0.00207,"65":0.00207,"72":0.0062,"77":0.00207,"78":0.0062,"88":0.00413,"89":0.00207,"91":0.00413,"95":0.00207,"99":0.0062,"100":0.00413,"101":0.00207,"102":0.02274,"103":0.00413,"104":0.00827,"105":0.00827,"106":0.00827,"107":0.01447,"108":0.03307,"109":0.70278,"110":0.44647,"111":0.01654,_:"2 3 4 5 6 7 8 9 10 11 12 13 14 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 35 36 37 38 39 40 41 42 44 45 46 49 50 51 53 54 55 57 58 59 61 62 63 64 66 67 68 69 70 71 73 74 75 76 79 80 81 82 83 84 85 86 87 90 92 93 94 96 97 98 112 3.5 3.6"},D:{"11":0.00207,"33":0.00413,"38":0.00413,"40":0.00413,"43":0.04341,"47":0.00413,"49":0.0248,"50":0.00413,"52":0.00207,"53":0.00207,"55":0.00413,"56":0.0062,"58":0.00413,"60":0.00207,"61":0.00207,"62":0.00207,"63":0.00827,"64":0.00413,"65":0.0062,"66":0.00413,"67":0.0124,"68":0.0062,"69":0.01654,"70":0.01034,"71":0.0062,"72":0.01034,"73":0.0062,"74":0.0186,"75":0.0062,"76":0.01034,"77":0.00827,"78":0.0062,"79":0.05788,"80":0.01447,"81":0.01447,"83":0.01447,"84":0.01034,"85":0.01654,"86":0.02067,"87":0.0248,"88":0.01447,"89":0.01034,"90":0.02067,"91":0.03101,"92":0.04341,"93":0.02894,"94":0.03101,"95":0.0186,"96":0.01654,"97":0.01447,"98":0.03514,"99":0.02067,"100":0.03101,"101":0.0186,"102":0.03307,"103":0.06614,"104":0.02894,"105":0.05374,"106":0.04341,"107":0.07648,"108":0.26458,"109":7.18283,"110":3.37128,"111":0.00827,"112":0.00413,_:"4 5 6 7 8 9 10 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 34 35 36 37 39 41 42 44 45 46 48 51 54 57 59 113"},F:{"28":0.00413,"36":0.00207,"64":0.00207,"72":0.00207,"73":0.0062,"79":0.0124,"81":0.00207,"82":0.00207,"83":0.00207,"84":0.00413,"85":0.00827,"86":0.00207,"89":0.00413,"90":0.0062,"91":0.00207,"92":0.0062,"93":0.02274,"94":0.24597,"95":0.24804,_:"9 11 12 15 16 17 18 19 20 21 22 23 24 25 26 27 29 30 31 32 33 34 35 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 60 62 63 65 66 67 68 69 70 71 74 75 76 77 78 80 87 88 9.5-9.6 10.5 10.6 11.1 11.5 11.6 12.1","10.0-10.1":0},B:{"12":0.01034,"13":0.0062,"14":0.00413,"15":0.00413,"16":0.00413,"17":0.00413,"18":0.0248,"84":0.00413,"85":0.00207,"89":0.0062,"90":0.00413,"92":0.0186,"95":0.00207,"100":0.00207,"101":0.00413,"102":0.00207,"103":0.00207,"104":0.00207,"105":0.0062,"106":0.0062,"107":0.02274,"108":0.04547,"109":0.77099,"110":0.93842,_:"79 80 81 83 86 87 88 91 93 94 96 97 98 99"},E:{"4":0,"13":0.00413,"14":0.0186,"15":0.00413,_:"0 5 6 7 8 9 10 11 12 3.1 3.2 6.1 7.1 9.1 10.1 16.4","5.1":0.03101,"11.1":0.00207,"12.1":0.00827,"13.1":0.02894,"14.1":0.04134,"15.1":0.00827,"15.2-15.3":0.0062,"15.4":0.01447,"15.5":0.0248,"15.6":0.12195,"16.0":0.0186,"16.1":0.04754,"16.2":0.12195,"16.3":0.08681},G:{"8":0.00083,"3.2":0,"4.0-4.1":0,"4.2-4.3":0,"5.0-5.1":0.00167,"6.0-6.1":0.0025,"7.0-7.1":0.02333,"8.1-8.4":0.00167,"9.0-9.2":0.00333,"9.3":0.04749,"10.0-10.2":0.0025,"10.3":0.05998,"11.0-11.2":0.00833,"11.3-11.4":0.01,"12.0-12.1":0.03499,"12.2-12.5":0.63066,"13.0-13.1":0.01999,"13.2":0.00833,"13.3":0.03666,"13.4-13.7":0.08581,"14.0-14.4":0.27493,"14.5-14.8":0.3599,"15.0-15.1":0.14913,"15.2-15.3":0.17162,"15.4":0.16912,"15.5":0.30658,"15.6":0.58234,"16.0":0.74897,"16.1":1.34214,"16.2":1.45794,"16.3":0.97557,"16.4":0.00417},P:{"4":0.24775,"20":0.75357,"5.0-5.4":0,"6.2-6.4":0,"7.2-7.4":0.23743,"8.2":0,"9.2":0.03097,"10.1":0,"11.1-11.2":0.07226,"12.0":0.02065,"13.0":0.08258,"14.0":0.08258,"15.0":0.04129,"16.0":0.15484,"17.0":0.14452,"18.0":0.1342,"19.0":2.07491},I:{"0":0,"3":0,"4":0,"2.1":0,"2.2":0,"2.3":0,"4.1":0.00158,"4.2-4.3":0.00709,"4.4":0,"4.4.3-4.4.4":0.04687},K:{_:"0 10 11 12 11.1 11.5 12.1"},A:{"8":0.00906,"9":0.00226,"10":0.00226,"11":0.0815,_:"6 7 5.5"},N:{"10":0,"11":0},S:{"2.5":0.0714,_:"3.0-3.1"},J:{"7":0,"10":0},O:{"0":0.46011},H:{"0":5.85064},L:{"0":64.46402},R:{_:"0"},M:{"0":0.23006},Q:{"13.1":0}};

View File

@@ -0,0 +1,27 @@
// Minimal replacement for ansi string helpers "wrap-ansi" and "strip-ansi".
// to facilitate ESM and Deno modules.
// TODO: look at porting https://www.npmjs.com/package/wrap-ansi to ESM.
// The npm application
// Copyright (c) npm, Inc. and Contributors
// Licensed on the terms of The Artistic License 2.0
// See: https://github.com/npm/cli/blob/4c65cd952bc8627811735bea76b9b110cc4fc80e/lib/utils/ansi-trim.js
const ansi = new RegExp('\x1b(?:\\[(?:\\d+[ABCDEFGJKSTm]|\\d+;\\d+[Hfm]|' +
'\\d+;\\d+;\\d+m|6n|s|u|\\?25[lh])|\\w)', 'g');
export function stripAnsi(str) {
return str.replace(ansi, '');
}
export function wrap(str, width) {
const [start, end] = str.match(ansi) || ['', ''];
str = stripAnsi(str);
let wrapped = '';
for (let i = 0; i < str.length; i++) {
if (i !== 0 && (i % width) === 0) {
wrapped += '\n';
}
wrapped += str.charAt(i);
}
if (start && end) {
wrapped = `${start}${wrapped}${end}`;
}
return wrapped;
}

View File

@@ -0,0 +1 @@
{"version":3,"file":"AsapAction.js","sourceRoot":"","sources":["../../../../src/internal/scheduler/AsapAction.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAG5C,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAGxD;IAAmC,8BAAc;IAC/C,oBAAsB,SAAwB,EAAY,IAAmD;QAA7G,YACE,kBAAM,SAAS,EAAE,IAAI,CAAC,SACvB;QAFqB,eAAS,GAAT,SAAS,CAAe;QAAY,UAAI,GAAJ,IAAI,CAA+C;;IAE7G,CAAC;IAES,mCAAc,GAAxB,UAAyB,SAAwB,EAAE,EAAgB,EAAE,KAAiB;QAAjB,sBAAA,EAAA,SAAiB;QAEpF,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,GAAG,CAAC,EAAE;YAC/B,OAAO,iBAAM,cAAc,YAAC,SAAS,EAAE,EAAE,EAAE,KAAK,CAAC,CAAC;SACnD;QAED,SAAS,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAI7B,OAAO,SAAS,CAAC,UAAU,IAAI,CAAC,SAAS,CAAC,UAAU,GAAG,iBAAiB,CAAC,YAAY,CAAC,SAAS,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC,CAAC,CAAC;IACrI,CAAC;IAES,mCAAc,GAAxB,UAAyB,SAAwB,EAAE,EAAgB,EAAE,KAAiB;;QAAjB,sBAAA,EAAA,SAAiB;QAIpF,IAAI,KAAK,IAAI,IAAI,CAAC,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,GAAG,CAAC,EAAE;YAC9C,OAAO,iBAAM,cAAc,YAAC,SAAS,EAAE,EAAE,EAAE,KAAK,CAAC,CAAC;SACnD;QAIO,IAAA,OAAO,GAAK,SAAS,QAAd,CAAe;QAC9B,IAAI,EAAE,IAAI,IAAI,IAAI,CAAA,MAAA,OAAO,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC,0CAAE,EAAE,MAAK,EAAE,EAAE;YACxD,iBAAiB,CAAC,cAAc,CAAC,EAAE,CAAC,CAAC;YACrC,SAAS,CAAC,UAAU,GAAG,SAAS,CAAC;SAClC;QAED,OAAO,SAAS,CAAC;IACnB,CAAC;IACH,iBAAC;AAAD,CAAC,AApCD,CAAmC,WAAW,GAoC7C"}

View File

@@ -0,0 +1,29 @@
import { OperatorFunction, ObservableInputTuple } from '../types';
/**
* Creates an Observable that mirrors the first source Observable to emit a next,
* error or complete notification from the combination of the Observable to which
* the operator is applied and supplied Observables.
*
* ## Example
*
* ```ts
* import { interval, map, raceWith } from 'rxjs';
*
* const obs1 = interval(7000).pipe(map(() => 'slow one'));
* const obs2 = interval(3000).pipe(map(() => 'fast one'));
* const obs3 = interval(5000).pipe(map(() => 'medium one'));
*
* obs1
* .pipe(raceWith(obs2, obs3))
* .subscribe(winner => console.log(winner));
*
* // Outputs
* // a series of 'fast one'
* ```
*
* @param otherSources Sources used to race for which Observable emits first.
* @return A function that returns an Observable that mirrors the output of the
* first Observable to emit an item.
*/
export declare function raceWith<T, A extends readonly unknown[]>(...otherSources: [...ObservableInputTuple<A>]): OperatorFunction<T, T | A[number]>;
//# sourceMappingURL=raceWith.d.ts.map

View File

@@ -0,0 +1,10 @@
"use strict";
if (!require("./is-implemented")()) {
Object.defineProperty(Math, "sign", {
value: require("./shim"),
configurable: true,
enumerable: false,
writable: true
});
}

View File

@@ -0,0 +1,796 @@
'use strict';
// See https://github.com/facebook/jest/issues/2549
// eslint-disable-next-line node/prefer-global/url
const {URL} = require('url');
const EventEmitter = require('events');
const tls = require('tls');
const http2 = require('http2');
const QuickLRU = require('quick-lru');
const delayAsyncDestroy = require('./utils/delay-async-destroy.js');
const kCurrentStreamCount = Symbol('currentStreamCount');
const kRequest = Symbol('request');
const kOriginSet = Symbol('cachedOriginSet');
const kGracefullyClosing = Symbol('gracefullyClosing');
const kLength = Symbol('length');
const nameKeys = [
// Not an Agent option actually
'createConnection',
// `http2.connect()` options
'maxDeflateDynamicTableSize',
'maxSettings',
'maxSessionMemory',
'maxHeaderListPairs',
'maxOutstandingPings',
'maxReservedRemoteStreams',
'maxSendHeaderBlockLength',
'paddingStrategy',
'peerMaxConcurrentStreams',
'settings',
// `tls.connect()` source options
'family',
'localAddress',
'rejectUnauthorized',
// `tls.connect()` secure context options
'pskCallback',
'minDHSize',
// `tls.connect()` destination options
// - `servername` is automatically validated, skip it
// - `host` and `port` just describe the destination server,
'path',
'socket',
// `tls.createSecureContext()` options
'ca',
'cert',
'sigalgs',
'ciphers',
'clientCertEngine',
'crl',
'dhparam',
'ecdhCurve',
'honorCipherOrder',
'key',
'privateKeyEngine',
'privateKeyIdentifier',
'maxVersion',
'minVersion',
'pfx',
'secureOptions',
'secureProtocol',
'sessionIdContext',
'ticketKeys'
];
const getSortedIndex = (array, value, compare) => {
let low = 0;
let high = array.length;
while (low < high) {
const mid = (low + high) >>> 1;
if (compare(array[mid], value)) {
low = mid + 1;
} else {
high = mid;
}
}
return low;
};
const compareSessions = (a, b) => a.remoteSettings.maxConcurrentStreams > b.remoteSettings.maxConcurrentStreams;
// See https://tools.ietf.org/html/rfc8336
const closeCoveredSessions = (where, session) => {
// Clients SHOULD NOT emit new requests on any connection whose Origin
// Set is a proper subset of another connection's Origin Set, and they
// SHOULD close it once all outstanding requests are satisfied.
for (let index = 0; index < where.length; index++) {
const coveredSession = where[index];
if (
// Unfortunately `.every()` returns true for an empty array
coveredSession[kOriginSet].length > 0
// The set is a proper subset when its length is less than the other set.
&& coveredSession[kOriginSet].length < session[kOriginSet].length
// And the other set includes all elements of the subset.
&& coveredSession[kOriginSet].every(origin => session[kOriginSet].includes(origin))
// Makes sure that the session can handle all requests from the covered session.
&& (coveredSession[kCurrentStreamCount] + session[kCurrentStreamCount]) <= session.remoteSettings.maxConcurrentStreams
) {
// This allows pending requests to finish and prevents making new requests.
gracefullyClose(coveredSession);
}
}
};
// This is basically inverted `closeCoveredSessions(...)`.
const closeSessionIfCovered = (where, coveredSession) => {
for (let index = 0; index < where.length; index++) {
const session = where[index];
if (
coveredSession[kOriginSet].length > 0
&& coveredSession[kOriginSet].length < session[kOriginSet].length
&& coveredSession[kOriginSet].every(origin => session[kOriginSet].includes(origin))
&& (coveredSession[kCurrentStreamCount] + session[kCurrentStreamCount]) <= session.remoteSettings.maxConcurrentStreams
) {
gracefullyClose(coveredSession);
return true;
}
}
return false;
};
const gracefullyClose = session => {
session[kGracefullyClosing] = true;
if (session[kCurrentStreamCount] === 0) {
session.close();
}
};
class Agent extends EventEmitter {
constructor({timeout = 0, maxSessions = Number.POSITIVE_INFINITY, maxEmptySessions = 10, maxCachedTlsSessions = 100} = {}) {
super();
// SESSIONS[NORMALIZED_OPTIONS] = [];
this.sessions = {};
// The queue for creating new sessions. It looks like this:
// QUEUE[NORMALIZED_OPTIONS][NORMALIZED_ORIGIN] = ENTRY_FUNCTION
//
// It's faster when there are many origins. If there's only one, then QUEUE[`${options}:${origin}`] is faster.
// I guess object creation / deletion is causing the slowdown.
//
// The entry function has `listeners`, `completed` and `destroyed` properties.
// `listeners` is an array of objects containing `resolve` and `reject` functions.
// `completed` is a boolean. It's set to true after ENTRY_FUNCTION is executed.
// `destroyed` is a boolean. If it's set to true, the session will be destroyed if hasn't connected yet.
this.queue = {};
// Each session will use this timeout value.
this.timeout = timeout;
// Max sessions in total
this.maxSessions = maxSessions;
// Max empty sessions in total
this.maxEmptySessions = maxEmptySessions;
this._emptySessionCount = 0;
this._sessionCount = 0;
// We don't support push streams by default.
this.settings = {
enablePush: false,
initialWindowSize: 1024 * 1024 * 32 // 32MB, see https://github.com/nodejs/node/issues/38426
};
// Reusing TLS sessions increases performance.
this.tlsSessionCache = new QuickLRU({maxSize: maxCachedTlsSessions});
}
get protocol() {
return 'https:';
}
normalizeOptions(options) {
let normalized = '';
for (let index = 0; index < nameKeys.length; index++) {
const key = nameKeys[index];
normalized += ':';
if (options && options[key] !== undefined) {
normalized += options[key];
}
}
return normalized;
}
_processQueue() {
if (this._sessionCount >= this.maxSessions) {
this.closeEmptySessions(this.maxSessions - this._sessionCount + 1);
return;
}
// eslint-disable-next-line guard-for-in
for (const normalizedOptions in this.queue) {
// eslint-disable-next-line guard-for-in
for (const normalizedOrigin in this.queue[normalizedOptions]) {
const item = this.queue[normalizedOptions][normalizedOrigin];
// The entry function can be run only once.
if (!item.completed) {
item.completed = true;
item();
}
}
}
}
_isBetterSession(thisStreamCount, thatStreamCount) {
return thisStreamCount > thatStreamCount;
}
_accept(session, listeners, normalizedOrigin, options) {
let index = 0;
while (index < listeners.length && session[kCurrentStreamCount] < session.remoteSettings.maxConcurrentStreams) {
// We assume `resolve(...)` calls `request(...)` *directly*,
// otherwise the session will get overloaded.
listeners[index].resolve(session);
index++;
}
listeners.splice(0, index);
if (listeners.length > 0) {
this.getSession(normalizedOrigin, options, listeners);
listeners.length = 0;
}
}
getSession(origin, options, listeners) {
return new Promise((resolve, reject) => {
if (Array.isArray(listeners) && listeners.length > 0) {
listeners = [...listeners];
// Resolve the current promise ASAP, we're just moving the listeners.
// They will be executed at a different time.
resolve();
} else {
listeners = [{resolve, reject}];
}
try {
// Parse origin
if (typeof origin === 'string') {
origin = new URL(origin);
} else if (!(origin instanceof URL)) {
throw new TypeError('The `origin` argument needs to be a string or an URL object');
}
if (options) {
// Validate servername
const {servername} = options;
const {hostname} = origin;
if (servername && hostname !== servername) {
throw new Error(`Origin ${hostname} differs from servername ${servername}`);
}
}
} catch (error) {
for (let index = 0; index < listeners.length; index++) {
listeners[index].reject(error);
}
return;
}
const normalizedOptions = this.normalizeOptions(options);
const normalizedOrigin = origin.origin;
if (normalizedOptions in this.sessions) {
const sessions = this.sessions[normalizedOptions];
let maxConcurrentStreams = -1;
let currentStreamsCount = -1;
let optimalSession;
// We could just do this.sessions[normalizedOptions].find(...) but that isn't optimal.
// Additionally, we are looking for session which has biggest current pending streams count.
//
// |------------| |------------| |------------| |------------|
// | Session: A | | Session: B | | Session: C | | Session: D |
// | Pending: 5 |-| Pending: 8 |-| Pending: 9 |-| Pending: 4 |
// | Max: 10 | | Max: 10 | | Max: 9 | | Max: 5 |
// |------------| |------------| |------------| |------------|
// ^
// |
// pick this one --
//
for (let index = 0; index < sessions.length; index++) {
const session = sessions[index];
const sessionMaxConcurrentStreams = session.remoteSettings.maxConcurrentStreams;
if (sessionMaxConcurrentStreams < maxConcurrentStreams) {
break;
}
if (!session[kOriginSet].includes(normalizedOrigin)) {
continue;
}
const sessionCurrentStreamsCount = session[kCurrentStreamCount];
if (
sessionCurrentStreamsCount >= sessionMaxConcurrentStreams
|| session[kGracefullyClosing]
// Unfortunately the `close` event isn't called immediately,
// so `session.destroyed` is `true`, but `session.closed` is `false`.
|| session.destroyed
) {
continue;
}
// We only need set this once.
if (!optimalSession) {
maxConcurrentStreams = sessionMaxConcurrentStreams;
}
// Either get the session which has biggest current stream count or the lowest.
if (this._isBetterSession(sessionCurrentStreamsCount, currentStreamsCount)) {
optimalSession = session;
currentStreamsCount = sessionCurrentStreamsCount;
}
}
if (optimalSession) {
this._accept(optimalSession, listeners, normalizedOrigin, options);
return;
}
}
if (normalizedOptions in this.queue) {
if (normalizedOrigin in this.queue[normalizedOptions]) {
// There's already an item in the queue, just attach ourselves to it.
this.queue[normalizedOptions][normalizedOrigin].listeners.push(...listeners);
return;
}
} else {
this.queue[normalizedOptions] = {
[kLength]: 0
};
}
// The entry must be removed from the queue IMMEDIATELY when:
// 1. the session connects successfully,
// 2. an error occurs.
const removeFromQueue = () => {
// Our entry can be replaced. We cannot remove the new one.
if (normalizedOptions in this.queue && this.queue[normalizedOptions][normalizedOrigin] === entry) {
delete this.queue[normalizedOptions][normalizedOrigin];
if (--this.queue[normalizedOptions][kLength] === 0) {
delete this.queue[normalizedOptions];
}
}
};
// The main logic is here
const entry = async () => {
this._sessionCount++;
const name = `${normalizedOrigin}:${normalizedOptions}`;
let receivedSettings = false;
let socket;
try {
const computedOptions = {...options};
if (computedOptions.settings === undefined) {
computedOptions.settings = this.settings;
}
if (computedOptions.session === undefined) {
computedOptions.session = this.tlsSessionCache.get(name);
}
const createConnection = computedOptions.createConnection || this.createConnection;
// A hacky workaround to enable async `createConnection`
socket = await createConnection.call(this, origin, computedOptions);
computedOptions.createConnection = () => socket;
const session = http2.connect(origin, computedOptions);
session[kCurrentStreamCount] = 0;
session[kGracefullyClosing] = false;
// Node.js return https://false:443 instead of https://1.1.1.1:443
const getOriginSet = () => {
const {socket} = session;
let originSet;
if (socket.servername === false) {
socket.servername = socket.remoteAddress;
originSet = session.originSet;
socket.servername = false;
} else {
originSet = session.originSet;
}
return originSet;
};
const isFree = () => session[kCurrentStreamCount] < session.remoteSettings.maxConcurrentStreams;
session.socket.once('session', tlsSession => {
this.tlsSessionCache.set(name, tlsSession);
});
session.once('error', error => {
// Listeners are empty when the session successfully connected.
for (let index = 0; index < listeners.length; index++) {
listeners[index].reject(error);
}
// The connection got broken, purge the cache.
this.tlsSessionCache.delete(name);
});
session.setTimeout(this.timeout, () => {
// Terminates all streams owned by this session.
session.destroy();
});
session.once('close', () => {
this._sessionCount--;
if (receivedSettings) {
// Assumes session `close` is emitted after request `close`
this._emptySessionCount--;
// This cannot be moved to the stream logic,
// because there may be a session that hadn't made a single request.
const where = this.sessions[normalizedOptions];
if (where.length === 1) {
delete this.sessions[normalizedOptions];
} else {
where.splice(where.indexOf(session), 1);
}
} else {
// Broken connection
removeFromQueue();
const error = new Error('Session closed without receiving a SETTINGS frame');
error.code = 'HTTP2WRAPPER_NOSETTINGS';
for (let index = 0; index < listeners.length; index++) {
listeners[index].reject(error);
}
}
// There may be another session awaiting.
this._processQueue();
});
// Iterates over the queue and processes listeners.
const processListeners = () => {
const queue = this.queue[normalizedOptions];
if (!queue) {
return;
}
const originSet = session[kOriginSet];
for (let index = 0; index < originSet.length; index++) {
const origin = originSet[index];
if (origin in queue) {
const {listeners, completed} = queue[origin];
let index = 0;
// Prevents session overloading.
while (index < listeners.length && isFree()) {
// We assume `resolve(...)` calls `request(...)` *directly*,
// otherwise the session will get overloaded.
listeners[index].resolve(session);
index++;
}
queue[origin].listeners.splice(0, index);
if (queue[origin].listeners.length === 0 && !completed) {
delete queue[origin];
if (--queue[kLength] === 0) {
delete this.queue[normalizedOptions];
break;
}
}
// We're no longer free, no point in continuing.
if (!isFree()) {
break;
}
}
}
};
// The Origin Set cannot shrink. No need to check if it suddenly became covered by another one.
session.on('origin', () => {
session[kOriginSet] = getOriginSet() || [];
session[kGracefullyClosing] = false;
closeSessionIfCovered(this.sessions[normalizedOptions], session);
if (session[kGracefullyClosing] || !isFree()) {
return;
}
processListeners();
if (!isFree()) {
return;
}
// Close covered sessions (if possible).
closeCoveredSessions(this.sessions[normalizedOptions], session);
});
session.once('remoteSettings', () => {
// The Agent could have been destroyed already.
if (entry.destroyed) {
const error = new Error('Agent has been destroyed');
for (let index = 0; index < listeners.length; index++) {
listeners[index].reject(error);
}
session.destroy();
return;
}
// See https://github.com/nodejs/node/issues/38426
if (session.setLocalWindowSize) {
session.setLocalWindowSize(1024 * 1024 * 4); // 4 MB
}
session[kOriginSet] = getOriginSet() || [];
if (session.socket.encrypted) {
const mainOrigin = session[kOriginSet][0];
if (mainOrigin !== normalizedOrigin) {
const error = new Error(`Requested origin ${normalizedOrigin} does not match server ${mainOrigin}`);
for (let index = 0; index < listeners.length; index++) {
listeners[index].reject(error);
}
session.destroy();
return;
}
}
removeFromQueue();
{
const where = this.sessions;
if (normalizedOptions in where) {
const sessions = where[normalizedOptions];
sessions.splice(getSortedIndex(sessions, session, compareSessions), 0, session);
} else {
where[normalizedOptions] = [session];
}
}
receivedSettings = true;
this._emptySessionCount++;
this.emit('session', session);
this._accept(session, listeners, normalizedOrigin, options);
if (session[kCurrentStreamCount] === 0 && this._emptySessionCount > this.maxEmptySessions) {
this.closeEmptySessions(this._emptySessionCount - this.maxEmptySessions);
}
// `session.remoteSettings.maxConcurrentStreams` might get increased
session.on('remoteSettings', () => {
if (!isFree()) {
return;
}
processListeners();
if (!isFree()) {
return;
}
// In case the Origin Set changes
closeCoveredSessions(this.sessions[normalizedOptions], session);
});
});
// Shim `session.request()` in order to catch all streams
session[kRequest] = session.request;
session.request = (headers, streamOptions) => {
if (session[kGracefullyClosing]) {
throw new Error('The session is gracefully closing. No new streams are allowed.');
}
const stream = session[kRequest](headers, streamOptions);
// The process won't exit until the session is closed or all requests are gone.
session.ref();
if (session[kCurrentStreamCount]++ === 0) {
this._emptySessionCount--;
}
stream.once('close', () => {
if (--session[kCurrentStreamCount] === 0) {
this._emptySessionCount++;
session.unref();
if (this._emptySessionCount > this.maxEmptySessions || session[kGracefullyClosing]) {
session.close();
return;
}
}
if (session.destroyed || session.closed) {
return;
}
if (isFree() && !closeSessionIfCovered(this.sessions[normalizedOptions], session)) {
closeCoveredSessions(this.sessions[normalizedOptions], session);
processListeners();
if (session[kCurrentStreamCount] === 0) {
this._processQueue();
}
}
});
return stream;
};
} catch (error) {
removeFromQueue();
this._sessionCount--;
for (let index = 0; index < listeners.length; index++) {
listeners[index].reject(error);
}
}
};
entry.listeners = listeners;
entry.completed = false;
entry.destroyed = false;
this.queue[normalizedOptions][normalizedOrigin] = entry;
this.queue[normalizedOptions][kLength]++;
this._processQueue();
});
}
request(origin, options, headers, streamOptions) {
return new Promise((resolve, reject) => {
this.getSession(origin, options, [{
reject,
resolve: session => {
try {
const stream = session.request(headers, streamOptions);
// Do not throw before `request(...)` has been awaited
delayAsyncDestroy(stream);
resolve(stream);
} catch (error) {
reject(error);
}
}
}]);
});
}
async createConnection(origin, options) {
return Agent.connect(origin, options);
}
static connect(origin, options) {
options.ALPNProtocols = ['h2'];
const port = origin.port || 443;
const host = origin.hostname;
if (typeof options.servername === 'undefined') {
options.servername = host;
}
const socket = tls.connect(port, host, options);
if (options.socket) {
socket._peername = {
family: undefined,
address: undefined,
port
};
}
return socket;
}
closeEmptySessions(maxCount = Number.POSITIVE_INFINITY) {
let closedCount = 0;
const {sessions} = this;
// eslint-disable-next-line guard-for-in
for (const key in sessions) {
const thisSessions = sessions[key];
for (let index = 0; index < thisSessions.length; index++) {
const session = thisSessions[index];
if (session[kCurrentStreamCount] === 0) {
closedCount++;
session.close();
if (closedCount >= maxCount) {
return closedCount;
}
}
}
}
return closedCount;
}
destroy(reason) {
const {sessions, queue} = this;
// eslint-disable-next-line guard-for-in
for (const key in sessions) {
const thisSessions = sessions[key];
for (let index = 0; index < thisSessions.length; index++) {
thisSessions[index].destroy(reason);
}
}
// eslint-disable-next-line guard-for-in
for (const normalizedOptions in queue) {
const entries = queue[normalizedOptions];
// eslint-disable-next-line guard-for-in
for (const normalizedOrigin in entries) {
entries[normalizedOrigin].destroyed = true;
}
}
// New requests should NOT attach to destroyed sessions
this.queue = {};
this.tlsSessionCache.clear();
}
get emptySessionCount() {
return this._emptySessionCount;
}
get pendingSessionCount() {
return this._sessionCount - this._emptySessionCount;
}
get sessionCount() {
return this._sessionCount;
}
}
Agent.kCurrentStreamCount = kCurrentStreamCount;
Agent.kGracefullyClosing = kGracefullyClosing;
module.exports = {
Agent,
globalAgent: new Agent()
};

View File

@@ -0,0 +1,23 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = isBefore;
var _assertString = _interopRequireDefault(require("./util/assertString"));
var _toDate = _interopRequireDefault(require("./toDate"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function isBefore(str) {
var date = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : String(new Date());
(0, _assertString.default)(str);
var comparison = (0, _toDate.default)(date);
var original = (0, _toDate.default)(str);
return !!(original && comparison && original < comparison);
}
module.exports = exports.default;
module.exports.default = exports.default;

View File

@@ -0,0 +1,10 @@
"use strict";
if (!require("./is-implemented")()) {
Object.defineProperty(Number, "MAX_SAFE_INTEGER", {
value: require("./"),
configurable: false,
enumerable: false,
writable: false
});
}

View File

@@ -0,0 +1 @@
{"name":"smart-buffer","version":"4.2.0","files":{"LICENSE":{"checkedAt":1678883672379,"integrity":"sha512-g9D+XSq0Aucg7GqK8AFwN6ZTOfRbmPrAom0Hl9OMH8VFfVe0CCxaKcrUWP3QIwgmtFEsHm54h7B3vDfCi0/kSg==","mode":420,"size":1087},"build/smartbuffer.js":{"checkedAt":1678883672394,"integrity":"sha512-lZhlgEf8tOSbdXKZY7FsyJrLNXiYN0xl5reZ1aoK6FkIU88OJ1gc6YkYl4VhjlWYA01Ghaq+0O2AjaKW6g6qlg==","mode":420,"size":44500},"build/utils.js":{"checkedAt":1678883672402,"integrity":"sha512-xs4pbNYSxYjVEiEsNcbqUwT1939qz3IZ/wth8wzTYzZtUgvfu+cT6djBsaYEGrBeOK7OsQSnjI5+6X86GZRdgw==","mode":420,"size":4273},"package.json":{"checkedAt":1678883672402,"integrity":"sha512-cYb1ogcpm9u683fOddfivYCAsUo4qSY3Dg2vTN7q27aEPdthLdLu6CI+/+Er6dkEohVp8MSBt2VFESNA45Ykfg==","mode":420,"size":1969},"build/smartbuffer.js.map":{"checkedAt":1678883672406,"integrity":"sha512-vb3ja3GSFcgi/lRG0OqfkLM1Wpm9AjaQ7nD/ZxjJdvVzOQWJ2Pi2PooZdR8xweX2EcbukMtUHZhxllPbYM3mdQ==","mode":420,"size":20978},"build/utils.js.map":{"checkedAt":1678883672406,"integrity":"sha512-zwOoS9d6VOaKlF/W1nDl4v7pAvsp4H5zJsTQHZ3rxEppEmRGjxFvKiXc9B4T+vIyOr+zYkyyWbvvNaAGCzkqag==","mode":420,"size":2024},"docs/CHANGELOG.md":{"checkedAt":1678883672406,"integrity":"sha512-qFSMtso9HIGu5nEH0Gw4P3sd4vmPzQHlIUpvVuEkzadU5fZadtx//Qg3ObNdjSFXPuj5eV8YbqbL4ffO8HdiTw==","mode":420,"size":2298},"docs/ROADMAP.md":{"checkedAt":1678883668323,"integrity":"sha512-z4PhNX7vuL3xVChQ1m2AB9Yg5AULVxXcg/SpIdNs6c5H0NE8XYXysP+DGNKHfuwvY7kxvUdBeoGlODJ6+SfaPg==","mode":420,"size":0},"docs/README_v3.md":{"checkedAt":1678883672411,"integrity":"sha512-U+4tWefmOiXeoAapRl1P2rCUgjyWkmAEJO/448861G/7zy3G1n79mfe1eaqpVO07Uu9UWpYrJhzuqBRPCFstKQ==","mode":420,"size":12570},"README.md":{"checkedAt":1678883672413,"integrity":"sha512-y/CFLt4d+BwNNd6FAKakCb086v3Wf1hdixrWxC9zbGTqZimmLWm+GoNUgve1EVixz5EjXT9ryx1CL/CPWT/GyA==","mode":420,"size":18782},"typings/smartbuffer.d.ts":{"checkedAt":1678883672419,"integrity":"sha512-EiQ1zmTy3AAQdqx8raDBZOoTOf/Rgiz66SvW04J0KlR+ta/YixqSDiQ5woupnTKxm93matGMLbE+5yRBOV75qA==","mode":420,"size":26868},"typings/utils.d.ts":{"checkedAt":1678883672419,"integrity":"sha512-7ulqjTrBcHRx8OSb+EobIVpUlULi5vAz20ftEZx0DcFVPolTFIvzmuHKm3WueyoHat4v48TdiWgHJxi2pYhoHg==","mode":420,"size":2442},".prettierrc.yaml":{"checkedAt":1678883672419,"integrity":"sha512-YLHIyIF2MXSrhe/k/thrPJDc7gJazM/RbKiVya3Vq1sLg36dMaDQmTCug+iCDtIjyDJM5kwdBhxNyuKtcNoxMQ==","mode":420,"size":84},".travis.yml":{"checkedAt":1678883672420,"integrity":"sha512-2UxnbYFB0JclwoXqrxjpBYlbBkBCIdH/dAYUiIlFfM/eIvfuvsaBpcGe6iQSrDhJRbMwJcditRrD0Ond4M/N7w==","mode":420,"size":152}}}

View File

@@ -0,0 +1,7 @@
# ECMA402 Abstract
Implementation for various ECMAScript 402 abstract operations.
[![npm Version](https://img.shields.io/npm/v/@formatjs/ecma402-abstract.svg?style=flat-square)](https://www.npmjs.org/package/@formatjs/ecma402-abstract)
**IMPORTANT: This does not follow semver so please pin the version to the exact one that you need.**

View File

@@ -0,0 +1,98 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.UserGroupService = void 0;
const request_1 = require("../core/request");
class UserGroupService {
/**
* Get all
* Lists all groups. <br> The information provided might change while the project continues to evolve.
* @result ResponseUserGroup
* @throws ApiError
*/
static async userGroupControllerGetAll() {
const result = await (0, request_1.request)({
method: 'GET',
path: `/api/usergroups`,
});
return result.body;
}
/**
* Post
* Create a new group. <br> If you want to grant permissions to the group you have to create them seperately by posting to /api/permissions after creating the group.
* @param requestBody CreateUserGroup
* @result any
* @throws ApiError
*/
static async userGroupControllerPost(requestBody) {
const result = await (0, request_1.request)({
method: 'POST',
path: `/api/usergroups`,
body: requestBody,
});
return result.body;
}
/**
* Get one
* Lists all information about the group whose id got provided. <br> The information provided might change while the project continues to evolve.
* @param id
* @result ResponseUserGroup
* @throws ApiError
*/
static async userGroupControllerGetOne(id) {
const result = await (0, request_1.request)({
method: 'GET',
path: `/api/usergroups/${id}`,
});
return result.body;
}
/**
* Put
* Update the group whose id you provided. <br> To change the permissions granted to the group please use /api/permissions instead. <br> Please remember that ids can't be changed.
* @param id
* @param requestBody UpdateUserGroup
* @result UserGroup
* @throws ApiError
*/
static async userGroupControllerPut(id, requestBody) {
const result = await (0, request_1.request)({
method: 'PUT',
path: `/api/usergroups/${id}`,
body: requestBody,
});
return result.body;
}
/**
* Remove
* Delete the group whose id you provided. <br> If there are any permissions directly granted to the group they will get deleted as well. <br> Users associated with this group won't get deleted - just deassociated. <br> If no group with this id exists it will just return 204(no content).
* @param id
* @param force
* @result ResponseUserGroup
* @result ResponseEmpty
* @throws ApiError
*/
static async userGroupControllerRemove(id, force) {
const result = await (0, request_1.request)({
method: 'DELETE',
path: `/api/usergroups/${id}`,
query: {
'force': force,
},
});
return result.body;
}
/**
* Get permissions
* Lists all permissions granted to the group as permission response objects.
* @param id
* @result ResponseUserGroupPermissions
* @throws ApiError
*/
static async userGroupControllerGetPermissions(id) {
const result = await (0, request_1.request)({
method: 'GET',
path: `/api/usergroups/${id}/permissions`,
});
return result.body;
}
}
exports.UserGroupService = UserGroupService;

View File

@@ -0,0 +1,193 @@
"use strict";
var punycode = require("punycode");
var mappingTable = require("./lib/mappingTable.json");
var PROCESSING_OPTIONS = {
TRANSITIONAL: 0,
NONTRANSITIONAL: 1
};
function normalize(str) { // fix bug in v8
return str.split('\u0000').map(function (s) { return s.normalize('NFC'); }).join('\u0000');
}
function findStatus(val) {
var start = 0;
var end = mappingTable.length - 1;
while (start <= end) {
var mid = Math.floor((start + end) / 2);
var target = mappingTable[mid];
if (target[0][0] <= val && target[0][1] >= val) {
return target;
} else if (target[0][0] > val) {
end = mid - 1;
} else {
start = mid + 1;
}
}
return null;
}
var regexAstralSymbols = /[\uD800-\uDBFF][\uDC00-\uDFFF]/g;
function countSymbols(string) {
return string
// replace every surrogate pair with a BMP symbol
.replace(regexAstralSymbols, '_')
// then get the length
.length;
}
function mapChars(domain_name, useSTD3, processing_option) {
var hasError = false;
var processed = "";
var len = countSymbols(domain_name);
for (var i = 0; i < len; ++i) {
var codePoint = domain_name.codePointAt(i);
var status = findStatus(codePoint);
switch (status[1]) {
case "disallowed":
hasError = true;
processed += String.fromCodePoint(codePoint);
break;
case "ignored":
break;
case "mapped":
processed += String.fromCodePoint.apply(String, status[2]);
break;
case "deviation":
if (processing_option === PROCESSING_OPTIONS.TRANSITIONAL) {
processed += String.fromCodePoint.apply(String, status[2]);
} else {
processed += String.fromCodePoint(codePoint);
}
break;
case "valid":
processed += String.fromCodePoint(codePoint);
break;
case "disallowed_STD3_mapped":
if (useSTD3) {
hasError = true;
processed += String.fromCodePoint(codePoint);
} else {
processed += String.fromCodePoint.apply(String, status[2]);
}
break;
case "disallowed_STD3_valid":
if (useSTD3) {
hasError = true;
}
processed += String.fromCodePoint(codePoint);
break;
}
}
return {
string: processed,
error: hasError
};
}
var combiningMarksRegex = /[\u0300-\u036F\u0483-\u0489\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u0610-\u061A\u064B-\u065F\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED\u0711\u0730-\u074A\u07A6-\u07B0\u07EB-\u07F3\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u08E4-\u0903\u093A-\u093C\u093E-\u094F\u0951-\u0957\u0962\u0963\u0981-\u0983\u09BC\u09BE-\u09C4\u09C7\u09C8\u09CB-\u09CD\u09D7\u09E2\u09E3\u0A01-\u0A03\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A70\u0A71\u0A75\u0A81-\u0A83\u0ABC\u0ABE-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AE2\u0AE3\u0B01-\u0B03\u0B3C\u0B3E-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B62\u0B63\u0B82\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD7\u0C00-\u0C03\u0C3E-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C62\u0C63\u0C81-\u0C83\u0CBC\u0CBE-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CE2\u0CE3\u0D01-\u0D03\u0D3E-\u0D44\u0D46-\u0D48\u0D4A-\u0D4D\u0D57\u0D62\u0D63\u0D82\u0D83\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DF2\u0DF3\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0EB1\u0EB4-\u0EB9\u0EBB\u0EBC\u0EC8-\u0ECD\u0F18\u0F19\u0F35\u0F37\u0F39\u0F3E\u0F3F\u0F71-\u0F84\u0F86\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102B-\u103E\u1056-\u1059\u105E-\u1060\u1062-\u1064\u1067-\u106D\u1071-\u1074\u1082-\u108D\u108F\u109A-\u109D\u135D-\u135F\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17B4-\u17D3\u17DD\u180B-\u180D\u18A9\u1920-\u192B\u1930-\u193B\u19B0-\u19C0\u19C8\u19C9\u1A17-\u1A1B\u1A55-\u1A5E\u1A60-\u1A7C\u1A7F\u1AB0-\u1ABE\u1B00-\u1B04\u1B34-\u1B44\u1B6B-\u1B73\u1B80-\u1B82\u1BA1-\u1BAD\u1BE6-\u1BF3\u1C24-\u1C37\u1CD0-\u1CD2\u1CD4-\u1CE8\u1CED\u1CF2-\u1CF4\u1CF8\u1CF9\u1DC0-\u1DF5\u1DFC-\u1DFF\u20D0-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302F\u3099\u309A\uA66F-\uA672\uA674-\uA67D\uA69F\uA6F0\uA6F1\uA802\uA806\uA80B\uA823-\uA827\uA880\uA881\uA8B4-\uA8C4\uA8E0-\uA8F1\uA926-\uA92D\uA947-\uA953\uA980-\uA983\uA9B3-\uA9C0\uA9E5\uAA29-\uAA36\uAA43\uAA4C\uAA4D\uAA7B-\uAA7D\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAEB-\uAAEF\uAAF5\uAAF6\uABE3-\uABEA\uABEC\uABED\uFB1E\uFE00-\uFE0F\uFE20-\uFE2D]|\uD800[\uDDFD\uDEE0\uDF76-\uDF7A]|\uD802[\uDE01-\uDE03\uDE05\uDE06\uDE0C-\uDE0F\uDE38-\uDE3A\uDE3F\uDEE5\uDEE6]|\uD804[\uDC00-\uDC02\uDC38-\uDC46\uDC7F-\uDC82\uDCB0-\uDCBA\uDD00-\uDD02\uDD27-\uDD34\uDD73\uDD80-\uDD82\uDDB3-\uDDC0\uDE2C-\uDE37\uDEDF-\uDEEA\uDF01-\uDF03\uDF3C\uDF3E-\uDF44\uDF47\uDF48\uDF4B-\uDF4D\uDF57\uDF62\uDF63\uDF66-\uDF6C\uDF70-\uDF74]|\uD805[\uDCB0-\uDCC3\uDDAF-\uDDB5\uDDB8-\uDDC0\uDE30-\uDE40\uDEAB-\uDEB7]|\uD81A[\uDEF0-\uDEF4\uDF30-\uDF36]|\uD81B[\uDF51-\uDF7E\uDF8F-\uDF92]|\uD82F[\uDC9D\uDC9E]|\uD834[\uDD65-\uDD69\uDD6D-\uDD72\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD\uDE42-\uDE44]|\uD83A[\uDCD0-\uDCD6]|\uDB40[\uDD00-\uDDEF]/;
function validateLabel(label, processing_option) {
if (label.substr(0, 4) === "xn--") {
label = punycode.toUnicode(label);
processing_option = PROCESSING_OPTIONS.NONTRANSITIONAL;
}
var error = false;
if (normalize(label) !== label ||
(label[3] === "-" && label[4] === "-") ||
label[0] === "-" || label[label.length - 1] === "-" ||
label.indexOf(".") !== -1 ||
label.search(combiningMarksRegex) === 0) {
error = true;
}
var len = countSymbols(label);
for (var i = 0; i < len; ++i) {
var status = findStatus(label.codePointAt(i));
if ((processing === PROCESSING_OPTIONS.TRANSITIONAL && status[1] !== "valid") ||
(processing === PROCESSING_OPTIONS.NONTRANSITIONAL &&
status[1] !== "valid" && status[1] !== "deviation")) {
error = true;
break;
}
}
return {
label: label,
error: error
};
}
function processing(domain_name, useSTD3, processing_option) {
var result = mapChars(domain_name, useSTD3, processing_option);
result.string = normalize(result.string);
var labels = result.string.split(".");
for (var i = 0; i < labels.length; ++i) {
try {
var validation = validateLabel(labels[i]);
labels[i] = validation.label;
result.error = result.error || validation.error;
} catch(e) {
result.error = true;
}
}
return {
string: labels.join("."),
error: result.error
};
}
module.exports.toASCII = function(domain_name, useSTD3, processing_option, verifyDnsLength) {
var result = processing(domain_name, useSTD3, processing_option);
var labels = result.string.split(".");
labels = labels.map(function(l) {
try {
return punycode.toASCII(l);
} catch(e) {
result.error = true;
return l;
}
});
if (verifyDnsLength) {
var total = labels.slice(0, labels.length - 1).join(".").length;
if (total.length > 253 || total.length === 0) {
result.error = true;
}
for (var i=0; i < labels.length; ++i) {
if (labels.length > 63 || labels.length === 0) {
result.error = true;
break;
}
}
}
if (result.error) return null;
return labels.join(".");
};
module.exports.toUnicode = function(domain_name, useSTD3) {
var result = processing(domain_name, useSTD3, PROCESSING_OPTIONS.NONTRANSITIONAL);
return {
domain: result.string,
error: result.error
};
};
module.exports.PROCESSING_OPTIONS = PROCESSING_OPTIONS;

View File

@@ -0,0 +1,77 @@
var cloneArrayBuffer = require('./_cloneArrayBuffer'),
cloneDataView = require('./_cloneDataView'),
cloneRegExp = require('./_cloneRegExp'),
cloneSymbol = require('./_cloneSymbol'),
cloneTypedArray = require('./_cloneTypedArray');
/** `Object#toString` result references. */
var boolTag = '[object Boolean]',
dateTag = '[object Date]',
mapTag = '[object Map]',
numberTag = '[object Number]',
regexpTag = '[object RegExp]',
setTag = '[object Set]',
stringTag = '[object String]',
symbolTag = '[object Symbol]';
var arrayBufferTag = '[object ArrayBuffer]',
dataViewTag = '[object DataView]',
float32Tag = '[object Float32Array]',
float64Tag = '[object Float64Array]',
int8Tag = '[object Int8Array]',
int16Tag = '[object Int16Array]',
int32Tag = '[object Int32Array]',
uint8Tag = '[object Uint8Array]',
uint8ClampedTag = '[object Uint8ClampedArray]',
uint16Tag = '[object Uint16Array]',
uint32Tag = '[object Uint32Array]';
/**
* Initializes an object clone based on its `toStringTag`.
*
* **Note:** This function only supports cloning values with tags of
* `Boolean`, `Date`, `Error`, `Map`, `Number`, `RegExp`, `Set`, or `String`.
*
* @private
* @param {Object} object The object to clone.
* @param {string} tag The `toStringTag` of the object to clone.
* @param {boolean} [isDeep] Specify a deep clone.
* @returns {Object} Returns the initialized clone.
*/
function initCloneByTag(object, tag, isDeep) {
var Ctor = object.constructor;
switch (tag) {
case arrayBufferTag:
return cloneArrayBuffer(object);
case boolTag:
case dateTag:
return new Ctor(+object);
case dataViewTag:
return cloneDataView(object, isDeep);
case float32Tag: case float64Tag:
case int8Tag: case int16Tag: case int32Tag:
case uint8Tag: case uint8ClampedTag: case uint16Tag: case uint32Tag:
return cloneTypedArray(object, isDeep);
case mapTag:
return new Ctor;
case numberTag:
case stringTag:
return new Ctor(object);
case regexpTag:
return cloneRegExp(object);
case setTag:
return new Ctor;
case symbolTag:
return cloneSymbol(object);
}
}
module.exports = initCloneByTag;

View File

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

View File

@@ -0,0 +1,22 @@
The MIT License (MIT)
Copyright (c) 2015 Matteo Collina
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@@ -0,0 +1 @@
{"version":3,"names":["reservedWords","keyword","strict","strictBind","keywords","Set","reservedWordsStrictSet","reservedWordsStrictBindSet","isReservedWord","word","inModule","isStrictReservedWord","has","isStrictBindOnlyReservedWord","isStrictBindReservedWord","isKeyword"],"sources":["../src/keyword.ts"],"sourcesContent":["const reservedWords = {\n keyword: [\n \"break\",\n \"case\",\n \"catch\",\n \"continue\",\n \"debugger\",\n \"default\",\n \"do\",\n \"else\",\n \"finally\",\n \"for\",\n \"function\",\n \"if\",\n \"return\",\n \"switch\",\n \"throw\",\n \"try\",\n \"var\",\n \"const\",\n \"while\",\n \"with\",\n \"new\",\n \"this\",\n \"super\",\n \"class\",\n \"extends\",\n \"export\",\n \"import\",\n \"null\",\n \"true\",\n \"false\",\n \"in\",\n \"instanceof\",\n \"typeof\",\n \"void\",\n \"delete\",\n ],\n strict: [\n \"implements\",\n \"interface\",\n \"let\",\n \"package\",\n \"private\",\n \"protected\",\n \"public\",\n \"static\",\n \"yield\",\n ],\n strictBind: [\"eval\", \"arguments\"],\n};\nconst keywords = new Set(reservedWords.keyword);\nconst reservedWordsStrictSet = new Set(reservedWords.strict);\nconst reservedWordsStrictBindSet = new Set(reservedWords.strictBind);\n\n/**\n * Checks if word is a reserved word in non-strict mode\n */\nexport function isReservedWord(word: string, inModule: boolean): boolean {\n return (inModule && word === \"await\") || word === \"enum\";\n}\n\n/**\n * Checks if word is a reserved word in non-binding strict mode\n *\n * Includes non-strict reserved words\n */\nexport function isStrictReservedWord(word: string, inModule: boolean): boolean {\n return isReservedWord(word, inModule) || reservedWordsStrictSet.has(word);\n}\n\n/**\n * Checks if word is a reserved word in binding strict mode, but it is allowed as\n * a normal identifier.\n */\nexport function isStrictBindOnlyReservedWord(word: string): boolean {\n return reservedWordsStrictBindSet.has(word);\n}\n\n/**\n * Checks if word is a reserved word in binding strict mode\n *\n * Includes non-strict reserved words and non-binding strict reserved words\n */\nexport function isStrictBindReservedWord(\n word: string,\n inModule: boolean,\n): boolean {\n return (\n isStrictReservedWord(word, inModule) || isStrictBindOnlyReservedWord(word)\n );\n}\n\nexport function isKeyword(word: string): boolean {\n return keywords.has(word);\n}\n"],"mappings":";;;;;;;;;;AAAA,MAAMA,aAAa,GAAG;EACpBC,OAAO,EAAE,CACP,OADO,EAEP,MAFO,EAGP,OAHO,EAIP,UAJO,EAKP,UALO,EAMP,SANO,EAOP,IAPO,EAQP,MARO,EASP,SATO,EAUP,KAVO,EAWP,UAXO,EAYP,IAZO,EAaP,QAbO,EAcP,QAdO,EAeP,OAfO,EAgBP,KAhBO,EAiBP,KAjBO,EAkBP,OAlBO,EAmBP,OAnBO,EAoBP,MApBO,EAqBP,KArBO,EAsBP,MAtBO,EAuBP,OAvBO,EAwBP,OAxBO,EAyBP,SAzBO,EA0BP,QA1BO,EA2BP,QA3BO,EA4BP,MA5BO,EA6BP,MA7BO,EA8BP,OA9BO,EA+BP,IA/BO,EAgCP,YAhCO,EAiCP,QAjCO,EAkCP,MAlCO,EAmCP,QAnCO,CADW;EAsCpBC,MAAM,EAAE,CACN,YADM,EAEN,WAFM,EAGN,KAHM,EAIN,SAJM,EAKN,SALM,EAMN,WANM,EAON,QAPM,EAQN,QARM,EASN,OATM,CAtCY;EAiDpBC,UAAU,EAAE,CAAC,MAAD,EAAS,WAAT;AAjDQ,CAAtB;AAmDA,MAAMC,QAAQ,GAAG,IAAIC,GAAJ,CAAQL,aAAa,CAACC,OAAtB,CAAjB;AACA,MAAMK,sBAAsB,GAAG,IAAID,GAAJ,CAAQL,aAAa,CAACE,MAAtB,CAA/B;AACA,MAAMK,0BAA0B,GAAG,IAAIF,GAAJ,CAAQL,aAAa,CAACG,UAAtB,CAAnC;;AAKO,SAASK,cAAT,CAAwBC,IAAxB,EAAsCC,QAAtC,EAAkE;EACvE,OAAQA,QAAQ,IAAID,IAAI,KAAK,OAAtB,IAAkCA,IAAI,KAAK,MAAlD;AACD;;AAOM,SAASE,oBAAT,CAA8BF,IAA9B,EAA4CC,QAA5C,EAAwE;EAC7E,OAAOF,cAAc,CAACC,IAAD,EAAOC,QAAP,CAAd,IAAkCJ,sBAAsB,CAACM,GAAvB,CAA2BH,IAA3B,CAAzC;AACD;;AAMM,SAASI,4BAAT,CAAsCJ,IAAtC,EAA6D;EAClE,OAAOF,0BAA0B,CAACK,GAA3B,CAA+BH,IAA/B,CAAP;AACD;;AAOM,SAASK,wBAAT,CACLL,IADK,EAELC,QAFK,EAGI;EACT,OACEC,oBAAoB,CAACF,IAAD,EAAOC,QAAP,CAApB,IAAwCG,4BAA4B,CAACJ,IAAD,CADtE;AAGD;;AAEM,SAASM,SAAT,CAAmBN,IAAnB,EAA0C;EAC/C,OAAOL,QAAQ,CAACQ,GAAT,CAAaH,IAAb,CAAP;AACD"}

View File

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

View File

@@ -0,0 +1,60 @@
import assertString from './util/assertString';
var isin = /^[A-Z]{2}[0-9A-Z]{9}[0-9]$/; // this link details how the check digit is calculated:
// https://www.isin.org/isin-format/. it is a little bit
// odd in that it works with digits, not numbers. in order
// to make only one pass through the ISIN characters, the
// each alpha character is handled as 2 characters within
// the loop.
export default function isISIN(str) {
assertString(str);
if (!isin.test(str)) {
return false;
}
var _double = true;
var sum = 0; // convert values
for (var i = str.length - 2; i >= 0; i--) {
if (str[i] >= 'A' && str[i] <= 'Z') {
var value = str[i].charCodeAt(0) - 55;
var lo = value % 10;
var hi = Math.trunc(value / 10); // letters have two digits, so handle the low order
// and high order digits separately.
for (var _i = 0, _arr = [lo, hi]; _i < _arr.length; _i++) {
var digit = _arr[_i];
if (_double) {
if (digit >= 5) {
sum += 1 + (digit - 5) * 2;
} else {
sum += digit * 2;
}
} else {
sum += digit;
}
_double = !_double;
}
} else {
var _digit = str[i].charCodeAt(0) - '0'.charCodeAt(0);
if (_double) {
if (_digit >= 5) {
sum += 1 + (_digit - 5) * 2;
} else {
sum += _digit * 2;
}
} else {
sum += _digit;
}
_double = !_double;
}
}
var check = Math.trunc((sum + 9) / 10) * 10 - sum;
return +str[str.length - 1] === check;
}

View File

@@ -0,0 +1 @@
{"version":3,"file":"windowTime.js","sourceRoot":"","sources":["../../../../src/internal/operators/windowTime.ts"],"names":[],"mappings":";;;AAAA,sCAAqC;AACrC,4CAAoD;AAEpD,gDAA+C;AAE/C,qCAAuC;AACvC,2DAAgE;AAChE,+CAA8C;AAC9C,qCAA4C;AAC5C,2DAA0D;AAgG1D,SAAgB,UAAU,CAAI,cAAsB;;IAAE,mBAAmB;SAAnB,UAAmB,EAAnB,qBAAmB,EAAnB,IAAmB;QAAnB,kCAAmB;;IACvE,IAAM,SAAS,GAAG,MAAA,mBAAY,CAAC,SAAS,CAAC,mCAAI,sBAAc,CAAC;IAC5D,IAAM,sBAAsB,GAAG,MAAC,SAAS,CAAC,CAAC,CAAY,mCAAI,IAAI,CAAC;IAChE,IAAM,aAAa,GAAI,SAAS,CAAC,CAAC,CAAY,IAAI,QAAQ,CAAC;IAE3D,OAAO,cAAO,CAAC,UAAC,MAAM,EAAE,UAAU;QAEhC,IAAI,aAAa,GAA6B,EAAE,CAAC;QAGjD,IAAI,cAAc,GAAG,KAAK,CAAC;QAE3B,IAAM,WAAW,GAAG,UAAC,MAAkD;YAC7D,IAAA,MAAM,GAAW,MAAM,OAAjB,EAAE,IAAI,GAAK,MAAM,KAAX,CAAY;YAChC,MAAM,CAAC,QAAQ,EAAE,CAAC;YAClB,IAAI,CAAC,WAAW,EAAE,CAAC;YACnB,qBAAS,CAAC,aAAa,EAAE,MAAM,CAAC,CAAC;YACjC,cAAc,IAAI,WAAW,EAAE,CAAC;QAClC,CAAC,CAAC;QAMF,IAAM,WAAW,GAAG;YAClB,IAAI,aAAa,EAAE;gBACjB,IAAM,IAAI,GAAG,IAAI,2BAAY,EAAE,CAAC;gBAChC,UAAU,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;gBACrB,IAAM,QAAM,GAAG,IAAI,iBAAO,EAAK,CAAC;gBAChC,IAAM,QAAM,GAAG;oBACb,MAAM,UAAA;oBACN,IAAI,MAAA;oBACJ,IAAI,EAAE,CAAC;iBACR,CAAC;gBACF,aAAa,CAAC,IAAI,CAAC,QAAM,CAAC,CAAC;gBAC3B,UAAU,CAAC,IAAI,CAAC,QAAM,CAAC,YAAY,EAAE,CAAC,CAAC;gBACvC,iCAAe,CAAC,IAAI,EAAE,SAAS,EAAE,cAAM,OAAA,WAAW,CAAC,QAAM,CAAC,EAAnB,CAAmB,EAAE,cAAc,CAAC,CAAC;aAC7E;QACH,CAAC,CAAC;QAEF,IAAI,sBAAsB,KAAK,IAAI,IAAI,sBAAsB,IAAI,CAAC,EAAE;YAIlE,iCAAe,CAAC,UAAU,EAAE,SAAS,EAAE,WAAW,EAAE,sBAAsB,EAAE,IAAI,CAAC,CAAC;SACnF;aAAM;YACL,cAAc,GAAG,IAAI,CAAC;SACvB;QAED,WAAW,EAAE,CAAC;QAQd,IAAM,IAAI,GAAG,UAAC,EAAqC,IAAK,OAAA,aAAc,CAAC,KAAK,EAAE,CAAC,OAAO,CAAC,EAAE,CAAC,EAAlC,CAAkC,CAAC;QAM3F,IAAM,SAAS,GAAG,UAAC,EAAqC;YACtD,IAAI,CAAC,UAAC,EAAU;oBAAR,MAAM,YAAA;gBAAO,OAAA,EAAE,CAAC,MAAM,CAAC;YAAV,CAAU,CAAC,CAAC;YACjC,EAAE,CAAC,UAAU,CAAC,CAAC;YACf,UAAU,CAAC,WAAW,EAAE,CAAC;QAC3B,CAAC,CAAC;QAEF,MAAM,CAAC,SAAS,CACd,6CAAwB,CACtB,UAAU,EACV,UAAC,KAAQ;YAEP,IAAI,CAAC,UAAC,MAAM;gBACV,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;gBAE1B,aAAa,IAAI,EAAE,MAAM,CAAC,IAAI,IAAI,WAAW,CAAC,MAAM,CAAC,CAAC;YACxD,CAAC,CAAC,CAAC;QACL,CAAC,EAED,cAAM,OAAA,SAAS,CAAC,UAAC,QAAQ,IAAK,OAAA,QAAQ,CAAC,QAAQ,EAAE,EAAnB,CAAmB,CAAC,EAA5C,CAA4C,EAElD,UAAC,GAAG,IAAK,OAAA,SAAS,CAAC,UAAC,QAAQ,IAAK,OAAA,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,EAAnB,CAAmB,CAAC,EAA5C,CAA4C,CACtD,CACF,CAAC;QAKF,OAAO;YAEL,aAAa,GAAG,IAAK,CAAC;QACxB,CAAC,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC;AA/FD,gCA+FC"}

View File

@@ -0,0 +1,397 @@
import { Subject, AnonymousSubject } from '../../Subject';
import { Subscriber } from '../../Subscriber';
import { Observable } from '../../Observable';
import { Subscription } from '../../Subscription';
import { Operator } from '../../Operator';
import { ReplaySubject } from '../../ReplaySubject';
import { Observer, NextObserver } from '../../types';
/**
* WebSocketSubjectConfig is a plain Object that allows us to make our
* webSocket configurable.
*
* <span class="informal">Provides flexibility to {@link webSocket}</span>
*
* It defines a set of properties to provide custom behavior in specific
* moments of the socket's lifecycle. When the connection opens we can
* use `openObserver`, when the connection is closed `closeObserver`, if we
* are interested in listening for data coming from server: `deserializer`,
* which allows us to customize the deserialization strategy of data before passing it
* to the socket client. By default, `deserializer` is going to apply `JSON.parse` to each message coming
* from the Server.
*
* ## Examples
*
* **deserializer**, the default for this property is `JSON.parse` but since there are just two options
* for incoming data, either be text or binary data. We can apply a custom deserialization strategy
* or just simply skip the default behaviour.
*
* ```ts
* import { webSocket } from 'rxjs/webSocket';
*
* const wsSubject = webSocket({
* url: 'ws://localhost:8081',
* //Apply any transformation of your choice.
* deserializer: ({ data }) => data
* });
*
* wsSubject.subscribe(console.log);
*
* // Let's suppose we have this on the Server: ws.send('This is a msg from the server')
* //output
* //
* // This is a msg from the server
* ```
*
* **serializer** allows us to apply custom serialization strategy but for the outgoing messages.
*
* ```ts
* import { webSocket } from 'rxjs/webSocket';
*
* const wsSubject = webSocket({
* url: 'ws://localhost:8081',
* // Apply any transformation of your choice.
* serializer: msg => JSON.stringify({ channel: 'webDevelopment', msg: msg })
* });
*
* wsSubject.subscribe(() => subject.next('msg to the server'));
*
* // Let's suppose we have this on the Server:
* // ws.on('message', msg => console.log);
* // ws.send('This is a msg from the server');
* // output at server side:
* //
* // {"channel":"webDevelopment","msg":"msg to the server"}
* ```
*
* **closeObserver** allows us to set a custom error when an error raises up.
*
* ```ts
* import { webSocket } from 'rxjs/webSocket';
*
* const wsSubject = webSocket({
* url: 'ws://localhost:8081',
* closeObserver: {
* next() {
* const customError = { code: 6666, reason: 'Custom evil reason' }
* console.log(`code: ${ customError.code }, reason: ${ customError.reason }`);
* }
* }
* });
*
* // output
* // code: 6666, reason: Custom evil reason
* ```
*
* **openObserver**, Let's say we need to make some kind of init task before sending/receiving msgs to the
* webSocket or sending notification that the connection was successful, this is when
* openObserver is useful for.
*
* ```ts
* import { webSocket } from 'rxjs/webSocket';
*
* const wsSubject = webSocket({
* url: 'ws://localhost:8081',
* openObserver: {
* next: () => {
* console.log('Connection ok');
* }
* }
* });
*
* // output
* // Connection ok
* ```
*/
export interface WebSocketSubjectConfig<T> {
/** The url of the socket server to connect to */
url: string;
/** The protocol to use to connect */
protocol?: string | Array<string>;
/** @deprecated Will be removed in v8. Use {@link deserializer} instead. */
resultSelector?: (e: MessageEvent) => T;
/**
* A serializer used to create messages from passed values before the
* messages are sent to the server. Defaults to JSON.stringify.
*/
serializer?: (value: T) => WebSocketMessage;
/**
* A deserializer used for messages arriving on the socket from the
* server. Defaults to JSON.parse.
*/
deserializer?: (e: MessageEvent) => T;
/**
* An Observer that watches when open events occur on the underlying web socket.
*/
openObserver?: NextObserver<Event>;
/**
* An Observer that watches when close events occur on the underlying web socket
*/
closeObserver?: NextObserver<CloseEvent>;
/**
* An Observer that watches when a close is about to occur due to
* unsubscription.
*/
closingObserver?: NextObserver<void>;
/**
* A WebSocket constructor to use. This is useful for situations like using a
* WebSocket impl in Node (WebSocket is a DOM API), or for mocking a WebSocket
* for testing purposes
*/
WebSocketCtor?: { new (url: string, protocols?: string | string[]): WebSocket };
/** Sets the `binaryType` property of the underlying WebSocket. */
binaryType?: 'blob' | 'arraybuffer';
}
const DEFAULT_WEBSOCKET_CONFIG: WebSocketSubjectConfig<any> = {
url: '',
deserializer: (e: MessageEvent) => JSON.parse(e.data),
serializer: (value: any) => JSON.stringify(value),
};
const WEBSOCKETSUBJECT_INVALID_ERROR_OBJECT =
'WebSocketSubject.error must be called with an object with an error code, and an optional reason: { code: number, reason: string }';
export type WebSocketMessage = string | ArrayBuffer | Blob | ArrayBufferView;
export class WebSocketSubject<T> extends AnonymousSubject<T> {
// @ts-ignore: Property has no initializer and is not definitely assigned
private _config: WebSocketSubjectConfig<T>;
/** @internal */
// @ts-ignore: Property has no initializer and is not definitely assigned
_output: Subject<T>;
private _socket: WebSocket | null = null;
constructor(urlConfigOrSource: string | WebSocketSubjectConfig<T> | Observable<T>, destination?: Observer<T>) {
super();
if (urlConfigOrSource instanceof Observable) {
this.destination = destination;
this.source = urlConfigOrSource as Observable<T>;
} else {
const config = (this._config = { ...DEFAULT_WEBSOCKET_CONFIG });
this._output = new Subject<T>();
if (typeof urlConfigOrSource === 'string') {
config.url = urlConfigOrSource;
} else {
for (const key in urlConfigOrSource) {
if (urlConfigOrSource.hasOwnProperty(key)) {
(config as any)[key] = (urlConfigOrSource as any)[key];
}
}
}
if (!config.WebSocketCtor && WebSocket) {
config.WebSocketCtor = WebSocket;
} else if (!config.WebSocketCtor) {
throw new Error('no WebSocket constructor can be found');
}
this.destination = new ReplaySubject();
}
}
/** @deprecated Internal implementation detail, do not use directly. Will be made internal in v8. */
lift<R>(operator: Operator<T, R>): WebSocketSubject<R> {
const sock = new WebSocketSubject<R>(this._config as WebSocketSubjectConfig<any>, this.destination as any);
sock.operator = operator;
sock.source = this;
return sock;
}
private _resetState() {
this._socket = null;
if (!this.source) {
this.destination = new ReplaySubject();
}
this._output = new Subject<T>();
}
/**
* Creates an {@link Observable}, that when subscribed to, sends a message,
* defined by the `subMsg` function, to the server over the socket to begin a
* subscription to data over that socket. Once data arrives, the
* `messageFilter` argument will be used to select the appropriate data for
* the resulting Observable. When finalization occurs, either due to
* unsubscription, completion, or error, a message defined by the `unsubMsg`
* argument will be sent to the server over the WebSocketSubject.
*
* @param subMsg A function to generate the subscription message to be sent to
* the server. This will still be processed by the serializer in the
* WebSocketSubject's config. (Which defaults to JSON serialization)
* @param unsubMsg A function to generate the unsubscription message to be
* sent to the server at finalization. This will still be processed by the
* serializer in the WebSocketSubject's config.
* @param messageFilter A predicate for selecting the appropriate messages
* from the server for the output stream.
*/
multiplex(subMsg: () => any, unsubMsg: () => any, messageFilter: (value: T) => boolean) {
const self = this;
return new Observable((observer: Observer<T>) => {
try {
self.next(subMsg());
} catch (err) {
observer.error(err);
}
const subscription = self.subscribe({
next: (x) => {
try {
if (messageFilter(x)) {
observer.next(x);
}
} catch (err) {
observer.error(err);
}
},
error: (err) => observer.error(err),
complete: () => observer.complete(),
});
return () => {
try {
self.next(unsubMsg());
} catch (err) {
observer.error(err);
}
subscription.unsubscribe();
};
});
}
private _connectSocket() {
const { WebSocketCtor, protocol, url, binaryType } = this._config;
const observer = this._output;
let socket: WebSocket | null = null;
try {
socket = protocol ? new WebSocketCtor!(url, protocol) : new WebSocketCtor!(url);
this._socket = socket;
if (binaryType) {
this._socket.binaryType = binaryType;
}
} catch (e) {
observer.error(e);
return;
}
const subscription = new Subscription(() => {
this._socket = null;
if (socket && socket.readyState === 1) {
socket.close();
}
});
socket.onopen = (evt: Event) => {
const { _socket } = this;
if (!_socket) {
socket!.close();
this._resetState();
return;
}
const { openObserver } = this._config;
if (openObserver) {
openObserver.next(evt);
}
const queue = this.destination;
this.destination = Subscriber.create<T>(
(x) => {
if (socket!.readyState === 1) {
try {
const { serializer } = this._config;
socket!.send(serializer!(x!));
} catch (e) {
this.destination!.error(e);
}
}
},
(err) => {
const { closingObserver } = this._config;
if (closingObserver) {
closingObserver.next(undefined);
}
if (err && err.code) {
socket!.close(err.code, err.reason);
} else {
observer.error(new TypeError(WEBSOCKETSUBJECT_INVALID_ERROR_OBJECT));
}
this._resetState();
},
() => {
const { closingObserver } = this._config;
if (closingObserver) {
closingObserver.next(undefined);
}
socket!.close();
this._resetState();
}
) as Subscriber<any>;
if (queue && queue instanceof ReplaySubject) {
subscription.add((queue as ReplaySubject<T>).subscribe(this.destination));
}
};
socket.onerror = (e: Event) => {
this._resetState();
observer.error(e);
};
socket.onclose = (e: CloseEvent) => {
if (socket === this._socket) {
this._resetState();
}
const { closeObserver } = this._config;
if (closeObserver) {
closeObserver.next(e);
}
if (e.wasClean) {
observer.complete();
} else {
observer.error(e);
}
};
socket.onmessage = (e: MessageEvent) => {
try {
const { deserializer } = this._config;
observer.next(deserializer!(e));
} catch (err) {
observer.error(err);
}
};
}
/** @internal */
protected _subscribe(subscriber: Subscriber<T>): Subscription {
const { source } = this;
if (source) {
return source.subscribe(subscriber);
}
if (!this._socket) {
this._connectSocket();
}
this._output.subscribe(subscriber);
subscriber.add(() => {
const { _socket } = this;
if (this._output.observers.length === 0) {
if (_socket && (_socket.readyState === 1 || _socket.readyState === 0)) {
_socket.close();
}
this._resetState();
}
});
return subscriber;
}
unsubscribe() {
const { _socket } = this;
if (_socket && (_socket.readyState === 1 || _socket.readyState === 0)) {
_socket.close();
}
this._resetState();
super.unsubscribe();
}
}

View File

@@ -0,0 +1,13 @@
import { Fork } from "../types";
export default function (fork: Fork): {
geq: (than: any) => import("./types").Type<unknown>;
defaults: {
null: () => null;
emptyArray: () => never[];
false: () => boolean;
true: () => boolean;
undefined: () => void;
"use strict": () => string;
};
isPrimitive: import("./types").Type<unknown>;
};

View File

@@ -0,0 +1,11 @@
// Standard YAML's Core schema.
// http://www.yaml.org/spec/1.2/spec.html#id2804923
//
// NOTE: JS-YAML does not support schema-specific tag resolution restrictions.
// So, Core schema has no distinctions from JSON schema is JS-YAML.
'use strict';
module.exports = require('./json');

View File

@@ -0,0 +1,3 @@
"use strict";
module.exports = function (value) { return value; };

View File

@@ -0,0 +1,28 @@
For recent changelog see CHANGELOG.md
-----
v1.0.0 -- 2016.06.09
* In case MutationObserver based solution ensure all callbacks are propagated
even if any on the way crashes (fixes #3)
* Support older engines (as IE8) which see typeof setTimeout as 'object'
* Fix spelling of LICENSE
* Configure lint scripts
v0.2.2 -- 2014.04.18
- Do not rely on es5-ext's valid-callable. Replace it with simple internal function
- In MutationObserver fallback rely on text node instead of attribute and assure
mutation event is invoked by real change of data
v0.2.1 -- 2014.02.24
- Fix case in import path
v0.2.0 -- 2014.02.24
- Assure microtask resultion if MutationObserver is available (thanks @Raynos) #1
- Unify validation of callback. TypeError is throw for any non callable input
- Move main module from `lib` to root directory
- Improve documentation
- Remove Makefile (it's environment agnostic pacakge)
v0.1.0 -- 2012.08.29
Initial

View File

@@ -0,0 +1 @@
{"version":3,"file":"isArrayLike.js","sourceRoot":"","sources":["../../../../src/internal/util/isArrayLike.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,IAAM,WAAW,GAAG,CAAC,UAAI,CAAM,IAAwB,OAAA,CAAC,IAAI,OAAO,CAAC,CAAC,MAAM,KAAK,QAAQ,IAAI,OAAO,CAAC,KAAK,UAAU,EAA5D,CAA4D,CAAC,CAAC"}

View File

@@ -0,0 +1 @@
{"version":3,"file":"isReadableStreamLike.js","sourceRoot":"","sources":["../../../../src/internal/util/isReadableStreamLike.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1C,MAAM,UAAiB,kCAAkC,CAAI,cAAqC;;QAChG,MAAM,MAAM,GAAG,cAAc,CAAC,SAAS,EAAE,CAAC;QAC1C,IAAI;YACF,OAAO,IAAI,EAAE;gBACX,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,cAAM,MAAM,CAAC,IAAI,EAAE,CAAA,CAAC;gBAC5C,IAAI,IAAI,EAAE;oBACR,6BAAO;iBACR;gBACD,oBAAM,KAAM,CAAA,CAAC;aACd;SACF;gBAAS;YACR,MAAM,CAAC,WAAW,EAAE,CAAC;SACtB;IACH,CAAC;CAAA;AAED,MAAM,UAAU,oBAAoB,CAAI,GAAQ;IAG9C,OAAO,UAAU,CAAC,GAAG,aAAH,GAAG,uBAAH,GAAG,CAAE,SAAS,CAAC,CAAC;AACpC,CAAC"}

View File

@@ -0,0 +1,118 @@
# Lilconfig ⚙️
[![npm version](https://badge.fury.io/js/lilconfig.svg)](https://badge.fury.io/js/lilconfig)
[![install size](https://packagephobia.now.sh/badge?p=lilconfig)](https://packagephobia.now.sh/result?p=lilconfig)
[![Coverage Status](https://coveralls.io/repos/github/antonk52/lilconfig/badge.svg)](https://coveralls.io/github/antonk52/lilconfig)
A zero-dependency alternative to [cosmiconfig](https://www.npmjs.com/package/cosmiconfig) with the same API.
## Installation
```sh
npm install lilconfig
```
## Usage
```js
import {lilconfig, lilconfigSync} from 'lilconfig';
// all keys are optional
const options = {
stopDir: '/Users/you/some/dir',
searchPlaces: ['package.json', 'myapp.conf.js'],
ignoreEmptySearchPlaces: false
}
lilconfig(
'myapp',
options // optional
).search() // Promise<LilconfigResult>
lilconfigSync(
'myapp',
options // optional
).load(pathToConfig) // LilconfigResult
/**
* LilconfigResult
* {
* config: any; // your config
* filepath: string;
* }
*/
```
## Difference to `cosmiconfig`
Lilconfig does not intend to be 100% compatible with `cosmiconfig` but tries to mimic it where possible. The key differences are:
- **no** support for yaml files out of the box(`lilconfig` attempts to parse files with no extension as JSON instead of YAML). You can still add the support for YAML files by providing a loader, see an [example](#loaders-example) below.
- **no** cache
### Options difference between the two.
|cosmiconfig option | lilconfig |
|------------------------|-----------|
|cache | ❌ |
|loaders | ✅ |
|ignoreEmptySearchPlaces | ✅ |
|packageProp | ✅ |
|searchPlaces | ✅ |
|stopDir | ✅ |
|transform | ✅ |
## Loaders examples
### Yaml loader
If you need the YAML support you can provide your own loader
```js
import {lilconfig} from 'lilconfig';
import yaml from 'yaml';
function loadYaml(filepath, content) {
return yaml.parse(content);
}
const options = {
loaders: {
'.yaml': loadYaml,
'.yml': loadYaml,
// loader for files with no extension
noExt: loadYaml
}
};
lilconfig('myapp', options)
.search()
.then(result => {
result // {config, filepath}
});
```
### ESM loader
Lilconfig v2 does not support ESM modules out of the box. However, you can support it with a custom a loader. Note that this will only work with the async `lilconfig` function and won't work with the sync `lilconfigSync`.
```js
import {lilconfig} from 'lilconfig';
const loadEsm = filepath => import(filepath);
lilconfig('myapp', {
loaders: {
'.js': loadEsm,
'.mjs': loadEsm,
}
})
.search()
.then(result => {
result // {config, filepath}
result.config.default // if config uses `export default`
});
```
## Version correlation
- lilconig v1 → cosmiconfig v6
- lilconig v2 → cosmiconfig v7

View File

@@ -0,0 +1,9 @@
import { createErrorClass } from './createErrorClass';
export var ObjectUnsubscribedError = createErrorClass(function (_super) {
return function ObjectUnsubscribedErrorImpl() {
_super(this);
this.name = 'ObjectUnsubscribedError';
this.message = 'object unsubscribed';
};
});
//# sourceMappingURL=ObjectUnsubscribedError.js.map

View File

@@ -0,0 +1,43 @@
var baseAssign = require('./_baseAssign'),
baseCreate = require('./_baseCreate');
/**
* Creates an object that inherits from the `prototype` object. If a
* `properties` object is given, its own enumerable string keyed properties
* are assigned to the created object.
*
* @static
* @memberOf _
* @since 2.3.0
* @category Object
* @param {Object} prototype The object to inherit from.
* @param {Object} [properties] The properties to assign to the object.
* @returns {Object} Returns the new object.
* @example
*
* function Shape() {
* this.x = 0;
* this.y = 0;
* }
*
* function Circle() {
* Shape.call(this);
* }
*
* Circle.prototype = _.create(Shape.prototype, {
* 'constructor': Circle
* });
*
* var circle = new Circle;
* circle instanceof Circle;
* // => true
*
* circle instanceof Shape;
* // => true
*/
function create(prototype, properties) {
var result = baseCreate(prototype);
return properties == null ? result : baseAssign(result, properties);
}
module.exports = create;

View File

@@ -0,0 +1,33 @@
# lines-and-columns
Maps lines and columns to character offsets and back. This is useful for parsers
and other text processors that deal in character ranges but process text with
meaningful lines and columns.
## Install
```
$ npm install [--save] lines-and-columns
```
## Usage
```js
import { LinesAndColumns } from 'lines-and-columns'
const lines = new LinesAndColumns(
`table {
border: 0
}`
)
lines.locationForIndex(9)
// { line: 1, column: 1 }
lines.indexForLocation({ line: 1, column: 2 })
// 10
```
## License
MIT

View File

@@ -0,0 +1,41 @@
"use strict";
module.exports = {
"@@iterator": require("./@@iterator"),
"binarySearch": require("./binary-search"),
"clear": require("./clear"),
"compact": require("./compact"),
"concat": require("./concat"),
"contains": require("./contains"),
"copyWithin": require("./copy-within"),
"diff": require("./diff"),
"eIndexOf": require("./e-index-of"),
"eLastIndexOf": require("./e-last-index-of"),
"entries": require("./entries"),
"exclusion": require("./exclusion"),
"fill": require("./fill"),
"filter": require("./filter"),
"find": require("./find"),
"findIndex": require("./find-index"),
"first": require("./first"),
"firstIndex": require("./first-index"),
"flatten": require("./flatten"),
"forEachRight": require("./for-each-right"),
"keys": require("./keys"),
"group": require("./group"),
"indexesOf": require("./indexes-of"),
"intersection": require("./intersection"),
"isCopy": require("./is-copy"),
"isEmpty": require("./is-empty"),
"isUniq": require("./is-uniq"),
"last": require("./last"),
"lastIndex": require("./last-index"),
"map": require("./map"),
"remove": require("./remove"),
"separate": require("./separate"),
"slice": require("./slice"),
"someRight": require("./some-right"),
"splice": require("./splice"),
"uniq": require("./uniq"),
"values": require("./values")
};

View File

@@ -0,0 +1,249 @@
/*!
* fill-range <https://github.com/jonschlinkert/fill-range>
*
* Copyright (c) 2014-present, Jon Schlinkert.
* Licensed under the MIT License.
*/
'use strict';
const util = require('util');
const toRegexRange = require('to-regex-range');
const isObject = val => val !== null && typeof val === 'object' && !Array.isArray(val);
const transform = toNumber => {
return value => toNumber === true ? Number(value) : String(value);
};
const isValidValue = value => {
return typeof value === 'number' || (typeof value === 'string' && value !== '');
};
const isNumber = num => Number.isInteger(+num);
const zeros = input => {
let value = `${input}`;
let index = -1;
if (value[0] === '-') value = value.slice(1);
if (value === '0') return false;
while (value[++index] === '0');
return index > 0;
};
const stringify = (start, end, options) => {
if (typeof start === 'string' || typeof end === 'string') {
return true;
}
return options.stringify === true;
};
const pad = (input, maxLength, toNumber) => {
if (maxLength > 0) {
let dash = input[0] === '-' ? '-' : '';
if (dash) input = input.slice(1);
input = (dash + input.padStart(dash ? maxLength - 1 : maxLength, '0'));
}
if (toNumber === false) {
return String(input);
}
return input;
};
const toMaxLen = (input, maxLength) => {
let negative = input[0] === '-' ? '-' : '';
if (negative) {
input = input.slice(1);
maxLength--;
}
while (input.length < maxLength) input = '0' + input;
return negative ? ('-' + input) : input;
};
const toSequence = (parts, options) => {
parts.negatives.sort((a, b) => a < b ? -1 : a > b ? 1 : 0);
parts.positives.sort((a, b) => a < b ? -1 : a > b ? 1 : 0);
let prefix = options.capture ? '' : '?:';
let positives = '';
let negatives = '';
let result;
if (parts.positives.length) {
positives = parts.positives.join('|');
}
if (parts.negatives.length) {
negatives = `-(${prefix}${parts.negatives.join('|')})`;
}
if (positives && negatives) {
result = `${positives}|${negatives}`;
} else {
result = positives || negatives;
}
if (options.wrap) {
return `(${prefix}${result})`;
}
return result;
};
const toRange = (a, b, isNumbers, options) => {
if (isNumbers) {
return toRegexRange(a, b, { wrap: false, ...options });
}
let start = String.fromCharCode(a);
if (a === b) return start;
let stop = String.fromCharCode(b);
return `[${start}-${stop}]`;
};
const toRegex = (start, end, options) => {
if (Array.isArray(start)) {
let wrap = options.wrap === true;
let prefix = options.capture ? '' : '?:';
return wrap ? `(${prefix}${start.join('|')})` : start.join('|');
}
return toRegexRange(start, end, options);
};
const rangeError = (...args) => {
return new RangeError('Invalid range arguments: ' + util.inspect(...args));
};
const invalidRange = (start, end, options) => {
if (options.strictRanges === true) throw rangeError([start, end]);
return [];
};
const invalidStep = (step, options) => {
if (options.strictRanges === true) {
throw new TypeError(`Expected step "${step}" to be a number`);
}
return [];
};
const fillNumbers = (start, end, step = 1, options = {}) => {
let a = Number(start);
let b = Number(end);
if (!Number.isInteger(a) || !Number.isInteger(b)) {
if (options.strictRanges === true) throw rangeError([start, end]);
return [];
}
// fix negative zero
if (a === 0) a = 0;
if (b === 0) b = 0;
let descending = a > b;
let startString = String(start);
let endString = String(end);
let stepString = String(step);
step = Math.max(Math.abs(step), 1);
let padded = zeros(startString) || zeros(endString) || zeros(stepString);
let maxLen = padded ? Math.max(startString.length, endString.length, stepString.length) : 0;
let toNumber = padded === false && stringify(start, end, options) === false;
let format = options.transform || transform(toNumber);
if (options.toRegex && step === 1) {
return toRange(toMaxLen(start, maxLen), toMaxLen(end, maxLen), true, options);
}
let parts = { negatives: [], positives: [] };
let push = num => parts[num < 0 ? 'negatives' : 'positives'].push(Math.abs(num));
let range = [];
let index = 0;
while (descending ? a >= b : a <= b) {
if (options.toRegex === true && step > 1) {
push(a);
} else {
range.push(pad(format(a, index), maxLen, toNumber));
}
a = descending ? a - step : a + step;
index++;
}
if (options.toRegex === true) {
return step > 1
? toSequence(parts, options)
: toRegex(range, null, { wrap: false, ...options });
}
return range;
};
const fillLetters = (start, end, step = 1, options = {}) => {
if ((!isNumber(start) && start.length > 1) || (!isNumber(end) && end.length > 1)) {
return invalidRange(start, end, options);
}
let format = options.transform || (val => String.fromCharCode(val));
let a = `${start}`.charCodeAt(0);
let b = `${end}`.charCodeAt(0);
let descending = a > b;
let min = Math.min(a, b);
let max = Math.max(a, b);
if (options.toRegex && step === 1) {
return toRange(min, max, false, options);
}
let range = [];
let index = 0;
while (descending ? a >= b : a <= b) {
range.push(format(a, index));
a = descending ? a - step : a + step;
index++;
}
if (options.toRegex === true) {
return toRegex(range, null, { wrap: false, options });
}
return range;
};
const fill = (start, end, step, options = {}) => {
if (end == null && isValidValue(start)) {
return [start];
}
if (!isValidValue(start) || !isValidValue(end)) {
return invalidRange(start, end, options);
}
if (typeof step === 'function') {
return fill(start, end, 1, { transform: step });
}
if (isObject(step)) {
return fill(start, end, 0, step);
}
let opts = { ...options };
if (opts.capture === true) opts.wrap = true;
step = step || opts.step || 1;
if (!isNumber(step)) {
if (step != null && !isObject(step)) return invalidStep(step, opts);
return fill(start, end, 1, step);
}
if (isNumber(start) && isNumber(end)) {
return fillNumbers(start, end, step, opts);
}
return fillLetters(start, end, Math.max(Math.abs(step), 1), opts);
};
module.exports = fill;

View File

@@ -0,0 +1 @@
{"version":3,"file":"IsValidTimeZoneName.d.ts","sourceRoot":"","sources":["../../../../../../packages/ecma402-abstract/IsValidTimeZoneName.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,wBAAgB,mBAAmB,CACjC,EAAE,EAAE,MAAM,EACV,EACE,MAAM,EACN,cAAc,GACf,EAAE;IACD,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IAC/B,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CACvC,GACA,OAAO,CAYT"}

View File

@@ -0,0 +1,25 @@
/**
* Creates a base function for methods like `_.forIn` and `_.forOwn`.
*
* @private
* @param {boolean} [fromRight] Specify iterating from right to left.
* @returns {Function} Returns the new base function.
*/
function createBaseFor(fromRight) {
return function(object, iteratee, keysFunc) {
var index = -1,
iterable = Object(object),
props = keysFunc(object),
length = props.length;
while (length--) {
var key = props[fromRight ? length : ++index];
if (iteratee(iterable[key], key, iterable) === false) {
break;
}
}
return object;
};
}
module.exports = createBaseFor;