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={A:{A:{"132":"K D E F A B mC"},B:{"1":"CB DB EB FB GB HB IB JB KB LB MB NB OB I","2":"C L M G N O P","292":"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"},C:{"1":"0 9 zB 0B 1B 2B 3B 4B 5B 6B 7B 8B 9B AC BC CC DC Q H R OC S T U V W X Y Z a b c d e f g h i j k l m n o p q r s t u v w x y z AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB I PC EC QC RC oC pC","2":"1 2 3 4 5 6 7 8 nC LC J PB K D E F A B C L M G N O P QB RB SB TB UB VB WB XB YB ZB aB bB cB dB eB fB gB hB iB jB kB lB mB nB oB pB qB rB sB tB uB vB MC wB NC xB qC rC","3138":"yB"},D:{"1":"CB DB EB FB GB HB IB JB KB LB MB NB OB I PC EC QC RC","292":"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"},E:{"16":"J PB sC SC","292":"K D E F A B C L M G tC 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"},F:{"1":"0 q r s t u v w x y z","2":"F B C 4C 5C 6C 7C FC kC 8C GC","292":"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 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"},G:{"2":"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","16":"SC 9C lC AD BD","292":"CD","804":"E DD ED FD GD HD ID JD KD LD MD ND OD PD"},H:{"2":"WD"},I:{"16":"XD YD","292":"LC J I ZD aD lC bD cD"},J:{"292":"D A"},K:{"2":"A B C FC kC GC","292":"H"},L:{"1":"I"},M:{"1":"EC"},N:{"2":"A B"},O:{"292":"HC"},P:{"1":"6 7 8","292":"1 2 3 4 5 J dD eD fD gD hD TC iD jD kD lD mD IC JC KC nD"},Q:{"292":"oD"},R:{"292":"pD"},S:{"2":"qD rD"}},B:4,C:"CSS scrollbar styling",D:true};

View File

@@ -0,0 +1 @@
module.exports={C:{"77":0.00138,"78":0.02202,"89":0.00344,"115":0.03027,"125":0.00138,"126":0.01032,"128":0.00206,"130":0.00206,"134":0.00206,"135":0.05022,"136":0.26832,_:"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 72 73 74 75 76 79 80 81 82 83 84 85 86 87 88 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 121 122 123 124 127 129 131 132 133 137 138 139 140 3.5 3.6"},D:{"39":0.00206,"40":0.00138,"43":0.00138,"44":0.00138,"46":0.00138,"51":0.00138,"53":0.00138,"54":0.00138,"55":0.00138,"56":0.00482,"57":0.00206,"59":0.00138,"60":0.00138,"69":0.00138,"70":0.00138,"73":0.00482,"81":0.01514,"83":0.00482,"87":0.00688,"91":0.01032,"95":0.00619,"101":0.00206,"102":0.00138,"103":0.0117,"105":0.00344,"109":0.03853,"110":0.00138,"111":0.00138,"113":0.00206,"114":0.00826,"115":0.12522,"116":0.03715,"117":0.00138,"118":0.00619,"119":0.09357,"120":0.01651,"121":0.00138,"123":0.00138,"124":0.00206,"125":0.00482,"126":0.02958,"128":0.31373,"129":0.01858,"130":0.02133,"131":0.03371,"132":0.07637,"133":0.95288,"134":1.47782,_:"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 41 42 45 47 48 49 50 52 58 61 62 63 64 65 66 67 68 71 72 74 75 76 77 78 79 80 84 85 86 88 89 90 92 93 94 96 97 98 99 100 104 106 107 108 112 122 127 135 136 137 138"},F:{"46":0.00482,"84":0.00138,"95":0.00963,"116":0.03509,"117":0.08669,_:"9 11 12 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 47 48 49 50 51 52 53 54 55 56 57 58 60 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 85 86 87 88 89 90 91 92 93 94 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 9.5-9.6 10.0-10.1 10.5 10.6 11.1 11.5 11.6 12.1"},B:{"18":0.00138,"92":0.00344,"109":0.00206,"115":0.00482,"125":0.00138,"127":0.00138,"129":0.00138,"130":0.00688,"131":0.04541,"132":0.01514,"133":0.2752,"134":0.90059,_:"12 13 14 15 16 17 79 80 81 83 84 85 86 87 88 89 90 91 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 110 111 112 113 114 116 117 118 119 120 121 122 123 124 126 128"},E:{"14":0.00138,_:"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 13.1 15.2-15.3 15.4 15.5 16.2 16.4 17.0 17.3 17.4","14.1":0.00138,"15.1":0.00138,"15.6":0.01032,"16.0":0.00138,"16.1":0.00344,"16.3":0.00344,"16.5":0.00963,"16.6":0.13554,"17.1":0.00138,"17.2":0.00206,"17.5":0.02546,"17.6":0.05848,"18.0":0.00963,"18.1":0.01789,"18.2":0.00344,"18.3":0.27314,"18.4":0.00619},G:{"8":0,"3.2":0,"4.0-4.1":0,"4.2-4.3":0.00112,"5.0-5.1":0,"6.0-6.1":0.00337,"7.0-7.1":0.00225,"8.1-8.4":0,"9.0-9.2":0.00169,"9.3":0.00787,"10.0-10.2":0.00056,"10.3":0.01294,"11.0-11.2":0.05962,"11.3-11.4":0.00394,"12.0-12.1":0.00225,"12.2-12.5":0.05568,"13.0-13.1":0.00112,"13.2":0.00169,"13.3":0.00225,"13.4-13.7":0.00787,"14.0-14.4":0.01969,"14.5-14.8":0.02362,"15.0-15.1":0.01294,"15.2-15.3":0.01294,"15.4":0.01575,"15.5":0.018,"15.6-15.8":0.2216,"16.0":0.0315,"16.1":0.06468,"16.2":0.03375,"16.3":0.05849,"16.4":0.01294,"16.5":0.02419,"16.6-16.7":0.26266,"17.0":0.01575,"17.1":0.02812,"17.2":0.02137,"17.3":0.02981,"17.4":0.05962,"17.5":0.13274,"17.6-17.7":0.38527,"18.0":0.10799,"18.1":0.35322,"18.2":0.15805,"18.3":3.30324,"18.4":0.04893},P:{"4":0.02032,"21":0.01016,"22":0.05079,"23":0.07111,"24":0.15238,"25":0.03048,"26":0.18285,"27":0.56888,_:"20 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","7.2-7.4":0.02032,"19.0":0.01016},I:{"0":0.04646,"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.00005},K:{"0":0.05587,_:"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.06518},Q:{_:"14.9"},O:{_:"0"},H:{"0":0},L:{"0":87.15368}};

