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:{"72":0.00214,"75":0.00107,"77":0.00214,"78":0.00641,"89":0.00107,"99":0.00107,"101":0.00107,"102":0.00107,"106":0.00214,"107":0.00107,"109":0.00107,"111":0.00107,"115":0.22877,"120":0.00428,"121":0.00321,"122":0.00214,"125":0.04597,"127":0.00748,"128":0.06949,"130":0.00107,"131":0.00428,"132":0.01069,"133":0.02031,"134":0.00321,"135":0.18708,"136":0.6585,"137":0.00214,_:"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 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 73 74 76 79 80 81 82 83 84 85 86 87 88 90 91 92 93 94 95 96 97 98 100 103 104 105 108 110 112 113 114 116 117 118 119 123 124 126 129 138 139 140 3.5 3.6"},D:{"39":0.00107,"52":0.00107,"55":0.00107,"66":0.00107,"68":0.00107,"71":0.00107,"79":0.00748,"81":0.00214,"84":0.00107,"85":0.00321,"87":0.01176,"90":0.00107,"94":0.00321,"103":0.10262,"104":0.00107,"108":0.00748,"109":0.14325,"111":0.00748,"112":0.00107,"114":0.00321,"116":0.03742,"118":0.00107,"119":0.00107,"120":0.00107,"121":0.00107,"122":0.00748,"123":0.00748,"124":0.00641,"125":0.00641,"126":0.00428,"127":0.00321,"128":0.03421,"129":0.00855,"130":0.00641,"131":0.05345,"132":0.39232,"133":1.14597,"134":2.49612,"135":0.00855,_:"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 40 41 42 43 44 45 46 47 48 49 50 51 53 54 56 57 58 59 60 61 62 63 64 65 67 69 70 72 73 74 75 76 77 78 80 83 86 88 89 91 92 93 95 96 97 98 99 100 101 102 105 106 107 110 113 115 117 136 137 138"},F:{"46":0.01069,"65":0.00107,"81":0.00214,"87":0.00107,"88":0.00107,"113":0.00535,"115":0.00107,"116":0.0449,"117":0.22984,_:"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 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 82 83 84 85 86 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 114 9.5-9.6 10.0-10.1 10.5 10.6 11.1 11.5 11.6 12.1"},B:{"16":0.00214,"18":0.00107,"92":0.00214,"100":0.00641,"109":0.00321,"112":0.00107,"113":0.00107,"120":0.00535,"124":0.00855,"125":0.00107,"126":0.00107,"128":0.00321,"129":0.00107,"131":0.00962,"132":0.00748,"133":0.41584,"134":1.10748,_:"12 13 14 15 17 79 80 81 83 84 85 86 87 88 89 90 91 93 94 95 96 97 98 99 101 102 103 104 105 106 107 108 110 111 114 115 116 117 118 119 121 122 123 127 130"},E:{"13":0.00107,"14":0.02245,"15":0.00107,_:"0 4 5 6 7 8 9 10 11 12 3.1 3.2 5.1 6.1 7.1 9.1 10.1 15.4","11.1":0.00107,"12.1":0.00214,"13.1":0.0139,"14.1":0.03207,"15.1":0.00748,"15.2-15.3":0.00428,"15.5":0.00962,"15.6":0.07269,"16.0":0.00855,"16.1":0.02031,"16.2":0.00748,"16.3":0.02352,"16.4":0.02245,"16.5":0.01283,"16.6":0.22235,"17.0":0.0139,"17.1":0.09728,"17.2":0.01817,"17.3":0.02886,"17.4":0.09193,"17.5":0.04597,"17.6":0.29184,"18.0":0.05024,"18.1":0.031,"18.2":0.03635,"18.3":0.80496,"18.4":0.01283},G:{"8":0,"3.2":0,"4.0-4.1":0,"4.2-4.3":0.00132,"5.0-5.1":0,"6.0-6.1":0.00396,"7.0-7.1":0.00264,"8.1-8.4":0,"9.0-9.2":0.00198,"9.3":0.00925,"10.0-10.2":0.00066,"10.3":0.0152,"11.0-11.2":0.07005,"11.3-11.4":0.00463,"12.0-12.1":0.00264,"12.2-12.5":0.06542,"13.0-13.1":0.00132,"13.2":0.00198,"13.3":0.00264,"13.4-13.7":0.00925,"14.0-14.4":0.02313,"14.5-14.8":0.02775,"15.0-15.1":0.0152,"15.2-15.3":0.0152,"15.4":0.0185,"15.5":0.02115,"15.6-15.8":0.26036,"16.0":0.03701,"16.1":0.07599,"16.2":0.03965,"16.3":0.06873,"16.4":0.0152,"16.5":0.02842,"16.6-16.7":0.3086,"17.0":0.0185,"17.1":0.03304,"17.2":0.02511,"17.3":0.03502,"17.4":0.07005,"17.5":0.15595,"17.6-17.7":0.45266,"18.0":0.12688,"18.1":0.41499,"18.2":0.18569,"18.3":3.881,"18.4":0.05749},P:{"21":0.01043,"24":0.01043,"25":0.0313,"26":0.02086,"27":1.03279,_:"4 20 22 23 5.0-5.4 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 18.0 19.0","7.2-7.4":0.01043},I:{"0":0.1604,"3":0,"4":0,"2.1":0,"2.2":0,"2.3":0,"4.1":0,"4.2-4.3":0.00005,"4.4":0,"4.4.3-4.4.4":0.00018},K:{"0":0.07144,_:"10 11 12 11.1 11.5 12.1"},A:{_:"6 7 8 9 10 11 5.5"},S:{_:"2.5 3.0-3.1"},J:{_:"7 10"},N:{_:"10 11"},R:{_:"0"},M:{"0":0.32148},Q:{_:"14.9"},O:{"0":0.00893},H:{"0":0},L:{"0":81.54128}};

View File

