This commit is contained in:
2025-05-09 05:30:08 +02:00
parent 7bb10e7df4
commit 73367bad9e
5322 changed files with 1266973 additions and 313 deletions

View File

@@ -0,0 +1 @@
module.exports={C:{"3":0.0112,"52":0.04107,"68":0.00373,"90":0.16056,"107":0.00373,"113":0.01494,"115":0.24271,"119":0.00373,"121":0.00373,"125":0.0224,"128":0.10829,"129":0.00373,"131":0.00373,"132":0.00373,"134":0.03734,"135":0.17923,"136":0.48169,"137":0.00373,_:"2 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 108 109 110 111 112 114 116 117 118 120 122 123 124 126 127 130 133 138 139 140 3.5 3.6"},D:{"29":0.0224,"39":0.0112,"40":0.01494,"41":0.0112,"42":0.01494,"43":0.0112,"44":0.01494,"45":0.01494,"46":0.00747,"47":0.0112,"48":0.01494,"49":0.0224,"50":0.01494,"51":0.0112,"52":0.0112,"53":0.01494,"54":0.0112,"55":0.0112,"56":0.0112,"57":0.01494,"58":0.03361,"59":0.01494,"60":0.01494,"66":0.00373,"70":0.00747,"74":0.00747,"75":0.00373,"78":0.00373,"79":0.0224,"83":0.00373,"84":0.00373,"86":0.00373,"87":0.00373,"89":0.00373,"90":0.0224,"91":0.0112,"94":0.03361,"95":0.00747,"97":0.02987,"98":0.00373,"99":0.0112,"101":0.00373,"102":0.01494,"103":0.00373,"105":0.03734,"106":0.01867,"107":0.00373,"108":0.00373,"109":1.69524,"110":0.0112,"111":0.0112,"112":0.01494,"113":0.00373,"114":0.01494,"116":0.02614,"117":0.00373,"118":0.05601,"119":0.01867,"120":0.09335,"121":0.0224,"122":0.10455,"123":0.06721,"124":0.05228,"125":0.3846,"126":0.19417,"127":0.01867,"128":0.1979,"129":0.07841,"130":0.05974,"131":0.26885,"132":0.23898,"133":6.61665,"134":12.09816,"135":0.02987,"136":0.00373,_:"4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 30 31 32 33 34 35 36 37 38 61 62 63 64 65 67 68 69 71 72 73 76 77 80 81 85 88 92 93 96 100 104 115 137 138"},F:{"36":0.00373,"79":0.0112,"85":0.00747,"86":0.0112,"87":0.0112,"95":0.1643,"114":0.00747,"115":0.00373,"116":0.28005,"117":1.5048,_:"9 11 12 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 60 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 80 81 82 83 84 88 89 90 91 92 93 94 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 9.5-9.6 10.0-10.1 10.5 10.6 11.1 11.5 11.6","12.1":0.00747},B:{"18":0.00373,"92":0.0112,"97":0.00373,"100":0.00373,"105":0.00373,"109":0.00747,"114":0.03361,"117":0.00373,"122":0.00373,"125":0.00373,"126":0.00373,"129":0.00373,"130":0.00373,"131":0.0224,"132":0.03361,"133":1.4936,"134":1.35918,_:"12 13 14 15 16 17 79 80 81 83 84 85 86 87 88 89 90 91 93 94 95 96 98 99 101 102 103 104 106 107 108 110 111 112 113 115 116 118 119 120 121 123 124 127 128"},E:{"4":0.00747,"14":0.00373,_:"0 5 6 7 8 9 10 11 12 13 15 3.1 3.2 6.1 7.1 9.1 10.1 11.1 15.1 15.2-15.3 15.4 15.5 16.0","5.1":0.06721,"12.1":0.00373,"13.1":0.01494,"14.1":0.00747,"15.6":0.05601,"16.1":0.00373,"16.2":0.00373,"16.3":0.0112,"16.4":0.00373,"16.5":0.0112,"16.6":0.03734,"17.0":0.00747,"17.1":0.04481,"17.2":0.00373,"17.3":0.01494,"17.4":0.0224,"17.5":0.04107,"17.6":0.12322,"18.0":0.03361,"18.1":0.06348,"18.2":0.05228,"18.3":0.39954,"18.4":0.0112},G:{"8":0,"3.2":0,"4.0-4.1":0,"4.2-4.3":0.00203,"5.0-5.1":0,"6.0-6.1":0.00608,"7.0-7.1":0.00406,"8.1-8.4":0,"9.0-9.2":0.00304,"9.3":0.01419,"10.0-10.2":0.00101,"10.3":0.02332,"11.0-11.2":0.10747,"11.3-11.4":0.0071,"12.0-12.1":0.00406,"12.2-12.5":0.10037,"13.0-13.1":0.00203,"13.2":0.00304,"13.3":0.00406,"13.4-13.7":0.01419,"14.0-14.4":0.03548,"14.5-14.8":0.04258,"15.0-15.1":0.02332,"15.2-15.3":0.02332,"15.4":0.02839,"15.5":0.03244,"15.6-15.8":0.39945,"16.0":0.05677,"16.1":0.11659,"16.2":0.06083,"16.3":0.10544,"16.4":0.02332,"16.5":0.0436,"16.6-16.7":0.47346,"17.0":0.02839,"17.1":0.05069,"17.2":0.03853,"17.3":0.05373,"17.4":0.10747,"17.5":0.23927,"17.6-17.7":0.69448,"18.0":0.19466,"18.1":0.63669,"18.2":0.28489,"18.3":5.95428,"18.4":0.0882},P:{"4":0.01035,"20":0.06208,"21":0.01035,"22":0.03104,"23":0.03104,"24":0.05173,"25":0.05173,"26":0.06208,"27":0.84839,_:"5.0-5.4 6.2-6.4 8.2 9.2 10.1 11.1-11.2 12.0 14.0 15.0","7.2-7.4":0.07242,"13.0":0.06208,"16.0":0.01035,"17.0":0.01035,"18.0":0.01035,"19.0":0.01035},I:{"0":0.25011,"3":0,"4":0,"2.1":0,"2.2":0,"2.3":0,"4.1":0,"4.2-4.3":0.00008,"4.4":0,"4.4.3-4.4.4":0.00028},K:{"0":0.50128,_:"10 11 12 11.1 11.5 12.1"},A:{"8":0.09894,"9":0.02151,"10":0.04302,"11":0.77003,_:"6 7 5.5"},S:{_:"2.5 3.0-3.1"},J:{_:"7 10"},N:{_:"10 11"},R:{_:"0"},M:{"0":0.07519},Q:{"14.9":0.0188},O:{"0":0.48248},H:{"0":0},L:{"0":49.84331}};

View File