View File

@@ -0,0 +1,7 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = Message;
const jsx_runtime_1 = require("react/jsx-runtime");
function Message({ children, type }) {
return (0, jsx_runtime_1.jsx)("div", { className: `react-pdf__message react-pdf__message--${type}`, children: children });
}

View File

@@ -0,0 +1,124 @@
/**
* @fileoverview `ConfigDependency` class.
*
* `ConfigDependency` class expresses a loaded parser or plugin.
*
* If the parser or plugin was loaded successfully, it has `definition` property
* and `filePath` property. Otherwise, it has `error` property.
*
* When `JSON.stringify()` converted a `ConfigDependency` object to a JSON, it
* omits `definition` property.
*
* `ConfigArrayFactory` creates `ConfigDependency` objects when it loads parsers
* or plugins.
*
* @author Toru Nagashima <https://github.com/mysticatea>
*/
import util from "node:util";
/**
* The class is to store parsers or plugins.
* This class hides the loaded object from `JSON.stringify()` and `console.log`.
* @template T
*/
class ConfigDependency {
/**
* Initialize this instance.
* @param {Object} data The dependency data.
* @param {T} [data.definition] The dependency if the loading succeeded.
* @param {T} [data.original] The original, non-normalized dependency if the loading succeeded.
* @param {Error} [data.error] The error object if the loading failed.
* @param {string} [data.filePath] The actual path to the dependency if the loading succeeded.
* @param {string} data.id The ID of this dependency.
* @param {string} data.importerName The name of the config file which loads this dependency.
* @param {string} data.importerPath The path to the config file which loads this dependency.
*/
constructor({
definition = null,
original = null,
error = null,
filePath = null,
id,
importerName,
importerPath
}) {
/**
* The loaded dependency if the loading succeeded.
* @type {T|null}
*/
this.definition = definition;
/**
* The original dependency as loaded directly from disk if the loading succeeded.
* @type {T|null}
*/
this.original = original;
/**
* The error object if the loading failed.
* @type {Error|null}
*/
this.error = error;
/**
* The loaded dependency if the loading succeeded.
* @type {string|null}
*/
this.filePath = filePath;
/**
* The ID of this dependency.
* @type {string}
*/
this.id = id;
/**
* The name of the config file which loads this dependency.
* @type {string}
*/
this.importerName = importerName;
/**
* The path to the config file which loads this dependency.
* @type {string}
*/
this.importerPath = importerPath;
}
/**
* Converts this instance to a JSON compatible object.
* @returns {Object} a JSON compatible object.
*/
toJSON() {
const obj = this[util.inspect.custom]();
// Display `error.message` (`Error#message` is unenumerable).
if (obj.error instanceof Error) {
obj.error = { ...obj.error, message: obj.error.message };
}
return obj;
}
/**
* Custom inspect method for Node.js `console.log()`.
* @returns {Object} an object to display by `console.log()`.
*/
[util.inspect.custom]() {
const {
definition: _ignore1, // eslint-disable-line no-unused-vars -- needed to make `obj` correct
original: _ignore2, // eslint-disable-line no-unused-vars -- needed to make `obj` correct
...obj
} = this;
return obj;
}
}
/** @typedef {ConfigDependency<import("../../shared/types").Parser>} DependentParser */
/** @typedef {ConfigDependency<import("../../shared/types").Plugin>} DependentPlugin */
export { ConfigDependency };

View File

@@ -0,0 +1 @@
{"version":3,"names":["_classPrivateFieldGet","require","_classExtractFieldDescriptor","receiver","privateMap","classPrivateFieldGet2"],"sources":["../../src/helpers/classExtractFieldDescriptor.js"],"sourcesContent":["/* @minVersion 7.13.10 */\n/* @onlyBabel7 */\n\nimport classPrivateFieldGet2 from \"classPrivateFieldGet2\";\n\nexport default function _classExtractFieldDescriptor(receiver, privateMap) {\n return classPrivateFieldGet2(privateMap, receiver);\n}\n"],"mappings":";;;;;;AAGA,IAAAA,qBAAA,GAAAC,OAAA;AAEe,SAASC,4BAA4BA,CAACC,QAAQ,EAAEC,UAAU,EAAE;EACzE,OAAOC,qBAAqB,CAACD,UAAU,EAAED,QAAQ,CAAC;AACpD","ignoreList":[]}

View File