@@ -0,0 +1 @@
module.exports={C:{"50":0.06067,"51":0.02427,"52":0.06067,"53":6.87391,"55":0.15168,"56":0.02427,"60":0.00607,"72":0.02427,"75":0.00607,"78":0.00607,"91":0.00607,"94":0.01213,"103":0.01213,"105":0.00607,"107":0.00607,"108":0.00607,"109":0.00607,"110":0.00607,"111":0.04854,"113":0.00607,"115":0.21841,"125":0.00607,"127":0.00607,"128":0.33369,"129":0.00607,"130":0.00607,"132":0.00607,"133":0.03034,"134":0.0546,"135":0.74624,"136":2.34793,"137":0.00607,_:"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 54 57 58 59 61 62 63 64 65 66 67 68 69 70 71 73 74 76 77 79 80 81 82 83 84 85 86 87 88 89 90 92 93 95 96 97 98 99 100 101 102 104 106 112 114 116 117 118 119 120 121 122 123 124 126 131 138 139 140 3.5 3.6"},D:{"38":0.00607,"42":0.00607,"48":0.00607,"52":0.0728,"66":0.04247,"70":0.00607,"71":0.0182,"73":0.00607,"78":0.00607,"79":0.02427,"80":0.00607,"81":0.01213,"85":0.01213,"87":0.09707,"88":0.00607,"91":0.54603,"92":0.00607,"93":0.02427,"94":0.0364,"95":0.00607,"96":0.03034,"99":0.00607,"100":0.0182,"102":0.01213,"103":0.0364,"104":0.15168,"105":0.0182,"106":0.0364,"107":0.04247,"108":0.0546,"109":0.39436,"110":0.03034,"111":0.04247,"112":0.04854,"113":0.0364,"114":0.0364,"115":0.13954,"116":0.09707,"117":0.00607,"118":0.01213,"119":0.0182,"120":0.0546,"121":0.04854,"122":0.0546,"123":0.10314,"124":0.07887,"125":0.50963,"126":0.5521,"127":0.17594,"128":0.14561,"129":1.38934,"130":0.12741,"131":2.58454,"132":2.56027,"133":10.47164,"134":18.40728,"135":0.11527,_:"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 39 40 41 43 44 45 46 47 49 50 51 53 54 55 56 57 58 59 60 61 62 63 64 65 67 68 69 72 74 75 76 77 83 84 86 89 90 97 98 101 136 137 138"},F:{"68":0.01213,"87":0.01213,"88":0.00607,"91":0.00607,"95":0.02427,"114":0.00607,"115":0.00607,"116":0.31548,"117":1.11633,_:"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 46 47 48 49 50 51 52 53 54 55 56 57 58 60 62 63 64 65 66 67 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 89 90 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:{"16":0.00607,"17":0.00607,"18":0.0182,"106":0.00607,"107":0.00607,"108":0.00607,"109":0.03034,"110":0.00607,"112":0.01213,"126":0.00607,"127":0.01213,"130":0.04247,"131":0.03034,"132":0.06674,"133":1.177,"134":2.74228,_:"12 13 14 15 79 80 81 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 111 113 114 115 116 117 118 119 120 121 122 123 124 125 128 129"},E:{"13":0.00607,"14":0.00607,"15":0.00607,_:"0 4 5 6 7 8 9 10 11 12 3.1 3.2 5.1 6.1 7.1 9.1 10.1 11.1 15.2-15.3","12.1":0.00607,"13.1":0.0364,"14.1":0.0182,"15.1":0.00607,"15.4":0.00607,"15.5":0.02427,"15.6":0.10314,"16.0":0.0364,"16.1":0.0182,"16.2":0.01213,"16.3":0.02427,"16.4":0.01213,"16.5":0.02427,"16.6":0.16381,"17.0":0.00607,"17.1":0.13347,"17.2":0.0182,"17.3":0.01213,"17.4":0.0546,"17.5":0.0728,"17.6":0.27302,"18.0":0.07887,"18.1":0.12134,"18.2":0.0546,"18.3":1.11633,"18.4":0.0182},G:{"8":0,"3.2":0,"4.0-4.1":0,"4.2-4.3":0.002,"5.0-5.1":0,"6.0-6.1":0.00599,"7.0-7.1":0.00399,"8.1-8.4":0,"9.0-9.2":0.003,"9.3":0.01398,"10.0-10.2":0.001,"10.3":0.02297,"11.0-11.2":0.10585,"11.3-11.4":0.00699,"12.0-12.1":0.00399,"12.2-12.5":0.09886,"13.0-13.1":0.002,"13.2":0.003,"13.3":0.00399,"13.4-13.7":0.01398,"14.0-14.4":0.03495,"14.5-14.8":0.04194,"15.0-15.1":0.02297,"15.2-15.3":0.02297,"15.4":0.02796,"15.5":0.03195,"15.6-15.8":0.39344,"16.0":0.05592,"16.1":0.11484,"16.2":0.05992,"16.3":0.10385,"16.4":0.02297,"16.5":0.04294,"16.6-16.7":0.46634,"17.0":0.02796,"17.1":0.04993,"17.2":0.03795,"17.3":0.05293,"17.4":0.10585,"17.5":0.23567,"17.6-17.7":0.68403,"18.0":0.19173,"18.1":0.62711,"18.2":0.2806,"18.3":5.86471,"18.4":0.08688},P:{"4":0.01065,"20":0.01065,"21":0.03196,"22":0.04261,"23":0.04261,"24":0.06392,"25":0.06392,"26":0.09588,"27":2.03478,_:"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 15.0 16.0","14.0":0.01065,"17.0":0.01065,"18.0":0.01065,"19.0":0.01065},I:{"0":0.02747,"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.55455,_:"10 11 12 11.1 11.5 12.1"},A:{"8":0.02629,"9":0.00876,"10":0.00876,"11":0.03505,_:"6 7 5.5"},S:{_:"2.5 3.0-3.1"},J:{_:"7 10"},N:{_:"10 11"},R:{_:"0"},M:{"0":0.7748},Q:{"14.9":0.00393},O:{"0":0.10619},H:{"0":0},L:{"0":25.58975}};

View File

@@ -0,0 +1,159 @@
/**
* @fileoverview A rule to set the maximum depth block can be nested in a function.
* @author Ian Christian Myers
*/
"use strict";
//------------------------------------------------------------------------------
// Rule Definition
//------------------------------------------------------------------------------
/** @type {import('../shared/types').Rule} */
module.exports = {
meta: {
type: "suggestion",
docs: {
description: "Enforce a maximum depth that blocks can be nested",
recommended: false,
url: "https://eslint.org/docs/latest/rules/max-depth",
},
schema: [
{
oneOf: [
{
type: "integer",
minimum: 0,
},
{
type: "object",
properties: {
maximum: {
type: "integer",
minimum: 0,
},
max: {
type: "integer",
minimum: 0,
},
},
additionalProperties: false,
},
],
},
],
messages: {
tooDeeply:
"Blocks are nested too deeply ({{depth}}). Maximum allowed is {{maxDepth}}.",
},
},
create(context) {
//--------------------------------------------------------------------------
// Helpers
//--------------------------------------------------------------------------
const functionStack = [],
option = context.options[0];
let maxDepth = 4;
if (
typeof option === "object" &&
(Object.hasOwn(option, "maximum") || Object.hasOwn(option, "max"))
) {
maxDepth = option.maximum || option.max;
}
if (typeof option === "number") {
maxDepth = option;
}
/**
* When parsing a new function, store it in our function stack
* @returns {void}
* @private
*/
function startFunction() {
functionStack.push(0);
}
/**
* When parsing is done then pop out the reference
* @returns {void}
* @private
*/
function endFunction() {
functionStack.pop();
}
/**
* Save the block and Evaluate the node
* @param {ASTNode} node node to evaluate
* @returns {void}
* @private
*/
function pushBlock(node) {
const len = ++functionStack[functionStack.length - 1];
if (len > maxDepth) {
context.report({
node,
messageId: "tooDeeply",
data: { depth: len, maxDepth },
});
}
}
/**
* Pop the saved block
* @returns {void}
* @private
*/
function popBlock() {
functionStack[functionStack.length - 1]--;
}
//--------------------------------------------------------------------------
// Public API
//--------------------------------------------------------------------------
return {
Program: startFunction,
FunctionDeclaration: startFunction,
FunctionExpression: startFunction,
ArrowFunctionExpression: startFunction,
StaticBlock: startFunction,
IfStatement(node) {
if (node.parent.type !== "IfStatement") {
pushBlock(node);
}
},
SwitchStatement: pushBlock,
TryStatement: pushBlock,
DoWhileStatement: pushBlock,
WhileStatement: pushBlock,
WithStatement: pushBlock,
ForStatement: pushBlock,
ForInStatement: pushBlock,
ForOfStatement: pushBlock,
"IfStatement:exit": popBlock,
"SwitchStatement:exit": popBlock,
"TryStatement:exit": popBlock,
"DoWhileStatement:exit": popBlock,
"WhileStatement:exit": popBlock,
"WithStatement:exit": popBlock,
"ForStatement:exit": popBlock,
"ForInStatement:exit": popBlock,
"ForOfStatement:exit": popBlock,
"FunctionDeclaration:exit": endFunction,
"FunctionExpression:exit": endFunction,
"ArrowFunctionExpression:exit": endFunction,
"StaticBlock:exit": endFunction,
"Program:exit": endFunction,
};
},
};

View File