@@ -0,0 +1 @@
module.exports={C:{"48":0.00438,"52":0.00876,"60":0.00438,"78":0.05255,"87":0.00876,"96":0.00438,"104":0.00438,"113":0.00438,"115":0.18392,"121":0.01752,"125":0.01314,"126":0.00438,"128":0.10948,"129":0.00438,"130":0.00438,"131":0.00438,"132":0.0219,"133":0.01314,"134":0.0219,"135":0.62182,"136":1.96179,"137":0.01752,_:"2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 49 50 51 53 54 55 56 57 58 59 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 79 80 81 82 83 84 85 86 88 89 90 91 92 93 94 95 97 98 99 100 101 102 103 105 106 107 108 109 110 111 112 114 116 117 118 119 120 122 123 124 127 138 139 140 3.5 3.6"},D:{"49":0.01314,"58":0.00438,"67":0.00438,"74":0.07006,"75":0.06131,"76":0.06131,"77":0.06131,"78":0.94586,"79":1.24364,"80":0.00438,"83":0.07006,"85":0.00438,"87":0.0219,"88":0.00438,"90":0.01314,"91":0.00876,"92":0.00438,"98":0.00438,"100":0.00876,"102":0.00438,"103":0.03503,"104":0.03065,"105":0.00876,"106":0.00438,"107":0.01314,"108":0.01752,"109":0.4598,"110":0.00876,"111":0.01314,"112":0.00876,"113":0.00876,"114":0.03065,"115":0.00438,"116":0.13137,"117":0.00876,"118":0.00876,"119":0.01314,"120":0.23209,"121":0.0219,"122":0.08758,"123":0.02627,"124":0.02627,"125":0.35032,"126":0.07006,"127":0.0219,"128":0.14013,"129":0.04817,"130":0.11823,"131":0.37659,"132":0.49483,"133":6.57288,"134":12.5327,"135":0.00876,_:"4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 50 51 52 53 54 55 56 57 59 60 61 62 63 64 65 66 68 69 70 71 72 73 81 84 86 89 93 94 95 96 97 99 101 136 137 138"},F:{"46":0.00438,"87":0.00438,"88":0.00438,"95":0.01314,"102":0.00438,"113":0.00438,"114":0.00438,"116":0.29339,"117":0.85391,_:"9 11 12 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 47 48 49 50 51 52 53 54 55 56 57 58 60 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 89 90 91 92 93 94 96 97 98 99 100 101 103 104 105 106 107 108 109 110 111 112 115 9.5-9.6 10.0-10.1 10.5 10.6 11.1 11.5 11.6 12.1"},B:{"86":0.00438,"92":0.00438,"107":0.00438,"108":0.00876,"109":0.05255,"111":0.00438,"114":0.00438,"116":0.00438,"118":0.00438,"120":0.00438,"121":0.00438,"122":0.00438,"123":0.00438,"124":0.00438,"125":0.00438,"126":0.00876,"127":0.00438,"128":0.01314,"129":0.01314,"130":0.03503,"131":0.04817,"132":0.13575,"133":1.97055,"134":4.87821,_:"12 13 14 15 16 17 18 79 80 81 83 84 85 87 88 89 90 91 93 94 95 96 97 98 99 100 101 102 103 104 105 106 110 112 113 115 117 119"},E:{"14":0.01314,_:"0 4 5 6 7 8 9 10 11 12 13 15 3.1 3.2 5.1 6.1 7.1 9.1 10.1","11.1":0.00876,"12.1":0.00876,"13.1":0.04817,"14.1":0.07006,"15.1":0.00438,"15.2-15.3":0.00438,"15.4":0.03065,"15.5":0.01752,"15.6":0.40287,"16.0":0.03941,"16.1":0.04817,"16.2":0.03503,"16.3":0.07882,"16.4":0.02627,"16.5":0.04817,"16.6":0.42476,"17.0":0.01314,"17.1":0.31967,"17.2":0.06131,"17.3":0.05255,"17.4":0.07444,"17.5":0.18392,"17.6":0.62182,"18.0":0.10072,"18.1":0.26712,"18.2":0.11385,"18.3":2.85073,"18.4":0.03941},G:{"8":0,"3.2":0,"4.0-4.1":0,"4.2-4.3":0.00364,"5.0-5.1":0,"6.0-6.1":0.01091,"7.0-7.1":0.00727,"8.1-8.4":0,"9.0-9.2":0.00546,"9.3":0.02546,"10.0-10.2":0.00182,"10.3":0.04182,"11.0-11.2":0.19275,"11.3-11.4":0.01273,"12.0-12.1":0.00727,"12.2-12.5":0.18002,"13.0-13.1":0.00364,"13.2":0.00546,"13.3":0.00727,"13.4-13.7":0.02546,"14.0-14.4":0.06364,"14.5-14.8":0.07637,"15.0-15.1":0.04182,"15.2-15.3":0.04182,"15.4":0.05092,"15.5":0.05819,"15.6-15.8":0.71645,"16.0":0.10183,"16.1":0.20912,"16.2":0.1091,"16.3":0.18911,"16.4":0.04182,"16.5":0.07819,"16.6-16.7":0.84919,"17.0":0.05092,"17.1":0.09092,"17.2":0.0691,"17.3":0.09637,"17.4":0.19275,"17.5":0.42914,"17.6-17.7":1.2456,"18.0":0.34913,"18.1":1.14195,"18.2":0.51097,"18.3":10.67943,"18.4":0.1582},P:{"4":0.03159,"20":0.01053,"21":0.02106,"22":0.02106,"23":0.02106,"24":0.03159,"25":0.03159,"26":0.07372,"27":3.58076,_:"5.0-5.4 6.2-6.4 7.2-7.4 8.2 9.2 10.1 11.1-11.2 12.0 13.0 14.0 15.0 16.0 17.0 18.0","19.0":0.01053},I:{"0":0.05609,"3":0,"4":0,"2.1":0,"2.2":0,"2.3":0,"4.1":0,"4.2-4.3":0.00002,"4.4":0,"4.4.3-4.4.4":0.00006},K:{"0":0.16863,_:"10 11 12 11.1 11.5 12.1"},A:{"11":0.03503,_:"6 7 8 9 10 5.5"},S:{_:"2.5 3.0-3.1"},J:{_:"7 10"},N:{_:"10 11"},R:{_:"0"},M:{"0":0.35974},Q:{_:"14.9"},O:{"0":0.01124},H:{"0":0},L:{"0":33.7976}};

View File

