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

View File

@@ -0,0 +1,18 @@
import { createRequire } from 'module';
import { fileURLToPath } from 'url';
import { dirname } from 'path';
/**
* @fileoverview Universal module importer
*/
//-----------------------------------------------------------------------------
// Helpers
//-----------------------------------------------------------------------------
const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);
const require = createRequire(__dirname + "/");
const { ModuleImporter } = require("./module-importer.cjs");
export { ModuleImporter };

View File

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

View File

@@ -0,0 +1,7 @@
'use strict';
if (process.env.NODE_ENV === 'production') {
module.exports = require('./cjs/react.react-server.production.js');
} else {
module.exports = require('./cjs/react.react-server.development.js');
}

View File

@@ -0,0 +1,4 @@
// This file is for backward compatibility with v0.5.1.
require('./register')
console.warn("'json5/require' is deprecated. Please use 'json5/register' instead.")

View File

@@ -0,0 +1,51 @@
/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
*/
"use strict";
const Hook = require("./Hook");
const HookCodeFactory = require("./HookCodeFactory");
class SyncBailHookCodeFactory extends HookCodeFactory {
content({ onError, onResult, resultReturns, onDone, rethrowIfPossible }) {
return this.callTapsSeries({
onError: (i, err) => onError(err),
onResult: (i, result, next) =>
`if(${result} !== undefined) {\n${onResult(
result
)};\n} else {\n${next()}}\n`,
resultReturns,
onDone,
rethrowIfPossible
});
}
}
const factory = new SyncBailHookCodeFactory();
const TAP_ASYNC = () => {
throw new Error("tapAsync is not supported on a SyncBailHook");
};
const TAP_PROMISE = () => {
throw new Error("tapPromise is not supported on a SyncBailHook");
};
const COMPILE = function(options) {
factory.setup(this, options);
return factory.create(options);
};
function SyncBailHook(args = [], name = undefined) {
const hook = new Hook(args, name);
hook.constructor = SyncBailHook;
hook.tapAsync = TAP_ASYNC;
hook.tapPromise = TAP_PROMISE;
hook.compile = COMPILE;
return hook;
}
SyncBailHook.prototype = null;
module.exports = SyncBailHook;

View File

