new license file version [CI SKIP]
This commit is contained in:
@@ -0,0 +1 @@
|
||||
module.exports={A:{A:{"1":"A B","2":"J D E F CC"},B:{"1":"C K L G M N O P Q R S T U V W X Y Z a b c d e i j k l m n o p q r s t u f H"},C:{"1":"0 1 2 3 4 5 6 7 8 9 tB I v J D E F A B C K L G M N O w g x y z AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB PB QB RB SB TB UB VB WB XB YB uB ZB vB aB bB cB dB eB fB gB hB iB jB kB h lB mB nB oB pB P Q R wB S T U V W X Y Z a b c d e i j k l m n o p q r s t u f H xB yB EC FC","2":"DC"},D:{"1":"0 1 2 3 4 5 6 7 8 9 E F A B C K L G M N O w g x y z AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB PB QB RB SB TB UB VB WB XB YB uB ZB vB aB bB cB dB eB fB gB hB iB jB kB h lB mB nB oB pB P Q R 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":"I","4":"v J D"},E:{"1":"J D E F A B C K L G JC KC LC 0B qB rB 1B MC NC 2B 3B 4B 5B sB 6B 7B 8B 9B OC","2":"I v HC zB IC"},F:{"1":"0 1 2 3 4 5 6 7 8 9 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 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 PC QC RC SC qB AC TC rB"},G:{"1":"E WC XC YC ZC aC bC cC dC eC fC gC hC iC jC kC lC mC nC 2B 3B 4B 5B sB 6B 7B 8B 9B","2":"zB UC BC VC"},H:{"1":"oC"},I:{"1":"f tC uC","2":"tB I pC qC rC sC BC"},J:{"1":"A","2":"D"},K:{"1":"A B C h qB AC rB"},L:{"1":"H"},M:{"1":"H"},N:{"1":"A B"},O:{"1":"vC"},P:{"1":"I g wC xC yC zC 0C 0B 1C 2C 3C 4C 5C sB 6C 7C 8C"},Q:{"1":"1B"},R:{"1":"9C"},S:{"1":"AD BD"}},B:2,C:"SVG filters"};
|
||||
@@ -0,0 +1,17 @@
|
||||
if(typeof cptable === 'undefined') cptable = {};
|
||||
cptable[57008] = (function(){ var d = [], e = {}, D = [], j;
|
||||
D[0] = "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007\b\t\n\u000b\f\r\u000e\u000f\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017\u0018\u0019\u001a\u001b\u001c\u001d\u001e\u001f !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~
<C29E><C29F>ಂಃಅಆಇಈಉಊಋಎಏಐಐಒಓಔಔಕಖಗಘಙಚಛಜಝಞಟಠಡಢಣತಥದಧನನಪಫಬಭಮಯಯರಱಲಳಳವಶಷಸಹ<E0B2B8>ಾಿೀುೂೃೆೇೈೈೊೋೌೌ್<E0B38C>.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>೦೧೨೩೪೫೬೭೮೯<E0B3AE><E0B3AF><EFBFBD><EFBFBD><EFBFBD>".split("");
|
||||
for(j = 0; j != D[0].length; ++j) if(D[0][j].charCodeAt(0) !== 0xFFFD) { e[D[0][j]] = 0 + j; d[0 + j] = D[0][j];}
|
||||
D[166] = "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ಌ<EFBFBD><E0B28C><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>".split("");
|
||||
for(j = 0; j != D[166].length; ++j) if(D[166][j].charCodeAt(0) !== 0xFFFD) { e[D[166][j]] = 42496 + j; d[42496 + j] = D[166][j];}
|
||||
D[167] = "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ೡ<EFBFBD><E0B3A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>".split("");
|
||||
for(j = 0; j != D[167].length; ++j) if(D[167][j].charCodeAt(0) !== 0xFFFD) { e[D[167][j]] = 42752 + j; d[42752 + j] = D[167][j];}
|
||||
D[170] = "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ೠ<EFBFBD><E0B3A0><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>".split("");
|
||||
for(j = 0; j != D[170].length; ++j) if(D[170][j].charCodeAt(0) !== 0xFFFD) { e[D[170][j]] = 43520 + j; d[43520 + j] = D[170][j];}
|
||||
D[201] = "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ೞ<EFBFBD><E0B39E><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>".split("");
|
||||
for(j = 0; j != D[201].length; ++j) if(D[201][j].charCodeAt(0) !== 0xFFFD) { e[D[201][j]] = 51456 + j; d[51456 + j] = D[201][j];}
|
||||
D[223] = "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ೄ<EFBFBD><E0B384><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>".split("");
|
||||
for(j = 0; j != D[223].length; ++j) if(D[223][j].charCodeAt(0) !== 0xFFFD) { e[D[223][j]] = 57088 + j; d[57088 + j] = D[223][j];}
|
||||
D[239] = "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>೯೯೯೯೯೯೯೯೯೯೯೯<E0B3AF><E0B3AF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>".split("");
|
||||
for(j = 0; j != D[239].length; ++j) if(D[239][j].charCodeAt(0) !== 0xFFFD) { e[D[239][j]] = 61184 + j; d[61184 + j] = D[239][j];}
|
||||
return {"enc": e, "dec": d }; })();
|
||||
@@ -0,0 +1,30 @@
|
||||
var eq = require('./eq');
|
||||
|
||||
/**
|
||||
* The base implementation of `_.sortedUniq` and `_.sortedUniqBy` without
|
||||
* support for iteratee shorthands.
|
||||
*
|
||||
* @private
|
||||
* @param {Array} array The array to inspect.
|
||||
* @param {Function} [iteratee] The iteratee invoked per element.
|
||||
* @returns {Array} Returns the new duplicate free array.
|
||||
*/
|
||||
function baseSortedUniq(array, iteratee) {
|
||||
var index = -1,
|
||||
length = array.length,
|
||||
resIndex = 0,
|
||||
result = [];
|
||||
|
||||
while (++index < length) {
|
||||
var value = array[index],
|
||||
computed = iteratee ? iteratee(value) : value;
|
||||
|
||||
if (!index || !eq(computed, seen)) {
|
||||
var seen = computed;
|
||||
result[resIndex++] = value === 0 ? 0 : value;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
module.exports = baseSortedUniq;
|
||||
@@ -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.00404,"48":0,"49":0,"50":0,"51":0,"52":0.00404,"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.02425,"74":0,"75":0,"76":0,"77":0,"78":0.00404,"79":0,"80":0.00404,"81":0.01213,"82":0.00404,"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.00404,"100":0,"101":0,"102":0.00808,"103":0,"104":0.10509,"105":0.00404,"106":0.00404,"107":0.00404,"108":0.01213,"109":0.24656,"110":0.14147,"111":0.00404,"112":0,"3.5":0,"3.6":0},D:{"4":0,"5":0,"6":0,"7":0,"8":0,"9":0,"10":0,"11":0,"12":0,"13":0,"14":0,"15":0,"16":0,"17":0,"18":0,"19":0,"20":0,"21":0,"22":0,"23":0,"24":0,"25":0,"26":0,"27":0,"28":0,"29":0,"30":0,"31":0,"32":0,"33":0,"34":0,"35":0,"36":0,"37":0,"38":0,"39":0,"40":0,"41":0,"42":0,"43":0,"44":0,"45":0,"46":0,"47":0.00808,"48":0.00808,"49":0.02829,"50":0,"51":0.00404,"52":0,"53":0,"54":0,"55":0,"56":0.00404,"57":0,"58":0,"59":0,"60":0,"61":0,"62":0,"63":0.00404,"64":0.00404,"65":0.00404,"66":0,"67":0,"68":0.00404,"69":0,"70":0.00404,"71":0,"72":0.00404,"73":0.00404,"74":0.00404,"75":0.00404,"76":0.06467,"77":0.00404,"78":0,"79":0.02829,"80":0.00404,"81":0.01617,"83":0.01213,"84":0.02021,"85":0.02829,"86":0.01617,"87":0.02829,"88":0.01213,"89":0.02021,"90":0.00808,"91":0.02021,"92":0.00404,"93":0.02425,"94":0.00808,"95":0.00808,"96":0.01213,"97":0.01213,"98":0.01213,"99":0.01617,"100":0.01213,"101":0.00808,"102":0.01213,"103":0.12126,"104":0.05255,"105":0.03638,"106":0.03234,"107":0.06871,"108":0.24656,"109":5.88515,"110":3.86415,"111":0.00404,"112":0.00404,"113":0},F:{"9":0,"11":0,"12":0,"15":0,"16":0,"17":0,"18":0,"19":0,"20":0,"21":0,"22":0,"23":0,"24":0,"25":0,"26":0,"27":0,"28":0.00404,"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.00808,"68":0,"69":0,"70":0,"71":0,"72":0,"73":0,"74":0,"75":0,"76":0,"77":0,"78":0,"79":0,"80":0,"81":0,"82":0,"83":0,"84":0,"85":0,"86":0,"87":0,"88":0,"89":0,"90":0.00404,"91":0,"92":0,"93":0.05659,"94":0.49717,"95":0.19402,"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.00404,"18":0.02425,"79":0,"80":0,"81":0,"83":0,"84":0.00404,"85":0.00404,"86":0,"87":0.00404,"88":0,"89":0,"90":0,"91":0,"92":0.01213,"93":0,"94":0,"95":0,"96":0,"97":0.00404,"98":0,"99":0,"100":0,"101":0,"102":0,"103":0.00404,"104":0.00404,"105":0.00404,"106":0.00404,"107":0.01617,"108":0.02829,"109":0.62247,"110":0.84882},E:{"4":0,"5":0,"6":0,"7":0,"8":0,"9":0,"10":0,"11":0,"12":0,"13":0.00404,"14":0.0485,"15":0.00808,_:"0","3.1":0,"3.2":0,"5.1":0.00808,"6.1":0,"7.1":0,"9.1":0,"10.1":0,"11.1":0,"12.1":0.00404,"13.1":0.05659,"14.1":0.05255,"15.1":0.00808,"15.2-15.3":0.00808,"15.4":0.02021,"15.5":0.06063,"15.6":0.21827,"16.0":0.03638,"16.1":0.08488,"16.2":0.24656,"16.3":0.18593,"16.4":0.00808},G:{"8":0,"3.2":0,"4.0-4.1":0,"4.2-4.3":0,"5.0-5.1":0,"6.0-6.1":0,"7.0-7.1":0.04682,"8.1-8.4":0.00624,"9.0-9.2":0,"9.3":0.04994,"10.0-10.2":0,"10.3":0.05618,"11.0-11.2":0.00312,"11.3-11.4":0.00624,"12.0-12.1":0.01561,"12.2-12.5":0.67415,"13.0-13.1":0.01248,"13.2":0.00624,"13.3":0.04057,"13.4-13.7":0.16542,"14.0-14.4":0.58676,"14.5-14.8":1.11109,"15.0-15.1":0.28089,"15.2-15.3":0.34956,"15.4":0.51497,"15.5":0.85829,"15.6":3.04926,"16.0":3.07735,"16.1":6.24833,"16.2":6.66655,"16.3":3.83576,"16.4":0.02497},P:{"4":0.1342,"20":0.48519,"5.0-5.4":0.01032,"6.2-6.4":0.01032,"7.2-7.4":0.10323,"8.2":0,"9.2":0.02065,"10.1":0,"11.1-11.2":0.08259,"12.0":0,"13.0":0.08259,"14.0":0.03097,"15.0":0.02065,"16.0":0.07226,"17.0":0.04129,"18.0":0.07226,"19.0":0.91877},I:{"0":0,"3":0,"4":0,"2.1":0,"2.2":0,"2.3":0,"4.1":0.01105,"4.2-4.3":0.09942,"4.4":0,"4.4.3-4.4.4":0.3314},K:{_:"0 10 11 12 11.1 11.5 12.1"},A:{"6":0.00472,"7":0,"8":0.01415,"9":0.00472,"10":0.00943,"11":0.02358,"5.5":0},N:{"10":0,"11":0},S:{"2.5":0,_:"3.0-3.1"},J:{"7":0,"10":0},O:{"0":0.0715},H:{"0":0.16922},L:{"0":52.66392},R:{_:"0"},M:{"0":0.35152},Q:{"13.1":0}};
|
||||
@@ -0,0 +1,33 @@
|
||||
var baseUpdate = require('./_baseUpdate'),
|
||||
castFunction = require('./_castFunction');
|
||||
|
||||
/**
|
||||
* This method is like `_.update` except that it accepts `customizer` which is
|
||||
* invoked to produce the objects of `path`. If `customizer` returns `undefined`
|
||||
* path creation is handled by the method instead. The `customizer` is invoked
|
||||
* with three arguments: (nsValue, key, nsObject).
|
||||
*
|
||||
* **Note:** This method mutates `object`.
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
* @since 4.6.0
|
||||
* @category Object
|
||||
* @param {Object} object The object to modify.
|
||||
* @param {Array|string} path The path of the property to set.
|
||||
* @param {Function} updater The function to produce the updated value.
|
||||
* @param {Function} [customizer] The function to customize assigned values.
|
||||
* @returns {Object} Returns `object`.
|
||||
* @example
|
||||
*
|
||||
* var object = {};
|
||||
*
|
||||
* _.updateWith(object, '[0][1]', _.constant('a'), Object);
|
||||
* // => { '0': { '1': 'a' } }
|
||||
*/
|
||||
function updateWith(object, path, updater, customizer) {
|
||||
customizer = typeof customizer == 'function' ? customizer : undefined;
|
||||
return object == null ? object : baseUpdate(object, path, castFunction(updater), customizer);
|
||||
}
|
||||
|
||||
module.exports = updateWith;
|
||||
@@ -0,0 +1,28 @@
|
||||
import { getXHRResponse } from './getXHRResponse';
|
||||
import { createErrorClass } from '../util/createErrorClass';
|
||||
export const AjaxError = createErrorClass((_super) => function AjaxErrorImpl(message, xhr, request) {
|
||||
this.message = message;
|
||||
this.name = 'AjaxError';
|
||||
this.xhr = xhr;
|
||||
this.request = request;
|
||||
this.status = xhr.status;
|
||||
this.responseType = xhr.responseType;
|
||||
let response;
|
||||
try {
|
||||
response = getXHRResponse(xhr);
|
||||
}
|
||||
catch (err) {
|
||||
response = xhr.responseText;
|
||||
}
|
||||
this.response = response;
|
||||
});
|
||||
export const AjaxTimeoutError = (() => {
|
||||
function AjaxTimeoutErrorImpl(xhr, request) {
|
||||
AjaxError.call(this, 'ajax timeout', xhr, request);
|
||||
this.name = 'AjaxTimeoutError';
|
||||
return this;
|
||||
}
|
||||
AjaxTimeoutErrorImpl.prototype = Object.create(AjaxError.prototype);
|
||||
return AjaxTimeoutErrorImpl;
|
||||
})();
|
||||
//# sourceMappingURL=errors.js.map
|
||||
@@ -0,0 +1,70 @@
|
||||
import { Subject } from '../Subject';
|
||||
import { asyncScheduler } from '../scheduler/async';
|
||||
import { Subscription } from '../Subscription';
|
||||
import { operate } from '../util/lift';
|
||||
import { createOperatorSubscriber } from './OperatorSubscriber';
|
||||
import { arrRemove } from '../util/arrRemove';
|
||||
import { popScheduler } from '../util/args';
|
||||
import { executeSchedule } from '../util/executeSchedule';
|
||||
export function windowTime(windowTimeSpan) {
|
||||
var _a, _b;
|
||||
var otherArgs = [];
|
||||
for (var _i = 1; _i < arguments.length; _i++) {
|
||||
otherArgs[_i - 1] = arguments[_i];
|
||||
}
|
||||
var scheduler = (_a = popScheduler(otherArgs)) !== null && _a !== void 0 ? _a : asyncScheduler;
|
||||
var windowCreationInterval = (_b = otherArgs[0]) !== null && _b !== void 0 ? _b : null;
|
||||
var maxWindowSize = otherArgs[1] || Infinity;
|
||||
return operate(function (source, subscriber) {
|
||||
var windowRecords = [];
|
||||
var restartOnClose = false;
|
||||
var closeWindow = function (record) {
|
||||
var window = record.window, subs = record.subs;
|
||||
window.complete();
|
||||
subs.unsubscribe();
|
||||
arrRemove(windowRecords, record);
|
||||
restartOnClose && startWindow();
|
||||
};
|
||||
var startWindow = function () {
|
||||
if (windowRecords) {
|
||||
var subs = new Subscription();
|
||||
subscriber.add(subs);
|
||||
var window_1 = new Subject();
|
||||
var record_1 = {
|
||||
window: window_1,
|
||||
subs: subs,
|
||||
seen: 0,
|
||||
};
|
||||
windowRecords.push(record_1);
|
||||
subscriber.next(window_1.asObservable());
|
||||
executeSchedule(subs, scheduler, function () { return closeWindow(record_1); }, windowTimeSpan);
|
||||
}
|
||||
};
|
||||
if (windowCreationInterval !== null && windowCreationInterval >= 0) {
|
||||
executeSchedule(subscriber, scheduler, startWindow, windowCreationInterval, true);
|
||||
}
|
||||
else {
|
||||
restartOnClose = true;
|
||||
}
|
||||
startWindow();
|
||||
var loop = function (cb) { return windowRecords.slice().forEach(cb); };
|
||||
var terminate = function (cb) {
|
||||
loop(function (_a) {
|
||||
var window = _a.window;
|
||||
return cb(window);
|
||||
});
|
||||
cb(subscriber);
|
||||
subscriber.unsubscribe();
|
||||
};
|
||||
source.subscribe(createOperatorSubscriber(subscriber, function (value) {
|
||||
loop(function (record) {
|
||||
record.window.next(value);
|
||||
maxWindowSize <= ++record.seen && closeWindow(record);
|
||||
});
|
||||
}, function () { return terminate(function (consumer) { return consumer.complete(); }); }, function (err) { return terminate(function (consumer) { return consumer.error(err); }); }));
|
||||
return function () {
|
||||
windowRecords = null;
|
||||
};
|
||||
});
|
||||
}
|
||||
//# sourceMappingURL=windowTime.js.map
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,5 @@
|
||||
import { bindCallbackInternals } from './bindCallbackInternals';
|
||||
export function bindCallback(callbackFunc, resultSelector, scheduler) {
|
||||
return bindCallbackInternals(false, callbackFunc, resultSelector, scheduler);
|
||||
}
|
||||
//# sourceMappingURL=bindCallback.js.map
|
||||
@@ -0,0 +1,203 @@
|
||||
import { BLAKE2, BlakeOpts, SIGMA } from './_blake2.js';
|
||||
import u64 from './_u64.js';
|
||||
import { toBytes, u32, wrapConstructorWithOpts } from './utils.js';
|
||||
|
||||
// Same as SHA-512 but LE
|
||||
// prettier-ignore
|
||||
const IV = new Uint32Array([
|
||||
0xf3bcc908, 0x6a09e667, 0x84caa73b, 0xbb67ae85, 0xfe94f82b, 0x3c6ef372, 0x5f1d36f1, 0xa54ff53a,
|
||||
0xade682d1, 0x510e527f, 0x2b3e6c1f, 0x9b05688c, 0xfb41bd6b, 0x1f83d9ab, 0x137e2179, 0x5be0cd19
|
||||
]);
|
||||
// Temporary buffer
|
||||
const BUF = new Uint32Array(32);
|
||||
|
||||
// Mixing function G splitted in two halfs
|
||||
function G1(a: number, b: number, c: number, d: number, msg: Uint32Array, x: number) {
|
||||
// NOTE: V is LE here
|
||||
const Xl = msg[x], Xh = msg[x + 1]; // prettier-ignore
|
||||
let Al = BUF[2 * a], Ah = BUF[2 * a + 1]; // prettier-ignore
|
||||
let Bl = BUF[2 * b], Bh = BUF[2 * b + 1]; // prettier-ignore
|
||||
let Cl = BUF[2 * c], Ch = BUF[2 * c + 1]; // prettier-ignore
|
||||
let Dl = BUF[2 * d], Dh = BUF[2 * d + 1]; // prettier-ignore
|
||||
// v[a] = (v[a] + v[b] + x) | 0;
|
||||
let ll = u64.add3L(Al, Bl, Xl);
|
||||
Ah = u64.add3H(ll, Ah, Bh, Xh);
|
||||
Al = ll | 0;
|
||||
// v[d] = rotr(v[d] ^ v[a], 32)
|
||||
({ Dh, Dl } = { Dh: Dh ^ Ah, Dl: Dl ^ Al });
|
||||
({ Dh, Dl } = { Dh: u64.rotr32H(Dh, Dl), Dl: u64.rotr32L(Dh, Dl) });
|
||||
// v[c] = (v[c] + v[d]) | 0;
|
||||
({ h: Ch, l: Cl } = u64.add(Ch, Cl, Dh, Dl));
|
||||
// v[b] = rotr(v[b] ^ v[c], 24)
|
||||
({ Bh, Bl } = { Bh: Bh ^ Ch, Bl: Bl ^ Cl });
|
||||
({ Bh, Bl } = { Bh: u64.rotrSH(Bh, Bl, 24), Bl: u64.rotrSL(Bh, Bl, 24) });
|
||||
(BUF[2 * a] = Al), (BUF[2 * a + 1] = Ah);
|
||||
(BUF[2 * b] = Bl), (BUF[2 * b + 1] = Bh);
|
||||
(BUF[2 * c] = Cl), (BUF[2 * c + 1] = Ch);
|
||||
(BUF[2 * d] = Dl), (BUF[2 * d + 1] = Dh);
|
||||
}
|
||||
|
||||
function G2(a: number, b: number, c: number, d: number, msg: Uint32Array, x: number) {
|
||||
// NOTE: V is LE here
|
||||
const Xl = msg[x], Xh = msg[x + 1]; // prettier-ignore
|
||||
let Al = BUF[2 * a], Ah = BUF[2 * a + 1]; // prettier-ignore
|
||||
let Bl = BUF[2 * b], Bh = BUF[2 * b + 1]; // prettier-ignore
|
||||
let Cl = BUF[2 * c], Ch = BUF[2 * c + 1]; // prettier-ignore
|
||||
let Dl = BUF[2 * d], Dh = BUF[2 * d + 1]; // prettier-ignore
|
||||
// v[a] = (v[a] + v[b] + x) | 0;
|
||||
let ll = u64.add3L(Al, Bl, Xl);
|
||||
Ah = u64.add3H(ll, Ah, Bh, Xh);
|
||||
Al = ll | 0;
|
||||
// v[d] = rotr(v[d] ^ v[a], 16)
|
||||
({ Dh, Dl } = { Dh: Dh ^ Ah, Dl: Dl ^ Al });
|
||||
({ Dh, Dl } = { Dh: u64.rotrSH(Dh, Dl, 16), Dl: u64.rotrSL(Dh, Dl, 16) });
|
||||
// v[c] = (v[c] + v[d]) | 0;
|
||||
({ h: Ch, l: Cl } = u64.add(Ch, Cl, Dh, Dl));
|
||||
// v[b] = rotr(v[b] ^ v[c], 63)
|
||||
({ Bh, Bl } = { Bh: Bh ^ Ch, Bl: Bl ^ Cl });
|
||||
({ Bh, Bl } = { Bh: u64.rotrBH(Bh, Bl, 63), Bl: u64.rotrBL(Bh, Bl, 63) });
|
||||
(BUF[2 * a] = Al), (BUF[2 * a + 1] = Ah);
|
||||
(BUF[2 * b] = Bl), (BUF[2 * b + 1] = Bh);
|
||||
(BUF[2 * c] = Cl), (BUF[2 * c + 1] = Ch);
|
||||
(BUF[2 * d] = Dl), (BUF[2 * d + 1] = Dh);
|
||||
}
|
||||
|
||||
class BLAKE2b extends BLAKE2<BLAKE2b> {
|
||||
// Same as SHA-512, but LE
|
||||
private v0l = IV[0] | 0;
|
||||
private v0h = IV[1] | 0;
|
||||
private v1l = IV[2] | 0;
|
||||
private v1h = IV[3] | 0;
|
||||
private v2l = IV[4] | 0;
|
||||
private v2h = IV[5] | 0;
|
||||
private v3l = IV[6] | 0;
|
||||
private v3h = IV[7] | 0;
|
||||
private v4l = IV[8] | 0;
|
||||
private v4h = IV[9] | 0;
|
||||
private v5l = IV[10] | 0;
|
||||
private v5h = IV[11] | 0;
|
||||
private v6l = IV[12] | 0;
|
||||
private v6h = IV[13] | 0;
|
||||
private v7l = IV[14] | 0;
|
||||
private v7h = IV[15] | 0;
|
||||
|
||||
constructor(opts: BlakeOpts = {}) {
|
||||
super(128, opts.dkLen === undefined ? 64 : opts.dkLen, opts, 64, 16, 16);
|
||||
const keyLength = opts.key ? opts.key.length : 0;
|
||||
this.v0l ^= this.outputLen | (keyLength << 8) | (0x01 << 16) | (0x01 << 24);
|
||||
if (opts.salt) {
|
||||
const salt = u32(toBytes(opts.salt));
|
||||
this.v4l ^= salt[0];
|
||||
this.v4h ^= salt[1];
|
||||
this.v5l ^= salt[2];
|
||||
this.v5h ^= salt[3];
|
||||
}
|
||||
if (opts.personalization) {
|
||||
const pers = u32(toBytes(opts.personalization));
|
||||
this.v6l ^= pers[0];
|
||||
this.v6h ^= pers[1];
|
||||
this.v7l ^= pers[2];
|
||||
this.v7h ^= pers[3];
|
||||
}
|
||||
if (opts.key) {
|
||||
// Pad to blockLen and update
|
||||
const tmp = new Uint8Array(this.blockLen);
|
||||
tmp.set(toBytes(opts.key));
|
||||
this.update(tmp);
|
||||
}
|
||||
}
|
||||
// prettier-ignore
|
||||
protected get(): [
|
||||
number, number, number, number, number, number, number, number,
|
||||
number, number, number, number, number, number, number, number
|
||||
] {
|
||||
let {v0l, v0h, v1l, v1h, v2l, v2h, v3l, v3h, v4l, v4h, v5l, v5h, v6l, v6h, v7l, v7h} = this;
|
||||
return [v0l, v0h, v1l, v1h, v2l, v2h, v3l, v3h, v4l, v4h, v5l, v5h, v6l, v6h, v7l, v7h];
|
||||
}
|
||||
// prettier-ignore
|
||||
protected set(
|
||||
v0l: number, v0h: number, v1l: number, v1h: number,
|
||||
v2l: number, v2h: number, v3l: number, v3h: number,
|
||||
v4l: number, v4h: number, v5l: number, v5h: number,
|
||||
v6l: number, v6h: number, v7l: number, v7h: number
|
||||
) {
|
||||
this.v0l = v0l | 0;
|
||||
this.v0h = v0h | 0;
|
||||
this.v1l = v1l | 0;
|
||||
this.v1h = v1h | 0;
|
||||
this.v2l = v2l | 0;
|
||||
this.v2h = v2h | 0;
|
||||
this.v3l = v3l | 0;
|
||||
this.v3h = v3h | 0;
|
||||
this.v4l = v4l | 0;
|
||||
this.v4h = v4h | 0;
|
||||
this.v5l = v5l | 0;
|
||||
this.v5h = v5h | 0;
|
||||
this.v6l = v6l | 0;
|
||||
this.v6h = v6h | 0;
|
||||
this.v7l = v7l | 0;
|
||||
this.v7h = v7h | 0;
|
||||
}
|
||||
protected compress(msg: Uint32Array, offset: number, isLast: boolean) {
|
||||
this.get().forEach((v, i) => (BUF[i] = v)); // First half from state.
|
||||
BUF.set(IV, 16); // Second half from IV.
|
||||
let { h, l } = u64.fromBig(BigInt(this.length));
|
||||
BUF[24] = IV[8] ^ l; // Low word of the offset.
|
||||
BUF[25] = IV[9] ^ h; // High word.
|
||||
// Invert all bits for last block
|
||||
if (isLast) {
|
||||
BUF[28] = ~BUF[28];
|
||||
BUF[29] = ~BUF[29];
|
||||
}
|
||||
let j = 0;
|
||||
const s = SIGMA;
|
||||
for (let i = 0; i < 12; i++) {
|
||||
G1(0, 4, 8, 12, msg, offset + 2 * s[j++]);
|
||||
G2(0, 4, 8, 12, msg, offset + 2 * s[j++]);
|
||||
G1(1, 5, 9, 13, msg, offset + 2 * s[j++]);
|
||||
G2(1, 5, 9, 13, msg, offset + 2 * s[j++]);
|
||||
G1(2, 6, 10, 14, msg, offset + 2 * s[j++]);
|
||||
G2(2, 6, 10, 14, msg, offset + 2 * s[j++]);
|
||||
G1(3, 7, 11, 15, msg, offset + 2 * s[j++]);
|
||||
G2(3, 7, 11, 15, msg, offset + 2 * s[j++]);
|
||||
|
||||
G1(0, 5, 10, 15, msg, offset + 2 * s[j++]);
|
||||
G2(0, 5, 10, 15, msg, offset + 2 * s[j++]);
|
||||
G1(1, 6, 11, 12, msg, offset + 2 * s[j++]);
|
||||
G2(1, 6, 11, 12, msg, offset + 2 * s[j++]);
|
||||
G1(2, 7, 8, 13, msg, offset + 2 * s[j++]);
|
||||
G2(2, 7, 8, 13, msg, offset + 2 * s[j++]);
|
||||
G1(3, 4, 9, 14, msg, offset + 2 * s[j++]);
|
||||
G2(3, 4, 9, 14, msg, offset + 2 * s[j++]);
|
||||
}
|
||||
this.v0l ^= BUF[0] ^ BUF[16];
|
||||
this.v0h ^= BUF[1] ^ BUF[17];
|
||||
this.v1l ^= BUF[2] ^ BUF[18];
|
||||
this.v1h ^= BUF[3] ^ BUF[19];
|
||||
this.v2l ^= BUF[4] ^ BUF[20];
|
||||
this.v2h ^= BUF[5] ^ BUF[21];
|
||||
this.v3l ^= BUF[6] ^ BUF[22];
|
||||
this.v3h ^= BUF[7] ^ BUF[23];
|
||||
this.v4l ^= BUF[8] ^ BUF[24];
|
||||
this.v4h ^= BUF[9] ^ BUF[25];
|
||||
this.v5l ^= BUF[10] ^ BUF[26];
|
||||
this.v5h ^= BUF[11] ^ BUF[27];
|
||||
this.v6l ^= BUF[12] ^ BUF[28];
|
||||
this.v6h ^= BUF[13] ^ BUF[29];
|
||||
this.v7l ^= BUF[14] ^ BUF[30];
|
||||
this.v7h ^= BUF[15] ^ BUF[31];
|
||||
BUF.fill(0);
|
||||
}
|
||||
destroy() {
|
||||
this.destroyed = true;
|
||||
this.buffer32.fill(0);
|
||||
this.set(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* BLAKE2b - optimized for 64-bit platforms. JS doesn't have uint64, so it's slower than BLAKE2s.
|
||||
* @param msg - message that would be hashed
|
||||
* @param opts - dkLen, key, salt, personalization
|
||||
*/
|
||||
export const blake2b = wrapConstructorWithOpts<BLAKE2b, BlakeOpts>((opts) => new BLAKE2b(opts));
|
||||
@@ -0,0 +1,76 @@
|
||||
var inspect = require('../');
|
||||
var test = require('tape');
|
||||
var arrow = require('make-arrow-function')();
|
||||
var functionsHaveConfigurableNames = require('functions-have-names').functionsHaveConfigurableNames();
|
||||
|
||||
test('function', function (t) {
|
||||
t.plan(1);
|
||||
var obj = [1, 2, function f(n) { return n; }, 4];
|
||||
t.equal(inspect(obj), '[ 1, 2, [Function: f], 4 ]');
|
||||
});
|
||||
|
||||
test('function name', function (t) {
|
||||
t.plan(1);
|
||||
var f = (function () {
|
||||
return function () {};
|
||||
}());
|
||||
f.toString = function toStr() { return 'function xxx () {}'; };
|
||||
var obj = [1, 2, f, 4];
|
||||
t.equal(inspect(obj), '[ 1, 2, [Function (anonymous)] { toString: [Function: toStr] }, 4 ]');
|
||||
});
|
||||
|
||||
test('anon function', function (t) {
|
||||
var f = (function () {
|
||||
return function () {};
|
||||
}());
|
||||
var obj = [1, 2, f, 4];
|
||||
t.equal(inspect(obj), '[ 1, 2, [Function (anonymous)], 4 ]');
|
||||
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('arrow function', { skip: !arrow }, function (t) {
|
||||
t.equal(inspect(arrow), '[Function (anonymous)]');
|
||||
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('truly nameless function', { skip: !arrow || !functionsHaveConfigurableNames }, function (t) {
|
||||
function f() {}
|
||||
Object.defineProperty(f, 'name', { value: false });
|
||||
t.equal(f.name, false);
|
||||
t.equal(
|
||||
inspect(f),
|
||||
'[Function: f]',
|
||||
'named function with falsy `.name` does not hide its original name'
|
||||
);
|
||||
|
||||
function g() {}
|
||||
Object.defineProperty(g, 'name', { value: true });
|
||||
t.equal(g.name, true);
|
||||
t.equal(
|
||||
inspect(g),
|
||||
'[Function: true]',
|
||||
'named function with truthy `.name` hides its original name'
|
||||
);
|
||||
|
||||
var anon = function () {}; // eslint-disable-line func-style
|
||||
Object.defineProperty(anon, 'name', { value: null });
|
||||
t.equal(anon.name, null);
|
||||
t.equal(
|
||||
inspect(anon),
|
||||
'[Function (anonymous)]',
|
||||
'anon function with falsy `.name` does not hide its anonymity'
|
||||
);
|
||||
|
||||
var anon2 = function () {}; // eslint-disable-line func-style
|
||||
Object.defineProperty(anon2, 'name', { value: 1 });
|
||||
t.equal(anon2.name, 1);
|
||||
t.equal(
|
||||
inspect(anon2),
|
||||
'[Function: 1]',
|
||||
'anon function with truthy `.name` hides its anonymity'
|
||||
);
|
||||
|
||||
t.end();
|
||||
});
|
||||
@@ -0,0 +1 @@
|
||||
module.exports={C:{"2":0.0063,"3":0,"4":0.0063,"5":0,"6":0.0063,"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.0063,"20":0.0063,"21":0,"22":0.0063,"23":0,"24":0,"25":0.0063,"26":0,"27":0,"28":0.0063,"29":0,"30":0,"31":0.0063,"32":0,"33":0,"34":0.0126,"35":0,"36":0.0063,"37":0,"38":0.0063,"39":0,"40":0.0315,"41":0,"42":0,"43":0,"44":0,"45":0,"46":0,"47":0,"48":0,"49":0,"50":0,"51":0,"52":0,"53":0,"54":0,"55":0,"56":0,"57":0,"58":0,"59":0,"60":0,"61":0,"62":0,"63":0,"64":0,"65":0,"66":0,"67":0,"68":0,"69":0,"70":0,"71":0,"72":0,"73":0,"74":0,"75":0,"76":0,"77":0.0063,"78":0.0063,"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.0063,"92":0,"93":0,"94":0,"95":0.0063,"96":0,"97":0,"98":0,"99":0,"100":0.0315,"101":0.0189,"102":0.0504,"103":0,"104":0,"105":0,"106":0.0126,"107":0.0126,"108":0.0504,"109":2.898,"110":1.9152,"111":0.0189,"112":0,"3.5":0.0189,"3.6":0.0063},D:{"4":0,"5":0,"6":0.0126,"7":0,"8":0,"9":0,"10":0,"11":0,"12":0,"13":0.0063,"14":0,"15":0,"16":0.0126,"17":0,"18":0,"19":0.0063,"20":0,"21":0,"22":0.0063,"23":0,"24":0,"25":0,"26":0.0063,"27":0.0063,"28":0.0063,"29":0,"30":0,"31":0.0126,"32":0.0063,"33":0,"34":0,"35":0,"36":0,"37":0.0063,"38":0,"39":0,"40":0,"41":0.0189,"42":0,"43":0.0315,"44":0.0441,"45":0.0378,"46":0.0252,"47":0.0063,"48":0,"49":0.1953,"50":0,"51":0.0252,"52":0,"53":0,"54":0,"55":0,"56":0,"57":0,"58":0,"59":0,"60":0,"61":0,"62":0,"63":0,"64":0,"65":0,"66":0,"67":0,"68":0,"69":0,"70":0,"71":0,"72":0,"73":0,"74":0,"75":0,"76":0,"77":0.0126,"78":0,"79":0.0819,"80":0,"81":0,"83":0,"84":0.1008,"85":0.0063,"86":0,"87":0,"88":0,"89":0,"90":0,"91":0.0126,"92":0.0252,"93":0,"94":0,"95":0,"96":0,"97":0.0252,"98":0.0063,"99":0.0063,"100":0.0126,"101":0,"102":0.0063,"103":0.0945,"104":0.0252,"105":1.5435,"106":0.5922,"107":0.0504,"108":0.4158,"109":9.2421,"110":6.4071,"111":0,"112":0,"113":0},F:{"9":0,"11":0,"12":0,"15":0,"16":0,"17":0,"18":0,"19":0,"20":0,"21":0,"22":0,"23":0,"24":0.0063,"25":0,"26":0,"27":0,"28":0,"29":0,"30":0.0063,"31":0.0063,"32":0.0063,"33":0,"34":0,"35":0,"36":0,"37":0,"38":0,"39":0,"40":0,"41":0,"42":0,"43":0,"44":0,"45":0,"46":0,"47":0,"48":0,"49":0,"50":0,"51":0,"52":0,"53":0,"54":0,"55":0,"56":0,"57":0,"58":0,"60":0,"62":0,"63":0,"64":0,"65":0,"66":0,"67":0,"68":0,"69":0,"70":0,"71":0,"72":0,"73":0,"74":0,"75":0,"76":0,"77":0,"78":0,"79":0,"80":0,"81":0,"82":0,"83":0,"84":0,"85":0,"86":0,"87":0,"88":0,"89":0,"90":0,"91":0.0252,"92":0,"93":0.252,"94":1.3167,"95":0.2268,"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.0189},B:{"12":0.0126,"13":0.0063,"14":0.0126,"15":0,"16":0,"17":0,"18":0,"79":0,"80":0,"81":0,"83":0,"84":0,"85":0,"86":0,"87":0,"88":0,"89":0,"90":0,"91":0,"92":0.0063,"93":0,"94":0,"95":0,"96":0,"97":0,"98":0.0315,"99":0,"100":0,"101":0,"102":0,"103":0,"104":0.0063,"105":0.0063,"106":0.0189,"107":0.3087,"108":0.4851,"109":2.268,"110":4.3911},E:{"4":0.0063,"5":0.0063,"6":0,"7":0,"8":0.0063,"9":0.0252,"10":0,"11":0,"12":0.0063,"13":0.2016,"14":0.1638,"15":0.063,_:"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.0189,"13.1":0.5166,"14.1":0.441,"15.1":0.063,"15.2-15.3":0.0882,"15.4":0.0378,"15.5":0.1386,"15.6":0.7875,"16.0":0.2079,"16.1":0.4032,"16.2":0.4788,"16.3":0.7434,"16.4":0},G:{"8":0,"3.2":0,"4.0-4.1":0,"4.2-4.3":0,"5.0-5.1":0,"6.0-6.1":0.00682,"7.0-7.1":0.05458,"8.1-8.4":0.1501,"9.0-9.2":0.01365,"9.3":0.20469,"10.0-10.2":0,"10.3":0.09552,"11.0-11.2":0.22516,"11.3-11.4":0.02047,"12.0-12.1":0.04094,"12.2-12.5":0.23198,"13.0-13.1":0.05458,"13.2":0.02388,"13.3":0,"13.4-13.7":0.01365,"14.0-14.4":0.24562,"14.5-14.8":1.63408,"15.0-15.1":0.19445,"15.2-15.3":0.15693,"15.4":0.23539,"15.5":0.49466,"15.6":4.08008,"16.0":2.61316,"16.1":9.38146,"16.2":9.14607,"16.3":4.12102,"16.4":0.01706},P:{"4":0.10245,"20":2.10016,"5.0-5.4":0,"6.2-6.4":0.02049,"7.2-7.4":0,"8.2":0,"9.2":0,"10.1":0,"11.1-11.2":0,"12.0":0,"13.0":0,"14.0":0,"15.0":0,"16.0":0,"17.0":0,"18.0":0.01024,"19.0":1.71086},I:{"0":0,"3":0,"4":0.08706,"2.1":0.0068,"2.2":0.08434,"2.3":0.04761,"4.1":0.07482,"4.2-4.3":0.10203,"4.4":0,"4.4.3-4.4.4":0.29384},K:{_:"0 10 11 12 11.1 11.5 12.1"},A:{"6":0.0126,"7":0.0252,"8":0.189,"9":0.0378,"10":0.0441,"11":0.1386,"5.5":0},N:{"10":0.0259,"11":0.0777},S:{"2.5":0.0148,_:"3.0-3.1"},J:{"7":0,"10":0.0111},O:{"0":0.0518},H:{"0":1.01935},L:{"0":17.9344},R:{_:"0"},M:{"0":0.3959},Q:{"13.1":0}};
|
||||
@@ -0,0 +1,7 @@
|
||||
export type RunnerGroup = {
|
||||
id: number;
|
||||
name: string;
|
||||
contact?: any;
|
||||
distance: number;
|
||||
distanceDonationAmount: number;
|
||||
};
|
||||
@@ -0,0 +1 @@
|
||||
{"name":"@paralleldrive/cuid2","version":"2.2.0","files":{"LICENSE":{"checkedAt":1678883668662,"integrity":"sha512-mb59xxE2EdbtdIfgG7IByexQ7Bxk9cUXQz+MRebF5kaZsg5zHEi+DBaX7wJytF9mILbhFoeSddj7QPdAbR3CBA==","mode":420,"size":1069},"index.js":{"checkedAt":1678883668662,"integrity":"sha512-WN1cBJuXbztbEAqISaX9Q1mgnzpBEzRE/nCkXin0LT3nQ6Ilk1Vf0kpj0ra/KbDwW+m7DyOzVmErQjrIyIRwWw==","mode":420,"size":214},"src/index.js":{"checkedAt":1678883668662,"integrity":"sha512-OTmrz7dl5tSxZ9iUghx6pGRdJi8Cz/rkx0Yy1yenbYwlh2V+86OMsFpQOc6owuvLrK4kZ7R8Wanvibd0gCDZvw==","mode":420,"size":3564},"package.json":{"checkedAt":1678883668662,"integrity":"sha512-QrSEBaEFNFl/q3Suk2aIwSOIxC/9RojaJbzOUnTtSR2dbWqt4mvNTrbTqoR69qLoRqPewmEE9DKUo9VsdcWWmw==","mode":420,"size":1874},"index.d.ts":{"checkedAt":1678883668674,"integrity":"sha512-ujMjWqo8c3GtrJvoB7x+/1qx26BzQzL0JB+pdDjrKtuIxJx2sE0dhi3bD0LI12/juwKe1YbWkwL8Tt62wdHfAQ==","mode":420,"size":345},"README.md":{"checkedAt":1678883668674,"integrity":"sha512-fT2uPIEOJ600j14kpLWqe8h5rCIvtD6Pr/VKqcc9+WF4dnMZCQMxnoLDUCWYGFeqXvvQ2b3DLvjj42GLuNdbfA==","mode":420,"size":24017}}}
|
||||
@@ -0,0 +1,38 @@
|
||||
define(['exports', 'module', '../utils', '../exception'], function (exports, module, _utils, _exception) {
|
||||
'use strict';
|
||||
|
||||
// istanbul ignore next
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
||||
|
||||
var _Exception = _interopRequireDefault(_exception);
|
||||
|
||||
module.exports = function (instance) {
|
||||
instance.registerHelper('with', function (context, options) {
|
||||
if (arguments.length != 2) {
|
||||
throw new _Exception['default']('#with requires exactly one argument');
|
||||
}
|
||||
if (_utils.isFunction(context)) {
|
||||
context = context.call(this);
|
||||
}
|
||||
|
||||
var fn = options.fn;
|
||||
|
||||
if (!_utils.isEmpty(context)) {
|
||||
var data = options.data;
|
||||
if (options.data && options.ids) {
|
||||
data = _utils.createFrame(options.data);
|
||||
data.contextPath = _utils.appendContextPath(options.data.contextPath, options.ids[0]);
|
||||
}
|
||||
|
||||
return fn(context, {
|
||||
data: data,
|
||||
blockParams: _utils.blockParams([context], [data && data.contextPath])
|
||||
});
|
||||
} else {
|
||||
return options.inverse(this);
|
||||
}
|
||||
});
|
||||
};
|
||||
});
|
||||
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uL2xpYi9oYW5kbGViYXJzL2hlbHBlcnMvd2l0aC5qcyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7bUJBU2UsVUFBUyxRQUFRLEVBQUU7QUFDaEMsWUFBUSxDQUFDLGNBQWMsQ0FBQyxNQUFNLEVBQUUsVUFBUyxPQUFPLEVBQUUsT0FBTyxFQUFFO0FBQ3pELFVBQUksU0FBUyxDQUFDLE1BQU0sSUFBSSxDQUFDLEVBQUU7QUFDekIsY0FBTSwwQkFBYyxxQ0FBcUMsQ0FBQyxDQUFDO09BQzVEO0FBQ0QsVUFBSSxPQVROLFVBQVUsQ0FTTyxPQUFPLENBQUMsRUFBRTtBQUN2QixlQUFPLEdBQUcsT0FBTyxDQUFDLElBQUksQ0FBQyxJQUFJLENBQUMsQ0FBQztPQUM5Qjs7QUFFRCxVQUFJLEVBQUUsR0FBRyxPQUFPLENBQUMsRUFBRSxDQUFDOztBQUVwQixVQUFJLENBQUMsT0FoQlAsT0FBTyxDQWdCUSxPQUFPLENBQUMsRUFBRTtBQUNyQixZQUFJLElBQUksR0FBRyxPQUFPLENBQUMsSUFBSSxDQUFDO0FBQ3hCLFlBQUksT0FBTyxDQUFDLElBQUksSUFBSSxPQUFPLENBQUMsR0FBRyxFQUFFO0FBQy9CLGNBQUksR0FBRyxPQXBCYixXQUFXLENBb0JjLE9BQU8sQ0FBQyxJQUFJLENBQUMsQ0FBQztBQUNqQyxjQUFJLENBQUMsV0FBVyxHQUFHLE9BdkJ6QixpQkFBaUIsQ0F3QlQsT0FBTyxDQUFDLElBQUksQ0FBQyxXQUFXLEVBQ3hCLE9BQU8sQ0FBQyxHQUFHLENBQUMsQ0FBQyxDQUFDLENBQ2YsQ0FBQztTQUNIOztBQUVELGVBQU8sRUFBRSxDQUFDLE9BQU8sRUFBRTtBQUNqQixjQUFJLEVBQUUsSUFBSTtBQUNWLHFCQUFXLEVBQUUsT0E5Qm5CLFdBQVcsQ0E4Qm9CLENBQUMsT0FBTyxDQUFDLEVBQUUsQ0FBQyxJQUFJLElBQUksSUFBSSxDQUFDLFdBQVcsQ0FBQyxDQUFDO1NBQ2hFLENBQUMsQ0FBQztPQUNKLE1BQU07QUFDTCxlQUFPLE9BQU8sQ0FBQyxPQUFPLENBQUMsSUFBSSxDQUFDLENBQUM7T0FDOUI7S0FDRixDQUFDLENBQUM7R0FDSiIsImZpbGUiOiJ3aXRoLmpzIiwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IHtcbiAgYXBwZW5kQ29udGV4dFBhdGgsXG4gIGJsb2NrUGFyYW1zLFxuICBjcmVhdGVGcmFtZSxcbiAgaXNFbXB0eSxcbiAgaXNGdW5jdGlvblxufSBmcm9tICcuLi91dGlscyc7XG5pbXBvcnQgRXhjZXB0aW9uIGZyb20gJy4uL2V4Y2VwdGlvbic7XG5cbmV4cG9ydCBkZWZhdWx0IGZ1bmN0aW9uKGluc3RhbmNlKSB7XG4gIGluc3RhbmNlLnJlZ2lzdGVySGVscGVyKCd3aXRoJywgZnVuY3Rpb24oY29udGV4dCwgb3B0aW9ucykge1xuICAgIGlmIChhcmd1bWVudHMubGVuZ3RoICE9IDIpIHtcbiAgICAgIHRocm93IG5ldyBFeGNlcHRpb24oJyN3aXRoIHJlcXVpcmVzIGV4YWN0bHkgb25lIGFyZ3VtZW50Jyk7XG4gICAgfVxuICAgIGlmIChpc0Z1bmN0aW9uKGNvbnRleHQpKSB7XG4gICAgICBjb250ZXh0ID0gY29udGV4dC5jYWxsKHRoaXMpO1xuICAgIH1cblxuICAgIGxldCBmbiA9IG9wdGlvbnMuZm47XG5cbiAgICBpZiAoIWlzRW1wdHkoY29udGV4dCkpIHtcbiAgICAgIGxldCBkYXRhID0gb3B0aW9ucy5kYXRhO1xuICAgICAgaWYgKG9wdGlvbnMuZGF0YSAmJiBvcHRpb25zLmlkcykge1xuICAgICAgICBkYXRhID0gY3JlYXRlRnJhbWUob3B0aW9ucy5kYXRhKTtcbiAgICAgICAgZGF0YS5jb250ZXh0UGF0aCA9IGFwcGVuZENvbnRleHRQYXRoKFxuICAgICAgICAgIG9wdGlvbnMuZGF0YS5jb250ZXh0UGF0aCxcbiAgICAgICAgICBvcHRpb25zLmlkc1swXVxuICAgICAgICApO1xuICAgICAgfVxuXG4gICAgICByZXR1cm4gZm4oY29udGV4dCwge1xuICAgICAgICBkYXRhOiBkYXRhLFxuICAgICAgICBibG9ja1BhcmFtczogYmxvY2tQYXJhbXMoW2NvbnRleHRdLCBbZGF0YSAmJiBkYXRhLmNvbnRleHRQYXRoXSlcbiAgICAgIH0pO1xuICAgIH0gZWxzZSB7XG4gICAgICByZXR1cm4gb3B0aW9ucy5pbnZlcnNlKHRoaXMpO1xuICAgIH1cbiAgfSk7XG59XG4iXX0=
|
||||
@@ -0,0 +1,22 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2015 Jordan Harband
|
||||
|
||||
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.
|
||||
|
||||
@@ -0,0 +1,691 @@
|
||||
var shortenHex = require('./shorten-hex');
|
||||
var shortenHsl = require('./shorten-hsl');
|
||||
var shortenRgb = require('./shorten-rgb');
|
||||
var sortSelectors = require('./sort-selectors');
|
||||
var tidyRules = require('./tidy-rules');
|
||||
var tidyBlock = require('./tidy-block');
|
||||
var tidyAtRule = require('./tidy-at-rule');
|
||||
|
||||
var Hack = require('../hack');
|
||||
var removeUnused = require('../remove-unused');
|
||||
var restoreFromOptimizing = require('../restore-from-optimizing');
|
||||
var wrapForOptimizing = require('../wrap-for-optimizing').all;
|
||||
|
||||
var OptimizationLevel = require('../../options/optimization-level').OptimizationLevel;
|
||||
|
||||
var Token = require('../../tokenizer/token');
|
||||
var Marker = require('../../tokenizer/marker');
|
||||
|
||||
var formatPosition = require('../../utils/format-position');
|
||||
var split = require('../../utils/split');
|
||||
|
||||
var serializeRules = require('../../writer/one-time').rules;
|
||||
|
||||
var IgnoreProperty = 'ignore-property';
|
||||
|
||||
var CHARSET_TOKEN = '@charset';
|
||||
var CHARSET_REGEXP = new RegExp('^' + CHARSET_TOKEN, 'i');
|
||||
|
||||
var DEFAULT_ROUNDING_PRECISION = require('../../options/rounding-precision').DEFAULT;
|
||||
|
||||
var WHOLE_PIXEL_VALUE = /(?:^|\s|\()(-?\d+)px/;
|
||||
var TIME_VALUE = /^(\-?[\d\.]+)(m?s)$/;
|
||||
|
||||
var HEX_VALUE_PATTERN = /[0-9a-f]/i;
|
||||
var PROPERTY_NAME_PATTERN = /^(?:\-chrome\-|\-[\w\-]+\w|\w[\w\-]+\w|\-\-\S+)$/;
|
||||
var IMPORT_PREFIX_PATTERN = /^@import/i;
|
||||
var QUOTED_PATTERN = /^('.*'|".*")$/;
|
||||
var QUOTED_BUT_SAFE_PATTERN = /^['"][a-zA-Z][a-zA-Z\d\-_]+['"]$/;
|
||||
var URL_PREFIX_PATTERN = /^url\(/i;
|
||||
var LOCAL_PREFIX_PATTERN = /^local\(/i;
|
||||
var VARIABLE_NAME_PATTERN = /^--\S+$/;
|
||||
|
||||
function isLocal(value){
|
||||
return LOCAL_PREFIX_PATTERN.test(value);
|
||||
}
|
||||
|
||||
function isNegative(value) {
|
||||
return value && value[1][0] == '-' && parseFloat(value[1]) < 0;
|
||||
}
|
||||
|
||||
function isQuoted(value) {
|
||||
return QUOTED_PATTERN.test(value);
|
||||
}
|
||||
|
||||
function isUrl(value) {
|
||||
return URL_PREFIX_PATTERN.test(value);
|
||||
}
|
||||
|
||||
function normalizeUrl(value) {
|
||||
return value
|
||||
.replace(URL_PREFIX_PATTERN, 'url(')
|
||||
.replace(/\\?\n|\\?\r\n/g, '');
|
||||
}
|
||||
|
||||
function optimizeBackground(property) {
|
||||
var values = property.value;
|
||||
|
||||
if (values.length == 1 && values[0][1] == 'none') {
|
||||
values[0][1] = '0 0';
|
||||
}
|
||||
|
||||
if (values.length == 1 && values[0][1] == 'transparent') {
|
||||
values[0][1] = '0 0';
|
||||
}
|
||||
}
|
||||
|
||||
function optimizeBorderRadius(property) {
|
||||
var values = property.value;
|
||||
var spliceAt;
|
||||
|
||||
if (values.length == 3 && values[1][1] == '/' && values[0][1] == values[2][1]) {
|
||||
spliceAt = 1;
|
||||
} else if (values.length == 5 && values[2][1] == '/' && values[0][1] == values[3][1] && values[1][1] == values[4][1]) {
|
||||
spliceAt = 2;
|
||||
} else if (values.length == 7 && values[3][1] == '/' && values[0][1] == values[4][1] && values[1][1] == values[5][1] && values[2][1] == values[6][1]) {
|
||||
spliceAt = 3;
|
||||
} else if (values.length == 9 && values[4][1] == '/' && values[0][1] == values[5][1] && values[1][1] == values[6][1] && values[2][1] == values[7][1] && values[3][1] == values[8][1]) {
|
||||
spliceAt = 4;
|
||||
}
|
||||
|
||||
if (spliceAt) {
|
||||
property.value.splice(spliceAt);
|
||||
property.dirty = true;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} name
|
||||
* @param {string} value
|
||||
* @param {Object} compatibility
|
||||
* @return {string}
|
||||
*/
|
||||
function optimizeColors(name, value, compatibility) {
|
||||
if (!value.match(/#|rgb|hsl/gi)) {
|
||||
return shortenHex(value);
|
||||
}
|
||||
|
||||
value = value
|
||||
.replace(/(rgb|hsl)a?\((\-?\d+),(\-?\d+\%?),(\-?\d+\%?),(0*[1-9]+[0-9]*(\.?\d*)?)\)/gi, function (match, colorFn, p1, p2, p3, alpha) {
|
||||
return (parseInt(alpha, 10) >= 1 ? colorFn + '(' + [p1,p2,p3].join(',') + ')' : match);
|
||||
})
|
||||
.replace(/rgb\((\-?\d+),(\-?\d+),(\-?\d+)\)/gi, function (match, red, green, blue) {
|
||||
return shortenRgb(red, green, blue);
|
||||
})
|
||||
.replace(/hsl\((-?\d+),(-?\d+)%?,(-?\d+)%?\)/gi, function (match, hue, saturation, lightness) {
|
||||
return shortenHsl(hue, saturation, lightness);
|
||||
})
|
||||
.replace(/(^|[^='"])#([0-9a-f]{6})/gi, function (match, prefix, color, at, inputValue) {
|
||||
var suffix = inputValue[at + match.length];
|
||||
|
||||
if (suffix && HEX_VALUE_PATTERN.test(suffix)) {
|
||||
return match;
|
||||
} else if (color[0] == color[1] && color[2] == color[3] && color[4] == color[5]) {
|
||||
return (prefix + '#' + color[0] + color[2] + color[4]).toLowerCase();
|
||||
} else {
|
||||
return (prefix + '#' + color).toLowerCase();
|
||||
}
|
||||
})
|
||||
.replace(/(^|[^='"])#([0-9a-f]{3})/gi, function (match, prefix, color) {
|
||||
return prefix + '#' + color.toLowerCase();
|
||||
})
|
||||
.replace(/(rgb|rgba|hsl|hsla)\(([^\)]+)\)/gi, function (match, colorFunction, colorDef) {
|
||||
var tokens = colorDef.split(',');
|
||||
var colorFnLowercase = colorFunction && colorFunction.toLowerCase();
|
||||
var applies = (colorFnLowercase == 'hsl' && tokens.length == 3) ||
|
||||
(colorFnLowercase == 'hsla' && tokens.length == 4) ||
|
||||
(colorFnLowercase == 'rgb' && tokens.length === 3 && colorDef.indexOf('%') > 0) ||
|
||||
(colorFnLowercase == 'rgba' && tokens.length == 4 && colorDef.indexOf('%') > 0);
|
||||
|
||||
if (!applies) {
|
||||
return match;
|
||||
}
|
||||
|
||||
if (tokens[1].indexOf('%') == -1) {
|
||||
tokens[1] += '%';
|
||||
}
|
||||
|
||||
if (tokens[2].indexOf('%') == -1) {
|
||||
tokens[2] += '%';
|
||||
}
|
||||
|
||||
return colorFunction + '(' + tokens.join(',') + ')';
|
||||
});
|
||||
|
||||
if (compatibility.colors.opacity && name.indexOf('background') == -1) {
|
||||
value = value.replace(/(?:rgba|hsla)\(0,0%?,0%?,0\)/g, function (match) {
|
||||
if (split(value, ',').pop().indexOf('gradient(') > -1) {
|
||||
return match;
|
||||
}
|
||||
|
||||
return 'transparent';
|
||||
});
|
||||
}
|
||||
|
||||
return shortenHex(value);
|
||||
}
|
||||
|
||||
function optimizeFilter(property) {
|
||||
if (property.value.length == 1) {
|
||||
property.value[0][1] = property.value[0][1].replace(/progid:DXImageTransform\.Microsoft\.(Alpha|Chroma)(\W)/, function (match, filter, suffix) {
|
||||
return filter.toLowerCase() + suffix;
|
||||
});
|
||||
}
|
||||
|
||||
property.value[0][1] = property.value[0][1]
|
||||
.replace(/,(\S)/g, ', $1')
|
||||
.replace(/ ?= ?/g, '=');
|
||||
}
|
||||
|
||||
function optimizeFontWeight(property, atIndex) {
|
||||
var value = property.value[atIndex][1];
|
||||
|
||||
if (value == 'normal') {
|
||||
value = '400';
|
||||
} else if (value == 'bold') {
|
||||
value = '700';
|
||||
}
|
||||
|
||||
property.value[atIndex][1] = value;
|
||||
}
|
||||
|
||||
function optimizeMultipleZeros(property) {
|
||||
var values = property.value;
|
||||
var spliceAt;
|
||||
|
||||
if (values.length == 4 && values[0][1] === '0' && values[1][1] === '0' && values[2][1] === '0' && values[3][1] === '0') {
|
||||
if (property.name.indexOf('box-shadow') > -1) {
|
||||
spliceAt = 2;
|
||||
} else {
|
||||
spliceAt = 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (spliceAt) {
|
||||
property.value.splice(spliceAt);
|
||||
property.dirty = true;
|
||||
}
|
||||
}
|
||||
|
||||
function optimizeOutline(property) {
|
||||
var values = property.value;
|
||||
|
||||
if (values.length == 1 && values[0][1] == 'none') {
|
||||
values[0][1] = '0';
|
||||
}
|
||||
}
|
||||
|
||||
function optimizePixelLengths(_, value, compatibility) {
|
||||
if (!WHOLE_PIXEL_VALUE.test(value)) {
|
||||
return value;
|
||||
}
|
||||
|
||||
return value.replace(WHOLE_PIXEL_VALUE, function (match, val) {
|
||||
var newValue;
|
||||
var intVal = parseInt(val);
|
||||
|
||||
if (intVal === 0) {
|
||||
return match;
|
||||
}
|
||||
|
||||
if (compatibility.properties.shorterLengthUnits && compatibility.units.pt && intVal * 3 % 4 === 0) {
|
||||
newValue = intVal * 3 / 4 + 'pt';
|
||||
}
|
||||
|
||||
if (compatibility.properties.shorterLengthUnits && compatibility.units.pc && intVal % 16 === 0) {
|
||||
newValue = intVal / 16 + 'pc';
|
||||
}
|
||||
|
||||
if (compatibility.properties.shorterLengthUnits && compatibility.units.in && intVal % 96 === 0) {
|
||||
newValue = intVal / 96 + 'in';
|
||||
}
|
||||
|
||||
if (newValue) {
|
||||
newValue = match.substring(0, match.indexOf(val)) + newValue;
|
||||
}
|
||||
|
||||
return newValue && newValue.length < match.length ? newValue : match;
|
||||
});
|
||||
}
|
||||
|
||||
function optimizePrecision(_, value, precisionOptions) {
|
||||
if (!precisionOptions.enabled || value.indexOf('.') === -1) {
|
||||
return value;
|
||||
}
|
||||
|
||||
return value
|
||||
.replace(precisionOptions.decimalPointMatcher, '$1$2$3')
|
||||
.replace(precisionOptions.zeroMatcher, function (match, integerPart, fractionPart, unit) {
|
||||
var multiplier = precisionOptions.units[unit].multiplier;
|
||||
var parsedInteger = parseInt(integerPart);
|
||||
var integer = isNaN(parsedInteger) ? 0 : parsedInteger;
|
||||
var fraction = parseFloat(fractionPart);
|
||||
|
||||
return Math.round((integer + fraction) * multiplier) / multiplier + unit;
|
||||
});
|
||||
}
|
||||
|
||||
function optimizeTimeUnits(_, value) {
|
||||
if (!TIME_VALUE.test(value))
|
||||
return value;
|
||||
|
||||
return value.replace(TIME_VALUE, function (match, val, unit) {
|
||||
var newValue;
|
||||
|
||||
if (unit == 'ms') {
|
||||
newValue = parseInt(val) / 1000 + 's';
|
||||
} else if (unit == 's') {
|
||||
newValue = parseFloat(val) * 1000 + 'ms';
|
||||
}
|
||||
|
||||
return newValue.length < match.length ? newValue : match;
|
||||
});
|
||||
}
|
||||
|
||||
function optimizeUnits(name, value, unitsRegexp) {
|
||||
if (/^(?:\-moz\-calc|\-webkit\-calc|calc|rgb|hsl|rgba|hsla)\(/.test(value)) {
|
||||
return value;
|
||||
}
|
||||
|
||||
if (name == 'flex' || name == '-ms-flex' || name == '-webkit-flex' || name == 'flex-basis' || name == '-webkit-flex-basis') {
|
||||
return value;
|
||||
}
|
||||
|
||||
if (value.indexOf('%') > 0 && (name == 'height' || name == 'max-height' || name == 'width' || name == 'max-width')) {
|
||||
return value;
|
||||
}
|
||||
|
||||
return value
|
||||
.replace(unitsRegexp, '$1' + '0' + '$2')
|
||||
.replace(unitsRegexp, '$1' + '0' + '$2');
|
||||
}
|
||||
|
||||
function optimizeWhitespace(name, value) {
|
||||
if (name.indexOf('filter') > -1 || value.indexOf(' ') == -1 || value.indexOf('expression') === 0) {
|
||||
return value;
|
||||
}
|
||||
|
||||
if (value.indexOf(Marker.SINGLE_QUOTE) > -1 || value.indexOf(Marker.DOUBLE_QUOTE) > -1) {
|
||||
return value;
|
||||
}
|
||||
|
||||
value = value.replace(/\s+/g, ' ');
|
||||
|
||||
if (value.indexOf('calc') > -1) {
|
||||
value = value.replace(/\) ?\/ ?/g, ')/ ');
|
||||
}
|
||||
|
||||
return value
|
||||
.replace(/(\(;?)\s+/g, '$1')
|
||||
.replace(/\s+(;?\))/g, '$1')
|
||||
.replace(/, /g, ',');
|
||||
}
|
||||
|
||||
function optimizeZeroDegUnit(_, value) {
|
||||
if (value.indexOf('0deg') == -1) {
|
||||
return value;
|
||||
}
|
||||
|
||||
return value.replace(/\(0deg\)/g, '(0)');
|
||||
}
|
||||
|
||||
function optimizeZeroUnits(name, value) {
|
||||
if (value.indexOf('0') == -1) {
|
||||
return value;
|
||||
}
|
||||
|
||||
if (value.indexOf('-') > -1) {
|
||||
value = value
|
||||
.replace(/([^\w\d\-]|^)\-0([^\.]|$)/g, '$10$2')
|
||||
.replace(/([^\w\d\-]|^)\-0([^\.]|$)/g, '$10$2');
|
||||
}
|
||||
|
||||
return value
|
||||
.replace(/(^|\s)0+([1-9])/g, '$1$2')
|
||||
.replace(/(^|\D)\.0+(\D|$)/g, '$10$2')
|
||||
.replace(/(^|\D)\.0+(\D|$)/g, '$10$2')
|
||||
.replace(/\.([1-9]*)0+(\D|$)/g, function (match, nonZeroPart, suffix) {
|
||||
return (nonZeroPart.length > 0 ? '.' : '') + nonZeroPart + suffix;
|
||||
})
|
||||
.replace(/(^|\D)0\.(\d)/g, '$1.$2');
|
||||
}
|
||||
|
||||
function removeQuotes(name, value) {
|
||||
if (name == 'content' || name.indexOf('font-variation-settings') > -1 || name.indexOf('font-feature-settings') > -1 || name == 'grid' || name.indexOf('grid-') > -1) {
|
||||
return value;
|
||||
}
|
||||
|
||||
return QUOTED_BUT_SAFE_PATTERN.test(value) ?
|
||||
value.substring(1, value.length - 1) :
|
||||
value;
|
||||
}
|
||||
|
||||
function removeUrlQuotes(value) {
|
||||
return /^url\(['"].+['"]\)$/.test(value) && !/^url\(['"].*[\*\s\(\)'"].*['"]\)$/.test(value) && !/^url\(['"]data:[^;]+;charset/.test(value) ?
|
||||
value.replace(/["']/g, '') :
|
||||
value;
|
||||
}
|
||||
|
||||
function transformValue(propertyName, propertyValue, rule, transformCallback) {
|
||||
var selector = serializeRules(rule);
|
||||
var transformedValue = transformCallback(propertyName, propertyValue, selector);
|
||||
|
||||
if (transformedValue === undefined) {
|
||||
return propertyValue;
|
||||
} else if (transformedValue === false) {
|
||||
return IgnoreProperty;
|
||||
} else {
|
||||
return transformedValue;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
function optimizeBody(rule, properties, context) {
|
||||
var options = context.options;
|
||||
var levelOptions = options.level[OptimizationLevel.One];
|
||||
var property, name, type, value;
|
||||
var valueIsUrl;
|
||||
var propertyToken;
|
||||
var _properties = wrapForOptimizing(properties, true);
|
||||
|
||||
propertyLoop:
|
||||
for (var i = 0, l = _properties.length; i < l; i++) {
|
||||
property = _properties[i];
|
||||
name = property.name;
|
||||
|
||||
if (!PROPERTY_NAME_PATTERN.test(name)) {
|
||||
propertyToken = property.all[property.position];
|
||||
context.warnings.push('Invalid property name \'' + name + '\' at ' + formatPosition(propertyToken[1][2][0]) + '. Ignoring.');
|
||||
property.unused = true;
|
||||
}
|
||||
|
||||
if (property.value.length === 0) {
|
||||
propertyToken = property.all[property.position];
|
||||
context.warnings.push('Empty property \'' + name + '\' at ' + formatPosition(propertyToken[1][2][0]) + '. Ignoring.');
|
||||
property.unused = true;
|
||||
}
|
||||
|
||||
if (property.hack && (
|
||||
(property.hack[0] == Hack.ASTERISK || property.hack[0] == Hack.UNDERSCORE) && !options.compatibility.properties.iePrefixHack ||
|
||||
property.hack[0] == Hack.BACKSLASH && !options.compatibility.properties.ieSuffixHack ||
|
||||
property.hack[0] == Hack.BANG && !options.compatibility.properties.ieBangHack)) {
|
||||
property.unused = true;
|
||||
}
|
||||
|
||||
if (levelOptions.removeNegativePaddings && name.indexOf('padding') === 0 && (isNegative(property.value[0]) || isNegative(property.value[1]) || isNegative(property.value[2]) || isNegative(property.value[3]))) {
|
||||
property.unused = true;
|
||||
}
|
||||
|
||||
if (!options.compatibility.properties.ieFilters && isLegacyFilter(property)) {
|
||||
property.unused = true;
|
||||
}
|
||||
|
||||
if (property.unused) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (property.block) {
|
||||
optimizeBody(rule, property.value[0][1], context);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (VARIABLE_NAME_PATTERN.test(name)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
for (var j = 0, m = property.value.length; j < m; j++) {
|
||||
type = property.value[j][0];
|
||||
value = property.value[j][1];
|
||||
valueIsUrl = isUrl(value);
|
||||
|
||||
if (type == Token.PROPERTY_BLOCK) {
|
||||
property.unused = true;
|
||||
context.warnings.push('Invalid value token at ' + formatPosition(value[0][1][2][0]) + '. Ignoring.');
|
||||
break;
|
||||
}
|
||||
|
||||
if (valueIsUrl && !context.validator.isUrl(value)) {
|
||||
property.unused = true;
|
||||
context.warnings.push('Broken URL \'' + value + '\' at ' + formatPosition(property.value[j][2][0]) + '. Ignoring.');
|
||||
break;
|
||||
}
|
||||
|
||||
if (valueIsUrl) {
|
||||
value = levelOptions.normalizeUrls ?
|
||||
normalizeUrl(value) :
|
||||
value;
|
||||
value = !options.compatibility.properties.urlQuotes ?
|
||||
removeUrlQuotes(value) :
|
||||
value;
|
||||
} else if (isQuoted(value) || isLocal(value)) {
|
||||
value = levelOptions.removeQuotes ?
|
||||
removeQuotes(name, value) :
|
||||
value;
|
||||
} else {
|
||||
value = levelOptions.removeWhitespace ?
|
||||
optimizeWhitespace(name, value) :
|
||||
value;
|
||||
value = optimizePrecision(name, value, options.precision);
|
||||
value = optimizePixelLengths(name, value, options.compatibility);
|
||||
value = levelOptions.replaceTimeUnits ?
|
||||
optimizeTimeUnits(name, value) :
|
||||
value;
|
||||
value = levelOptions.replaceZeroUnits ?
|
||||
optimizeZeroUnits(name, value) :
|
||||
value;
|
||||
|
||||
if (options.compatibility.properties.zeroUnits) {
|
||||
value = optimizeZeroDegUnit(name, value);
|
||||
value = optimizeUnits(name, value, options.unitsRegexp);
|
||||
}
|
||||
|
||||
if (options.compatibility.properties.colors) {
|
||||
value = optimizeColors(name, value, options.compatibility);
|
||||
}
|
||||
}
|
||||
|
||||
value = transformValue(name, value, rule, levelOptions.transform);
|
||||
|
||||
if (value === IgnoreProperty) {
|
||||
property.unused = true;
|
||||
continue propertyLoop;
|
||||
}
|
||||
|
||||
property.value[j][1] = value;
|
||||
}
|
||||
|
||||
if (levelOptions.replaceMultipleZeros) {
|
||||
optimizeMultipleZeros(property);
|
||||
}
|
||||
|
||||
if (name == 'background' && levelOptions.optimizeBackground) {
|
||||
optimizeBackground(property);
|
||||
} else if (name.indexOf('border') === 0 && name.indexOf('radius') > 0 && levelOptions.optimizeBorderRadius) {
|
||||
optimizeBorderRadius(property);
|
||||
} else if (name == 'filter'&& levelOptions.optimizeFilter && options.compatibility.properties.ieFilters) {
|
||||
optimizeFilter(property);
|
||||
} else if (name == 'font-weight' && levelOptions.optimizeFontWeight) {
|
||||
optimizeFontWeight(property, 0);
|
||||
} else if (name == 'outline' && levelOptions.optimizeOutline) {
|
||||
optimizeOutline(property);
|
||||
}
|
||||
}
|
||||
|
||||
restoreFromOptimizing(_properties);
|
||||
removeUnused(_properties);
|
||||
removeComments(properties, options);
|
||||
}
|
||||
|
||||
function removeComments(tokens, options) {
|
||||
var token;
|
||||
var i;
|
||||
|
||||
for (i = 0; i < tokens.length; i++) {
|
||||
token = tokens[i];
|
||||
|
||||
if (token[0] != Token.COMMENT) {
|
||||
continue;
|
||||
}
|
||||
|
||||
optimizeComment(token, options);
|
||||
|
||||
if (token[1].length === 0) {
|
||||
tokens.splice(i, 1);
|
||||
i--;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function optimizeComment(token, options) {
|
||||
if (token[1][2] == Marker.EXCLAMATION && (options.level[OptimizationLevel.One].specialComments == 'all' || options.commentsKept < options.level[OptimizationLevel.One].specialComments)) {
|
||||
options.commentsKept++;
|
||||
return;
|
||||
}
|
||||
|
||||
token[1] = [];
|
||||
}
|
||||
|
||||
function cleanupCharsets(tokens) {
|
||||
var hasCharset = false;
|
||||
|
||||
for (var i = 0, l = tokens.length; i < l; i++) {
|
||||
var token = tokens[i];
|
||||
|
||||
if (token[0] != Token.AT_RULE)
|
||||
continue;
|
||||
|
||||
if (!CHARSET_REGEXP.test(token[1]))
|
||||
continue;
|
||||
|
||||
if (hasCharset || token[1].indexOf(CHARSET_TOKEN) == -1) {
|
||||
tokens.splice(i, 1);
|
||||
i--;
|
||||
l--;
|
||||
} else {
|
||||
hasCharset = true;
|
||||
tokens.splice(i, 1);
|
||||
tokens.unshift([Token.AT_RULE, token[1].replace(CHARSET_REGEXP, CHARSET_TOKEN)]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function buildUnitRegexp(options) {
|
||||
var units = ['px', 'em', 'ex', 'cm', 'mm', 'in', 'pt', 'pc', '%'];
|
||||
var otherUnits = ['ch', 'rem', 'vh', 'vm', 'vmax', 'vmin', 'vw'];
|
||||
|
||||
otherUnits.forEach(function (unit) {
|
||||
if (options.compatibility.units[unit]) {
|
||||
units.push(unit);
|
||||
}
|
||||
});
|
||||
|
||||
return new RegExp('(^|\\s|\\(|,)0(?:' + units.join('|') + ')(\\W|$)', 'g');
|
||||
}
|
||||
|
||||
function buildPrecisionOptions(roundingPrecision) {
|
||||
var precisionOptions = {
|
||||
matcher: null,
|
||||
units: {},
|
||||
};
|
||||
var optimizable = [];
|
||||
var unit;
|
||||
var value;
|
||||
|
||||
for (unit in roundingPrecision) {
|
||||
value = roundingPrecision[unit];
|
||||
|
||||
if (value != DEFAULT_ROUNDING_PRECISION) {
|
||||
precisionOptions.units[unit] = {};
|
||||
precisionOptions.units[unit].value = value;
|
||||
precisionOptions.units[unit].multiplier = Math.pow(10, value);
|
||||
|
||||
optimizable.push(unit);
|
||||
}
|
||||
}
|
||||
|
||||
if (optimizable.length > 0) {
|
||||
precisionOptions.enabled = true;
|
||||
precisionOptions.decimalPointMatcher = new RegExp('(\\d)\\.($|' + optimizable.join('|') + ')($|\\W)', 'g');
|
||||
precisionOptions.zeroMatcher = new RegExp('(\\d*)(\\.\\d+)(' + optimizable.join('|') + ')', 'g');
|
||||
}
|
||||
|
||||
return precisionOptions;
|
||||
}
|
||||
|
||||
function isImport(token) {
|
||||
return IMPORT_PREFIX_PATTERN.test(token[1]);
|
||||
}
|
||||
|
||||
function isLegacyFilter(property) {
|
||||
var value;
|
||||
|
||||
if (property.name == 'filter' || property.name == '-ms-filter') {
|
||||
value = property.value[0][1];
|
||||
|
||||
return value.indexOf('progid') > -1 ||
|
||||
value.indexOf('alpha') === 0 ||
|
||||
value.indexOf('chroma') === 0;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function level1Optimize(tokens, context) {
|
||||
var options = context.options;
|
||||
var levelOptions = options.level[OptimizationLevel.One];
|
||||
var ie7Hack = options.compatibility.selectors.ie7Hack;
|
||||
var adjacentSpace = options.compatibility.selectors.adjacentSpace;
|
||||
var spaceAfterClosingBrace = options.compatibility.properties.spaceAfterClosingBrace;
|
||||
var format = options.format;
|
||||
var mayHaveCharset = false;
|
||||
var afterRules = false;
|
||||
|
||||
options.unitsRegexp = options.unitsRegexp || buildUnitRegexp(options);
|
||||
options.precision = options.precision || buildPrecisionOptions(levelOptions.roundingPrecision);
|
||||
options.commentsKept = options.commentsKept || 0;
|
||||
|
||||
for (var i = 0, l = tokens.length; i < l; i++) {
|
||||
var token = tokens[i];
|
||||
|
||||
switch (token[0]) {
|
||||
case Token.AT_RULE:
|
||||
token[1] = isImport(token) && afterRules ? '' : token[1];
|
||||
token[1] = levelOptions.tidyAtRules ? tidyAtRule(token[1]) : token[1];
|
||||
mayHaveCharset = true;
|
||||
break;
|
||||
case Token.AT_RULE_BLOCK:
|
||||
optimizeBody(token[1], token[2], context);
|
||||
afterRules = true;
|
||||
break;
|
||||
case Token.NESTED_BLOCK:
|
||||
token[1] = levelOptions.tidyBlockScopes ? tidyBlock(token[1], spaceAfterClosingBrace) : token[1];
|
||||
level1Optimize(token[2], context);
|
||||
afterRules = true;
|
||||
break;
|
||||
case Token.COMMENT:
|
||||
optimizeComment(token, options);
|
||||
break;
|
||||
case Token.RULE:
|
||||
token[1] = levelOptions.tidySelectors ? tidyRules(token[1], !ie7Hack, adjacentSpace, format, context.warnings) : token[1];
|
||||
token[1] = token[1].length > 1 ? sortSelectors(token[1], levelOptions.selectorsSortingMethod) : token[1];
|
||||
optimizeBody(token[1], token[2], context);
|
||||
afterRules = true;
|
||||
break;
|
||||
}
|
||||
|
||||
if (token[0] == Token.COMMENT && token[1].length === 0 || levelOptions.removeEmpty && (token[1].length === 0 || (token[2] && token[2].length === 0))) {
|
||||
tokens.splice(i, 1);
|
||||
i--;
|
||||
l--;
|
||||
}
|
||||
}
|
||||
|
||||
if (levelOptions.cleanupCharsets && mayHaveCharset) {
|
||||
cleanupCharsets(tokens);
|
||||
}
|
||||
|
||||
return tokens;
|
||||
}
|
||||
|
||||
module.exports = level1Optimize;
|
||||
@@ -0,0 +1 @@
|
||||
module.exports={A:{A:{"1":"A B","2":"J D E F CC"},B:{"1":"C K L G M N O P Q R S T U V W X Y Z a b c d e i j k l m n o p q r s t u f H"},C:{"1":"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 nB oB pB P Q R wB S T U V W X Y Z a b c d e i j k l m n o p q r s t u f H xB yB","2":"DC tB EC FC"},D:{"1":"0 1 2 3 4 5 6 7 8 9 A B C K L G M N O w g x y z AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB PB QB RB SB TB UB VB WB XB YB uB ZB vB aB bB cB dB eB fB gB hB iB jB kB h lB mB nB oB pB P Q R 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":"I v J D E F"},E:{"1":"B C K L G 0B qB rB 1B MC NC 2B 3B 4B 5B sB 6B 7B 8B 9B OC","2":"I HC zB","16":"v","388":"J D E F A IC JC KC LC"},F:{"1":"0 1 2 3 4 5 6 7 8 9 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 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 PC QC RC SC qB AC TC rB","2":"F"},G:{"1":"cC dC eC fC gC hC iC jC kC lC mC nC 2B 3B 4B 5B sB 6B 7B 8B 9B","16":"zB UC BC","388":"E VC WC XC YC ZC aC bC"},H:{"2":"oC"},I:{"1":"f uC","2":"tB I pC qC rC sC BC tC"},J:{"1":"A","2":"D"},K:{"1":"A B C h qB AC rB"},L:{"1":"H"},M:{"1":"H"},N:{"132":"A B"},O:{"1":"vC"},P:{"1":"I g wC xC yC zC 0C 0B 1C 2C 3C 4C 5C sB 6C 7C 8C"},Q:{"1":"1B"},R:{"1":"9C"},S:{"1":"AD BD"}},B:1,C:"Pattern attribute for input fields"};
|
||||
@@ -0,0 +1,223 @@
|
||||
const ANSI_BACKGROUND_OFFSET = 10;
|
||||
|
||||
const wrapAnsi16 = (offset = 0) => code => `\u001B[${code + offset}m`;
|
||||
|
||||
const wrapAnsi256 = (offset = 0) => code => `\u001B[${38 + offset};5;${code}m`;
|
||||
|
||||
const wrapAnsi16m = (offset = 0) => (red, green, blue) => `\u001B[${38 + offset};2;${red};${green};${blue}m`;
|
||||
|
||||
const styles = {
|
||||
modifier: {
|
||||
reset: [0, 0],
|
||||
// 21 isn't widely supported and 22 does the same thing
|
||||
bold: [1, 22],
|
||||
dim: [2, 22],
|
||||
italic: [3, 23],
|
||||
underline: [4, 24],
|
||||
overline: [53, 55],
|
||||
inverse: [7, 27],
|
||||
hidden: [8, 28],
|
||||
strikethrough: [9, 29],
|
||||
},
|
||||
color: {
|
||||
black: [30, 39],
|
||||
red: [31, 39],
|
||||
green: [32, 39],
|
||||
yellow: [33, 39],
|
||||
blue: [34, 39],
|
||||
magenta: [35, 39],
|
||||
cyan: [36, 39],
|
||||
white: [37, 39],
|
||||
|
||||
// Bright color
|
||||
blackBright: [90, 39],
|
||||
gray: [90, 39], // Alias of `blackBright`
|
||||
grey: [90, 39], // Alias of `blackBright`
|
||||
redBright: [91, 39],
|
||||
greenBright: [92, 39],
|
||||
yellowBright: [93, 39],
|
||||
blueBright: [94, 39],
|
||||
magentaBright: [95, 39],
|
||||
cyanBright: [96, 39],
|
||||
whiteBright: [97, 39],
|
||||
},
|
||||
bgColor: {
|
||||
bgBlack: [40, 49],
|
||||
bgRed: [41, 49],
|
||||
bgGreen: [42, 49],
|
||||
bgYellow: [43, 49],
|
||||
bgBlue: [44, 49],
|
||||
bgMagenta: [45, 49],
|
||||
bgCyan: [46, 49],
|
||||
bgWhite: [47, 49],
|
||||
|
||||
// Bright color
|
||||
bgBlackBright: [100, 49],
|
||||
bgGray: [100, 49], // Alias of `bgBlackBright`
|
||||
bgGrey: [100, 49], // Alias of `bgBlackBright`
|
||||
bgRedBright: [101, 49],
|
||||
bgGreenBright: [102, 49],
|
||||
bgYellowBright: [103, 49],
|
||||
bgBlueBright: [104, 49],
|
||||
bgMagentaBright: [105, 49],
|
||||
bgCyanBright: [106, 49],
|
||||
bgWhiteBright: [107, 49],
|
||||
},
|
||||
};
|
||||
|
||||
export const modifierNames = Object.keys(styles.modifier);
|
||||
export const foregroundColorNames = Object.keys(styles.color);
|
||||
export const backgroundColorNames = Object.keys(styles.bgColor);
|
||||
export const colorNames = [...foregroundColorNames, ...backgroundColorNames];
|
||||
|
||||
function assembleStyles() {
|
||||
const codes = new Map();
|
||||
|
||||
for (const [groupName, group] of Object.entries(styles)) {
|
||||
for (const [styleName, style] of Object.entries(group)) {
|
||||
styles[styleName] = {
|
||||
open: `\u001B[${style[0]}m`,
|
||||
close: `\u001B[${style[1]}m`,
|
||||
};
|
||||
|
||||
group[styleName] = styles[styleName];
|
||||
|
||||
codes.set(style[0], style[1]);
|
||||
}
|
||||
|
||||
Object.defineProperty(styles, groupName, {
|
||||
value: group,
|
||||
enumerable: false,
|
||||
});
|
||||
}
|
||||
|
||||
Object.defineProperty(styles, 'codes', {
|
||||
value: codes,
|
||||
enumerable: false,
|
||||
});
|
||||
|
||||
styles.color.close = '\u001B[39m';
|
||||
styles.bgColor.close = '\u001B[49m';
|
||||
|
||||
styles.color.ansi = wrapAnsi16();
|
||||
styles.color.ansi256 = wrapAnsi256();
|
||||
styles.color.ansi16m = wrapAnsi16m();
|
||||
styles.bgColor.ansi = wrapAnsi16(ANSI_BACKGROUND_OFFSET);
|
||||
styles.bgColor.ansi256 = wrapAnsi256(ANSI_BACKGROUND_OFFSET);
|
||||
styles.bgColor.ansi16m = wrapAnsi16m(ANSI_BACKGROUND_OFFSET);
|
||||
|
||||
// From https://github.com/Qix-/color-convert/blob/3f0e0d4e92e235796ccb17f6e85c72094a651f49/conversions.js
|
||||
Object.defineProperties(styles, {
|
||||
rgbToAnsi256: {
|
||||
value(red, green, blue) {
|
||||
// We use the extended greyscale palette here, with the exception of
|
||||
// black and white. normal palette only has 4 greyscale shades.
|
||||
if (red === green && green === blue) {
|
||||
if (red < 8) {
|
||||
return 16;
|
||||
}
|
||||
|
||||
if (red > 248) {
|
||||
return 231;
|
||||
}
|
||||
|
||||
return Math.round(((red - 8) / 247) * 24) + 232;
|
||||
}
|
||||
|
||||
return 16
|
||||
+ (36 * Math.round(red / 255 * 5))
|
||||
+ (6 * Math.round(green / 255 * 5))
|
||||
+ Math.round(blue / 255 * 5);
|
||||
},
|
||||
enumerable: false,
|
||||
},
|
||||
hexToRgb: {
|
||||
value(hex) {
|
||||
const matches = /[a-f\d]{6}|[a-f\d]{3}/i.exec(hex.toString(16));
|
||||
if (!matches) {
|
||||
return [0, 0, 0];
|
||||
}
|
||||
|
||||
let [colorString] = matches;
|
||||
|
||||
if (colorString.length === 3) {
|
||||
colorString = [...colorString].map(character => character + character).join('');
|
||||
}
|
||||
|
||||
const integer = Number.parseInt(colorString, 16);
|
||||
|
||||
return [
|
||||
/* eslint-disable no-bitwise */
|
||||
(integer >> 16) & 0xFF,
|
||||
(integer >> 8) & 0xFF,
|
||||
integer & 0xFF,
|
||||
/* eslint-enable no-bitwise */
|
||||
];
|
||||
},
|
||||
enumerable: false,
|
||||
},
|
||||
hexToAnsi256: {
|
||||
value: hex => styles.rgbToAnsi256(...styles.hexToRgb(hex)),
|
||||
enumerable: false,
|
||||
},
|
||||
ansi256ToAnsi: {
|
||||
value(code) {
|
||||
if (code < 8) {
|
||||
return 30 + code;
|
||||
}
|
||||
|
||||
if (code < 16) {
|
||||
return 90 + (code - 8);
|
||||
}
|
||||
|
||||
let red;
|
||||
let green;
|
||||
let blue;
|
||||
|
||||
if (code >= 232) {
|
||||
red = (((code - 232) * 10) + 8) / 255;
|
||||
green = red;
|
||||
blue = red;
|
||||
} else {
|
||||
code -= 16;
|
||||
|
||||
const remainder = code % 36;
|
||||
|
||||
red = Math.floor(code / 36) / 5;
|
||||
green = Math.floor(remainder / 6) / 5;
|
||||
blue = (remainder % 6) / 5;
|
||||
}
|
||||
|
||||
const value = Math.max(red, green, blue) * 2;
|
||||
|
||||
if (value === 0) {
|
||||
return 30;
|
||||
}
|
||||
|
||||
// eslint-disable-next-line no-bitwise
|
||||
let result = 30 + ((Math.round(blue) << 2) | (Math.round(green) << 1) | Math.round(red));
|
||||
|
||||
if (value === 2) {
|
||||
result += 60;
|
||||
}
|
||||
|
||||
return result;
|
||||
},
|
||||
enumerable: false,
|
||||
},
|
||||
rgbToAnsi: {
|
||||
value: (red, green, blue) => styles.ansi256ToAnsi(styles.rgbToAnsi256(red, green, blue)),
|
||||
enumerable: false,
|
||||
},
|
||||
hexToAnsi: {
|
||||
value: hex => styles.ansi256ToAnsi(styles.hexToAnsi256(hex)),
|
||||
enumerable: false,
|
||||
},
|
||||
});
|
||||
|
||||
return styles;
|
||||
}
|
||||
|
||||
const ansiStyles = assembleStyles();
|
||||
|
||||
export default ansiStyles;
|
||||
@@ -0,0 +1,35 @@
|
||||
import type {Except} from './except';
|
||||
import type {Simplify} from './simplify';
|
||||
|
||||
/**
|
||||
Create a type that makes the given keys optional. The remaining keys are kept as is. The sister of the `SetRequired` type.
|
||||
|
||||
Use-case: You want to define a single model where the only thing that changes is whether or not some of the keys are optional.
|
||||
|
||||
@example
|
||||
```
|
||||
import type {SetOptional} from 'type-fest';
|
||||
|
||||
type Foo = {
|
||||
a: number;
|
||||
b?: string;
|
||||
c: boolean;
|
||||
}
|
||||
|
||||
type SomeOptional = SetOptional<Foo, 'b' | 'c'>;
|
||||
// type SomeOptional = {
|
||||
// a: number;
|
||||
// b?: string; // Was already optional and still is.
|
||||
// c?: boolean; // Is now optional.
|
||||
// }
|
||||
```
|
||||
|
||||
@category Object
|
||||
*/
|
||||
export type SetOptional<BaseType, Keys extends keyof BaseType> =
|
||||
Simplify<
|
||||
// Pick just the keys that are readonly from the base type.
|
||||
Except<BaseType, Keys> &
|
||||
// Pick the keys that should be mutable from the base type and make them mutable.
|
||||
Partial<Pick<BaseType, Keys>>
|
||||
>;
|
||||
@@ -0,0 +1,663 @@
|
||||
<img src="media/logo.svg" width="400">
|
||||
<br>
|
||||
|
||||
[](https://codecov.io/gh/sindresorhus/execa)
|
||||
|
||||
> Process execution for humans
|
||||
|
||||
## Why
|
||||
|
||||
This package improves [`child_process`](https://nodejs.org/api/child_process.html) methods with:
|
||||
|
||||
- Promise interface.
|
||||
- [Strips the final newline](#stripfinalnewline) from the output so you don't have to do `stdout.trim()`.
|
||||
- Supports [shebang](https://en.wikipedia.org/wiki/Shebang_(Unix)) binaries cross-platform.
|
||||
- [Improved Windows support.](https://github.com/IndigoUnited/node-cross-spawn#why)
|
||||
- Higher max buffer. 100 MB instead of 200 KB.
|
||||
- [Executes locally installed binaries by name.](#preferlocal)
|
||||
- [Cleans up spawned processes when the parent process dies.](#cleanup)
|
||||
- [Get interleaved output](#all) from `stdout` and `stderr` similar to what is printed on the terminal. [*(Async only)*](#execasyncfile-arguments-options)
|
||||
- [Can specify file and arguments as a single string without a shell](#execacommandcommand-options)
|
||||
- More descriptive errors.
|
||||
|
||||
## Install
|
||||
|
||||
```
|
||||
$ npm install execa
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
const execa = require('execa');
|
||||
|
||||
(async () => {
|
||||
const {stdout} = await execa('echo', ['unicorns']);
|
||||
console.log(stdout);
|
||||
//=> 'unicorns'
|
||||
})();
|
||||
```
|
||||
|
||||
### Pipe the child process stdout to the parent
|
||||
|
||||
```js
|
||||
const execa = require('execa');
|
||||
|
||||
execa('echo', ['unicorns']).stdout.pipe(process.stdout);
|
||||
```
|
||||
|
||||
### Handling Errors
|
||||
|
||||
```js
|
||||
const execa = require('execa');
|
||||
|
||||
(async () => {
|
||||
// Catching an error
|
||||
try {
|
||||
await execa('unknown', ['command']);
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
/*
|
||||
{
|
||||
message: 'Command failed with ENOENT: unknown command spawn unknown ENOENT',
|
||||
errno: -2,
|
||||
code: 'ENOENT',
|
||||
syscall: 'spawn unknown',
|
||||
path: 'unknown',
|
||||
spawnargs: ['command'],
|
||||
originalMessage: 'spawn unknown ENOENT',
|
||||
shortMessage: 'Command failed with ENOENT: unknown command spawn unknown ENOENT',
|
||||
command: 'unknown command',
|
||||
escapedCommand: 'unknown command',
|
||||
stdout: '',
|
||||
stderr: '',
|
||||
all: '',
|
||||
failed: true,
|
||||
timedOut: false,
|
||||
isCanceled: false,
|
||||
killed: false
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
})();
|
||||
```
|
||||
|
||||
### Cancelling a spawned process
|
||||
|
||||
```js
|
||||
const execa = require('execa');
|
||||
|
||||
(async () => {
|
||||
const subprocess = execa('node');
|
||||
|
||||
setTimeout(() => {
|
||||
subprocess.cancel();
|
||||
}, 1000);
|
||||
|
||||
try {
|
||||
await subprocess;
|
||||
} catch (error) {
|
||||
console.log(subprocess.killed); // true
|
||||
console.log(error.isCanceled); // true
|
||||
}
|
||||
})()
|
||||
```
|
||||
|
||||
### Catching an error with the sync method
|
||||
|
||||
```js
|
||||
try {
|
||||
execa.sync('unknown', ['command']);
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
/*
|
||||
{
|
||||
message: 'Command failed with ENOENT: unknown command spawnSync unknown ENOENT',
|
||||
errno: -2,
|
||||
code: 'ENOENT',
|
||||
syscall: 'spawnSync unknown',
|
||||
path: 'unknown',
|
||||
spawnargs: ['command'],
|
||||
originalMessage: 'spawnSync unknown ENOENT',
|
||||
shortMessage: 'Command failed with ENOENT: unknown command spawnSync unknown ENOENT',
|
||||
command: 'unknown command',
|
||||
escapedCommand: 'unknown command',
|
||||
stdout: '',
|
||||
stderr: '',
|
||||
all: '',
|
||||
failed: true,
|
||||
timedOut: false,
|
||||
isCanceled: false,
|
||||
killed: false
|
||||
}
|
||||
*/
|
||||
}
|
||||
```
|
||||
|
||||
### Kill a process
|
||||
|
||||
Using SIGTERM, and after 2 seconds, kill it with SIGKILL.
|
||||
|
||||
```js
|
||||
const subprocess = execa('node');
|
||||
|
||||
setTimeout(() => {
|
||||
subprocess.kill('SIGTERM', {
|
||||
forceKillAfterTimeout: 2000
|
||||
});
|
||||
}, 1000);
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
### execa(file, arguments, options?)
|
||||
|
||||
Execute a file. Think of this as a mix of [`child_process.execFile()`](https://nodejs.org/api/child_process.html#child_process_child_process_execfile_file_args_options_callback) and [`child_process.spawn()`](https://nodejs.org/api/child_process.html#child_process_child_process_spawn_command_args_options).
|
||||
|
||||
No escaping/quoting is needed.
|
||||
|
||||
Unless the [`shell`](#shell) option is used, no shell interpreter (Bash, `cmd.exe`, etc.) is used, so shell features such as variables substitution (`echo $PATH`) are not allowed.
|
||||
|
||||
Returns a [`child_process` instance](https://nodejs.org/api/child_process.html#child_process_class_childprocess) which:
|
||||
- is also a `Promise` resolving or rejecting with a [`childProcessResult`](#childProcessResult).
|
||||
- exposes the following additional methods and properties.
|
||||
|
||||
#### kill(signal?, options?)
|
||||
|
||||
Same as the original [`child_process#kill()`](https://nodejs.org/api/child_process.html#child_process_subprocess_kill_signal) except: if `signal` is `SIGTERM` (the default value) and the child process is not terminated after 5 seconds, force it by sending `SIGKILL`.
|
||||
|
||||
##### options.forceKillAfterTimeout
|
||||
|
||||
Type: `number | false`\
|
||||
Default: `5000`
|
||||
|
||||
Milliseconds to wait for the child process to terminate before sending `SIGKILL`.
|
||||
|
||||
Can be disabled with `false`.
|
||||
|
||||
#### cancel()
|
||||
|
||||
Similar to [`childProcess.kill()`](https://nodejs.org/api/child_process.html#child_process_subprocess_kill_signal). This is preferred when cancelling the child process execution as the error is more descriptive and [`childProcessResult.isCanceled`](#iscanceled) is set to `true`.
|
||||
|
||||
#### all
|
||||
|
||||
Type: `ReadableStream | undefined`
|
||||
|
||||
Stream combining/interleaving [`stdout`](https://nodejs.org/api/child_process.html#child_process_subprocess_stdout) and [`stderr`](https://nodejs.org/api/child_process.html#child_process_subprocess_stderr).
|
||||
|
||||
This is `undefined` if either:
|
||||
- the [`all` option](#all-2) is `false` (the default value)
|
||||
- both [`stdout`](#stdout-1) and [`stderr`](#stderr-1) options are set to [`'inherit'`, `'ipc'`, `Stream` or `integer`](https://nodejs.org/dist/latest-v6.x/docs/api/child_process.html#child_process_options_stdio)
|
||||
|
||||
### execa.sync(file, arguments?, options?)
|
||||
|
||||
Execute a file synchronously.
|
||||
|
||||
Returns or throws a [`childProcessResult`](#childProcessResult).
|
||||
|
||||
### execa.command(command, options?)
|
||||
|
||||
Same as [`execa()`](#execafile-arguments-options) except both file and arguments are specified in a single `command` string. For example, `execa('echo', ['unicorns'])` is the same as `execa.command('echo unicorns')`.
|
||||
|
||||
If the file or an argument contains spaces, they must be escaped with backslashes. This matters especially if `command` is not a constant but a variable, for example with `__dirname` or `process.cwd()`. Except for spaces, no escaping/quoting is needed.
|
||||
|
||||
The [`shell` option](#shell) must be used if the `command` uses shell-specific features (for example, `&&` or `||`), as opposed to being a simple `file` followed by its `arguments`.
|
||||
|
||||
### execa.commandSync(command, options?)
|
||||
|
||||
Same as [`execa.command()`](#execacommand-command-options) but synchronous.
|
||||
|
||||
Returns or throws a [`childProcessResult`](#childProcessResult).
|
||||
|
||||
### execa.node(scriptPath, arguments?, options?)
|
||||
|
||||
Execute a Node.js script as a child process.
|
||||
|
||||
Same as `execa('node', [scriptPath, ...arguments], options)` except (like [`child_process#fork()`](https://nodejs.org/api/child_process.html#child_process_child_process_fork_modulepath_args_options)):
|
||||
- the current Node version and options are used. This can be overridden using the [`nodePath`](#nodepath-for-node-only) and [`nodeOptions`](#nodeoptions-for-node-only) options.
|
||||
- the [`shell`](#shell) option cannot be used
|
||||
- an extra channel [`ipc`](https://nodejs.org/api/child_process.html#child_process_options_stdio) is passed to [`stdio`](#stdio)
|
||||
|
||||
### childProcessResult
|
||||
|
||||
Type: `object`
|
||||
|
||||
Result of a child process execution. On success this is a plain object. On failure this is also an `Error` instance.
|
||||
|
||||
The child process [fails](#failed) when:
|
||||
- its [exit code](#exitcode) is not `0`
|
||||
- it was [killed](#killed) with a [signal](#signal)
|
||||
- [timing out](#timedout)
|
||||
- [being canceled](#iscanceled)
|
||||
- there's not enough memory or there are already too many child processes
|
||||
|
||||
#### command
|
||||
|
||||
Type: `string`
|
||||
|
||||
The file and arguments that were run, for logging purposes.
|
||||
|
||||
This is not escaped and should not be executed directly as a process, including using [`execa()`](#execafile-arguments-options) or [`execa.command()`](#execacommandcommand-options).
|
||||
|
||||
#### escapedCommand
|
||||
|
||||
Type: `string`
|
||||
|
||||
Same as [`command`](#command) but escaped.
|
||||
|
||||
This is meant to be copy and pasted into a shell, for debugging purposes.
|
||||
Since the escaping is fairly basic, this should not be executed directly as a process, including using [`execa()`](#execafile-arguments-options) or [`execa.command()`](#execacommandcommand-options).
|
||||
|
||||
#### exitCode
|
||||
|
||||
Type: `number`
|
||||
|
||||
The numeric exit code of the process that was run.
|
||||
|
||||
#### stdout
|
||||
|
||||
Type: `string | Buffer`
|
||||
|
||||
The output of the process on stdout.
|
||||
|
||||
#### stderr
|
||||
|
||||
Type: `string | Buffer`
|
||||
|
||||
The output of the process on stderr.
|
||||
|
||||
#### all
|
||||
|
||||
Type: `string | Buffer | undefined`
|
||||
|
||||
The output of the process with `stdout` and `stderr` interleaved.
|
||||
|
||||
This is `undefined` if either:
|
||||
- the [`all` option](#all-2) is `false` (the default value)
|
||||
- `execa.sync()` was used
|
||||
|
||||
#### failed
|
||||
|
||||
Type: `boolean`
|
||||
|
||||
Whether the process failed to run.
|
||||
|
||||
#### timedOut
|
||||
|
||||
Type: `boolean`
|
||||
|
||||
Whether the process timed out.
|
||||
|
||||
#### isCanceled
|
||||
|
||||
Type: `boolean`
|
||||
|
||||
Whether the process was canceled.
|
||||
|
||||
#### killed
|
||||
|
||||
Type: `boolean`
|
||||
|
||||
Whether the process was killed.
|
||||
|
||||
#### signal
|
||||
|
||||
Type: `string | undefined`
|
||||
|
||||
The name of the signal that was used to terminate the process. For example, `SIGFPE`.
|
||||
|
||||
If a signal terminated the process, this property is defined and included in the error message. Otherwise it is `undefined`.
|
||||
|
||||
#### signalDescription
|
||||
|
||||
Type: `string | undefined`
|
||||
|
||||
A human-friendly description of the signal that was used to terminate the process. For example, `Floating point arithmetic error`.
|
||||
|
||||
If a signal terminated the process, this property is defined and included in the error message. Otherwise it is `undefined`. It is also `undefined` when the signal is very uncommon which should seldomly happen.
|
||||
|
||||
#### message
|
||||
|
||||
Type: `string`
|
||||
|
||||
Error message when the child process failed to run. In addition to the [underlying error message](#originalMessage), it also contains some information related to why the child process errored.
|
||||
|
||||
The child process [stderr](#stderr) then [stdout](#stdout) are appended to the end, separated with newlines and not interleaved.
|
||||
|
||||
#### shortMessage
|
||||
|
||||
Type: `string`
|
||||
|
||||
This is the same as the [`message` property](#message) except it does not include the child process stdout/stderr.
|
||||
|
||||
#### originalMessage
|
||||
|
||||
Type: `string | undefined`
|
||||
|
||||
Original error message. This is the same as the `message` property except it includes neither the child process stdout/stderr nor some additional information added by Execa.
|
||||
|
||||
This is `undefined` unless the child process exited due to an `error` event or a timeout.
|
||||
|
||||
### options
|
||||
|
||||
Type: `object`
|
||||
|
||||
#### cleanup
|
||||
|
||||
Type: `boolean`\
|
||||
Default: `true`
|
||||
|
||||
Kill the spawned process when the parent process exits unless either:
|
||||
- the spawned process is [`detached`](https://nodejs.org/api/child_process.html#child_process_options_detached)
|
||||
- the parent process is terminated abruptly, for example, with `SIGKILL` as opposed to `SIGTERM` or a normal exit
|
||||
|
||||
#### preferLocal
|
||||
|
||||
Type: `boolean`\
|
||||
Default: `false`
|
||||
|
||||
Prefer locally installed binaries when looking for a binary to execute.\
|
||||
If you `$ npm install foo`, you can then `execa('foo')`.
|
||||
|
||||
#### localDir
|
||||
|
||||
Type: `string`\
|
||||
Default: `process.cwd()`
|
||||
|
||||
Preferred path to find locally installed binaries in (use with `preferLocal`).
|
||||
|
||||
#### execPath
|
||||
|
||||
Type: `string`\
|
||||
Default: `process.execPath` (Current Node.js executable)
|
||||
|
||||
Path to the Node.js executable to use in child processes.
|
||||
|
||||
This can be either an absolute path or a path relative to the [`cwd` option](#cwd).
|
||||
|
||||
Requires [`preferLocal`](#preferlocal) to be `true`.
|
||||
|
||||
For example, this can be used together with [`get-node`](https://github.com/ehmicky/get-node) to run a specific Node.js version in a child process.
|
||||
|
||||
#### buffer
|
||||
|
||||
Type: `boolean`\
|
||||
Default: `true`
|
||||
|
||||
Buffer the output from the spawned process. When set to `false`, you must read the output of [`stdout`](#stdout-1) and [`stderr`](#stderr-1) (or [`all`](#all) if the [`all`](#all-2) option is `true`). Otherwise the returned promise will not be resolved/rejected.
|
||||
|
||||
If the spawned process fails, [`error.stdout`](#stdout), [`error.stderr`](#stderr), and [`error.all`](#all) will contain the buffered data.
|
||||
|
||||
#### input
|
||||
|
||||
Type: `string | Buffer | stream.Readable`
|
||||
|
||||
Write some input to the `stdin` of your binary.\
|
||||
Streams are not allowed when using the synchronous methods.
|
||||
|
||||
#### stdin
|
||||
|
||||
Type: `string | number | Stream | undefined`\
|
||||
Default: `pipe`
|
||||
|
||||
Same options as [`stdio`](https://nodejs.org/dist/latest-v6.x/docs/api/child_process.html#child_process_options_stdio).
|
||||
|
||||
#### stdout
|
||||
|
||||
Type: `string | number | Stream | undefined`\
|
||||
Default: `pipe`
|
||||
|
||||
Same options as [`stdio`](https://nodejs.org/dist/latest-v6.x/docs/api/child_process.html#child_process_options_stdio).
|
||||
|
||||
#### stderr
|
||||
|
||||
Type: `string | number | Stream | undefined`\
|
||||
Default: `pipe`
|
||||
|
||||
Same options as [`stdio`](https://nodejs.org/dist/latest-v6.x/docs/api/child_process.html#child_process_options_stdio).
|
||||
|
||||
#### all
|
||||
|
||||
Type: `boolean`\
|
||||
Default: `false`
|
||||
|
||||
Add an `.all` property on the [promise](#all) and the [resolved value](#all-1). The property contains the output of the process with `stdout` and `stderr` interleaved.
|
||||
|
||||
#### reject
|
||||
|
||||
Type: `boolean`\
|
||||
Default: `true`
|
||||
|
||||
Setting this to `false` resolves the promise with the error instead of rejecting it.
|
||||
|
||||
#### stripFinalNewline
|
||||
|
||||
Type: `boolean`\
|
||||
Default: `true`
|
||||
|
||||
Strip the final [newline character](https://en.wikipedia.org/wiki/Newline) from the output.
|
||||
|
||||
#### extendEnv
|
||||
|
||||
Type: `boolean`\
|
||||
Default: `true`
|
||||
|
||||
Set to `false` if you don't want to extend the environment variables when providing the `env` property.
|
||||
|
||||
---
|
||||
|
||||
Execa also accepts the below options which are the same as the options for [`child_process#spawn()`](https://nodejs.org/api/child_process.html#child_process_child_process_spawn_command_args_options)/[`child_process#exec()`](https://nodejs.org/api/child_process.html#child_process_child_process_exec_command_options_callback)
|
||||
|
||||
#### cwd
|
||||
|
||||
Type: `string`\
|
||||
Default: `process.cwd()`
|
||||
|
||||
Current working directory of the child process.
|
||||
|
||||
#### env
|
||||
|
||||
Type: `object`\
|
||||
Default: `process.env`
|
||||
|
||||
Environment key-value pairs. Extends automatically from `process.env`. Set [`extendEnv`](#extendenv) to `false` if you don't want this.
|
||||
|
||||
#### argv0
|
||||
|
||||
Type: `string`
|
||||
|
||||
Explicitly set the value of `argv[0]` sent to the child process. This will be set to `file` if not specified.
|
||||
|
||||
#### stdio
|
||||
|
||||
Type: `string | string[]`\
|
||||
Default: `pipe`
|
||||
|
||||
Child's [stdio](https://nodejs.org/api/child_process.html#child_process_options_stdio) configuration.
|
||||
|
||||
#### serialization
|
||||
|
||||
Type: `string`\
|
||||
Default: `'json'`
|
||||
|
||||
Specify the kind of serialization used for sending messages between processes when using the [`stdio: 'ipc'`](#stdio) option or [`execa.node()`](#execanodescriptpath-arguments-options):
|
||||
- `json`: Uses `JSON.stringify()` and `JSON.parse()`.
|
||||
- `advanced`: Uses [`v8.serialize()`](https://nodejs.org/api/v8.html#v8_v8_serialize_value)
|
||||
|
||||
Requires Node.js `13.2.0` or later.
|
||||
|
||||
[More info.](https://nodejs.org/api/child_process.html#child_process_advanced_serialization)
|
||||
|
||||
#### detached
|
||||
|
||||
Type: `boolean`
|
||||
|
||||
Prepare child to run independently of its parent process. Specific behavior [depends on the platform](https://nodejs.org/api/child_process.html#child_process_options_detached).
|
||||
|
||||
#### uid
|
||||
|
||||
Type: `number`
|
||||
|
||||
Sets the user identity of the process.
|
||||
|
||||
#### gid
|
||||
|
||||
Type: `number`
|
||||
|
||||
Sets the group identity of the process.
|
||||
|
||||
#### shell
|
||||
|
||||
Type: `boolean | string`\
|
||||
Default: `false`
|
||||
|
||||
If `true`, runs `file` inside of a shell. Uses `/bin/sh` on UNIX and `cmd.exe` on Windows. A different shell can be specified as a string. The shell should understand the `-c` switch on UNIX or `/d /s /c` on Windows.
|
||||
|
||||
We recommend against using this option since it is:
|
||||
- not cross-platform, encouraging shell-specific syntax.
|
||||
- slower, because of the additional shell interpretation.
|
||||
- unsafe, potentially allowing command injection.
|
||||
|
||||
#### encoding
|
||||
|
||||
Type: `string | null`\
|
||||
Default: `utf8`
|
||||
|
||||
Specify the character encoding used to decode the `stdout` and `stderr` output. If set to `null`, then `stdout` and `stderr` will be a `Buffer` instead of a string.
|
||||
|
||||
#### timeout
|
||||
|
||||
Type: `number`\
|
||||
Default: `0`
|
||||
|
||||
If timeout is greater than `0`, the parent will send the signal identified by the `killSignal` property (the default is `SIGTERM`) if the child runs longer than timeout milliseconds.
|
||||
|
||||
#### maxBuffer
|
||||
|
||||
Type: `number`\
|
||||
Default: `100_000_000` (100 MB)
|
||||
|
||||
Largest amount of data in bytes allowed on `stdout` or `stderr`.
|
||||
|
||||
#### killSignal
|
||||
|
||||
Type: `string | number`\
|
||||
Default: `SIGTERM`
|
||||
|
||||
Signal value to be used when the spawned process will be killed.
|
||||
|
||||
#### windowsVerbatimArguments
|
||||
|
||||
Type: `boolean`\
|
||||
Default: `false`
|
||||
|
||||
If `true`, no quoting or escaping of arguments is done on Windows. Ignored on other platforms. This is set to `true` automatically when the `shell` option is `true`.
|
||||
|
||||
#### windowsHide
|
||||
|
||||
Type: `boolean`\
|
||||
Default: `true`
|
||||
|
||||
On Windows, do not create a new console window. Please note this also prevents `CTRL-C` [from working](https://github.com/nodejs/node/issues/29837) on Windows.
|
||||
|
||||
#### nodePath *(For `.node()` only)*
|
||||
|
||||
Type: `string`\
|
||||
Default: [`process.execPath`](https://nodejs.org/api/process.html#process_process_execpath)
|
||||
|
||||
Node.js executable used to create the child process.
|
||||
|
||||
#### nodeOptions *(For `.node()` only)*
|
||||
|
||||
Type: `string[]`\
|
||||
Default: [`process.execArgv`](https://nodejs.org/api/process.html#process_process_execargv)
|
||||
|
||||
List of [CLI options](https://nodejs.org/api/cli.html#cli_options) passed to the Node.js executable.
|
||||
|
||||
## Tips
|
||||
|
||||
### Retry on error
|
||||
|
||||
Gracefully handle failures by using automatic retries and exponential backoff with the [`p-retry`](https://github.com/sindresorhus/p-retry) package:
|
||||
|
||||
```js
|
||||
const pRetry = require('p-retry');
|
||||
|
||||
const run = async () => {
|
||||
const results = await execa('curl', ['-sSL', 'https://sindresorhus.com/unicorn']);
|
||||
return results;
|
||||
};
|
||||
|
||||
(async () => {
|
||||
console.log(await pRetry(run, {retries: 5}));
|
||||
})();
|
||||
```
|
||||
|
||||
### Save and pipe output from a child process
|
||||
|
||||
Let's say you want to show the output of a child process in real-time while also saving it to a variable.
|
||||
|
||||
```js
|
||||
const execa = require('execa');
|
||||
|
||||
const subprocess = execa('echo', ['foo']);
|
||||
subprocess.stdout.pipe(process.stdout);
|
||||
|
||||
(async () => {
|
||||
const {stdout} = await subprocess;
|
||||
console.log('child output:', stdout);
|
||||
})();
|
||||
```
|
||||
|
||||
### Redirect output to a file
|
||||
|
||||
```js
|
||||
const execa = require('execa');
|
||||
|
||||
const subprocess = execa('echo', ['foo'])
|
||||
subprocess.stdout.pipe(fs.createWriteStream('stdout.txt'))
|
||||
```
|
||||
|
||||
### Redirect input from a file
|
||||
|
||||
```js
|
||||
const execa = require('execa');
|
||||
|
||||
const subprocess = execa('cat')
|
||||
fs.createReadStream('stdin.txt').pipe(subprocess.stdin)
|
||||
```
|
||||
|
||||
### Execute the current package's binary
|
||||
|
||||
```js
|
||||
const {getBinPathSync} = require('get-bin-path');
|
||||
|
||||
const binPath = getBinPathSync();
|
||||
const subprocess = execa(binPath);
|
||||
```
|
||||
|
||||
`execa` can be combined with [`get-bin-path`](https://github.com/ehmicky/get-bin-path) to test the current package's binary. As opposed to hard-coding the path to the binary, this validates that the `package.json` `bin` field is correctly set up.
|
||||
|
||||
## Related
|
||||
|
||||
- [gulp-execa](https://github.com/ehmicky/gulp-execa) - Gulp plugin for `execa`
|
||||
- [nvexeca](https://github.com/ehmicky/nvexeca) - Run `execa` using any Node.js version
|
||||
- [sudo-prompt](https://github.com/jorangreef/sudo-prompt) - Run commands with elevated privileges.
|
||||
|
||||
## Maintainers
|
||||
|
||||
- [Sindre Sorhus](https://github.com/sindresorhus)
|
||||
- [@ehmicky](https://github.com/ehmicky)
|
||||
|
||||
---
|
||||
|
||||
<div align="center">
|
||||
<b>
|
||||
<a href="https://tidelift.com/subscription/pkg/npm-execa?utm_source=npm-execa&utm_medium=referral&utm_campaign=readme">Get professional support for this package with a Tidelift subscription</a>
|
||||
</b>
|
||||
<br>
|
||||
<sub>
|
||||
Tidelift helps make open source sustainable for maintainers while giving companies<br>assurances about security, maintenance, and licensing for their dependencies.
|
||||
</sub>
|
||||
</div>
|
||||
@@ -0,0 +1 @@
|
||||
{"name":"next-tick","version":"1.1.0","files":{".editorconfig":{"checkedAt":1678883668460,"integrity":"sha512-UxFUp3I+5xuYgyrI3NGrxt1Pc22gpmpcWYXjLgf7DEKHy/qCMN4/AuuCOrm+WzniooGROVkEyDYaoVkivbFwow==","mode":420,"size":288},".lint":{"checkedAt":1678883668460,"integrity":"sha512-VNdAZU1SaDoxH2Zw/jFqTk+BfA6UKIDWQyOBT4UtzJ73477qsAJt3dLLpxAU5Z6lpZQ6KrhbW2hOApvmhMRg8Q==","mode":420,"size":202},"CHANGES":{"checkedAt":1678883668460,"integrity":"sha512-99E4FGgVU4NYETz4mxOp1HDLznyDFmTEDQ5slfrhtJlI+l0BbZE+xspuvFUaNOLYc3zr0HHAtkp771ztvZ0N4A==","mode":420,"size":947},"LICENSE":{"checkedAt":1678883668460,"integrity":"sha512-YUCo6+WnVPM/NUa914eaniGMzPhKgkaGYYZ4NlblMmRmgb82tzfstzSOWl9Qmb/Ev2G4+axYdU1Su7BIIstBAg==","mode":420,"size":773},"index.js":{"checkedAt":1678883668460,"integrity":"sha512-B6bKRQYSpKwDej6Xy6L76QxvD9MIPAzPb1Ns6YFV1/CzqUgJXnWOVYHVOajUcq9zv0Lt7G84m7PbOUpMk6AhPQ==","mode":420,"size":2039},"test/index.js":{"checkedAt":1678883668460,"integrity":"sha512-0O1vtOYzOi3xUChBSoHX9FB7eqUU6ZdSHLNT35dxiobQTicxzIYYcL8+hXxFAr7dT610AxJLoz/wUGVv2iluTA==","mode":420,"size":518},"CHANGELOG.md":{"checkedAt":1678883668460,"integrity":"sha512-QhdlUI7pe86IdSGww5ALy2xoDIiH4iexLo/1eZjqruwnmVYU6Bl6JQY+3VWOVF+c/N1k16v5f79l8ZsyY8kzDg==","mode":420,"size":540},".github/FUNDING.yml":{"checkedAt":1678883668460,"integrity":"sha512-SsdzlbAijjZonjQibpDFlFmoWggqpyy2rkuvIW9WFXX53f9AMASeVGHizvxOcizwWF3/e5YOpWtVe9eBKpsttQ==","mode":420,"size":26},"README.md":{"checkedAt":1678883668460,"integrity":"sha512-ivtXetN7v8Ak5OlsEidGBWwdWZWLNe9d2Mt8wdiDP5rsP790IRMHeB3P+er2FbsKj3jIiPHcTMzZ1F6ZI36o6A==","mode":420,"size":1557},"package.json":{"checkedAt":1678883668475,"integrity":"sha512-vB7NxRk6kpuNgA79lFoR69P9A6I+Oc9utqG9D1QuqTejrO/blyx7XMOt7+F/MevoSu1l99jXolpGO37oMQItyQ==","mode":420,"size":760}}}
|
||||
@@ -0,0 +1,14 @@
|
||||
import { TemplateNode } from '../../interfaces';
|
||||
import Component from '../Component';
|
||||
import Expression from './shared/Expression';
|
||||
import Node from './shared/Node';
|
||||
import TemplateScope from './shared/TemplateScope';
|
||||
export default class StyleDirective extends Node {
|
||||
type: 'StyleDirective';
|
||||
name: string;
|
||||
modifiers: Set<string>;
|
||||
expression: Expression;
|
||||
should_cache: boolean;
|
||||
constructor(component: Component, parent: Node, scope: TemplateScope, info: TemplateNode);
|
||||
get important(): boolean;
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{"name":"@sindresorhus/is","version":"5.3.0","files":{"license":{"checkedAt":1678883669302,"integrity":"sha512-0fM2/ycrxrltyaBKfQ748Ck23VlPUUBgNAR47ldf4B1V/HoXTfWBSk+vcshGKwEpmOynu4mOP5o+hyBfuRNa8g==","mode":420,"size":1117},"package.json":{"checkedAt":1678883670959,"integrity":"sha512-nT3vn5+B+y75myKRHhbkDOpVDbHxrYcWmUGeajAxeOFC7rvgGPFhgqm2zLWmcvnXj7tr3NR/h9qi5uFhinnKyA==","mode":420,"size":1547},"dist/index.js":{"checkedAt":1678883670959,"integrity":"sha512-lGxWoj8SVhkCXp57kzDKX2q4+mVtG3d/n/7Ey2M59j8glKImo5HE/wVnekhiky8hdRqM9tB5GviQ0thknnrSeg==","mode":420,"size":22610},"dist/types.js":{"checkedAt":1678883670960,"integrity":"sha512-yjEgaDfGKoWtk3fD30EOrbDdDERWenlMSYnrLGRXFqzCazxdNdbPNFEmRAZFmPF2JmMB3wcVX6mIwa4EDRpShQ==","mode":420,"size":128},"readme.md":{"checkedAt":1678883670963,"integrity":"sha512-QQ0Dzuqx9JvbVLV5Ly4PR5q8hhiaCionitZrnbanhz+n6wnQq+16/UHgTBN/P47dF12nROEMvw8VA+0HQ6B0jA==","mode":420,"size":17377},"dist/types.d.ts":{"checkedAt":1678883670964,"integrity":"sha512-yxI+aGRo6JvXcuXyXBuruI23Qw5yzmNxcd7hQJAleHh9X2Hsi4ad9PZFwYbeb0YIitIKgud2QsL6Q7dvB/DCrw==","mode":420,"size":1298},"dist/index.d.ts":{"checkedAt":1678883670964,"integrity":"sha512-edjAY0wRXjT6aDXd+P5u6hZ8f5A85ZunlZYk+mh1awIGxZ1Z0j4Aqxq19RLe9wf3+3U+AUuCctzHx59IXPSQxQ==","mode":420,"size":14839}}}
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,24 @@
|
||||
var assignValue = require('./_assignValue'),
|
||||
baseZipObject = require('./_baseZipObject');
|
||||
|
||||
/**
|
||||
* This method is like `_.fromPairs` except that it accepts two arrays,
|
||||
* one of property identifiers and one of corresponding values.
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
* @since 0.4.0
|
||||
* @category Array
|
||||
* @param {Array} [props=[]] The property identifiers.
|
||||
* @param {Array} [values=[]] The property values.
|
||||
* @returns {Object} Returns the new object.
|
||||
* @example
|
||||
*
|
||||
* _.zipObject(['a', 'b'], [1, 2]);
|
||||
* // => { 'a': 1, 'b': 2 }
|
||||
*/
|
||||
function zipObject(props, values) {
|
||||
return baseZipObject(props || [], values || [], assignValue);
|
||||
}
|
||||
|
||||
module.exports = zipObject;
|
||||
@@ -0,0 +1,3 @@
|
||||
"use strict";
|
||||
|
||||
module.exports = require("./is-implemented")() ? String.prototype.startsWith : require("./shim");
|
||||
@@ -0,0 +1,94 @@
|
||||
import { createFrame, extend, toString } from './utils';
|
||||
import Exception from './exception';
|
||||
import { registerDefaultHelpers } from './helpers';
|
||||
import { registerDefaultDecorators } from './decorators';
|
||||
import logger from './logger';
|
||||
import { resetLoggedProperties } from './internal/proto-access';
|
||||
|
||||
export const VERSION = '4.7.7';
|
||||
export const COMPILER_REVISION = 8;
|
||||
export const LAST_COMPATIBLE_COMPILER_REVISION = 7;
|
||||
|
||||
export const REVISION_CHANGES = {
|
||||
1: '<= 1.0.rc.2', // 1.0.rc.2 is actually rev2 but doesn't report it
|
||||
2: '== 1.0.0-rc.3',
|
||||
3: '== 1.0.0-rc.4',
|
||||
4: '== 1.x.x',
|
||||
5: '== 2.0.0-alpha.x',
|
||||
6: '>= 2.0.0-beta.1',
|
||||
7: '>= 4.0.0 <4.3.0',
|
||||
8: '>= 4.3.0'
|
||||
};
|
||||
|
||||
const objectType = '[object Object]';
|
||||
|
||||
export function HandlebarsEnvironment(helpers, partials, decorators) {
|
||||
this.helpers = helpers || {};
|
||||
this.partials = partials || {};
|
||||
this.decorators = decorators || {};
|
||||
|
||||
registerDefaultHelpers(this);
|
||||
registerDefaultDecorators(this);
|
||||
}
|
||||
|
||||
HandlebarsEnvironment.prototype = {
|
||||
constructor: HandlebarsEnvironment,
|
||||
|
||||
logger: logger,
|
||||
log: logger.log,
|
||||
|
||||
registerHelper: function(name, fn) {
|
||||
if (toString.call(name) === objectType) {
|
||||
if (fn) {
|
||||
throw new Exception('Arg not supported with multiple helpers');
|
||||
}
|
||||
extend(this.helpers, name);
|
||||
} else {
|
||||
this.helpers[name] = fn;
|
||||
}
|
||||
},
|
||||
unregisterHelper: function(name) {
|
||||
delete this.helpers[name];
|
||||
},
|
||||
|
||||
registerPartial: function(name, partial) {
|
||||
if (toString.call(name) === objectType) {
|
||||
extend(this.partials, name);
|
||||
} else {
|
||||
if (typeof partial === 'undefined') {
|
||||
throw new Exception(
|
||||
`Attempting to register a partial called "${name}" as undefined`
|
||||
);
|
||||
}
|
||||
this.partials[name] = partial;
|
||||
}
|
||||
},
|
||||
unregisterPartial: function(name) {
|
||||
delete this.partials[name];
|
||||
},
|
||||
|
||||
registerDecorator: function(name, fn) {
|
||||
if (toString.call(name) === objectType) {
|
||||
if (fn) {
|
||||
throw new Exception('Arg not supported with multiple decorators');
|
||||
}
|
||||
extend(this.decorators, name);
|
||||
} else {
|
||||
this.decorators[name] = fn;
|
||||
}
|
||||
},
|
||||
unregisterDecorator: function(name) {
|
||||
delete this.decorators[name];
|
||||
},
|
||||
/**
|
||||
* Reset the memory of illegal property accesses that have already been logged.
|
||||
* @deprecated should only be used in handlebars test-cases
|
||||
*/
|
||||
resetLoggedPropertyAccesses() {
|
||||
resetLoggedProperties();
|
||||
}
|
||||
};
|
||||
|
||||
export let log = logger.log;
|
||||
|
||||
export { createFrame, logger };
|
||||
@@ -0,0 +1,17 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.isMissingLocaleDataError = void 0;
|
||||
var tslib_1 = require("tslib");
|
||||
var MissingLocaleDataError = /** @class */ (function (_super) {
|
||||
(0, tslib_1.__extends)(MissingLocaleDataError, _super);
|
||||
function MissingLocaleDataError() {
|
||||
var _this = _super !== null && _super.apply(this, arguments) || this;
|
||||
_this.type = 'MISSING_LOCALE_DATA';
|
||||
return _this;
|
||||
}
|
||||
return MissingLocaleDataError;
|
||||
}(Error));
|
||||
function isMissingLocaleDataError(e) {
|
||||
return e.type === 'MISSING_LOCALE_DATA';
|
||||
}
|
||||
exports.isMissingLocaleDataError = isMissingLocaleDataError;
|
||||
@@ -0,0 +1,9 @@
|
||||
if (!globalThis.DOMException) {
|
||||
const { MessageChannel } = require('worker_threads')
|
||||
const port = new MessageChannel().port1
|
||||
const ab = new ArrayBuffer()
|
||||
try { port.postMessage(ab, [ab, ab]) }
|
||||
catch (err) { globalThis.DOMException = err.constructor }
|
||||
}
|
||||
|
||||
module.exports
|
||||
@@ -0,0 +1,370 @@
|
||||
/******************************************************************************
|
||||
Copyright (c) Microsoft Corporation.
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted.
|
||||
|
||||
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.
|
||||
***************************************************************************** */
|
||||
/* global global, define, System, Reflect, Promise */
|
||||
var __extends;
|
||||
var __assign;
|
||||
var __rest;
|
||||
var __decorate;
|
||||
var __param;
|
||||
var __esDecorate;
|
||||
var __runInitializers;
|
||||
var __propKey;
|
||||
var __setFunctionName;
|
||||
var __metadata;
|
||||
var __awaiter;
|
||||
var __generator;
|
||||
var __exportStar;
|
||||
var __values;
|
||||
var __read;
|
||||
var __spread;
|
||||
var __spreadArrays;
|
||||
var __spreadArray;
|
||||
var __await;
|
||||
var __asyncGenerator;
|
||||
var __asyncDelegator;
|
||||
var __asyncValues;
|
||||
var __makeTemplateObject;
|
||||
var __importStar;
|
||||
var __importDefault;
|
||||
var __classPrivateFieldGet;
|
||||
var __classPrivateFieldSet;
|
||||
var __classPrivateFieldIn;
|
||||
var __createBinding;
|
||||
(function (factory) {
|
||||
var root = typeof global === "object" ? global : typeof self === "object" ? self : typeof this === "object" ? this : {};
|
||||
if (typeof define === "function" && define.amd) {
|
||||
define("tslib", ["exports"], function (exports) { factory(createExporter(root, createExporter(exports))); });
|
||||
}
|
||||
else if (typeof module === "object" && typeof module.exports === "object") {
|
||||
factory(createExporter(root, createExporter(module.exports)));
|
||||
}
|
||||
else {
|
||||
factory(createExporter(root));
|
||||
}
|
||||
function createExporter(exports, previous) {
|
||||
if (exports !== root) {
|
||||
if (typeof Object.create === "function") {
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
}
|
||||
else {
|
||||
exports.__esModule = true;
|
||||
}
|
||||
}
|
||||
return function (id, v) { return exports[id] = previous ? previous(id, v) : v; };
|
||||
}
|
||||
})
|
||||
(function (exporter) {
|
||||
var extendStatics = Object.setPrototypeOf ||
|
||||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
||||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
||||
|
||||
__extends = function (d, b) {
|
||||
if (typeof b !== "function" && b !== null)
|
||||
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
||||
extendStatics(d, b);
|
||||
function __() { this.constructor = d; }
|
||||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||
};
|
||||
|
||||
__assign = Object.assign || function (t) {
|
||||
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
||||
s = arguments[i];
|
||||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
||||
}
|
||||
return t;
|
||||
};
|
||||
|
||||
__rest = function (s, e) {
|
||||
var t = {};
|
||||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
||||
t[p] = s[p];
|
||||
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
||||
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
||||
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
||||
t[p[i]] = s[p[i]];
|
||||
}
|
||||
return t;
|
||||
};
|
||||
|
||||
__decorate = function (decorators, target, key, desc) {
|
||||
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
||||
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
||||
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
||||
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
||||
};
|
||||
|
||||
__param = function (paramIndex, decorator) {
|
||||
return function (target, key) { decorator(target, key, paramIndex); }
|
||||
};
|
||||
|
||||
__esDecorate = function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
|
||||
function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
|
||||
var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
|
||||
var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
|
||||
var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
|
||||
var _, done = false;
|
||||
for (var i = decorators.length - 1; i >= 0; i--) {
|
||||
var context = {};
|
||||
for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
|
||||
for (var p in contextIn.access) context.access[p] = contextIn.access[p];
|
||||
context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
|
||||
var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
|
||||
if (kind === "accessor") {
|
||||
if (result === void 0) continue;
|
||||
if (result === null || typeof result !== "object") throw new TypeError("Object expected");
|
||||
if (_ = accept(result.get)) descriptor.get = _;
|
||||
if (_ = accept(result.set)) descriptor.set = _;
|
||||
if (_ = accept(result.init)) initializers.push(_);
|
||||
}
|
||||
else if (_ = accept(result)) {
|
||||
if (kind === "field") initializers.push(_);
|
||||
else descriptor[key] = _;
|
||||
}
|
||||
}
|
||||
if (target) Object.defineProperty(target, contextIn.name, descriptor);
|
||||
done = true;
|
||||
};
|
||||
|
||||
__runInitializers = function (thisArg, initializers, value) {
|
||||
var useValue = arguments.length > 2;
|
||||
for (var i = 0; i < initializers.length; i++) {
|
||||
value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
|
||||
}
|
||||
return useValue ? value : void 0;
|
||||
};
|
||||
|
||||
__propKey = function (x) {
|
||||
return typeof x === "symbol" ? x : "".concat(x);
|
||||
};
|
||||
|
||||
__setFunctionName = function (f, name, prefix) {
|
||||
if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : "";
|
||||
return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name });
|
||||
};
|
||||
|
||||
__metadata = function (metadataKey, metadataValue) {
|
||||
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue);
|
||||
};
|
||||
|
||||
__awaiter = function (thisArg, _arguments, P, generator) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
|
||||
__generator = function (thisArg, body) {
|
||||
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
||||
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
||||
function verb(n) { return function (v) { return step([n, v]); }; }
|
||||
function step(op) {
|
||||
if (f) throw new TypeError("Generator is already executing.");
|
||||
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
||||
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
||||
if (y = 0, t) op = [op[0] & 2, t.value];
|
||||
switch (op[0]) {
|
||||
case 0: case 1: t = op; break;
|
||||
case 4: _.label++; return { value: op[1], done: false };
|
||||
case 5: _.label++; y = op[1]; op = [0]; continue;
|
||||
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
||||
default:
|
||||
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
||||
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
||||
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
||||
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
||||
if (t[2]) _.ops.pop();
|
||||
_.trys.pop(); continue;
|
||||
}
|
||||
op = body.call(thisArg, _);
|
||||
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
||||
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
||||
}
|
||||
};
|
||||
|
||||
__exportStar = function(m, o) {
|
||||
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p);
|
||||
};
|
||||
|
||||
__createBinding = Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
});
|
||||
|
||||
__values = function (o) {
|
||||
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
||||
if (m) return m.call(o);
|
||||
if (o && typeof o.length === "number") return {
|
||||
next: function () {
|
||||
if (o && i >= o.length) o = void 0;
|
||||
return { value: o && o[i++], done: !o };
|
||||
}
|
||||
};
|
||||
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
||||
};
|
||||
|
||||
__read = function (o, n) {
|
||||
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
||||
if (!m) return o;
|
||||
var i = m.call(o), r, ar = [], e;
|
||||
try {
|
||||
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
||||
}
|
||||
catch (error) { e = { error: error }; }
|
||||
finally {
|
||||
try {
|
||||
if (r && !r.done && (m = i["return"])) m.call(i);
|
||||
}
|
||||
finally { if (e) throw e.error; }
|
||||
}
|
||||
return ar;
|
||||
};
|
||||
|
||||
/** @deprecated */
|
||||
__spread = function () {
|
||||
for (var ar = [], i = 0; i < arguments.length; i++)
|
||||
ar = ar.concat(__read(arguments[i]));
|
||||
return ar;
|
||||
};
|
||||
|
||||
/** @deprecated */
|
||||
__spreadArrays = function () {
|
||||
for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
|
||||
for (var r = Array(s), k = 0, i = 0; i < il; i++)
|
||||
for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
|
||||
r[k] = a[j];
|
||||
return r;
|
||||
};
|
||||
|
||||
__spreadArray = function (to, from, pack) {
|
||||
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
||||
if (ar || !(i in from)) {
|
||||
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
||||
ar[i] = from[i];
|
||||
}
|
||||
}
|
||||
return to.concat(ar || Array.prototype.slice.call(from));
|
||||
};
|
||||
|
||||
__await = function (v) {
|
||||
return this instanceof __await ? (this.v = v, this) : new __await(v);
|
||||
};
|
||||
|
||||
__asyncGenerator = function (thisArg, _arguments, generator) {
|
||||
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
||||
var g = generator.apply(thisArg, _arguments || []), i, q = [];
|
||||
return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
|
||||
function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
|
||||
function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }
|
||||
function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
|
||||
function fulfill(value) { resume("next", value); }
|
||||
function reject(value) { resume("throw", value); }
|
||||
function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }
|
||||
};
|
||||
|
||||
__asyncDelegator = function (o) {
|
||||
var i, p;
|
||||
return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
|
||||
function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: false } : f ? f(v) : v; } : f; }
|
||||
};
|
||||
|
||||
__asyncValues = function (o) {
|
||||
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
||||
var m = o[Symbol.asyncIterator], i;
|
||||
return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
|
||||
function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
|
||||
function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
|
||||
};
|
||||
|
||||
__makeTemplateObject = function (cooked, raw) {
|
||||
if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
|
||||
return cooked;
|
||||
};
|
||||
|
||||
var __setModuleDefault = Object.create ? (function(o, v) {
|
||||
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||
}) : function(o, v) {
|
||||
o["default"] = v;
|
||||
};
|
||||
|
||||
__importStar = function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
};
|
||||
|
||||
__importDefault = function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
|
||||
__classPrivateFieldGet = function (receiver, state, kind, f) {
|
||||
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
||||
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
||||
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
||||
};
|
||||
|
||||
__classPrivateFieldSet = function (receiver, state, value, kind, f) {
|
||||
if (kind === "m") throw new TypeError("Private method is not writable");
|
||||
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
||||
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
||||
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
||||
};
|
||||
|
||||
__classPrivateFieldIn = function (state, receiver) {
|
||||
if (receiver === null || (typeof receiver !== "object" && typeof receiver !== "function")) throw new TypeError("Cannot use 'in' operator on non-object");
|
||||
return typeof state === "function" ? receiver === state : state.has(receiver);
|
||||
};
|
||||
|
||||
exporter("__extends", __extends);
|
||||
exporter("__assign", __assign);
|
||||
exporter("__rest", __rest);
|
||||
exporter("__decorate", __decorate);
|
||||
exporter("__param", __param);
|
||||
exporter("__esDecorate", __esDecorate);
|
||||
exporter("__runInitializers", __runInitializers);
|
||||
exporter("__propKey", __propKey);
|
||||
exporter("__setFunctionName", __setFunctionName);
|
||||
exporter("__metadata", __metadata);
|
||||
exporter("__awaiter", __awaiter);
|
||||
exporter("__generator", __generator);
|
||||
exporter("__exportStar", __exportStar);
|
||||
exporter("__createBinding", __createBinding);
|
||||
exporter("__values", __values);
|
||||
exporter("__read", __read);
|
||||
exporter("__spread", __spread);
|
||||
exporter("__spreadArrays", __spreadArrays);
|
||||
exporter("__spreadArray", __spreadArray);
|
||||
exporter("__await", __await);
|
||||
exporter("__asyncGenerator", __asyncGenerator);
|
||||
exporter("__asyncDelegator", __asyncDelegator);
|
||||
exporter("__asyncValues", __asyncValues);
|
||||
exporter("__makeTemplateObject", __makeTemplateObject);
|
||||
exporter("__importStar", __importStar);
|
||||
exporter("__importDefault", __importDefault);
|
||||
exporter("__classPrivateFieldGet", __classPrivateFieldGet);
|
||||
exporter("__classPrivateFieldSet", __classPrivateFieldSet);
|
||||
exporter("__classPrivateFieldIn", __classPrivateFieldIn);
|
||||
});
|
||||
@@ -0,0 +1,15 @@
|
||||
The ISC License
|
||||
|
||||
Copyright (c) 2015, 2019 Elan Shanker
|
||||
|
||||
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,4 @@
|
||||
import { ReadableStreamLike } from '../types';
|
||||
export declare function readableStreamLikeToAsyncGenerator<T>(readableStream: ReadableStreamLike<T>): AsyncGenerator<T>;
|
||||
export declare function isReadableStreamLike<T>(obj: any): obj is ReadableStreamLike<T>;
|
||||
//# sourceMappingURL=isReadableStreamLike.d.ts.map
|
||||
@@ -0,0 +1,35 @@
|
||||
var baseSet = require('./_baseSet');
|
||||
|
||||
/**
|
||||
* Sets the value at `path` of `object`. If a portion of `path` doesn't exist,
|
||||
* it's created. Arrays are created for missing index properties while objects
|
||||
* are created for all other missing properties. Use `_.setWith` to customize
|
||||
* `path` creation.
|
||||
*
|
||||
* **Note:** This method mutates `object`.
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
* @since 3.7.0
|
||||
* @category Object
|
||||
* @param {Object} object The object to modify.
|
||||
* @param {Array|string} path The path of the property to set.
|
||||
* @param {*} value The value to set.
|
||||
* @returns {Object} Returns `object`.
|
||||
* @example
|
||||
*
|
||||
* var object = { 'a': [{ 'b': { 'c': 3 } }] };
|
||||
*
|
||||
* _.set(object, 'a[0].b.c', 4);
|
||||
* console.log(object.a[0].b.c);
|
||||
* // => 4
|
||||
*
|
||||
* _.set(object, ['x', '0', 'y', 'z'], 5);
|
||||
* console.log(object.x[0].y.z);
|
||||
* // => 5
|
||||
*/
|
||||
function set(object, path, value) {
|
||||
return object == null ? object : baseSet(object, path, value);
|
||||
}
|
||||
|
||||
module.exports = set;
|
||||
@@ -0,0 +1,27 @@
|
||||
'use strict';
|
||||
const lazy = (importedModule, importFn, moduleId) =>
|
||||
importedModule === undefined ? importFn(moduleId) : importedModule;
|
||||
|
||||
module.exports = importFn => {
|
||||
return moduleId => {
|
||||
let importedModule;
|
||||
|
||||
const handler = {
|
||||
get: (target, property) => {
|
||||
importedModule = lazy(importedModule, importFn, moduleId);
|
||||
return Reflect.get(importedModule, property);
|
||||
},
|
||||
apply: (target, thisArgument, argumentsList) => {
|
||||
importedModule = lazy(importedModule, importFn, moduleId);
|
||||
return Reflect.apply(importedModule, thisArgument, argumentsList);
|
||||
},
|
||||
construct: (target, argumentsList) => {
|
||||
importedModule = lazy(importedModule, importFn, moduleId);
|
||||
return Reflect.construct(importedModule, argumentsList);
|
||||
}
|
||||
};
|
||||
|
||||
// eslint-disable-next-line prefer-arrow-callback
|
||||
return new Proxy(function () {}, handler);
|
||||
};
|
||||
};
|
||||
@@ -0,0 +1,14 @@
|
||||
'use strict';
|
||||
|
||||
var define = require('define-properties');
|
||||
var getPolyfill = require('./polyfill');
|
||||
|
||||
module.exports = function shimTrimEnd() {
|
||||
var polyfill = getPolyfill();
|
||||
define(
|
||||
String.prototype,
|
||||
{ trimEnd: polyfill },
|
||||
{ trimEnd: function () { return String.prototype.trimEnd !== polyfill; } }
|
||||
);
|
||||
return polyfill;
|
||||
};
|
||||
@@ -0,0 +1 @@
|
||||
{"name":"pac-proxy-agent","version":"5.0.0","files":{"dist/index.js":{"checkedAt":1678883671994,"integrity":"sha512-69wcklfiMpfRivpoidETxPyEFv15UX0uYpi2oSH0MPkuykLAcA301opgkc/lPxBFAgM/ED5iSK0IwsHK4hRcTQ==","mode":420,"size":1381},"dist/agent.js":{"checkedAt":1678883671994,"integrity":"sha512-gBdpY2vPSQr01GmIBFaQAfGrPOorOF7t7hwhLuSLwQ7N4PK3T3UTqBU/ObBqwFUbg55MdXgGfOGpR+cvPw5L5w==","mode":420,"size":9598},"package.json":{"checkedAt":1678883671994,"integrity":"sha512-PxXKZw+KN3zEaaNiCSjC4CiTmUDAdhIxmWRljrSI8i5vvxhDFqU9CX2twtdYBd6p68u7qiGjn1fX7XqIIOcwjg==","mode":420,"size":1752},"dist/index.js.map":{"checkedAt":1678883671997,"integrity":"sha512-YLOPe79lJaSeKolWIenSgEZS8ZkBZQQgOv89mDxDEAbHboZDgBKdMIRuX7xbyfkdHWfu0pDNIBmBgxQPLTp06Q==","mode":420,"size":975},"dist/agent.js.map":{"checkedAt":1678883671997,"integrity":"sha512-8+uPAvSUJ5JwvZ2mYm06vKIrQ0+vY0OACsMJVHOuM7MEg3yhOX2ERLQbNyicypR4fQxPZFxx6jAaLliqw5dSsQ==","mode":420,"size":5474},"README.md":{"checkedAt":1678883671997,"integrity":"sha512-4MqF4SVVk1pXEDEMYzaA+tDqL/881L/cI6EMEfV6c3HqzjMx7p4kjaOHIu887L5EZtcjvAV/JgPwwXwG0Q1EAw==","mode":420,"size":2624},"dist/agent.d.ts":{"checkedAt":1678883671997,"integrity":"sha512-icE9bToxwP4zfZG6Y/Asx48jUP5eWjQR5WYHu2Mp/3FoRwz+fzdPwFiXDJnsNLwvDcKYHNc0Q5vbJ+5Tpd/c2A==","mode":420,"size":1600},"dist/index.d.ts":{"checkedAt":1678883671997,"integrity":"sha512-sMJXLGQIylD6DPzfrbiSo9qlOmuDCiuLXOmvL9E6Vmbs2IDAMaQhddqP9/hTyeD17ZQp4lQBM48aevBQbAvf0A==","mode":420,"size":1018}}}
|
||||
@@ -0,0 +1,73 @@
|
||||
/**
|
||||
* What is the default action for this signal when it is not handled.
|
||||
*/
|
||||
export type SignalAction = 'terminate' | 'core' | 'ignore' | 'pause' | 'unpause'
|
||||
|
||||
/**
|
||||
* Which standard defined that signal.
|
||||
*/
|
||||
export type SignalStandard = 'ansi' | 'posix' | 'bsd' | 'systemv' | 'other'
|
||||
|
||||
/**
|
||||
* Standard name of the signal, for example 'SIGINT'.
|
||||
*/
|
||||
export type SignalName = `SIG${string}`
|
||||
|
||||
/**
|
||||
* Code number of the signal, for example 2.
|
||||
* While most number are cross-platform, some are different between different
|
||||
* OS.
|
||||
*/
|
||||
export type SignalNumber = number
|
||||
|
||||
export type Signal = {
|
||||
/**
|
||||
* Standard name of the signal, for example 'SIGINT'.
|
||||
*/
|
||||
name: SignalName
|
||||
|
||||
/**
|
||||
* Code number of the signal, for example 2.
|
||||
* While most number are cross-platform, some are different between different
|
||||
* OS.
|
||||
*/
|
||||
number: SignalNumber
|
||||
|
||||
/**
|
||||
* Human-friendly description for the signal, for example
|
||||
* 'User interruption with CTRL-C'.
|
||||
*/
|
||||
description: string
|
||||
|
||||
/**
|
||||
* Whether the current OS can handle this signal in Node.js using
|
||||
* `process.on(name, handler)`. The list of supported signals is OS-specific.
|
||||
*/
|
||||
supported: boolean
|
||||
|
||||
/**
|
||||
* What is the default action for this signal when it is not handled.
|
||||
*/
|
||||
action: SignalAction
|
||||
|
||||
/**
|
||||
* Whether the signal's default action cannot be prevented.
|
||||
* This is true for SIGTERM, SIGKILL and SIGSTOP.
|
||||
*/
|
||||
forced: boolean
|
||||
|
||||
/**
|
||||
* Which standard defined that signal.
|
||||
*/
|
||||
standard: SignalStandard
|
||||
}
|
||||
|
||||
/**
|
||||
* Object whose keys are signal names and values are signal objects.
|
||||
*/
|
||||
export declare const signalsByName: { [signalName: SignalName]: Signal }
|
||||
|
||||
/**
|
||||
* Object whose keys are signal numbers and values are signal objects.
|
||||
*/
|
||||
export declare const signalsByNumber: { [signalNumber: SignalNumber]: Signal }
|
||||
@@ -0,0 +1,5 @@
|
||||
/// <reference types="node" />
|
||||
import { LookupAddress, LookupOptions } from 'dns';
|
||||
import { GMT } from './index';
|
||||
export declare function dnsLookup(host: string, opts: LookupOptions): Promise<string | LookupAddress[]>;
|
||||
export declare function isGMT(v: any): v is GMT;
|
||||
@@ -0,0 +1 @@
|
||||
{"name":"windows-release","version":"5.1.0","files":{"license":{"checkedAt":1678883669302,"integrity":"sha512-0fM2/ycrxrltyaBKfQ748Ck23VlPUUBgNAR47ldf4B1V/HoXTfWBSk+vcshGKwEpmOynu4mOP5o+hyBfuRNa8g==","mode":420,"size":1117},"index.js":{"checkedAt":1678883673413,"integrity":"sha512-mOq7yY9DY8V8XQa56MlabImoOT4+IgsnsSA/sQ3EuiIqPXwROuJWDFwN3xk6I+sD+RcUOgeE4CiswBLDMQ4umA==","mode":420,"size":2004},"readme.md":{"checkedAt":1678883673413,"integrity":"sha512-249JRE9A0CqbS1PKkwMslXULynTlsMKIK9AYGdKnNOMVM6fQCVEFxFmqj4jCLj8rIqztE4leQjJe1EsoaS4vCA==","mode":420,"size":1144},"index.d.ts":{"checkedAt":1678883673413,"integrity":"sha512-MAwmAMAtVa8YjTCxW1MsM8tjNe09A3hUqewbxMyL7IUkxFvNfosEYkZgHAy8gPcj6uAZgLx5RN1o7wwmJeOsCQ==","mode":420,"size":844},"package.json":{"checkedAt":1678883673413,"integrity":"sha512-6UbkHPQRocEDzitPeEmfVwIgsPVBBhxV2cytBquanYPaNHRyC3G2SYGW5IdvuG6IrstNI1RehnYnFk0sdWVxRw==","mode":420,"size":863}}}
|
||||
@@ -0,0 +1,19 @@
|
||||
"use strict";
|
||||
|
||||
var SymbolPolyfill = require("../polyfill");
|
||||
|
||||
module.exports = function (t, a) {
|
||||
var symbol;
|
||||
a.throws(function () { t(undefined); }, TypeError, "Undefined");
|
||||
a.throws(function () { t(null); }, TypeError, "Null");
|
||||
a.throws(function () { t(true); }, TypeError, "Primitive");
|
||||
a.throws(function () { t("raz"); }, TypeError, "String");
|
||||
a.throws(function () { t({}); }, TypeError, "Object");
|
||||
a.throws(function () { t([]); }, TypeError, "Array");
|
||||
if (typeof Symbol !== "undefined") {
|
||||
symbol = Symbol("foo");
|
||||
a(t(symbol), symbol, "Native");
|
||||
}
|
||||
symbol = SymbolPolyfill();
|
||||
a(t(symbol), symbol, "Polyfill");
|
||||
};
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"defaultIfEmpty.js","sourceRoot":"","sources":["../../../../src/internal/operators/defaultIfEmpty.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,wBAAwB,EAAE,MAAM,sBAAsB,CAAC;AAqChE,MAAM,UAAU,cAAc,CAAO,YAAe;IAClD,OAAO,OAAO,CAAC,CAAC,MAAM,EAAE,UAAU,EAAE,EAAE;QACpC,IAAI,QAAQ,GAAG,KAAK,CAAC;QACrB,MAAM,CAAC,SAAS,CACd,wBAAwB,CACtB,UAAU,EACV,CAAC,KAAK,EAAE,EAAE;YACR,QAAQ,GAAG,IAAI,CAAC;YAChB,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACzB,CAAC,EACD,GAAG,EAAE;YACH,IAAI,CAAC,QAAQ,EAAE;gBACb,UAAU,CAAC,IAAI,CAAC,YAAa,CAAC,CAAC;aAChC;YACD,UAAU,CAAC,QAAQ,EAAE,CAAC;QACxB,CAAC,CACF,CACF,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC"}
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"repeatWhen.js","sourceRoot":"","sources":["../../../../src/internal/operators/repeatWhen.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACpD,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAIrC,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,wBAAwB,EAAE,MAAM,sBAAsB,CAAC;AAoChE,MAAM,UAAU,UAAU,CAAI,QAAmE;IAC/F,OAAO,OAAO,CAAC,UAAC,MAAM,EAAE,UAAU;QAChC,IAAI,QAA6B,CAAC;QAClC,IAAI,SAAS,GAAG,KAAK,CAAC;QACtB,IAAI,YAA2B,CAAC;QAChC,IAAI,kBAAkB,GAAG,KAAK,CAAC;QAC/B,IAAI,cAAc,GAAG,KAAK,CAAC;QAK3B,IAAM,aAAa,GAAG,cAAM,OAAA,cAAc,IAAI,kBAAkB,IAAI,CAAC,UAAU,CAAC,QAAQ,EAAE,EAAE,IAAI,CAAC,EAArE,CAAqE,CAAC;QAKlG,IAAM,oBAAoB,GAAG;YAC3B,IAAI,CAAC,YAAY,EAAE;gBACjB,YAAY,GAAG,IAAI,OAAO,EAAE,CAAC;gBAI7B,SAAS,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAC,CAAC,SAAS,CACzC,wBAAwB,CACtB,UAAU,EACV;oBACE,IAAI,QAAQ,EAAE;wBACZ,sBAAsB,EAAE,CAAC;qBAC1B;yBAAM;wBAKL,SAAS,GAAG,IAAI,CAAC;qBAClB;gBACH,CAAC,EACD;oBACE,kBAAkB,GAAG,IAAI,CAAC;oBAC1B,aAAa,EAAE,CAAC;gBAClB,CAAC,CACF,CACF,CAAC;aACH;YACD,OAAO,YAAY,CAAC;QACtB,CAAC,CAAC;QAEF,IAAM,sBAAsB,GAAG;YAC7B,cAAc,GAAG,KAAK,CAAC;YAEvB,QAAQ,GAAG,MAAM,CAAC,SAAS,CACzB,wBAAwB,CAAC,UAAU,EAAE,SAAS,EAAE;gBAC9C,cAAc,GAAG,IAAI,CAAC;gBAMtB,CAAC,aAAa,EAAE,IAAI,oBAAoB,EAAE,CAAC,IAAI,EAAE,CAAC;YACpD,CAAC,CAAC,CACH,CAAC;YAEF,IAAI,SAAS,EAAE;gBAKb,QAAQ,CAAC,WAAW,EAAE,CAAC;gBAIvB,QAAQ,GAAG,IAAI,CAAC;gBAEhB,SAAS,GAAG,KAAK,CAAC;gBAElB,sBAAsB,EAAE,CAAC;aAC1B;QACH,CAAC,CAAC;QAGF,sBAAsB,EAAE,CAAC;IAC3B,CAAC,CAAC,CAAC;AACL,CAAC"}
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,60 @@
|
||||
# is-npm
|
||||
|
||||
> Check if your code is running as an [npm](https://docs.npmjs.com/misc/scripts) or [yarn](https://yarnpkg.com/lang/en/docs/cli/run/) script
|
||||
|
||||
## Install
|
||||
|
||||
```sh
|
||||
npm install is-npm
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
import {isNpmOrYarn, isNpm, isYarn} from 'is-npm';
|
||||
|
||||
console.table({isNpmOrYarn, isNpm, isYarn});
|
||||
```
|
||||
|
||||
```sh
|
||||
$ node foo.js
|
||||
# ┌─────────────┬────────┐
|
||||
# │ (index) │ Values │
|
||||
# ├─────────────┼────────┤
|
||||
# │ isNpmOrYarn │ false │
|
||||
# │ isNpm │ false │
|
||||
# │ isYarn │ false │
|
||||
# └─────────────┴────────┘
|
||||
$ npm run foo
|
||||
# ┌─────────────┬────────┐
|
||||
# │ (index) │ Values │
|
||||
# ├─────────────┼────────┤
|
||||
# │ isNpmOrYarn │ true │
|
||||
# │ isNpm │ true │
|
||||
# │ isYarn │ false │
|
||||
# └─────────────┴────────┘
|
||||
$ yarn run foo
|
||||
# ┌─────────────┬────────┐
|
||||
# │ (index) │ Values │
|
||||
# ├─────────────┼────────┤
|
||||
# │ isNpmOrYarn │ true │
|
||||
# │ isNpm │ false │
|
||||
# │ isYarn │ true │
|
||||
# └─────────────┴────────┘
|
||||
```
|
||||
|
||||
## Related
|
||||
|
||||
- [is-npm-cli](https://github.com/sindresorhus/is-npm-cli) - CLI for this module
|
||||
|
||||
---
|
||||
|
||||
<div align="center">
|
||||
<b>
|
||||
<a href="https://tidelift.com/subscription/pkg/npm-is-npm?utm_source=npm-is-npm&utm_medium=referral&utm_campaign=readme">Get professional support for this package with a Tidelift subscription</a>
|
||||
</b>
|
||||
<br>
|
||||
<sub>
|
||||
Tidelift helps make open source sustainable for maintainers while giving companies<br>assurances about security, maintenance, and licensing for their dependencies.
|
||||
</sub>
|
||||
</div>
|
||||
@@ -0,0 +1,526 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "default", {
|
||||
enumerable: true,
|
||||
get: ()=>expandApplyAtRules
|
||||
});
|
||||
const _postcss = /*#__PURE__*/ _interopRequireDefault(require("postcss"));
|
||||
const _postcssSelectorParser = /*#__PURE__*/ _interopRequireDefault(require("postcss-selector-parser"));
|
||||
const _generateRules = require("./generateRules");
|
||||
const _escapeClassName = /*#__PURE__*/ _interopRequireDefault(require("../util/escapeClassName"));
|
||||
function _interopRequireDefault(obj) {
|
||||
return obj && obj.__esModule ? obj : {
|
||||
default: obj
|
||||
};
|
||||
}
|
||||
/** @typedef {Map<string, [any, import('postcss').Rule[]]>} ApplyCache */ function extractClasses(node) {
|
||||
/** @type {Map<string, Set<string>>} */ let groups = new Map();
|
||||
let container = _postcss.default.root({
|
||||
nodes: [
|
||||
node.clone()
|
||||
]
|
||||
});
|
||||
container.walkRules((rule)=>{
|
||||
(0, _postcssSelectorParser.default)((selectors)=>{
|
||||
selectors.walkClasses((classSelector)=>{
|
||||
let parentSelector = classSelector.parent.toString();
|
||||
let classes = groups.get(parentSelector);
|
||||
if (!classes) {
|
||||
groups.set(parentSelector, classes = new Set());
|
||||
}
|
||||
classes.add(classSelector.value);
|
||||
});
|
||||
}).processSync(rule.selector);
|
||||
});
|
||||
let normalizedGroups = Array.from(groups.values(), (classes)=>Array.from(classes));
|
||||
let classes = normalizedGroups.flat();
|
||||
return Object.assign(classes, {
|
||||
groups: normalizedGroups
|
||||
});
|
||||
}
|
||||
let selectorExtractor = (0, _postcssSelectorParser.default)();
|
||||
/**
|
||||
* @param {string} ruleSelectors
|
||||
*/ function extractSelectors(ruleSelectors) {
|
||||
return selectorExtractor.astSync(ruleSelectors);
|
||||
}
|
||||
function extractBaseCandidates(candidates, separator) {
|
||||
let baseClasses = new Set();
|
||||
for (let candidate of candidates){
|
||||
baseClasses.add(candidate.split(separator).pop());
|
||||
}
|
||||
return Array.from(baseClasses);
|
||||
}
|
||||
function prefix(context, selector) {
|
||||
let prefix = context.tailwindConfig.prefix;
|
||||
return typeof prefix === "function" ? prefix(selector) : prefix + selector;
|
||||
}
|
||||
function* pathToRoot(node) {
|
||||
yield node;
|
||||
while(node.parent){
|
||||
yield node.parent;
|
||||
node = node.parent;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Only clone the node itself and not its children
|
||||
*
|
||||
* @param {*} node
|
||||
* @param {*} overrides
|
||||
* @returns
|
||||
*/ function shallowClone(node, overrides = {}) {
|
||||
let children = node.nodes;
|
||||
node.nodes = [];
|
||||
let tmp = node.clone(overrides);
|
||||
node.nodes = children;
|
||||
return tmp;
|
||||
}
|
||||
/**
|
||||
* Clone just the nodes all the way to the top that are required to represent
|
||||
* this singular rule in the tree.
|
||||
*
|
||||
* For example, if we have CSS like this:
|
||||
* ```css
|
||||
* @media (min-width: 768px) {
|
||||
* @supports (display: grid) {
|
||||
* .foo {
|
||||
* display: grid;
|
||||
* grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
|
||||
* }
|
||||
* }
|
||||
*
|
||||
* @supports (backdrop-filter: blur(1px)) {
|
||||
* .bar {
|
||||
* backdrop-filter: blur(1px);
|
||||
* }
|
||||
* }
|
||||
*
|
||||
* .baz {
|
||||
* color: orange;
|
||||
* }
|
||||
* }
|
||||
* ```
|
||||
*
|
||||
* And we're cloning `.bar` it'll return a cloned version of what's required for just that single node:
|
||||
*
|
||||
* ```css
|
||||
* @media (min-width: 768px) {
|
||||
* @supports (backdrop-filter: blur(1px)) {
|
||||
* .bar {
|
||||
* backdrop-filter: blur(1px);
|
||||
* }
|
||||
* }
|
||||
* }
|
||||
* ```
|
||||
*
|
||||
* @param {import('postcss').Node} node
|
||||
*/ function nestedClone(node) {
|
||||
for (let parent of pathToRoot(node)){
|
||||
if (node === parent) {
|
||||
continue;
|
||||
}
|
||||
if (parent.type === "root") {
|
||||
break;
|
||||
}
|
||||
node = shallowClone(parent, {
|
||||
nodes: [
|
||||
node
|
||||
]
|
||||
});
|
||||
}
|
||||
return node;
|
||||
}
|
||||
/**
|
||||
* @param {import('postcss').Root} root
|
||||
*/ function buildLocalApplyCache(root, context) {
|
||||
/** @type {ApplyCache} */ let cache = new Map();
|
||||
root.walkRules((rule)=>{
|
||||
// Ignore rules generated by Tailwind
|
||||
for (let node of pathToRoot(rule)){
|
||||
var _node_raws_tailwind;
|
||||
if (((_node_raws_tailwind = node.raws.tailwind) === null || _node_raws_tailwind === void 0 ? void 0 : _node_raws_tailwind.layer) !== undefined) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
// Clone what's required to represent this singular rule in the tree
|
||||
let container = nestedClone(rule);
|
||||
let sort = context.offsets.create("user");
|
||||
for (let className of extractClasses(rule)){
|
||||
let list = cache.get(className) || [];
|
||||
cache.set(className, list);
|
||||
list.push([
|
||||
{
|
||||
layer: "user",
|
||||
sort,
|
||||
important: false
|
||||
},
|
||||
container
|
||||
]);
|
||||
}
|
||||
});
|
||||
return cache;
|
||||
}
|
||||
/**
|
||||
* @returns {ApplyCache}
|
||||
*/ function buildApplyCache(applyCandidates, context) {
|
||||
for (let candidate of applyCandidates){
|
||||
if (context.notClassCache.has(candidate) || context.applyClassCache.has(candidate)) {
|
||||
continue;
|
||||
}
|
||||
if (context.classCache.has(candidate)) {
|
||||
context.applyClassCache.set(candidate, context.classCache.get(candidate).map(([meta, rule])=>[
|
||||
meta,
|
||||
rule.clone()
|
||||
]));
|
||||
continue;
|
||||
}
|
||||
let matches = Array.from((0, _generateRules.resolveMatches)(candidate, context));
|
||||
if (matches.length === 0) {
|
||||
context.notClassCache.add(candidate);
|
||||
continue;
|
||||
}
|
||||
context.applyClassCache.set(candidate, matches);
|
||||
}
|
||||
return context.applyClassCache;
|
||||
}
|
||||
/**
|
||||
* Build a cache only when it's first used
|
||||
*
|
||||
* @param {() => ApplyCache} buildCacheFn
|
||||
* @returns {ApplyCache}
|
||||
*/ function lazyCache(buildCacheFn) {
|
||||
let cache = null;
|
||||
return {
|
||||
get: (name)=>{
|
||||
cache = cache || buildCacheFn();
|
||||
return cache.get(name);
|
||||
},
|
||||
has: (name)=>{
|
||||
cache = cache || buildCacheFn();
|
||||
return cache.has(name);
|
||||
}
|
||||
};
|
||||
}
|
||||
/**
|
||||
* Take a series of multiple caches and merge
|
||||
* them so they act like one large cache
|
||||
*
|
||||
* @param {ApplyCache[]} caches
|
||||
* @returns {ApplyCache}
|
||||
*/ function combineCaches(caches) {
|
||||
return {
|
||||
get: (name)=>caches.flatMap((cache)=>cache.get(name) || []),
|
||||
has: (name)=>caches.some((cache)=>cache.has(name))
|
||||
};
|
||||
}
|
||||
function extractApplyCandidates(params) {
|
||||
let candidates = params.split(/[\s\t\n]+/g);
|
||||
if (candidates[candidates.length - 1] === "!important") {
|
||||
return [
|
||||
candidates.slice(0, -1),
|
||||
true
|
||||
];
|
||||
}
|
||||
return [
|
||||
candidates,
|
||||
false
|
||||
];
|
||||
}
|
||||
function processApply(root, context, localCache) {
|
||||
let applyCandidates = new Set();
|
||||
// Collect all @apply rules and candidates
|
||||
let applies = [];
|
||||
root.walkAtRules("apply", (rule)=>{
|
||||
let [candidates] = extractApplyCandidates(rule.params);
|
||||
for (let util of candidates){
|
||||
applyCandidates.add(util);
|
||||
}
|
||||
applies.push(rule);
|
||||
});
|
||||
// Start the @apply process if we have rules with @apply in them
|
||||
if (applies.length === 0) {
|
||||
return;
|
||||
}
|
||||
// Fill up some caches!
|
||||
let applyClassCache = combineCaches([
|
||||
localCache,
|
||||
buildApplyCache(applyCandidates, context)
|
||||
]);
|
||||
/**
|
||||
* When we have an apply like this:
|
||||
*
|
||||
* .abc {
|
||||
* @apply hover:font-bold;
|
||||
* }
|
||||
*
|
||||
* What we essentially will do is resolve to this:
|
||||
*
|
||||
* .abc {
|
||||
* @apply .hover\:font-bold:hover {
|
||||
* font-weight: 500;
|
||||
* }
|
||||
* }
|
||||
*
|
||||
* Notice that the to-be-applied class is `.hover\:font-bold:hover` and that the utility candidate was `hover:font-bold`.
|
||||
* What happens in this function is that we prepend a `.` and escape the candidate.
|
||||
* This will result in `.hover\:font-bold`
|
||||
* Which means that we can replace `.hover\:font-bold` with `.abc` in `.hover\:font-bold:hover` resulting in `.abc:hover`
|
||||
*
|
||||
* @param {string} selector
|
||||
* @param {string} utilitySelectors
|
||||
* @param {string} candidate
|
||||
*/ function replaceSelector(selector, utilitySelectors, candidate) {
|
||||
let selectorList = extractSelectors(selector);
|
||||
let utilitySelectorsList = extractSelectors(utilitySelectors);
|
||||
let candidateList = extractSelectors(`.${(0, _escapeClassName.default)(candidate)}`);
|
||||
let candidateClass = candidateList.nodes[0].nodes[0];
|
||||
selectorList.each((sel)=>{
|
||||
/** @type {Set<import('postcss-selector-parser').Selector>} */ let replaced = new Set();
|
||||
utilitySelectorsList.each((utilitySelector)=>{
|
||||
let hasReplaced = false;
|
||||
utilitySelector = utilitySelector.clone();
|
||||
utilitySelector.walkClasses((node)=>{
|
||||
if (node.value !== candidateClass.value) {
|
||||
return;
|
||||
}
|
||||
// Don't replace multiple instances of the same class
|
||||
// This is theoretically correct but only partially
|
||||
// We'd need to generate every possible permutation of the replacement
|
||||
// For example with `.foo + .foo { … }` and `section { @apply foo; }`
|
||||
// We'd need to generate all of these:
|
||||
// - `.foo + .foo`
|
||||
// - `.foo + section`
|
||||
// - `section + .foo`
|
||||
// - `section + section`
|
||||
if (hasReplaced) {
|
||||
return;
|
||||
}
|
||||
// Since you can only `@apply` class names this is sufficient
|
||||
// We want to replace the matched class name with the selector the user is using
|
||||
// Ex: Replace `.text-blue-500` with `.foo.bar:is(.something-cool)`
|
||||
node.replaceWith(...sel.nodes.map((node)=>node.clone()));
|
||||
// Record that we did something and we want to use this new selector
|
||||
replaced.add(utilitySelector);
|
||||
hasReplaced = true;
|
||||
});
|
||||
});
|
||||
// Sort tag names before class names (but only sort each group (separated by a combinator)
|
||||
// separately and not in total)
|
||||
// This happens when replacing `.bar` in `.foo.bar` with a tag like `section`
|
||||
for (let sel1 of replaced){
|
||||
let groups = [
|
||||
[]
|
||||
];
|
||||
for (let node of sel1.nodes){
|
||||
if (node.type === "combinator") {
|
||||
groups.push(node);
|
||||
groups.push([]);
|
||||
} else {
|
||||
let last = groups[groups.length - 1];
|
||||
last.push(node);
|
||||
}
|
||||
}
|
||||
sel1.nodes = [];
|
||||
for (let group of groups){
|
||||
if (Array.isArray(group)) {
|
||||
group.sort((a, b)=>{
|
||||
if (a.type === "tag" && b.type === "class") {
|
||||
return -1;
|
||||
} else if (a.type === "class" && b.type === "tag") {
|
||||
return 1;
|
||||
} else if (a.type === "class" && b.type === "pseudo" && b.value.startsWith("::")) {
|
||||
return -1;
|
||||
} else if (a.type === "pseudo" && a.value.startsWith("::") && b.type === "class") {
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
});
|
||||
}
|
||||
sel1.nodes = sel1.nodes.concat(group);
|
||||
}
|
||||
}
|
||||
sel.replaceWith(...replaced);
|
||||
});
|
||||
return selectorList.toString();
|
||||
}
|
||||
let perParentApplies = new Map();
|
||||
// Collect all apply candidates and their rules
|
||||
for (let apply of applies){
|
||||
let [candidates] = perParentApplies.get(apply.parent) || [
|
||||
[],
|
||||
apply.source
|
||||
];
|
||||
perParentApplies.set(apply.parent, [
|
||||
candidates,
|
||||
apply.source
|
||||
]);
|
||||
let [applyCandidates1, important] = extractApplyCandidates(apply.params);
|
||||
if (apply.parent.type === "atrule") {
|
||||
if (apply.parent.name === "screen") {
|
||||
let screenType = apply.parent.params;
|
||||
throw apply.error(`@apply is not supported within nested at-rules like @screen. We suggest you write this as @apply ${applyCandidates1.map((c)=>`${screenType}:${c}`).join(" ")} instead.`);
|
||||
}
|
||||
throw apply.error(`@apply is not supported within nested at-rules like @${apply.parent.name}. You can fix this by un-nesting @${apply.parent.name}.`);
|
||||
}
|
||||
for (let applyCandidate of applyCandidates1){
|
||||
if ([
|
||||
prefix(context, "group"),
|
||||
prefix(context, "peer")
|
||||
].includes(applyCandidate)) {
|
||||
// TODO: Link to specific documentation page with error code.
|
||||
throw apply.error(`@apply should not be used with the '${applyCandidate}' utility`);
|
||||
}
|
||||
if (!applyClassCache.has(applyCandidate)) {
|
||||
throw apply.error(`The \`${applyCandidate}\` class does not exist. If \`${applyCandidate}\` is a custom class, make sure it is defined within a \`@layer\` directive.`);
|
||||
}
|
||||
let rules = applyClassCache.get(applyCandidate);
|
||||
candidates.push([
|
||||
applyCandidate,
|
||||
important,
|
||||
rules
|
||||
]);
|
||||
}
|
||||
}
|
||||
for (let [parent, [candidates1, atApplySource]] of perParentApplies){
|
||||
let siblings = [];
|
||||
for (let [applyCandidate1, important1, rules1] of candidates1){
|
||||
let potentialApplyCandidates = [
|
||||
applyCandidate1,
|
||||
...extractBaseCandidates([
|
||||
applyCandidate1
|
||||
], context.tailwindConfig.separator)
|
||||
];
|
||||
for (let [meta, node] of rules1){
|
||||
let parentClasses = extractClasses(parent);
|
||||
let nodeClasses = extractClasses(node);
|
||||
// When we encounter a rule like `.dark .a, .b { … }` we only want to be left with `[.dark, .a]` if the base applyCandidate is `.a` or with `[.b]` if the base applyCandidate is `.b`
|
||||
// So we've split them into groups
|
||||
nodeClasses = nodeClasses.groups.filter((classList)=>classList.some((className)=>potentialApplyCandidates.includes(className))).flat();
|
||||
// Add base utility classes from the @apply node to the list of
|
||||
// classes to check whether it intersects and therefore results in a
|
||||
// circular dependency or not.
|
||||
//
|
||||
// E.g.:
|
||||
// .foo {
|
||||
// @apply hover:a; // This applies "a" but with a modifier
|
||||
// }
|
||||
//
|
||||
// We only have to do that with base classes of the `node`, not of the `parent`
|
||||
// E.g.:
|
||||
// .hover\:foo {
|
||||
// @apply bar;
|
||||
// }
|
||||
// .bar {
|
||||
// @apply foo;
|
||||
// }
|
||||
//
|
||||
// This should not result in a circular dependency because we are
|
||||
// just applying `.foo` and the rule above is `.hover\:foo` which is
|
||||
// unrelated. However, if we were to apply `hover:foo` then we _did_
|
||||
// have to include this one.
|
||||
nodeClasses = nodeClasses.concat(extractBaseCandidates(nodeClasses, context.tailwindConfig.separator));
|
||||
let intersects = parentClasses.some((selector)=>nodeClasses.includes(selector));
|
||||
if (intersects) {
|
||||
throw node.error(`You cannot \`@apply\` the \`${applyCandidate1}\` utility here because it creates a circular dependency.`);
|
||||
}
|
||||
let root1 = _postcss.default.root({
|
||||
nodes: [
|
||||
node.clone()
|
||||
]
|
||||
});
|
||||
// Make sure every node in the entire tree points back at the @apply rule that generated it
|
||||
root1.walk((node)=>{
|
||||
node.source = atApplySource;
|
||||
});
|
||||
let canRewriteSelector = node.type !== "atrule" || node.type === "atrule" && node.name !== "keyframes";
|
||||
if (canRewriteSelector) {
|
||||
root1.walkRules((rule)=>{
|
||||
// Let's imagine you have the following structure:
|
||||
//
|
||||
// .foo {
|
||||
// @apply bar;
|
||||
// }
|
||||
//
|
||||
// @supports (a: b) {
|
||||
// .bar {
|
||||
// color: blue
|
||||
// }
|
||||
//
|
||||
// .something-unrelated {}
|
||||
// }
|
||||
//
|
||||
// In this case we want to apply `.bar` but it happens to be in
|
||||
// an atrule node. We clone that node instead of the nested one
|
||||
// because we still want that @supports rule to be there once we
|
||||
// applied everything.
|
||||
//
|
||||
// However it happens to be that the `.something-unrelated` is
|
||||
// also in that same shared @supports atrule. This is not good,
|
||||
// and this should not be there. The good part is that this is
|
||||
// a clone already and it can be safely removed. The question is
|
||||
// how do we know we can remove it. Basically what we can do is
|
||||
// match it against the applyCandidate that you want to apply. If
|
||||
// it doesn't match the we can safely delete it.
|
||||
//
|
||||
// If we didn't do this, then the `replaceSelector` function
|
||||
// would have replaced this with something that didn't exist and
|
||||
// therefore it removed the selector altogether. In this specific
|
||||
// case it would result in `{}` instead of `.something-unrelated {}`
|
||||
if (!extractClasses(rule).some((candidate)=>candidate === applyCandidate1)) {
|
||||
rule.remove();
|
||||
return;
|
||||
}
|
||||
// Strip the important selector from the parent selector if at the beginning
|
||||
let importantSelector = typeof context.tailwindConfig.important === "string" ? context.tailwindConfig.important : null;
|
||||
// We only want to move the "important" selector if this is a Tailwind-generated utility
|
||||
// We do *not* want to do this for user CSS that happens to be structured the same
|
||||
let isGenerated = parent.raws.tailwind !== undefined;
|
||||
let parentSelector = isGenerated && importantSelector && parent.selector.indexOf(importantSelector) === 0 ? parent.selector.slice(importantSelector.length) : parent.selector;
|
||||
rule.selector = replaceSelector(parentSelector, rule.selector, applyCandidate1);
|
||||
// And then re-add it if it was removed
|
||||
if (importantSelector && parentSelector !== parent.selector) {
|
||||
rule.selector = `${importantSelector} ${rule.selector}`;
|
||||
}
|
||||
rule.walkDecls((d)=>{
|
||||
d.important = meta.important || important1;
|
||||
});
|
||||
});
|
||||
}
|
||||
// It could be that the node we were inserted was removed because the class didn't match
|
||||
// If that was the *only* rule in the parent, then we have nothing add so we skip it
|
||||
if (!root1.nodes[0]) {
|
||||
continue;
|
||||
}
|
||||
// Insert it
|
||||
siblings.push([
|
||||
meta.sort,
|
||||
root1.nodes[0]
|
||||
]);
|
||||
}
|
||||
}
|
||||
// Inject the rules, sorted, correctly
|
||||
let nodes = context.offsets.sort(siblings).map((s)=>s[1]);
|
||||
// `parent` refers to the node at `.abc` in: .abc { @apply mt-2 }
|
||||
parent.after(nodes);
|
||||
}
|
||||
for (let apply1 of applies){
|
||||
// If there are left-over declarations, just remove the @apply
|
||||
if (apply1.parent.nodes.length > 1) {
|
||||
apply1.remove();
|
||||
} else {
|
||||
// The node is empty, drop the full node
|
||||
apply1.parent.remove();
|
||||
}
|
||||
}
|
||||
// Do it again, in case we have other `@apply` rules
|
||||
processApply(root, context, localCache);
|
||||
}
|
||||
function expandApplyAtRules(context) {
|
||||
return (root)=>{
|
||||
// Build a cache of the user's CSS so we can use it to resolve classes used by @apply
|
||||
let localCache = lazyCache(()=>buildLocalApplyCache(root, context));
|
||||
processApply(root, context, localCache);
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user