@@ -0,0 +1 @@
module.exports={A:{D:{"1":"0 9 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","33":"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 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"},L:{"1":"I"},B:{"1":"0 9 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","33":"C L M G N O P Q H R S T U V W X"},C:{"1":"0 9 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 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 qC rC"},M:{"1":"EC"},A:{"2":"K D E F mC","33":"A B"},F:{"1":"0 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 4C 5C 6C 7C FC kC 8C GC","33":"1 2 3 4 5 6 7 8 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"},K:{"1":"H","2":"A B C FC kC GC"},E:{"1":"G 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","2":"3C","33":"J PB K D E F A B C L M sC SC tC uC vC wC TC FC GC xC"},G:{"1":"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","33":"E SC 9C lC AD BD CD DD ED FD GD HD ID JD KD LD MD ND OD PD QD"},P:{"1":"1 2 3 4 5 6 7 8 mD IC JC KC nD","33":"J dD eD fD gD hD TC iD jD kD lD"},I:{"1":"I","2":"LC J XD YD ZD aD lC","33":"bD cD"}},B:6,C:"::file-selector-button CSS pseudo-element",D:undefined};

View File

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

View File

@@ -0,0 +1 @@
{"version":3,"names":["_inherit","require","inheritLeadingComments","child","parent","inherit"],"sources":["../../src/comments/inheritLeadingComments.ts"],"sourcesContent":["import inherit from \"../utils/inherit.ts\";\nimport type * as t from \"../index.ts\";\n\nexport default function inheritLeadingComments(\n child: t.Node,\n parent: t.Node,\n): void {\n inherit(\"leadingComments\", child, parent);\n}\n"],"mappings":";;;;;;AAAA,IAAAA,QAAA,GAAAC,OAAA;AAGe,SAASC,sBAAsBA,CAC5CC,KAAa,EACbC,MAAc,EACR;EACN,IAAAC,gBAAO,EAAC,iBAAiB,EAAEF,KAAK,EAAEC,MAAM,CAAC;AAC3C","ignoreList":[]}

View File

