update
This commit is contained in:
@@ -0,0 +1 @@
|
||||
module.exports={A:{A:{"2":"K D E F mC","132":"A B"},B:{"132":"C L M G N O P","1028":"0 9 Q H R S T U V W X Y Z a b c d e f g h i j k l m n o p q r s t u v w x y z AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB I"},C:{"2":"1 2 3 4 5 6 7 8 nC LC J PB K D E F A B C L M G N O P QB RB SB TB UB VB qC rC","1028":"0 9 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","2564":"WB XB YB ZB aB bB cB dB eB fB gB hB iB jB kB lB","3076":"mB nB oB pB qB rB sB tB uB vB MC wB NC xB yB zB 0B 1B 2B 3B"},D:{"16":"J PB K D","132":"1 2 3 4 5 6 7 8 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","388":"E","1028":"0 9 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:{"16":"J sC SC","132":"PB K D E F A tC uC vC wC TC","1028":"B C L M G FC GC xC yC zC UC VC HC 0C IC WC XC YC ZC aC 1C JC bC cC dC eC fC 2C KC gC hC iC jC 3C"},F:{"2":"F B C 4C 5C 6C 7C FC kC 8C GC","132":"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","1028":"0 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:{"16":"SC 9C lC","132":"E AD BD CD DD ED FD GD HD","1028":"ID JD KD LD MD ND OD PD QD RD SD UC VC HC TD IC WC XC YC ZC aC UD JC bC cC dC eC fC VD KC gC hC iC jC"},H:{"2":"WD"},I:{"132":"J aD lC bD cD","292":"LC XD YD ZD","1028":"I"},J:{"16":"D","132":"A"},K:{"2":"A B C FC kC GC","1028":"H"},L:{"1028":"I"},M:{"1028":"EC"},N:{"132":"A B"},O:{"1028":"HC"},P:{"132":"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:{"1028":"oD"},R:{"1028":"pD"},S:{"1028":"rD","2564":"qD"}},B:4,C:"DOMMatrix",D:true};
|
||||
@@ -0,0 +1,154 @@
|
||||
// Generated by LiveScript 1.6.0
|
||||
var values, keys, pairsToObj, objToPairs, listsToObj, objToLists, empty, each, map, compact, filter, reject, partition, find;
|
||||
values = function(object){
|
||||
var i$, x, results$ = [];
|
||||
for (i$ in object) {
|
||||
x = object[i$];
|
||||
results$.push(x);
|
||||
}
|
||||
return results$;
|
||||
};
|
||||
keys = function(object){
|
||||
var x, results$ = [];
|
||||
for (x in object) {
|
||||
results$.push(x);
|
||||
}
|
||||
return results$;
|
||||
};
|
||||
pairsToObj = function(object){
|
||||
var i$, len$, x, resultObj$ = {};
|
||||
for (i$ = 0, len$ = object.length; i$ < len$; ++i$) {
|
||||
x = object[i$];
|
||||
resultObj$[x[0]] = x[1];
|
||||
}
|
||||
return resultObj$;
|
||||
};
|
||||
objToPairs = function(object){
|
||||
var key, value, results$ = [];
|
||||
for (key in object) {
|
||||
value = object[key];
|
||||
results$.push([key, value]);
|
||||
}
|
||||
return results$;
|
||||
};
|
||||
listsToObj = curry$(function(keys, values){
|
||||
var i$, len$, i, key, resultObj$ = {};
|
||||
for (i$ = 0, len$ = keys.length; i$ < len$; ++i$) {
|
||||
i = i$;
|
||||
key = keys[i$];
|
||||
resultObj$[key] = values[i];
|
||||
}
|
||||
return resultObj$;
|
||||
});
|
||||
objToLists = function(object){
|
||||
var keys, values, key, value;
|
||||
keys = [];
|
||||
values = [];
|
||||
for (key in object) {
|
||||
value = object[key];
|
||||
keys.push(key);
|
||||
values.push(value);
|
||||
}
|
||||
return [keys, values];
|
||||
};
|
||||
empty = function(object){
|
||||
var x;
|
||||
for (x in object) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
};
|
||||
each = curry$(function(f, object){
|
||||
var i$, x;
|
||||
for (i$ in object) {
|
||||
x = object[i$];
|
||||
f(x);
|
||||
}
|
||||
return object;
|
||||
});
|
||||
map = curry$(function(f, object){
|
||||
var k, x, resultObj$ = {};
|
||||
for (k in object) {
|
||||
x = object[k];
|
||||
resultObj$[k] = f(x);
|
||||
}
|
||||
return resultObj$;
|
||||
});
|
||||
compact = function(object){
|
||||
var k, x, resultObj$ = {};
|
||||
for (k in object) {
|
||||
x = object[k];
|
||||
if (x) {
|
||||
resultObj$[k] = x;
|
||||
}
|
||||
}
|
||||
return resultObj$;
|
||||
};
|
||||
filter = curry$(function(f, object){
|
||||
var k, x, resultObj$ = {};
|
||||
for (k in object) {
|
||||
x = object[k];
|
||||
if (f(x)) {
|
||||
resultObj$[k] = x;
|
||||
}
|
||||
}
|
||||
return resultObj$;
|
||||
});
|
||||
reject = curry$(function(f, object){
|
||||
var k, x, resultObj$ = {};
|
||||
for (k in object) {
|
||||
x = object[k];
|
||||
if (!f(x)) {
|
||||
resultObj$[k] = x;
|
||||
}
|
||||
}
|
||||
return resultObj$;
|
||||
});
|
||||
partition = curry$(function(f, object){
|
||||
var passed, failed, k, x;
|
||||
passed = {};
|
||||
failed = {};
|
||||
for (k in object) {
|
||||
x = object[k];
|
||||
(f(x) ? passed : failed)[k] = x;
|
||||
}
|
||||
return [passed, failed];
|
||||
});
|
||||
find = curry$(function(f, object){
|
||||
var i$, x;
|
||||
for (i$ in object) {
|
||||
x = object[i$];
|
||||
if (f(x)) {
|
||||
return x;
|
||||
}
|
||||
}
|
||||
});
|
||||
module.exports = {
|
||||
values: values,
|
||||
keys: keys,
|
||||
pairsToObj: pairsToObj,
|
||||
objToPairs: objToPairs,
|
||||
listsToObj: listsToObj,
|
||||
objToLists: objToLists,
|
||||
empty: empty,
|
||||
each: each,
|
||||
map: map,
|
||||
filter: filter,
|
||||
compact: compact,
|
||||
reject: reject,
|
||||
partition: partition,
|
||||
find: find
|
||||
};
|
||||
function curry$(f, bound){
|
||||
var context,
|
||||
_curry = function(args) {
|
||||
return f.length > 1 ? function(){
|
||||
var params = args ? args.concat() : [];
|
||||
context = bound ? context || this : this;
|
||||
return params.push.apply(params, arguments) <
|
||||
f.length && arguments.length ?
|
||||
_curry.call(context, params) : f.apply(context, params);
|
||||
} : f;
|
||||
};
|
||||
return _curry();
|
||||
}
|
||||
@@ -0,0 +1,282 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.BreakStatement = BreakStatement;
|
||||
exports.CatchClause = CatchClause;
|
||||
exports.ContinueStatement = ContinueStatement;
|
||||
exports.DebuggerStatement = DebuggerStatement;
|
||||
exports.DoWhileStatement = DoWhileStatement;
|
||||
exports.ForOfStatement = exports.ForInStatement = void 0;
|
||||
exports.ForStatement = ForStatement;
|
||||
exports.IfStatement = IfStatement;
|
||||
exports.LabeledStatement = LabeledStatement;
|
||||
exports.ReturnStatement = ReturnStatement;
|
||||
exports.SwitchCase = SwitchCase;
|
||||
exports.SwitchStatement = SwitchStatement;
|
||||
exports.ThrowStatement = ThrowStatement;
|
||||
exports.TryStatement = TryStatement;
|
||||
exports.VariableDeclaration = VariableDeclaration;
|
||||
exports.VariableDeclarator = VariableDeclarator;
|
||||
exports.WhileStatement = WhileStatement;
|
||||
exports.WithStatement = WithStatement;
|
||||
var _t = require("@babel/types");
|
||||
var _index = require("../node/index.js");
|
||||
const {
|
||||
isFor,
|
||||
isForStatement,
|
||||
isIfStatement,
|
||||
isStatement
|
||||
} = _t;
|
||||
function WithStatement(node) {
|
||||
this.word("with");
|
||||
this.space();
|
||||
this.tokenChar(40);
|
||||
this.print(node.object);
|
||||
this.tokenChar(41);
|
||||
this.printBlock(node);
|
||||
}
|
||||
function IfStatement(node) {
|
||||
this.word("if");
|
||||
this.space();
|
||||
this.tokenChar(40);
|
||||
this.print(node.test);
|
||||
this.tokenChar(41);
|
||||
this.space();
|
||||
const needsBlock = node.alternate && isIfStatement(getLastStatement(node.consequent));
|
||||
if (needsBlock) {
|
||||
this.tokenChar(123);
|
||||
this.newline();
|
||||
this.indent();
|
||||
}
|
||||
this.printAndIndentOnComments(node.consequent);
|
||||
if (needsBlock) {
|
||||
this.dedent();
|
||||
this.newline();
|
||||
this.tokenChar(125);
|
||||
}
|
||||
if (node.alternate) {
|
||||
if (this.endsWith(125)) this.space();
|
||||
this.word("else");
|
||||
this.space();
|
||||
this.printAndIndentOnComments(node.alternate);
|
||||
}
|
||||
}
|
||||
function getLastStatement(statement) {
|
||||
const {
|
||||
body
|
||||
} = statement;
|
||||
if (isStatement(body) === false) {
|
||||
return statement;
|
||||
}
|
||||
return getLastStatement(body);
|
||||
}
|
||||
function ForStatement(node) {
|
||||
this.word("for");
|
||||
this.space();
|
||||
this.tokenChar(40);
|
||||
{
|
||||
const exit = this.enterForStatementInit();
|
||||
this.tokenContext |= _index.TokenContext.forHead;
|
||||
this.print(node.init);
|
||||
exit();
|
||||
}
|
||||
this.tokenChar(59);
|
||||
if (node.test) {
|
||||
this.space();
|
||||
this.print(node.test);
|
||||
}
|
||||
this.token(";", false, 1);
|
||||
if (node.update) {
|
||||
this.space();
|
||||
this.print(node.update);
|
||||
}
|
||||
this.tokenChar(41);
|
||||
this.printBlock(node);
|
||||
}
|
||||
function WhileStatement(node) {
|
||||
this.word("while");
|
||||
this.space();
|
||||
this.tokenChar(40);
|
||||
this.print(node.test);
|
||||
this.tokenChar(41);
|
||||
this.printBlock(node);
|
||||
}
|
||||
function ForXStatement(node) {
|
||||
this.word("for");
|
||||
this.space();
|
||||
const isForOf = node.type === "ForOfStatement";
|
||||
if (isForOf && node.await) {
|
||||
this.word("await");
|
||||
this.space();
|
||||
}
|
||||
this.noIndentInnerCommentsHere();
|
||||
this.tokenChar(40);
|
||||
{
|
||||
const exit = isForOf ? null : this.enterForStatementInit();
|
||||
this.tokenContext |= isForOf ? _index.TokenContext.forOfHead : _index.TokenContext.forInHead;
|
||||
this.print(node.left);
|
||||
exit == null || exit();
|
||||
}
|
||||
this.space();
|
||||
this.word(isForOf ? "of" : "in");
|
||||
this.space();
|
||||
this.print(node.right);
|
||||
this.tokenChar(41);
|
||||
this.printBlock(node);
|
||||
}
|
||||
const ForInStatement = exports.ForInStatement = ForXStatement;
|
||||
const ForOfStatement = exports.ForOfStatement = ForXStatement;
|
||||
function DoWhileStatement(node) {
|
||||
this.word("do");
|
||||
this.space();
|
||||
this.print(node.body);
|
||||
this.space();
|
||||
this.word("while");
|
||||
this.space();
|
||||
this.tokenChar(40);
|
||||
this.print(node.test);
|
||||
this.tokenChar(41);
|
||||
this.semicolon();
|
||||
}
|
||||
function printStatementAfterKeyword(printer, node) {
|
||||
if (node) {
|
||||
printer.space();
|
||||
printer.printTerminatorless(node);
|
||||
}
|
||||
printer.semicolon();
|
||||
}
|
||||
function BreakStatement(node) {
|
||||
this.word("break");
|
||||
printStatementAfterKeyword(this, node.label);
|
||||
}
|
||||
function ContinueStatement(node) {
|
||||
this.word("continue");
|
||||
printStatementAfterKeyword(this, node.label);
|
||||
}
|
||||
function ReturnStatement(node) {
|
||||
this.word("return");
|
||||
printStatementAfterKeyword(this, node.argument);
|
||||
}
|
||||
function ThrowStatement(node) {
|
||||
this.word("throw");
|
||||
printStatementAfterKeyword(this, node.argument);
|
||||
}
|
||||
function LabeledStatement(node) {
|
||||
this.print(node.label);
|
||||
this.tokenChar(58);
|
||||
this.space();
|
||||
this.print(node.body);
|
||||
}
|
||||
function TryStatement(node) {
|
||||
this.word("try");
|
||||
this.space();
|
||||
this.print(node.block);
|
||||
this.space();
|
||||
if (node.handlers) {
|
||||
this.print(node.handlers[0]);
|
||||
} else {
|
||||
this.print(node.handler);
|
||||
}
|
||||
if (node.finalizer) {
|
||||
this.space();
|
||||
this.word("finally");
|
||||
this.space();
|
||||
this.print(node.finalizer);
|
||||
}
|
||||
}
|
||||
function CatchClause(node) {
|
||||
this.word("catch");
|
||||
this.space();
|
||||
if (node.param) {
|
||||
this.tokenChar(40);
|
||||
this.print(node.param);
|
||||
this.print(node.param.typeAnnotation);
|
||||
this.tokenChar(41);
|
||||
this.space();
|
||||
}
|
||||
this.print(node.body);
|
||||
}
|
||||
function SwitchStatement(node) {
|
||||
this.word("switch");
|
||||
this.space();
|
||||
this.tokenChar(40);
|
||||
this.print(node.discriminant);
|
||||
this.tokenChar(41);
|
||||
this.space();
|
||||
this.tokenChar(123);
|
||||
this.printSequence(node.cases, true, undefined, function addNewlines(leading, cas) {
|
||||
if (!leading && node.cases[node.cases.length - 1] === cas) return -1;
|
||||
});
|
||||
this.rightBrace(node);
|
||||
}
|
||||
function SwitchCase(node) {
|
||||
if (node.test) {
|
||||
this.word("case");
|
||||
this.space();
|
||||
this.print(node.test);
|
||||
this.tokenChar(58);
|
||||
} else {
|
||||
this.word("default");
|
||||
this.tokenChar(58);
|
||||
}
|
||||
if (node.consequent.length) {
|
||||
this.newline();
|
||||
this.printSequence(node.consequent, true);
|
||||
}
|
||||
}
|
||||
function DebuggerStatement() {
|
||||
this.word("debugger");
|
||||
this.semicolon();
|
||||
}
|
||||
function VariableDeclaration(node, parent) {
|
||||
if (node.declare) {
|
||||
this.word("declare");
|
||||
this.space();
|
||||
}
|
||||
const {
|
||||
kind
|
||||
} = node;
|
||||
if (kind === "await using") {
|
||||
this.word("await");
|
||||
this.space();
|
||||
this.word("using", true);
|
||||
} else {
|
||||
this.word(kind, kind === "using");
|
||||
}
|
||||
this.space();
|
||||
let hasInits = false;
|
||||
if (!isFor(parent)) {
|
||||
for (const declar of node.declarations) {
|
||||
if (declar.init) {
|
||||
hasInits = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
this.printList(node.declarations, undefined, undefined, node.declarations.length > 1, hasInits ? function (occurrenceCount) {
|
||||
this.token(",", false, occurrenceCount);
|
||||
this.newline();
|
||||
} : undefined);
|
||||
if (isFor(parent)) {
|
||||
if (isForStatement(parent)) {
|
||||
if (parent.init === node) return;
|
||||
} else {
|
||||
if (parent.left === node) return;
|
||||
}
|
||||
}
|
||||
this.semicolon();
|
||||
}
|
||||
function VariableDeclarator(node) {
|
||||
this.print(node.id);
|
||||
if (node.definite) this.tokenChar(33);
|
||||
this.print(node.id.typeAnnotation);
|
||||
if (node.init) {
|
||||
this.space();
|
||||
this.tokenChar(61);
|
||||
this.space();
|
||||
this.print(node.init);
|
||||
}
|
||||
}
|
||||
|
||||
//# sourceMappingURL=statements.js.map
|
||||
@@ -0,0 +1,246 @@
|
||||
/**
|
||||
* @fileoverview Rule to check the spacing around the * in generator functions.
|
||||
* @author Jamund Ferguson
|
||||
* @deprecated in ESLint v8.53.0
|
||||
*/
|
||||
|
||||
"use strict";
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Rule Definition
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
const OVERRIDE_SCHEMA = {
|
||||
oneOf: [
|
||||
{
|
||||
enum: ["before", "after", "both", "neither"],
|
||||
},
|
||||
{
|
||||
type: "object",
|
||||
properties: {
|
||||
before: { type: "boolean" },
|
||||
after: { type: "boolean" },
|
||||
},
|
||||
additionalProperties: false,
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
/** @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: "generator-star-spacing",
|
||||
url: "https://eslint.style/rules/js/generator-star-spacing",
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
type: "layout",
|
||||
|
||||
docs: {
|
||||
description:
|
||||
"Enforce consistent spacing around `*` operators in generator functions",
|
||||
recommended: false,
|
||||
url: "https://eslint.org/docs/latest/rules/generator-star-spacing",
|
||||
},
|
||||
|
||||
fixable: "whitespace",
|
||||
|
||||
schema: [
|
||||
{
|
||||
oneOf: [
|
||||
{
|
||||
enum: ["before", "after", "both", "neither"],
|
||||
},
|
||||
{
|
||||
type: "object",
|
||||
properties: {
|
||||
before: { type: "boolean" },
|
||||
after: { type: "boolean" },
|
||||
named: OVERRIDE_SCHEMA,
|
||||
anonymous: OVERRIDE_SCHEMA,
|
||||
method: OVERRIDE_SCHEMA,
|
||||
},
|
||||
additionalProperties: false,
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
|
||||
messages: {
|
||||
missingBefore: "Missing space before *.",
|
||||
missingAfter: "Missing space after *.",
|
||||
unexpectedBefore: "Unexpected space before *.",
|
||||
unexpectedAfter: "Unexpected space after *.",
|
||||
},
|
||||
},
|
||||
|
||||
create(context) {
|
||||
const optionDefinitions = {
|
||||
before: { before: true, after: false },
|
||||
after: { before: false, after: true },
|
||||
both: { before: true, after: true },
|
||||
neither: { before: false, after: false },
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns resolved option definitions based on an option and defaults
|
||||
* @param {any} option The option object or string value
|
||||
* @param {Object} defaults The defaults to use if options are not present
|
||||
* @returns {Object} the resolved object definition
|
||||
*/
|
||||
function optionToDefinition(option, defaults) {
|
||||
if (!option) {
|
||||
return defaults;
|
||||
}
|
||||
|
||||
return typeof option === "string"
|
||||
? optionDefinitions[option]
|
||||
: Object.assign({}, defaults, option);
|
||||
}
|
||||
|
||||
const modes = (function (option) {
|
||||
const defaults = optionToDefinition(
|
||||
option,
|
||||
optionDefinitions.before,
|
||||
);
|
||||
|
||||
return {
|
||||
named: optionToDefinition(option.named, defaults),
|
||||
anonymous: optionToDefinition(option.anonymous, defaults),
|
||||
method: optionToDefinition(option.method, defaults),
|
||||
};
|
||||
})(context.options[0] || {});
|
||||
|
||||
const sourceCode = context.sourceCode;
|
||||
|
||||
/**
|
||||
* Checks if the given token is a star token or not.
|
||||
* @param {Token} token The token to check.
|
||||
* @returns {boolean} `true` if the token is a star token.
|
||||
*/
|
||||
function isStarToken(token) {
|
||||
return token.value === "*" && token.type === "Punctuator";
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the generator star token of the given function node.
|
||||
* @param {ASTNode} node The function node to get.
|
||||
* @returns {Token} Found star token.
|
||||
*/
|
||||
function getStarToken(node) {
|
||||
return sourceCode.getFirstToken(
|
||||
node.parent.method || node.parent.type === "MethodDefinition"
|
||||
? node.parent
|
||||
: node,
|
||||
isStarToken,
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* capitalize a given string.
|
||||
* @param {string} str the given string.
|
||||
* @returns {string} the capitalized string.
|
||||
*/
|
||||
function capitalize(str) {
|
||||
return str[0].toUpperCase() + str.slice(1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks the spacing between two tokens before or after the star token.
|
||||
* @param {string} kind Either "named", "anonymous", or "method"
|
||||
* @param {string} side Either "before" or "after".
|
||||
* @param {Token} leftToken `function` keyword token if side is "before", or
|
||||
* star token if side is "after".
|
||||
* @param {Token} rightToken Star token if side is "before", or identifier
|
||||
* token if side is "after".
|
||||
* @returns {void}
|
||||
*/
|
||||
function checkSpacing(kind, side, leftToken, rightToken) {
|
||||
if (
|
||||
!!(rightToken.range[0] - leftToken.range[1]) !==
|
||||
modes[kind][side]
|
||||
) {
|
||||
const after = leftToken.value === "*";
|
||||
const spaceRequired = modes[kind][side];
|
||||
const node = after ? leftToken : rightToken;
|
||||
const messageId = `${spaceRequired ? "missing" : "unexpected"}${capitalize(side)}`;
|
||||
|
||||
context.report({
|
||||
node,
|
||||
messageId,
|
||||
fix(fixer) {
|
||||
if (spaceRequired) {
|
||||
if (after) {
|
||||
return fixer.insertTextAfter(node, " ");
|
||||
}
|
||||
return fixer.insertTextBefore(node, " ");
|
||||
}
|
||||
return fixer.removeRange([
|
||||
leftToken.range[1],
|
||||
rightToken.range[0],
|
||||
]);
|
||||
},
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Enforces the spacing around the star if node is a generator function.
|
||||
* @param {ASTNode} node A function expression or declaration node.
|
||||
* @returns {void}
|
||||
*/
|
||||
function checkFunction(node) {
|
||||
if (!node.generator) {
|
||||
return;
|
||||
}
|
||||
|
||||
const starToken = getStarToken(node);
|
||||
const prevToken = sourceCode.getTokenBefore(starToken);
|
||||
const nextToken = sourceCode.getTokenAfter(starToken);
|
||||
|
||||
let kind = "named";
|
||||
|
||||
if (
|
||||
node.parent.type === "MethodDefinition" ||
|
||||
(node.parent.type === "Property" && node.parent.method)
|
||||
) {
|
||||
kind = "method";
|
||||
} else if (!node.id) {
|
||||
kind = "anonymous";
|
||||
}
|
||||
|
||||
// Only check before when preceded by `function`|`static` keyword
|
||||
if (
|
||||
!(
|
||||
kind === "method" &&
|
||||
starToken === sourceCode.getFirstToken(node.parent)
|
||||
)
|
||||
) {
|
||||
checkSpacing(kind, "before", prevToken, starToken);
|
||||
}
|
||||
|
||||
checkSpacing(kind, "after", starToken, nextToken);
|
||||
}
|
||||
|
||||
return {
|
||||
FunctionDeclaration: checkFunction,
|
||||
FunctionExpression: checkFunction,
|
||||
};
|
||||
},
|
||||
};
|
||||
@@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2015 Nathan Friedly <nathan@nfriedly.com> (http://nfriedly.com/)
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
@@ -0,0 +1,21 @@
|
||||
{
|
||||
"name": "eslint-plugin-react-refresh",
|
||||
"description": "Validate that your components can safely be updated with Fast Refresh",
|
||||
"version": "0.4.19",
|
||||
"type": "commonjs",
|
||||
"author": "Arnaud Barré (https://github.com/ArnaudBarre)",
|
||||
"license": "MIT",
|
||||
"repository": "github:ArnaudBarre/eslint-plugin-react-refresh",
|
||||
"main": "index.js",
|
||||
"types": "index.d.ts",
|
||||
"keywords": [
|
||||
"eslint",
|
||||
"eslint-plugin",
|
||||
"react",
|
||||
"react-refresh",
|
||||
"fast refresh"
|
||||
],
|
||||
"peerDependencies": {
|
||||
"eslint": ">=8.40"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,270 @@
|
||||
'use strict';
|
||||
module.exports = function generate_required(it, $keyword, $ruleType) {
|
||||
var out = ' ';
|
||||
var $lvl = it.level;
|
||||
var $dataLvl = it.dataLevel;
|
||||
var $schema = it.schema[$keyword];
|
||||
var $schemaPath = it.schemaPath + it.util.getProperty($keyword);
|
||||
var $errSchemaPath = it.errSchemaPath + '/' + $keyword;
|
||||
var $breakOnError = !it.opts.allErrors;
|
||||
var $data = 'data' + ($dataLvl || '');
|
||||
var $valid = 'valid' + $lvl;
|
||||
var $isData = it.opts.$data && $schema && $schema.$data,
|
||||
$schemaValue;
|
||||
if ($isData) {
|
||||
out += ' var schema' + ($lvl) + ' = ' + (it.util.getData($schema.$data, $dataLvl, it.dataPathArr)) + '; ';
|
||||
$schemaValue = 'schema' + $lvl;
|
||||
} else {
|
||||
$schemaValue = $schema;
|
||||
}
|
||||
var $vSchema = 'schema' + $lvl;
|
||||
if (!$isData) {
|
||||
if ($schema.length < it.opts.loopRequired && it.schema.properties && Object.keys(it.schema.properties).length) {
|
||||
var $required = [];
|
||||
var arr1 = $schema;
|
||||
if (arr1) {
|
||||
var $property, i1 = -1,
|
||||
l1 = arr1.length - 1;
|
||||
while (i1 < l1) {
|
||||
$property = arr1[i1 += 1];
|
||||
var $propertySch = it.schema.properties[$property];
|
||||
if (!($propertySch && (it.opts.strictKeywords ? (typeof $propertySch == 'object' && Object.keys($propertySch).length > 0) || $propertySch === false : it.util.schemaHasRules($propertySch, it.RULES.all)))) {
|
||||
$required[$required.length] = $property;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
var $required = $schema;
|
||||
}
|
||||
}
|
||||
if ($isData || $required.length) {
|
||||
var $currentErrorPath = it.errorPath,
|
||||
$loopRequired = $isData || $required.length >= it.opts.loopRequired,
|
||||
$ownProperties = it.opts.ownProperties;
|
||||
if ($breakOnError) {
|
||||
out += ' var missing' + ($lvl) + '; ';
|
||||
if ($loopRequired) {
|
||||
if (!$isData) {
|
||||
out += ' var ' + ($vSchema) + ' = validate.schema' + ($schemaPath) + '; ';
|
||||
}
|
||||
var $i = 'i' + $lvl,
|
||||
$propertyPath = 'schema' + $lvl + '[' + $i + ']',
|
||||
$missingProperty = '\' + ' + $propertyPath + ' + \'';
|
||||
if (it.opts._errorDataPathProperty) {
|
||||
it.errorPath = it.util.getPathExpr($currentErrorPath, $propertyPath, it.opts.jsonPointers);
|
||||
}
|
||||
out += ' var ' + ($valid) + ' = true; ';
|
||||
if ($isData) {
|
||||
out += ' if (schema' + ($lvl) + ' === undefined) ' + ($valid) + ' = true; else if (!Array.isArray(schema' + ($lvl) + ')) ' + ($valid) + ' = false; else {';
|
||||
}
|
||||
out += ' for (var ' + ($i) + ' = 0; ' + ($i) + ' < ' + ($vSchema) + '.length; ' + ($i) + '++) { ' + ($valid) + ' = ' + ($data) + '[' + ($vSchema) + '[' + ($i) + ']] !== undefined ';
|
||||
if ($ownProperties) {
|
||||
out += ' && Object.prototype.hasOwnProperty.call(' + ($data) + ', ' + ($vSchema) + '[' + ($i) + ']) ';
|
||||
}
|
||||
out += '; if (!' + ($valid) + ') break; } ';
|
||||
if ($isData) {
|
||||
out += ' } ';
|
||||
}
|
||||
out += ' if (!' + ($valid) + ') { ';
|
||||
var $$outStack = $$outStack || [];
|
||||
$$outStack.push(out);
|
||||
out = ''; /* istanbul ignore else */
|
||||
if (it.createErrors !== false) {
|
||||
out += ' { keyword: \'' + ('required') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { missingProperty: \'' + ($missingProperty) + '\' } ';
|
||||
if (it.opts.messages !== false) {
|
||||
out += ' , message: \'';
|
||||
if (it.opts._errorDataPathProperty) {
|
||||
out += 'is a required property';
|
||||
} else {
|
||||
out += 'should have required property \\\'' + ($missingProperty) + '\\\'';
|
||||
}
|
||||
out += '\' ';
|
||||
}
|
||||
if (it.opts.verbose) {
|
||||
out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';
|
||||
}
|
||||
out += ' } ';
|
||||
} else {
|
||||
out += ' {} ';
|
||||
}
|
||||
var __err = out;
|
||||
out = $$outStack.pop();
|
||||
if (!it.compositeRule && $breakOnError) {
|
||||
/* istanbul ignore if */
|
||||
if (it.async) {
|
||||
out += ' throw new ValidationError([' + (__err) + ']); ';
|
||||
} else {
|
||||
out += ' validate.errors = [' + (__err) + ']; return false; ';
|
||||
}
|
||||
} else {
|
||||
out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ';
|
||||
}
|
||||
out += ' } else { ';
|
||||
} else {
|
||||
out += ' if ( ';
|
||||
var arr2 = $required;
|
||||
if (arr2) {
|
||||
var $propertyKey, $i = -1,
|
||||
l2 = arr2.length - 1;
|
||||
while ($i < l2) {
|
||||
$propertyKey = arr2[$i += 1];
|
||||
if ($i) {
|
||||
out += ' || ';
|
||||
}
|
||||
var $prop = it.util.getProperty($propertyKey),
|
||||
$useData = $data + $prop;
|
||||
out += ' ( ( ' + ($useData) + ' === undefined ';
|
||||
if ($ownProperties) {
|
||||
out += ' || ! Object.prototype.hasOwnProperty.call(' + ($data) + ', \'' + (it.util.escapeQuotes($propertyKey)) + '\') ';
|
||||
}
|
||||
out += ') && (missing' + ($lvl) + ' = ' + (it.util.toQuotedString(it.opts.jsonPointers ? $propertyKey : $prop)) + ') ) ';
|
||||
}
|
||||
}
|
||||
out += ') { ';
|
||||
var $propertyPath = 'missing' + $lvl,
|
||||
$missingProperty = '\' + ' + $propertyPath + ' + \'';
|
||||
if (it.opts._errorDataPathProperty) {
|
||||
it.errorPath = it.opts.jsonPointers ? it.util.getPathExpr($currentErrorPath, $propertyPath, true) : $currentErrorPath + ' + ' + $propertyPath;
|
||||
}
|
||||
var $$outStack = $$outStack || [];
|
||||
$$outStack.push(out);
|
||||
out = ''; /* istanbul ignore else */
|
||||
if (it.createErrors !== false) {
|
||||
out += ' { keyword: \'' + ('required') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { missingProperty: \'' + ($missingProperty) + '\' } ';
|
||||
if (it.opts.messages !== false) {
|
||||
out += ' , message: \'';
|
||||
if (it.opts._errorDataPathProperty) {
|
||||
out += 'is a required property';
|
||||
} else {
|
||||
out += 'should have required property \\\'' + ($missingProperty) + '\\\'';
|
||||
}
|
||||
out += '\' ';
|
||||
}
|
||||
if (it.opts.verbose) {
|
||||
out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';
|
||||
}
|
||||
out += ' } ';
|
||||
} else {
|
||||
out += ' {} ';
|
||||
}
|
||||
var __err = out;
|
||||
out = $$outStack.pop();
|
||||
if (!it.compositeRule && $breakOnError) {
|
||||
/* istanbul ignore if */
|
||||
if (it.async) {
|
||||
out += ' throw new ValidationError([' + (__err) + ']); ';
|
||||
} else {
|
||||
out += ' validate.errors = [' + (__err) + ']; return false; ';
|
||||
}
|
||||
} else {
|
||||
out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ';
|
||||
}
|
||||
out += ' } else { ';
|
||||
}
|
||||
} else {
|
||||
if ($loopRequired) {
|
||||
if (!$isData) {
|
||||
out += ' var ' + ($vSchema) + ' = validate.schema' + ($schemaPath) + '; ';
|
||||
}
|
||||
var $i = 'i' + $lvl,
|
||||
$propertyPath = 'schema' + $lvl + '[' + $i + ']',
|
||||
$missingProperty = '\' + ' + $propertyPath + ' + \'';
|
||||
if (it.opts._errorDataPathProperty) {
|
||||
it.errorPath = it.util.getPathExpr($currentErrorPath, $propertyPath, it.opts.jsonPointers);
|
||||
}
|
||||
if ($isData) {
|
||||
out += ' if (' + ($vSchema) + ' && !Array.isArray(' + ($vSchema) + ')) { var err = '; /* istanbul ignore else */
|
||||
if (it.createErrors !== false) {
|
||||
out += ' { keyword: \'' + ('required') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { missingProperty: \'' + ($missingProperty) + '\' } ';
|
||||
if (it.opts.messages !== false) {
|
||||
out += ' , message: \'';
|
||||
if (it.opts._errorDataPathProperty) {
|
||||
out += 'is a required property';
|
||||
} else {
|
||||
out += 'should have required property \\\'' + ($missingProperty) + '\\\'';
|
||||
}
|
||||
out += '\' ';
|
||||
}
|
||||
if (it.opts.verbose) {
|
||||
out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';
|
||||
}
|
||||
out += ' } ';
|
||||
} else {
|
||||
out += ' {} ';
|
||||
}
|
||||
out += '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } else if (' + ($vSchema) + ' !== undefined) { ';
|
||||
}
|
||||
out += ' for (var ' + ($i) + ' = 0; ' + ($i) + ' < ' + ($vSchema) + '.length; ' + ($i) + '++) { if (' + ($data) + '[' + ($vSchema) + '[' + ($i) + ']] === undefined ';
|
||||
if ($ownProperties) {
|
||||
out += ' || ! Object.prototype.hasOwnProperty.call(' + ($data) + ', ' + ($vSchema) + '[' + ($i) + ']) ';
|
||||
}
|
||||
out += ') { var err = '; /* istanbul ignore else */
|
||||
if (it.createErrors !== false) {
|
||||
out += ' { keyword: \'' + ('required') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { missingProperty: \'' + ($missingProperty) + '\' } ';
|
||||
if (it.opts.messages !== false) {
|
||||
out += ' , message: \'';
|
||||
if (it.opts._errorDataPathProperty) {
|
||||
out += 'is a required property';
|
||||
} else {
|
||||
out += 'should have required property \\\'' + ($missingProperty) + '\\\'';
|
||||
}
|
||||
out += '\' ';
|
||||
}
|
||||
if (it.opts.verbose) {
|
||||
out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';
|
||||
}
|
||||
out += ' } ';
|
||||
} else {
|
||||
out += ' {} ';
|
||||
}
|
||||
out += '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } } ';
|
||||
if ($isData) {
|
||||
out += ' } ';
|
||||
}
|
||||
} else {
|
||||
var arr3 = $required;
|
||||
if (arr3) {
|
||||
var $propertyKey, i3 = -1,
|
||||
l3 = arr3.length - 1;
|
||||
while (i3 < l3) {
|
||||
$propertyKey = arr3[i3 += 1];
|
||||
var $prop = it.util.getProperty($propertyKey),
|
||||
$missingProperty = it.util.escapeQuotes($propertyKey),
|
||||
$useData = $data + $prop;
|
||||
if (it.opts._errorDataPathProperty) {
|
||||
it.errorPath = it.util.getPath($currentErrorPath, $propertyKey, it.opts.jsonPointers);
|
||||
}
|
||||
out += ' if ( ' + ($useData) + ' === undefined ';
|
||||
if ($ownProperties) {
|
||||
out += ' || ! Object.prototype.hasOwnProperty.call(' + ($data) + ', \'' + (it.util.escapeQuotes($propertyKey)) + '\') ';
|
||||
}
|
||||
out += ') { var err = '; /* istanbul ignore else */
|
||||
if (it.createErrors !== false) {
|
||||
out += ' { keyword: \'' + ('required') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { missingProperty: \'' + ($missingProperty) + '\' } ';
|
||||
if (it.opts.messages !== false) {
|
||||
out += ' , message: \'';
|
||||
if (it.opts._errorDataPathProperty) {
|
||||
out += 'is a required property';
|
||||
} else {
|
||||
out += 'should have required property \\\'' + ($missingProperty) + '\\\'';
|
||||
}
|
||||
out += '\' ';
|
||||
}
|
||||
if (it.opts.verbose) {
|
||||
out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';
|
||||
}
|
||||
out += ' } ';
|
||||
} else {
|
||||
out += ' {} ';
|
||||
}
|
||||
out += '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } ';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
it.errorPath = $currentErrorPath;
|
||||
} else if ($breakOnError) {
|
||||
out += ' if (true) {';
|
||||
}
|
||||
return out;
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = isLet;
|
||||
var _index = require("./generated/index.js");
|
||||
{
|
||||
var BLOCK_SCOPED_SYMBOL = Symbol.for("var used to be block scoped");
|
||||
}
|
||||
function isLet(node) {
|
||||
{
|
||||
return (0, _index.isVariableDeclaration)(node) && (node.kind !== "var" || node[BLOCK_SCOPED_SYMBOL]);
|
||||
}
|
||||
}
|
||||
|
||||
//# sourceMappingURL=isLet.js.map
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,77 @@
|
||||
import { decode, encode } from './qss'
|
||||
import type { AnySchema } from './validators'
|
||||
|
||||
export const defaultParseSearch = parseSearchWith(JSON.parse)
|
||||
export const defaultStringifySearch = stringifySearchWith(
|
||||
JSON.stringify,
|
||||
JSON.parse,
|
||||
)
|
||||
|
||||
export function parseSearchWith(parser: (str: string) => any) {
|
||||
return (searchStr: string): AnySchema => {
|
||||
if (searchStr.substring(0, 1) === '?') {
|
||||
searchStr = searchStr.substring(1)
|
||||
}
|
||||
|
||||
const query: Record<string, unknown> = decode(searchStr)
|
||||
|
||||
// Try to parse any query params that might be json
|
||||
for (const key in query) {
|
||||
const value = query[key]
|
||||
if (typeof value === 'string') {
|
||||
try {
|
||||
query[key] = parser(value)
|
||||
} catch (err) {
|
||||
//
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return query
|
||||
}
|
||||
}
|
||||
|
||||
export function stringifySearchWith(
|
||||
stringify: (search: any) => string,
|
||||
parser?: (str: string) => any,
|
||||
) {
|
||||
function stringifyValue(val: any) {
|
||||
if (typeof val === 'object' && val !== null) {
|
||||
try {
|
||||
return stringify(val)
|
||||
} catch (err) {
|
||||
// silent
|
||||
}
|
||||
} else if (typeof val === 'string' && typeof parser === 'function') {
|
||||
try {
|
||||
// Check if it's a valid parseable string.
|
||||
// If it is, then stringify it again.
|
||||
parser(val)
|
||||
return stringify(val)
|
||||
} catch (err) {
|
||||
// silent
|
||||
}
|
||||
}
|
||||
return val
|
||||
}
|
||||
|
||||
return (search: Record<string, any>) => {
|
||||
search = { ...search }
|
||||
|
||||
Object.keys(search).forEach((key) => {
|
||||
const val = search[key]
|
||||
if (typeof val === 'undefined' || val === undefined) {
|
||||
delete search[key]
|
||||
} else {
|
||||
search[key] = stringifyValue(val)
|
||||
}
|
||||
})
|
||||
|
||||
const searchStr = encode(search as Record<string, string>).toString()
|
||||
|
||||
return searchStr ? `?${searchStr}` : ''
|
||||
}
|
||||
}
|
||||
|
||||
export type SearchSerializer = (searchObj: Record<string, any>) => string
|
||||
export type SearchParser = (searchStr: string) => Record<string, any>
|
||||
@@ -0,0 +1,9 @@
|
||||
import { ErrorInfo } from 'react';
|
||||
import { NotFoundError } from '@tanstack/router-core';
|
||||
import * as React from 'react';
|
||||
export declare function CatchNotFound(props: {
|
||||
fallback?: (error: NotFoundError) => React.ReactElement;
|
||||
onCatch?: (error: Error, errorInfo: ErrorInfo) => void;
|
||||
children: React.ReactNode;
|
||||
}): import("react/jsx-runtime").JSX.Element;
|
||||
export declare function DefaultGlobalNotFound(): import("react/jsx-runtime").JSX.Element;
|
||||
@@ -0,0 +1,28 @@
|
||||
import { jsx } from "react/jsx-runtime";
|
||||
import jsesc from "jsesc";
|
||||
function ScriptOnce({
|
||||
children,
|
||||
log
|
||||
}) {
|
||||
if (typeof document !== "undefined") {
|
||||
return null;
|
||||
}
|
||||
return /* @__PURE__ */ jsx(
|
||||
"script",
|
||||
{
|
||||
className: "tsr-once",
|
||||
dangerouslySetInnerHTML: {
|
||||
__html: [
|
||||
children,
|
||||
(log ?? true) && process.env.NODE_ENV === "development" ? `console.info(\`Injected From Server:
|
||||
${jsesc(children.toString(), { quotes: "backtick" })}\`)` : "",
|
||||
'if (typeof __TSR_SSR__ !== "undefined") __TSR_SSR__.cleanScripts()'
|
||||
].filter(Boolean).join("\n")
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
export {
|
||||
ScriptOnce
|
||||
};
|
||||
//# sourceMappingURL=ScriptOnce.js.map
|
||||
@@ -0,0 +1 @@
|
||||
module.exports={A:{A:{"2":"K D E F A B mC"},B:{"1":"0 9 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","2":"C"},C:{"1":"0 9 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","16":"nC","33":"1 2 3 4 5 6 7 8 LC J PB K D E F A B C L M G N O P QB RB SB TB UB VB WB XB YB ZB aB bB cB dB eB fB gB hB iB jB kB lB mB nB oB pB qB rB sB tB uB vB MC wB NC xB yB zB 0B 1B 2B 3B 4B 5B 6B 7B 8B 9B AC BC CC qC rC"},D:{"1":"0 9 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","16":"J PB K D E F A B C L M","132":"1 2 3 4 5 6 7 8 G N O P QB RB SB TB UB VB WB XB YB"},E:{"1":"F A B C L M G wC TC FC GC xC yC zC UC VC HC 0C IC WC XC YC ZC aC 1C JC bC cC dC eC fC 2C KC gC hC iC jC 3C","16":"sC SC","132":"J PB K D E tC uC vC"},F:{"1":"0 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","16":"F B 4C 5C 6C 7C FC","132":"1 2 3 C G N O P QB kC 8C GC"},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","16":"SC 9C","132":"E lC AD BD CD DD"},H:{"2":"WD"},I:{"1":"I","16":"XD YD","132":"LC J ZD aD lC bD cD"},J:{"1":"A","132":"D"},K:{"1":"H","2":"A B FC","132":"C 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":"rD","33":"qD"}},B:1,C:"CSS :read-only and :read-write selectors",D:true};
|
||||
@@ -0,0 +1,36 @@
|
||||
import { NavigateOptions } from './link.cjs';
|
||||
import { RoutePaths } from './routeInfo.cjs';
|
||||
import { AnyRouter, RegisteredRouter } from './router.cjs';
|
||||
import { PickAsRequired } from './utils.cjs';
|
||||
export type AnyRedirect = Redirect<any, any, any, any, any>;
|
||||
/**
|
||||
* @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RedirectType)
|
||||
*/
|
||||
export type Redirect<TRouter extends AnyRouter = RegisteredRouter, TFrom extends RoutePaths<TRouter['routeTree']> | string = '/', TTo extends string | undefined = '.', TMaskFrom extends RoutePaths<TRouter['routeTree']> | string = TFrom, TMaskTo extends string = '.'> = {
|
||||
href?: string;
|
||||
/**
|
||||
* @deprecated Use `statusCode` instead
|
||||
**/
|
||||
code?: number;
|
||||
/**
|
||||
* The HTTP status code to use when redirecting.
|
||||
* @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RedirectType#statuscode-property)
|
||||
*/
|
||||
statusCode?: number;
|
||||
/**
|
||||
* If provided, will throw the redirect object instead of returning it. This can be useful in places where `throwing` in a function might cause it to have a return type of `never`. In that case, you can use `redirect({ throw: true })` to throw the redirect object instead of returning it.
|
||||
* @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RedirectType#throw-property)
|
||||
*/
|
||||
throw?: any;
|
||||
/**
|
||||
* The HTTP headers to use when redirecting.
|
||||
* @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RedirectType#headers-property)
|
||||
*/
|
||||
headers?: HeadersInit;
|
||||
} & NavigateOptions<TRouter, TFrom, TTo, TMaskFrom, TMaskTo>;
|
||||
export type ResolvedRedirect<TRouter extends AnyRouter = RegisteredRouter, TFrom extends RoutePaths<TRouter['routeTree']> = '/', TTo extends string = '', TMaskFrom extends RoutePaths<TRouter['routeTree']> = TFrom, TMaskTo extends string = ''> = PickAsRequired<Redirect<TRouter, TFrom, TTo, TMaskFrom, TMaskTo>, 'code' | 'statusCode' | 'headers'> & {
|
||||
href: string;
|
||||
};
|
||||
export declare function redirect<TRouter extends RegisteredRouter, const TTo extends string | undefined, const TFrom extends string = string, const TMaskFrom extends string = TFrom, const TMaskTo extends string = ''>(opts: Redirect<TRouter, TFrom, TTo, TMaskFrom, TMaskTo>): Redirect<TRouter, TFrom, TTo, TMaskFrom, TMaskTo>;
|
||||
export declare function isRedirect(obj: any): obj is AnyRedirect;
|
||||
export declare function isResolvedRedirect(obj: any): obj is ResolvedRedirect;
|
||||
@@ -0,0 +1,120 @@
|
||||
/// <reference types="../types/index.d.ts" />
|
||||
|
||||
// (c) 2020-present Andrea Giammarchi
|
||||
|
||||
const {parse: $parse, stringify: $stringify} = JSON;
|
||||
const {keys} = Object;
|
||||
|
||||
const Primitive = String; // it could be Number
|
||||
const primitive = 'string'; // it could be 'number'
|
||||
|
||||
const ignore = {};
|
||||
const object = 'object';
|
||||
|
||||
const noop = (_, value) => value;
|
||||
|
||||
const primitives = value => (
|
||||
value instanceof Primitive ? Primitive(value) : value
|
||||
);
|
||||
|
||||
const Primitives = (_, value) => (
|
||||
typeof value === primitive ? new Primitive(value) : value
|
||||
);
|
||||
|
||||
const revive = (input, parsed, output, $) => {
|
||||
const lazy = [];
|
||||
for (let ke = keys(output), {length} = ke, y = 0; y < length; y++) {
|
||||
const k = ke[y];
|
||||
const value = output[k];
|
||||
if (value instanceof Primitive) {
|
||||
const tmp = input[value];
|
||||
if (typeof tmp === object && !parsed.has(tmp)) {
|
||||
parsed.add(tmp);
|
||||
output[k] = ignore;
|
||||
lazy.push({k, a: [input, parsed, tmp, $]});
|
||||
}
|
||||
else
|
||||
output[k] = $.call(output, k, tmp);
|
||||
}
|
||||
else if (output[k] !== ignore)
|
||||
output[k] = $.call(output, k, value);
|
||||
}
|
||||
for (let {length} = lazy, i = 0; i < length; i++) {
|
||||
const {k, a} = lazy[i];
|
||||
output[k] = $.call(output, k, revive.apply(null, a));
|
||||
}
|
||||
return output;
|
||||
};
|
||||
|
||||
const set = (known, input, value) => {
|
||||
const index = Primitive(input.push(value) - 1);
|
||||
known.set(value, index);
|
||||
return index;
|
||||
};
|
||||
|
||||
/**
|
||||
* Converts a specialized flatted string into a JS value.
|
||||
* @param {string} text
|
||||
* @param {(this: any, key: string, value: any) => any} [reviver]
|
||||
* @returns {any}
|
||||
*/
|
||||
export const parse = (text, reviver) => {
|
||||
const input = $parse(text, Primitives).map(primitives);
|
||||
const value = input[0];
|
||||
const $ = reviver || noop;
|
||||
const tmp = typeof value === object && value ?
|
||||
revive(input, new Set, value, $) :
|
||||
value;
|
||||
return $.call({'': tmp}, '', tmp);
|
||||
};
|
||||
|
||||
/**
|
||||
* Converts a JS value into a specialized flatted string.
|
||||
* @param {any} value
|
||||
* @param {((this: any, key: string, value: any) => any) | (string | number)[] | null | undefined} [replacer]
|
||||
* @param {string | number | undefined} [space]
|
||||
* @returns {string}
|
||||
*/
|
||||
export const stringify = (value, replacer, space) => {
|
||||
const $ = replacer && typeof replacer === object ?
|
||||
(k, v) => (k === '' || -1 < replacer.indexOf(k) ? v : void 0) :
|
||||
(replacer || noop);
|
||||
const known = new Map;
|
||||
const input = [];
|
||||
const output = [];
|
||||
let i = +set(known, input, $.call({'': value}, '', value));
|
||||
let firstRun = !i;
|
||||
while (i < input.length) {
|
||||
firstRun = true;
|
||||
output[i] = $stringify(input[i++], replace, space);
|
||||
}
|
||||
return '[' + output.join(',') + ']';
|
||||
function replace(key, value) {
|
||||
if (firstRun) {
|
||||
firstRun = !firstRun;
|
||||
return value;
|
||||
}
|
||||
const after = $.call(this, key, value);
|
||||
switch (typeof after) {
|
||||
case object:
|
||||
if (after === null) return after;
|
||||
case primitive:
|
||||
return known.get(after) || set(known, input, after);
|
||||
}
|
||||
return after;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Converts a generic value into a JSON serializable object without losing recursion.
|
||||
* @param {any} value
|
||||
* @returns {any}
|
||||
*/
|
||||
export const toJSON = value => $parse(stringify(value));
|
||||
|
||||
/**
|
||||
* Converts a previously serialized object with recursion into a recursive one.
|
||||
* @param {any} value
|
||||
* @returns {any}
|
||||
*/
|
||||
export const fromJSON = value => parse($stringify(value));
|
||||
@@ -0,0 +1,136 @@
|
||||
(function() {
|
||||
'use strict';
|
||||
|
||||
var collator;
|
||||
try {
|
||||
collator = (typeof Intl !== "undefined" && typeof Intl.Collator !== "undefined") ? Intl.Collator("generic", { sensitivity: "base" }) : null;
|
||||
} catch (err){
|
||||
console.log("Collator could not be initialized and wouldn't be used");
|
||||
}
|
||||
// arrays to re-use
|
||||
var prevRow = [],
|
||||
str2Char = [];
|
||||
|
||||
/**
|
||||
* Based on the algorithm at http://en.wikipedia.org/wiki/Levenshtein_distance.
|
||||
*/
|
||||
var Levenshtein = {
|
||||
/**
|
||||
* Calculate levenshtein distance of the two strings.
|
||||
*
|
||||
* @param str1 String the first string.
|
||||
* @param str2 String the second string.
|
||||
* @param [options] Additional options.
|
||||
* @param [options.useCollator] Use `Intl.Collator` for locale-sensitive string comparison.
|
||||
* @return Integer the levenshtein distance (0 and above).
|
||||
*/
|
||||
get: function(str1, str2, options) {
|
||||
var useCollator = (options && collator && options.useCollator);
|
||||
|
||||
var str1Len = str1.length,
|
||||
str2Len = str2.length;
|
||||
|
||||
// base cases
|
||||
if (str1Len === 0) return str2Len;
|
||||
if (str2Len === 0) return str1Len;
|
||||
|
||||
// two rows
|
||||
var curCol, nextCol, i, j, tmp;
|
||||
|
||||
// initialise previous row
|
||||
for (i=0; i<str2Len; ++i) {
|
||||
prevRow[i] = i;
|
||||
str2Char[i] = str2.charCodeAt(i);
|
||||
}
|
||||
prevRow[str2Len] = str2Len;
|
||||
|
||||
var strCmp;
|
||||
if (useCollator) {
|
||||
// calculate current row distance from previous row using collator
|
||||
for (i = 0; i < str1Len; ++i) {
|
||||
nextCol = i + 1;
|
||||
|
||||
for (j = 0; j < str2Len; ++j) {
|
||||
curCol = nextCol;
|
||||
|
||||
// substution
|
||||
strCmp = 0 === collator.compare(str1.charAt(i), String.fromCharCode(str2Char[j]));
|
||||
|
||||
nextCol = prevRow[j] + (strCmp ? 0 : 1);
|
||||
|
||||
// insertion
|
||||
tmp = curCol + 1;
|
||||
if (nextCol > tmp) {
|
||||
nextCol = tmp;
|
||||
}
|
||||
// deletion
|
||||
tmp = prevRow[j + 1] + 1;
|
||||
if (nextCol > tmp) {
|
||||
nextCol = tmp;
|
||||
}
|
||||
|
||||
// copy current col value into previous (in preparation for next iteration)
|
||||
prevRow[j] = curCol;
|
||||
}
|
||||
|
||||
// copy last col value into previous (in preparation for next iteration)
|
||||
prevRow[j] = nextCol;
|
||||
}
|
||||
}
|
||||
else {
|
||||
// calculate current row distance from previous row without collator
|
||||
for (i = 0; i < str1Len; ++i) {
|
||||
nextCol = i + 1;
|
||||
|
||||
for (j = 0; j < str2Len; ++j) {
|
||||
curCol = nextCol;
|
||||
|
||||
// substution
|
||||
strCmp = str1.charCodeAt(i) === str2Char[j];
|
||||
|
||||
nextCol = prevRow[j] + (strCmp ? 0 : 1);
|
||||
|
||||
// insertion
|
||||
tmp = curCol + 1;
|
||||
if (nextCol > tmp) {
|
||||
nextCol = tmp;
|
||||
}
|
||||
// deletion
|
||||
tmp = prevRow[j + 1] + 1;
|
||||
if (nextCol > tmp) {
|
||||
nextCol = tmp;
|
||||
}
|
||||
|
||||
// copy current col value into previous (in preparation for next iteration)
|
||||
prevRow[j] = curCol;
|
||||
}
|
||||
|
||||
// copy last col value into previous (in preparation for next iteration)
|
||||
prevRow[j] = nextCol;
|
||||
}
|
||||
}
|
||||
return nextCol;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
// amd
|
||||
if (typeof define !== "undefined" && define !== null && define.amd) {
|
||||
define(function() {
|
||||
return Levenshtein;
|
||||
});
|
||||
}
|
||||
// commonjs
|
||||
else if (typeof module !== "undefined" && module !== null && typeof exports !== "undefined" && module.exports === exports) {
|
||||
module.exports = Levenshtein;
|
||||
}
|
||||
// web worker
|
||||
else if (typeof self !== "undefined" && typeof self.postMessage === 'function' && typeof self.importScripts === 'function') {
|
||||
self.Levenshtein = Levenshtein;
|
||||
}
|
||||
// browser main thread
|
||||
else if (typeof window !== "undefined" && window !== null) {
|
||||
window.Levenshtein = Levenshtein;
|
||||
}
|
||||
}());
|
||||
|
||||
Reference in New Issue
Block a user