new license file version [CI SKIP]
This commit is contained in:
@@ -0,0 +1 @@
|
||||
module.exports={C:{"2":0,"3":0,"4":0,"5":0,"6":0,"7":0,"8":0,"9":0,"10":0,"11":0,"12":0,"13":0,"14":0,"15":0,"16":0,"17":0,"18":0,"19":0,"20":0,"21":0,"22":0,"23":0,"24":0,"25":0,"26":0,"27":0,"28":0,"29":0,"30":0,"31":0,"32":0,"33":0,"34":0,"35":0,"36":0,"37":0,"38":0,"39":0,"40":0,"41":0,"42":0,"43":0,"44":0,"45":0,"46":0,"47":0,"48":0,"49":0,"50":0,"51":0,"52":0.00671,"53":0,"54":0,"55":0,"56":0,"57":0,"58":0,"59":0,"60":0,"61":0,"62":0,"63":0,"64":0,"65":0,"66":0,"67":0,"68":0,"69":0,"70":0,"71":0,"72":0,"73":0,"74":0,"75":0,"76":0,"77":0,"78":0.01007,"79":0,"80":0,"81":0,"82":0,"83":0,"84":0,"85":0,"86":0,"87":0,"88":0,"89":0,"90":0,"91":0,"92":0,"93":0,"94":0,"95":0,"96":0,"97":0,"98":0,"99":0,"100":0,"101":0,"102":0.00336,"103":0,"104":0,"105":0,"106":0,"107":0.01007,"108":0.19465,"109":0.15773,"110":0,"111":0,"3.5":0,"3.6":0},D:{"4":0,"5":0,"6":0,"7":0,"8":0,"9":0,"10":0,"11":0,"12":0,"13":0,"14":0,"15":0,"16":0,"17":0,"18":0,"19":0,"20":0,"21":0,"22":0,"23":0,"24":0,"25":0,"26":0,"27":0,"28":0,"29":0,"30":0,"31":0,"32":0,"33":0,"34":0,"35":0,"36":0,"37":0,"38":0,"39":0,"40":0,"41":0,"42":0,"43":0,"44":0,"45":0,"46":0,"47":0.00336,"48":0,"49":0.00336,"50":0,"51":0,"52":0,"53":0.00671,"54":0,"55":0,"56":0,"57":0,"58":0,"59":0,"60":0,"61":0,"62":0,"63":0,"64":0,"65":0.00336,"66":0,"67":0,"68":0,"69":0,"70":0,"71":0,"72":0,"73":0,"74":0,"75":0,"76":0,"77":0,"78":0,"79":0.00671,"80":0,"81":0.00671,"83":0.00336,"84":0.00336,"85":0,"86":0,"87":0.01007,"88":0.00336,"89":0,"90":0,"91":0,"92":0,"93":0.00671,"94":0.00336,"95":0,"96":0,"97":0,"98":0.0302,"99":0.00336,"100":0.00336,"101":0.00336,"102":0.00336,"103":0.05705,"104":0.00671,"105":0.02014,"106":0.02685,"107":0.09397,"108":2.97006,"109":2.75528,"110":0.01007,"111":0,"112":0},F:{"9":0,"11":0,"12":0,"15":0,"16":0,"17":0,"18":0,"19":0,"20":0,"21":0,"22":0,"23":0,"24":0,"25":0,"26":0,"27":0,"28":0,"29":0,"30":0,"31":0,"32":0,"33":0,"34":0,"35":0,"36":0,"37":0,"38":0,"39":0,"40":0,"41":0,"42":0,"43":0,"44":0,"45":0,"46":0,"47":0,"48":0,"49":0,"50":0,"51":0,"52":0,"53":0,"54":0,"55":0,"56":0,"57":0,"58":0,"60":0,"62":0,"63":0,"64":0,"65":0,"66":0,"67":0,"68":0,"69":0,"70":0,"71":0,"72":0,"73":0.00336,"74":0,"75":0,"76":0,"77":0,"78":0,"79":0,"80":0,"81":0,"82":0,"83":0,"84":0,"85":0,"86":0,"87":0,"88":0,"89":0,"90":0,"91":0,"92":0,"93":0.13088,"94":0.09061,"9.5-9.6":0,"10.0-10.1":0,"10.5":0,"10.6":0,"11.1":0,"11.5":0,"11.6":0,"12.1":0},B:{"12":0,"13":0,"14":0,"15":0,"16":0,"17":0,"18":0.00336,"79":0,"80":0,"81":0,"83":0,"84":0.01678,"85":0.01342,"86":0,"87":0,"88":0,"89":0,"90":0,"91":0,"92":0,"93":0,"94":0,"95":0,"96":0,"97":0,"98":0,"99":0,"100":0,"101":0,"102":0,"103":0,"104":0,"105":0.00336,"106":0.00671,"107":0.02014,"108":1.62766,"109":0.85914},E:{"4":0,"5":0,"6":0,"7":0,"8":0,"9":0,"10":0,"11":0,"12":0,"13":0.00336,"14":0.0537,"15":0.00336,_:"0","3.1":0,"3.2":0,"5.1":0,"6.1":0,"7.1":0,"9.1":0,"10.1":0,"11.1":0,"12.1":0.00671,"13.1":0.09732,"14.1":0.18458,"15.1":0.01342,"15.2-15.3":0.0302,"15.4":0.03692,"15.5":0.0839,"15.6":0.55374,"16.0":0.04698,"16.1":0.23492,"16.2":0.43628,"16.3":0.03356},G:{"8":0,"3.2":0,"4.0-4.1":0,"4.2-4.3":0,"5.0-5.1":0.00412,"6.0-6.1":0,"7.0-7.1":0,"8.1-8.4":0,"9.0-9.2":0,"9.3":0.02883,"10.0-10.2":0.00412,"10.3":0.06178,"11.0-11.2":0,"11.3-11.4":0.01648,"12.0-12.1":0.02883,"12.2-12.5":0.36247,"13.0-13.1":0.00412,"13.2":0.02883,"13.3":0.00824,"13.4-13.7":0.04531,"14.0-14.4":0.33364,"14.5-14.8":0.90206,"15.0-15.1":0.13181,"15.2-15.3":0.24302,"15.4":0.42426,"15.5":1.24806,"15.6":4.53914,"16.0":4.82747,"16.1":16.24533,"16.2":9.29246,"16.3":0.57666},P:{"4":0.07217,"5.0-5.4":0,"6.2-6.4":0,"7.2-7.4":0.17526,"8.2":0,"9.2":0,"10.1":0,"11.1-11.2":0.04124,"12.0":0.01031,"13.0":0.06186,"14.0":0.03093,"15.0":0.02062,"16.0":0.06186,"17.0":0.08248,"18.0":0.17526,"19.0":6.74251},I:{"0":0,"3":0,"4":0,"2.1":0,"2.2":0,"2.3":0,"4.1":0,"4.2-4.3":0,"4.4":0,"4.4.3-4.4.4":0.19753},K:{_:"0 10 11 12 11.1 11.5 12.1"},A:{"6":0,"7":0,"8":0,"9":0,"10":0,"11":0.01342,"5.5":0},J:{"7":0,"10":0},N:{"10":0,"11":0},R:{_:"0"},M:{"0":0.2724},Q:{"13.1":0},O:{"0":0.03986},H:{"0":0.08806},L:{"0":37.26101},S:{"2.5":0}};
|
||||
@@ -0,0 +1,430 @@
|
||||
'use strict'
|
||||
|
||||
let Declaration = require('./declaration')
|
||||
let { isClean } = require('./symbols')
|
||||
let Comment = require('./comment')
|
||||
let Node = require('./node')
|
||||
|
||||
let parse, Rule, AtRule
|
||||
|
||||
function cleanSource(nodes) {
|
||||
return nodes.map(i => {
|
||||
if (i.nodes) i.nodes = cleanSource(i.nodes)
|
||||
delete i.source
|
||||
return i
|
||||
})
|
||||
}
|
||||
|
||||
function markDirtyUp(node) {
|
||||
node[isClean] = false
|
||||
if (node.proxyOf.nodes) {
|
||||
for (let i of node.proxyOf.nodes) {
|
||||
markDirtyUp(i)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// istanbul ignore next
|
||||
function rebuild(node) {
|
||||
if (node.type === 'atrule') {
|
||||
Object.setPrototypeOf(node, AtRule.prototype)
|
||||
} else if (node.type === 'rule') {
|
||||
Object.setPrototypeOf(node, Rule.prototype)
|
||||
} else if (node.type === 'decl') {
|
||||
Object.setPrototypeOf(node, Declaration.prototype)
|
||||
} else if (node.type === 'comment') {
|
||||
Object.setPrototypeOf(node, Comment.prototype)
|
||||
}
|
||||
|
||||
if (node.nodes) {
|
||||
node.nodes.forEach(child => {
|
||||
rebuild(child)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
class Container extends Node {
|
||||
push(child) {
|
||||
child.parent = this
|
||||
this.proxyOf.nodes.push(child)
|
||||
return this
|
||||
}
|
||||
|
||||
each(callback) {
|
||||
if (!this.proxyOf.nodes) return undefined
|
||||
let iterator = this.getIterator()
|
||||
|
||||
let index, result
|
||||
while (this.indexes[iterator] < this.proxyOf.nodes.length) {
|
||||
index = this.indexes[iterator]
|
||||
result = callback(this.proxyOf.nodes[index], index)
|
||||
if (result === false) break
|
||||
|
||||
this.indexes[iterator] += 1
|
||||
}
|
||||
|
||||
delete this.indexes[iterator]
|
||||
return result
|
||||
}
|
||||
|
||||
walk(callback) {
|
||||
return this.each((child, i) => {
|
||||
let result
|
||||
try {
|
||||
result = callback(child, i)
|
||||
} catch (e) {
|
||||
throw child.addToError(e)
|
||||
}
|
||||
if (result !== false && child.walk) {
|
||||
result = child.walk(callback)
|
||||
}
|
||||
|
||||
return result
|
||||
})
|
||||
}
|
||||
|
||||
walkDecls(prop, callback) {
|
||||
if (!callback) {
|
||||
callback = prop
|
||||
return this.walk((child, i) => {
|
||||
if (child.type === 'decl') {
|
||||
return callback(child, i)
|
||||
}
|
||||
})
|
||||
}
|
||||
if (prop instanceof RegExp) {
|
||||
return this.walk((child, i) => {
|
||||
if (child.type === 'decl' && prop.test(child.prop)) {
|
||||
return callback(child, i)
|
||||
}
|
||||
})
|
||||
}
|
||||
return this.walk((child, i) => {
|
||||
if (child.type === 'decl' && child.prop === prop) {
|
||||
return callback(child, i)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
walkRules(selector, callback) {
|
||||
if (!callback) {
|
||||
callback = selector
|
||||
|
||||
return this.walk((child, i) => {
|
||||
if (child.type === 'rule') {
|
||||
return callback(child, i)
|
||||
}
|
||||
})
|
||||
}
|
||||
if (selector instanceof RegExp) {
|
||||
return this.walk((child, i) => {
|
||||
if (child.type === 'rule' && selector.test(child.selector)) {
|
||||
return callback(child, i)
|
||||
}
|
||||
})
|
||||
}
|
||||
return this.walk((child, i) => {
|
||||
if (child.type === 'rule' && child.selector === selector) {
|
||||
return callback(child, i)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
walkAtRules(name, callback) {
|
||||
if (!callback) {
|
||||
callback = name
|
||||
return this.walk((child, i) => {
|
||||
if (child.type === 'atrule') {
|
||||
return callback(child, i)
|
||||
}
|
||||
})
|
||||
}
|
||||
if (name instanceof RegExp) {
|
||||
return this.walk((child, i) => {
|
||||
if (child.type === 'atrule' && name.test(child.name)) {
|
||||
return callback(child, i)
|
||||
}
|
||||
})
|
||||
}
|
||||
return this.walk((child, i) => {
|
||||
if (child.type === 'atrule' && child.name === name) {
|
||||
return callback(child, i)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
walkComments(callback) {
|
||||
return this.walk((child, i) => {
|
||||
if (child.type === 'comment') {
|
||||
return callback(child, i)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
append(...children) {
|
||||
for (let child of children) {
|
||||
let nodes = this.normalize(child, this.last)
|
||||
for (let node of nodes) this.proxyOf.nodes.push(node)
|
||||
}
|
||||
|
||||
this.markDirty()
|
||||
|
||||
return this
|
||||
}
|
||||
|
||||
prepend(...children) {
|
||||
children = children.reverse()
|
||||
for (let child of children) {
|
||||
let nodes = this.normalize(child, this.first, 'prepend').reverse()
|
||||
for (let node of nodes) this.proxyOf.nodes.unshift(node)
|
||||
for (let id in this.indexes) {
|
||||
this.indexes[id] = this.indexes[id] + nodes.length
|
||||
}
|
||||
}
|
||||
|
||||
this.markDirty()
|
||||
|
||||
return this
|
||||
}
|
||||
|
||||
cleanRaws(keepBetween) {
|
||||
super.cleanRaws(keepBetween)
|
||||
if (this.nodes) {
|
||||
for (let node of this.nodes) node.cleanRaws(keepBetween)
|
||||
}
|
||||
}
|
||||
|
||||
insertBefore(exist, add) {
|
||||
exist = this.index(exist)
|
||||
|
||||
let type = exist === 0 ? 'prepend' : false
|
||||
let nodes = this.normalize(add, this.proxyOf.nodes[exist], type).reverse()
|
||||
for (let node of nodes) this.proxyOf.nodes.splice(exist, 0, node)
|
||||
|
||||
let index
|
||||
for (let id in this.indexes) {
|
||||
index = this.indexes[id]
|
||||
if (exist <= index) {
|
||||
this.indexes[id] = index + nodes.length
|
||||
}
|
||||
}
|
||||
|
||||
this.markDirty()
|
||||
|
||||
return this
|
||||
}
|
||||
|
||||
insertAfter(exist, add) {
|
||||
exist = this.index(exist)
|
||||
|
||||
let nodes = this.normalize(add, this.proxyOf.nodes[exist]).reverse()
|
||||
for (let node of nodes) this.proxyOf.nodes.splice(exist + 1, 0, node)
|
||||
|
||||
let index
|
||||
for (let id in this.indexes) {
|
||||
index = this.indexes[id]
|
||||
if (exist < index) {
|
||||
this.indexes[id] = index + nodes.length
|
||||
}
|
||||
}
|
||||
|
||||
this.markDirty()
|
||||
|
||||
return this
|
||||
}
|
||||
|
||||
removeChild(child) {
|
||||
child = this.index(child)
|
||||
this.proxyOf.nodes[child].parent = undefined
|
||||
this.proxyOf.nodes.splice(child, 1)
|
||||
|
||||
let index
|
||||
for (let id in this.indexes) {
|
||||
index = this.indexes[id]
|
||||
if (index >= child) {
|
||||
this.indexes[id] = index - 1
|
||||
}
|
||||
}
|
||||
|
||||
this.markDirty()
|
||||
|
||||
return this
|
||||
}
|
||||
|
||||
removeAll() {
|
||||
for (let node of this.proxyOf.nodes) node.parent = undefined
|
||||
this.proxyOf.nodes = []
|
||||
|
||||
this.markDirty()
|
||||
|
||||
return this
|
||||
}
|
||||
|
||||
replaceValues(pattern, opts, callback) {
|
||||
if (!callback) {
|
||||
callback = opts
|
||||
opts = {}
|
||||
}
|
||||
|
||||
this.walkDecls(decl => {
|
||||
if (opts.props && !opts.props.includes(decl.prop)) return
|
||||
if (opts.fast && !decl.value.includes(opts.fast)) return
|
||||
|
||||
decl.value = decl.value.replace(pattern, callback)
|
||||
})
|
||||
|
||||
this.markDirty()
|
||||
|
||||
return this
|
||||
}
|
||||
|
||||
every(condition) {
|
||||
return this.nodes.every(condition)
|
||||
}
|
||||
|
||||
some(condition) {
|
||||
return this.nodes.some(condition)
|
||||
}
|
||||
|
||||
index(child) {
|
||||
if (typeof child === 'number') return child
|
||||
if (child.proxyOf) child = child.proxyOf
|
||||
return this.proxyOf.nodes.indexOf(child)
|
||||
}
|
||||
|
||||
get first() {
|
||||
if (!this.proxyOf.nodes) return undefined
|
||||
return this.proxyOf.nodes[0]
|
||||
}
|
||||
|
||||
get last() {
|
||||
if (!this.proxyOf.nodes) return undefined
|
||||
return this.proxyOf.nodes[this.proxyOf.nodes.length - 1]
|
||||
}
|
||||
|
||||
normalize(nodes, sample) {
|
||||
if (typeof nodes === 'string') {
|
||||
nodes = cleanSource(parse(nodes).nodes)
|
||||
} else if (Array.isArray(nodes)) {
|
||||
nodes = nodes.slice(0)
|
||||
for (let i of nodes) {
|
||||
if (i.parent) i.parent.removeChild(i, 'ignore')
|
||||
}
|
||||
} else if (nodes.type === 'root') {
|
||||
nodes = nodes.nodes.slice(0)
|
||||
for (let i of nodes) {
|
||||
if (i.parent) i.parent.removeChild(i, 'ignore')
|
||||
}
|
||||
} else if (nodes.type) {
|
||||
nodes = [nodes]
|
||||
} else if (nodes.prop) {
|
||||
if (typeof nodes.value === 'undefined') {
|
||||
throw new Error('Value field is missed in node creation')
|
||||
} else if (typeof nodes.value !== 'string') {
|
||||
nodes.value = String(nodes.value)
|
||||
}
|
||||
nodes = [new Declaration(nodes)]
|
||||
} else if (nodes.selector) {
|
||||
nodes = [new Rule(nodes)]
|
||||
} else if (nodes.name) {
|
||||
nodes = [new AtRule(nodes)]
|
||||
} else if (nodes.text) {
|
||||
nodes = [new Comment(nodes)]
|
||||
} else {
|
||||
throw new Error('Unknown node type in node creation')
|
||||
}
|
||||
|
||||
let processed = nodes.map(i => {
|
||||
// istanbul ignore next
|
||||
if (typeof i.markDirty !== 'function') rebuild(i)
|
||||
i = i.proxyOf
|
||||
if (i.parent) i.parent.removeChild(i)
|
||||
if (i[isClean]) markDirtyUp(i)
|
||||
if (typeof i.raws.before === 'undefined') {
|
||||
if (sample && typeof sample.raws.before !== 'undefined') {
|
||||
i.raws.before = sample.raws.before.replace(/\S/g, '')
|
||||
}
|
||||
}
|
||||
i.parent = this
|
||||
return i
|
||||
})
|
||||
|
||||
return processed
|
||||
}
|
||||
|
||||
getProxyProcessor() {
|
||||
return {
|
||||
set(node, prop, value) {
|
||||
if (node[prop] === value) return true
|
||||
node[prop] = value
|
||||
if (prop === 'name' || prop === 'params' || prop === 'selector') {
|
||||
node.markDirty()
|
||||
}
|
||||
return true
|
||||
},
|
||||
|
||||
get(node, prop) {
|
||||
if (prop === 'proxyOf') {
|
||||
return node
|
||||
} else if (!node[prop]) {
|
||||
return node[prop]
|
||||
} else if (
|
||||
prop === 'each' ||
|
||||
(typeof prop === 'string' && prop.startsWith('walk'))
|
||||
) {
|
||||
return (...args) => {
|
||||
return node[prop](
|
||||
...args.map(i => {
|
||||
if (typeof i === 'function') {
|
||||
return (child, index) => i(child.toProxy(), index)
|
||||
} else {
|
||||
return i
|
||||
}
|
||||
})
|
||||
)
|
||||
}
|
||||
} else if (prop === 'every' || prop === 'some') {
|
||||
return cb => {
|
||||
return node[prop]((child, ...other) =>
|
||||
cb(child.toProxy(), ...other)
|
||||
)
|
||||
}
|
||||
} else if (prop === 'root') {
|
||||
return () => node.root().toProxy()
|
||||
} else if (prop === 'nodes') {
|
||||
return node.nodes.map(i => i.toProxy())
|
||||
} else if (prop === 'first' || prop === 'last') {
|
||||
return node[prop].toProxy()
|
||||
} else {
|
||||
return node[prop]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
getIterator() {
|
||||
if (!this.lastEach) this.lastEach = 0
|
||||
if (!this.indexes) this.indexes = {}
|
||||
|
||||
this.lastEach += 1
|
||||
let iterator = this.lastEach
|
||||
this.indexes[iterator] = 0
|
||||
|
||||
return iterator
|
||||
}
|
||||
}
|
||||
|
||||
Container.registerParse = dependant => {
|
||||
parse = dependant
|
||||
}
|
||||
|
||||
Container.registerRule = dependant => {
|
||||
Rule = dependant
|
||||
}
|
||||
|
||||
Container.registerAtRule = dependant => {
|
||||
AtRule = dependant
|
||||
}
|
||||
|
||||
module.exports = Container
|
||||
Container.default = Container
|
||||
@@ -0,0 +1 @@
|
||||
export * from 'rxjs-compat';
|
||||
@@ -0,0 +1 @@
|
||||
module.exports={A:{A:{"1":"G A B","132":"J E F BC"},B:{"1":"L H M N O P Q R S T U V W X Y Z a b c d f g h i j k l m n o p q r s D t","260":"C K"},C:{"1":"0 1 2 3 4 5 6 7 8 9 I u J E F G A B C K L H M N O v w 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 e lB mB nB oB pB P Q R wB S T U V W X Y Z a b c d f g h i j k l m n o p q r s D t xB yB","4":"CC tB DC EC"},D:{"1":"0 1 2 3 4 5 6 7 8 9 u J E F G A B C K L H M N O v w 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 e lB mB nB oB pB P Q R S T U V W X Y Z a b c d f g h i j k l m n o p q r s D t xB yB FC","4":"I"},E:{"1":"u J E F G A B C K L H HC IC JC KC 0B qB rB 1B LC MC 2B 3B 4B 5B sB 6B 7B 8B NC","4":"I GC zB"},F:{"1":"0 1 2 3 4 5 6 7 8 9 H M N O v w x y z AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB PB QB RB SB TB UB VB WB XB YB ZB aB bB cB dB eB fB gB hB iB jB kB e lB mB nB oB pB P Q R wB S T U V W X Y Z a b c d","260":"G B C OC PC QC RC qB 9B SC rB"},G:{"2":"F zB TC AC UC VC WC XC YC ZC aC bC cC dC eC fC gC hC iC jC kC lC mC 2B 3B 4B 5B sB 6B 7B 8B"},H:{"2":"nC"},I:{"1":"D","2":"tB I oC pC qC rC AC sC tC"},J:{"2":"E","16":"A"},K:{"1":"e","2":"A B C qB 9B rB"},L:{"1":"D"},M:{"2":"D"},N:{"2":"A B"},O:{"1":"uC"},P:{"2":"I vC wC xC yC zC 0B 0C 1C 2C 3C 4C sB 5C 6C 7C"},Q:{"1":"1B"},R:{"1":"8C"},S:{"2":"9C"}},B:2,C:"CSS3 Cursors (original values)"};
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"zip.js","sources":["../../../src/internal/operators/zip.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,IAAI,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAsCrD,MAAM,UAAU,GAAG,CAAO,GAAG,WAAyE;IACpG,OAAO,SAAS,mBAAmB,CAAC,MAAqB;QACvD,OAAO,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,CAAI,MAAM,EAAE,GAAG,WAAW,CAAC,CAAC,CAAC;IAChE,CAAC,CAAC;AACJ,CAAC"}
|
||||
@@ -0,0 +1,13 @@
|
||||
Copyright (c) 2015, Ilya Radchenko <ilya@burstcreations.com>
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
@@ -0,0 +1,381 @@
|
||||
import { isPlainObject } from 'is-plain-object';
|
||||
import { getUserAgent } from 'universal-user-agent';
|
||||
|
||||
function lowercaseKeys(object) {
|
||||
if (!object) {
|
||||
return {};
|
||||
}
|
||||
return Object.keys(object).reduce((newObj, key) => {
|
||||
newObj[key.toLowerCase()] = object[key];
|
||||
return newObj;
|
||||
}, {});
|
||||
}
|
||||
|
||||
function mergeDeep(defaults, options) {
|
||||
const result = Object.assign({}, defaults);
|
||||
Object.keys(options).forEach((key) => {
|
||||
if (isPlainObject(options[key])) {
|
||||
if (!(key in defaults))
|
||||
Object.assign(result, { [key]: options[key] });
|
||||
else
|
||||
result[key] = mergeDeep(defaults[key], options[key]);
|
||||
}
|
||||
else {
|
||||
Object.assign(result, { [key]: options[key] });
|
||||
}
|
||||
});
|
||||
return result;
|
||||
}
|
||||
|
||||
function removeUndefinedProperties(obj) {
|
||||
for (const key in obj) {
|
||||
if (obj[key] === undefined) {
|
||||
delete obj[key];
|
||||
}
|
||||
}
|
||||
return obj;
|
||||
}
|
||||
|
||||
function merge(defaults, route, options) {
|
||||
if (typeof route === "string") {
|
||||
let [method, url] = route.split(" ");
|
||||
options = Object.assign(url ? { method, url } : { url: method }, options);
|
||||
}
|
||||
else {
|
||||
options = Object.assign({}, route);
|
||||
}
|
||||
// lowercase header names before merging with defaults to avoid duplicates
|
||||
options.headers = lowercaseKeys(options.headers);
|
||||
// remove properties with undefined values before merging
|
||||
removeUndefinedProperties(options);
|
||||
removeUndefinedProperties(options.headers);
|
||||
const mergedOptions = mergeDeep(defaults || {}, options);
|
||||
// mediaType.previews arrays are merged, instead of overwritten
|
||||
if (defaults && defaults.mediaType.previews.length) {
|
||||
mergedOptions.mediaType.previews = defaults.mediaType.previews
|
||||
.filter((preview) => !mergedOptions.mediaType.previews.includes(preview))
|
||||
.concat(mergedOptions.mediaType.previews);
|
||||
}
|
||||
mergedOptions.mediaType.previews = mergedOptions.mediaType.previews.map((preview) => preview.replace(/-preview/, ""));
|
||||
return mergedOptions;
|
||||
}
|
||||
|
||||
function addQueryParameters(url, parameters) {
|
||||
const separator = /\?/.test(url) ? "&" : "?";
|
||||
const names = Object.keys(parameters);
|
||||
if (names.length === 0) {
|
||||
return url;
|
||||
}
|
||||
return (url +
|
||||
separator +
|
||||
names
|
||||
.map((name) => {
|
||||
if (name === "q") {
|
||||
return ("q=" + parameters.q.split("+").map(encodeURIComponent).join("+"));
|
||||
}
|
||||
return `${name}=${encodeURIComponent(parameters[name])}`;
|
||||
})
|
||||
.join("&"));
|
||||
}
|
||||
|
||||
const urlVariableRegex = /\{[^}]+\}/g;
|
||||
function removeNonChars(variableName) {
|
||||
return variableName.replace(/^\W+|\W+$/g, "").split(/,/);
|
||||
}
|
||||
function extractUrlVariableNames(url) {
|
||||
const matches = url.match(urlVariableRegex);
|
||||
if (!matches) {
|
||||
return [];
|
||||
}
|
||||
return matches.map(removeNonChars).reduce((a, b) => a.concat(b), []);
|
||||
}
|
||||
|
||||
function omit(object, keysToOmit) {
|
||||
return Object.keys(object)
|
||||
.filter((option) => !keysToOmit.includes(option))
|
||||
.reduce((obj, key) => {
|
||||
obj[key] = object[key];
|
||||
return obj;
|
||||
}, {});
|
||||
}
|
||||
|
||||
// Based on https://github.com/bramstein/url-template, licensed under BSD
|
||||
// TODO: create separate package.
|
||||
//
|
||||
// Copyright (c) 2012-2014, Bram Stein
|
||||
// All rights reserved.
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions
|
||||
// are met:
|
||||
// 1. Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// 2. Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in the
|
||||
// documentation and/or other materials provided with the distribution.
|
||||
// 3. The name of the author may not be used to endorse or promote products
|
||||
// derived from this software without specific prior written permission.
|
||||
// THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED
|
||||
// WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
|
||||
// EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
|
||||
// INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
||||
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
|
||||
// EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
/* istanbul ignore file */
|
||||
function encodeReserved(str) {
|
||||
return str
|
||||
.split(/(%[0-9A-Fa-f]{2})/g)
|
||||
.map(function (part) {
|
||||
if (!/%[0-9A-Fa-f]/.test(part)) {
|
||||
part = encodeURI(part).replace(/%5B/g, "[").replace(/%5D/g, "]");
|
||||
}
|
||||
return part;
|
||||
})
|
||||
.join("");
|
||||
}
|
||||
function encodeUnreserved(str) {
|
||||
return encodeURIComponent(str).replace(/[!'()*]/g, function (c) {
|
||||
return "%" + c.charCodeAt(0).toString(16).toUpperCase();
|
||||
});
|
||||
}
|
||||
function encodeValue(operator, value, key) {
|
||||
value =
|
||||
operator === "+" || operator === "#"
|
||||
? encodeReserved(value)
|
||||
: encodeUnreserved(value);
|
||||
if (key) {
|
||||
return encodeUnreserved(key) + "=" + value;
|
||||
}
|
||||
else {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
function isDefined(value) {
|
||||
return value !== undefined && value !== null;
|
||||
}
|
||||
function isKeyOperator(operator) {
|
||||
return operator === ";" || operator === "&" || operator === "?";
|
||||
}
|
||||
function getValues(context, operator, key, modifier) {
|
||||
var value = context[key], result = [];
|
||||
if (isDefined(value) && value !== "") {
|
||||
if (typeof value === "string" ||
|
||||
typeof value === "number" ||
|
||||
typeof value === "boolean") {
|
||||
value = value.toString();
|
||||
if (modifier && modifier !== "*") {
|
||||
value = value.substring(0, parseInt(modifier, 10));
|
||||
}
|
||||
result.push(encodeValue(operator, value, isKeyOperator(operator) ? key : ""));
|
||||
}
|
||||
else {
|
||||
if (modifier === "*") {
|
||||
if (Array.isArray(value)) {
|
||||
value.filter(isDefined).forEach(function (value) {
|
||||
result.push(encodeValue(operator, value, isKeyOperator(operator) ? key : ""));
|
||||
});
|
||||
}
|
||||
else {
|
||||
Object.keys(value).forEach(function (k) {
|
||||
if (isDefined(value[k])) {
|
||||
result.push(encodeValue(operator, value[k], k));
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
else {
|
||||
const tmp = [];
|
||||
if (Array.isArray(value)) {
|
||||
value.filter(isDefined).forEach(function (value) {
|
||||
tmp.push(encodeValue(operator, value));
|
||||
});
|
||||
}
|
||||
else {
|
||||
Object.keys(value).forEach(function (k) {
|
||||
if (isDefined(value[k])) {
|
||||
tmp.push(encodeUnreserved(k));
|
||||
tmp.push(encodeValue(operator, value[k].toString()));
|
||||
}
|
||||
});
|
||||
}
|
||||
if (isKeyOperator(operator)) {
|
||||
result.push(encodeUnreserved(key) + "=" + tmp.join(","));
|
||||
}
|
||||
else if (tmp.length !== 0) {
|
||||
result.push(tmp.join(","));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (operator === ";") {
|
||||
if (isDefined(value)) {
|
||||
result.push(encodeUnreserved(key));
|
||||
}
|
||||
}
|
||||
else if (value === "" && (operator === "&" || operator === "?")) {
|
||||
result.push(encodeUnreserved(key) + "=");
|
||||
}
|
||||
else if (value === "") {
|
||||
result.push("");
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
function parseUrl(template) {
|
||||
return {
|
||||
expand: expand.bind(null, template),
|
||||
};
|
||||
}
|
||||
function expand(template, context) {
|
||||
var operators = ["+", "#", ".", "/", ";", "?", "&"];
|
||||
return template.replace(/\{([^\{\}]+)\}|([^\{\}]+)/g, function (_, expression, literal) {
|
||||
if (expression) {
|
||||
let operator = "";
|
||||
const values = [];
|
||||
if (operators.indexOf(expression.charAt(0)) !== -1) {
|
||||
operator = expression.charAt(0);
|
||||
expression = expression.substr(1);
|
||||
}
|
||||
expression.split(/,/g).forEach(function (variable) {
|
||||
var tmp = /([^:\*]*)(?::(\d+)|(\*))?/.exec(variable);
|
||||
values.push(getValues(context, operator, tmp[1], tmp[2] || tmp[3]));
|
||||
});
|
||||
if (operator && operator !== "+") {
|
||||
var separator = ",";
|
||||
if (operator === "?") {
|
||||
separator = "&";
|
||||
}
|
||||
else if (operator !== "#") {
|
||||
separator = operator;
|
||||
}
|
||||
return (values.length !== 0 ? operator : "") + values.join(separator);
|
||||
}
|
||||
else {
|
||||
return values.join(",");
|
||||
}
|
||||
}
|
||||
else {
|
||||
return encodeReserved(literal);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function parse(options) {
|
||||
// https://fetch.spec.whatwg.org/#methods
|
||||
let method = options.method.toUpperCase();
|
||||
// replace :varname with {varname} to make it RFC 6570 compatible
|
||||
let url = (options.url || "/").replace(/:([a-z]\w+)/g, "{$1}");
|
||||
let headers = Object.assign({}, options.headers);
|
||||
let body;
|
||||
let parameters = omit(options, [
|
||||
"method",
|
||||
"baseUrl",
|
||||
"url",
|
||||
"headers",
|
||||
"request",
|
||||
"mediaType",
|
||||
]);
|
||||
// extract variable names from URL to calculate remaining variables later
|
||||
const urlVariableNames = extractUrlVariableNames(url);
|
||||
url = parseUrl(url).expand(parameters);
|
||||
if (!/^http/.test(url)) {
|
||||
url = options.baseUrl + url;
|
||||
}
|
||||
const omittedParameters = Object.keys(options)
|
||||
.filter((option) => urlVariableNames.includes(option))
|
||||
.concat("baseUrl");
|
||||
const remainingParameters = omit(parameters, omittedParameters);
|
||||
const isBinaryRequest = /application\/octet-stream/i.test(headers.accept);
|
||||
if (!isBinaryRequest) {
|
||||
if (options.mediaType.format) {
|
||||
// e.g. application/vnd.github.v3+json => application/vnd.github.v3.raw
|
||||
headers.accept = headers.accept
|
||||
.split(/,/)
|
||||
.map((preview) => preview.replace(/application\/vnd(\.\w+)(\.v3)?(\.\w+)?(\+json)?$/, `application/vnd$1$2.${options.mediaType.format}`))
|
||||
.join(",");
|
||||
}
|
||||
if (options.mediaType.previews.length) {
|
||||
const previewsFromAcceptHeader = headers.accept.match(/[\w-]+(?=-preview)/g) || [];
|
||||
headers.accept = previewsFromAcceptHeader
|
||||
.concat(options.mediaType.previews)
|
||||
.map((preview) => {
|
||||
const format = options.mediaType.format
|
||||
? `.${options.mediaType.format}`
|
||||
: "+json";
|
||||
return `application/vnd.github.${preview}-preview${format}`;
|
||||
})
|
||||
.join(",");
|
||||
}
|
||||
}
|
||||
// for GET/HEAD requests, set URL query parameters from remaining parameters
|
||||
// for PATCH/POST/PUT/DELETE requests, set request body from remaining parameters
|
||||
if (["GET", "HEAD"].includes(method)) {
|
||||
url = addQueryParameters(url, remainingParameters);
|
||||
}
|
||||
else {
|
||||
if ("data" in remainingParameters) {
|
||||
body = remainingParameters.data;
|
||||
}
|
||||
else {
|
||||
if (Object.keys(remainingParameters).length) {
|
||||
body = remainingParameters;
|
||||
}
|
||||
else {
|
||||
headers["content-length"] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
// default content-type for JSON if body is set
|
||||
if (!headers["content-type"] && typeof body !== "undefined") {
|
||||
headers["content-type"] = "application/json; charset=utf-8";
|
||||
}
|
||||
// GitHub expects 'content-length: 0' header for PUT/PATCH requests without body.
|
||||
// fetch does not allow to set `content-length` header, but we can set body to an empty string
|
||||
if (["PATCH", "PUT"].includes(method) && typeof body === "undefined") {
|
||||
body = "";
|
||||
}
|
||||
// Only return body/request keys if present
|
||||
return Object.assign({ method, url, headers }, typeof body !== "undefined" ? { body } : null, options.request ? { request: options.request } : null);
|
||||
}
|
||||
|
||||
function endpointWithDefaults(defaults, route, options) {
|
||||
return parse(merge(defaults, route, options));
|
||||
}
|
||||
|
||||
function withDefaults(oldDefaults, newDefaults) {
|
||||
const DEFAULTS = merge(oldDefaults, newDefaults);
|
||||
const endpoint = endpointWithDefaults.bind(null, DEFAULTS);
|
||||
return Object.assign(endpoint, {
|
||||
DEFAULTS,
|
||||
defaults: withDefaults.bind(null, DEFAULTS),
|
||||
merge: merge.bind(null, DEFAULTS),
|
||||
parse,
|
||||
});
|
||||
}
|
||||
|
||||
const VERSION = "6.0.12";
|
||||
|
||||
const userAgent = `octokit-endpoint.js/${VERSION} ${getUserAgent()}`;
|
||||
// DEFAULTS has all properties set that EndpointOptions has, except url.
|
||||
// So we use RequestParameters and add method as additional required property.
|
||||
const DEFAULTS = {
|
||||
method: "GET",
|
||||
baseUrl: "https://api.github.com",
|
||||
headers: {
|
||||
accept: "application/vnd.github.v3+json",
|
||||
"user-agent": userAgent,
|
||||
},
|
||||
mediaType: {
|
||||
format: "",
|
||||
previews: [],
|
||||
},
|
||||
};
|
||||
|
||||
const endpoint = withDefaults(null, DEFAULTS);
|
||||
|
||||
export { endpoint };
|
||||
//# sourceMappingURL=index.js.map
|
||||
@@ -0,0 +1 @@
|
||||
import 'rxjs-compat/add/operator/expand';
|
||||
@@ -0,0 +1,7 @@
|
||||
"use strict";
|
||||
function __export(m) {
|
||||
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
|
||||
}
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
__export(require("rxjs-compat/operator/sequenceEqual"));
|
||||
//# sourceMappingURL=sequenceEqual.js.map
|
||||
@@ -0,0 +1 @@
|
||||
module.exports={A:{A:{"2":"J E F G A B BC"},B:{"1":"M N O P Q R S T U V W X Y Z a b c d f g h i j k l m n o p q r s D t","2":"C K L H"},C:{"1":"QB RB SB TB UB VB WB XB YB uB ZB vB aB bB cB dB eB fB gB hB iB jB kB e lB mB nB oB pB P Q R wB S T U V W X Y Z a b c d f g h i j k l m n o p q r s D t xB yB","2":"0 1 2 3 4 5 6 7 8 9 CC tB I u J E F G A B C K L H M N O v w x y z AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB PB DC EC"},D:{"1":"VB WB XB YB uB ZB vB aB bB cB dB eB fB gB hB iB jB kB e lB mB nB oB pB P Q R S T U V W X Y Z a b c d f g h i j k l m n o p q r s D t xB yB FC","2":"0 1 2 3 4 5 6 7 8 9 I u J E F G A B C K L H M N O v w x y z AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB PB QB RB SB TB UB"},E:{"1":"A B C K L H 0B qB rB 1B LC MC 2B 3B 4B 5B sB 6B 7B 8B NC","2":"I u J E F G GC zB HC IC JC KC"},F:{"1":"IB JB KB LB MB NB OB PB QB RB SB TB UB VB WB XB YB ZB aB bB cB dB eB fB gB hB iB jB kB e lB mB nB oB pB P Q R wB S T U V W X Y Z a b c d","2":"0 1 2 3 4 5 6 7 8 9 G B C H M N O v w x y z AB BB CB DB EB FB GB HB OC PC QC RC qB 9B SC rB"},G:{"1":"aC bC cC dC eC fC gC hC iC jC kC lC mC 2B 3B 4B 5B sB 6B 7B 8B","2":"F zB TC AC UC VC WC XC YC ZC"},H:{"2":"nC"},I:{"1":"D","2":"tB I oC pC qC rC AC sC tC"},J:{"2":"E A"},K:{"1":"e","2":"A B C qB 9B rB"},L:{"1":"D"},M:{"1":"D"},N:{"2":"A B"},O:{"1":"uC"},P:{"1":"wC xC yC zC 0B 0C 1C 2C 3C 4C sB 5C 6C 7C","2":"I vC"},Q:{"1":"1B"},R:{"1":"8C"},S:{"2":"9C"}},B:1,C:"\"once\" event listener option"};
|
||||
@@ -0,0 +1 @@
|
||||
module.exports={A:{A:{"2":"J E F G A B BC"},B:{"1":"P Q R S T U V W X Y Z a b c d f g h i j k l m n o p q r s D t","2":"C K L H M N O"},C:{"1":"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 e lB mB nB oB pB P Q R wB S T U V W X Y Z a b c d f g h i j k l m n o p q r s D t xB yB","2":"0 1 2 3 4 5 6 7 8 9 CC tB I u J E F G A B C K L H M N O v w x y z AB BB CB DB DC EC","194":"EB FB GB"},D:{"1":"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 e lB mB nB oB pB P Q R S T U V W X Y Z a b c d f g h i j k l m n o p q r s D t xB yB FC","2":"0 1 2 3 4 5 6 7 8 9 I u J E F G A B C K L H M N O v w x y z AB BB CB DB EB FB GB HB IB JB KB LB MB NB"},E:{"1":"L H LC MC 2B 3B 4B 5B sB 6B 7B 8B NC","2":"I u J E F G GC zB HC IC JC KC","16":"A","33":"B C K 0B qB rB 1B"},F:{"1":"BB CB DB EB FB GB HB IB JB KB LB MB NB OB PB QB RB SB TB UB VB WB XB YB ZB aB bB cB dB eB fB gB hB iB jB kB e lB mB nB oB pB P Q R wB S T U V W X Y Z a b c d","2":"0 1 2 3 4 5 6 7 8 9 G B C H M N O v w x y z AB OC PC QC RC qB 9B SC rB"},G:{"1":"aC bC cC dC eC fC gC hC iC jC kC lC mC 2B 3B 4B 5B sB 6B 7B 8B","2":"F zB TC AC UC VC WC XC YC ZC"},H:{"2":"nC"},I:{"1":"D","2":"tB I oC pC qC rC AC sC tC"},J:{"2":"E A"},K:{"1":"e","2":"A B C qB 9B rB"},L:{"1":"D"},M:{"1":"D"},N:{"2":"A B"},O:{"1":"uC"},P:{"1":"vC wC xC yC zC 0B 0C 1C 2C 3C 4C sB 5C 6C 7C","2":"I"},Q:{"1":"1B"},R:{"1":"8C"},S:{"1":"9C"}},B:2,C:"CSS text-orientation"};
|
||||
@@ -0,0 +1 @@
|
||||
module.exports={A:{A:{"1":"J E F G A B","16":"BC"},B:{"1":"C K L H M N O P Q R S T U V W X Y Z a b c d f g h i j k l m n o p q r s D t"},C:{"1":"0 1 2 3 4 5 6 7 8 9 tB I u J E F G A B C K L H M N O v w 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 e lB mB nB oB pB P Q R wB S T U V W X Y Z a b c d f g h i j k l m n o p q r s D t xB yB DC EC","16":"CC"},D:{"1":"0 1 2 3 4 5 6 7 8 9 H M N O v w 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 e lB mB nB oB pB P Q R S T U V W X Y Z a b c d f g h i j k l m n o p q r s D t xB yB FC","16":"I u J E F G A B C K L"},E:{"1":"u J E F G A B C K L H HC IC JC KC 0B qB rB 1B LC MC 2B 3B 4B 5B sB 6B 7B 8B NC","16":"I GC zB"},F:{"1":"0 1 2 3 4 5 6 7 8 9 B C H M N O v w x y z AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB PB QB RB SB TB UB VB WB XB YB ZB aB bB cB dB eB fB gB hB iB jB kB e lB mB nB oB pB P Q R wB S T U V W X Y Z a b c d qB 9B SC rB","16":"G OC PC QC RC"},G:{"1":"F TC AC UC VC WC XC YC ZC aC bC cC dC eC fC gC hC iC jC kC lC mC 2B 3B 4B 5B sB 6B 7B 8B","16":"zB"},H:{"1":"nC"},I:{"1":"tB I D qC rC AC sC tC","16":"oC pC"},J:{"1":"E A"},K:{"1":"C e rB","16":"A B qB 9B"},L:{"1":"D"},M:{"1":"D"},N:{"1":"A B"},O:{"1":"uC"},P:{"1":"I vC wC xC yC zC 0B 0C 1C 2C 3C 4C sB 5C 6C 7C"},Q:{"1":"1B"},R:{"1":"8C"},S:{"1":"9C"}},B:5,C:"document.elementFromPoint()"};
|
||||
@@ -0,0 +1 @@
|
||||
import 'rxjs-compat/add/operator/switchMapTo';
|
||||
@@ -0,0 +1,141 @@
|
||||
import { async } from '../scheduler/async';
|
||||
import { Subscriber } from '../Subscriber';
|
||||
import { isScheduler } from '../util/isScheduler';
|
||||
export function bufferTime(bufferTimeSpan) {
|
||||
let length = arguments.length;
|
||||
let scheduler = async;
|
||||
if (isScheduler(arguments[arguments.length - 1])) {
|
||||
scheduler = arguments[arguments.length - 1];
|
||||
length--;
|
||||
}
|
||||
let bufferCreationInterval = null;
|
||||
if (length >= 2) {
|
||||
bufferCreationInterval = arguments[1];
|
||||
}
|
||||
let maxBufferSize = Number.POSITIVE_INFINITY;
|
||||
if (length >= 3) {
|
||||
maxBufferSize = arguments[2];
|
||||
}
|
||||
return function bufferTimeOperatorFunction(source) {
|
||||
return source.lift(new BufferTimeOperator(bufferTimeSpan, bufferCreationInterval, maxBufferSize, scheduler));
|
||||
};
|
||||
}
|
||||
class BufferTimeOperator {
|
||||
constructor(bufferTimeSpan, bufferCreationInterval, maxBufferSize, scheduler) {
|
||||
this.bufferTimeSpan = bufferTimeSpan;
|
||||
this.bufferCreationInterval = bufferCreationInterval;
|
||||
this.maxBufferSize = maxBufferSize;
|
||||
this.scheduler = scheduler;
|
||||
}
|
||||
call(subscriber, source) {
|
||||
return source.subscribe(new BufferTimeSubscriber(subscriber, this.bufferTimeSpan, this.bufferCreationInterval, this.maxBufferSize, this.scheduler));
|
||||
}
|
||||
}
|
||||
class Context {
|
||||
constructor() {
|
||||
this.buffer = [];
|
||||
}
|
||||
}
|
||||
class BufferTimeSubscriber extends Subscriber {
|
||||
constructor(destination, bufferTimeSpan, bufferCreationInterval, maxBufferSize, scheduler) {
|
||||
super(destination);
|
||||
this.bufferTimeSpan = bufferTimeSpan;
|
||||
this.bufferCreationInterval = bufferCreationInterval;
|
||||
this.maxBufferSize = maxBufferSize;
|
||||
this.scheduler = scheduler;
|
||||
this.contexts = [];
|
||||
const context = this.openContext();
|
||||
this.timespanOnly = bufferCreationInterval == null || bufferCreationInterval < 0;
|
||||
if (this.timespanOnly) {
|
||||
const timeSpanOnlyState = { subscriber: this, context, bufferTimeSpan };
|
||||
this.add(context.closeAction = scheduler.schedule(dispatchBufferTimeSpanOnly, bufferTimeSpan, timeSpanOnlyState));
|
||||
}
|
||||
else {
|
||||
const closeState = { subscriber: this, context };
|
||||
const creationState = { bufferTimeSpan, bufferCreationInterval, subscriber: this, scheduler };
|
||||
this.add(context.closeAction = scheduler.schedule(dispatchBufferClose, bufferTimeSpan, closeState));
|
||||
this.add(scheduler.schedule(dispatchBufferCreation, bufferCreationInterval, creationState));
|
||||
}
|
||||
}
|
||||
_next(value) {
|
||||
const contexts = this.contexts;
|
||||
const len = contexts.length;
|
||||
let filledBufferContext;
|
||||
for (let i = 0; i < len; i++) {
|
||||
const context = contexts[i];
|
||||
const buffer = context.buffer;
|
||||
buffer.push(value);
|
||||
if (buffer.length == this.maxBufferSize) {
|
||||
filledBufferContext = context;
|
||||
}
|
||||
}
|
||||
if (filledBufferContext) {
|
||||
this.onBufferFull(filledBufferContext);
|
||||
}
|
||||
}
|
||||
_error(err) {
|
||||
this.contexts.length = 0;
|
||||
super._error(err);
|
||||
}
|
||||
_complete() {
|
||||
const { contexts, destination } = this;
|
||||
while (contexts.length > 0) {
|
||||
const context = contexts.shift();
|
||||
destination.next(context.buffer);
|
||||
}
|
||||
super._complete();
|
||||
}
|
||||
_unsubscribe() {
|
||||
this.contexts = null;
|
||||
}
|
||||
onBufferFull(context) {
|
||||
this.closeContext(context);
|
||||
const closeAction = context.closeAction;
|
||||
closeAction.unsubscribe();
|
||||
this.remove(closeAction);
|
||||
if (!this.closed && this.timespanOnly) {
|
||||
context = this.openContext();
|
||||
const bufferTimeSpan = this.bufferTimeSpan;
|
||||
const timeSpanOnlyState = { subscriber: this, context, bufferTimeSpan };
|
||||
this.add(context.closeAction = this.scheduler.schedule(dispatchBufferTimeSpanOnly, bufferTimeSpan, timeSpanOnlyState));
|
||||
}
|
||||
}
|
||||
openContext() {
|
||||
const context = new Context();
|
||||
this.contexts.push(context);
|
||||
return context;
|
||||
}
|
||||
closeContext(context) {
|
||||
this.destination.next(context.buffer);
|
||||
const contexts = this.contexts;
|
||||
const spliceIndex = contexts ? contexts.indexOf(context) : -1;
|
||||
if (spliceIndex >= 0) {
|
||||
contexts.splice(contexts.indexOf(context), 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
function dispatchBufferTimeSpanOnly(state) {
|
||||
const subscriber = state.subscriber;
|
||||
const prevContext = state.context;
|
||||
if (prevContext) {
|
||||
subscriber.closeContext(prevContext);
|
||||
}
|
||||
if (!subscriber.closed) {
|
||||
state.context = subscriber.openContext();
|
||||
state.context.closeAction = this.schedule(state, state.bufferTimeSpan);
|
||||
}
|
||||
}
|
||||
function dispatchBufferCreation(state) {
|
||||
const { bufferCreationInterval, bufferTimeSpan, subscriber, scheduler } = state;
|
||||
const context = subscriber.openContext();
|
||||
const action = this;
|
||||
if (!subscriber.closed) {
|
||||
subscriber.add(context.closeAction = scheduler.schedule(dispatchBufferClose, bufferTimeSpan, { subscriber, context }));
|
||||
action.schedule(state, bufferCreationInterval);
|
||||
}
|
||||
}
|
||||
function dispatchBufferClose(arg) {
|
||||
const { subscriber, context } = arg;
|
||||
subscriber.closeContext(context);
|
||||
}
|
||||
//# sourceMappingURL=bufferTime.js.map
|
||||
@@ -0,0 +1 @@
|
||||
module.exports={A:{A:{"2":"J E F G A B BC"},B:{"1":"P Q R S T U V W X Y Z a b c d f g h i j k l m n o p q r s D t","2":"C K L H M N O"},C:{"1":"0 1 2 3 4 5 6 7 8 9 w 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 e lB mB nB oB pB P Q R wB S T U V W X Y Z a b c d f g h i j k l m n o p q r s D t xB yB","2":"CC tB I u J E F G A B C K L H M N O DC EC","132":"v"},D:{"1":"EB FB GB HB IB JB KB LB MB NB OB PB QB RB SB TB UB VB WB XB YB uB ZB vB aB bB cB dB eB fB gB hB iB jB kB e lB mB nB oB pB P Q R S T U V W X Y Z a b c d f g h i j k l m n o p q r s D t xB yB FC","2":"0 1 2 3 4 5 6 7 8 9 I u J E F G A B C K L H M N O v w x y z AB BB CB DB"},E:{"1":"B C K L H 0B qB rB 1B LC MC 2B 3B 4B 5B sB 6B 7B 8B NC","2":"I u J E F G A GC zB HC IC JC KC"},F:{"1":"1 2 3 4 5 6 7 8 9 AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB PB QB RB SB TB UB VB WB XB YB ZB aB bB cB dB eB fB gB hB iB jB kB e lB mB nB oB pB P Q R wB S T U V W X Y Z a b c d","2":"0 G B C H M N O v w x y z OC PC QC RC qB 9B SC rB"},G:{"1":"bC cC dC eC fC gC hC iC jC kC lC mC 2B 3B 4B 5B sB 6B 7B 8B","2":"F zB TC AC UC VC WC XC YC ZC aC"},H:{"2":"nC"},I:{"1":"D","2":"tB I oC pC qC rC AC sC tC"},J:{"2":"E A"},K:{"1":"e","2":"A B C qB 9B rB"},L:{"1":"D"},M:{"1":"D"},N:{"2":"A B"},O:{"1":"uC"},P:{"1":"I vC wC xC yC zC 0B 0C 1C 2C 3C 4C sB 5C 6C 7C"},Q:{"1":"1B"},R:{"1":"8C"},S:{"1":"9C"}},B:1,C:"TextEncoder & TextDecoder"};
|
||||
@@ -0,0 +1 @@
|
||||
export * from 'rxjs-compat/operator/audit';
|
||||
@@ -0,0 +1,23 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
|
||||
var _crypto = _interopRequireDefault(require("crypto"));
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function sha1(bytes) {
|
||||
if (Array.isArray(bytes)) {
|
||||
bytes = Buffer.from(bytes);
|
||||
} else if (typeof bytes === 'string') {
|
||||
bytes = Buffer.from(bytes, 'utf8');
|
||||
}
|
||||
|
||||
return _crypto.default.createHash('sha1').update(bytes).digest();
|
||||
}
|
||||
|
||||
var _default = sha1;
|
||||
exports.default = _default;
|
||||
@@ -0,0 +1,27 @@
|
||||
import { Location } from 'locate-character';
|
||||
export interface Source {
|
||||
source: string;
|
||||
get_location: (search: number) => Location;
|
||||
file_basename: string;
|
||||
filename: string;
|
||||
}
|
||||
export interface Processed {
|
||||
code: string;
|
||||
map?: string | object;
|
||||
dependencies?: string[];
|
||||
toString?: () => string;
|
||||
}
|
||||
export declare type MarkupPreprocessor = (options: {
|
||||
content: string;
|
||||
filename: string;
|
||||
}) => Processed | Promise<Processed>;
|
||||
export declare type Preprocessor = (options: {
|
||||
content: string;
|
||||
attributes: Record<string, string | boolean>;
|
||||
filename?: string;
|
||||
}) => Processed | Promise<Processed>;
|
||||
export interface PreprocessorGroup {
|
||||
markup?: MarkupPreprocessor;
|
||||
style?: Preprocessor;
|
||||
script?: Preprocessor;
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
# responselike
|
||||
|
||||
> A response-like object for mocking a Node.js HTTP response stream
|
||||
|
||||
[](https://travis-ci.org/lukechilds/responselike)
|
||||
[](https://coveralls.io/github/lukechilds/responselike?branch=master)
|
||||
[](https://www.npmjs.com/package/responselike)
|
||||
[](https://www.npmjs.com/package/responselike)
|
||||
|
||||
Returns a streamable response object similar to a [Node.js HTTP response stream](https://nodejs.org/api/http.html#http_class_http_incomingmessage). Useful for formatting cached responses so they can be consumed by code expecting a real response.
|
||||
|
||||
## Install
|
||||
|
||||
```shell
|
||||
npm install --save responselike
|
||||
```
|
||||
|
||||
Or if you're just using for testing you'll want:
|
||||
|
||||
```shell
|
||||
npm install --save-dev responselike
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
const Response = require('responselike');
|
||||
|
||||
const response = new Response(200, { foo: 'bar' }, Buffer.from('Hi!'), 'https://example.com');
|
||||
|
||||
response.statusCode;
|
||||
// 200
|
||||
response.headers;
|
||||
// { foo: 'bar' }
|
||||
response.body;
|
||||
// <Buffer 48 69 21>
|
||||
response.url;
|
||||
// 'https://example.com'
|
||||
|
||||
response.pipe(process.stdout);
|
||||
// Hi!
|
||||
```
|
||||
|
||||
|
||||
## API
|
||||
|
||||
### new Response(statusCode, headers, body, url)
|
||||
|
||||
Returns a streamable response object similar to a [Node.js HTTP response stream](https://nodejs.org/api/http.html#http_class_http_incomingmessage).
|
||||
|
||||
#### statusCode
|
||||
|
||||
Type: `number`
|
||||
|
||||
HTTP response status code.
|
||||
|
||||
#### headers
|
||||
|
||||
Type: `object`
|
||||
|
||||
HTTP headers object. Keys will be automatically lowercased.
|
||||
|
||||
#### body
|
||||
|
||||
Type: `buffer`
|
||||
|
||||
A Buffer containing the response body. The Buffer contents will be streamable but is also exposed directly as `response.body`.
|
||||
|
||||
#### url
|
||||
|
||||
Type: `string`
|
||||
|
||||
Request URL string.
|
||||
|
||||
## License
|
||||
|
||||
MIT © Luke Childs
|
||||
Reference in New Issue
Block a user