@@ -0,0 +1,44 @@
# simple-concat [![travis][travis-image]][travis-url] [![npm][npm-image]][npm-url] [![downloads][downloads-image]][downloads-url] [![javascript style guide][standard-image]][standard-url]
[travis-image]: https://img.shields.io/travis/feross/simple-concat/master.svg
[travis-url]: https://travis-ci.org/feross/simple-concat
[npm-image]: https://img.shields.io/npm/v/simple-concat.svg
[npm-url]: https://npmjs.org/package/simple-concat
[downloads-image]: https://img.shields.io/npm/dm/simple-concat.svg
[downloads-url]: https://npmjs.org/package/simple-concat
[standard-image]: https://img.shields.io/badge/code_style-standard-brightgreen.svg
[standard-url]: https://standardjs.com
### Super-minimalist version of [`concat-stream`](https://github.com/maxogden/concat-stream). Less than 15 lines!
## install
```
npm install simple-concat
```
## usage
This example is longer than the implementation.
```js
var s = new stream.PassThrough()
concat(s, function (err, buf) {
if (err) throw err
console.error(buf)
})
s.write('abc')
setTimeout(function () {
s.write('123')
}, 10)
setTimeout(function () {
s.write('456')
}, 20)
setTimeout(function () {
s.end('789')
}, 30)
```
## license
MIT. Copyright (c) [Feross Aboukhadijeh](http://feross.org).

View File

@@ -0,0 +1 @@
{"version":3,"names":["_index","require","isSpecifierDefault","specifier","isImportDefaultSpecifier","isIdentifier","imported","exported","name"],"sources":["../../src/validators/isSpecifierDefault.ts"],"sourcesContent":["import { isIdentifier, isImportDefaultSpecifier } from \"./generated/index.ts\";\nimport type * as t from \"../index.ts\";\n\n/**\n * Check if the input `specifier` is a `default` import or export.\n */\nexport default function isSpecifierDefault(\n specifier: t.ModuleSpecifier,\n): boolean {\n return (\n isImportDefaultSpecifier(specifier) ||\n // @ts-expect-error todo(flow->ts): stricter type for specifier\n isIdentifier(specifier.imported || specifier.exported, {\n name: \"default\",\n })\n );\n}\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAMe,SAASC,kBAAkBA,CACxCC,SAA4B,EACnB;EACT,OACE,IAAAC,+BAAwB,EAACD,SAAS,CAAC,IAEnC,IAAAE,mBAAY,EAACF,SAAS,CAACG,QAAQ,IAAIH,SAAS,CAACI,QAAQ,EAAE;IACrDC,IAAI,EAAE;EACR,CAAC,CAAC;AAEN","ignoreList":[]}

View File

@@ -0,0 +1,235 @@
/**
* @fileoverview Rule to disallow Math.pow in favor of the ** operator
* @author Milos Djermanovic
*/
"use strict";
//------------------------------------------------------------------------------
// Requirements
//------------------------------------------------------------------------------
const astUtils = require("./utils/ast-utils");
const { CALL, ReferenceTracker } = require("@eslint-community/eslint-utils");
//------------------------------------------------------------------------------
// Helpers
//------------------------------------------------------------------------------
const PRECEDENCE_OF_EXPONENTIATION_EXPR = astUtils.getPrecedence({
type: "BinaryExpression",
operator: "**",
});
/**
* Determines whether the given node needs parens if used as the base in an exponentiation binary expression.
* @param {ASTNode} base The node to check.
* @returns {boolean} `true` if the node needs to be parenthesised.
*/
function doesBaseNeedParens(base) {
return (
// '**' is right-associative, parens are needed when Math.pow(a ** b, c) is converted to (a ** b) ** c
astUtils.getPrecedence(base) <= PRECEDENCE_OF_EXPONENTIATION_EXPR ||
// An unary operator cannot be used immediately before an exponentiation expression
base.type === "AwaitExpression" ||
base.type === "UnaryExpression"
);
}
/**
* Determines whether the given node needs parens if used as the exponent in an exponentiation binary expression.
* @param {ASTNode} exponent The node to check.
* @returns {boolean} `true` if the node needs to be parenthesised.
*/
function doesExponentNeedParens(exponent) {
// '**' is right-associative, there is no need for parens when Math.pow(a, b ** c) is converted to a ** b ** c
return astUtils.getPrecedence(exponent) < PRECEDENCE_OF_EXPONENTIATION_EXPR;
}
/**
* Determines whether an exponentiation binary expression at the place of the given node would need parens.
* @param {ASTNode} node A node that would be replaced by an exponentiation binary expression.
* @param {SourceCode} sourceCode A SourceCode object.
* @returns {boolean} `true` if the expression needs to be parenthesised.
*/
function doesExponentiationExpressionNeedParens(node, sourceCode) {
const parent =
node.parent.type === "ChainExpression"
? node.parent.parent
: node.parent;
const parentPrecedence = astUtils.getPrecedence(parent);
const needsParens =
parent.type === "ClassDeclaration" ||
(parent.type.endsWith("Expression") &&
(parentPrecedence === -1 ||
parentPrecedence >= PRECEDENCE_OF_EXPONENTIATION_EXPR) &&
!(
parent.type === "BinaryExpression" &&
parent.operator === "**" &&
parent.right === node
) &&
!(
(parent.type === "CallExpression" ||
parent.type === "NewExpression") &&
parent.arguments.includes(node)
) &&
!(
parent.type === "MemberExpression" &&
parent.computed &&
parent.property === node
) &&
!(parent.type === "ArrayExpression"));
return needsParens && !astUtils.isParenthesised(sourceCode, node);
}
/**
* Optionally parenthesizes given text.
* @param {string} text The text to parenthesize.
* @param {boolean} shouldParenthesize If `true`, the text will be parenthesised.
* @returns {string} parenthesised or unchanged text.
*/
function parenthesizeIfShould(text, shouldParenthesize) {
return shouldParenthesize ? `(${text})` : text;
}
//------------------------------------------------------------------------------
// Rule Definition
//------------------------------------------------------------------------------
/** @type {import('../shared/types').Rule} */
module.exports = {
meta: {
type: "suggestion",
docs: {
description:
"Disallow the use of `Math.pow` in favor of the `**` operator",
recommended: false,
frozen: true,
url: "https://eslint.org/docs/latest/rules/prefer-exponentiation-operator",
},
schema: [],
fixable: "code",
messages: {
useExponentiation: "Use the '**' operator instead of 'Math.pow'.",
},
},
create(context) {
const sourceCode = context.sourceCode;
/**
* Reports the given node.
* @param {ASTNode} node 'Math.pow()' node to report.
* @returns {void}
*/
function report(node) {
context.report({
node,
messageId: "useExponentiation",
fix(fixer) {
if (
node.arguments.length !== 2 ||
node.arguments.some(
arg => arg.type === "SpreadElement",
) ||
sourceCode.getCommentsInside(node).length > 0
) {
return null;
}
const base = node.arguments[0],
exponent = node.arguments[1],
baseText = sourceCode.getText(base),
exponentText = sourceCode.getText(exponent),
shouldParenthesizeBase = doesBaseNeedParens(base),
shouldParenthesizeExponent =
doesExponentNeedParens(exponent),
shouldParenthesizeAll =
doesExponentiationExpressionNeedParens(
node,
sourceCode,
);
let prefix = "",
suffix = "";
if (!shouldParenthesizeAll) {
if (!shouldParenthesizeBase) {
const firstReplacementToken =
sourceCode.getFirstToken(base),
tokenBefore = sourceCode.getTokenBefore(node);
if (
tokenBefore &&
tokenBefore.range[1] === node.range[0] &&
!astUtils.canTokensBeAdjacent(
tokenBefore,
firstReplacementToken,
)
) {
prefix = " "; // a+Math.pow(++b, c) -> a+ ++b**c
}
}
if (!shouldParenthesizeExponent) {
const lastReplacementToken =
sourceCode.getLastToken(exponent),
tokenAfter = sourceCode.getTokenAfter(node);
if (
tokenAfter &&
node.range[1] === tokenAfter.range[0] &&
!astUtils.canTokensBeAdjacent(
lastReplacementToken,
tokenAfter,
)
) {
suffix = " "; // Math.pow(a, b)in c -> a**b in c
}
}
}
const baseReplacement = parenthesizeIfShould(
baseText,
shouldParenthesizeBase,
),
exponentReplacement = parenthesizeIfShould(
exponentText,
shouldParenthesizeExponent,
),
replacement = parenthesizeIfShould(
`${baseReplacement}**${exponentReplacement}`,
shouldParenthesizeAll,
);
return fixer.replaceText(
node,
`${prefix}${replacement}${suffix}`,
);
},
});
}
return {
Program(node) {
const scope = sourceCode.getScope(node);
const tracker = new ReferenceTracker(scope);
const trackMap = {
Math: {
pow: { [CALL]: true },
},
};
for (const { node: refNode } of tracker.iterateGlobalReferences(
trackMap,
)) {
report(refNode);
}
},
};
},
};

View File

@@ -0,0 +1,119 @@
"use strict";
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
const store = require("./store.cjs");
const scheduler = require("./scheduler.cjs");
class Derived {
constructor(options) {
this.listeners = /* @__PURE__ */ new Set();
this._subscriptions = [];
this.lastSeenDepValues = [];
this.getDepVals = () => {
const prevDepVals = [];
const currDepVals = [];
for (const dep of this.options.deps) {
prevDepVals.push(dep.prevState);
currDepVals.push(dep.state);
}
this.lastSeenDepValues = currDepVals;
return {
prevDepVals,
currDepVals,
prevVal: this.prevState ?? void 0
};
};
this.recompute = () => {
var _a, _b;
this.prevState = this.state;
const { prevDepVals, currDepVals, prevVal } = this.getDepVals();
this.state = this.options.fn({
prevDepVals,
currDepVals,
prevVal
});
(_b = (_a = this.options).onUpdate) == null ? void 0 : _b.call(_a);
};
this.checkIfRecalculationNeededDeeply = () => {
for (const dep of this.options.deps) {
if (dep instanceof Derived) {
dep.checkIfRecalculationNeededDeeply();
}
}
let shouldRecompute = false;
const lastSeenDepValues = this.lastSeenDepValues;
const { currDepVals } = this.getDepVals();
for (let i = 0; i < currDepVals.length; i++) {
if (currDepVals[i] !== lastSeenDepValues[i]) {
shouldRecompute = true;
break;
}
}
if (shouldRecompute) {
this.recompute();
}
};
this.mount = () => {
this.registerOnGraph();
this.checkIfRecalculationNeededDeeply();
return () => {
this.unregisterFromGraph();
for (const cleanup of this._subscriptions) {
cleanup();
}
};
};
this.subscribe = (listener) => {
var _a, _b;
this.listeners.add(listener);
const unsub = (_b = (_a = this.options).onSubscribe) == null ? void 0 : _b.call(_a, listener, this);
return () => {
this.listeners.delete(listener);
unsub == null ? void 0 : unsub();
};
};
this.options = options;
this.state = options.fn({
prevDepVals: void 0,
prevVal: void 0,
currDepVals: this.getDepVals().currDepVals
});
}
registerOnGraph(deps = this.options.deps) {
for (const dep of deps) {
if (dep instanceof Derived) {
dep.registerOnGraph();
this.registerOnGraph(dep.options.deps);
} else if (dep instanceof store.Store) {
let relatedLinkedDerivedVals = scheduler.__storeToDerived.get(dep);
if (!relatedLinkedDerivedVals) {
relatedLinkedDerivedVals = /* @__PURE__ */ new Set();
scheduler.__storeToDerived.set(dep, relatedLinkedDerivedVals);
}
relatedLinkedDerivedVals.add(this);
let relatedStores = scheduler.__derivedToStore.get(this);
if (!relatedStores) {
relatedStores = /* @__PURE__ */ new Set();
scheduler.__derivedToStore.set(this, relatedStores);
}
relatedStores.add(dep);
}
}
}
unregisterFromGraph(deps = this.options.deps) {
for (const dep of deps) {
if (dep instanceof Derived) {
this.unregisterFromGraph(dep.options.deps);
} else if (dep instanceof store.Store) {
const relatedLinkedDerivedVals = scheduler.__storeToDerived.get(dep);
if (relatedLinkedDerivedVals) {
relatedLinkedDerivedVals.delete(this);
}
const relatedStores = scheduler.__derivedToStore.get(this);
if (relatedStores) {
relatedStores.delete(dep);
}
}
}
}
}
exports.Derived = Derived;
//# sourceMappingURL=derived.cjs.map

View File

@@ -0,0 +1 @@
module.exports={C:{"4":0.06948,"34":0.0327,"78":0.01635,"101":0.00409,"106":0.01226,"115":0.03678,"117":0.00409,"120":0.04087,"126":0.00409,"128":0.02044,"129":0.00409,"130":0.00409,"131":0.00409,"133":0.00409,"134":0.00817,"135":0.29018,"136":1.08714,"137":0.00409,_:"2 3 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 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 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 102 103 104 105 107 108 109 110 111 112 113 114 116 118 119 121 122 123 124 125 127 132 138 139 140 3.5 3.6"},D:{"39":0.00409,"40":0.00409,"41":0.00409,"42":0.00409,"43":0.00409,"45":0.00409,"46":0.00409,"47":0.00409,"48":0.00409,"49":0.00409,"50":0.00409,"51":0.00409,"52":0.00409,"53":0.00409,"54":0.00409,"55":0.00409,"56":0.00409,"57":0.00409,"58":0.00409,"59":0.00409,"60":0.00409,"62":0.00409,"65":0.00409,"73":0.01226,"74":0.00409,"75":0.01226,"76":0.00409,"78":0.00409,"79":0.05722,"81":0.01226,"83":0.16757,"85":0.00817,"86":0.00409,"87":0.84192,"88":0.02044,"89":0.03678,"91":0.01635,"93":0.00409,"94":0.02452,"95":0.00409,"98":0.00409,"100":0.01635,"101":0.00409,"102":0.00409,"103":0.06948,"106":0.00409,"107":0.01226,"108":0.00817,"109":0.54766,"110":0.04087,"111":0.01226,"112":0.01635,"113":0.00409,"114":0.02861,"116":0.17165,"119":0.01226,"120":0.22479,"121":0.00817,"122":0.07357,"123":0.02044,"124":0.07765,"125":0.14713,"126":0.06131,"127":0.01635,"128":0.2207,"129":0.05313,"130":0.0327,"131":0.42505,"132":0.38009,"133":6.51059,"134":14.33311,"135":0.00817,_:"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 44 61 63 64 66 67 68 69 70 71 72 77 80 84 90 92 96 97 99 104 105 115 117 118 136 137 138"},F:{"87":0.02861,"88":0.0327,"95":0.06948,"105":0.00409,"114":0.00817,"116":0.77653,"117":1.96176,_:"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 89 90 91 92 93 94 96 97 98 99 100 101 102 103 104 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:{"92":0.01635,"100":0.00409,"109":0.02044,"110":0.00409,"114":0.02452,"121":0.00409,"122":0.00817,"124":0.00409,"125":0.00409,"126":0.02044,"127":0.01226,"128":0.00817,"129":0.00409,"130":0.02861,"131":0.05722,"132":0.08991,"133":1.36097,"134":4.07883,_:"12 13 14 15 16 17 18 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 111 112 113 115 116 117 118 119 120 123"},E:{"14":0.00409,_:"0 4 5 6 7 8 9 10 11 12 13 15 3.1 3.2 6.1 7.1 9.1 10.1 11.1 12.1 15.1 15.2-15.3","5.1":0.00409,"13.1":0.05722,"14.1":0.00817,"15.4":0.00817,"15.5":0.00409,"15.6":0.13896,"16.0":0.00817,"16.1":0.02452,"16.2":0.01226,"16.3":0.01226,"16.4":0.08583,"16.5":0.00817,"16.6":0.1267,"17.0":0.01226,"17.1":0.08174,"17.2":0.01635,"17.3":0.01635,"17.4":0.02861,"17.5":0.1267,"17.6":0.17574,"18.0":0.0327,"18.1":0.06948,"18.2":0.0327,"18.3":1.23019,"18.4":0.01635},G:{"8":0,"3.2":0,"4.0-4.1":0,"4.2-4.3":0.00259,"5.0-5.1":0,"6.0-6.1":0.00776,"7.0-7.1":0.00517,"8.1-8.4":0,"9.0-9.2":0.00388,"9.3":0.0181,"10.0-10.2":0.00129,"10.3":0.02973,"11.0-11.2":0.13701,"11.3-11.4":0.00905,"12.0-12.1":0.00517,"12.2-12.5":0.12797,"13.0-13.1":0.00259,"13.2":0.00388,"13.3":0.00517,"13.4-13.7":0.0181,"14.0-14.4":0.04524,"14.5-14.8":0.05429,"15.0-15.1":0.02973,"15.2-15.3":0.02973,"15.4":0.03619,"15.5":0.04136,"15.6-15.8":0.50928,"16.0":0.07238,"16.1":0.14865,"16.2":0.07755,"16.3":0.13443,"16.4":0.02973,"16.5":0.05558,"16.6-16.7":0.60364,"17.0":0.03619,"17.1":0.06463,"17.2":0.04912,"17.3":0.06851,"17.4":0.13701,"17.5":0.30505,"17.6-17.7":0.88542,"18.0":0.24818,"18.1":0.81174,"18.2":0.36322,"18.3":7.59133,"18.4":0.11245},P:{"4":0.04143,"20":0.01036,"21":0.03107,"22":0.145,"23":0.01036,"24":0.19679,"25":0.03107,"26":0.09321,"27":2.58929,_:"5.0-5.4 6.2-6.4 8.2 9.2 10.1 12.0 13.0 14.0 15.0 16.0 18.0 19.0","7.2-7.4":0.0725,"11.1-11.2":0.01036,"17.0":0.01036},I:{"0":0.0177,"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.00002},K:{"0":0.17739,_:"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.272},Q:{"14.9":0.00591},O:{"0":0.10052},H:{"0":0},L:{"0":44.29546}};

View File

@@ -0,0 +1,5 @@
try {
module.exports = require("./lib/index.cjs");
} catch {
module.exports = require("./lib/index.js");
}

View File

@@ -0,0 +1,688 @@
/**
* @fileoverview Rule to replace assignment expressions with logical operator assignment
* @author Daniel Martens
*/
"use strict";
//------------------------------------------------------------------------------
// Requirements
//------------------------------------------------------------------------------
const astUtils = require("./utils/ast-utils.js");
//------------------------------------------------------------------------------
// Helpers
//------------------------------------------------------------------------------
const baseTypes = new Set(["Identifier", "Super", "ThisExpression"]);
/**
* Returns true iff either "undefined" or a void expression (eg. "void 0")
* @param {ASTNode} expression Expression to check
* @param {import('eslint-scope').Scope} scope Scope of the expression
* @returns {boolean} True iff "undefined" or "void ..."
*/
function isUndefined(expression, scope) {
if (expression.type === "Identifier" && expression.name === "undefined") {
return astUtils.isReferenceToGlobalVariable(scope, expression);
}
return (
expression.type === "UnaryExpression" &&
expression.operator === "void" &&
expression.argument.type === "Literal" &&
expression.argument.value === 0
);
}
/**
* Returns true iff the reference is either an identifier or member expression
* @param {ASTNode} expression Expression to check
* @returns {boolean} True for identifiers and member expressions
*/
function isReference(expression) {
return (
(expression.type === "Identifier" && expression.name !== "undefined") ||
expression.type === "MemberExpression"
);
}
/**
* Returns true iff the expression checks for nullish with loose equals.
* Examples: value == null, value == void 0
* @param {ASTNode} expression Test condition
* @param {import('eslint-scope').Scope} scope Scope of the expression
* @returns {boolean} True iff implicit nullish comparison
*/
function isImplicitNullishComparison(expression, scope) {
if (
expression.type !== "BinaryExpression" ||
expression.operator !== "=="
) {
return false;
}
const reference = isReference(expression.left) ? "left" : "right";
const nullish = reference === "left" ? "right" : "left";
return (
isReference(expression[reference]) &&
(astUtils.isNullLiteral(expression[nullish]) ||
isUndefined(expression[nullish], scope))
);
}
/**
* Condition with two equal comparisons.
* @param {ASTNode} expression Condition
* @returns {boolean} True iff matches ? === ? || ? === ?
*/
function isDoubleComparison(expression) {
return (
expression.type === "LogicalExpression" &&
expression.operator === "||" &&
expression.left.type === "BinaryExpression" &&
expression.left.operator === "===" &&
expression.right.type === "BinaryExpression" &&
expression.right.operator === "==="
);
}
/**
* Returns true iff the expression checks for undefined and null.
* Example: value === null || value === undefined
* @param {ASTNode} expression Test condition
* @param {import('eslint-scope').Scope} scope Scope of the expression
* @returns {boolean} True iff explicit nullish comparison
*/
function isExplicitNullishComparison(expression, scope) {
if (!isDoubleComparison(expression)) {
return false;
}
const leftReference = isReference(expression.left.left) ? "left" : "right";
const leftNullish = leftReference === "left" ? "right" : "left";
const rightReference = isReference(expression.right.left)
? "left"
: "right";
const rightNullish = rightReference === "left" ? "right" : "left";
return (
astUtils.isSameReference(
expression.left[leftReference],
expression.right[rightReference],
) &&
((astUtils.isNullLiteral(expression.left[leftNullish]) &&
isUndefined(expression.right[rightNullish], scope)) ||
(isUndefined(expression.left[leftNullish], scope) &&
astUtils.isNullLiteral(expression.right[rightNullish])))
);
}
/**
* Returns true for Boolean(arg) calls
* @param {ASTNode} expression Test condition
* @param {import('eslint-scope').Scope} scope Scope of the expression
* @returns {boolean} Whether the expression is a boolean cast
*/
function isBooleanCast(expression, scope) {
return (
expression.type === "CallExpression" &&
expression.callee.name === "Boolean" &&
expression.arguments.length === 1 &&
astUtils.isReferenceToGlobalVariable(scope, expression.callee)
);
}
/**
* Returns true for:
* truthiness checks: value, Boolean(value), !!value
* falsiness checks: !value, !Boolean(value)
* nullish checks: value == null, value === undefined || value === null
* @param {ASTNode} expression Test condition
* @param {import('eslint-scope').Scope} scope Scope of the expression
* @returns {?{ reference: ASTNode, operator: '??'|'||'|'&&'}} Null if not a known existence
*/
function getExistence(expression, scope) {
const isNegated =
expression.type === "UnaryExpression" && expression.operator === "!";
const base = isNegated ? expression.argument : expression;
switch (true) {
case isReference(base):
return { reference: base, operator: isNegated ? "||" : "&&" };
case base.type === "UnaryExpression" &&
base.operator === "!" &&
isReference(base.argument):
return { reference: base.argument, operator: "&&" };
case isBooleanCast(base, scope) && isReference(base.arguments[0]):
return {
reference: base.arguments[0],
operator: isNegated ? "||" : "&&",
};
case isImplicitNullishComparison(expression, scope):
return {
reference: isReference(expression.left)
? expression.left
: expression.right,
operator: "??",
};
case isExplicitNullishComparison(expression, scope):
return {
reference: isReference(expression.left.left)
? expression.left.left
: expression.left.right,
operator: "??",
};
default:
return null;
}
}
/**
* Returns true iff the node is inside a with block
* @param {ASTNode} node Node to check
* @returns {boolean} True iff passed node is inside a with block
*/
function isInsideWithBlock(node) {
if (node.type === "Program") {
return false;
}
return node.parent.type === "WithStatement" && node.parent.body === node
? true
: isInsideWithBlock(node.parent);
}
/**
* Gets the leftmost operand of a consecutive logical expression.
* @param {SourceCode} sourceCode The ESLint source code object
* @param {LogicalExpression} node LogicalExpression
* @returns {Expression} Leftmost operand
*/
function getLeftmostOperand(sourceCode, node) {
let left = node.left;
while (
left.type === "LogicalExpression" &&
left.operator === node.operator
) {
if (astUtils.isParenthesised(sourceCode, left)) {
/*
* It should have associativity,
* but ignore it if use parentheses to make the evaluation order clear.
*/
return left;
}
left = left.left;
}
return left;
}
//------------------------------------------------------------------------------
// Rule Definition
//------------------------------------------------------------------------------
/** @type {import('../shared/types').Rule} */
module.exports = {
meta: {
type: "suggestion",
docs: {
description:
"Require or disallow logical assignment operator shorthand",
recommended: false,
frozen: true,
url: "https://eslint.org/docs/latest/rules/logical-assignment-operators",
},
schema: {
type: "array",
oneOf: [
{
items: [
{ const: "always" },
{
type: "object",
properties: {
enforceForIfStatements: {
type: "boolean",
},
},
additionalProperties: false,
},
],
minItems: 0, // 0 for allowing passing no options
maxItems: 2,
},
{
items: [{ const: "never" }],
minItems: 1,
maxItems: 1,
},
],
},
fixable: "code",
hasSuggestions: true,
messages: {
assignment:
"Assignment (=) can be replaced with operator assignment ({{operator}}).",
useLogicalOperator:
"Convert this assignment to use the operator {{ operator }}.",
logical:
"Logical expression can be replaced with an assignment ({{ operator }}).",
convertLogical:
"Replace this logical expression with an assignment with the operator {{ operator }}.",
if: "'if' statement can be replaced with a logical operator assignment with operator {{ operator }}.",
convertIf:
"Replace this 'if' statement with a logical assignment with operator {{ operator }}.",
unexpected:
"Unexpected logical operator assignment ({{operator}}) shorthand.",
separate:
"Separate the logical assignment into an assignment with a logical operator.",
},
},
create(context) {
const mode = context.options[0] === "never" ? "never" : "always";
const checkIf =
mode === "always" &&
context.options.length > 1 &&
context.options[1].enforceForIfStatements;
const sourceCode = context.sourceCode;
const isStrict = sourceCode.getScope(sourceCode.ast).isStrict;
/**
* Returns false if the access could be a getter
* @param {ASTNode} node Assignment expression
* @returns {boolean} True iff the fix is safe
*/
function cannotBeGetter(node) {
return (
node.type === "Identifier" &&
(isStrict || !isInsideWithBlock(node))
);
}
/**
* Check whether only a single property is accessed
* @param {ASTNode} node reference
* @returns {boolean} True iff a single property is accessed
*/
function accessesSingleProperty(node) {
if (!isStrict && isInsideWithBlock(node)) {
return node.type === "Identifier";
}
return (
node.type === "MemberExpression" &&
baseTypes.has(node.object.type) &&
(!node.computed ||
(node.property.type !== "MemberExpression" &&
node.property.type !== "ChainExpression"))
);
}
/**
* Adds a fixer or suggestion whether on the fix is safe.
* @param {{ messageId: string, node: ASTNode }} descriptor Report descriptor without fix or suggest
* @param {{ messageId: string, fix: Function }} suggestion Adds the fix or the whole suggestion as only element in "suggest" to suggestion
* @param {boolean} shouldBeFixed Fix iff the condition is true
* @returns {Object} Descriptor with either an added fix or suggestion
*/
function createConditionalFixer(descriptor, suggestion, shouldBeFixed) {
if (shouldBeFixed) {
return {
...descriptor,
fix: suggestion.fix,
};
}
return {
...descriptor,
suggest: [suggestion],
};
}
/**
* Returns the operator token for assignments and binary expressions
* @param {ASTNode} node AssignmentExpression or BinaryExpression
* @returns {import('eslint').AST.Token} Operator token between the left and right expression
*/
function getOperatorToken(node) {
return sourceCode.getFirstTokenBetween(
node.left,
node.right,
token => token.value === node.operator,
);
}
if (mode === "never") {
return {
// foo ||= bar
AssignmentExpression(assignment) {
if (
!astUtils.isLogicalAssignmentOperator(
assignment.operator,
)
) {
return;
}
const descriptor = {
messageId: "unexpected",
node: assignment,
data: { operator: assignment.operator },
};
const suggestion = {
messageId: "separate",
*fix(ruleFixer) {
if (
sourceCode.getCommentsInside(assignment)
.length > 0
) {
return;
}
const operatorToken = getOperatorToken(assignment);
// -> foo = bar
yield ruleFixer.replaceText(operatorToken, "=");
const assignmentText = sourceCode.getText(
assignment.left,
);
const operator = assignment.operator.slice(0, -1);
// -> foo = foo || bar
yield ruleFixer.insertTextAfter(
operatorToken,
` ${assignmentText} ${operator}`,
);
const precedence =
astUtils.getPrecedence(assignment.right) <=
astUtils.getPrecedence({
type: "LogicalExpression",
operator,
});
// ?? and || / && cannot be mixed but have same precedence
const mixed =
assignment.operator === "??=" &&
astUtils.isLogicalExpression(assignment.right);
if (
!astUtils.isParenthesised(
sourceCode,
assignment.right,
) &&
(precedence || mixed)
) {
// -> foo = foo || (bar)
yield ruleFixer.insertTextBefore(
assignment.right,
"(",
);
yield ruleFixer.insertTextAfter(
assignment.right,
")",
);
}
},
};
context.report(
createConditionalFixer(
descriptor,
suggestion,
cannotBeGetter(assignment.left),
),
);
},
};
}
return {
// foo = foo || bar
"AssignmentExpression[operator='='][right.type='LogicalExpression']"(
assignment,
) {
const leftOperand = getLeftmostOperand(
sourceCode,
assignment.right,
);
if (!astUtils.isSameReference(assignment.left, leftOperand)) {
return;
}
const descriptor = {
messageId: "assignment",
node: assignment,
data: { operator: `${assignment.right.operator}=` },
};
const suggestion = {
messageId: "useLogicalOperator",
data: { operator: `${assignment.right.operator}=` },
*fix(ruleFixer) {
if (
sourceCode.getCommentsInside(assignment).length > 0
) {
return;
}
// No need for parenthesis around the assignment based on precedence as the precedence stays the same even with changed operator
const assignmentOperatorToken =
getOperatorToken(assignment);
// -> foo ||= foo || bar
yield ruleFixer.insertTextBefore(
assignmentOperatorToken,
assignment.right.operator,
);
// -> foo ||= bar
const logicalOperatorToken = getOperatorToken(
leftOperand.parent,
);
const firstRightOperandToken =
sourceCode.getTokenAfter(logicalOperatorToken);
yield ruleFixer.removeRange([
leftOperand.parent.range[0],
firstRightOperandToken.range[0],
]);
},
};
context.report(
createConditionalFixer(
descriptor,
suggestion,
cannotBeGetter(assignment.left),
),
);
},
// foo || (foo = bar)
'LogicalExpression[right.type="AssignmentExpression"][right.operator="="]'(
logical,
) {
// Right side has to be parenthesized, otherwise would be parsed as (foo || foo) = bar which is illegal
if (
isReference(logical.left) &&
astUtils.isSameReference(logical.left, logical.right.left)
) {
const descriptor = {
messageId: "logical",
node: logical,
data: { operator: `${logical.operator}=` },
};
const suggestion = {
messageId: "convertLogical",
data: { operator: `${logical.operator}=` },
*fix(ruleFixer) {
if (
sourceCode.getCommentsInside(logical).length > 0
) {
return;
}
const parentPrecedence = astUtils.getPrecedence(
logical.parent,
);
const requiresOuterParenthesis =
logical.parent.type !== "ExpressionStatement" &&
(parentPrecedence === -1 ||
astUtils.getPrecedence({
type: "AssignmentExpression",
}) < parentPrecedence);
if (
!astUtils.isParenthesised(
sourceCode,
logical,
) &&
requiresOuterParenthesis
) {
yield ruleFixer.insertTextBefore(logical, "(");
yield ruleFixer.insertTextAfter(logical, ")");
}
// Also removes all opening parenthesis
yield ruleFixer.removeRange([
logical.range[0],
logical.right.range[0],
]); // -> foo = bar)
// Also removes all ending parenthesis
yield ruleFixer.removeRange([
logical.right.range[1],
logical.range[1],
]); // -> foo = bar
const operatorToken = getOperatorToken(
logical.right,
);
yield ruleFixer.insertTextBefore(
operatorToken,
logical.operator,
); // -> foo ||= bar
},
};
const fix =
cannotBeGetter(logical.left) ||
accessesSingleProperty(logical.left);
context.report(
createConditionalFixer(descriptor, suggestion, fix),
);
}
},
// if (foo) foo = bar
"IfStatement[alternate=null]"(ifNode) {
if (!checkIf) {
return;
}
const hasBody = ifNode.consequent.type === "BlockStatement";
if (hasBody && ifNode.consequent.body.length !== 1) {
return;
}
const body = hasBody
? ifNode.consequent.body[0]
: ifNode.consequent;
const scope = sourceCode.getScope(ifNode);
const existence = getExistence(ifNode.test, scope);
if (
body.type === "ExpressionStatement" &&
body.expression.type === "AssignmentExpression" &&
body.expression.operator === "=" &&
existence !== null &&
astUtils.isSameReference(
existence.reference,
body.expression.left,
)
) {
const descriptor = {
messageId: "if",
node: ifNode,
data: { operator: `${existence.operator}=` },
};
const suggestion = {
messageId: "convertIf",
data: { operator: `${existence.operator}=` },
*fix(ruleFixer) {
if (
sourceCode.getCommentsInside(ifNode).length > 0
) {
return;
}
const firstBodyToken =
sourceCode.getFirstToken(body);
const prevToken = sourceCode.getTokenBefore(ifNode);
if (
prevToken !== null &&
prevToken.value !== ";" &&
prevToken.value !== "{" &&
firstBodyToken.type !== "Identifier" &&
firstBodyToken.type !== "Keyword"
) {
// Do not fix if the fixed statement could be part of the previous statement (eg. fn() if (a == null) (a) = b --> fn()(a) ??= b)
return;
}
const operatorToken = getOperatorToken(
body.expression,
);
yield ruleFixer.insertTextBefore(
operatorToken,
existence.operator,
); // -> if (foo) foo ||= bar
yield ruleFixer.removeRange([
ifNode.range[0],
body.range[0],
]); // -> foo ||= bar
yield ruleFixer.removeRange([
body.range[1],
ifNode.range[1],
]); // -> foo ||= bar, only present if "if" had a body
const nextToken = sourceCode.getTokenAfter(
body.expression,
);
if (
hasBody &&
nextToken !== null &&
nextToken.value !== ";"
) {
yield ruleFixer.insertTextAfter(ifNode, ";");
}
},
};
const shouldBeFixed =
cannotBeGetter(existence.reference) ||
(ifNode.test.type !== "LogicalExpression" &&
accessesSingleProperty(existence.reference));
context.report(
createConditionalFixer(
descriptor,
suggestion,
shouldBeFixed,
),
);
}
},
};
},
};

View File

@@ -0,0 +1,55 @@
import type { StateCreator, StoreApi, StoreMutatorIdentifier } from 'zustand/vanilla';
type Config = Parameters<(Window extends {
__REDUX_DEVTOOLS_EXTENSION__?: infer T;
} ? T : {
connect: (param: any) => any;
})['connect']>[0];
declare module '../vanilla' {
interface StoreMutators<S, A> {
'zustand/devtools': WithDevtools<S>;
}
}
type Cast<T, U> = T extends U ? T : U;
type Write<T, U> = Omit<T, keyof U> & U;
type TakeTwo<T> = T extends {
length: 0;
} ? [undefined, undefined] : T extends {
length: 1;
} ? [...a0: Cast<T, unknown[]>, a1: undefined] : T extends {
length: 0 | 1;
} ? [...a0: Cast<T, unknown[]>, a1: undefined] : T extends {
length: 2;
} ? T : T extends {
length: 1 | 2;
} ? T : T extends {
length: 0 | 1 | 2;
} ? T : T extends [infer A0, infer A1, ...unknown[]] ? [A0, A1] : T extends [infer A0, (infer A1)?, ...unknown[]] ? [A0, A1?] : T extends [(infer A0)?, (infer A1)?, ...unknown[]] ? [A0?, A1?] : never;
type WithDevtools<S> = Write<S, StoreDevtools<S>>;
type Action = string | {
type: string;
[x: string | number | symbol]: unknown;
};
type StoreDevtools<S> = S extends {
setState: {
(...a: infer Sa1): infer Sr1;
(...a: infer Sa2): infer Sr2;
};
} ? {
setState(...a: [...a: TakeTwo<Sa1>, action?: Action]): Sr1;
setState(...a: [...a: TakeTwo<Sa2>, action?: Action]): Sr2;
} : never;
export interface DevtoolsOptions extends Config {
name?: string;
enabled?: boolean;
anonymousActionType?: string;
store?: string;
}
type Devtools = <T, Mps extends [StoreMutatorIdentifier, unknown][] = [], Mcs extends [StoreMutatorIdentifier, unknown][] = [], U = T>(initializer: StateCreator<T, [...Mps, ['zustand/devtools', never]], Mcs, U>, devtoolsOptions?: DevtoolsOptions) => StateCreator<T, Mps, [['zustand/devtools', never], ...Mcs]>;
declare module '../vanilla' {
interface StoreMutators<S, A> {
'zustand/devtools': WithDevtools<S>;
}
}
export type NamedSet<T> = WithDevtools<StoreApi<T>>['setState'];
export declare const devtools: Devtools;
export {};

View File

@@ -0,0 +1,242 @@
/**
* 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 {
Action,
Await,
BrowserRouter,
DataRouterContext,
DataRouterStateContext,
ErrorResponseImpl,
FetchersContext,
Form,
FrameworkContext,
HashRouter,
HistoryRouter,
IDLE_BLOCKER,
IDLE_FETCHER,
IDLE_NAVIGATION,
Link,
Links,
LocationContext,
MemoryRouter,
Meta,
NavLink,
Navigate,
NavigationContext,
Outlet,
PrefetchPageLinks,
RemixErrorBoundary,
Route,
RouteContext,
Router,
RouterProvider,
Routes,
Scripts,
ScrollRestoration,
ServerMode,
ServerRouter,
SingleFetchRedirectSymbol,
StaticRouter,
StaticRouterProvider,
ViewTransitionContext,
createBrowserHistory,
createBrowserRouter,
createClientRoutes,
createClientRoutesWithHMRRevalidationOptOut,
createCookie,
createCookieSessionStorage,
createHashRouter,
createMemoryRouter,
createMemorySessionStorage,
createPath,
createRequestHandler,
createRouter,
createRoutesFromChildren,
createRoutesFromElements,
createRoutesStub,
createSearchParams,
createSession,
createSessionStorage,
createStaticHandler,
createStaticRouter,
data,
decodeViaTurboStream,
deserializeErrors,
generatePath,
getPatchRoutesOnNavigationFunction,
getSingleFetchDataStrategy,
href,
invariant,
isCookie,
isRouteErrorResponse,
isSession,
mapRouteProperties,
matchPath,
matchRoutes,
parsePath,
redirect,
redirectDocument,
renderMatches,
replace,
resolvePath,
setDevServerHooks,
shouldHydrateRouteLoader,
unstable_RouterContextProvider,
unstable_createContext,
useActionData,
useAsyncError,
useAsyncValue,
useBeforeUnload,
useBlocker,
useFetcher,
useFetchers,
useFogOFWarDiscovery,
useFormAction,
useHref,
useInRouterContext,
useLinkClickHandler,
useLoaderData,
useLocation,
useMatch,
useMatches,
useNavigate,
useNavigation,
useNavigationType,
useOutlet,
useOutletContext,
useParams,
usePrompt,
useResolvedPath,
useRevalidator,
useRouteError,
useRouteLoaderData,
useRoutes,
useScrollRestoration,
useSearchParams,
useSubmit,
useViewTransitionState
} from "./chunk-KNED5TY2.mjs";
export {
Await,
BrowserRouter,
Form,
HashRouter,
IDLE_BLOCKER,
IDLE_FETCHER,
IDLE_NAVIGATION,
Link,
Links,
MemoryRouter,
Meta,
NavLink,
Navigate,
Action as NavigationType,
Outlet,
PrefetchPageLinks,
Route,
Router,
RouterProvider,
Routes,
Scripts,
ScrollRestoration,
ServerRouter,
StaticRouter,
StaticRouterProvider,
DataRouterContext as UNSAFE_DataRouterContext,
DataRouterStateContext as UNSAFE_DataRouterStateContext,
ErrorResponseImpl as UNSAFE_ErrorResponseImpl,
FetchersContext as UNSAFE_FetchersContext,
FrameworkContext as UNSAFE_FrameworkContext,
LocationContext as UNSAFE_LocationContext,
NavigationContext as UNSAFE_NavigationContext,
RemixErrorBoundary as UNSAFE_RemixErrorBoundary,
RouteContext as UNSAFE_RouteContext,
ServerMode as UNSAFE_ServerMode,
SingleFetchRedirectSymbol as UNSAFE_SingleFetchRedirectSymbol,
ViewTransitionContext as UNSAFE_ViewTransitionContext,
createBrowserHistory as UNSAFE_createBrowserHistory,
createClientRoutes as UNSAFE_createClientRoutes,
createClientRoutesWithHMRRevalidationOptOut as UNSAFE_createClientRoutesWithHMRRevalidationOptOut,
createRouter as UNSAFE_createRouter,
decodeViaTurboStream as UNSAFE_decodeViaTurboStream,
deserializeErrors as UNSAFE_deserializeErrors,
getPatchRoutesOnNavigationFunction as UNSAFE_getPatchRoutesOnNavigationFunction,
getSingleFetchDataStrategy as UNSAFE_getSingleFetchDataStrategy,
invariant as UNSAFE_invariant,
mapRouteProperties as UNSAFE_mapRouteProperties,
shouldHydrateRouteLoader as UNSAFE_shouldHydrateRouteLoader,
useFogOFWarDiscovery as UNSAFE_useFogOFWarDiscovery,
useScrollRestoration as UNSAFE_useScrollRestoration,
createBrowserRouter,
createCookie,
createCookieSessionStorage,
createHashRouter,
createMemoryRouter,
createMemorySessionStorage,
createPath,
createRequestHandler,
createRoutesFromChildren,
createRoutesFromElements,
createRoutesStub,
createSearchParams,
createSession,
createSessionStorage,
createStaticHandler,
createStaticRouter,
data,
generatePath,
href,
isCookie,
isRouteErrorResponse,
isSession,
matchPath,
matchRoutes,
parsePath,
redirect,
redirectDocument,
renderMatches,
replace,
resolvePath,
HistoryRouter as unstable_HistoryRouter,
unstable_RouterContextProvider,
unstable_createContext,
setDevServerHooks as unstable_setDevServerHooks,
usePrompt as unstable_usePrompt,
useActionData,
useAsyncError,
useAsyncValue,
useBeforeUnload,
useBlocker,
useFetcher,
useFetchers,
useFormAction,
useHref,
useInRouterContext,
useLinkClickHandler,
useLoaderData,
useLocation,
useMatch,
useMatches,
useNavigate,
useNavigation,
useNavigationType,
useOutlet,
useOutletContext,
useParams,
useResolvedPath,
useRevalidator,
useRouteError,
useRouteLoaderData,
useRoutes,
useSearchParams,
useSubmit,
useViewTransitionState
};

View File

@@ -0,0 +1,69 @@
export class PDFNodeStream {
constructor(source: any);
source: any;
url: URL;
isHttp: boolean;
isFsUrl: boolean;
headers: Headers;
_fullRequestReader: PDFNodeStreamFsFullReader | PDFNodeStreamFullReader | null;
_rangeRequestReaders: any[];
get _progressiveDataLength(): number;
getFullReader(): PDFNodeStreamFsFullReader | PDFNodeStreamFullReader;
getRangeReader(start: any, end: any): PDFNodeStreamFsRangeReader | PDFNodeStreamRangeReader | null;
cancelAllRequests(reason: any): void;
}
declare class PDFNodeStreamFsFullReader extends BaseFullReader {
}
declare class PDFNodeStreamFullReader extends BaseFullReader {
_request: any;
}
declare class PDFNodeStreamFsRangeReader extends BaseRangeReader {
constructor(stream: any, start: any, end: any);
}
declare class PDFNodeStreamRangeReader extends BaseRangeReader {
constructor(stream: any, start: any, end: any);
_request: any;
}
declare class BaseFullReader {
constructor(stream: any);
_url: any;
_done: boolean;
_storedError: any;
onProgress: any;
_contentLength: any;
_loaded: number;
_filename: any;
_disableRange: any;
_rangeChunkSize: any;
_isStreamingSupported: boolean;
_isRangeSupported: boolean;
_readableStream: any;
_readCapability: any;
_headersCapability: any;
get headersReady(): any;
get filename(): any;
get contentLength(): any;
get isRangeSupported(): boolean;
get isStreamingSupported(): boolean;
read(): any;
cancel(reason: any): void;
_error(reason: any): void;
_setReadableStream(readableStream: any): void;
}
declare class BaseRangeReader {
constructor(stream: any);
_url: any;
_done: boolean;
_storedError: any;
onProgress: any;
_loaded: number;
_readableStream: any;
_readCapability: any;
_isStreamingSupported: boolean;
get isStreamingSupported(): boolean;
read(): any;
cancel(reason: any): void;
_error(reason: any): void;
_setReadableStream(readableStream: any): void;
}
export {};

View File

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

View File

@@ -0,0 +1,12 @@
export default KEYS;
export type VisitorKeys = {
readonly [type: string]: ReadonlyArray<string>;
};
/**
* @typedef {{ readonly [type: string]: ReadonlyArray<string> }} VisitorKeys
*/
/**
* @type {VisitorKeys}
*/
declare const KEYS: VisitorKeys;
//# sourceMappingURL=visitor-keys.d.ts.map

View File

@@ -0,0 +1,22 @@
{
"author": "Mikeal Rogers <mikeal.rogers@gmail.com> (http://www.futurealoof.com)",
"name": "tunnel-agent",
"license": "Apache-2.0",
"description": "HTTP proxy tunneling agent. Formerly part of mikeal/request, now a standalone module.",
"version": "0.6.0",
"repository": {
"url": "https://github.com/mikeal/tunnel-agent"
},
"main": "index.js",
"files": [
"index.js"
],
"dependencies": {
"safe-buffer": "^5.0.1"
},
"devDependencies": {},
"optionalDependencies": {},
"engines": {
"node": "*"
}
}

View File

@@ -0,0 +1,548 @@
import {
BaseRootRoute,
BaseRoute,
BaseRouteApi,
notFound,
} from '@tanstack/router-core'
import { useLoaderData } from './useLoaderData'
import { useLoaderDeps } from './useLoaderDeps'
import { useParams } from './useParams'
import { useSearch } from './useSearch'
import { useNavigate } from './useNavigate'
import { useMatch } from './useMatch'
import { useRouter } from './useRouter'
import type {
AnyContext,
AnyRoute,
AnyRouter,
ConstrainLiteral,
ErrorComponentProps,
NotFoundError,
NotFoundRouteProps,
RegisteredRouter,
ResolveFullPath,
ResolveId,
ResolveParams,
RootRouteId,
RootRouteOptions,
RouteConstraints,
RouteIds,
RouteMask,
RouteOptions,
RouteTypesById,
RouterCore,
ToMaskOptions,
UseNavigateResult,
} from '@tanstack/router-core'
import type { UseLoaderDataRoute } from './useLoaderData'
import type { UseMatchRoute } from './useMatch'
import type { UseLoaderDepsRoute } from './useLoaderDeps'
import type { UseParamsRoute } from './useParams'
import type { UseSearchRoute } from './useSearch'
import type * as React from 'react'
import type { UseRouteContextRoute } from './useRouteContext'
declare module '@tanstack/router-core' {
export interface UpdatableRouteOptionsExtensions {
component?: RouteComponent
errorComponent?: false | null | ErrorRouteComponent
notFoundComponent?: NotFoundRouteComponent
pendingComponent?: RouteComponent
}
export interface RouteExtensions<
TId extends string,
TFullPath extends string,
> {
useMatch: UseMatchRoute<TId>
useRouteContext: UseRouteContextRoute<TId>
useSearch: UseSearchRoute<TId>
useParams: UseParamsRoute<TId>
useLoaderDeps: UseLoaderDepsRoute<TId>
useLoaderData: UseLoaderDataRoute<TId>
useNavigate: () => UseNavigateResult<TFullPath>
}
}
export function getRouteApi<
const TId,
TRouter extends AnyRouter = RegisteredRouter,
>(id: ConstrainLiteral<TId, RouteIds<TRouter['routeTree']>>) {
return new RouteApi<TId, TRouter>({ id })
}
export class RouteApi<
TId,
TRouter extends AnyRouter = RegisteredRouter,
> extends BaseRouteApi<TId, TRouter> {
/**
* @deprecated Use the `getRouteApi` function instead.
*/
constructor({ id }: { id: TId }) {
super({ id })
}
useMatch: UseMatchRoute<TId> = (opts) => {
return useMatch({
select: opts?.select,
from: this.id,
structuralSharing: opts?.structuralSharing,
} as any) as any
}
useRouteContext: UseRouteContextRoute<TId> = (opts) => {
return useMatch({
from: this.id as any,
select: (d) => (opts?.select ? opts.select(d.context) : d.context),
}) as any
}
useSearch: UseSearchRoute<TId> = (opts) => {
// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion
return useSearch({
select: opts?.select,
structuralSharing: opts?.structuralSharing,
from: this.id,
} as any) as any
}
useParams: UseParamsRoute<TId> = (opts) => {
// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion
return useParams({
select: opts?.select,
structuralSharing: opts?.structuralSharing,
from: this.id,
} as any) as any
}
useLoaderDeps: UseLoaderDepsRoute<TId> = (opts) => {
return useLoaderDeps({ ...opts, from: this.id, strict: false } as any)
}
useLoaderData: UseLoaderDataRoute<TId> = (opts) => {
return useLoaderData({ ...opts, from: this.id, strict: false } as any)
}
useNavigate = (): UseNavigateResult<
RouteTypesById<TRouter, TId>['fullPath']
> => {
const router = useRouter()
return useNavigate({ from: router.routesById[this.id as string].fullPath })
}
notFound = (opts?: NotFoundError) => {
return notFound({ routeId: this.id as string, ...opts })
}
}
export class Route<
in out TParentRoute extends RouteConstraints['TParentRoute'] = AnyRoute,
in out TPath extends RouteConstraints['TPath'] = '/',
in out TFullPath extends RouteConstraints['TFullPath'] = ResolveFullPath<
TParentRoute,
TPath
>,
in out TCustomId extends RouteConstraints['TCustomId'] = string,
in out TId extends RouteConstraints['TId'] = ResolveId<
TParentRoute,
TCustomId,
TPath
>,
in out TSearchValidator = undefined,
in out TParams = ResolveParams<TPath>,
in out TRouterContext = AnyContext,
in out TRouteContextFn = AnyContext,
in out TBeforeLoadFn = AnyContext,
in out TLoaderDeps extends Record<string, any> = {},
in out TLoaderFn = undefined,
in out TChildren = unknown,
in out TFileRouteTypes = unknown,
> extends BaseRoute<
TParentRoute,
TPath,
TFullPath,
TCustomId,
TId,
TSearchValidator,
TParams,
TRouterContext,
TRouteContextFn,
TBeforeLoadFn,
TLoaderDeps,
TLoaderFn,
TChildren,
TFileRouteTypes
> {
/**
* @deprecated Use the `createRoute` function instead.
*/
constructor(
options?: RouteOptions<
TParentRoute,
TId,
TCustomId,
TFullPath,
TPath,
TSearchValidator,
TParams,
TLoaderDeps,
TLoaderFn,
TRouterContext,
TRouteContextFn,
TBeforeLoadFn
>,
) {
super(options)
;(this as any).$$typeof = Symbol.for('react.memo')
}
useMatch: UseMatchRoute<TId> = (opts) => {
return useMatch({
select: opts?.select,
from: this.id,
structuralSharing: opts?.structuralSharing,
} as any) as any
}
useRouteContext: UseRouteContextRoute<TId> = (opts?) => {
return useMatch({
...opts,
from: this.id,
select: (d) => (opts?.select ? opts.select(d.context) : d.context),
}) as any
}
useSearch: UseSearchRoute<TId> = (opts) => {
// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion
return useSearch({
select: opts?.select,
structuralSharing: opts?.structuralSharing,
from: this.id,
} as any) as any
}
useParams: UseParamsRoute<TId> = (opts) => {
// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion
return useParams({
select: opts?.select,
structuralSharing: opts?.structuralSharing,
from: this.id,
} as any) as any
}
useLoaderDeps: UseLoaderDepsRoute<TId> = (opts) => {
return useLoaderDeps({ ...opts, from: this.id } as any)
}
useLoaderData: UseLoaderDataRoute<TId> = (opts) => {
return useLoaderData({ ...opts, from: this.id } as any)
}
useNavigate = (): UseNavigateResult<TFullPath> => {
return useNavigate({ from: this.fullPath })
}
}
export function createRoute<
TParentRoute extends RouteConstraints['TParentRoute'] = AnyRoute,
TPath extends RouteConstraints['TPath'] = '/',
TFullPath extends RouteConstraints['TFullPath'] = ResolveFullPath<
TParentRoute,
TPath
>,
TCustomId extends RouteConstraints['TCustomId'] = string,
TId extends RouteConstraints['TId'] = ResolveId<
TParentRoute,
TCustomId,
TPath
>,
TSearchValidator = undefined,
TParams = ResolveParams<TPath>,
TRouteContextFn = AnyContext,
TBeforeLoadFn = AnyContext,
TLoaderDeps extends Record<string, any> = {},
TLoaderFn = undefined,
TChildren = unknown,
>(
options: RouteOptions<
TParentRoute,
TId,
TCustomId,
TFullPath,
TPath,
TSearchValidator,
TParams,
TLoaderDeps,
TLoaderFn,
AnyContext,
TRouteContextFn,
TBeforeLoadFn
>,
): Route<
TParentRoute,
TPath,
TFullPath,
TCustomId,
TId,
TSearchValidator,
TParams,
AnyContext,
TRouteContextFn,
TBeforeLoadFn,
TLoaderDeps,
TLoaderFn,
TChildren
> {
return new Route<
TParentRoute,
TPath,
TFullPath,
TCustomId,
TId,
TSearchValidator,
TParams,
AnyContext,
TRouteContextFn,
TBeforeLoadFn,
TLoaderDeps,
TLoaderFn,
TChildren
>(options)
}
export type AnyRootRoute = RootRoute<any, any, any, any, any, any, any, any>
export function createRootRouteWithContext<TRouterContext extends {}>() {
return <
TRouteContextFn = AnyContext,
TBeforeLoadFn = AnyContext,
TSearchValidator = undefined,
TLoaderDeps extends Record<string, any> = {},
TLoaderFn = undefined,
>(
options?: RootRouteOptions<
TSearchValidator,
TRouterContext,
TRouteContextFn,
TBeforeLoadFn,
TLoaderDeps,
TLoaderFn
>,
) => {
return createRootRoute<
TSearchValidator,
TRouterContext,
TRouteContextFn,
TBeforeLoadFn,
TLoaderDeps,
TLoaderFn
>(options as any)
}
}
/**
* @deprecated Use the `createRootRouteWithContext` function instead.
*/
export const rootRouteWithContext = createRootRouteWithContext
export class RootRoute<
in out TSearchValidator = undefined,
in out TRouterContext = {},
in out TRouteContextFn = AnyContext,
in out TBeforeLoadFn = AnyContext,
in out TLoaderDeps extends Record<string, any> = {},
in out TLoaderFn = undefined,
in out TChildren = unknown,
in out TFileRouteTypes = unknown,
> extends BaseRootRoute<
TSearchValidator,
TRouterContext,
TRouteContextFn,
TBeforeLoadFn,
TLoaderDeps,
TLoaderFn,
TChildren,
TFileRouteTypes
> {
/**
* @deprecated `RootRoute` is now an internal implementation detail. Use `createRootRoute()` instead.
*/
constructor(
options?: RootRouteOptions<
TSearchValidator,
TRouterContext,
TRouteContextFn,
TBeforeLoadFn,
TLoaderDeps,
TLoaderFn
>,
) {
super(options)
;(this as any).$$typeof = Symbol.for('react.memo')
}
useMatch: UseMatchRoute<RootRouteId> = (opts) => {
return useMatch({
select: opts?.select,
from: this.id,
structuralSharing: opts?.structuralSharing,
} as any) as any
}
useRouteContext: UseRouteContextRoute<RootRouteId> = (opts) => {
return useMatch({
...opts,
from: this.id,
select: (d) => (opts?.select ? opts.select(d.context) : d.context),
}) as any
}
useSearch: UseSearchRoute<RootRouteId> = (opts) => {
// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion
return useSearch({
select: opts?.select,
structuralSharing: opts?.structuralSharing,
from: this.id,
} as any) as any
}
useParams: UseParamsRoute<RootRouteId> = (opts) => {
// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion
return useParams({
select: opts?.select,
structuralSharing: opts?.structuralSharing,
from: this.id,
} as any) as any
}
useLoaderDeps: UseLoaderDepsRoute<RootRouteId> = (opts) => {
return useLoaderDeps({ ...opts, from: this.id } as any)
}
useLoaderData: UseLoaderDataRoute<RootRouteId> = (opts) => {
return useLoaderData({ ...opts, from: this.id } as any)
}
useNavigate = (): UseNavigateResult<'/'> => {
return useNavigate({ from: this.fullPath })
}
}
export function createRootRoute<
TSearchValidator = undefined,
TRouterContext = {},
TRouteContextFn = AnyContext,
TBeforeLoadFn = AnyContext,
TLoaderDeps extends Record<string, any> = {},
TLoaderFn = undefined,
>(
options?: RootRouteOptions<
TSearchValidator,
TRouterContext,
TRouteContextFn,
TBeforeLoadFn,
TLoaderDeps,
TLoaderFn
>,
): RootRoute<
TSearchValidator,
TRouterContext,
TRouteContextFn,
TBeforeLoadFn,
TLoaderDeps,
TLoaderFn,
unknown,
unknown
> {
return new RootRoute<
TSearchValidator,
TRouterContext,
TRouteContextFn,
TBeforeLoadFn,
TLoaderDeps,
TLoaderFn
>(options)
}
export function createRouteMask<
TRouteTree extends AnyRoute,
TFrom extends string,
TTo extends string,
>(
opts: {
routeTree: TRouteTree
} & ToMaskOptions<RouterCore<TRouteTree, 'never', boolean>, TFrom, TTo>,
): RouteMask<TRouteTree> {
return opts as any
}
export type ReactNode = any
export type SyncRouteComponent<TProps> =
| ((props: TProps) => ReactNode)
| React.LazyExoticComponent<(props: TProps) => ReactNode>
export type AsyncRouteComponent<TProps> = SyncRouteComponent<TProps> & {
preload?: () => Promise<void>
}
export type RouteComponent<TProps = any> = AsyncRouteComponent<TProps>
export type ErrorRouteComponent = RouteComponent<ErrorComponentProps>
export type NotFoundRouteComponent = SyncRouteComponent<NotFoundRouteProps>
export class NotFoundRoute<
TParentRoute extends AnyRootRoute,
TRouterContext = AnyContext,
TRouteContextFn = AnyContext,
TBeforeLoadFn = AnyContext,
TSearchValidator = undefined,
TLoaderDeps extends Record<string, any> = {},
TLoaderFn = undefined,
TChildren = unknown,
> extends Route<
TParentRoute,
'/404',
'/404',
'404',
'404',
TSearchValidator,
{},
TRouterContext,
TRouteContextFn,
TBeforeLoadFn,
TLoaderDeps,
TLoaderFn,
TChildren
> {
constructor(
options: Omit<
RouteOptions<
TParentRoute,
string,
string,
string,
string,
TSearchValidator,
{},
TLoaderDeps,
TLoaderFn,
TRouterContext,
TRouteContextFn,
TBeforeLoadFn
>,
| 'caseSensitive'
| 'parseParams'
| 'stringifyParams'
| 'path'
| 'id'
| 'params'
>,
) {
super({
...(options as any),
id: '404',
})
}
}