update
This commit is contained in:
@@ -0,0 +1 @@
|
||||
module.exports={C:{"45":0.07594,"52":0.05062,"68":0.00362,"75":0.00362,"78":0.01446,"81":0.00362,"84":0.04701,"88":0.00723,"89":0.03978,"91":0.10125,"96":0.00362,"99":0.00362,"100":0.00723,"102":0.00362,"103":0.00362,"104":0.00362,"107":0.00362,"108":0.00362,"109":0.00362,"110":0.00362,"111":0.00362,"113":0.00723,"115":0.58218,"120":0.00362,"121":0.00362,"122":0.00362,"125":0.02531,"126":0.00362,"127":0.01446,"128":0.14464,"129":0.00362,"130":0.00362,"131":0.00723,"132":0.01808,"133":0.01808,"134":0.02893,"135":0.62557,"136":2.32509,"137":0.00723,_:"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 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 76 77 79 80 82 83 85 86 87 90 92 93 94 95 97 98 101 105 106 112 114 116 117 118 119 123 124 138 139 140 3.5 3.6"},D:{"41":0.00723,"49":0.02531,"53":0.00723,"58":0.00362,"63":0.00362,"73":0.00362,"74":0.00362,"76":0.00362,"78":0.00362,"79":0.11933,"80":0.00723,"81":0.00362,"83":0.00723,"85":0.00723,"86":0.00362,"87":0.08678,"88":0.00723,"89":0.00362,"90":0.00362,"91":0.01446,"92":0.00362,"93":0.10125,"94":0.00723,"95":0.00362,"97":0.00362,"98":0.97632,"99":0.00723,"100":0.01446,"102":0.00723,"103":0.01446,"104":0.13018,"105":0.00362,"106":0.01085,"107":0.00723,"108":0.05424,"109":2.11536,"110":0.01085,"111":0.0217,"112":0.00723,"113":0.00723,"114":0.01808,"115":0.0217,"116":0.02893,"117":0.00723,"118":0.01085,"119":0.01808,"120":0.02531,"121":0.02531,"122":0.04339,"123":0.01808,"124":0.06509,"125":0.01808,"126":0.03978,"127":0.01808,"128":0.05786,"129":0.03978,"130":0.03978,"131":0.21334,"132":0.47008,"133":6.15082,"134":13.69018,"135":0.00723,"136":0.00362,_:"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 42 43 44 45 46 47 48 50 51 52 54 55 56 57 59 60 61 62 64 65 66 67 68 69 70 71 72 75 77 84 96 101 137 138"},F:{"28":0.00362,"36":0.00362,"46":0.03978,"83":0.00362,"85":0.01085,"86":0.00362,"87":0.0217,"88":0.00723,"89":0.00362,"95":0.07232,"114":0.00362,"115":0.00362,"116":0.15549,"117":0.80275,_:"9 11 12 15 16 17 18 19 20 21 22 23 24 25 26 27 29 30 31 32 33 34 35 37 38 39 40 41 42 43 44 45 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 84 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"},B:{"15":0.00362,"92":0.00362,"107":0.00362,"108":0.00362,"109":0.06147,"114":0.00362,"119":0.00362,"120":0.00723,"121":0.00362,"123":0.00362,"124":0.00362,"125":0.00362,"126":0.00362,"127":0.00362,"128":0.00362,"129":0.00362,"130":0.00723,"131":0.01808,"132":0.03254,"133":0.84976,"134":2.26362,_:"12 13 14 16 17 18 79 80 81 83 84 85 86 87 88 89 90 91 93 94 95 96 97 98 99 100 101 102 103 104 105 106 110 111 112 113 115 116 117 118 122"},E:{"14":0.00362,_:"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 12.1 15.2-15.3","13.1":0.00362,"14.1":0.01808,"15.1":0.00362,"15.4":0.00362,"15.5":0.00362,"15.6":0.04339,"16.0":0.00723,"16.1":0.00362,"16.2":0.00362,"16.3":0.00723,"16.4":0.00362,"16.5":0.00723,"16.6":0.05786,"17.0":0.00362,"17.1":0.03978,"17.2":0.00723,"17.3":0.00723,"17.4":0.01808,"17.5":0.02531,"17.6":0.07594,"18.0":0.01808,"18.1":0.03254,"18.2":0.01446,"18.3":0.36883,"18.4":0.00723},G:{"8":0,"3.2":0,"4.0-4.1":0,"4.2-4.3":0.00212,"5.0-5.1":0,"6.0-6.1":0.00637,"7.0-7.1":0.00425,"8.1-8.4":0,"9.0-9.2":0.00318,"9.3":0.01486,"10.0-10.2":0.00106,"10.3":0.02441,"11.0-11.2":0.11252,"11.3-11.4":0.00743,"12.0-12.1":0.00425,"12.2-12.5":0.10509,"13.0-13.1":0.00212,"13.2":0.00318,"13.3":0.00425,"13.4-13.7":0.01486,"14.0-14.4":0.03715,"14.5-14.8":0.04458,"15.0-15.1":0.02441,"15.2-15.3":0.02441,"15.4":0.02972,"15.5":0.03397,"15.6-15.8":0.41823,"16.0":0.05944,"16.1":0.12207,"16.2":0.06369,"16.3":0.1104,"16.4":0.02441,"16.5":0.04564,"16.6-16.7":0.49572,"17.0":0.02972,"17.1":0.05307,"17.2":0.04034,"17.3":0.05626,"17.4":0.11252,"17.5":0.25051,"17.6-17.7":0.72712,"18.0":0.20381,"18.1":0.66662,"18.2":0.29828,"18.3":6.23415,"18.4":0.09235},P:{"4":0.16439,"20":0.01027,"21":0.02055,"22":0.03082,"23":0.05137,"24":0.05137,"25":0.0411,"26":0.11302,"27":3.02074,"5.0-5.4":0.02055,"6.2-6.4":0.02055,"7.2-7.4":0.03082,_:"8.2 9.2 10.1 11.1-11.2 12.0 13.0 14.0 15.0 16.0","17.0":0.01027,"18.0":0.01027,"19.0":0.01027},I:{"0":0.08917,"3":0,"4":0,"2.1":0,"2.2":0,"2.3":0,"4.1":0,"4.2-4.3":0.00003,"4.4":0,"4.4.3-4.4.4":0.0001},K:{"0":0.38298,_:"10 11 12 11.1 11.5 12.1"},A:{"11":0.04339,_:"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.24255},Q:{_:"14.9"},O:{"0":0.03192},H:{"0":0},L:{"0":49.93657}};
|
||||
@@ -0,0 +1,27 @@
|
||||
ESQuery is a library for querying the AST output by Esprima for patterns of syntax using a CSS style selector system. Check out the demo:
|
||||
|
||||
[demo](https://estools.github.io/esquery/)
|
||||
|
||||
The following selectors are supported:
|
||||
* AST node type: `ForStatement`
|
||||
* [wildcard](http://dev.w3.org/csswg/selectors4/#universal-selector): `*`
|
||||
* [attribute existence](http://dev.w3.org/csswg/selectors4/#attribute-selectors): `[attr]`
|
||||
* [attribute value](http://dev.w3.org/csswg/selectors4/#attribute-selectors): `[attr="foo"]` or `[attr=123]`
|
||||
* attribute regex: `[attr=/foo.*/]` or (with flags) `[attr=/foo.*/is]`
|
||||
* attribute conditions: `[attr!="foo"]`, `[attr>2]`, `[attr<3]`, `[attr>=2]`, or `[attr<=3]`
|
||||
* nested attribute: `[attr.level2="foo"]`
|
||||
* field: `FunctionDeclaration > Identifier.id`
|
||||
* [First](http://dev.w3.org/csswg/selectors4/#the-first-child-pseudo) or [last](http://dev.w3.org/csswg/selectors4/#the-last-child-pseudo) child: `:first-child` or `:last-child`
|
||||
* [nth-child](http://dev.w3.org/csswg/selectors4/#the-nth-child-pseudo) (no ax+b support): `:nth-child(2)`
|
||||
* [nth-last-child](http://dev.w3.org/csswg/selectors4/#the-nth-last-child-pseudo) (no ax+b support): `:nth-last-child(1)`
|
||||
* [descendant](http://dev.w3.org/csswg/selectors4/#descendant-combinators): `ancestor descendant`
|
||||
* [child](http://dev.w3.org/csswg/selectors4/#child-combinators): `parent > child`
|
||||
* [following sibling](http://dev.w3.org/csswg/selectors4/#general-sibling-combinators): `node ~ sibling`
|
||||
* [adjacent sibling](http://dev.w3.org/csswg/selectors4/#adjacent-sibling-combinators): `node + adjacent`
|
||||
* [negation](http://dev.w3.org/csswg/selectors4/#negation-pseudo): `:not(ForStatement)`
|
||||
* [has](https://drafts.csswg.org/selectors-4/#has-pseudo): `:has(ForStatement)`, `:has(> ForStatement)`
|
||||
* [matches-any](http://dev.w3.org/csswg/selectors4/#matches): `:matches([attr] > :first-child, :last-child)`
|
||||
* [subject indicator](http://dev.w3.org/csswg/selectors4/#subject): `!IfStatement > [name="foo"]`
|
||||
* class of AST node: `:statement`, `:expression`, `:declaration`, `:function`, or `:pattern`
|
||||
|
||||
[](https://travis-ci.org/estools/esquery)
|
||||
@@ -0,0 +1 @@
|
||||
module.exports={A:{A:{"2":"K D E F A B mC"},B:{"1":"0 9 M G 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"},C:{"1":"0 1 2 3 4 5 6 7 8 9 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 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":"nC LC J PB K D E F A B C L M qC rC"},D:{"1":"0 9 WB XB YB ZB aB bB cB dB eB fB gB hB iB jB kB lB mB nB 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 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"},E:{"1":"jC 3C","2":"J PB K D E F A sC SC tC uC vC wC TC","132":"B C L M G FC GC xC yC zC UC VC HC 0C IC WC XC YC ZC aC 1C JC bC cC dC","260":"eC","516":"fC 2C KC gC hC iC"},F:{"1":"0 1 2 3 4 5 6 7 8 RB SB TB UB VB WB XB YB ZB 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 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":"F B C G N O P QB 4C 5C 6C 7C FC kC 8C GC"},G:{"1":"jC","2":"E SC 9C lC AD BD CD DD ED FD GD HD","132":"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","260":"eC","516":"fC VD KC gC hC iC"},H:{"2":"WD"},I:{"1":"I","2":"LC J XD YD ZD aD lC bD cD"},J:{"2":"D A"},K:{"1":"H","2":"A B C FC kC GC"},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","2":"J"},Q:{"1":"oD"},R:{"1":"pD"},S:{"1":"qD rD"}},B:6,C:"Opus audio format",D:true};
|
||||
@@ -0,0 +1,10 @@
|
||||
/**
|
||||
* react-router v7.5.0
|
||||
*
|
||||
* Copyright (c) Remix Software Inc.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE.md file in the root directory of this source tree.
|
||||
*
|
||||
* @license MIT
|
||||
*/
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,66 @@
|
||||
'use strict';
|
||||
|
||||
var YAMLException = require('./exception');
|
||||
|
||||
var TYPE_CONSTRUCTOR_OPTIONS = [
|
||||
'kind',
|
||||
'multi',
|
||||
'resolve',
|
||||
'construct',
|
||||
'instanceOf',
|
||||
'predicate',
|
||||
'represent',
|
||||
'representName',
|
||||
'defaultStyle',
|
||||
'styleAliases'
|
||||
];
|
||||
|
||||
var YAML_NODE_KINDS = [
|
||||
'scalar',
|
||||
'sequence',
|
||||
'mapping'
|
||||
];
|
||||
|
||||
function compileStyleAliases(map) {
|
||||
var result = {};
|
||||
|
||||
if (map !== null) {
|
||||
Object.keys(map).forEach(function (style) {
|
||||
map[style].forEach(function (alias) {
|
||||
result[String(alias)] = style;
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
function Type(tag, options) {
|
||||
options = options || {};
|
||||
|
||||
Object.keys(options).forEach(function (name) {
|
||||
if (TYPE_CONSTRUCTOR_OPTIONS.indexOf(name) === -1) {
|
||||
throw new YAMLException('Unknown option "' + name + '" is met in definition of "' + tag + '" YAML type.');
|
||||
}
|
||||
});
|
||||
|
||||
// TODO: Add tag format check.
|
||||
this.options = options; // keep original options in case user wants to extend this type later
|
||||
this.tag = tag;
|
||||
this.kind = options['kind'] || null;
|
||||
this.resolve = options['resolve'] || function () { return true; };
|
||||
this.construct = options['construct'] || function (data) { return data; };
|
||||
this.instanceOf = options['instanceOf'] || null;
|
||||
this.predicate = options['predicate'] || null;
|
||||
this.represent = options['represent'] || null;
|
||||
this.representName = options['representName'] || null;
|
||||
this.defaultStyle = options['defaultStyle'] || null;
|
||||
this.multi = options['multi'] || false;
|
||||
this.styleAliases = compileStyleAliases(options['styleAliases'] || null);
|
||||
|
||||
if (YAML_NODE_KINDS.indexOf(this.kind) === -1) {
|
||||
throw new YAMLException('Unknown kind "' + this.kind + '" is specified for "' + tag + '" YAML type.');
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = Type;
|
||||
@@ -0,0 +1 @@
|
||||
module.exports={C:{"52":0.00431,"115":0.08622,"121":0.00431,"124":0.00431,"126":0.00431,"127":0.00431,"128":0.03018,"134":0.00862,"135":0.17675,"136":0.79754,"137":0.02587,_:"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 48 49 50 51 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 78 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 109 110 111 112 113 114 116 117 118 119 120 122 123 125 129 130 131 132 133 138 139 140 3.5 3.6"},D:{"39":0.00431,"40":0.00862,"41":0.00862,"42":0.00862,"43":0.00862,"44":0.00862,"45":0.00862,"46":0.00862,"47":0.00862,"48":0.00862,"49":0.00862,"50":0.00862,"51":0.00862,"52":0.00862,"53":0.00862,"54":0.00862,"55":0.00862,"56":0.00862,"57":0.00862,"58":0.00862,"59":0.00862,"60":0.00862,"63":0.00431,"68":0.00431,"69":0.00431,"70":0.04742,"74":0.00862,"77":0.00431,"78":0.00862,"79":0.00431,"80":0.00431,"81":0.01293,"83":0.00431,"84":0.00431,"85":0.00431,"87":0.02587,"89":0.00431,"92":0.00431,"94":0.01293,"96":0.00431,"97":0.00431,"98":0.00431,"99":0.00431,"102":0.02156,"103":0.03018,"104":0.00431,"105":0.00862,"106":0.02156,"107":0.01293,"108":0.00862,"109":1.25881,"112":0.00431,"113":0.00431,"114":0.03449,"115":0.00431,"116":0.06035,"117":0.00862,"118":0.01724,"119":0.02156,"120":0.02587,"121":0.09053,"122":0.1164,"123":0.01724,"124":0.06467,"125":0.11209,"126":0.06467,"127":0.03018,"128":0.16813,"129":0.0388,"130":0.07329,"131":0.29315,"132":0.4699,"133":6.22077,"134":17.72252,"135":0.01293,"136":0.00862,_:"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 61 62 64 65 66 67 71 72 73 75 76 86 88 90 91 93 95 100 101 110 111 137 138"},F:{"36":0.00862,"45":0.01724,"87":0.00431,"88":0.00862,"95":0.01724,"114":0.00431,"115":0.00431,"116":0.35781,"117":2.18999,_:"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 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 79 80 81 82 83 84 85 86 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"},B:{"12":0.00431,"15":0.00431,"16":0.00431,"18":0.01293,"84":0.00431,"89":0.00431,"92":0.03018,"100":0.00431,"104":0.00431,"105":0.00431,"109":0.06035,"113":0.00431,"114":0.0388,"116":0.00431,"117":0.00431,"118":0.00431,"119":0.00431,"120":0.00431,"121":0.00862,"122":0.01293,"123":0.00862,"124":0.00862,"125":0.02587,"126":0.01724,"127":0.01724,"128":0.01293,"129":0.02587,"130":0.01724,"131":0.07329,"132":0.08191,"133":1.29761,"134":4.89299,_:"13 14 17 79 80 81 83 85 86 87 88 90 91 93 94 95 96 97 98 99 101 102 103 106 107 108 110 111 112 115"},E:{"14":0.00862,_:"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","12.1":0.00431,"13.1":0.00862,"14.1":0.03449,"15.1":0.17244,"15.2-15.3":0.00862,"15.4":0.00431,"15.5":0.00431,"15.6":0.0776,"16.0":0.01293,"16.1":0.00431,"16.2":0.01724,"16.3":0.06035,"16.4":0.01724,"16.5":0.02156,"16.6":0.12502,"17.0":0.03018,"17.1":0.04742,"17.2":0.01724,"17.3":0.02587,"17.4":0.05604,"17.5":0.09053,"17.6":0.18537,"18.0":0.02156,"18.1":0.13795,"18.2":0.05173,"18.3":0.85789,"18.4":0.03018},G:{"8":0,"3.2":0,"4.0-4.1":0,"4.2-4.3":0.00337,"5.0-5.1":0,"6.0-6.1":0.01012,"7.0-7.1":0.00675,"8.1-8.4":0,"9.0-9.2":0.00506,"9.3":0.02362,"10.0-10.2":0.00169,"10.3":0.03881,"11.0-11.2":0.17886,"11.3-11.4":0.01181,"12.0-12.1":0.00675,"12.2-12.5":0.16705,"13.0-13.1":0.00337,"13.2":0.00506,"13.3":0.00675,"13.4-13.7":0.02362,"14.0-14.4":0.05906,"14.5-14.8":0.07087,"15.0-15.1":0.03881,"15.2-15.3":0.03881,"15.4":0.04725,"15.5":0.054,"15.6-15.8":0.66482,"16.0":0.09449,"16.1":0.19405,"16.2":0.10124,"16.3":0.17549,"16.4":0.03881,"16.5":0.07256,"16.6-16.7":0.788,"17.0":0.04725,"17.1":0.08437,"17.2":0.06412,"17.3":0.08943,"17.4":0.17886,"17.5":0.39822,"17.6-17.7":1.15584,"18.0":0.32397,"18.1":1.05966,"18.2":0.47415,"18.3":9.90985,"18.4":0.1468},P:{"4":0.08315,"20":0.01039,"21":0.02079,"22":0.05197,"23":0.05197,"24":0.03118,"25":0.07275,"26":0.13511,"27":2.70228,"5.0-5.4":0.02079,_:"6.2-6.4 8.2 9.2 10.1 11.1-11.2 12.0 13.0 14.0 15.0 16.0 17.0 19.0","7.2-7.4":0.04157,"18.0":0.01039},I:{"0":0.02839,"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":0.13654,_:"10 11 12 11.1 11.5 12.1"},A:{"11":0.04742,_:"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.28445},Q:{"14.9":0.06827},O:{"0":0.1024},H:{"0":0},L:{"0":38.16348}};
|
||||
@@ -0,0 +1,53 @@
|
||||
export type PDFPageProxy = import("../src/display/api").PDFPageProxy;
|
||||
export type PageViewport = import("../src/display/display_utils").PageViewport;
|
||||
export type AnnotationEditorUIManager = import("../src/display/editor/tools.js").AnnotationEditorUIManager;
|
||||
export type TextAccessibilityManager = import("./text_accessibility.js").TextAccessibilityManager;
|
||||
export type IL10n = import("./interfaces").IL10n;
|
||||
export type AnnotationLayer = import("../src/display/annotation_layer.js").AnnotationLayer;
|
||||
export type StructTreeLayerBuilder = any;
|
||||
export type AnnotationEditorLayerBuilderOptions = {
|
||||
uiManager?: import("../src/pdf").AnnotationEditorUIManager | undefined;
|
||||
pdfPage: PDFPageProxy;
|
||||
l10n?: import("./interfaces").IL10n | undefined;
|
||||
structTreeLayer?: StructTreeLayerBuilder;
|
||||
accessibilityManager?: import("./text_accessibility.js").TextAccessibilityManager | undefined;
|
||||
annotationLayer?: import("../src/pdf").AnnotationLayer | undefined;
|
||||
textLayer?: any;
|
||||
drawLayer?: any;
|
||||
onAppend?: Function | undefined;
|
||||
};
|
||||
/**
|
||||
* @typedef {Object} AnnotationEditorLayerBuilderOptions
|
||||
* @property {AnnotationEditorUIManager} [uiManager]
|
||||
* @property {PDFPageProxy} pdfPage
|
||||
* @property {IL10n} [l10n]
|
||||
* @property {StructTreeLayerBuilder} [structTreeLayer]
|
||||
* @property {TextAccessibilityManager} [accessibilityManager]
|
||||
* @property {AnnotationLayer} [annotationLayer]
|
||||
* @property {TextLayer} [textLayer]
|
||||
* @property {DrawLayer} [drawLayer]
|
||||
* @property {function} [onAppend]
|
||||
*/
|
||||
export class AnnotationEditorLayerBuilder {
|
||||
/**
|
||||
* @param {AnnotationEditorLayerBuilderOptions} options
|
||||
*/
|
||||
constructor(options: AnnotationEditorLayerBuilderOptions);
|
||||
pdfPage: import("../src/display/api").PDFPageProxy;
|
||||
accessibilityManager: import("./text_accessibility.js").TextAccessibilityManager | undefined;
|
||||
l10n: import("./interfaces").IL10n | GenericL10n | undefined;
|
||||
annotationEditorLayer: AnnotationEditorLayer | null;
|
||||
div: HTMLDivElement | null;
|
||||
_cancelled: boolean;
|
||||
/**
|
||||
* @param {PageViewport} viewport
|
||||
* @param {string} intent (default value is 'display')
|
||||
*/
|
||||
render(viewport: PageViewport, intent?: string): Promise<void>;
|
||||
cancel(): void;
|
||||
hide(): void;
|
||||
show(): void;
|
||||
#private;
|
||||
}
|
||||
import { GenericL10n } from "./genericl10n";
|
||||
import { AnnotationEditorLayer } from "../src/pdf";
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"names":["_index","require","isScope","node","parent","isBlockStatement","isFunction","isCatchClause","isPattern","isScopable"],"sources":["../../src/validators/isScope.ts"],"sourcesContent":["import {\n isFunction,\n isCatchClause,\n isBlockStatement,\n isScopable,\n isPattern,\n} from \"./generated/index.ts\";\nimport type * as t from \"../index.ts\";\n\n/**\n * Check if the input `node` is a scope.\n */\nexport default function isScope(node: t.Node, parent: t.Node): boolean {\n // If a BlockStatement is an immediate descendent of a Function/CatchClause, it must be in the body.\n // Hence we skipped the parentKey === \"params\" check\n if (isBlockStatement(node) && (isFunction(parent) || isCatchClause(parent))) {\n return false;\n }\n\n // If a Pattern is an immediate descendent of a Function/CatchClause, it must be in the params.\n // Hence we skipped the parentKey === \"params\" check\n if (isPattern(node) && (isFunction(parent) || isCatchClause(parent))) {\n return true;\n }\n\n return isScopable(node);\n}\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAYe,SAASC,OAAOA,CAACC,IAAY,EAAEC,MAAc,EAAW;EAGrE,IAAI,IAAAC,uBAAgB,EAACF,IAAI,CAAC,KAAK,IAAAG,iBAAU,EAACF,MAAM,CAAC,IAAI,IAAAG,oBAAa,EAACH,MAAM,CAAC,CAAC,EAAE;IAC3E,OAAO,KAAK;EACd;EAIA,IAAI,IAAAI,gBAAS,EAACL,IAAI,CAAC,KAAK,IAAAG,iBAAU,EAACF,MAAM,CAAC,IAAI,IAAAG,oBAAa,EAACH,MAAM,CAAC,CAAC,EAAE;IACpE,OAAO,IAAI;EACb;EAEA,OAAO,IAAAK,iBAAU,EAACN,IAAI,CAAC;AACzB","ignoreList":[]}
|
||||
@@ -0,0 +1,6 @@
|
||||
|
||||
/**
|
||||
* For Node.js, simply re-export the core `util.deprecate` function.
|
||||
*/
|
||||
|
||||
module.exports = require('util').deprecate;
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1 @@
|
||||
{"version":3,"names":["_classApplyDescriptorSet","require","_assertClassBrand","_classCheckPrivateStaticFieldDescriptor","_classStaticPrivateFieldSpecSet","receiver","classConstructor","descriptor","value","assertClassBrand","classCheckPrivateStaticFieldDescriptor","classApplyDescriptorSet"],"sources":["../../src/helpers/classStaticPrivateFieldSpecSet.js"],"sourcesContent":["/* @minVersion 7.0.2 */\n/* @onlyBabel7 */\n\nimport classApplyDescriptorSet from \"classApplyDescriptorSet\";\nimport assertClassBrand from \"assertClassBrand\";\nimport classCheckPrivateStaticFieldDescriptor from \"classCheckPrivateStaticFieldDescriptor\";\nexport default function _classStaticPrivateFieldSpecSet(\n receiver,\n classConstructor,\n descriptor,\n value,\n) {\n assertClassBrand(classConstructor, receiver);\n classCheckPrivateStaticFieldDescriptor(descriptor, \"set\");\n classApplyDescriptorSet(receiver, descriptor, value);\n return value;\n}\n"],"mappings":";;;;;;AAGA,IAAAA,wBAAA,GAAAC,OAAA;AACA,IAAAC,iBAAA,GAAAD,OAAA;AACA,IAAAE,uCAAA,GAAAF,OAAA;AACe,SAASG,+BAA+BA,CACrDC,QAAQ,EACRC,gBAAgB,EAChBC,UAAU,EACVC,KAAK,EACL;EACAC,iBAAgB,CAACH,gBAAgB,EAAED,QAAQ,CAAC;EAC5CK,uCAAsC,CAACH,UAAU,EAAE,KAAK,CAAC;EACzDI,wBAAuB,CAACN,QAAQ,EAAEE,UAAU,EAAEC,KAAK,CAAC;EACpD,OAAOA,KAAK;AACd","ignoreList":[]}
|
||||
@@ -0,0 +1 @@
|
||||
module.exports={C:{"52":0.21414,"78":0.00522,"96":0.01567,"102":0.00522,"104":0.01045,"105":0.03656,"110":0.00522,"113":0.03656,"114":0.00522,"115":0.64243,"118":0.00522,"120":0.00522,"122":0.00522,"125":0.03134,"126":0.02612,"127":0.01567,"128":0.05745,"129":0.01045,"131":0.05223,"132":0.00522,"133":0.03656,"134":0.05223,"135":0.43351,"136":1.44677,"137":0.00522,"138":0.00522,_:"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 48 49 50 51 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 97 98 99 100 101 103 106 107 108 109 111 112 116 117 119 121 123 124 130 139 140 3.5 3.6"},D:{"39":0.01045,"40":0.01567,"41":0.01045,"42":0.01567,"43":0.01567,"44":0.01567,"45":0.01567,"46":0.01567,"47":0.01567,"48":0.01567,"49":0.04701,"50":0.01567,"51":0.01567,"52":0.01567,"53":0.01567,"54":0.01567,"55":0.01567,"56":0.01567,"57":0.16714,"58":0.14102,"59":0.01567,"60":0.01045,"61":0.01045,"69":0.00522,"72":0.01567,"77":0.01567,"78":0.00522,"79":0.12013,"81":0.00522,"85":0.00522,"87":0.02089,"88":0.00522,"89":0.02089,"90":0.01567,"91":0.00522,"92":0.00522,"93":0.00522,"94":0.00522,"96":0.00522,"97":0.00522,"98":0.00522,"99":0.00522,"100":0.01045,"101":0.02089,"102":0.02612,"103":0.04178,"104":0.00522,"105":0.00522,"106":0.10968,"107":0.02612,"108":0.03656,"109":3.08157,"110":0.01567,"111":0.05223,"112":0.02089,"113":0.00522,"114":0.05223,"115":0.02612,"116":0.02612,"117":0.00522,"118":0.2037,"119":0.04701,"120":0.02612,"121":0.02089,"122":0.04701,"123":0.02089,"124":0.07835,"125":0.04178,"126":0.07312,"127":0.02089,"128":0.07312,"129":0.05223,"130":0.08879,"131":0.23504,"132":0.42306,"133":6.71678,"134":13.1933,"135":0.01567,"136":0.03656,_:"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 62 63 64 65 66 67 68 70 71 73 74 75 76 80 83 84 86 95 137 138"},F:{"36":0.01567,"57":0.06268,"60":0.01045,"72":0.00522,"73":0.02612,"79":0.12013,"81":0.00522,"83":0.00522,"84":0.01567,"85":0.05745,"86":0.02612,"87":0.05745,"88":0.02089,"91":0.00522,"94":0.00522,"95":1.02371,"100":0.00522,"102":0.00522,"105":0.00522,"109":0.01045,"110":0.00522,"112":0.00522,"113":0.00522,"114":0.01567,"115":0.01045,"116":0.51185,"117":4.37687,_:"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 58 62 63 64 65 66 67 68 69 70 71 74 75 76 77 78 80 82 89 90 92 93 96 97 98 99 101 103 104 106 107 108 111 9.5-9.6 10.0-10.1 10.5 10.6 11.1 11.5 11.6","12.1":0.03134},B:{"14":0.00522,"18":0.01045,"92":0.01045,"109":0.02089,"110":0.00522,"111":0.00522,"114":0.01567,"122":0.00522,"123":0.01045,"126":0.00522,"127":0.00522,"128":0.00522,"130":0.00522,"131":0.01567,"132":0.02089,"133":0.80957,"134":2.15188,_:"12 13 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 103 104 105 106 107 108 112 113 115 116 117 118 119 120 121 124 125 129"},E:{"13":0.00522,_:"0 4 5 6 7 8 9 10 11 12 14 15 3.1 3.2 5.1 6.1 7.1 9.1 10.1 11.1 12.1 15.1 15.2-15.3","13.1":0.03656,"14.1":0.02612,"15.4":0.02612,"15.5":0.00522,"15.6":0.16714,"16.0":0.00522,"16.1":0.04178,"16.2":0.02089,"16.3":0.07312,"16.4":0.03134,"16.5":0.02089,"16.6":0.40217,"17.0":0.01567,"17.1":0.34994,"17.2":0.03656,"17.3":0.03656,"17.4":0.0679,"17.5":0.09924,"17.6":0.3186,"18.0":0.1358,"18.1":0.20892,"18.2":0.09401,"18.3":2.51226,"18.4":0.16191},G:{"8":0,"3.2":0,"4.0-4.1":0,"4.2-4.3":0.00308,"5.0-5.1":0,"6.0-6.1":0.00925,"7.0-7.1":0.00617,"8.1-8.4":0,"9.0-9.2":0.00463,"9.3":0.02159,"10.0-10.2":0.00154,"10.3":0.03547,"11.0-11.2":0.16345,"11.3-11.4":0.01079,"12.0-12.1":0.00617,"12.2-12.5":0.15266,"13.0-13.1":0.00308,"13.2":0.00463,"13.3":0.00617,"13.4-13.7":0.02159,"14.0-14.4":0.05397,"14.5-14.8":0.06476,"15.0-15.1":0.03547,"15.2-15.3":0.03547,"15.4":0.04318,"15.5":0.04934,"15.6-15.8":0.60755,"16.0":0.08635,"16.1":0.17733,"16.2":0.09252,"16.3":0.16037,"16.4":0.03547,"16.5":0.06631,"16.6-16.7":0.72012,"17.0":0.04318,"17.1":0.0771,"17.2":0.0586,"17.3":0.08173,"17.4":0.16345,"17.5":0.36392,"17.6-17.7":1.05628,"18.0":0.29607,"18.1":0.96839,"18.2":0.43331,"18.3":9.05626,"18.4":0.13416},P:{"4":0.0211,"24":0.01055,"25":0.01055,"26":0.0211,"27":1.02344,_:"20 21 22 23 5.0-5.4 8.2 10.1 11.1-11.2 12.0 13.0 15.0 16.0 17.0 19.0","6.2-6.4":0.07386,"7.2-7.4":0.01055,"9.2":0.01055,"14.0":0.0211,"18.0":0.01055},I:{"0":0.08104,"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.00009},K:{"0":0.98317,_:"10 11 12 11.1 11.5 12.1"},A:{"8":0.01638,"11":0.10375,_:"6 7 9 10 5.5"},S:{_:"2.5 3.0-3.1"},J:{_:"7 10"},N:{_:"10 11"},R:{_:"0"},M:{"0":0.11943},Q:{"14.9":0.00955},O:{"0":0.09076},H:{"0":0.02},L:{"0":28.26357}};
|
||||
@@ -0,0 +1,122 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
var _assert = require("assert");
|
||||
var _t = require("@babel/types");
|
||||
const {
|
||||
callExpression,
|
||||
cloneNode,
|
||||
expressionStatement,
|
||||
identifier,
|
||||
importDeclaration,
|
||||
importDefaultSpecifier,
|
||||
importNamespaceSpecifier,
|
||||
importSpecifier,
|
||||
memberExpression,
|
||||
stringLiteral,
|
||||
variableDeclaration,
|
||||
variableDeclarator
|
||||
} = _t;
|
||||
class ImportBuilder {
|
||||
constructor(importedSource, scope, hub) {
|
||||
this._statements = [];
|
||||
this._resultName = null;
|
||||
this._importedSource = void 0;
|
||||
this._scope = scope;
|
||||
this._hub = hub;
|
||||
this._importedSource = importedSource;
|
||||
}
|
||||
done() {
|
||||
return {
|
||||
statements: this._statements,
|
||||
resultName: this._resultName
|
||||
};
|
||||
}
|
||||
import() {
|
||||
this._statements.push(importDeclaration([], stringLiteral(this._importedSource)));
|
||||
return this;
|
||||
}
|
||||
require() {
|
||||
this._statements.push(expressionStatement(callExpression(identifier("require"), [stringLiteral(this._importedSource)])));
|
||||
return this;
|
||||
}
|
||||
namespace(name = "namespace") {
|
||||
const local = this._scope.generateUidIdentifier(name);
|
||||
const statement = this._statements[this._statements.length - 1];
|
||||
_assert(statement.type === "ImportDeclaration");
|
||||
_assert(statement.specifiers.length === 0);
|
||||
statement.specifiers = [importNamespaceSpecifier(local)];
|
||||
this._resultName = cloneNode(local);
|
||||
return this;
|
||||
}
|
||||
default(name) {
|
||||
const id = this._scope.generateUidIdentifier(name);
|
||||
const statement = this._statements[this._statements.length - 1];
|
||||
_assert(statement.type === "ImportDeclaration");
|
||||
_assert(statement.specifiers.length === 0);
|
||||
statement.specifiers = [importDefaultSpecifier(id)];
|
||||
this._resultName = cloneNode(id);
|
||||
return this;
|
||||
}
|
||||
named(name, importName) {
|
||||
if (importName === "default") return this.default(name);
|
||||
const id = this._scope.generateUidIdentifier(name);
|
||||
const statement = this._statements[this._statements.length - 1];
|
||||
_assert(statement.type === "ImportDeclaration");
|
||||
_assert(statement.specifiers.length === 0);
|
||||
statement.specifiers = [importSpecifier(id, identifier(importName))];
|
||||
this._resultName = cloneNode(id);
|
||||
return this;
|
||||
}
|
||||
var(name) {
|
||||
const id = this._scope.generateUidIdentifier(name);
|
||||
let statement = this._statements[this._statements.length - 1];
|
||||
if (statement.type !== "ExpressionStatement") {
|
||||
_assert(this._resultName);
|
||||
statement = expressionStatement(this._resultName);
|
||||
this._statements.push(statement);
|
||||
}
|
||||
this._statements[this._statements.length - 1] = variableDeclaration("var", [variableDeclarator(id, statement.expression)]);
|
||||
this._resultName = cloneNode(id);
|
||||
return this;
|
||||
}
|
||||
defaultInterop() {
|
||||
return this._interop(this._hub.addHelper("interopRequireDefault"));
|
||||
}
|
||||
wildcardInterop() {
|
||||
return this._interop(this._hub.addHelper("interopRequireWildcard"));
|
||||
}
|
||||
_interop(callee) {
|
||||
const statement = this._statements[this._statements.length - 1];
|
||||
if (statement.type === "ExpressionStatement") {
|
||||
statement.expression = callExpression(callee, [statement.expression]);
|
||||
} else if (statement.type === "VariableDeclaration") {
|
||||
_assert(statement.declarations.length === 1);
|
||||
statement.declarations[0].init = callExpression(callee, [statement.declarations[0].init]);
|
||||
} else {
|
||||
_assert.fail("Unexpected type.");
|
||||
}
|
||||
return this;
|
||||
}
|
||||
prop(name) {
|
||||
const statement = this._statements[this._statements.length - 1];
|
||||
if (statement.type === "ExpressionStatement") {
|
||||
statement.expression = memberExpression(statement.expression, identifier(name));
|
||||
} else if (statement.type === "VariableDeclaration") {
|
||||
_assert(statement.declarations.length === 1);
|
||||
statement.declarations[0].init = memberExpression(statement.declarations[0].init, identifier(name));
|
||||
} else {
|
||||
_assert.fail("Unexpected type:" + statement.type);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
read(name) {
|
||||
this._resultName = memberExpression(this._resultName, identifier(name));
|
||||
}
|
||||
}
|
||||
exports.default = ImportBuilder;
|
||||
|
||||
//# sourceMappingURL=import-builder.js.map
|
||||
@@ -0,0 +1,79 @@
|
||||
import { jsx, Fragment } from "react/jsx-runtime";
|
||||
import * as React from "react";
|
||||
import { Outlet } from "./Match.js";
|
||||
function isModuleNotFoundError(error) {
|
||||
if (typeof (error == null ? void 0 : error.message) !== "string") return false;
|
||||
return error.message.startsWith("Failed to fetch dynamically imported module") || error.message.startsWith("error loading dynamically imported module") || error.message.startsWith("Importing a module script failed");
|
||||
}
|
||||
function ClientOnly({
|
||||
children,
|
||||
fallback = null
|
||||
}) {
|
||||
return useHydrated() ? /* @__PURE__ */ jsx(Fragment, { children }) : /* @__PURE__ */ jsx(Fragment, { children: fallback });
|
||||
}
|
||||
function subscribe() {
|
||||
return () => {
|
||||
};
|
||||
}
|
||||
function useHydrated() {
|
||||
return React.useSyncExternalStore(
|
||||
subscribe,
|
||||
() => true,
|
||||
() => false
|
||||
);
|
||||
}
|
||||
function lazyRouteComponent(importer, exportName, ssr) {
|
||||
let loadPromise;
|
||||
let comp;
|
||||
let error;
|
||||
let reload;
|
||||
const load = () => {
|
||||
if (typeof document === "undefined" && (ssr == null ? void 0 : ssr()) === false) {
|
||||
comp = () => null;
|
||||
return Promise.resolve();
|
||||
}
|
||||
if (!loadPromise) {
|
||||
loadPromise = importer().then((res) => {
|
||||
loadPromise = void 0;
|
||||
comp = res[exportName ?? "default"];
|
||||
}).catch((err) => {
|
||||
error = err;
|
||||
if (isModuleNotFoundError(error)) {
|
||||
if (error instanceof Error && typeof window !== "undefined" && typeof sessionStorage !== "undefined") {
|
||||
const storageKey = `tanstack_router_reload:${error.message}`;
|
||||
if (!sessionStorage.getItem(storageKey)) {
|
||||
sessionStorage.setItem(storageKey, "1");
|
||||
reload = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
return loadPromise;
|
||||
};
|
||||
const lazyComp = function Lazy(props) {
|
||||
if (reload) {
|
||||
window.location.reload();
|
||||
throw new Promise(() => {
|
||||
});
|
||||
}
|
||||
if (error) {
|
||||
throw error;
|
||||
}
|
||||
if (!comp) {
|
||||
throw load();
|
||||
}
|
||||
if ((ssr == null ? void 0 : ssr()) === false) {
|
||||
return /* @__PURE__ */ jsx(ClientOnly, { fallback: /* @__PURE__ */ jsx(Outlet, {}), children: React.createElement(comp, props) });
|
||||
}
|
||||
return React.createElement(comp, props);
|
||||
};
|
||||
lazyComp.preload = load;
|
||||
return lazyComp;
|
||||
}
|
||||
export {
|
||||
ClientOnly,
|
||||
lazyRouteComponent,
|
||||
useHydrated
|
||||
};
|
||||
//# sourceMappingURL=lazyRouteComponent.js.map
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,652 @@
|
||||
/**
|
||||
* @fileoverview enforce a particular style for multiline comments
|
||||
* @author Teddy Katz
|
||||
* @deprecated in ESLint v9.3.0
|
||||
*/
|
||||
"use strict";
|
||||
|
||||
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: "9.3.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: "multiline-comment-style",
|
||||
url: "https://eslint.style/rules/js/multiline-comment-style",
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
type: "suggestion",
|
||||
docs: {
|
||||
description: "Enforce a particular style for multiline comments",
|
||||
recommended: false,
|
||||
url: "https://eslint.org/docs/latest/rules/multiline-comment-style",
|
||||
},
|
||||
|
||||
fixable: "whitespace",
|
||||
schema: {
|
||||
anyOf: [
|
||||
{
|
||||
type: "array",
|
||||
items: [
|
||||
{
|
||||
enum: ["starred-block", "bare-block"],
|
||||
},
|
||||
],
|
||||
additionalItems: false,
|
||||
},
|
||||
{
|
||||
type: "array",
|
||||
items: [
|
||||
{
|
||||
enum: ["separate-lines"],
|
||||
},
|
||||
{
|
||||
type: "object",
|
||||
properties: {
|
||||
checkJSDoc: {
|
||||
type: "boolean",
|
||||
},
|
||||
},
|
||||
additionalProperties: false,
|
||||
},
|
||||
],
|
||||
additionalItems: false,
|
||||
},
|
||||
],
|
||||
},
|
||||
messages: {
|
||||
expectedBlock:
|
||||
"Expected a block comment instead of consecutive line comments.",
|
||||
expectedBareBlock:
|
||||
"Expected a block comment without padding stars.",
|
||||
startNewline: "Expected a linebreak after '/*'.",
|
||||
endNewline: "Expected a linebreak before '*/'.",
|
||||
missingStar: "Expected a '*' at the start of this line.",
|
||||
alignment:
|
||||
"Expected this line to be aligned with the start of the comment.",
|
||||
expectedLines:
|
||||
"Expected multiple line comments instead of a block comment.",
|
||||
},
|
||||
},
|
||||
|
||||
create(context) {
|
||||
const sourceCode = context.sourceCode;
|
||||
const option = context.options[0] || "starred-block";
|
||||
const params = context.options[1] || {};
|
||||
const checkJSDoc = !!params.checkJSDoc;
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Helpers
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Checks if a comment line is starred.
|
||||
* @param {string} line A string representing a comment line.
|
||||
* @returns {boolean} Whether or not the comment line is starred.
|
||||
*/
|
||||
function isStarredCommentLine(line) {
|
||||
return /^\s*\*/u.test(line);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if a comment group is in starred-block form.
|
||||
* @param {Token[]} commentGroup A group of comments, containing either multiple line comments or a single block comment.
|
||||
* @returns {boolean} Whether or not the comment group is in starred block form.
|
||||
*/
|
||||
function isStarredBlockComment([firstComment]) {
|
||||
if (firstComment.type !== "Block") {
|
||||
return false;
|
||||
}
|
||||
|
||||
const lines = firstComment.value.split(astUtils.LINEBREAK_MATCHER);
|
||||
|
||||
// The first and last lines can only contain whitespace.
|
||||
return (
|
||||
lines.length > 0 &&
|
||||
lines.every((line, i) =>
|
||||
(i === 0 || i === lines.length - 1
|
||||
? /^\s*$/u
|
||||
: /^\s*\*/u
|
||||
).test(line),
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if a comment group is in JSDoc form.
|
||||
* @param {Token[]} commentGroup A group of comments, containing either multiple line comments or a single block comment.
|
||||
* @returns {boolean} Whether or not the comment group is in JSDoc form.
|
||||
*/
|
||||
function isJSDocComment([firstComment]) {
|
||||
if (firstComment.type !== "Block") {
|
||||
return false;
|
||||
}
|
||||
|
||||
const lines = firstComment.value.split(astUtils.LINEBREAK_MATCHER);
|
||||
|
||||
return (
|
||||
/^\*\s*$/u.test(lines[0]) &&
|
||||
lines.slice(1, -1).every(line => /^\s* /u.test(line)) &&
|
||||
/^\s*$/u.test(lines.at(-1))
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Processes a comment group that is currently in separate-line form, calculating the offset for each line.
|
||||
* @param {Token[]} commentGroup A group of comments containing multiple line comments.
|
||||
* @returns {string[]} An array of the processed lines.
|
||||
*/
|
||||
function processSeparateLineComments(commentGroup) {
|
||||
const allLinesHaveLeadingSpace = commentGroup
|
||||
.map(({ value }) => value)
|
||||
.filter(line => line.trim().length)
|
||||
.every(line => line.startsWith(" "));
|
||||
|
||||
return commentGroup.map(({ value }) =>
|
||||
allLinesHaveLeadingSpace ? value.replace(/^ /u, "") : value,
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Processes a comment group that is currently in starred-block form, calculating the offset for each line.
|
||||
* @param {Token} comment A single block comment token in starred-block form.
|
||||
* @returns {string[]} An array of the processed lines.
|
||||
*/
|
||||
function processStarredBlockComment(comment) {
|
||||
const lines = comment.value
|
||||
.split(astUtils.LINEBREAK_MATCHER)
|
||||
.filter(
|
||||
(line, i, linesArr) =>
|
||||
!(i === 0 || i === linesArr.length - 1),
|
||||
)
|
||||
.map(line => line.replace(/^\s*$/u, ""));
|
||||
const allLinesHaveLeadingSpace = lines
|
||||
.map(line => line.replace(/\s*\*/u, ""))
|
||||
.filter(line => line.trim().length)
|
||||
.every(line => line.startsWith(" "));
|
||||
|
||||
return lines.map(line =>
|
||||
line.replace(
|
||||
allLinesHaveLeadingSpace ? /\s*\* ?/u : /\s*\*/u,
|
||||
"",
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Processes a comment group that is currently in bare-block form, calculating the offset for each line.
|
||||
* @param {Token} comment A single block comment token in bare-block form.
|
||||
* @returns {string[]} An array of the processed lines.
|
||||
*/
|
||||
function processBareBlockComment(comment) {
|
||||
const lines = comment.value
|
||||
.split(astUtils.LINEBREAK_MATCHER)
|
||||
.map(line => line.replace(/^\s*$/u, ""));
|
||||
const leadingWhitespace = `${sourceCode.text.slice(comment.range[0] - comment.loc.start.column, comment.range[0])} `;
|
||||
let offset = "";
|
||||
|
||||
/*
|
||||
* Calculate the offset of the least indented line and use that as the basis for offsetting all the lines.
|
||||
* The first line should not be checked because it is inline with the opening block comment delimiter.
|
||||
*/
|
||||
for (const [i, line] of lines.entries()) {
|
||||
if (!line.trim().length || i === 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
const [, lineOffset] = line.match(/^(\s*\*?\s*)/u);
|
||||
|
||||
if (lineOffset.length < leadingWhitespace.length) {
|
||||
const newOffset = leadingWhitespace.slice(
|
||||
lineOffset.length - leadingWhitespace.length,
|
||||
);
|
||||
|
||||
if (newOffset.length > offset.length) {
|
||||
offset = newOffset;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return lines.map(line => {
|
||||
const match = line.match(/^(\s*\*?\s*)(.*)/u);
|
||||
const [, lineOffset, lineContents] = match;
|
||||
|
||||
if (lineOffset.length > leadingWhitespace.length) {
|
||||
return `${lineOffset.slice(leadingWhitespace.length - (offset.length + lineOffset.length))}${lineContents}`;
|
||||
}
|
||||
|
||||
if (lineOffset.length < leadingWhitespace.length) {
|
||||
return `${lineOffset.slice(leadingWhitespace.length)}${lineContents}`;
|
||||
}
|
||||
|
||||
return lineContents;
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a list of comment lines in a group, formatting leading whitespace as necessary.
|
||||
* @param {Token[]} commentGroup A group of comments containing either multiple line comments or a single block comment.
|
||||
* @returns {string[]} A list of comment lines.
|
||||
*/
|
||||
function getCommentLines(commentGroup) {
|
||||
const [firstComment] = commentGroup;
|
||||
|
||||
if (firstComment.type === "Line") {
|
||||
return processSeparateLineComments(commentGroup);
|
||||
}
|
||||
|
||||
if (isStarredBlockComment(commentGroup)) {
|
||||
return processStarredBlockComment(firstComment);
|
||||
}
|
||||
|
||||
return processBareBlockComment(firstComment);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the initial offset (whitespace) from the beginning of a line to a given comment token.
|
||||
* @param {Token} comment The token to check.
|
||||
* @returns {string} The offset from the beginning of a line to the token.
|
||||
*/
|
||||
function getInitialOffset(comment) {
|
||||
return sourceCode.text.slice(
|
||||
comment.range[0] - comment.loc.start.column,
|
||||
comment.range[0],
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts a comment into starred-block form
|
||||
* @param {Token} firstComment The first comment of the group being converted
|
||||
* @param {string[]} commentLinesList A list of lines to appear in the new starred-block comment
|
||||
* @returns {string} A representation of the comment value in starred-block form, excluding start and end markers
|
||||
*/
|
||||
function convertToStarredBlock(firstComment, commentLinesList) {
|
||||
const initialOffset = getInitialOffset(firstComment);
|
||||
|
||||
return `/*\n${commentLinesList.map(line => `${initialOffset} * ${line}`).join("\n")}\n${initialOffset} */`;
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts a comment into separate-line form
|
||||
* @param {Token} firstComment The first comment of the group being converted
|
||||
* @param {string[]} commentLinesList A list of lines to appear in the new starred-block comment
|
||||
* @returns {string} A representation of the comment value in separate-line form
|
||||
*/
|
||||
function convertToSeparateLines(firstComment, commentLinesList) {
|
||||
return commentLinesList
|
||||
.map(line => `// ${line}`)
|
||||
.join(`\n${getInitialOffset(firstComment)}`);
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts a comment into bare-block form
|
||||
* @param {Token} firstComment The first comment of the group being converted
|
||||
* @param {string[]} commentLinesList A list of lines to appear in the new starred-block comment
|
||||
* @returns {string} A representation of the comment value in bare-block form
|
||||
*/
|
||||
function convertToBlock(firstComment, commentLinesList) {
|
||||
return `/* ${commentLinesList.join(`\n${getInitialOffset(firstComment)} `)} */`;
|
||||
}
|
||||
|
||||
/**
|
||||
* Each method checks a group of comments to see if it's valid according to the given option.
|
||||
* @param {Token[]} commentGroup A list of comments that appear together. This will either contain a single
|
||||
* block comment or multiple line comments.
|
||||
* @returns {void}
|
||||
*/
|
||||
const commentGroupCheckers = {
|
||||
"starred-block"(commentGroup) {
|
||||
const [firstComment] = commentGroup;
|
||||
const commentLines = getCommentLines(commentGroup);
|
||||
|
||||
if (commentLines.some(value => value.includes("*/"))) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (commentGroup.length > 1) {
|
||||
context.report({
|
||||
loc: {
|
||||
start: firstComment.loc.start,
|
||||
end: commentGroup.at(-1).loc.end,
|
||||
},
|
||||
messageId: "expectedBlock",
|
||||
fix(fixer) {
|
||||
const range = [
|
||||
firstComment.range[0],
|
||||
commentGroup.at(-1).range[1],
|
||||
];
|
||||
|
||||
return commentLines.some(value =>
|
||||
value.startsWith("/"),
|
||||
)
|
||||
? null
|
||||
: fixer.replaceTextRange(
|
||||
range,
|
||||
convertToStarredBlock(
|
||||
firstComment,
|
||||
commentLines,
|
||||
),
|
||||
);
|
||||
},
|
||||
});
|
||||
} else {
|
||||
const lines = firstComment.value.split(
|
||||
astUtils.LINEBREAK_MATCHER,
|
||||
);
|
||||
const expectedLeadingWhitespace =
|
||||
getInitialOffset(firstComment);
|
||||
const expectedLinePrefix = `${expectedLeadingWhitespace} *`;
|
||||
|
||||
if (!/^\*?\s*$/u.test(lines[0])) {
|
||||
const start = firstComment.value.startsWith("*")
|
||||
? firstComment.range[0] + 1
|
||||
: firstComment.range[0];
|
||||
|
||||
context.report({
|
||||
loc: {
|
||||
start: firstComment.loc.start,
|
||||
end: {
|
||||
line: firstComment.loc.start.line,
|
||||
column: firstComment.loc.start.column + 2,
|
||||
},
|
||||
},
|
||||
messageId: "startNewline",
|
||||
fix: fixer =>
|
||||
fixer.insertTextAfterRange(
|
||||
[start, start + 2],
|
||||
`\n${expectedLinePrefix}`,
|
||||
),
|
||||
});
|
||||
}
|
||||
|
||||
if (!/^\s*$/u.test(lines.at(-1))) {
|
||||
context.report({
|
||||
loc: {
|
||||
start: {
|
||||
line: firstComment.loc.end.line,
|
||||
column: firstComment.loc.end.column - 2,
|
||||
},
|
||||
end: firstComment.loc.end,
|
||||
},
|
||||
messageId: "endNewline",
|
||||
fix: fixer =>
|
||||
fixer.replaceTextRange(
|
||||
[
|
||||
firstComment.range[1] - 2,
|
||||
firstComment.range[1],
|
||||
],
|
||||
`\n${expectedLinePrefix}/`,
|
||||
),
|
||||
});
|
||||
}
|
||||
|
||||
for (
|
||||
let lineNumber = firstComment.loc.start.line + 1;
|
||||
lineNumber <= firstComment.loc.end.line;
|
||||
lineNumber++
|
||||
) {
|
||||
const lineText = sourceCode.lines[lineNumber - 1];
|
||||
const errorType = isStarredCommentLine(lineText)
|
||||
? "alignment"
|
||||
: "missingStar";
|
||||
|
||||
if (!lineText.startsWith(expectedLinePrefix)) {
|
||||
context.report({
|
||||
loc: {
|
||||
start: { line: lineNumber, column: 0 },
|
||||
end: {
|
||||
line: lineNumber,
|
||||
column: lineText.length,
|
||||
},
|
||||
},
|
||||
messageId: errorType,
|
||||
fix(fixer) {
|
||||
const lineStartIndex =
|
||||
sourceCode.getIndexFromLoc({
|
||||
line: lineNumber,
|
||||
column: 0,
|
||||
});
|
||||
|
||||
if (errorType === "alignment") {
|
||||
const [, commentTextPrefix = ""] =
|
||||
lineText.match(/^(\s*\*)/u) || [];
|
||||
const commentTextStartIndex =
|
||||
lineStartIndex +
|
||||
commentTextPrefix.length;
|
||||
|
||||
return fixer.replaceTextRange(
|
||||
[
|
||||
lineStartIndex,
|
||||
commentTextStartIndex,
|
||||
],
|
||||
expectedLinePrefix,
|
||||
);
|
||||
}
|
||||
|
||||
const [, commentTextPrefix = ""] =
|
||||
lineText.match(/^(\s*)/u) || [];
|
||||
const commentTextStartIndex =
|
||||
lineStartIndex +
|
||||
commentTextPrefix.length;
|
||||
let offset;
|
||||
|
||||
for (const [idx, line] of lines.entries()) {
|
||||
if (!/\S+/u.test(line)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
const lineTextToAlignWith =
|
||||
sourceCode.lines[
|
||||
firstComment.loc.start.line -
|
||||
1 +
|
||||
idx
|
||||
];
|
||||
const [
|
||||
,
|
||||
prefix = "",
|
||||
initialOffset = "",
|
||||
] =
|
||||
lineTextToAlignWith.match(
|
||||
/^(\s*(?:\/?\*)?(\s*))/u,
|
||||
) || [];
|
||||
|
||||
offset = `${commentTextPrefix.slice(prefix.length)}${initialOffset}`;
|
||||
|
||||
if (
|
||||
/^\s*\//u.test(lineText) &&
|
||||
offset.length === 0
|
||||
) {
|
||||
offset += " ";
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
return fixer.replaceTextRange(
|
||||
[lineStartIndex, commentTextStartIndex],
|
||||
`${expectedLinePrefix}${offset}`,
|
||||
);
|
||||
},
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"separate-lines"(commentGroup) {
|
||||
const [firstComment] = commentGroup;
|
||||
|
||||
const isJSDoc = isJSDocComment(commentGroup);
|
||||
|
||||
if (firstComment.type !== "Block" || (!checkJSDoc && isJSDoc)) {
|
||||
return;
|
||||
}
|
||||
|
||||
let commentLines = getCommentLines(commentGroup);
|
||||
|
||||
if (isJSDoc) {
|
||||
commentLines = commentLines.slice(
|
||||
1,
|
||||
commentLines.length - 1,
|
||||
);
|
||||
}
|
||||
|
||||
const tokenAfter = sourceCode.getTokenAfter(firstComment, {
|
||||
includeComments: true,
|
||||
});
|
||||
|
||||
if (
|
||||
tokenAfter &&
|
||||
firstComment.loc.end.line === tokenAfter.loc.start.line
|
||||
) {
|
||||
return;
|
||||
}
|
||||
|
||||
context.report({
|
||||
loc: {
|
||||
start: firstComment.loc.start,
|
||||
end: {
|
||||
line: firstComment.loc.start.line,
|
||||
column: firstComment.loc.start.column + 2,
|
||||
},
|
||||
},
|
||||
messageId: "expectedLines",
|
||||
fix(fixer) {
|
||||
return fixer.replaceText(
|
||||
firstComment,
|
||||
convertToSeparateLines(firstComment, commentLines),
|
||||
);
|
||||
},
|
||||
});
|
||||
},
|
||||
"bare-block"(commentGroup) {
|
||||
if (isJSDocComment(commentGroup)) {
|
||||
return;
|
||||
}
|
||||
|
||||
const [firstComment] = commentGroup;
|
||||
const commentLines = getCommentLines(commentGroup);
|
||||
|
||||
// Disallows consecutive line comments in favor of using a block comment.
|
||||
if (
|
||||
firstComment.type === "Line" &&
|
||||
commentLines.length > 1 &&
|
||||
!commentLines.some(value => value.includes("*/"))
|
||||
) {
|
||||
context.report({
|
||||
loc: {
|
||||
start: firstComment.loc.start,
|
||||
end: commentGroup.at(-1).loc.end,
|
||||
},
|
||||
messageId: "expectedBlock",
|
||||
fix(fixer) {
|
||||
return fixer.replaceTextRange(
|
||||
[
|
||||
firstComment.range[0],
|
||||
commentGroup.at(-1).range[1],
|
||||
],
|
||||
convertToBlock(firstComment, commentLines),
|
||||
);
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
// Prohibits block comments from having a * at the beginning of each line.
|
||||
if (isStarredBlockComment(commentGroup)) {
|
||||
context.report({
|
||||
loc: {
|
||||
start: firstComment.loc.start,
|
||||
end: {
|
||||
line: firstComment.loc.start.line,
|
||||
column: firstComment.loc.start.column + 2,
|
||||
},
|
||||
},
|
||||
messageId: "expectedBareBlock",
|
||||
fix(fixer) {
|
||||
return fixer.replaceText(
|
||||
firstComment,
|
||||
convertToBlock(firstComment, commentLines),
|
||||
);
|
||||
},
|
||||
});
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Public
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
return {
|
||||
Program() {
|
||||
return sourceCode
|
||||
.getAllComments()
|
||||
.filter(comment => comment.type !== "Shebang")
|
||||
.filter(
|
||||
comment =>
|
||||
!astUtils.COMMENTS_IGNORE_PATTERN.test(
|
||||
comment.value,
|
||||
),
|
||||
)
|
||||
.filter(comment => {
|
||||
const tokenBefore = sourceCode.getTokenBefore(comment, {
|
||||
includeComments: true,
|
||||
});
|
||||
|
||||
return (
|
||||
!tokenBefore ||
|
||||
tokenBefore.loc.end.line < comment.loc.start.line
|
||||
);
|
||||
})
|
||||
.reduce((commentGroups, comment, index, commentList) => {
|
||||
const tokenBefore = sourceCode.getTokenBefore(comment, {
|
||||
includeComments: true,
|
||||
});
|
||||
|
||||
if (
|
||||
comment.type === "Line" &&
|
||||
index &&
|
||||
commentList[index - 1].type === "Line" &&
|
||||
tokenBefore &&
|
||||
tokenBefore.loc.end.line ===
|
||||
comment.loc.start.line - 1 &&
|
||||
tokenBefore === commentList[index - 1]
|
||||
) {
|
||||
commentGroups.at(-1).push(comment);
|
||||
} else {
|
||||
commentGroups.push([comment]);
|
||||
}
|
||||
|
||||
return commentGroups;
|
||||
}, [])
|
||||
.filter(
|
||||
commentGroup =>
|
||||
!(
|
||||
commentGroup.length === 1 &&
|
||||
commentGroup[0].loc.start.line ===
|
||||
commentGroup[0].loc.end.line
|
||||
),
|
||||
)
|
||||
.forEach(commentGroupCheckers[option]);
|
||||
},
|
||||
};
|
||||
},
|
||||
};
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"names":["_newArrowCheck","innerThis","boundThis","TypeError"],"sources":["../../src/helpers/newArrowCheck.js"],"sourcesContent":["/* @minVersion 7.0.0-beta.0 */\n\nexport default function _newArrowCheck(innerThis, boundThis) {\n if (innerThis !== boundThis) {\n throw new TypeError(\"Cannot instantiate an arrow function\");\n }\n}\n"],"mappings":";;;;;;AAEe,SAASA,cAAcA,CAACC,SAAS,EAAEC,SAAS,EAAE;EAC3D,IAAID,SAAS,KAAKC,SAAS,EAAE;IAC3B,MAAM,IAAIC,SAAS,CAAC,sCAAsC,CAAC;EAC7D;AACF","ignoreList":[]}
|
||||
@@ -0,0 +1 @@
|
||||
module.exports={A:{A:{"1":"A B","2":"K D E F mC"},B:{"1":"C L M G N O P","322":"0 9 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"},C:{"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 qC rC","194":"0 9 WB XB YB ZB aB bB cB dB eB fB gB hB iB jB kB lB mB nB 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"},D:{"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 hB","322":"0 9 iB jB kB lB mB nB 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 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"},E:{"1":"D E F A B C L M G uC vC wC TC FC GC 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 sC SC tC"},F:{"2":"1 2 3 4 5 6 7 8 F B C G N O P QB RB SB TB UB 4C 5C 6C 7C FC kC 8C GC","322":"0 VB WB XB YB ZB 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 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"},G:{"1":"E CD DD ED FD GD HD 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":"SC 9C lC AD BD"},H:{"2":"WD"},I:{"2":"LC J I XD YD ZD aD lC bD cD"},J:{"2":"D A"},K:{"2":"A B C FC kC GC","322":"H"},L:{"322":"I"},M:{"2":"EC"},N:{"1":"A B"},O:{"322":"HC"},P:{"2":"1 2 3 4 5 6 7 8 J dD eD fD gD hD TC iD jD kD lD mD IC JC KC nD"},Q:{"322":"oD"},R:{"322":"pD"},S:{"194":"qD rD"}},B:1,C:"Audio Tracks",D:true};
|
||||
@@ -0,0 +1,69 @@
|
||||
{
|
||||
"name": "@jridgewell/resolve-uri",
|
||||
"version": "3.1.2",
|
||||
"description": "Resolve a URI relative to an optional base URI",
|
||||
"keywords": [
|
||||
"resolve",
|
||||
"uri",
|
||||
"url",
|
||||
"path"
|
||||
],
|
||||
"author": "Justin Ridgewell <justin@ridgewell.name>",
|
||||
"license": "MIT",
|
||||
"repository": "https://github.com/jridgewell/resolve-uri",
|
||||
"main": "dist/resolve-uri.umd.js",
|
||||
"module": "dist/resolve-uri.mjs",
|
||||
"types": "dist/types/resolve-uri.d.ts",
|
||||
"exports": {
|
||||
".": [
|
||||
{
|
||||
"types": "./dist/types/resolve-uri.d.ts",
|
||||
"browser": "./dist/resolve-uri.umd.js",
|
||||
"require": "./dist/resolve-uri.umd.js",
|
||||
"import": "./dist/resolve-uri.mjs"
|
||||
},
|
||||
"./dist/resolve-uri.umd.js"
|
||||
],
|
||||
"./package.json": "./package.json"
|
||||
},
|
||||
"files": [
|
||||
"dist"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=6.0.0"
|
||||
},
|
||||
"scripts": {
|
||||
"prebuild": "rm -rf dist",
|
||||
"build": "run-s -n build:*",
|
||||
"build:rollup": "rollup -c rollup.config.js",
|
||||
"build:ts": "tsc --project tsconfig.build.json",
|
||||
"lint": "run-s -n lint:*",
|
||||
"lint:prettier": "npm run test:lint:prettier -- --write",
|
||||
"lint:ts": "npm run test:lint:ts -- --fix",
|
||||
"pretest": "run-s build:rollup",
|
||||
"test": "run-s -n test:lint test:only",
|
||||
"test:debug": "mocha --inspect-brk",
|
||||
"test:lint": "run-s -n test:lint:*",
|
||||
"test:lint:prettier": "prettier --check '{src,test}/**/*.ts'",
|
||||
"test:lint:ts": "eslint '{src,test}/**/*.ts'",
|
||||
"test:only": "mocha",
|
||||
"test:coverage": "c8 mocha",
|
||||
"test:watch": "mocha --watch",
|
||||
"prepublishOnly": "npm run preversion",
|
||||
"preversion": "run-s test build"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@jridgewell/resolve-uri-latest": "npm:@jridgewell/resolve-uri@*",
|
||||
"@rollup/plugin-typescript": "8.3.0",
|
||||
"@typescript-eslint/eslint-plugin": "5.10.0",
|
||||
"@typescript-eslint/parser": "5.10.0",
|
||||
"c8": "7.11.0",
|
||||
"eslint": "8.7.0",
|
||||
"eslint-config-prettier": "8.3.0",
|
||||
"mocha": "9.2.0",
|
||||
"npm-run-all": "4.1.5",
|
||||
"prettier": "2.5.1",
|
||||
"rollup": "2.66.0",
|
||||
"typescript": "4.5.5"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,98 @@
|
||||
{{# def.definitions }}
|
||||
{{# def.errors }}
|
||||
{{# def.setupKeyword }}
|
||||
{{# def.setupNextLevel }}
|
||||
|
||||
|
||||
{{## def.validateItems:startFrom:
|
||||
for (var {{=$idx}} = {{=startFrom}}; {{=$idx}} < {{=$data}}.length; {{=$idx}}++) {
|
||||
{{
|
||||
$it.errorPath = it.util.getPathExpr(it.errorPath, $idx, it.opts.jsonPointers, true);
|
||||
var $passData = $data + '[' + $idx + ']';
|
||||
$it.dataPathArr[$dataNxt] = $idx;
|
||||
}}
|
||||
|
||||
{{# def.generateSubschemaCode }}
|
||||
{{# def.optimizeValidate }}
|
||||
|
||||
{{? $breakOnError }}
|
||||
if (!{{=$nextValid}}) break;
|
||||
{{?}}
|
||||
}
|
||||
#}}
|
||||
|
||||
{{
|
||||
var $idx = 'i' + $lvl
|
||||
, $dataNxt = $it.dataLevel = it.dataLevel + 1
|
||||
, $nextData = 'data' + $dataNxt
|
||||
, $currentBaseId = it.baseId;
|
||||
}}
|
||||
|
||||
var {{=$errs}} = errors;
|
||||
var {{=$valid}};
|
||||
|
||||
{{? Array.isArray($schema) }}
|
||||
{{ /* 'items' is an array of schemas */}}
|
||||
{{ var $additionalItems = it.schema.additionalItems; }}
|
||||
{{? $additionalItems === false }}
|
||||
{{=$valid}} = {{=$data}}.length <= {{= $schema.length }};
|
||||
{{
|
||||
var $currErrSchemaPath = $errSchemaPath;
|
||||
$errSchemaPath = it.errSchemaPath + '/additionalItems';
|
||||
}}
|
||||
{{# def.checkError:'additionalItems' }}
|
||||
{{ $errSchemaPath = $currErrSchemaPath; }}
|
||||
{{# def.elseIfValid}}
|
||||
{{?}}
|
||||
|
||||
{{~ $schema:$sch:$i }}
|
||||
{{? {{# def.nonEmptySchema:$sch }} }}
|
||||
{{=$nextValid}} = true;
|
||||
|
||||
if ({{=$data}}.length > {{=$i}}) {
|
||||
{{
|
||||
var $passData = $data + '[' + $i + ']';
|
||||
$it.schema = $sch;
|
||||
$it.schemaPath = $schemaPath + '[' + $i + ']';
|
||||
$it.errSchemaPath = $errSchemaPath + '/' + $i;
|
||||
$it.errorPath = it.util.getPathExpr(it.errorPath, $i, it.opts.jsonPointers, true);
|
||||
$it.dataPathArr[$dataNxt] = $i;
|
||||
}}
|
||||
|
||||
{{# def.generateSubschemaCode }}
|
||||
{{# def.optimizeValidate }}
|
||||
}
|
||||
|
||||
{{# def.ifResultValid }}
|
||||
{{?}}
|
||||
{{~}}
|
||||
|
||||
{{? typeof $additionalItems == 'object' && {{# def.nonEmptySchema:$additionalItems }} }}
|
||||
{{
|
||||
$it.schema = $additionalItems;
|
||||
$it.schemaPath = it.schemaPath + '.additionalItems';
|
||||
$it.errSchemaPath = it.errSchemaPath + '/additionalItems';
|
||||
}}
|
||||
{{=$nextValid}} = true;
|
||||
|
||||
if ({{=$data}}.length > {{= $schema.length }}) {
|
||||
{{# def.validateItems: $schema.length }}
|
||||
}
|
||||
|
||||
{{# def.ifResultValid }}
|
||||
{{?}}
|
||||
|
||||
{{?? {{# def.nonEmptySchema:$schema }} }}
|
||||
{{ /* 'items' is a single schema */}}
|
||||
{{
|
||||
$it.schema = $schema;
|
||||
$it.schemaPath = $schemaPath;
|
||||
$it.errSchemaPath = $errSchemaPath;
|
||||
}}
|
||||
{{# def.validateItems: 0 }}
|
||||
{{?}}
|
||||
|
||||
{{? $breakOnError }}
|
||||
{{= $closingBraces }}
|
||||
if ({{=$errs}} == errors) {
|
||||
{{?}}
|
||||
@@ -0,0 +1 @@
|
||||
module.exports={A:{A:{"1":"F A B","2":"K D E mC"},B:{"1":"0 9 C L M G 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"},C:{"1":"0 1 2 3 4 5 6 7 8 9 RB SB TB UB VB WB XB YB ZB aB bB cB dB eB fB gB hB iB jB kB lB mB nB 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":"nC LC","260":"J PB K D E F A B C L M G N O P QB qC rC"},D:{"1":"0 1 2 3 4 5 6 7 8 9 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 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 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"},E:{"1":"J PB K D E F A sC SC tC uC vC wC TC","513":"B C L M G FC GC 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"},F:{"1":"0 1 2 3 4 5 6 7 8 B C 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 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 6C 7C FC kC 8C GC","2":"F 4C 5C"},G:{"1025":"E SC 9C lC AD BD CD DD ED FD GD HD","1537":"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"},H:{"2":"WD"},I:{"1":"LC J I ZD aD lC bD cD","132":"XD YD"},J:{"1":"D A"},K:{"1":"B C H FC kC GC","2":"A"},L:{"1":"I"},M:{"1":"EC"},N:{"1":"A B"},O:{"1":"HC"},P:{"1":"1 2 3 4 5 6 7 8 J dD eD fD gD hD TC iD jD kD lD mD IC JC KC nD"},Q:{"1":"oD"},R:{"1":"pD"},S:{"1":"qD rD"}},B:1,C:"Video element",D:true};
|
||||
@@ -0,0 +1,77 @@
|
||||
/**
|
||||
* @fileoverview Rule to flag use of function declaration identifiers as variables.
|
||||
* @author Ian Christian Myers
|
||||
*/
|
||||
|
||||
"use strict";
|
||||
|
||||
const astUtils = require("./utils/ast-utils");
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Rule Definition
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
/** @type {import('../shared/types').Rule} */
|
||||
module.exports = {
|
||||
meta: {
|
||||
type: "problem",
|
||||
|
||||
docs: {
|
||||
description: "Disallow reassigning `function` declarations",
|
||||
recommended: true,
|
||||
url: "https://eslint.org/docs/latest/rules/no-func-assign",
|
||||
},
|
||||
|
||||
schema: [],
|
||||
|
||||
messages: {
|
||||
isAFunction: "'{{name}}' is a function.",
|
||||
},
|
||||
},
|
||||
|
||||
create(context) {
|
||||
const sourceCode = context.sourceCode;
|
||||
|
||||
/**
|
||||
* Reports a reference if is non initializer and writable.
|
||||
* @param {References} references Collection of reference to check.
|
||||
* @returns {void}
|
||||
*/
|
||||
function checkReference(references) {
|
||||
astUtils.getModifyingReferences(references).forEach(reference => {
|
||||
context.report({
|
||||
node: reference.identifier,
|
||||
messageId: "isAFunction",
|
||||
data: {
|
||||
name: reference.identifier.name,
|
||||
},
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Finds and reports references that are non initializer and writable.
|
||||
* @param {Variable} variable A variable to check.
|
||||
* @returns {void}
|
||||
*/
|
||||
function checkVariable(variable) {
|
||||
if (variable.defs[0].type === "FunctionName") {
|
||||
checkReference(variable.references);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks parameters of a given function node.
|
||||
* @param {ASTNode} node A function node to check.
|
||||
* @returns {void}
|
||||
*/
|
||||
function checkForFunction(node) {
|
||||
sourceCode.getDeclaredVariables(node).forEach(checkVariable);
|
||||
}
|
||||
|
||||
return {
|
||||
FunctionDeclaration: checkForFunction,
|
||||
FunctionExpression: checkForFunction,
|
||||
};
|
||||
},
|
||||
};
|
||||
@@ -0,0 +1,343 @@
|
||||
'use strict';
|
||||
|
||||
const vite = require('vite');
|
||||
const fs = require('node:fs');
|
||||
const path = require('node:path');
|
||||
const node_module = require('node:module');
|
||||
|
||||
var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
|
||||
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e.default : e; }
|
||||
|
||||
const fs__default = /*#__PURE__*/_interopDefaultCompat(fs);
|
||||
const path__default = /*#__PURE__*/_interopDefaultCompat(path);
|
||||
|
||||
const runtimePublicPath = "/@react-refresh";
|
||||
const _require = node_module.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.src || new URL('index.cjs', document.baseURI).href)));
|
||||
const reactRefreshDir = path__default.dirname(
|
||||
_require.resolve("react-refresh/package.json")
|
||||
);
|
||||
const runtimeFilePath = path__default.join(
|
||||
reactRefreshDir,
|
||||
"cjs/react-refresh-runtime.development.js"
|
||||
);
|
||||
const runtimeCode = `
|
||||
const exports = {}
|
||||
${fs__default.readFileSync(runtimeFilePath, "utf-8")}
|
||||
${fs__default.readFileSync(_require.resolve("./refreshUtils.js"), "utf-8")}
|
||||
export default exports
|
||||
`;
|
||||
const preambleCode = `
|
||||
import RefreshRuntime from "__BASE__${runtimePublicPath.slice(1)}"
|
||||
RefreshRuntime.injectIntoGlobalHook(window)
|
||||
window.$RefreshReg$ = () => {}
|
||||
window.$RefreshSig$ = () => (type) => type
|
||||
window.__vite_plugin_react_preamble_installed__ = true
|
||||
`;
|
||||
const sharedHeader = `
|
||||
import RefreshRuntime from "${runtimePublicPath}";
|
||||
|
||||
const inWebWorker = typeof WorkerGlobalScope !== 'undefined' && self instanceof WorkerGlobalScope;
|
||||
`.replace(/\n+/g, "");
|
||||
const functionHeader = `
|
||||
let prevRefreshReg;
|
||||
let prevRefreshSig;
|
||||
|
||||
if (import.meta.hot && !inWebWorker) {
|
||||
if (!window.__vite_plugin_react_preamble_installed__) {
|
||||
throw new Error(
|
||||
"@vitejs/plugin-react can't detect preamble. Something is wrong. " +
|
||||
"See https://github.com/vitejs/vite-plugin-react/pull/11#discussion_r430879201"
|
||||
);
|
||||
}
|
||||
|
||||
prevRefreshReg = window.$RefreshReg$;
|
||||
prevRefreshSig = window.$RefreshSig$;
|
||||
window.$RefreshReg$ = (type, id) => {
|
||||
RefreshRuntime.register(type, __SOURCE__ + " " + id)
|
||||
};
|
||||
window.$RefreshSig$ = RefreshRuntime.createSignatureFunctionForTransform;
|
||||
}`.replace(/\n+/g, "");
|
||||
const functionFooter = `
|
||||
if (import.meta.hot && !inWebWorker) {
|
||||
window.$RefreshReg$ = prevRefreshReg;
|
||||
window.$RefreshSig$ = prevRefreshSig;
|
||||
}`;
|
||||
const sharedFooter = (id) => `
|
||||
if (import.meta.hot && !inWebWorker) {
|
||||
RefreshRuntime.__hmr_import(import.meta.url).then((currentExports) => {
|
||||
RefreshRuntime.registerExportsForReactRefresh(${JSON.stringify(
|
||||
id
|
||||
)}, currentExports);
|
||||
import.meta.hot.accept((nextExports) => {
|
||||
if (!nextExports) return;
|
||||
const invalidateMessage = RefreshRuntime.validateRefreshBoundaryAndEnqueueUpdate(${JSON.stringify(
|
||||
id
|
||||
)}, currentExports, nextExports);
|
||||
if (invalidateMessage) import.meta.hot.invalidate(invalidateMessage);
|
||||
});
|
||||
});
|
||||
}`;
|
||||
function addRefreshWrapper(code, id) {
|
||||
return sharedHeader + functionHeader.replace("__SOURCE__", JSON.stringify(id)) + code + functionFooter + sharedFooter(id);
|
||||
}
|
||||
function addClassComponentRefreshWrapper(code, id) {
|
||||
return sharedHeader + code + sharedFooter(id);
|
||||
}
|
||||
|
||||
let babel;
|
||||
async function loadBabel() {
|
||||
if (!babel) {
|
||||
babel = await import('@babel/core');
|
||||
}
|
||||
return babel;
|
||||
}
|
||||
const reactCompRE = /extends\s+(?:React\.)?(?:Pure)?Component/;
|
||||
const refreshContentRE = /\$Refresh(?:Reg|Sig)\$\(/;
|
||||
const defaultIncludeRE = /\.[tj]sx?$/;
|
||||
const tsRE = /\.tsx?$/;
|
||||
function viteReact(opts = {}) {
|
||||
let devBase = "/";
|
||||
const filter = vite.createFilter(opts.include ?? defaultIncludeRE, opts.exclude);
|
||||
const jsxImportSource = opts.jsxImportSource ?? "react";
|
||||
const jsxImportRuntime = `${jsxImportSource}/jsx-runtime`;
|
||||
const jsxImportDevRuntime = `${jsxImportSource}/jsx-dev-runtime`;
|
||||
let isProduction = true;
|
||||
let projectRoot = process.cwd();
|
||||
let skipFastRefresh = false;
|
||||
let runPluginOverrides;
|
||||
let staticBabelOptions;
|
||||
const importReactRE = /\bimport\s+(?:\*\s+as\s+)?React\b/;
|
||||
const viteBabel = {
|
||||
name: "vite:react-babel",
|
||||
enforce: "pre",
|
||||
config() {
|
||||
if (opts.jsxRuntime === "classic") {
|
||||
return {
|
||||
esbuild: {
|
||||
jsx: "transform"
|
||||
}
|
||||
};
|
||||
} else {
|
||||
return {
|
||||
esbuild: {
|
||||
jsx: "automatic",
|
||||
jsxImportSource: opts.jsxImportSource
|
||||
},
|
||||
optimizeDeps: { esbuildOptions: { jsx: "automatic" } }
|
||||
};
|
||||
}
|
||||
},
|
||||
configResolved(config) {
|
||||
devBase = config.base;
|
||||
projectRoot = config.root;
|
||||
isProduction = config.isProduction;
|
||||
skipFastRefresh = isProduction || config.command === "build" || config.server.hmr === false;
|
||||
if ("jsxPure" in opts) {
|
||||
config.logger.warnOnce(
|
||||
"[@vitejs/plugin-react] jsxPure was removed. You can configure esbuild.jsxSideEffects directly."
|
||||
);
|
||||
}
|
||||
const hooks = config.plugins.map((plugin) => plugin.api?.reactBabel).filter(defined);
|
||||
if (hooks.length > 0) {
|
||||
runPluginOverrides = (babelOptions, context) => {
|
||||
hooks.forEach((hook) => hook(babelOptions, context, config));
|
||||
};
|
||||
} else if (typeof opts.babel !== "function") {
|
||||
staticBabelOptions = createBabelOptions(opts.babel);
|
||||
}
|
||||
},
|
||||
async transform(code, id, options) {
|
||||
if (id.includes("/node_modules/"))
|
||||
return;
|
||||
const [filepath] = id.split("?");
|
||||
if (!filter(filepath))
|
||||
return;
|
||||
const ssr = options?.ssr === true;
|
||||
const babelOptions = (() => {
|
||||
if (staticBabelOptions)
|
||||
return staticBabelOptions;
|
||||
const newBabelOptions = createBabelOptions(
|
||||
typeof opts.babel === "function" ? opts.babel(id, { ssr }) : opts.babel
|
||||
);
|
||||
runPluginOverrides?.(newBabelOptions, { id, ssr });
|
||||
return newBabelOptions;
|
||||
})();
|
||||
const plugins = [...babelOptions.plugins];
|
||||
const isJSX = filepath.endsWith("x");
|
||||
const useFastRefresh = !skipFastRefresh && !ssr && (isJSX || (opts.jsxRuntime === "classic" ? importReactRE.test(code) : code.includes(jsxImportDevRuntime) || code.includes(jsxImportRuntime)));
|
||||
if (useFastRefresh) {
|
||||
plugins.push([
|
||||
await loadPlugin("react-refresh/babel"),
|
||||
{ skipEnvCheck: true }
|
||||
]);
|
||||
}
|
||||
if (opts.jsxRuntime === "classic" && isJSX) {
|
||||
if (!isProduction) {
|
||||
plugins.push(
|
||||
await loadPlugin("@babel/plugin-transform-react-jsx-self"),
|
||||
await loadPlugin("@babel/plugin-transform-react-jsx-source")
|
||||
);
|
||||
}
|
||||
}
|
||||
if (!plugins.length && !babelOptions.presets.length && !babelOptions.configFile && !babelOptions.babelrc) {
|
||||
return;
|
||||
}
|
||||
const parserPlugins = [...babelOptions.parserOpts.plugins];
|
||||
if (!filepath.endsWith(".ts")) {
|
||||
parserPlugins.push("jsx");
|
||||
}
|
||||
if (tsRE.test(filepath)) {
|
||||
parserPlugins.push("typescript");
|
||||
}
|
||||
const babel2 = await loadBabel();
|
||||
const result = await babel2.transformAsync(code, {
|
||||
...babelOptions,
|
||||
root: projectRoot,
|
||||
filename: id,
|
||||
sourceFileName: filepath,
|
||||
// Required for esbuild.jsxDev to provide correct line numbers
|
||||
// This crates issues the react compiler because the re-order is too important
|
||||
// People should use @babel/plugin-transform-react-jsx-development to get back good line numbers
|
||||
retainLines: getReactCompilerPlugin(plugins) != null ? false : !isProduction && isJSX && opts.jsxRuntime !== "classic",
|
||||
parserOpts: {
|
||||
...babelOptions.parserOpts,
|
||||
sourceType: "module",
|
||||
allowAwaitOutsideFunction: true,
|
||||
plugins: parserPlugins
|
||||
},
|
||||
generatorOpts: {
|
||||
...babelOptions.generatorOpts,
|
||||
// import attributes parsing available without plugin since 7.26
|
||||
importAttributesKeyword: "with",
|
||||
decoratorsBeforeExport: true
|
||||
},
|
||||
plugins,
|
||||
sourceMaps: true
|
||||
});
|
||||
if (result) {
|
||||
let code2 = result.code;
|
||||
if (useFastRefresh) {
|
||||
if (refreshContentRE.test(code2)) {
|
||||
code2 = addRefreshWrapper(code2, id);
|
||||
} else if (reactCompRE.test(code2)) {
|
||||
code2 = addClassComponentRefreshWrapper(code2, id);
|
||||
}
|
||||
}
|
||||
return { code: code2, map: result.map };
|
||||
}
|
||||
}
|
||||
};
|
||||
const dependencies = [
|
||||
"react",
|
||||
"react-dom",
|
||||
jsxImportDevRuntime,
|
||||
jsxImportRuntime
|
||||
];
|
||||
const staticBabelPlugins = typeof opts.babel === "object" ? opts.babel?.plugins ?? [] : [];
|
||||
const reactCompilerPlugin = getReactCompilerPlugin(staticBabelPlugins);
|
||||
if (reactCompilerPlugin != null) {
|
||||
const reactCompilerRuntimeModule = getReactCompilerRuntimeModule(reactCompilerPlugin);
|
||||
dependencies.push(reactCompilerRuntimeModule);
|
||||
}
|
||||
const viteReactRefresh = {
|
||||
name: "vite:react-refresh",
|
||||
enforce: "pre",
|
||||
config: (userConfig) => ({
|
||||
build: silenceUseClientWarning(userConfig),
|
||||
optimizeDeps: {
|
||||
include: dependencies
|
||||
},
|
||||
resolve: {
|
||||
dedupe: ["react", "react-dom"]
|
||||
}
|
||||
}),
|
||||
resolveId(id) {
|
||||
if (id === runtimePublicPath) {
|
||||
return id;
|
||||
}
|
||||
},
|
||||
load(id) {
|
||||
if (id === runtimePublicPath) {
|
||||
return runtimeCode;
|
||||
}
|
||||
},
|
||||
transformIndexHtml() {
|
||||
if (!skipFastRefresh)
|
||||
return [
|
||||
{
|
||||
tag: "script",
|
||||
attrs: { type: "module" },
|
||||
children: preambleCode.replace(`__BASE__`, devBase)
|
||||
}
|
||||
];
|
||||
}
|
||||
};
|
||||
return [viteBabel, viteReactRefresh];
|
||||
}
|
||||
viteReact.preambleCode = preambleCode;
|
||||
const silenceUseClientWarning = (userConfig) => ({
|
||||
rollupOptions: {
|
||||
onwarn(warning, defaultHandler) {
|
||||
if (warning.code === "MODULE_LEVEL_DIRECTIVE" && warning.message.includes("use client")) {
|
||||
return;
|
||||
}
|
||||
if (warning.code === "SOURCEMAP_ERROR" && warning.message.includes("resolve original location") && warning.pos === 0) {
|
||||
return;
|
||||
}
|
||||
if (userConfig.build?.rollupOptions?.onwarn) {
|
||||
userConfig.build.rollupOptions.onwarn(warning, defaultHandler);
|
||||
} else {
|
||||
defaultHandler(warning);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
const loadedPlugin = /* @__PURE__ */ new Map();
|
||||
function loadPlugin(path) {
|
||||
const cached = loadedPlugin.get(path);
|
||||
if (cached)
|
||||
return cached;
|
||||
const promise = import(path).then((module) => {
|
||||
const value = module.default || module;
|
||||
loadedPlugin.set(path, value);
|
||||
return value;
|
||||
});
|
||||
loadedPlugin.set(path, promise);
|
||||
return promise;
|
||||
}
|
||||
function createBabelOptions(rawOptions) {
|
||||
var _a;
|
||||
const babelOptions = {
|
||||
babelrc: false,
|
||||
configFile: false,
|
||||
...rawOptions
|
||||
};
|
||||
babelOptions.plugins || (babelOptions.plugins = []);
|
||||
babelOptions.presets || (babelOptions.presets = []);
|
||||
babelOptions.overrides || (babelOptions.overrides = []);
|
||||
babelOptions.parserOpts || (babelOptions.parserOpts = {});
|
||||
(_a = babelOptions.parserOpts).plugins || (_a.plugins = []);
|
||||
return babelOptions;
|
||||
}
|
||||
function defined(value) {
|
||||
return value !== void 0;
|
||||
}
|
||||
function getReactCompilerPlugin(plugins) {
|
||||
return plugins.find(
|
||||
(p) => p === "babel-plugin-react-compiler" || Array.isArray(p) && p[0] === "babel-plugin-react-compiler"
|
||||
);
|
||||
}
|
||||
function getReactCompilerRuntimeModule(plugin) {
|
||||
let moduleName = "react/compiler-runtime";
|
||||
if (Array.isArray(plugin)) {
|
||||
if (plugin[1]?.target === "17" || plugin[1]?.target === "18") {
|
||||
moduleName = "react-compiler-runtime";
|
||||
} else if (typeof plugin[1]?.runtimeModule === "string") {
|
||||
moduleName = plugin[1]?.runtimeModule;
|
||||
}
|
||||
}
|
||||
return moduleName;
|
||||
}
|
||||
|
||||
module.exports = viteReact;
|
||||
module.exports.default = viteReact;
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1 @@
|
||||
{"version":3,"names":["toPrimitive","input","hint","prim","Symbol","undefined","res","call","TypeError","String","Number"],"sources":["../../src/helpers/toPrimitive.ts"],"sourcesContent":["/* @minVersion 7.1.5 */\n\n// https://tc39.es/ecma262/#sec-toprimitive\nexport default function toPrimitive(\n input: unknown,\n hint?: \"default\" | \"string\" | \"number\",\n) {\n if (typeof input !== \"object\" || !input) return input;\n // @ts-expect-error Symbol.toPrimitive might not index {}\n var prim = input[Symbol.toPrimitive];\n if (prim !== undefined) {\n var res = prim.call(input, hint || \"default\");\n if (typeof res !== \"object\") return res;\n throw new TypeError(\"@@toPrimitive must return a primitive value.\");\n }\n return (hint === \"string\" ? String : Number)(input);\n}\n"],"mappings":";;;;;;AAGe,SAASA,WAAWA,CACjCC,KAAc,EACdC,IAAsC,EACtC;EACA,IAAI,OAAOD,KAAK,KAAK,QAAQ,IAAI,CAACA,KAAK,EAAE,OAAOA,KAAK;EAErD,IAAIE,IAAI,GAAGF,KAAK,CAACG,MAAM,CAACJ,WAAW,CAAC;EACpC,IAAIG,IAAI,KAAKE,SAAS,EAAE;IACtB,IAAIC,GAAG,GAAGH,IAAI,CAACI,IAAI,CAACN,KAAK,EAAEC,IAAI,IAAI,SAAS,CAAC;IAC7C,IAAI,OAAOI,GAAG,KAAK,QAAQ,EAAE,OAAOA,GAAG;IACvC,MAAM,IAAIE,SAAS,CAAC,8CAA8C,CAAC;EACrE;EACA,OAAO,CAACN,IAAI,KAAK,QAAQ,GAAGO,MAAM,GAAGC,MAAM,EAAET,KAAK,CAAC;AACrD","ignoreList":[]}
|
||||
Reference in New Issue
Block a user