@@ -0,0 +1,660 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.AnyTypeAnnotation = AnyTypeAnnotation;
exports.ArrayTypeAnnotation = ArrayTypeAnnotation;
exports.BooleanLiteralTypeAnnotation = BooleanLiteralTypeAnnotation;
exports.BooleanTypeAnnotation = BooleanTypeAnnotation;
exports.DeclareClass = DeclareClass;
exports.DeclareExportAllDeclaration = DeclareExportAllDeclaration;
exports.DeclareExportDeclaration = DeclareExportDeclaration;
exports.DeclareFunction = DeclareFunction;
exports.DeclareInterface = DeclareInterface;
exports.DeclareModule = DeclareModule;
exports.DeclareModuleExports = DeclareModuleExports;
exports.DeclareOpaqueType = DeclareOpaqueType;
exports.DeclareTypeAlias = DeclareTypeAlias;
exports.DeclareVariable = DeclareVariable;
exports.DeclaredPredicate = DeclaredPredicate;
exports.EmptyTypeAnnotation = EmptyTypeAnnotation;
exports.EnumBooleanBody = EnumBooleanBody;
exports.EnumBooleanMember = EnumBooleanMember;
exports.EnumDeclaration = EnumDeclaration;
exports.EnumDefaultedMember = EnumDefaultedMember;
exports.EnumNumberBody = EnumNumberBody;
exports.EnumNumberMember = EnumNumberMember;
exports.EnumStringBody = EnumStringBody;
exports.EnumStringMember = EnumStringMember;
exports.EnumSymbolBody = EnumSymbolBody;
exports.ExistsTypeAnnotation = ExistsTypeAnnotation;
exports.FunctionTypeAnnotation = FunctionTypeAnnotation;
exports.FunctionTypeParam = FunctionTypeParam;
exports.IndexedAccessType = IndexedAccessType;
exports.InferredPredicate = InferredPredicate;
exports.InterfaceDeclaration = InterfaceDeclaration;
exports.GenericTypeAnnotation = exports.ClassImplements = exports.InterfaceExtends = InterfaceExtends;
exports.InterfaceTypeAnnotation = InterfaceTypeAnnotation;
exports.IntersectionTypeAnnotation = IntersectionTypeAnnotation;
exports.MixedTypeAnnotation = MixedTypeAnnotation;
exports.NullLiteralTypeAnnotation = NullLiteralTypeAnnotation;
exports.NullableTypeAnnotation = NullableTypeAnnotation;
Object.defineProperty(exports, "NumberLiteralTypeAnnotation", {
enumerable: true,
get: function () {
return _types2.NumericLiteral;
}
});
exports.NumberTypeAnnotation = NumberTypeAnnotation;
exports.ObjectTypeAnnotation = ObjectTypeAnnotation;
exports.ObjectTypeCallProperty = ObjectTypeCallProperty;
exports.ObjectTypeIndexer = ObjectTypeIndexer;
exports.ObjectTypeInternalSlot = ObjectTypeInternalSlot;
exports.ObjectTypeProperty = ObjectTypeProperty;
exports.ObjectTypeSpreadProperty = ObjectTypeSpreadProperty;
exports.OpaqueType = OpaqueType;
exports.OptionalIndexedAccessType = OptionalIndexedAccessType;
exports.QualifiedTypeIdentifier = QualifiedTypeIdentifier;
Object.defineProperty(exports, "StringLiteralTypeAnnotation", {
enumerable: true,
get: function () {
return _types2.StringLiteral;
}
});
exports.StringTypeAnnotation = StringTypeAnnotation;
exports.SymbolTypeAnnotation = SymbolTypeAnnotation;
exports.ThisTypeAnnotation = ThisTypeAnnotation;
exports.TupleTypeAnnotation = TupleTypeAnnotation;
exports.TypeAlias = TypeAlias;
exports.TypeAnnotation = TypeAnnotation;
exports.TypeCastExpression = TypeCastExpression;
exports.TypeParameter = TypeParameter;
exports.TypeParameterDeclaration = exports.TypeParameterInstantiation = TypeParameterInstantiation;
exports.TypeofTypeAnnotation = TypeofTypeAnnotation;
exports.UnionTypeAnnotation = UnionTypeAnnotation;
exports.Variance = Variance;
exports.VoidTypeAnnotation = VoidTypeAnnotation;
exports._interfaceish = _interfaceish;
exports._variance = _variance;
var _t = require("@babel/types");
var _modules = require("./modules.js");
var _index = require("../node/index.js");
var _types2 = require("./types.js");
const {
isDeclareExportDeclaration,
isStatement
} = _t;
function AnyTypeAnnotation() {
this.word("any");
}
function ArrayTypeAnnotation(node) {
this.print(node.elementType, true);
this.tokenChar(91);
this.tokenChar(93);
}
function BooleanTypeAnnotation() {
this.word("boolean");
}
function BooleanLiteralTypeAnnotation(node) {
this.word(node.value ? "true" : "false");
}
function NullLiteralTypeAnnotation() {
this.word("null");
}
function DeclareClass(node, parent) {
if (!isDeclareExportDeclaration(parent)) {
this.word("declare");
this.space();
}
this.word("class");
this.space();
this._interfaceish(node);
}
function DeclareFunction(node, parent) {
if (!isDeclareExportDeclaration(parent)) {
this.word("declare");
this.space();
}
this.word("function");
this.space();
this.print(node.id);
this.print(node.id.typeAnnotation.typeAnnotation);
if (node.predicate) {
this.space();
this.print(node.predicate);
}
this.semicolon();
}
function InferredPredicate() {
this.tokenChar(37);
this.word("checks");
}
function DeclaredPredicate(node) {
this.tokenChar(37);
this.word("checks");
this.tokenChar(40);
this.print(node.value);
this.tokenChar(41);
}
function DeclareInterface(node) {
this.word("declare");
this.space();
this.InterfaceDeclaration(node);
}
function DeclareModule(node) {
this.word("declare");
this.space();
this.word("module");
this.space();
this.print(node.id);
this.space();
this.print(node.body);
}
function DeclareModuleExports(node) {
this.word("declare");
this.space();
this.word("module");
this.tokenChar(46);
this.word("exports");
this.print(node.typeAnnotation);
}
function DeclareTypeAlias(node) {
this.word("declare");
this.space();
this.TypeAlias(node);
}
function DeclareOpaqueType(node, parent) {
if (!isDeclareExportDeclaration(parent)) {
this.word("declare");
this.space();
}
this.OpaqueType(node);
}
function DeclareVariable(node, parent) {
if (!isDeclareExportDeclaration(parent)) {
this.word("declare");
this.space();
}
this.word("var");
this.space();
this.print(node.id);
this.print(node.id.typeAnnotation);
this.semicolon();
}
function DeclareExportDeclaration(node) {
this.word("declare");
this.space();
this.word("export");
this.space();
if (node.default) {
this.word("default");
this.space();
}
FlowExportDeclaration.call(this, node);
}
function DeclareExportAllDeclaration(node) {
this.word("declare");
this.space();
_modules.ExportAllDeclaration.call(this, node);
}
function EnumDeclaration(node) {
const {
id,
body
} = node;
this.word("enum");
this.space();
this.print(id);
this.print(body);
}
function enumExplicitType(context, name, hasExplicitType) {
if (hasExplicitType) {
context.space();
context.word("of");
context.space();
context.word(name);
}
context.space();
}
function enumBody(context, node) {
const {
members
} = node;
context.token("{");
context.indent();
context.newline();
for (const member of members) {
context.print(member);
context.newline();
}
if (node.hasUnknownMembers) {
context.token("...");
context.newline();
}
context.dedent();
context.token("}");
}
function EnumBooleanBody(node) {
const {
explicitType
} = node;
enumExplicitType(this, "boolean", explicitType);
enumBody(this, node);
}
function EnumNumberBody(node) {
const {
explicitType
} = node;
enumExplicitType(this, "number", explicitType);
enumBody(this, node);
}
function EnumStringBody(node) {
const {
explicitType
} = node;
enumExplicitType(this, "string", explicitType);
enumBody(this, node);
}
function EnumSymbolBody(node) {
enumExplicitType(this, "symbol", true);
enumBody(this, node);
}
function EnumDefaultedMember(node) {
const {
id
} = node;
this.print(id);
this.tokenChar(44);
}
function enumInitializedMember(context, node) {
context.print(node.id);
context.space();
context.token("=");
context.space();
context.print(node.init);
context.token(",");
}
function EnumBooleanMember(node) {
enumInitializedMember(this, node);
}
function EnumNumberMember(node) {
enumInitializedMember(this, node);
}
function EnumStringMember(node) {
enumInitializedMember(this, node);
}
function FlowExportDeclaration(node) {
if (node.declaration) {
const declar = node.declaration;
this.print(declar);
if (!isStatement(declar)) this.semicolon();
} else {
this.tokenChar(123);
if (node.specifiers.length) {
this.space();
this.printList(node.specifiers);
this.space();
}
this.tokenChar(125);
if (node.source) {
this.space();
this.word("from");
this.space();
this.print(node.source);
}
this.semicolon();
}
}
function ExistsTypeAnnotation() {
this.tokenChar(42);
}
function FunctionTypeAnnotation(node, parent) {
this.print(node.typeParameters);
this.tokenChar(40);
if (node.this) {
this.word("this");
this.tokenChar(58);
this.space();
this.print(node.this.typeAnnotation);
if (node.params.length || node.rest) {
this.tokenChar(44);
this.space();
}
}
this.printList(node.params);
if (node.rest) {
if (node.params.length) {
this.tokenChar(44);
this.space();
}
this.token("...");
this.print(node.rest);
}
this.tokenChar(41);
const type = parent == null ? void 0 : parent.type;
if (type != null && (type === "ObjectTypeCallProperty" || type === "ObjectTypeInternalSlot" || type === "DeclareFunction" || type === "ObjectTypeProperty" && parent.method)) {
this.tokenChar(58);
} else {
this.space();
this.token("=>");
}
this.space();
this.print(node.returnType);
}
function FunctionTypeParam(node) {
this.print(node.name);
if (node.optional) this.tokenChar(63);
if (node.name) {
this.tokenChar(58);
this.space();
}
this.print(node.typeAnnotation);
}
function InterfaceExtends(node) {
this.print(node.id);
this.print(node.typeParameters, true);
}
function _interfaceish(node) {
var _node$extends;
this.print(node.id);
this.print(node.typeParameters);
if ((_node$extends = node.extends) != null && _node$extends.length) {
this.space();
this.word("extends");
this.space();
this.printList(node.extends);
}
if (node.type === "DeclareClass") {
var _node$mixins, _node$implements;
if ((_node$mixins = node.mixins) != null && _node$mixins.length) {
this.space();
this.word("mixins");
this.space();
this.printList(node.mixins);
}
if ((_node$implements = node.implements) != null && _node$implements.length) {
this.space();
this.word("implements");
this.space();
this.printList(node.implements);
}
}
this.space();
this.print(node.body);
}
function _variance(node) {
var _node$variance;
const kind = (_node$variance = node.variance) == null ? void 0 : _node$variance.kind;
if (kind != null) {
if (kind === "plus") {
this.tokenChar(43);
} else if (kind === "minus") {
this.tokenChar(45);
}
}
}
function InterfaceDeclaration(node) {
this.word("interface");
this.space();
this._interfaceish(node);
}
function andSeparator(occurrenceCount) {
this.space();
this.token("&", false, occurrenceCount);
this.space();
}
function InterfaceTypeAnnotation(node) {
var _node$extends2;
this.word("interface");
if ((_node$extends2 = node.extends) != null && _node$extends2.length) {
this.space();
this.word("extends");
this.space();
this.printList(node.extends);
}
this.space();
this.print(node.body);
}
function IntersectionTypeAnnotation(node) {
this.printJoin(node.types, undefined, undefined, andSeparator);
}
function MixedTypeAnnotation() {
this.word("mixed");
}
function EmptyTypeAnnotation() {
this.word("empty");
}
function NullableTypeAnnotation(node) {
this.tokenChar(63);
this.print(node.typeAnnotation);
}
function NumberTypeAnnotation() {
this.word("number");
}
function StringTypeAnnotation() {
this.word("string");
}
function ThisTypeAnnotation() {
this.word("this");
}
function TupleTypeAnnotation(node) {
this.tokenChar(91);
this.printList(node.types);
this.tokenChar(93);
}
function TypeofTypeAnnotation(node) {
this.word("typeof");
this.space();
this.print(node.argument);
}
function TypeAlias(node) {
this.word("type");
this.space();
this.print(node.id);
this.print(node.typeParameters);
this.space();
this.tokenChar(61);
this.space();
this.print(node.right);
this.semicolon();
}
function TypeAnnotation(node, parent) {
this.tokenChar(58);
this.space();
if (parent.type === "ArrowFunctionExpression") {
this.tokenContext |= _index.TokenContext.arrowFlowReturnType;
} else if (node.optional) {
this.tokenChar(63);
}
this.print(node.typeAnnotation);
}
function TypeParameterInstantiation(node) {
this.tokenChar(60);
this.printList(node.params);
this.tokenChar(62);
}
function TypeParameter(node) {
this._variance(node);
this.word(node.name);
if (node.bound) {
this.print(node.bound);
}
if (node.default) {
this.space();
this.tokenChar(61);
this.space();
this.print(node.default);
}
}
function OpaqueType(node) {
this.word("opaque");
this.space();
this.word("type");
this.space();
this.print(node.id);
this.print(node.typeParameters);
if (node.supertype) {
this.tokenChar(58);
this.space();
this.print(node.supertype);
}
if (node.impltype) {
this.space();
this.tokenChar(61);
this.space();
this.print(node.impltype);
}
this.semicolon();
}
function ObjectTypeAnnotation(node) {
if (node.exact) {
this.token("{|");
} else {
this.tokenChar(123);
}
const props = [...node.properties, ...(node.callProperties || []), ...(node.indexers || []), ...(node.internalSlots || [])];
if (props.length) {
this.newline();
this.space();
this.printJoin(props, true, true, undefined, undefined, function addNewlines(leading) {
if (leading && !props[0]) return 1;
}, () => {
if (props.length !== 1 || node.inexact) {
this.tokenChar(44);
this.space();
}
});
this.space();
}
if (node.inexact) {
this.indent();
this.token("...");
if (props.length) {
this.newline();
}
this.dedent();
}
if (node.exact) {
this.token("|}");
} else {
this.tokenChar(125);
}
}
function ObjectTypeInternalSlot(node) {
if (node.static) {
this.word("static");
this.space();
}
this.tokenChar(91);
this.tokenChar(91);
this.print(node.id);
this.tokenChar(93);
this.tokenChar(93);
if (node.optional) this.tokenChar(63);
if (!node.method) {
this.tokenChar(58);
this.space();
}
this.print(node.value);
}
function ObjectTypeCallProperty(node) {
if (node.static) {
this.word("static");
this.space();
}
this.print(node.value);
}
function ObjectTypeIndexer(node) {
if (node.static) {
this.word("static");
this.space();
}
this._variance(node);
this.tokenChar(91);
if (node.id) {
this.print(node.id);
this.tokenChar(58);
this.space();
}
this.print(node.key);
this.tokenChar(93);
this.tokenChar(58);
this.space();
this.print(node.value);
}
function ObjectTypeProperty(node) {
if (node.proto) {
this.word("proto");
this.space();
}
if (node.static) {
this.word("static");
this.space();
}
if (node.kind === "get" || node.kind === "set") {
this.word(node.kind);
this.space();
}
this._variance(node);
this.print(node.key);
if (node.optional) this.tokenChar(63);
if (!node.method) {
this.tokenChar(58);
this.space();
}
this.print(node.value);
}
function ObjectTypeSpreadProperty(node) {
this.token("...");
this.print(node.argument);
}
function QualifiedTypeIdentifier(node) {
this.print(node.qualification);
this.tokenChar(46);
this.print(node.id);
}
function SymbolTypeAnnotation() {
this.word("symbol");
}
function orSeparator(occurrenceCount) {
this.space();
this.token("|", false, occurrenceCount);
this.space();
}
function UnionTypeAnnotation(node) {
this.printJoin(node.types, undefined, undefined, orSeparator);
}
function TypeCastExpression(node) {
this.tokenChar(40);
this.print(node.expression);
this.print(node.typeAnnotation);
this.tokenChar(41);
}
function Variance(node) {
if (node.kind === "plus") {
this.tokenChar(43);
} else {
this.tokenChar(45);
}
}
function VoidTypeAnnotation() {
this.word("void");
}
function IndexedAccessType(node) {
this.print(node.objectType, true);
this.tokenChar(91);
this.print(node.indexType);
this.tokenChar(93);
}
function OptionalIndexedAccessType(node) {
this.print(node.objectType);
if (node.optional) {
this.token("?.");
}
this.tokenChar(91);
this.print(node.indexType);
this.tokenChar(93);
}
//# sourceMappingURL=flow.js.map