@@ -0,0 +1 @@
module.exports={A:{A:{"2":"K D E F A B mC"},B:{"1":"0 9 N O P Q H R S T U V W X Y Z a b c d e f g h i j k l m n o p q r s t u v w x y z AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB I","2":"C L M G"},C:{"1":"0 9 oB pB qB rB sB tB uB vB MC wB NC xB yB zB 0B 1B 2B 3B 4B 5B 6B 7B 8B 9B AC BC CC DC Q H R OC S T U V W X Y Z a b c d e f g h i j k l m n o p q r s t u v w x y z AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB I PC EC QC RC oC pC","2":"1 2 3 4 5 6 7 8 nC LC J PB K D E F A B C L M G N O P QB RB SB TB UB VB WB XB YB ZB aB bB cB dB eB fB gB hB iB jB kB lB mB nB qC rC"},D:{"1":"0 9 tB uB vB MC wB NC xB yB zB 0B 1B 2B 3B 4B 5B 6B 7B 8B 9B AC BC CC DC Q H R S T U V W X Y Z a b c d e f g h i j k l m n o p q r s t u v w x y z AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB I PC EC QC RC","2":"1 2 3 4 5 6 7 8 J PB K D E F A B C L M G N O P QB RB SB TB UB VB WB XB YB ZB aB bB cB dB eB fB gB","16":"hB iB jB","388":"kB lB mB nB oB pB qB rB sB"},E:{"1":"L M G xC yC zC UC VC HC 0C IC WC XC YC ZC aC 1C JC bC cC dC eC fC 2C KC gC hC iC jC 3C","2":"J PB K D E F A sC SC tC uC vC wC TC","516":"B C FC GC"},F:{"1":"0 fB gB hB iB jB kB lB mB nB oB pB qB rB sB tB uB vB wB xB yB zB 0B 1B 2B 3B 4B 5B 6B 7B 8B 9B AC BC CC DC Q H R OC S T U V W X Y Z a b c d e f g h i j k l m n o p q r s t u v w x y z","2":"1 2 3 4 5 6 7 8 F B C G N O P QB RB SB TB UB VB WB XB YB ZB aB bB cB dB eB 4C 5C 6C 7C FC kC 8C GC"},G:{"1":"ID JD KD LD MD ND OD PD QD RD SD UC VC HC TD IC WC XC YC ZC aC UD JC bC cC dC eC fC VD KC gC hC iC jC","2":"E SC 9C lC AD BD CD DD ED FD GD HD"},H:{"2":"WD"},I:{"1":"I","2":"XD YD ZD","16":"LC J aD lC bD cD"},J:{"1":"A","2":"D"},K:{"1":"H GC","16":"A B C FC kC"},L:{"1":"I"},M:{"1":"EC"},N:{"2":"A B"},O:{"1":"HC"},P:{"1":"1 2 3 4 5 6 7 8 dD eD fD gD hD TC iD jD kD lD mD IC JC KC nD","129":"J"},Q:{"1":"oD"},R:{"1":"pD"},S:{"1":"rD","2":"qD"}},B:6,C:"FLAC audio format",D:true};

View File

@@ -0,0 +1 @@
{"39":"0.20","40":"0.21","41":"0.21","42":"0.25","43":"0.27","44":"0.30","45":"0.31","47":"0.36","49":"0.37","50":"1.1","51":"1.2","52":"1.3","53":"1.4","54":"1.4","56":"1.6","58":"1.7","59":"1.8","61":"2.0","66":"3.0","69":"4.0","72":"5.0","73":"5.0","76":"6.0","78":"7.0","79":"8.0","80":"8.0","82":"9.0","83":"9.0","84":"10.0","85":"10.0","86":"11.0","87":"11.0","89":"12.0","90":"13.0","91":"13.0","92":"14.0","93":"14.0","94":"15.0","95":"16.0","96":"16.0","98":"17.0","99":"18.0","100":"18.0","102":"19.0","103":"20.0","104":"20.0","105":"21.0","106":"21.0","107":"22.0","108":"22.0","110":"23.0","111":"24.0","112":"24.0","114":"25.0","116":"26.0","118":"27.0","119":"28.0","120":"28.0","121":"29.0","122":"29.0","123":"30.0","124":"30.0","125":"31.0","126":"31.0","127":"32.0","128":"32.0","129":"33.0","130":"33.0","131":"34.0","132":"34.0","133":"35.0","134":"35.0","135":"36.0","136":"36.0"}

View File

@@ -0,0 +1,20 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = _construct;
var _isNativeReflectConstruct = require("./isNativeReflectConstruct.js");
var _setPrototypeOf = require("./setPrototypeOf.js");
function _construct(Parent, args, Class) {
if ((0, _isNativeReflectConstruct.default)()) {
return Reflect.construct.apply(null, arguments);
}
var a = [null];
a.push.apply(a, args);
var instance = new (Parent.bind.apply(Parent, a))();
if (Class) (0, _setPrototypeOf.default)(instance, Class.prototype);
return instance;
}
//# sourceMappingURL=construct.js.map

View File

@@ -0,0 +1,87 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.BlockStatement = BlockStatement;
exports.Directive = Directive;
exports.DirectiveLiteral = DirectiveLiteral;
exports.File = File;
exports.InterpreterDirective = InterpreterDirective;
exports.Placeholder = Placeholder;
exports.Program = Program;
function File(node) {
if (node.program) {
this.print(node.program.interpreter);
}
this.print(node.program);
}
function Program(node) {
var _node$directives;
this.noIndentInnerCommentsHere();
this.printInnerComments();
const directivesLen = (_node$directives = node.directives) == null ? void 0 : _node$directives.length;
if (directivesLen) {
var _node$directives$trai;
const newline = node.body.length ? 2 : 1;
this.printSequence(node.directives, undefined, newline);
if (!((_node$directives$trai = node.directives[directivesLen - 1].trailingComments) != null && _node$directives$trai.length)) {
this.newline(newline);
}
}
this.printSequence(node.body);
}
function BlockStatement(node) {
var _node$directives2;
this.tokenChar(123);
const exit = this.enterDelimited();
const directivesLen = (_node$directives2 = node.directives) == null ? void 0 : _node$directives2.length;
if (directivesLen) {
var _node$directives$trai2;
const newline = node.body.length ? 2 : 1;
this.printSequence(node.directives, true, newline);
if (!((_node$directives$trai2 = node.directives[directivesLen - 1].trailingComments) != null && _node$directives$trai2.length)) {
this.newline(newline);
}
}
this.printSequence(node.body, true);
exit();
this.rightBrace(node);
}
function Directive(node) {
this.print(node.value);
this.semicolon();
}
const unescapedSingleQuoteRE = /(?:^|[^\\])(?:\\\\)*'/;
const unescapedDoubleQuoteRE = /(?:^|[^\\])(?:\\\\)*"/;
function DirectiveLiteral(node) {
const raw = this.getPossibleRaw(node);
if (!this.format.minified && raw !== undefined) {
this.token(raw);
return;
}
const {
value
} = node;
if (!unescapedDoubleQuoteRE.test(value)) {
this.token(`"${value}"`);
} else if (!unescapedSingleQuoteRE.test(value)) {
this.token(`'${value}'`);
} else {
throw new Error("Malformed AST: it is not possible to print a directive containing" + " both unescaped single and double quotes.");
}
}
function InterpreterDirective(node) {
this.token(`#!${node.value}`);
this.newline(1, true);
}
function Placeholder(node) {
this.token("%%");
this.print(node.name);
this.token("%%");
if (node.expectedNode === "Statement") {
this.semicolon();
}
}
//# sourceMappingURL=base.js.map

View File