@@ -0,0 +1,168 @@
/**
* @fileoverview Rule to enforce spacing around embedded expressions of template strings
* @author Toru Nagashima
* @deprecated in ESLint v8.53.0
*/
"use strict";
//------------------------------------------------------------------------------
// Requirements
//------------------------------------------------------------------------------
const astUtils = require("./utils/ast-utils");
//------------------------------------------------------------------------------
// Rule Definition
//------------------------------------------------------------------------------
/** @type {import('../shared/types').Rule} */
module.exports = {
meta: {
deprecated: {
message: "Formatting rules are being moved out of ESLint core.",
url: "https://eslint.org/blog/2023/10/deprecating-formatting-rules/",
deprecatedSince: "8.53.0",
availableUntil: "10.0.0",
replacedBy: [
{
message:
"ESLint Stylistic now maintains deprecated stylistic core rules.",
url: "https://eslint.style/guide/migration",
plugin: {
name: "@stylistic/eslint-plugin-js",
url: "https://eslint.style/packages/js",
},
rule: {
name: "template-curly-spacing",
url: "https://eslint.style/rules/js/template-curly-spacing",
},
},
],
},
type: "layout",
docs: {
description:
"Require or disallow spacing around embedded expressions of template strings",
recommended: false,
url: "https://eslint.org/docs/latest/rules/template-curly-spacing",
},
fixable: "whitespace",
schema: [{ enum: ["always", "never"] }],
messages: {
expectedBefore: "Expected space(s) before '}'.",
expectedAfter: "Expected space(s) after '${'.",
unexpectedBefore: "Unexpected space(s) before '}'.",
unexpectedAfter: "Unexpected space(s) after '${'.",
},
},
create(context) {
const sourceCode = context.sourceCode;
const always = context.options[0] === "always";
/**
* Checks spacing before `}` of a given token.
* @param {Token} token A token to check. This is a Template token.
* @returns {void}
*/
function checkSpacingBefore(token) {
if (!token.value.startsWith("}")) {
return; // starts with a backtick, this is the first template element in the template literal
}
const prevToken = sourceCode.getTokenBefore(token, {
includeComments: true,
}),
hasSpace = sourceCode.isSpaceBetween(prevToken, token);
if (!astUtils.isTokenOnSameLine(prevToken, token)) {
return;
}
if (always && !hasSpace) {
context.report({
loc: {
start: token.loc.start,
end: {
line: token.loc.start.line,
column: token.loc.start.column + 1,
},
},
messageId: "expectedBefore",
fix: fixer => fixer.insertTextBefore(token, " "),
});
}
if (!always && hasSpace) {
context.report({
loc: {
start: prevToken.loc.end,
end: token.loc.start,
},
messageId: "unexpectedBefore",
fix: fixer =>
fixer.removeRange([prevToken.range[1], token.range[0]]),
});
}
}
/**
* Checks spacing after `${` of a given token.
* @param {Token} token A token to check. This is a Template token.
* @returns {void}
*/
function checkSpacingAfter(token) {
if (!token.value.endsWith("${")) {
return; // ends with a backtick, this is the last template element in the template literal
}
const nextToken = sourceCode.getTokenAfter(token, {
includeComments: true,
}),
hasSpace = sourceCode.isSpaceBetween(token, nextToken);
if (!astUtils.isTokenOnSameLine(token, nextToken)) {
return;
}
if (always && !hasSpace) {
context.report({
loc: {
start: {
line: token.loc.end.line,
column: token.loc.end.column - 2,
},
end: token.loc.end,
},
messageId: "expectedAfter",
fix: fixer => fixer.insertTextAfter(token, " "),
});
}
if (!always && hasSpace) {
context.report({
loc: {
start: token.loc.end,
end: nextToken.loc.start,
},
messageId: "unexpectedAfter",
fix: fixer =>
fixer.removeRange([token.range[1], nextToken.range[0]]),
});
}
}
return {
TemplateElement(node) {
const token = sourceCode.getFirstToken(node);
checkSpacingBefore(token);
checkSpacingAfter(token);
},
};
},
};

View File

@@ -0,0 +1 @@
{"version":3,"names":["hooks","exports","self","parent","removeParent","key","isWhile","isSwitchCase","isExportDeclaration","isLabeledStatement","listKey","isVariableDeclaration","node","declarations","length","isExpressionStatement","remove","isSequenceExpression","expressions","replaceWith","isBinary","right","left","isIfStatement","isLoop","isArrowFunctionExpression","type","body"],"sources":["../../../src/path/lib/removal-hooks.ts"],"sourcesContent":["// this file contains hooks that handle ancestry cleanup of parent nodes when removing children\n\nimport type NodePath from \"../index.ts\";\nimport type * as t from \"@babel/types\";\n/**\n * Pre hooks should be used for either rejecting removal or delegating removal\n */\n\nexport const hooks = [\n function (self: NodePath, parent: NodePath) {\n const removeParent =\n // while (NODE);\n // removing the test of a while/switch, we can either just remove it entirely *or* turn the\n // `test` into `true` unlikely that the latter will ever be what's wanted so we just remove\n // the loop to avoid infinite recursion\n (self.key === \"test\" && (parent.isWhile() || parent.isSwitchCase())) ||\n // export NODE;\n // just remove a declaration for an export as this is no longer valid\n (self.key === \"declaration\" && parent.isExportDeclaration()) ||\n // label: NODE\n // stray labeled statement with no body\n (self.key === \"body\" && parent.isLabeledStatement()) ||\n // let NODE;\n // remove an entire declaration if there are no declarators left\n (self.listKey === \"declarations\" &&\n parent.isVariableDeclaration() &&\n parent.node.declarations.length === 1) ||\n // NODE;\n // remove the entire expression statement if there's no expression\n (self.key === \"expression\" && parent.isExpressionStatement());\n\n if (removeParent) {\n parent.remove();\n return true;\n }\n },\n\n function (self: NodePath, parent: NodePath) {\n if (parent.isSequenceExpression() && parent.node.expressions.length === 1) {\n // (node, NODE);\n // we've just removed the second element of a sequence expression so let's turn that sequence\n // expression into a regular expression\n parent.replaceWith(parent.node.expressions[0]);\n return true;\n }\n },\n\n function (self: NodePath, parent: NodePath) {\n if (parent.isBinary()) {\n // left + NODE;\n // NODE + right;\n // we're in a binary expression, better remove it and replace it with the last expression\n if (self.key === \"left\") {\n parent.replaceWith(parent.node.right);\n } else {\n // key === \"right\"\n parent.replaceWith(parent.node.left);\n }\n return true;\n }\n },\n\n function (self: NodePath, parent: NodePath) {\n if (\n (parent.isIfStatement() && self.key === \"consequent\") ||\n (self.key === \"body\" &&\n (parent.isLoop() || parent.isArrowFunctionExpression()))\n ) {\n self.replaceWith({\n type: \"BlockStatement\",\n body: [],\n } as t.BlockStatement);\n return true;\n }\n },\n];\n"],"mappings":";;;;;;AAQO,MAAMA,KAAK,GAAAC,OAAA,CAAAD,KAAA,GAAG,CACnB,UAAUE,IAAc,EAAEC,MAAgB,EAAE;EAC1C,MAAMC,YAAY,GAKfF,IAAI,CAACG,GAAG,KAAK,MAAM,KAAKF,MAAM,CAACG,OAAO,CAAC,CAAC,IAAIH,MAAM,CAACI,YAAY,CAAC,CAAC,CAAC,IAGlEL,IAAI,CAACG,GAAG,KAAK,aAAa,IAAIF,MAAM,CAACK,mBAAmB,CAAC,CAAE,IAG3DN,IAAI,CAACG,GAAG,KAAK,MAAM,IAAIF,MAAM,CAACM,kBAAkB,CAAC,CAAE,IAGnDP,IAAI,CAACQ,OAAO,KAAK,cAAc,IAC9BP,MAAM,CAACQ,qBAAqB,CAAC,CAAC,IAC9BR,MAAM,CAACS,IAAI,CAACC,YAAY,CAACC,MAAM,KAAK,CAAE,IAGvCZ,IAAI,CAACG,GAAG,KAAK,YAAY,IAAIF,MAAM,CAACY,qBAAqB,CAAC,CAAE;EAE/D,IAAIX,YAAY,EAAE;IAChBD,MAAM,CAACa,MAAM,CAAC,CAAC;IACf,OAAO,IAAI;EACb;AACF,CAAC,EAED,UAAUd,IAAc,EAAEC,MAAgB,EAAE;EAC1C,IAAIA,MAAM,CAACc,oBAAoB,CAAC,CAAC,IAAId,MAAM,CAACS,IAAI,CAACM,WAAW,CAACJ,MAAM,KAAK,CAAC,EAAE;IAIzEX,MAAM,CAACgB,WAAW,CAAChB,MAAM,CAACS,IAAI,CAACM,WAAW,CAAC,CAAC,CAAC,CAAC;IAC9C,OAAO,IAAI;EACb;AACF,CAAC,EAED,UAAUhB,IAAc,EAAEC,MAAgB,EAAE;EAC1C,IAAIA,MAAM,CAACiB,QAAQ,CAAC,CAAC,EAAE;IAIrB,IAAIlB,IAAI,CAACG,GAAG,KAAK,MAAM,EAAE;MACvBF,MAAM,CAACgB,WAAW,CAAChB,MAAM,CAACS,IAAI,CAACS,KAAK,CAAC;IACvC,CAAC,MAAM;MAELlB,MAAM,CAACgB,WAAW,CAAChB,MAAM,CAACS,IAAI,CAACU,IAAI,CAAC;IACtC;IACA,OAAO,IAAI;EACb;AACF,CAAC,EAED,UAAUpB,IAAc,EAAEC,MAAgB,EAAE;EAC1C,IACGA,MAAM,CAACoB,aAAa,CAAC,CAAC,IAAIrB,IAAI,CAACG,GAAG,KAAK,YAAY,IACnDH,IAAI,CAACG,GAAG,KAAK,MAAM,KACjBF,MAAM,CAACqB,MAAM,CAAC,CAAC,IAAIrB,MAAM,CAACsB,yBAAyB,CAAC,CAAC,CAAE,EAC1D;IACAvB,IAAI,CAACiB,WAAW,CAAC;MACfO,IAAI,EAAE,gBAAgB;MACtBC,IAAI,EAAE;IACR,CAAqB,CAAC;IACtB,OAAO,IAAI;EACb;AACF,CAAC,CACF","ignoreList":[]}