View File

@@ -0,0 +1,7 @@
// when this is loaded into the browser,
// just use the defaults...
module.exports = function (name, defaults) {
return defaults
}

View File

@@ -0,0 +1,7 @@
/**
* Extract file name from the Content-Disposition HTTP response header.
*
* @param {string} contentDisposition
* @returns {string} Filename, if found in the Content-Disposition header.
*/
export function getFilenameFromContentDispositionHeader(contentDisposition: string): string;

View File

@@ -0,0 +1,79 @@
/**
* @fileoverview Disallow string concatenation when using __dirname and __filename
* @author Nicholas C. Zakas
* @deprecated in ESLint v7.0.0
*/
"use strict";
//------------------------------------------------------------------------------
// Rule Definition
//------------------------------------------------------------------------------
/** @type {import('../shared/types').Rule} */
module.exports = {
meta: {
deprecated: {
message: "Node.js rules were moved out of ESLint core.",
url: "https://eslint.org/docs/latest/use/migrating-to-7.0.0#deprecate-node-rules",
deprecatedSince: "7.0.0",
availableUntil: null,
replacedBy: [
{
message:
"eslint-plugin-n now maintains deprecated Node.js-related rules.",
plugin: {
name: "eslint-plugin-n",
url: "https://github.com/eslint-community/eslint-plugin-n",
},
rule: {
name: "no-path-concat",
url: "https://github.com/eslint-community/eslint-plugin-n/tree/master/docs/rules/no-path-concat.md",
},
},
],
},
type: "suggestion",
docs: {
description:
"Disallow string concatenation with `__dirname` and `__filename`",
recommended: false,
url: "https://eslint.org/docs/latest/rules/no-path-concat",
},
schema: [],
messages: {
usePathFunctions:
"Use path.join() or path.resolve() instead of + to create paths.",
},
},
create(context) {
const MATCHER = /^__(?:dir|file)name$/u;
//--------------------------------------------------------------------------
// Public
//--------------------------------------------------------------------------
return {
BinaryExpression(node) {
const left = node.left,
right = node.right;
if (
node.operator === "+" &&
((left.type === "Identifier" && MATCHER.test(left.name)) ||
(right.type === "Identifier" &&
MATCHER.test(right.name)))
) {
context.report({
node,
messageId: "usePathFunctions",
});
}
},
};
},
};

View File