@@ -0,0 +1 @@
module.exports={C:{"48":0.00226,"78":0.00226,"109":0.00453,"110":0.00453,"115":0.02716,"121":0.00226,"125":0.00679,"128":0.01584,"129":0.00226,"132":0.00226,"133":0.00226,"134":0.00905,"135":0.09505,"136":0.35303,_:"2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 111 112 113 114 116 117 118 119 120 122 123 124 126 127 130 131 137 138 139 140 3.5 3.6"},D:{"38":0.00226,"39":0.00226,"40":0.00226,"41":0.00226,"42":0.00226,"43":0.00226,"44":0.00226,"45":0.00226,"46":0.00226,"47":0.01132,"48":0.00226,"49":0.00453,"50":0.00226,"52":0.00226,"53":0.00226,"54":0.00226,"55":0.00226,"56":0.00226,"57":0.00226,"58":0.04526,"59":0.00226,"60":0.00226,"68":0.00226,"72":0.00453,"73":0.00226,"75":0.00226,"78":0.00453,"79":0.01358,"81":0.00226,"83":0.00226,"84":0.00226,"85":0.00226,"87":0.06563,"88":0.00453,"89":0.00453,"91":0.00453,"93":0.00226,"94":0.00453,"95":0.00226,"98":0.00226,"99":0.00453,"101":0.05431,"102":0.00226,"103":0.06336,"104":0.00226,"105":0.00226,"106":0.01584,"107":0.01358,"108":0.00679,"109":0.31908,"110":0.01132,"111":0.02942,"112":0.00679,"113":0.00453,"114":0.02942,"116":0.02037,"117":0.00679,"118":0.00679,"119":0.00905,"120":0.01584,"121":0.01358,"122":0.02716,"123":0.02716,"124":0.043,"125":0.03395,"126":0.03168,"127":0.01358,"128":0.06336,"129":0.02489,"130":0.02489,"131":0.13125,"132":0.31682,"133":4.0915,"134":8.16038,"135":0.00453,_:"4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 51 61 62 63 64 65 66 67 69 70 71 74 76 77 80 86 90 92 96 97 100 115 136 137 138"},F:{"46":0.02263,"85":0.00226,"87":0.07015,"88":0.05884,"91":0.00679,"93":0.00453,"95":0.02716,"109":0.00226,"114":0.00226,"116":0.26025,"117":0.72416,_:"9 11 12 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 47 48 49 50 51 52 53 54 55 56 57 58 60 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 86 89 90 92 94 96 97 98 99 100 101 102 103 104 105 106 107 108 110 111 112 113 115 9.5-9.6 10.0-10.1 10.5 10.6 11.1 11.5 11.6 12.1"},B:{"18":0.00905,"92":0.00679,"103":0.00679,"107":0.00226,"109":0.02263,"114":0.00453,"121":0.00226,"126":0.00679,"127":0.00226,"128":0.00226,"129":0.00679,"130":0.00679,"131":0.10636,"132":0.08599,"133":0.70153,"134":1.69725,_:"12 13 14 15 16 17 79 80 81 83 84 85 86 87 88 89 90 91 93 94 95 96 97 98 99 100 101 102 104 105 106 108 110 111 112 113 115 116 117 118 119 120 122 123 124 125"},E:{"7":0.00453,"14":0.0181,"15":0.00226,_:"0 4 5 6 8 9 10 11 12 13 3.1 3.2 6.1 7.1 9.1 10.1 11.1","5.1":0.00226,"12.1":0.00226,"13.1":0.00905,"14.1":0.02263,"15.1":0.00679,"15.2-15.3":0.00226,"15.4":0.00453,"15.5":0.00453,"15.6":0.05205,"16.0":0.00905,"16.1":0.01132,"16.2":0.00905,"16.3":0.02716,"16.4":0.00679,"16.5":0.02037,"16.6":0.11089,"17.0":0.00453,"17.1":0.04979,"17.2":0.02263,"17.3":0.03395,"17.4":0.02716,"17.5":0.08826,"17.6":0.16067,"18.0":0.06336,"18.1":0.10184,"18.2":0.09957,"18.3":0.92783,"18.4":0.00679},G:{"8":0,"3.2":0,"4.0-4.1":0,"4.2-4.3":0.00602,"5.0-5.1":0,"6.0-6.1":0.01805,"7.0-7.1":0.01204,"8.1-8.4":0,"9.0-9.2":0.00903,"9.3":0.04212,"10.0-10.2":0.00301,"10.3":0.06921,"11.0-11.2":0.31895,"11.3-11.4":0.02106,"12.0-12.1":0.01204,"12.2-12.5":0.29788,"13.0-13.1":0.00602,"13.2":0.00903,"13.3":0.01204,"13.4-13.7":0.04212,"14.0-14.4":0.10531,"14.5-14.8":0.12637,"15.0-15.1":0.06921,"15.2-15.3":0.06921,"15.4":0.08425,"15.5":0.09629,"15.6-15.8":1.18551,"16.0":0.1685,"16.1":0.34603,"16.2":0.18054,"16.3":0.31293,"16.4":0.06921,"16.5":0.12938,"16.6-16.7":1.40517,"17.0":0.08425,"17.1":0.15045,"17.2":0.11434,"17.3":0.15947,"17.4":0.31895,"17.5":0.7101,"17.6-17.7":2.06111,"18.0":0.57771,"18.1":1.8896,"18.2":0.84551,"18.3":17.67138,"18.4":0.26178},P:{"4":0.05098,"21":0.03059,"22":0.05098,"23":0.05098,"24":0.09176,"25":0.10195,"26":0.15293,"27":3.4664,_:"20 5.0-5.4 6.2-6.4 8.2 9.2 10.1 12.0 14.0 15.0 16.0 17.0","7.2-7.4":0.03059,"11.1-11.2":0.03059,"13.0":0.04078,"18.0":0.0102,"19.0":0.02039},I:{"0":0.02316,"3":0,"4":0,"2.1":0,"2.2":0,"2.3":0,"4.1":0,"4.2-4.3":0.00001,"4.4":0,"4.4.3-4.4.4":0.00003},K:{"0":1.4855,_:"10 11 12 11.1 11.5 12.1"},A:{"11":0.03847,_:"6 7 8 9 10 5.5"},S:{_:"2.5 3.0-3.1"},J:{_:"7 10"},N:{_:"10 11"},R:{_:"0"},M:{"0":0.09284},Q:{_:"14.9"},O:{"0":1.4855},H:{"0":0},L:{"0":41.8484}};

View File