View File

@@ -0,0 +1,169 @@
/**
* @fileoverview Rule to disallow unnecessary labels
* @author Toru Nagashima
*/
"use strict";
//------------------------------------------------------------------------------
// Requirements
//------------------------------------------------------------------------------
const astUtils = require("./utils/ast-utils");
//------------------------------------------------------------------------------
// Rule Definition
//------------------------------------------------------------------------------
/** @type {import('../shared/types').Rule} */
module.exports = {
meta: {
type: "suggestion",
docs: {
description: "Disallow unnecessary labels",
recommended: false,
frozen: true,
url: "https://eslint.org/docs/latest/rules/no-extra-label",
},
schema: [],
fixable: "code",
messages: {
unexpected: "This label '{{name}}' is unnecessary.",
},
},
create(context) {
const sourceCode = context.sourceCode;
let scopeInfo = null;
/**
* Creates a new scope with a breakable statement.
* @param {ASTNode} node A node to create. This is a BreakableStatement.
* @returns {void}
*/
function enterBreakableStatement(node) {
scopeInfo = {
label:
node.parent.type === "LabeledStatement"
? node.parent.label
: null,
breakable: true,
upper: scopeInfo,
};
}
/**
* Removes the top scope of the stack.
* @returns {void}
*/
function exitBreakableStatement() {
scopeInfo = scopeInfo.upper;
}
/**
* Creates a new scope with a labeled statement.
*
* This ignores it if the body is a breakable statement.
* In this case it's handled in the `enterBreakableStatement` function.
* @param {ASTNode} node A node to create. This is a LabeledStatement.
* @returns {void}
*/
function enterLabeledStatement(node) {
if (!astUtils.isBreakableStatement(node.body)) {
scopeInfo = {
label: node.label,
breakable: false,
upper: scopeInfo,
};
}
}
/**
* Removes the top scope of the stack.
*
* This ignores it if the body is a breakable statement.
* In this case it's handled in the `exitBreakableStatement` function.
* @param {ASTNode} node A node. This is a LabeledStatement.
* @returns {void}
*/
function exitLabeledStatement(node) {
if (!astUtils.isBreakableStatement(node.body)) {
scopeInfo = scopeInfo.upper;
}
}
/**
* Reports a given control node if it's unnecessary.
* @param {ASTNode} node A node. This is a BreakStatement or a
* ContinueStatement.
* @returns {void}
*/
function reportIfUnnecessary(node) {
if (!node.label) {
return;
}
const labelNode = node.label;
for (let info = scopeInfo; info !== null; info = info.upper) {
if (
info.breakable ||
(info.label && info.label.name === labelNode.name)
) {
if (
info.breakable &&
info.label &&
info.label.name === labelNode.name
) {
context.report({
node: labelNode,
messageId: "unexpected",
data: labelNode,
fix(fixer) {
const breakOrContinueToken =
sourceCode.getFirstToken(node);
if (
sourceCode.commentsExistBetween(
breakOrContinueToken,
labelNode,
)
) {
return null;
}
return fixer.removeRange([
breakOrContinueToken.range[1],
labelNode.range[1],
]);
},
});
}
return;
}
}
}
return {
WhileStatement: enterBreakableStatement,
"WhileStatement:exit": exitBreakableStatement,
DoWhileStatement: enterBreakableStatement,
"DoWhileStatement:exit": exitBreakableStatement,
ForStatement: enterBreakableStatement,
"ForStatement:exit": exitBreakableStatement,
ForInStatement: enterBreakableStatement,
"ForInStatement:exit": exitBreakableStatement,
ForOfStatement: enterBreakableStatement,
"ForOfStatement:exit": exitBreakableStatement,
SwitchStatement: enterBreakableStatement,
"SwitchStatement:exit": exitBreakableStatement,
LabeledStatement: enterLabeledStatement,
"LabeledStatement:exit": exitLabeledStatement,
BreakStatement: reportIfUnnecessary,
ContinueStatement: reportIfUnnecessary,
};
},
};

View File