@@ -0,0 +1,263 @@
'use strict';
function hasKey(obj, keys) {
var o = obj;
keys.slice(0, -1).forEach(function (key) {
o = o[key] || {};
});
var key = keys[keys.length - 1];
return key in o;
}
function isNumber(x) {
if (typeof x === 'number') { return true; }
if ((/^0x[0-9a-f]+$/i).test(x)) { return true; }
return (/^[-+]?(?:\d+(?:\.\d*)?|\.\d+)(e[-+]?\d+)?$/).test(x);
}
function isConstructorOrProto(obj, key) {
return (key === 'constructor' && typeof obj[key] === 'function') || key === '__proto__';
}
module.exports = function (args, opts) {
if (!opts) { opts = {}; }
var flags = {
bools: {},
strings: {},
unknownFn: null,
};
if (typeof opts.unknown === 'function') {
flags.unknownFn = opts.unknown;
}
if (typeof opts.boolean === 'boolean' && opts.boolean) {
flags.allBools = true;
} else {
[].concat(opts.boolean).filter(Boolean).forEach(function (key) {
flags.bools[key] = true;
});
}
var aliases = {};
function aliasIsBoolean(key) {
return aliases[key].some(function (x) {
return flags.bools[x];
});
}
Object.keys(opts.alias || {}).forEach(function (key) {
aliases[key] = [].concat(opts.alias[key]);
aliases[key].forEach(function (x) {
aliases[x] = [key].concat(aliases[key].filter(function (y) {
return x !== y;
}));
});
});
[].concat(opts.string).filter(Boolean).forEach(function (key) {
flags.strings[key] = true;
if (aliases[key]) {
[].concat(aliases[key]).forEach(function (k) {
flags.strings[k] = true;
});
}
});
var defaults = opts.default || {};
var argv = { _: [] };
function argDefined(key, arg) {
return (flags.allBools && (/^--[^=]+$/).test(arg))
|| flags.strings[key]
|| flags.bools[key]
|| aliases[key];
}
function setKey(obj, keys, value) {
var o = obj;
for (var i = 0; i < keys.length - 1; i++) {
var key = keys[i];
if (isConstructorOrProto(o, key)) { return; }
if (o[key] === undefined) { o[key] = {}; }
if (
o[key] === Object.prototype
|| o[key] === Number.prototype
|| o[key] === String.prototype
) {
o[key] = {};
}
if (o[key] === Array.prototype) { o[key] = []; }
o = o[key];
}
var lastKey = keys[keys.length - 1];
if (isConstructorOrProto(o, lastKey)) { return; }
if (
o === Object.prototype
|| o === Number.prototype
|| o === String.prototype
) {
o = {};
}
if (o === Array.prototype) { o = []; }
if (o[lastKey] === undefined || flags.bools[lastKey] || typeof o[lastKey] === 'boolean') {
o[lastKey] = value;
} else if (Array.isArray(o[lastKey])) {
o[lastKey].push(value);
} else {
o[lastKey] = [o[lastKey], value];
}
}
function setArg(key, val, arg) {
if (arg && flags.unknownFn && !argDefined(key, arg)) {
if (flags.unknownFn(arg) === false) { return; }
}
var value = !flags.strings[key] && isNumber(val)
? Number(val)
: val;
setKey(argv, key.split('.'), value);
(aliases[key] || []).forEach(function (x) {
setKey(argv, x.split('.'), value);
});
}
Object.keys(flags.bools).forEach(function (key) {
setArg(key, defaults[key] === undefined ? false : defaults[key]);
});
var notFlags = [];
if (args.indexOf('--') !== -1) {
notFlags = args.slice(args.indexOf('--') + 1);
args = args.slice(0, args.indexOf('--'));
}
for (var i = 0; i < args.length; i++) {
var arg = args[i];
var key;
var next;
if ((/^--.+=/).test(arg)) {
// Using [\s\S] instead of . because js doesn't support the
// 'dotall' regex modifier. See:
// http://stackoverflow.com/a/1068308/13216
var m = arg.match(/^--([^=]+)=([\s\S]*)$/);
key = m[1];
var value = m[2];
if (flags.bools[key]) {
value = value !== 'false';
}
setArg(key, value, arg);
} else if ((/^--no-.+/).test(arg)) {
key = arg.match(/^--no-(.+)/)[1];
setArg(key, false, arg);
} else if ((/^--.+/).test(arg)) {
key = arg.match(/^--(.+)/)[1];
next = args[i + 1];
if (
next !== undefined
&& !(/^(-|--)[^-]/).test(next)
&& !flags.bools[key]
&& !flags.allBools
&& (aliases[key] ? !aliasIsBoolean(key) : true)
) {
setArg(key, next, arg);
i += 1;
} else if ((/^(true|false)$/).test(next)) {
setArg(key, next === 'true', arg);
i += 1;
} else {
setArg(key, flags.strings[key] ? '' : true, arg);
}
} else if ((/^-[^-]+/).test(arg)) {
var letters = arg.slice(1, -1).split('');
var broken = false;
for (var j = 0; j < letters.length; j++) {
next = arg.slice(j + 2);
if (next === '-') {
setArg(letters[j], next, arg);
continue;
}
if ((/[A-Za-z]/).test(letters[j]) && next[0] === '=') {
setArg(letters[j], next.slice(1), arg);
broken = true;
break;
}
if (
(/[A-Za-z]/).test(letters[j])
&& (/-?\d+(\.\d*)?(e-?\d+)?$/).test(next)
) {
setArg(letters[j], next, arg);
broken = true;
break;
}
if (letters[j + 1] && letters[j + 1].match(/\W/)) {
setArg(letters[j], arg.slice(j + 2), arg);
broken = true;
break;
} else {
setArg(letters[j], flags.strings[letters[j]] ? '' : true, arg);
}
}
key = arg.slice(-1)[0];
if (!broken && key !== '-') {
if (
args[i + 1]
&& !(/^(-|--)[^-]/).test(args[i + 1])
&& !flags.bools[key]
&& (aliases[key] ? !aliasIsBoolean(key) : true)
) {
setArg(key, args[i + 1], arg);
i += 1;
} else if (args[i + 1] && (/^(true|false)$/).test(args[i + 1])) {
setArg(key, args[i + 1] === 'true', arg);
i += 1;
} else {
setArg(key, flags.strings[key] ? '' : true, arg);
}
}
} else {
if (!flags.unknownFn || flags.unknownFn(arg) !== false) {
argv._.push(flags.strings._ || !isNumber(arg) ? arg : Number(arg));
}
if (opts.stopEarly) {
argv._.push.apply(argv._, args.slice(i + 1));
break;
}
}
}
Object.keys(defaults).forEach(function (k) {
if (!hasKey(argv, k.split('.'))) {
setKey(argv, k.split('.'), defaults[k]);
(aliases[k] || []).forEach(function (x) {
setKey(argv, x.split('.'), defaults[k]);
});
}
});
if (opts['--']) {
argv['--'] = notFlags.slice();
} else {
notFlags.forEach(function (k) {
argv._.push(k);
});
}
return argv;
};

View File

@@ -0,0 +1,6 @@
# Contributing to prebuild
- no commits direct to master
- all commits as pull requests (one or several per PR)
- each commit solves one identifiable problem
- never merge one's own PRs, another contributor does this

View File