@@ -0,0 +1,611 @@
'use strict'
let AtRule = require('./at-rule')
let Comment = require('./comment')
let Declaration = require('./declaration')
let Root = require('./root')
let Rule = require('./rule')
let tokenizer = require('./tokenize')
const SAFE_COMMENT_NEIGHBOR = {
empty: true,
space: true
}
function findLastWithPosition(tokens) {
for (let i = tokens.length - 1; i >= 0; i--) {
let token = tokens[i]
let pos = token[3] || token[2]
if (pos) return pos
}
}
class Parser {
constructor(input) {
this.input = input
this.root = new Root()
this.current = this.root
this.spaces = ''
this.semicolon = false
this.createTokenizer()
this.root.source = { input, start: { column: 1, line: 1, offset: 0 } }
}
atrule(token) {
let node = new AtRule()
node.name = token[1].slice(1)
if (node.name === '') {
this.unnamedAtrule(node, token)
}
this.init(node, token[2])
let type
let prev
let shift
let last = false
let open = false
let params = []
let brackets = []
while (!this.tokenizer.endOfFile()) {
token = this.tokenizer.nextToken()
type = token[0]
if (type === '(' || type === '[') {
brackets.push(type === '(' ? ')' : ']')
} else if (type === '{' && brackets.length > 0) {
brackets.push('}')
} else if (type === brackets[brackets.length - 1]) {
brackets.pop()
}
if (brackets.length === 0) {
if (type === ';') {
node.source.end = this.getPosition(token[2])
node.source.end.offset++
this.semicolon = true
break
} else if (type === '{') {
open = true
break
} else if (type === '}') {
if (params.length > 0) {
shift = params.length - 1
prev = params[shift]
while (prev && prev[0] === 'space') {
prev = params[--shift]
}
if (prev) {
node.source.end = this.getPosition(prev[3] || prev[2])
node.source.end.offset++
}
}
this.end(token)
break
} else {
params.push(token)
}
} else {
params.push(token)
}
if (this.tokenizer.endOfFile()) {
last = true
break
}
}
node.raws.between = this.spacesAndCommentsFromEnd(params)
if (params.length) {
node.raws.afterName = this.spacesAndCommentsFromStart(params)
this.raw(node, 'params', params)
if (last) {
token = params[params.length - 1]
node.source.end = this.getPosition(token[3] || token[2])
node.source.end.offset++
this.spaces = node.raws.between
node.raws.between = ''
}
} else {
node.raws.afterName = ''
node.params = ''
}
if (open) {
node.nodes = []
this.current = node
}
}
checkMissedSemicolon(tokens) {
let colon = this.colon(tokens)
if (colon === false) return
let founded = 0
let token
for (let j = colon - 1; j >= 0; j--) {
token = tokens[j]
if (token[0] !== 'space') {
founded += 1
if (founded === 2) break
}
}
// If the token is a word, e.g. `!important`, `red` or any other valid property's value.
// Then we need to return the colon after that word token. [3] is the "end" colon of that word.
// And because we need it after that one we do +1 to get the next one.
throw this.input.error(
'Missed semicolon',
token[0] === 'word' ? token[3] + 1 : token[2]
)
}
colon(tokens) {
let brackets = 0
let prev, token, type
for (let [i, element] of tokens.entries()) {
token = element
type = token[0]
if (type === '(') {
brackets += 1
}
if (type === ')') {
brackets -= 1
}
if (brackets === 0 && type === ':') {
if (!prev) {
this.doubleColon(token)
} else if (prev[0] === 'word' && prev[1] === 'progid') {
continue
} else {
return i
}
}
prev = token
}
return false
}
comment(token) {
let node = new Comment()
this.init(node, token[2])
node.source.end = this.getPosition(token[3] || token[2])
node.source.end.offset++
let text = token[1].slice(2, -2)
if (/^\s*$/.test(text)) {
node.text = ''
node.raws.left = text
node.raws.right = ''
} else {
let match = text.match(/^(\s*)([^]*\S)(\s*)$/)
node.text = match[2]
node.raws.left = match[1]
node.raws.right = match[3]
}
}
createTokenizer() {
this.tokenizer = tokenizer(this.input)
}
decl(tokens, customProperty) {
let node = new Declaration()
this.init(node, tokens[0][2])
let last = tokens[tokens.length - 1]
if (last[0] === ';') {
this.semicolon = true
tokens.pop()
}
node.source.end = this.getPosition(
last[3] || last[2] || findLastWithPosition(tokens)
)
node.source.end.offset++
while (tokens[0][0] !== 'word') {
if (tokens.length === 1) this.unknownWord(tokens)
node.raws.before += tokens.shift()[1]
}
node.source.start = this.getPosition(tokens[0][2])
node.prop = ''
while (tokens.length) {
let type = tokens[0][0]
if (type === ':' || type === 'space' || type === 'comment') {
break
}
node.prop += tokens.shift()[1]
}
node.raws.between = ''
let token
while (tokens.length) {
token = tokens.shift()
if (token[0] === ':') {
node.raws.between += token[1]
break
} else {
if (token[0] === 'word' && /\w/.test(token[1])) {
this.unknownWord([token])
}
node.raws.between += token[1]
}
}
if (node.prop[0] === '_' || node.prop[0] === '*') {
node.raws.before += node.prop[0]
node.prop = node.prop.slice(1)
}
let firstSpaces = []
let next
while (tokens.length) {
next = tokens[0][0]
if (next !== 'space' && next !== 'comment') break
firstSpaces.push(tokens.shift())
}
this.precheckMissedSemicolon(tokens)
for (let i = tokens.length - 1; i >= 0; i--) {
token = tokens[i]
if (token[1].toLowerCase() === '!important') {
node.important = true
let string = this.stringFrom(tokens, i)
string = this.spacesFromEnd(tokens) + string
if (string !== ' !important') node.raws.important = string
break
} else if (token[1].toLowerCase() === 'important') {
let cache = tokens.slice(0)
let str = ''
for (let j = i; j > 0; j--) {
let type = cache[j][0]
if (str.trim().startsWith('!') && type !== 'space') {
break
}
str = cache.pop()[1] + str
}
if (str.trim().startsWith('!')) {
node.important = true
node.raws.important = str
tokens = cache
}
}
if (token[0] !== 'space' && token[0] !== 'comment') {
break
}
}
let hasWord = tokens.some(i => i[0] !== 'space' && i[0] !== 'comment')
if (hasWord) {
node.raws.between += firstSpaces.map(i => i[1]).join('')
firstSpaces = []
}
this.raw(node, 'value', firstSpaces.concat(tokens), customProperty)
if (node.value.includes(':') && !customProperty) {
this.checkMissedSemicolon(tokens)
}
}
doubleColon(token) {
throw this.input.error(
'Double colon',
{ offset: token[2] },
{ offset: token[2] + token[1].length }
)
}
emptyRule(token) {
let node = new Rule()
this.init(node, token[2])
node.selector = ''
node.raws.between = ''
this.current = node
}
end(token) {
if (this.current.nodes && this.current.nodes.length) {
this.current.raws.semicolon = this.semicolon
}
this.semicolon = false
this.current.raws.after = (this.current.raws.after || '') + this.spaces
this.spaces = ''
if (this.current.parent) {
this.current.source.end = this.getPosition(token[2])
this.current.source.end.offset++
this.current = this.current.parent
} else {
this.unexpectedClose(token)
}
}
endFile() {
if (this.current.parent) this.unclosedBlock()
if (this.current.nodes && this.current.nodes.length) {
this.current.raws.semicolon = this.semicolon
}
this.current.raws.after = (this.current.raws.after || '') + this.spaces
this.root.source.end = this.getPosition(this.tokenizer.position())
}
freeSemicolon(token) {
this.spaces += token[1]
if (this.current.nodes) {
let prev = this.current.nodes[this.current.nodes.length - 1]
if (prev && prev.type === 'rule' && !prev.raws.ownSemicolon) {
prev.raws.ownSemicolon = this.spaces
this.spaces = ''
prev.source.end = this.getPosition(token[2])
prev.source.end.offset += prev.raws.ownSemicolon.length
}
}
}
// Helpers
getPosition(offset) {
let pos = this.input.fromOffset(offset)
return {
column: pos.col,
line: pos.line,
offset
}
}
init(node, offset) {
this.current.push(node)
node.source = {
input: this.input,
start: this.getPosition(offset)
}
node.raws.before = this.spaces
this.spaces = ''
if (node.type !== 'comment') this.semicolon = false
}
other(start) {
let end = false
let type = null
let colon = false
let bracket = null
let brackets = []
let customProperty = start[1].startsWith('--')
let tokens = []
let token = start
while (token) {
type = token[0]
tokens.push(token)
if (type === '(' || type === '[') {
if (!bracket) bracket = token
brackets.push(type === '(' ? ')' : ']')
} else if (customProperty && colon && type === '{') {
if (!bracket) bracket = token
brackets.push('}')
} else if (brackets.length === 0) {
if (type === ';') {
if (colon) {
this.decl(tokens, customProperty)
return
} else {
break
}
} else if (type === '{') {
this.rule(tokens)
return
} else if (type === '}') {
this.tokenizer.back(tokens.pop())
end = true
break
} else if (type === ':') {
colon = true
}
} else if (type === brackets[brackets.length - 1]) {
brackets.pop()
if (brackets.length === 0) bracket = null
}
token = this.tokenizer.nextToken()
}
if (this.tokenizer.endOfFile()) end = true
if (brackets.length > 0) this.unclosedBracket(bracket)
if (end && colon) {
if (!customProperty) {
while (tokens.length) {
token = tokens[tokens.length - 1][0]
if (token !== 'space' && token !== 'comment') break
this.tokenizer.back(tokens.pop())
}
}
this.decl(tokens, customProperty)
} else {
this.unknownWord(tokens)
}
}
parse() {
let token
while (!this.tokenizer.endOfFile()) {
token = this.tokenizer.nextToken()
switch (token[0]) {
case 'space':
this.spaces += token[1]
break
case ';':
this.freeSemicolon(token)
break
case '}':
this.end(token)
break
case 'comment':
this.comment(token)
break
case 'at-word':
this.atrule(token)
break
case '{':
this.emptyRule(token)
break
default:
this.other(token)
break
}
}
this.endFile()
}
precheckMissedSemicolon(/* tokens */) {
// Hook for Safe Parser
}
raw(node, prop, tokens, customProperty) {
let token, type
let length = tokens.length
let value = ''
let clean = true
let next, prev
for (let i = 0; i < length; i += 1) {
token = tokens[i]
type = token[0]
if (type === 'space' && i === length - 1 && !customProperty) {
clean = false
} else if (type === 'comment') {
prev = tokens[i - 1] ? tokens[i - 1][0] : 'empty'
next = tokens[i + 1] ? tokens[i + 1][0] : 'empty'
if (!SAFE_COMMENT_NEIGHBOR[prev] && !SAFE_COMMENT_NEIGHBOR[next]) {
if (value.slice(-1) === ',') {
clean = false
} else {
value += token[1]
}
} else {
clean = false
}
} else {
value += token[1]
}
}
if (!clean) {
let raw = tokens.reduce((all, i) => all + i[1], '')
node.raws[prop] = { raw, value }
}
node[prop] = value
}
rule(tokens) {
tokens.pop()
let node = new Rule()
this.init(node, tokens[0][2])
node.raws.between = this.spacesAndCommentsFromEnd(tokens)
this.raw(node, 'selector', tokens)
this.current = node
}
spacesAndCommentsFromEnd(tokens) {
let lastTokenType
let spaces = ''
while (tokens.length) {
lastTokenType = tokens[tokens.length - 1][0]
if (lastTokenType !== 'space' && lastTokenType !== 'comment') break
spaces = tokens.pop()[1] + spaces
}
return spaces
}
// Errors
spacesAndCommentsFromStart(tokens) {
let next
let spaces = ''
while (tokens.length) {
next = tokens[0][0]
if (next !== 'space' && next !== 'comment') break
spaces += tokens.shift()[1]
}
return spaces
}
spacesFromEnd(tokens) {
let lastTokenType
let spaces = ''
while (tokens.length) {
lastTokenType = tokens[tokens.length - 1][0]
if (lastTokenType !== 'space') break
spaces = tokens.pop()[1] + spaces
}
return spaces
}
stringFrom(tokens, from) {
let result = ''
for (let i = from; i < tokens.length; i++) {
result += tokens[i][1]
}
tokens.splice(from, tokens.length - from)
return result
}
unclosedBlock() {
let pos = this.current.source.start
throw this.input.error('Unclosed block', pos.line, pos.column)
}
unclosedBracket(bracket) {
throw this.input.error(
'Unclosed bracket',
{ offset: bracket[2] },
{ offset: bracket[2] + 1 }
)
}
unexpectedClose(token) {
throw this.input.error(
'Unexpected }',
{ offset: token[2] },
{ offset: token[2] + 1 }
)
}
unknownWord(tokens) {
throw this.input.error(
'Unknown word ' + tokens[0][1],
{ offset: tokens[0][2] },
{ offset: tokens[0][2] + tokens[0][1].length }
)
}
unnamedAtrule(node, token) {
throw this.input.error(
'At-rule without name',
{ offset: token[2] },
{ offset: token[2] + token[1].length }
)
}
}
module.exports = Parser