@@ -0,0 +1,15 @@
'use strict';
var shallow = require('zustand/vanilla/shallow');
var shallow$1 = require('zustand/react/shallow');
Object.defineProperty(exports, "shallow", {
enumerable: true,
get: function () { return shallow.shallow; }
});
Object.defineProperty(exports, "useShallow", {
enumerable: true,
get: function () { return shallow$1.useShallow; }
});

View File

@@ -0,0 +1 @@
module.exports={C:{"45":0.007,"86":0.04202,"108":0.0035,"110":0.007,"113":0.007,"115":0.01751,"128":0.04903,"132":0.0035,"133":0.007,"134":0.08055,"135":0.29417,"136":1.744,"137":0.01751,_:"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 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 109 111 112 114 116 117 118 119 120 121 122 123 124 125 126 127 129 130 131 138 139 140 3.5 3.6"},D:{"44":0.0035,"57":0.0035,"59":0.007,"71":0.05603,"78":0.0035,"88":0.03502,"103":0.01751,"107":0.02101,"109":0.27666,"110":0.0035,"111":0.29067,"112":0.11557,"114":0.01751,"115":0.0035,"116":0.08755,"117":0.0035,"118":0.03852,"119":0.01751,"120":0.03152,"121":0.08755,"122":0.05603,"123":0.09105,"124":0.04202,"125":0.03152,"126":0.44826,"127":0.04903,"128":0.14358,"129":0.05253,"130":0.09105,"131":0.41674,"132":0.42374,"133":5.2565,"134":10.69861,"135":0.03152,_:"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 45 46 47 48 49 50 51 52 53 54 55 56 58 60 61 62 63 64 65 66 67 68 69 70 72 73 74 75 76 77 79 80 81 83 84 85 86 87 89 90 91 92 93 94 95 96 97 98 99 100 101 102 104 105 106 108 113 136 137 138"},F:{"87":0.0035,"115":0.01401,"116":0.02802,"117":0.38172,_:"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 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 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 9.5-9.6 10.0-10.1 10.5 10.6 11.1 11.5 11.6 12.1"},B:{"17":0.03502,"18":0.0035,"84":0.01051,"92":0.0035,"93":0.007,"104":0.0035,"106":0.0035,"109":0.007,"113":0.02101,"120":0.03852,"121":0.0035,"122":0.0035,"123":0.0035,"124":0.007,"125":0.01051,"126":0.01401,"127":0.01751,"128":0.01051,"129":0.01751,"130":0.01401,"131":0.36421,"132":0.04202,"133":0.85799,"134":4.99035,_:"12 13 14 15 16 79 80 81 83 85 86 87 88 89 90 91 94 95 96 97 98 99 100 101 102 103 105 107 108 110 111 112 114 115 116 117 118 119"},E:{"11":0.02451,"13":0.007,"14":0.0035,_:"0 4 5 6 7 8 9 10 12 15 3.1 3.2 5.1 6.1 7.1 9.1 10.1 11.1 15.1 15.2-15.3 16.0 16.2 16.5 18.4","12.1":0.1821,"13.1":0.007,"14.1":0.01751,"15.4":0.007,"15.5":0.0035,"15.6":0.06654,"16.1":0.007,"16.3":0.007,"16.4":0.01051,"16.6":0.03152,"17.0":0.02101,"17.1":0.01401,"17.2":0.01751,"17.3":0.007,"17.4":0.01751,"17.5":0.01051,"17.6":0.15059,"18.0":0.007,"18.1":0.09806,"18.2":0.02451,"18.3":1.06811},G:{"8":0,"3.2":0,"4.0-4.1":0,"4.2-4.3":0.00098,"5.0-5.1":0,"6.0-6.1":0.00293,"7.0-7.1":0.00195,"8.1-8.4":0,"9.0-9.2":0.00146,"9.3":0.00683,"10.0-10.2":0.00049,"10.3":0.01122,"11.0-11.2":0.05173,"11.3-11.4":0.00342,"12.0-12.1":0.00195,"12.2-12.5":0.04831,"13.0-13.1":0.00098,"13.2":0.00146,"13.3":0.00195,"13.4-13.7":0.00683,"14.0-14.4":0.01708,"14.5-14.8":0.0205,"15.0-15.1":0.01122,"15.2-15.3":0.01122,"15.4":0.01366,"15.5":0.01562,"15.6-15.8":0.19227,"16.0":0.02733,"16.1":0.05612,"16.2":0.02928,"16.3":0.05075,"16.4":0.01122,"16.5":0.02098,"16.6-16.7":0.2279,"17.0":0.01366,"17.1":0.0244,"17.2":0.01854,"17.3":0.02586,"17.4":0.05173,"17.5":0.11517,"17.6-17.7":0.33428,"18.0":0.0937,"18.1":0.30646,"18.2":0.13713,"18.3":2.86602,"18.4":0.04246},P:{"4":0.01032,"20":0.03097,"21":0.03097,"22":0.20644,"24":0.0929,"25":0.46448,"26":0.14451,"27":4.32484,_:"23 5.0-5.4 6.2-6.4 7.2-7.4 8.2 9.2 10.1 11.1-11.2 12.0 13.0 14.0 15.0 17.0 18.0","16.0":0.05161,"19.0":0.01032},I:{"0":0.03242,"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.00004},K:{"0":0.52284,_:"10 11 12 11.1 11.5 12.1"},A:{"11":1.751,_:"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.80575},Q:{"14.9":0.05198},O:{"0":0.3379},H:{"0":0.01},L:{"0":55.2991}};

View File