@@ -0,0 +1,234 @@
/**
* 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
*/
import {
FrameworkContext,
RemixErrorBoundary,
RouterProvider,
createBrowserHistory,
createClientRoutes,
createClientRoutesWithHMRRevalidationOptOut,
createRouter,
decodeViaTurboStream,
deserializeErrors,
getPatchRoutesOnNavigationFunction,
getSingleFetchDataStrategy,
invariant,
mapRouteProperties,
matchRoutes,
shouldHydrateRouteLoader,
useFogOFWarDiscovery
} from "./chunk-ZIM7OIE3.mjs";
// lib/dom-export/dom-router-provider.tsx
import * as React from "react";
import * as ReactDOM from "react-dom";
function RouterProvider2(props) {
return /* @__PURE__ */ React.createElement(RouterProvider, { flushSync: ReactDOM.flushSync, ...props });
}
// lib/dom-export/hydrated-router.tsx
import * as React2 from "react";
var ssrInfo = null;
var router = null;
function initSsrInfo() {
if (!ssrInfo && window.__reactRouterContext && window.__reactRouterManifest && window.__reactRouterRouteModules) {
if (window.__reactRouterManifest.sri === true) {
const importMap = document.querySelector("script[rr-importmap]");
if (importMap?.textContent) {
try {
window.__reactRouterManifest.sri = JSON.parse(
importMap.textContent
).integrity;
} catch (err) {
console.error("Failed to parse import map", err);
}
}
}
ssrInfo = {
context: window.__reactRouterContext,
manifest: window.__reactRouterManifest,
routeModules: window.__reactRouterRouteModules,
stateDecodingPromise: void 0,
router: void 0,
routerInitialized: false
};
}
}
function createHydratedRouter({
unstable_getContext
}) {
initSsrInfo();
if (!ssrInfo) {
throw new Error(
"You must be using the SSR features of React Router in order to skip passing a `router` prop to `<RouterProvider>`"
);
}
let localSsrInfo = ssrInfo;
if (!ssrInfo.stateDecodingPromise) {
let stream = ssrInfo.context.stream;
invariant(stream, "No stream found for single fetch decoding");
ssrInfo.context.stream = void 0;
ssrInfo.stateDecodingPromise = decodeViaTurboStream(stream, window).then((value) => {
ssrInfo.context.state = value.value;
localSsrInfo.stateDecodingPromise.value = true;
}).catch((e) => {
localSsrInfo.stateDecodingPromise.error = e;
});
}
if (ssrInfo.stateDecodingPromise.error) {
throw ssrInfo.stateDecodingPromise.error;
}
if (!ssrInfo.stateDecodingPromise.value) {
throw ssrInfo.stateDecodingPromise;
}
let routes = createClientRoutes(
ssrInfo.manifest.routes,
ssrInfo.routeModules,
ssrInfo.context.state,
ssrInfo.context.ssr,
ssrInfo.context.isSpaMode
);
let hydrationData = void 0;
let loaderData = ssrInfo.context.state.loaderData;
if (ssrInfo.context.isSpaMode) {
if (ssrInfo.manifest.routes.root?.hasLoader && loaderData && "root" in loaderData) {
hydrationData = {
loaderData: {
root: loaderData.root
}
};
}
} else {
hydrationData = {
...ssrInfo.context.state,
loaderData: { ...loaderData }
};
let initialMatches = matchRoutes(
routes,
window.location,
window.__reactRouterContext?.basename
);
if (initialMatches) {
for (let match of initialMatches) {
let routeId = match.route.id;
let route = ssrInfo.routeModules[routeId];
let manifestRoute = ssrInfo.manifest.routes[routeId];
if (route && manifestRoute && shouldHydrateRouteLoader(
manifestRoute,
route,
ssrInfo.context.isSpaMode
) && (route.HydrateFallback || !manifestRoute.hasLoader)) {
delete hydrationData.loaderData[routeId];
} else if (manifestRoute && !manifestRoute.hasLoader) {
hydrationData.loaderData[routeId] = null;
}
}
}
if (hydrationData && hydrationData.errors) {
hydrationData.errors = deserializeErrors(hydrationData.errors);
}
}
let router2 = createRouter({
routes,
history: createBrowserHistory(),
basename: ssrInfo.context.basename,
unstable_getContext,
hydrationData,
mapRouteProperties,
future: {
unstable_middleware: ssrInfo.context.future.unstable_middleware
},
dataStrategy: getSingleFetchDataStrategy(
ssrInfo.manifest,
ssrInfo.routeModules,
ssrInfo.context.ssr,
ssrInfo.context.basename,
() => router2
),
patchRoutesOnNavigation: getPatchRoutesOnNavigationFunction(
ssrInfo.manifest,
ssrInfo.routeModules,
ssrInfo.context.ssr,
ssrInfo.context.isSpaMode,
ssrInfo.context.basename
)
});
ssrInfo.router = router2;
if (router2.state.initialized) {
ssrInfo.routerInitialized = true;
router2.initialize();
}
router2.createRoutesForHMR = /* spacer so ts-ignore does not affect the right hand of the assignment */
createClientRoutesWithHMRRevalidationOptOut;
window.__reactRouterDataRouter = router2;
return router2;
}
function HydratedRouter(props) {
if (!router) {
router = createHydratedRouter({
unstable_getContext: props.unstable_getContext
});
}
let [criticalCss, setCriticalCss] = React2.useState(
process.env.NODE_ENV === "development" ? ssrInfo?.context.criticalCss : void 0
);
if (process.env.NODE_ENV === "development") {
if (ssrInfo) {
window.__reactRouterClearCriticalCss = () => setCriticalCss(void 0);
}
}
let [location, setLocation] = React2.useState(router.state.location);
React2.useLayoutEffect(() => {
if (ssrInfo && ssrInfo.router && !ssrInfo.routerInitialized) {
ssrInfo.routerInitialized = true;
ssrInfo.router.initialize();
}
}, []);
React2.useLayoutEffect(() => {
if (ssrInfo && ssrInfo.router) {
return ssrInfo.router.subscribe((newState) => {
if (newState.location !== location) {
setLocation(newState.location);
}
});
}
}, [location]);
invariant(ssrInfo, "ssrInfo unavailable for HydratedRouter");
useFogOFWarDiscovery(
router,
ssrInfo.manifest,
ssrInfo.routeModules,
ssrInfo.context.ssr,
ssrInfo.context.isSpaMode
);
return (
// This fragment is important to ensure we match the <ServerRouter> JSX
// structure so that useId values hydrate correctly
/* @__PURE__ */ React2.createElement(React2.Fragment, null, /* @__PURE__ */ React2.createElement(
FrameworkContext.Provider,
{
value: {
manifest: ssrInfo.manifest,
routeModules: ssrInfo.routeModules,
future: ssrInfo.context.future,
criticalCss,
ssr: ssrInfo.context.ssr,
isSpaMode: ssrInfo.context.isSpaMode
}
},
/* @__PURE__ */ React2.createElement(RemixErrorBoundary, { location }, /* @__PURE__ */ React2.createElement(RouterProvider2, { router }))
), /* @__PURE__ */ React2.createElement(React2.Fragment, null))
);
}
export {
HydratedRouter,
RouterProvider2 as RouterProvider
};

View File