View File

@@ -0,0 +1,224 @@
/**
* @fileoverview Specify the maximum number of statements allowed per line.
* @author Kenneth Williams
* @deprecated in ESLint v8.53.0
*/
"use strict";
//------------------------------------------------------------------------------
// Requirements
//------------------------------------------------------------------------------
const astUtils = require("./utils/ast-utils");
//------------------------------------------------------------------------------
// Rule Definition
//------------------------------------------------------------------------------
/** @type {import('../shared/types').Rule} */
module.exports = {
meta: {
deprecated: {
message: "Formatting rules are being moved out of ESLint core.",
url: "https://eslint.org/blog/2023/10/deprecating-formatting-rules/",
deprecatedSince: "8.53.0",
availableUntil: "10.0.0",
replacedBy: [
{
message:
"ESLint Stylistic now maintains deprecated stylistic core rules.",
url: "https://eslint.style/guide/migration",
plugin: {
name: "@stylistic/eslint-plugin-js",
url: "https://eslint.style/packages/js",
},
rule: {
name: "max-statements-per-line",
url: "https://eslint.style/rules/js/max-statements-per-line",
},
},
],
},
type: "layout",
docs: {
description:
"Enforce a maximum number of statements allowed per line",
recommended: false,
url: "https://eslint.org/docs/latest/rules/max-statements-per-line",
},
schema: [
{
type: "object",
properties: {
max: {
type: "integer",
minimum: 1,
default: 1,
},
},
additionalProperties: false,
},
],
messages: {
exceed: "This line has {{numberOfStatementsOnThisLine}} {{statements}}. Maximum allowed is {{maxStatementsPerLine}}.",
},
},
create(context) {
const sourceCode = context.sourceCode,
options = context.options[0] || {},
maxStatementsPerLine =
typeof options.max !== "undefined" ? options.max : 1;
let lastStatementLine = 0,
numberOfStatementsOnThisLine = 0,
firstExtraStatement;
//--------------------------------------------------------------------------
// Helpers
//--------------------------------------------------------------------------
const SINGLE_CHILD_ALLOWED =
/^(?:(?:DoWhile|For|ForIn|ForOf|If|Labeled|While)Statement|Export(?:Default|Named)Declaration)$/u;
/**
* Reports with the first extra statement, and clears it.
* @returns {void}
*/
function reportFirstExtraStatementAndClear() {
if (firstExtraStatement) {
context.report({
node: firstExtraStatement,
messageId: "exceed",
data: {
numberOfStatementsOnThisLine,
maxStatementsPerLine,
statements:
numberOfStatementsOnThisLine === 1
? "statement"
: "statements",
},
});
}
firstExtraStatement = null;
}
/**
* Gets the actual last token of a given node.
* @param {ASTNode} node A node to get. This is a node except EmptyStatement.
* @returns {Token} The actual last token.
*/
function getActualLastToken(node) {
return sourceCode.getLastToken(node, astUtils.isNotSemicolonToken);
}
/**
* Addresses a given node.
* It updates the state of this rule, then reports the node if the node violated this rule.
* @param {ASTNode} node A node to check.
* @returns {void}
*/
function enterStatement(node) {
const line = node.loc.start.line;
/*
* Skip to allow non-block statements if this is direct child of control statements.
* `if (a) foo();` is counted as 1.
* But `if (a) foo(); else foo();` should be counted as 2.
*/
if (
SINGLE_CHILD_ALLOWED.test(node.parent.type) &&
node.parent.alternate !== node
) {
return;
}
// Update state.
if (line === lastStatementLine) {
numberOfStatementsOnThisLine += 1;
} else {
reportFirstExtraStatementAndClear();
numberOfStatementsOnThisLine = 1;
lastStatementLine = line;
}
// Reports if the node violated this rule.
if (numberOfStatementsOnThisLine === maxStatementsPerLine + 1) {
firstExtraStatement = firstExtraStatement || node;
}
}
/**
* Updates the state of this rule with the end line of leaving node to check with the next statement.
* @param {ASTNode} node A node to check.
* @returns {void}
*/
function leaveStatement(node) {
const line = getActualLastToken(node).loc.end.line;
// Update state.
if (line !== lastStatementLine) {
reportFirstExtraStatementAndClear();
numberOfStatementsOnThisLine = 1;
lastStatementLine = line;
}
}
//--------------------------------------------------------------------------
// Public API
//--------------------------------------------------------------------------
return {
BreakStatement: enterStatement,
ClassDeclaration: enterStatement,
ContinueStatement: enterStatement,
DebuggerStatement: enterStatement,
DoWhileStatement: enterStatement,
ExpressionStatement: enterStatement,
ForInStatement: enterStatement,
ForOfStatement: enterStatement,
ForStatement: enterStatement,
FunctionDeclaration: enterStatement,
IfStatement: enterStatement,
ImportDeclaration: enterStatement,
LabeledStatement: enterStatement,
ReturnStatement: enterStatement,
SwitchStatement: enterStatement,
ThrowStatement: enterStatement,
TryStatement: enterStatement,
VariableDeclaration: enterStatement,
WhileStatement: enterStatement,
WithStatement: enterStatement,
ExportNamedDeclaration: enterStatement,
ExportDefaultDeclaration: enterStatement,
ExportAllDeclaration: enterStatement,
"BreakStatement:exit": leaveStatement,
"ClassDeclaration:exit": leaveStatement,
"ContinueStatement:exit": leaveStatement,
"DebuggerStatement:exit": leaveStatement,
"DoWhileStatement:exit": leaveStatement,
"ExpressionStatement:exit": leaveStatement,
"ForInStatement:exit": leaveStatement,
"ForOfStatement:exit": leaveStatement,
"ForStatement:exit": leaveStatement,
"FunctionDeclaration:exit": leaveStatement,
"IfStatement:exit": leaveStatement,
"ImportDeclaration:exit": leaveStatement,
"LabeledStatement:exit": leaveStatement,
"ReturnStatement:exit": leaveStatement,
"SwitchStatement:exit": leaveStatement,
"ThrowStatement:exit": leaveStatement,
"TryStatement:exit": leaveStatement,
"VariableDeclaration:exit": leaveStatement,
"WhileStatement:exit": leaveStatement,
"WithStatement:exit": leaveStatement,
"ExportNamedDeclaration:exit": leaveStatement,
"ExportDefaultDeclaration:exit": leaveStatement,
"ExportAllDeclaration:exit": leaveStatement,
"Program:exit": reportFirstExtraStatementAndClear,
};
},
};