@@ -0,0 +1 @@
module.exports={C:{"90":0.001,"104":0.001,"110":0.001,"113":0.00199,"114":0.001,"115":0.02094,"116":0.001,"127":0.001,"128":0.00897,"129":0.001,"133":0.001,"134":0.001,"135":0.06879,"136":0.22433,"137":0.00399,_:"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 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 91 92 93 94 95 96 97 98 99 100 101 102 103 105 106 107 108 109 111 112 117 118 119 120 121 122 123 124 125 126 130 131 132 138 139 140 3.5 3.6"},D:{"49":0.001,"54":0.001,"58":0.02493,"59":0.001,"64":0.001,"65":0.001,"68":0.02493,"69":0.01296,"70":0.00199,"71":0.00399,"72":0.00798,"73":0.00199,"74":0.00598,"75":0.00399,"76":0.00499,"77":0.00299,"78":0.00399,"79":0.00399,"80":0.00399,"81":0.00299,"83":0.00299,"84":0.00399,"85":0.00499,"86":0.00598,"87":0.01196,"88":0.00798,"89":0.00399,"90":0.00499,"91":0.001,"93":0.01097,"94":0.001,"95":0.001,"96":0.001,"98":0.001,"100":0.01496,"102":0.001,"103":0.00598,"105":0.00199,"106":0.22931,"107":0.001,"109":0.40977,"111":0.00698,"112":0.00199,"114":0.00299,"116":0.05284,"118":0.00698,"119":0.00399,"120":0.001,"121":0.00598,"122":0.02393,"123":0.001,"124":0.00897,"125":0.00997,"126":0.01097,"127":0.03888,"128":0.00997,"129":0.00299,"130":0.0339,"131":0.0339,"132":0.04487,"133":0.81953,"134":1.69291,_:"4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 50 51 52 53 55 56 57 60 61 62 63 66 67 92 97 99 101 104 108 110 113 115 117 135 136 137 138"},F:{"47":0.001,"52":0.001,"53":0.001,"54":0.001,"55":0.00199,"56":0.001,"73":0.00199,"74":0.001,"75":0.001,"76":0.00299,"77":0.00299,"79":0.001,"87":0.00399,"88":0.001,"95":0.001,"114":0.001,"116":0.00399,"117":0.11366,_:"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 48 49 50 51 57 58 60 62 63 64 65 66 67 68 69 70 71 72 78 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 115 9.5-9.6 10.0-10.1 10.5 10.6 11.1 11.5 11.6 12.1"},B:{"16":0.001,"17":0.001,"18":0.00798,"80":0.00199,"84":0.001,"87":0.001,"89":0.00199,"90":0.00399,"92":0.00399,"100":0.001,"109":0.00399,"110":0.001,"114":0.001,"118":0.00199,"119":0.001,"124":0.00199,"126":0.01496,"129":0.00399,"130":0.00399,"131":0.01097,"132":0.01097,"133":0.15354,"134":0.29611,_:"12 13 14 15 79 81 83 85 86 88 91 93 94 95 96 97 98 99 101 102 103 104 105 106 107 108 111 112 113 115 116 117 120 121 122 123 125 127 128"},E:{"14":0.001,_:"0 4 5 6 7 8 9 10 11 12 13 15 3.1 3.2 6.1 7.1 10.1 11.1 12.1 15.1 15.2-15.3 16.4 17.0 18.0 18.4","5.1":0.001,"9.1":0.01795,"13.1":0.01496,"14.1":0.01296,"15.4":0.00299,"15.5":0.001,"15.6":0.07677,"16.0":0.00299,"16.1":0.00798,"16.2":0.00199,"16.3":0.00698,"16.5":0.00499,"16.6":0.02193,"17.1":0.02891,"17.2":0.001,"17.3":0.01097,"17.4":0.00399,"17.5":0.00997,"17.6":0.00598,"18.1":0.00199,"18.2":0.00798,"18.3":0.06481},G:{"8":0,"3.2":0,"4.0-4.1":0,"4.2-4.3":0.00447,"5.0-5.1":0,"6.0-6.1":0.01341,"7.0-7.1":0.00894,"8.1-8.4":0,"9.0-9.2":0.00671,"9.3":0.0313,"10.0-10.2":0.00224,"10.3":0.05142,"11.0-11.2":0.23696,"11.3-11.4":0.01565,"12.0-12.1":0.00894,"12.2-12.5":0.22131,"13.0-13.1":0.00447,"13.2":0.00671,"13.3":0.00894,"13.4-13.7":0.0313,"14.0-14.4":0.07824,"14.5-14.8":0.09389,"15.0-15.1":0.05142,"15.2-15.3":0.05142,"15.4":0.06259,"15.5":0.07153,"15.6-15.8":0.88077,"16.0":0.12518,"16.1":0.25708,"16.2":0.13413,"16.3":0.23249,"16.4":0.05142,"16.5":0.09612,"16.6-16.7":1.04395,"17.0":0.06259,"17.1":0.11177,"17.2":0.08495,"17.3":0.11848,"17.4":0.23696,"17.5":0.52756,"17.6-17.7":1.53128,"18.0":0.42921,"18.1":1.40386,"18.2":0.62816,"18.3":13.12877,"18.4":0.19448},P:{"4":0.15358,"20":0.05119,"21":0.01024,"22":0.12286,"23":0.02048,"24":0.06143,"25":0.02048,"26":0.12286,"27":0.44026,"5.0-5.4":0.09215,"6.2-6.4":0.03072,"7.2-7.4":0.22525,"8.2":0.08191,"9.2":0.01024,_:"10.1 12.0 14.0 18.0","11.1-11.2":0.01024,"13.0":0.05119,"15.0":0.01024,"16.0":0.03072,"17.0":0.01024,"19.0":0.01024},I:{"0":0,"3":0,"4":0,"2.1":0,"2.2":0,"2.3":0,"4.1":0,"4.2-4.3":0,"4.4":0,"4.4.3-4.4.4":0},K:{"0":0.34912,_:"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.009},Q:{_:"14.9"},O:{"0":0.08103},H:{"0":0.02},L:{"0":70.4559}};

View File

@@ -0,0 +1,114 @@
// forward declarations
declare global {
namespace NodeJS {
// eslint-disable-next-line @typescript-eslint/no-empty-interface
interface ReadableStream {}
// eslint-disable-next-line @typescript-eslint/no-empty-interface
interface WritableStream {}
}
/**
* Stub for https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal
*/
// eslint-disable-next-line @typescript-eslint/no-empty-interface
interface AbortSignal {}
/**
* Stub for https://developer.mozilla.org/en-US/docs/Web/API/ReadableStream
*/
// eslint-disable-next-line @typescript-eslint/no-empty-interface
interface ReadableStream {}
}
import { ReactNode } from "react";
import { ErrorInfo } from "./client";
export type BootstrapScriptDescriptor = {
src: string;
integrity?: string | undefined;
crossOrigin?: string | undefined;
};
export interface RenderToPipeableStreamOptions {
identifierPrefix?: string;
namespaceURI?: string;
nonce?: string;
bootstrapScriptContent?: string;
bootstrapScripts?: Array<string | BootstrapScriptDescriptor>;
bootstrapModules?: Array<string | BootstrapScriptDescriptor>;
progressiveChunkSize?: number;
onShellReady?: () => void;
onShellError?: (error: unknown) => void;
onAllReady?: () => void;
onError?: (error: unknown, errorInfo: ErrorInfo) => string | void;
}
export interface PipeableStream {
abort: (reason?: unknown) => void;
pipe: <Writable extends NodeJS.WritableStream>(destination: Writable) => Writable;
}
export interface ServerOptions {
identifierPrefix?: string;
}
/**
* Only available in the environments with [Node.js Streams](https://nodejs.dev/learn/nodejs-streams).
*
* @see [API](https://reactjs.org/docs/react-dom-server.html#rendertopipeablestream)
*
* @param children
* @param options
*/
export function renderToPipeableStream(children: ReactNode, options?: RenderToPipeableStreamOptions): PipeableStream;
/**
* Render a React element to its initial HTML. This should only be used on the server.
* React will return an HTML string. You can use this method to generate HTML on the server
* and send the markup down on the initial request for faster page loads and to allow search
* engines to crawl your pages for SEO purposes.
*
* If you call `ReactDOMClient.hydrateRoot()` on a node that already has this server-rendered markup,
* React will preserve it and only attach event handlers, allowing you
* to have a very performant first-load experience.
*/
export function renderToString(element: ReactNode, options?: ServerOptions): string;
/**
* Similar to `renderToString`, except this doesn't create extra DOM attributes
* such as `data-reactid`, that React uses internally. This is useful if you want
* to use React as a simple static page generator, as stripping away the extra
* attributes can save lots of bytes.
*/
export function renderToStaticMarkup(element: ReactNode, options?: ServerOptions): string;
export interface RenderToReadableStreamOptions {
identifierPrefix?: string;
namespaceURI?: string;
nonce?: string;
bootstrapScriptContent?: string;
bootstrapScripts?: Array<string | BootstrapScriptDescriptor>;
bootstrapModules?: Array<string | BootstrapScriptDescriptor>;
progressiveChunkSize?: number;
signal?: AbortSignal;
onError?: (error: unknown, errorInfo: ErrorInfo) => string | void;
}
export interface ReactDOMServerReadableStream extends ReadableStream {
allReady: Promise<void>;
}
/**
* Only available in the environments with [Web Streams](https://developer.mozilla.org/en-US/docs/Web/API/Streams_API) (this includes browsers, Deno, and some modern edge runtimes).
*
* @see [API](https://reactjs.org/docs/react-dom-server.html#rendertoreadablestream)
*/
export function renderToReadableStream(
children: ReactNode,
options?: RenderToReadableStreamOptions,
): Promise<ReactDOMServerReadableStream>;
export const version: string;
export as namespace ReactDOMServer;

View File

@@ -0,0 +1 @@
module.exports={A:{A:{"2":"K D E F A mC","132":"B"},B:{"1":"C L M G N O P","513":"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:{"1":"ZB aB bB cB dB eB fB gB hB iB jB kB lB mB nB oB pB","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 qC rC","513":"0 9 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:{"1":"eB fB gB hB iB jB kB lB mB nB","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","513":"0 9 oB pB qB rB sB tB uB vB MC wB NC xB yB zB 0B 1B 2B 3B 4B 5B 6B 7B 8B 9B AC BC CC DC Q H R 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":"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","2":"J PB K D E sC SC tC uC vC","260":"F A wC TC"},F:{"1":"RB SB TB UB VB WB XB YB ZB aB","2":"1 2 3 4 5 6 7 8 F B C G N O P QB 4C 5C 6C 7C FC kC 8C GC","513":"0 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":"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":"E SC 9C lC AD BD CD DD"},H:{"2":"WD"},I:{"2":"LC J XD YD ZD aD lC bD cD","513":"I"},J:{"2":"D A"},K:{"2":"A B C FC kC GC","513":"H"},L:{"513":"I"},M:{"513":"EC"},N:{"2":"A B"},O:{"513":"HC"},P:{"1":"J","513":"1 2 3 4 5 6 7 8 dD eD fD gD hD TC iD jD kD lD mD IC JC KC nD"},Q:{"513":"oD"},R:{"513":"pD"},S:{"1":"qD","513":"rD"}},B:6,C:"HTTP/2 protocol",D:true};

View File

@@ -0,0 +1,54 @@
# import-fresh
> Import a module while bypassing the [cache](https://nodejs.org/api/modules.html#modules_caching)
Useful for testing purposes when you need to freshly import a module.
## ESM
For ESM, you can use this snippet:
```js
const importFresh = moduleName => import(`${moduleName}?${Date.now()}`);
const {default: foo} = await importFresh('foo');
```
**This snippet causes a memory leak, so only use it for short-lived tests.**
## Install
```sh
npm install import-fresh
```
## Usage
```js
// foo.js
let i = 0;
module.exports = () => ++i;
```
```js
const importFresh = require('import-fresh');
require('./foo')();
//=> 1
require('./foo')();
//=> 2
importFresh('./foo')();
//=> 1
importFresh('./foo')();
//=> 1
```
## Related
- [clear-module](https://github.com/sindresorhus/clear-module) - Clear a module from the import cache
- [import-from](https://github.com/sindresorhus/import-from) - Import a module from a given path
- [import-cwd](https://github.com/sindresorhus/import-cwd) - Import a module from the current working directory
- [import-lazy](https://github.com/sindresorhus/import-lazy) - Import modules lazily

View File

@@ -0,0 +1,27 @@
{
"name": "@types/estree",
"version": "1.0.7",
"description": "TypeScript definitions for estree",
"homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/estree",
"license": "MIT",
"contributors": [
{
"name": "RReverser",
"githubUsername": "RReverser",
"url": "https://github.com/RReverser"
}
],
"main": "",
"types": "index.d.ts",
"repository": {
"type": "git",
"url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git",
"directory": "types/estree"
},
"scripts": {},
"dependencies": {},
"peerDependencies": {},
"typesPublisherContentHash": "1ab11f4e78319f80655b4ca20a073da0dc035be5f3290fb0bfa1e08a055d0c7d",
"typeScriptVersion": "5.0",
"nonNpm": true
}

View File

@@ -0,0 +1,248 @@
import { FilePosition } from './input.js'
declare namespace CssSyntaxError {
/**
* A position that is part of a range.
*/
export interface RangePosition {
/**
* The column number in the input.
*/
column: number
/**
* The line number in the input.
*/
line: number
}
// eslint-disable-next-line @typescript-eslint/no-use-before-define
export { CssSyntaxError_ as default }
}
/**
* The CSS parser throws this error for broken CSS.
*
* Custom parsers can throw this error for broken custom syntax using
* the `Node#error` method.
*
* PostCSS will use the input source map to detect the original error location.
* If you wrote a Sass file, compiled it to CSS and then parsed it with PostCSS,
* PostCSS will show the original position in the Sass file.
*
* If you need the position in the PostCSS input
* (e.g., to debug the previous compiler), use `error.input.file`.
*
* ```js
* // Raising error from plugin
* throw node.error('Unknown variable', { plugin: 'postcss-vars' })
* ```
*
* ```js
* // Catching and checking syntax error
* try {
* postcss.parse('a{')
* } catch (error) {
* if (error.name === 'CssSyntaxError') {
* error //=> CssSyntaxError
* }
* }
* ```
*/
declare class CssSyntaxError_ extends Error {
/**
* Source column of the error.
*
* ```js
* error.column //=> 1
* error.input.column //=> 4
* ```
*
* PostCSS will use the input source map to detect the original location.
* If you need the position in the PostCSS input, use `error.input.column`.
*/
column?: number
/**
* Source column of the error's end, exclusive. Provided if the error pertains
* to a range.
*
* ```js
* error.endColumn //=> 1
* error.input.endColumn //=> 4
* ```
*
* PostCSS will use the input source map to detect the original location.
* If you need the position in the PostCSS input, use `error.input.endColumn`.
*/
endColumn?: number
/**
* Source line of the error's end, exclusive. Provided if the error pertains
* to a range.
*
* ```js
* error.endLine //=> 3
* error.input.endLine //=> 4
* ```
*
* PostCSS will use the input source map to detect the original location.
* If you need the position in the PostCSS input, use `error.input.endLine`.
*/
endLine?: number
/**
* Absolute path to the broken file.
*
* ```js
* error.file //=> 'a.sass'
* error.input.file //=> 'a.css'
* ```
*
* PostCSS will use the input source map to detect the original location.
* If you need the position in the PostCSS input, use `error.input.file`.
*/
file?: string
/**
* Input object with PostCSS internal information
* about input file. If input has source map
* from previous tool, PostCSS will use origin
* (for example, Sass) source. You can use this
* object to get PostCSS input source.
*
* ```js
* error.input.file //=> 'a.css'
* error.file //=> 'a.sass'
* ```
*/
input?: FilePosition
/**
* Source line of the error.
*
* ```js
* error.line //=> 2
* error.input.line //=> 4
* ```
*
* PostCSS will use the input source map to detect the original location.
* If you need the position in the PostCSS input, use `error.input.line`.
*/
line?: number
/**
* Full error text in the GNU error format
* with plugin, file, line and column.
*
* ```js
* error.message //=> 'a.css:1:1: Unclosed block'
* ```
*/
message: string
/**
* Always equal to `'CssSyntaxError'`. You should always check error type
* by `error.name === 'CssSyntaxError'`
* instead of `error instanceof CssSyntaxError`,
* because npm could have several PostCSS versions.
*
* ```js
* if (error.name === 'CssSyntaxError') {
* error //=> CssSyntaxError
* }
* ```
*/
name: 'CssSyntaxError'
/**
* Plugin name, if error came from plugin.
*
* ```js
* error.plugin //=> 'postcss-vars'
* ```
*/
plugin?: string
/**
* Error message.
*
* ```js
* error.message //=> 'Unclosed block'
* ```
*/
reason: string
/**
* Source code of the broken file.
*
* ```js
* error.source //=> 'a { b {} }'
* error.input.source //=> 'a b { }'
* ```
*/
source?: string
stack: string
/**
* Instantiates a CSS syntax error. Can be instantiated for a single position
* or for a range.
* @param message Error message.
* @param lineOrStartPos If for a single position, the line number, or if for
* a range, the inclusive start position of the error.
* @param columnOrEndPos If for a single position, the column number, or if for
* a range, the exclusive end position of the error.
* @param source Source code of the broken file.
* @param file Absolute path to the broken file.
* @param plugin PostCSS plugin name, if error came from plugin.
*/
constructor(
message: string,
lineOrStartPos?: CssSyntaxError.RangePosition | number,
columnOrEndPos?: CssSyntaxError.RangePosition | number,
source?: string,
file?: string,
plugin?: string
)
/**
* Returns a few lines of CSS source that caused the error.
*
* If the CSS has an input source map without `sourceContent`,
* this method will return an empty string.
*
* ```js
* error.showSourceCode() //=> " 4 | }
* // 5 | a {
* // > 6 | bad
* // | ^
* // 7 | }
* // 8 | b {"
* ```
*
* @param color Whether arrow will be colored red by terminal
* color codes. By default, PostCSS will detect
* color support by `process.stdout.isTTY`
* and `process.env.NODE_DISABLE_COLORS`.
* @return Few lines of CSS source that caused the error.
*/
showSourceCode(color?: boolean): string
/**
* Returns error position, message and source code of the broken part.
*
* ```js
* error.toString() //=> "CssSyntaxError: app.css:1:1: Unclosed block
* // > 1 | a {
* // | ^"
* ```
*
* @return Error position, message and source code.
*/
toString(): string
}
declare class CssSyntaxError extends CssSyntaxError_ {}
export = CssSyntaxError

View File

@@ -0,0 +1,5 @@
import { NoInfer, PickOptional } from './utils.js';
import { SearchMiddleware } from './route.js';
import { IsRequiredParams } from './link.js';
export declare function retainSearchParams<TSearchSchema extends object>(keys: Array<keyof TSearchSchema> | true): SearchMiddleware<TSearchSchema>;
export declare function stripSearchParams<TSearchSchema, TOptionalProps = PickOptional<NoInfer<TSearchSchema>>, const TValues = Partial<NoInfer<TOptionalProps>> | Array<keyof TOptionalProps>, const TInput = IsRequiredParams<TSearchSchema> extends never ? TValues | true : TValues>(input: NoInfer<TInput>): SearchMiddleware<TSearchSchema>;

View File

@@ -0,0 +1,16 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = tsRewriteRelativeImportExtensions;
function tsRewriteRelativeImportExtensions(path, preserveJsx) {
if (typeof path === "string" && /^\.\.?\//.test(path)) {
return path.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+)?)\.([cm]?)ts$/i, function (m, tsx, d, ext, cm) {
return tsx ? preserveJsx ? ".jsx" : ".js" : d && (!ext || !cm) ? m : d + ext + "." + cm.toLowerCase() + "js";
});
}
return path;
}
//# sourceMappingURL=tsRewriteRelativeImportExtensions.js.map