@@ -0,0 +1,54 @@
import { InferFileRouteTypes } from './fileRoute.cjs';
import { AddTrailingSlash, RemoveTrailingSlashes } from './link.cjs';
import { AnyRoute } from './route.cjs';
import { AnyRouter, TrailingSlashOption } from './router.cjs';
import { PartialMergeAll } from './utils.cjs';
export type ParseRoute<TRouteTree, TAcc = TRouteTree> = TRouteTree extends {
types: {
children: infer TChildren;
};
} ? unknown extends TChildren ? TAcc : TChildren extends ReadonlyArray<any> ? ParseRoute<TChildren[number], TAcc | TChildren[number]> : ParseRoute<TChildren[keyof TChildren], TAcc | TChildren[keyof TChildren]> : TAcc;
export type ParseRouteWithoutBranches<TRouteTree> = ParseRoute<TRouteTree> extends infer TRoute extends AnyRoute ? TRoute extends any ? unknown extends TRoute['types']['children'] ? TRoute : TRoute['types']['children'] extends ReadonlyArray<any> ? '/' extends TRoute['types']['children'][number]['path'] ? never : TRoute : '/' extends TRoute['types']['children'][keyof TRoute['types']['children']]['path'] ? never : TRoute : never : never;
export type CodeRoutesById<TRouteTree extends AnyRoute> = ParseRoute<TRouteTree> extends infer TRoutes extends AnyRoute ? {
[K in TRoutes as K['id']]: K;
} : never;
export type RoutesById<TRouteTree extends AnyRoute> = InferFileRouteTypes<TRouteTree> extends never ? CodeRoutesById<TRouteTree> : InferFileRouteTypes<TRouteTree>['fileRoutesById'];
export type RouteById<TRouteTree extends AnyRoute, TId> = Extract<RoutesById<TRouteTree>[TId & keyof RoutesById<TRouteTree>], AnyRoute>;
export type CodeRouteIds<TRouteTree extends AnyRoute> = ParseRoute<TRouteTree> extends infer TRoutes extends AnyRoute ? TRoutes['id'] : never;
export type RouteIds<TRouteTree extends AnyRoute> = InferFileRouteTypes<TRouteTree> extends never ? CodeRouteIds<TRouteTree> : InferFileRouteTypes<TRouteTree>['id'];
export type ParentPath<TRouter extends AnyRouter> = TrailingSlashOptionByRouter<TRouter> extends 'always' ? '../' : TrailingSlashOptionByRouter<TRouter> extends 'never' ? '..' : '../' | '..';
export type CurrentPath<TRouter extends AnyRouter> = TrailingSlashOptionByRouter<TRouter> extends 'always' ? './' : TrailingSlashOptionByRouter<TRouter> extends 'never' ? '.' : './' | '.';
export type ToPath<TRouter extends AnyRouter, TTo extends string> = TrailingSlashOptionByRouter<TRouter> extends 'always' ? AddTrailingSlash<TTo> : TrailingSlashOptionByRouter<TRouter> extends 'never' ? RemoveTrailingSlashes<TTo> : AddTrailingSlash<TTo> | RemoveTrailingSlashes<TTo>;
export type CatchAllPaths<TRouter extends AnyRouter> = CurrentPath<TRouter> | ParentPath<TRouter>;
export type CodeRoutesByPath<TRouteTree extends AnyRoute> = ParseRoute<TRouteTree> extends infer TRoutes extends AnyRoute ? {
[K in TRoutes as K['fullPath']]: K;
} : never;
export type RoutesByPath<TRouteTree extends AnyRoute> = InferFileRouteTypes<TRouteTree> extends never ? CodeRoutesByPath<TRouteTree> : InferFileRouteTypes<TRouteTree>['fileRoutesByFullPath'];
export type RouteByPath<TRouteTree extends AnyRoute, TPath> = Extract<RoutesByPath<TRouteTree>[TPath & keyof RoutesByPath<TRouteTree>], AnyRoute>;
export type CodeRoutePaths<TRouteTree extends AnyRoute> = ParseRoute<TRouteTree> extends infer TRoutes extends AnyRoute ? TRoutes['fullPath'] : never;
export type RoutePaths<TRouteTree extends AnyRoute> = unknown extends TRouteTree ? string : (InferFileRouteTypes<TRouteTree> extends never ? CodeRoutePaths<TRouteTree> : InferFileRouteTypes<TRouteTree>['fullPaths']) | '/';
export type RouteToPathAlwaysTrailingSlash<TRoute extends AnyRoute> = TRoute['path'] extends '/' ? TRoute['fullPath'] : TRoute['fullPath'] extends '/' ? TRoute['fullPath'] : `${TRoute['fullPath']}/`;
export type RouteToPathNeverTrailingSlash<TRoute extends AnyRoute> = TRoute['path'] extends '/' ? TRoute['fullPath'] extends '/' ? TRoute['fullPath'] : RemoveTrailingSlashes<TRoute['fullPath']> : TRoute['fullPath'];
export type RouteToPathPreserveTrailingSlash<TRoute extends AnyRoute> = RouteToPathNeverTrailingSlash<TRoute> | RouteToPathAlwaysTrailingSlash<TRoute>;
export type RouteToPathByTrailingSlashOption<TRoute extends AnyRoute> = {
always: RouteToPathAlwaysTrailingSlash<TRoute>;
preserve: RouteToPathPreserveTrailingSlash<TRoute>;
never: RouteToPathNeverTrailingSlash<TRoute>;
};
export type TrailingSlashOptionByRouter<TRouter extends AnyRouter> = TrailingSlashOption extends TRouter['options']['trailingSlash'] ? 'never' : NonNullable<TRouter['options']['trailingSlash']>;
export type RouteToByRouter<TRouter extends AnyRouter, TRoute extends AnyRoute> = RouteToPathByTrailingSlashOption<TRoute>[TrailingSlashOptionByRouter<TRouter>];
export type CodeRouteToPath<TRouter extends AnyRouter> = ParseRouteWithoutBranches<TRouter['routeTree']> extends infer TRoute extends AnyRoute ? TRoute extends any ? RouteToByRouter<TRouter, TRoute> : never : never;
export type FileRouteToPath<TRouter extends AnyRouter, TTo = InferFileRouteTypes<TRouter['routeTree']>['to'], TTrailingSlashOption = TrailingSlashOptionByRouter<TRouter>> = 'never' extends TTrailingSlashOption ? TTo : 'always' extends TTrailingSlashOption ? AddTrailingSlash<TTo> : TTo | AddTrailingSlash<TTo>;
export type RouteToPath<TRouter extends AnyRouter> = unknown extends TRouter ? string : InferFileRouteTypes<TRouter['routeTree']> extends never ? CodeRouteToPath<TRouter> : FileRouteToPath<TRouter>;
export type CodeRoutesByToPath<TRouter extends AnyRouter> = ParseRouteWithoutBranches<TRouter['routeTree']> extends infer TRoutes extends AnyRoute ? {
[TRoute in TRoutes as RouteToByRouter<TRouter, TRoute>]: TRoute;
} : never;
export type RoutesByToPath<TRouter extends AnyRouter> = InferFileRouteTypes<TRouter['routeTree']> extends never ? CodeRoutesByToPath<TRouter> : InferFileRouteTypes<TRouter['routeTree']>['fileRoutesByTo'];
export type CodeRouteByToPath<TRouter extends AnyRouter, TTo> = Extract<RoutesByToPath<TRouter>[TTo & keyof RoutesByToPath<TRouter>], AnyRoute>;
export type FileRouteByToPath<TRouter extends AnyRouter, TTo> = 'never' extends TrailingSlashOptionByRouter<TRouter> ? CodeRouteByToPath<TRouter, TTo> : 'always' extends TrailingSlashOptionByRouter<TRouter> ? TTo extends '/' ? CodeRouteByToPath<TRouter, TTo> : TTo extends `${infer TPath}/` ? CodeRouteByToPath<TRouter, TPath> : never : CodeRouteByToPath<TRouter, TTo extends '/' ? TTo : RemoveTrailingSlashes<TTo>>;
export type RouteByToPath<TRouter extends AnyRouter, TTo> = InferFileRouteTypes<TRouter['routeTree']> extends never ? CodeRouteByToPath<TRouter, TTo> : FileRouteByToPath<TRouter, TTo>;
export type FullSearchSchema<TRouteTree extends AnyRoute> = ParseRoute<TRouteTree> extends infer TRoutes extends AnyRoute ? PartialMergeAll<TRoutes['types']['fullSearchSchema']> : never;
export type FullSearchSchemaInput<TRouteTree extends AnyRoute> = ParseRoute<TRouteTree> extends infer TRoutes extends AnyRoute ? PartialMergeAll<TRoutes['types']['fullSearchSchemaInput']> : never;
export type AllParams<TRouteTree extends AnyRoute> = ParseRoute<TRouteTree> extends infer TRoutes extends AnyRoute ? PartialMergeAll<TRoutes['types']['allParams']> : never;
export type AllContext<TRouteTree extends AnyRoute> = ParseRoute<TRouteTree> extends infer TRoutes extends AnyRoute ? PartialMergeAll<TRoutes['types']['allContext']> : never;
export type AllLoaderData<TRouteTree extends AnyRoute> = ParseRoute<TRouteTree> extends infer TRoutes extends AnyRoute ? PartialMergeAll<TRoutes['types']['loaderData']> : never;

View File

@@ -0,0 +1 @@
module.exports={A:{A:{"2":"K D E F A B 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 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 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 qC rC"},D:{"1":"0 9 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","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"},E:{"1":"E F A B C L M G 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 D sC SC tC uC vC"},F:{"1":"0 1 2 3 4 5 6 7 8 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","2":"F B C G 4C 5C 6C 7C FC kC 8C GC"},G:{"1":"E 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 CD"},H:{"2":"WD"},I:{"1":"I bD cD","2":"LC J XD YD ZD aD lC"},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 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:"document.currentScript",D:true};

View File

@@ -0,0 +1,62 @@
/**
* @fileoverview Rule to flag when using constructor for wrapper objects
* @author Ilya Volodin
*/
"use strict";
//------------------------------------------------------------------------------
// Requirements
//------------------------------------------------------------------------------
const { getVariableByName } = require("./utils/ast-utils");
//------------------------------------------------------------------------------
// Rule Definition
//------------------------------------------------------------------------------
/** @type {import('../shared/types').Rule} */
module.exports = {
meta: {
type: "suggestion",
docs: {
description:
"Disallow `new` operators with the `String`, `Number`, and `Boolean` objects",
recommended: false,
url: "https://eslint.org/docs/latest/rules/no-new-wrappers",
},
schema: [],
messages: {
noConstructor: "Do not use {{fn}} as a constructor.",
},
},
create(context) {
const { sourceCode } = context;
return {
NewExpression(node) {
const wrapperObjects = ["String", "Number", "Boolean"];
const { name } = node.callee;
if (wrapperObjects.includes(name)) {
const variable = getVariableByName(
sourceCode.getScope(node),
name,
);
if (variable && variable.identifiers.length === 0) {
context.report({
node,
messageId: "noConstructor",
data: { fn: name },
});
}
}
},
};
},
};