View File

@@ -0,0 +1,15 @@
# Installation
> `npm install --save @types/cookie`
# Summary
This package contains type definitions for cookie (https://github.com/jshttp/cookie).
# Details
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/cookie.
### Additional Details
* Last updated: Sun, 26 Nov 2023 22:07:01 GMT
* Dependencies: none
# Credits
These definitions were written by [Pine Mizune](https://github.com/pine), and [Piotr Błażejewicz](https://github.com/peterblazejewicz).

View File

@@ -0,0 +1,109 @@
# `eslint-plugin-react-hooks`
This ESLint plugin enforces the [Rules of Hooks](https://react.dev/reference/rules/rules-of-hooks).
It is a part of the [Hooks API](https://react.dev/reference/react/hooks) for React.
## Installation
**Note: If you're using Create React App, please use `react-scripts` >= 3 instead of adding it directly.**
Assuming you already have ESLint installed, run:
```sh
# npm
npm install eslint-plugin-react-hooks --save-dev
# yarn
yarn add eslint-plugin-react-hooks --dev
```
### Legacy Config (.eslintrc)
If you are still using ESLint below 9.0.0, please continue to use `recommended-legacy`. To avoid breaking changes, we still support `recommended` as well, but note that this will be changed to alias the flat recommended config in v6.
```js
{
"extends": [
// ...
"plugin:react-hooks/recommended-legacy"
]
}
```
### Flat Config (eslint.config.js)
For [ESLint 9.0.0 and above](https://eslint.org/blog/2024/04/eslint-v9.0.0-released/) users, add the `recommended-latest` config.
```js
import reactHooks from 'eslint-plugin-react-hooks';
export default [
// ...
reactHooks.configs['recommended-latest'],
];
```
### Custom Configuration
If you want more fine-grained configuration, you can instead add a snippet like this to your ESLint configuration file:
#### Legacy Config (.eslintrc)
```js
{
"plugins": [
// ...
"react-hooks"
],
"rules": {
// ...
"react-hooks/rules-of-hooks": "error",
"react-hooks/exhaustive-deps": "warn"
}
}
```
#### Flat Config (eslint.config.js)
```js
import reactHooks from 'eslint-plugin-react-hooks';
export default [
{
files: ['**/*.{js,jsx}'],
plugins: { 'react-hooks': reactHooks },
// ...
rules: {
'react-hooks/rules-of-hooks': 'error',
'react-hooks/exhaustive-deps': 'warn',
}
},
];
```
## Advanced Configuration
`exhaustive-deps` can be configured to validate dependencies of custom Hooks with the `additionalHooks` option.
This option accepts a regex to match the names of custom Hooks that have dependencies.
```js
{
"rules": {
// ...
"react-hooks/exhaustive-deps": ["warn", {
"additionalHooks": "(useMyCustomHook|useMyOtherCustomHook)"
}]
}
}
```
We suggest to use this option **very sparingly, if at all**. Generally saying, we recommend most custom Hooks to not use the dependencies argument, and instead provide a higher-level API that is more focused around a specific use case.
## Valid and Invalid Examples
Please refer to the [Rules of Hooks](https://react.dev/reference/rules/rules-of-hooks) documentation to learn more about this rule.
## License
MIT

View File

@@ -0,0 +1,8 @@
"use strict";
// As defined in https://github.com/mozilla/pdf.js/blob/d9fac3459609a807be6506fb3441b5da4b154d14/src/shared/util.js#L371-L374
Object.defineProperty(exports, "__esModule", { value: true });
const PasswordResponses = {
NEED_PASSWORD: 1,
INCORRECT_PASSWORD: 2,
};
exports.default = PasswordResponses;

View File

@@ -0,0 +1,50 @@
import { jsx, Fragment } from "react/jsx-runtime";
import { createElement } from "react";
import { Asset } from "./Asset.js";
import { useRouterState } from "./useRouterState.js";
import { useRouter } from "./useRouter.js";
const Scripts = () => {
const router = useRouter();
const assetScripts = useRouterState({
select: (state) => {
var _a;
const assetScripts2 = [];
const manifest = (_a = router.ssr) == null ? void 0 : _a.manifest;
if (!manifest) {
return [];
}
state.matches.map((match) => router.looseRoutesById[match.routeId]).forEach(
(route) => {
var _a2, _b;
return (_b = (_a2 = manifest.routes[route.id]) == null ? void 0 : _a2.assets) == null ? void 0 : _b.filter((d) => d.tag === "script").forEach((asset) => {
assetScripts2.push({
tag: "script",
attrs: asset.attrs,
children: asset.children
});
});
}
);
return assetScripts2;
},
structuralSharing: true
});
const { scripts } = useRouterState({
select: (state) => ({
scripts: state.matches.map((match) => match.scripts).flat(1).filter(Boolean).map(({ children, ...script }) => ({
tag: "script",
attrs: {
...script,
suppressHydrationWarning: true
},
children
}))
})
});
const allScripts = [...scripts, ...assetScripts];
return /* @__PURE__ */ jsx(Fragment, { children: allScripts.map((asset, i) => /* @__PURE__ */ createElement(Asset, { ...asset, key: `tsr-scripts-${asset.tag}-${i}` })) });
};
export {
Scripts
};
//# sourceMappingURL=Scripts.js.map

View File

@@ -0,0 +1,154 @@
/*
Copyright (C) 2015 Yusuke Suzuki <utatane.tea@gmail.com>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
import estraverse from "estraverse";
import esrecurse from "esrecurse";
const { Syntax } = estraverse;
/**
* Get last array element
* @param {Array} xs array
* @returns {any} Last elment
*/
function getLast(xs) {
return xs.at(-1) || null;
}
/**
* Visitor for destructuring patterns.
*/
class PatternVisitor extends esrecurse.Visitor {
static isPattern(node) {
const nodeType = node.type;
return (
nodeType === Syntax.Identifier ||
nodeType === Syntax.ObjectPattern ||
nodeType === Syntax.ArrayPattern ||
nodeType === Syntax.SpreadElement ||
nodeType === Syntax.RestElement ||
nodeType === Syntax.AssignmentPattern
);
}
constructor(options, rootPattern, callback) {
super(null, options);
this.rootPattern = rootPattern;
this.callback = callback;
this.assignments = [];
this.rightHandNodes = [];
this.restElements = [];
}
Identifier(pattern) {
const lastRestElement = getLast(this.restElements);
this.callback(pattern, {
topLevel: pattern === this.rootPattern,
rest: lastRestElement !== null && lastRestElement !== void 0 && lastRestElement.argument === pattern,
assignments: this.assignments
});
}
Property(property) {
// Computed property's key is a right hand node.
if (property.computed) {
this.rightHandNodes.push(property.key);
}
// If it's shorthand, its key is same as its value.
// If it's shorthand and has its default value, its key is same as its value.left (the value is AssignmentPattern).
// If it's not shorthand, the name of new variable is its value's.
this.visit(property.value);
}
ArrayPattern(pattern) {
for (let i = 0, iz = pattern.elements.length; i < iz; ++i) {
const element = pattern.elements[i];
this.visit(element);
}
}
AssignmentPattern(pattern) {
this.assignments.push(pattern);
this.visit(pattern.left);
this.rightHandNodes.push(pattern.right);
this.assignments.pop();
}
RestElement(pattern) {
this.restElements.push(pattern);
this.visit(pattern.argument);
this.restElements.pop();
}
MemberExpression(node) {
// Computed property's key is a right hand node.
if (node.computed) {
this.rightHandNodes.push(node.property);
}
// the object is only read, write to its property.
this.rightHandNodes.push(node.object);
}
//
// ForInStatement.left and AssignmentExpression.left are LeftHandSideExpression.
// By spec, LeftHandSideExpression is Pattern or MemberExpression.
// (see also: https://github.com/estree/estree/pull/20#issuecomment-74584758)
// But espree 2.0 parses to ArrayExpression, ObjectExpression, etc...
//
SpreadElement(node) {
this.visit(node.argument);
}
ArrayExpression(node) {
node.elements.forEach(this.visit, this);
}
AssignmentExpression(node) {
this.assignments.push(node);
this.visit(node.left);
this.rightHandNodes.push(node.right);
this.assignments.pop();
}
CallExpression(node) {
// arguments are right hand nodes.
node.arguments.forEach(a => {
this.rightHandNodes.push(a);
});
this.visit(node.callee);
}
}
export default PatternVisitor;
/* vim: set sw=4 ts=4 et tw=80 : */