update
This commit is contained in:
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
@@ -0,0 +1,30 @@
|
||||
export class FreeDrawOutline extends Outline {
|
||||
constructor(outline: any, points: any, box: any, scaleFactor: any, innerMargin: any, isLTR: any);
|
||||
serialize([blX, blY, trX, trY]: [any, any, any, any], rotation: any): {
|
||||
outline: number[];
|
||||
points: number[][];
|
||||
};
|
||||
get box(): null;
|
||||
newOutliner(point: any, box: any, scaleFactor: any, thickness: any, isLTR: any, innerMargin?: number): FreeDrawOutliner;
|
||||
getNewOutline(thickness: any, innerMargin: any): FreeDrawOutline;
|
||||
#private;
|
||||
}
|
||||
export class FreeDrawOutliner {
|
||||
static "__#19@#MIN_DIST": number;
|
||||
static "__#19@#MIN_DIFF": number;
|
||||
static "__#19@#MIN": number;
|
||||
constructor({ x, y }: {
|
||||
x: any;
|
||||
y: any;
|
||||
}, box: any, scaleFactor: any, thickness: any, isLTR: any, innerMargin?: number);
|
||||
isEmpty(): boolean;
|
||||
add({ x, y }: {
|
||||
x: any;
|
||||
y: any;
|
||||
}): boolean;
|
||||
toSVGPath(): string;
|
||||
newFreeDrawOutline(outline: any, points: any, box: any, scaleFactor: any, innerMargin: any, isLTR: any): FreeDrawOutline;
|
||||
getOutlines(): FreeDrawOutline;
|
||||
#private;
|
||||
}
|
||||
import { Outline } from "./outline.js";
|
||||
@@ -0,0 +1,22 @@
|
||||
export interface StartSerializer {
|
||||
stringify: (obj: unknown) => string;
|
||||
parse: (str: string) => unknown;
|
||||
encode: <T>(value: T) => T;
|
||||
decode: <T>(value: T) => T;
|
||||
}
|
||||
export type SerializerStringifyBy<T, TSerializable> = T extends TSerializable ? T : T extends (...args: Array<any>) => any ? 'Function is not serializable' : {
|
||||
[K in keyof T]: SerializerStringifyBy<T[K], TSerializable>;
|
||||
};
|
||||
export type SerializerParseBy<T, TSerializable> = T extends TSerializable ? T : unknown extends SerializerExtensions['ReadableStream'] ? {
|
||||
[K in keyof T]: SerializerParseBy<T[K], TSerializable>;
|
||||
} : T extends SerializerExtensions['ReadableStream'] ? ReadableStream : {
|
||||
[K in keyof T]: SerializerParseBy<T[K], TSerializable>;
|
||||
};
|
||||
export interface DefaultSerializerExtensions {
|
||||
ReadableStream: unknown;
|
||||
}
|
||||
export interface SerializerExtensions extends DefaultSerializerExtensions {
|
||||
}
|
||||
export type Serializable = Date | undefined | Error | FormData | bigint;
|
||||
export type SerializerStringify<T> = SerializerStringifyBy<T, Serializable>;
|
||||
export type SerializerParse<T> = SerializerParseBy<T, Serializable>;
|
||||
@@ -0,0 +1,11 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = _nonIterableSpread;
|
||||
function _nonIterableSpread() {
|
||||
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
||||
}
|
||||
|
||||
//# sourceMappingURL=nonIterableSpread.js.map
|
||||
@@ -0,0 +1 @@
|
||||
module.exports={A:{A:{"1":"A B","2":"K D E F mC"},B:{"1":"0 9 C L M G N O P Q H R S T U V W X Y Z a b c d e f g h i j k l m n o p q r s t u v w x y z AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB I"},C:{"1":"0 1 2 3 4 5 6 7 8 9 J PB K D E F A B C L M G N O P QB RB SB TB UB VB WB XB YB ZB aB bB cB dB eB fB gB hB iB jB kB lB mB nB oB pB qB rB sB tB uB vB MC wB NC xB yB zB 0B 1B 2B 3B 4B 5B 6B 7B 8B 9B AC BC CC DC Q H R OC S T U V W X Y Z a b c d e f g h i j k l m n o p q r s t u v w x y z AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB I PC EC QC RC oC pC","2":"nC LC qC rC"},D:{"1":"0 1 2 3 4 5 6 7 8 9 A B C L M G N O P QB RB SB TB UB VB WB XB YB ZB aB bB cB dB eB fB gB hB iB jB kB lB mB nB oB pB qB rB sB tB uB vB MC wB NC xB yB zB 0B 1B 2B 3B 4B 5B 6B 7B 8B 9B AC BC CC DC Q H R S T U V W X Y Z a b c d e f g h i j k l m n o p q r s t u v w x y z AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB I PC EC QC RC","2":"J PB K D E F"},E:{"1":"B C L M G TC FC GC xC yC zC UC VC HC 0C IC WC XC YC ZC aC 1C JC bC cC dC eC fC 2C KC gC hC iC jC 3C","2":"J sC SC","132":"PB K D E F A tC uC vC wC"},F:{"1":"0 1 2 3 4 5 6 7 8 B C G N O P QB RB SB TB UB VB WB XB YB ZB aB bB cB dB eB fB gB hB iB jB kB lB mB nB oB pB qB rB sB tB uB vB wB xB yB zB 0B 1B 2B 3B 4B 5B 6B 7B 8B 9B AC BC CC DC Q H R OC S T U V W X Y Z a b c d e f g h i j k l m n o p q r s t u v w x y z 5C 6C 7C FC kC 8C GC","2":"F 4C"},G:{"1":"HD ID JD KD LD MD ND OD PD QD RD SD UC VC HC TD IC WC XC YC ZC aC UD JC bC cC dC eC fC VD KC gC hC iC jC","2":"SC","132":"E 9C lC AD BD CD DD ED FD GD"},H:{"516":"WD"},I:{"1":"I cD","2":"LC XD YD ZD","132":"J aD lC bD"},J:{"1":"A","132":"D"},K:{"1":"A B C H FC kC GC"},L:{"1":"I"},M:{"132":"EC"},N:{"260":"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","132":"qD"}},B:1,C:"Form validation",D:true};
|
||||
@@ -0,0 +1,66 @@
|
||||
/**
|
||||
* @fileoverview A rule to disallow modifying variables of class declarations
|
||||
* @author Toru Nagashima
|
||||
*/
|
||||
|
||||
"use strict";
|
||||
|
||||
const astUtils = require("./utils/ast-utils");
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Rule Definition
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
/** @type {import('../shared/types').Rule} */
|
||||
module.exports = {
|
||||
meta: {
|
||||
type: "problem",
|
||||
|
||||
docs: {
|
||||
description: "Disallow reassigning class members",
|
||||
recommended: true,
|
||||
url: "https://eslint.org/docs/latest/rules/no-class-assign",
|
||||
},
|
||||
|
||||
schema: [],
|
||||
|
||||
messages: {
|
||||
class: "'{{name}}' is a class.",
|
||||
},
|
||||
},
|
||||
|
||||
create(context) {
|
||||
const sourceCode = context.sourceCode;
|
||||
|
||||
/**
|
||||
* Finds and reports references that are non initializer and writable.
|
||||
* @param {Variable} variable A variable to check.
|
||||
* @returns {void}
|
||||
*/
|
||||
function checkVariable(variable) {
|
||||
astUtils
|
||||
.getModifyingReferences(variable.references)
|
||||
.forEach(reference => {
|
||||
context.report({
|
||||
node: reference.identifier,
|
||||
messageId: "class",
|
||||
data: { name: reference.identifier.name },
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Finds and reports references that are non initializer and writable.
|
||||
* @param {ASTNode} node A ClassDeclaration/ClassExpression node to check.
|
||||
* @returns {void}
|
||||
*/
|
||||
function checkForClass(node) {
|
||||
sourceCode.getDeclaredVariables(node).forEach(checkVariable);
|
||||
}
|
||||
|
||||
return {
|
||||
ClassDeclaration: checkForClass,
|
||||
ClassExpression: checkForClass,
|
||||
};
|
||||
},
|
||||
};
|
||||
@@ -0,0 +1,112 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
exports.generate = generate;
|
||||
var _sourceMap = require("./source-map.js");
|
||||
var _printer = require("./printer.js");
|
||||
function normalizeOptions(code, opts, ast) {
|
||||
if (opts.experimental_preserveFormat) {
|
||||
if (typeof code !== "string") {
|
||||
throw new Error("`experimental_preserveFormat` requires the original `code` to be passed to @babel/generator as a string");
|
||||
}
|
||||
if (!opts.retainLines) {
|
||||
throw new Error("`experimental_preserveFormat` requires `retainLines` to be set to `true`");
|
||||
}
|
||||
if (opts.compact && opts.compact !== "auto") {
|
||||
throw new Error("`experimental_preserveFormat` is not compatible with the `compact` option");
|
||||
}
|
||||
if (opts.minified) {
|
||||
throw new Error("`experimental_preserveFormat` is not compatible with the `minified` option");
|
||||
}
|
||||
if (opts.jsescOption) {
|
||||
throw new Error("`experimental_preserveFormat` is not compatible with the `jsescOption` option");
|
||||
}
|
||||
if (!Array.isArray(ast.tokens)) {
|
||||
throw new Error("`experimental_preserveFormat` requires the AST to have attatched the token of the input code. Make sure to enable the `tokens: true` parser option.");
|
||||
}
|
||||
}
|
||||
const format = {
|
||||
auxiliaryCommentBefore: opts.auxiliaryCommentBefore,
|
||||
auxiliaryCommentAfter: opts.auxiliaryCommentAfter,
|
||||
shouldPrintComment: opts.shouldPrintComment,
|
||||
preserveFormat: opts.experimental_preserveFormat,
|
||||
retainLines: opts.retainLines,
|
||||
retainFunctionParens: opts.retainFunctionParens,
|
||||
comments: opts.comments == null || opts.comments,
|
||||
compact: opts.compact,
|
||||
minified: opts.minified,
|
||||
concise: opts.concise,
|
||||
indent: {
|
||||
adjustMultilineComment: true,
|
||||
style: " "
|
||||
},
|
||||
jsescOption: Object.assign({
|
||||
quotes: "double",
|
||||
wrap: true,
|
||||
minimal: false
|
||||
}, opts.jsescOption),
|
||||
topicToken: opts.topicToken,
|
||||
importAttributesKeyword: opts.importAttributesKeyword
|
||||
};
|
||||
{
|
||||
var _opts$recordAndTupleS;
|
||||
format.decoratorsBeforeExport = opts.decoratorsBeforeExport;
|
||||
format.jsescOption.json = opts.jsonCompatibleStrings;
|
||||
format.recordAndTupleSyntaxType = (_opts$recordAndTupleS = opts.recordAndTupleSyntaxType) != null ? _opts$recordAndTupleS : "hash";
|
||||
}
|
||||
if (format.minified) {
|
||||
format.compact = true;
|
||||
format.shouldPrintComment = format.shouldPrintComment || (() => format.comments);
|
||||
} else {
|
||||
format.shouldPrintComment = format.shouldPrintComment || (value => format.comments || value.includes("@license") || value.includes("@preserve"));
|
||||
}
|
||||
if (format.compact === "auto") {
|
||||
format.compact = typeof code === "string" && code.length > 500000;
|
||||
if (format.compact) {
|
||||
console.error("[BABEL] Note: The code generator has deoptimised the styling of " + `${opts.filename} as it exceeds the max of ${"500KB"}.`);
|
||||
}
|
||||
}
|
||||
if (format.compact || format.preserveFormat) {
|
||||
format.indent.adjustMultilineComment = false;
|
||||
}
|
||||
const {
|
||||
auxiliaryCommentBefore,
|
||||
auxiliaryCommentAfter,
|
||||
shouldPrintComment
|
||||
} = format;
|
||||
if (auxiliaryCommentBefore && !shouldPrintComment(auxiliaryCommentBefore)) {
|
||||
format.auxiliaryCommentBefore = undefined;
|
||||
}
|
||||
if (auxiliaryCommentAfter && !shouldPrintComment(auxiliaryCommentAfter)) {
|
||||
format.auxiliaryCommentAfter = undefined;
|
||||
}
|
||||
return format;
|
||||
}
|
||||
{
|
||||
exports.CodeGenerator = class CodeGenerator {
|
||||
constructor(ast, opts = {}, code) {
|
||||
this._ast = void 0;
|
||||
this._format = void 0;
|
||||
this._map = void 0;
|
||||
this._ast = ast;
|
||||
this._format = normalizeOptions(code, opts, ast);
|
||||
this._map = opts.sourceMaps ? new _sourceMap.default(opts, code) : null;
|
||||
}
|
||||
generate() {
|
||||
const printer = new _printer.default(this._format, this._map);
|
||||
return printer.generate(this._ast);
|
||||
}
|
||||
};
|
||||
}
|
||||
function generate(ast, opts = {}, code) {
|
||||
const format = normalizeOptions(code, opts, ast);
|
||||
const map = opts.sourceMaps ? new _sourceMap.default(opts, code) : null;
|
||||
const printer = new _printer.default(format, map, ast.tokens, typeof code === "string" ? code : null);
|
||||
return printer.generate(ast);
|
||||
}
|
||||
var _default = exports.default = generate;
|
||||
|
||||
//# sourceMappingURL=index.js.map
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,40 @@
|
||||
/**
|
||||
* @license React
|
||||
* react-jsx-dev-runtime.react-server.production.js
|
||||
*
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
"use strict";
|
||||
var React = require("react"),
|
||||
REACT_ELEMENT_TYPE = Symbol.for("react.transitional.element"),
|
||||
REACT_FRAGMENT_TYPE = Symbol.for("react.fragment");
|
||||
if (!React.__SERVER_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE)
|
||||
throw Error(
|
||||
'The "react" package in this environment is not configured correctly. The "react-server" condition must be enabled in any environment that runs React Server Components.'
|
||||
);
|
||||
function jsxProd(type, config, maybeKey) {
|
||||
var key = null;
|
||||
void 0 !== maybeKey && (key = "" + maybeKey);
|
||||
void 0 !== config.key && (key = "" + config.key);
|
||||
if ("key" in config) {
|
||||
maybeKey = {};
|
||||
for (var propName in config)
|
||||
"key" !== propName && (maybeKey[propName] = config[propName]);
|
||||
} else maybeKey = config;
|
||||
config = maybeKey.ref;
|
||||
return {
|
||||
$$typeof: REACT_ELEMENT_TYPE,
|
||||
type: type,
|
||||
key: key,
|
||||
ref: void 0 !== config ? config : null,
|
||||
props: maybeKey
|
||||
};
|
||||
}
|
||||
exports.Fragment = REACT_FRAGMENT_TYPE;
|
||||
exports.jsx = jsxProd;
|
||||
exports.jsxDEV = void 0;
|
||||
exports.jsxs = jsxProd;
|
||||
@@ -0,0 +1,20 @@
|
||||
var isProduction = process.env.NODE_ENV === 'production';
|
||||
function warning(condition, message) {
|
||||
if (!isProduction) {
|
||||
if (condition) {
|
||||
return;
|
||||
}
|
||||
|
||||
var text = "Warning: " + message;
|
||||
|
||||
if (typeof console !== 'undefined') {
|
||||
console.warn(text);
|
||||
}
|
||||
|
||||
try {
|
||||
throw Error(text);
|
||||
} catch (x) {}
|
||||
}
|
||||
}
|
||||
|
||||
export default warning;
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -0,0 +1,26 @@
|
||||
{
|
||||
"rules": {
|
||||
"generator-star": ["generator-star-spacing"],
|
||||
"global-strict": ["strict"],
|
||||
"no-arrow-condition": ["no-confusing-arrow", "no-constant-condition"],
|
||||
"no-comma-dangle": ["comma-dangle"],
|
||||
"no-empty-class": ["no-empty-character-class"],
|
||||
"no-empty-label": ["no-labels"],
|
||||
"no-extra-strict": ["strict"],
|
||||
"no-reserved-keys": ["quote-props"],
|
||||
"no-space-before-semi": ["semi-spacing"],
|
||||
"no-wrap-func": ["no-extra-parens"],
|
||||
"space-after-function-name": ["space-before-function-paren"],
|
||||
"space-after-keywords": ["keyword-spacing"],
|
||||
"space-before-function-parentheses": ["space-before-function-paren"],
|
||||
"space-before-keywords": ["keyword-spacing"],
|
||||
"space-in-brackets": [
|
||||
"object-curly-spacing",
|
||||
"array-bracket-spacing",
|
||||
"computed-property-spacing"
|
||||
],
|
||||
"space-return-throw-case": ["keyword-spacing"],
|
||||
"space-unary-word-ops": ["space-unary-ops"],
|
||||
"spaced-line-comment": ["spaced-comment"]
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
const rootRouteId = "__root__";
|
||||
export {
|
||||
rootRouteId
|
||||
};
|
||||
//# sourceMappingURL=root.js.map
|
||||
@@ -0,0 +1,191 @@
|
||||
/**
|
||||
* @fileoverview The instance of Ajv validator.
|
||||
* @author Evgeny Poberezkin
|
||||
*/
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Requirements
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
import Ajv from "ajv";
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Helpers
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
/*
|
||||
* Copied from ajv/lib/refs/json-schema-draft-04.json
|
||||
* The MIT License (MIT)
|
||||
* Copyright (c) 2015-2017 Evgeny Poberezkin
|
||||
*/
|
||||
const metaSchema = {
|
||||
id: "http://json-schema.org/draft-04/schema#",
|
||||
$schema: "http://json-schema.org/draft-04/schema#",
|
||||
description: "Core schema meta-schema",
|
||||
definitions: {
|
||||
schemaArray: {
|
||||
type: "array",
|
||||
minItems: 1,
|
||||
items: { $ref: "#" }
|
||||
},
|
||||
positiveInteger: {
|
||||
type: "integer",
|
||||
minimum: 0
|
||||
},
|
||||
positiveIntegerDefault0: {
|
||||
allOf: [{ $ref: "#/definitions/positiveInteger" }, { default: 0 }]
|
||||
},
|
||||
simpleTypes: {
|
||||
enum: ["array", "boolean", "integer", "null", "number", "object", "string"]
|
||||
},
|
||||
stringArray: {
|
||||
type: "array",
|
||||
items: { type: "string" },
|
||||
minItems: 1,
|
||||
uniqueItems: true
|
||||
}
|
||||
},
|
||||
type: "object",
|
||||
properties: {
|
||||
id: {
|
||||
type: "string"
|
||||
},
|
||||
$schema: {
|
||||
type: "string"
|
||||
},
|
||||
title: {
|
||||
type: "string"
|
||||
},
|
||||
description: {
|
||||
type: "string"
|
||||
},
|
||||
default: { },
|
||||
multipleOf: {
|
||||
type: "number",
|
||||
minimum: 0,
|
||||
exclusiveMinimum: true
|
||||
},
|
||||
maximum: {
|
||||
type: "number"
|
||||
},
|
||||
exclusiveMaximum: {
|
||||
type: "boolean",
|
||||
default: false
|
||||
},
|
||||
minimum: {
|
||||
type: "number"
|
||||
},
|
||||
exclusiveMinimum: {
|
||||
type: "boolean",
|
||||
default: false
|
||||
},
|
||||
maxLength: { $ref: "#/definitions/positiveInteger" },
|
||||
minLength: { $ref: "#/definitions/positiveIntegerDefault0" },
|
||||
pattern: {
|
||||
type: "string",
|
||||
format: "regex"
|
||||
},
|
||||
additionalItems: {
|
||||
anyOf: [
|
||||
{ type: "boolean" },
|
||||
{ $ref: "#" }
|
||||
],
|
||||
default: { }
|
||||
},
|
||||
items: {
|
||||
anyOf: [
|
||||
{ $ref: "#" },
|
||||
{ $ref: "#/definitions/schemaArray" }
|
||||
],
|
||||
default: { }
|
||||
},
|
||||
maxItems: { $ref: "#/definitions/positiveInteger" },
|
||||
minItems: { $ref: "#/definitions/positiveIntegerDefault0" },
|
||||
uniqueItems: {
|
||||
type: "boolean",
|
||||
default: false
|
||||
},
|
||||
maxProperties: { $ref: "#/definitions/positiveInteger" },
|
||||
minProperties: { $ref: "#/definitions/positiveIntegerDefault0" },
|
||||
required: { $ref: "#/definitions/stringArray" },
|
||||
additionalProperties: {
|
||||
anyOf: [
|
||||
{ type: "boolean" },
|
||||
{ $ref: "#" }
|
||||
],
|
||||
default: { }
|
||||
},
|
||||
definitions: {
|
||||
type: "object",
|
||||
additionalProperties: { $ref: "#" },
|
||||
default: { }
|
||||
},
|
||||
properties: {
|
||||
type: "object",
|
||||
additionalProperties: { $ref: "#" },
|
||||
default: { }
|
||||
},
|
||||
patternProperties: {
|
||||
type: "object",
|
||||
additionalProperties: { $ref: "#" },
|
||||
default: { }
|
||||
},
|
||||
dependencies: {
|
||||
type: "object",
|
||||
additionalProperties: {
|
||||
anyOf: [
|
||||
{ $ref: "#" },
|
||||
{ $ref: "#/definitions/stringArray" }
|
||||
]
|
||||
}
|
||||
},
|
||||
enum: {
|
||||
type: "array",
|
||||
minItems: 1,
|
||||
uniqueItems: true
|
||||
},
|
||||
type: {
|
||||
anyOf: [
|
||||
{ $ref: "#/definitions/simpleTypes" },
|
||||
{
|
||||
type: "array",
|
||||
items: { $ref: "#/definitions/simpleTypes" },
|
||||
minItems: 1,
|
||||
uniqueItems: true
|
||||
}
|
||||
]
|
||||
},
|
||||
format: { type: "string" },
|
||||
allOf: { $ref: "#/definitions/schemaArray" },
|
||||
anyOf: { $ref: "#/definitions/schemaArray" },
|
||||
oneOf: { $ref: "#/definitions/schemaArray" },
|
||||
not: { $ref: "#" }
|
||||
},
|
||||
dependencies: {
|
||||
exclusiveMaximum: ["maximum"],
|
||||
exclusiveMinimum: ["minimum"]
|
||||
},
|
||||
default: { }
|
||||
};
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Public Interface
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
export default (additionalOptions = {}) => {
|
||||
const ajv = new Ajv({
|
||||
meta: false,
|
||||
useDefaults: true,
|
||||
validateSchema: false,
|
||||
missingRefs: "ignore",
|
||||
verbose: true,
|
||||
schemaId: "auto",
|
||||
...additionalOptions
|
||||
});
|
||||
|
||||
ajv.addMetaSchema(metaSchema);
|
||||
// eslint-disable-next-line no-underscore-dangle -- part of the API
|
||||
ajv._opts.defaultMeta = metaSchema.id;
|
||||
|
||||
return ajv;
|
||||
};
|
||||
@@ -0,0 +1,497 @@
|
||||
/**
|
||||
* @fileoverview Rule to check for max length on a line.
|
||||
* @author Matt DuVall <http://www.mattduvall.com>
|
||||
* @deprecated in ESLint v8.53.0
|
||||
*/
|
||||
|
||||
"use strict";
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Constants
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
const OPTIONS_SCHEMA = {
|
||||
type: "object",
|
||||
properties: {
|
||||
code: {
|
||||
type: "integer",
|
||||
minimum: 0,
|
||||
},
|
||||
comments: {
|
||||
type: "integer",
|
||||
minimum: 0,
|
||||
},
|
||||
tabWidth: {
|
||||
type: "integer",
|
||||
minimum: 0,
|
||||
},
|
||||
ignorePattern: {
|
||||
type: "string",
|
||||
},
|
||||
ignoreComments: {
|
||||
type: "boolean",
|
||||
},
|
||||
ignoreStrings: {
|
||||
type: "boolean",
|
||||
},
|
||||
ignoreUrls: {
|
||||
type: "boolean",
|
||||
},
|
||||
ignoreTemplateLiterals: {
|
||||
type: "boolean",
|
||||
},
|
||||
ignoreRegExpLiterals: {
|
||||
type: "boolean",
|
||||
},
|
||||
ignoreTrailingComments: {
|
||||
type: "boolean",
|
||||
},
|
||||
},
|
||||
additionalProperties: false,
|
||||
};
|
||||
|
||||
const OPTIONS_OR_INTEGER_SCHEMA = {
|
||||
anyOf: [
|
||||
OPTIONS_SCHEMA,
|
||||
{
|
||||
type: "integer",
|
||||
minimum: 0,
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Rule Definition
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
/** @type {import('../shared/types').Rule} */
|
||||
module.exports = {
|
||||
meta: {
|
||||
deprecated: {
|
||||
message: "Formatting rules are being moved out of ESLint core.",
|
||||
url: "https://eslint.org/blog/2023/10/deprecating-formatting-rules/",
|
||||
deprecatedSince: "8.53.0",
|
||||
availableUntil: "10.0.0",
|
||||
replacedBy: [
|
||||
{
|
||||
message:
|
||||
"ESLint Stylistic now maintains deprecated stylistic core rules.",
|
||||
url: "https://eslint.style/guide/migration",
|
||||
plugin: {
|
||||
name: "@stylistic/eslint-plugin-js",
|
||||
url: "https://eslint.style/packages/js",
|
||||
},
|
||||
rule: {
|
||||
name: "max-len",
|
||||
url: "https://eslint.style/rules/js/max-len",
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
type: "layout",
|
||||
|
||||
docs: {
|
||||
description: "Enforce a maximum line length",
|
||||
recommended: false,
|
||||
url: "https://eslint.org/docs/latest/rules/max-len",
|
||||
},
|
||||
|
||||
schema: [
|
||||
OPTIONS_OR_INTEGER_SCHEMA,
|
||||
OPTIONS_OR_INTEGER_SCHEMA,
|
||||
OPTIONS_SCHEMA,
|
||||
],
|
||||
messages: {
|
||||
max: "This line has a length of {{lineLength}}. Maximum allowed is {{maxLength}}.",
|
||||
maxComment:
|
||||
"This line has a comment length of {{lineLength}}. Maximum allowed is {{maxCommentLength}}.",
|
||||
},
|
||||
},
|
||||
|
||||
create(context) {
|
||||
/*
|
||||
* Inspired by http://tools.ietf.org/html/rfc3986#appendix-B, however:
|
||||
* - They're matching an entire string that we know is a URI
|
||||
* - We're matching part of a string where we think there *might* be a URL
|
||||
* - We're only concerned about URLs, as picking out any URI would cause
|
||||
* too many false positives
|
||||
* - We don't care about matching the entire URL, any small segment is fine
|
||||
*/
|
||||
const URL_REGEXP = /[^:/?#]:\/\/[^?#]/u;
|
||||
|
||||
const sourceCode = context.sourceCode;
|
||||
|
||||
/**
|
||||
* Computes the length of a line that may contain tabs. The width of each
|
||||
* tab will be the number of spaces to the next tab stop.
|
||||
* @param {string} line The line.
|
||||
* @param {int} tabWidth The width of each tab stop in spaces.
|
||||
* @returns {int} The computed line length.
|
||||
* @private
|
||||
*/
|
||||
function computeLineLength(line, tabWidth) {
|
||||
let extraCharacterCount = 0;
|
||||
|
||||
line.replace(/\t/gu, (match, offset) => {
|
||||
const totalOffset = offset + extraCharacterCount,
|
||||
previousTabStopOffset = tabWidth
|
||||
? totalOffset % tabWidth
|
||||
: 0,
|
||||
spaceCount = tabWidth - previousTabStopOffset;
|
||||
|
||||
extraCharacterCount += spaceCount - 1; // -1 for the replaced tab
|
||||
});
|
||||
return Array.from(line).length + extraCharacterCount;
|
||||
}
|
||||
|
||||
// The options object must be the last option specified…
|
||||
const options = Object.assign({}, context.options.at(-1));
|
||||
|
||||
// …but max code length…
|
||||
if (typeof context.options[0] === "number") {
|
||||
options.code = context.options[0];
|
||||
}
|
||||
|
||||
// …and tabWidth can be optionally specified directly as integers.
|
||||
if (typeof context.options[1] === "number") {
|
||||
options.tabWidth = context.options[1];
|
||||
}
|
||||
|
||||
const maxLength = typeof options.code === "number" ? options.code : 80,
|
||||
tabWidth =
|
||||
typeof options.tabWidth === "number" ? options.tabWidth : 4,
|
||||
ignoreComments = !!options.ignoreComments,
|
||||
ignoreStrings = !!options.ignoreStrings,
|
||||
ignoreTemplateLiterals = !!options.ignoreTemplateLiterals,
|
||||
ignoreRegExpLiterals = !!options.ignoreRegExpLiterals,
|
||||
ignoreTrailingComments =
|
||||
!!options.ignoreTrailingComments || !!options.ignoreComments,
|
||||
ignoreUrls = !!options.ignoreUrls,
|
||||
maxCommentLength = options.comments;
|
||||
let ignorePattern = options.ignorePattern || null;
|
||||
|
||||
if (ignorePattern) {
|
||||
ignorePattern = new RegExp(ignorePattern, "u");
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Helpers
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Tells if a given comment is trailing: it starts on the current line and
|
||||
* extends to or past the end of the current line.
|
||||
* @param {string} line The source line we want to check for a trailing comment on
|
||||
* @param {number} lineNumber The one-indexed line number for line
|
||||
* @param {ASTNode} comment The comment to inspect
|
||||
* @returns {boolean} If the comment is trailing on the given line
|
||||
*/
|
||||
function isTrailingComment(line, lineNumber, comment) {
|
||||
return (
|
||||
comment &&
|
||||
comment.loc.start.line === lineNumber &&
|
||||
lineNumber <= comment.loc.end.line &&
|
||||
(comment.loc.end.line > lineNumber ||
|
||||
comment.loc.end.column === line.length)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Tells if a comment encompasses the entire line.
|
||||
* @param {string} line The source line with a trailing comment
|
||||
* @param {number} lineNumber The one-indexed line number this is on
|
||||
* @param {ASTNode} comment The comment to remove
|
||||
* @returns {boolean} If the comment covers the entire line
|
||||
*/
|
||||
function isFullLineComment(line, lineNumber, comment) {
|
||||
const start = comment.loc.start,
|
||||
end = comment.loc.end,
|
||||
isFirstTokenOnLine = !line
|
||||
.slice(0, comment.loc.start.column)
|
||||
.trim();
|
||||
|
||||
return (
|
||||
comment &&
|
||||
(start.line < lineNumber ||
|
||||
(start.line === lineNumber && isFirstTokenOnLine)) &&
|
||||
(end.line > lineNumber ||
|
||||
(end.line === lineNumber && end.column === line.length))
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a node is a JSXEmptyExpression contained in a single line JSXExpressionContainer.
|
||||
* @param {ASTNode} node A node to check.
|
||||
* @returns {boolean} True if the node is a JSXEmptyExpression contained in a single line JSXExpressionContainer.
|
||||
*/
|
||||
function isJSXEmptyExpressionInSingleLineContainer(node) {
|
||||
if (
|
||||
!node ||
|
||||
!node.parent ||
|
||||
node.type !== "JSXEmptyExpression" ||
|
||||
node.parent.type !== "JSXExpressionContainer"
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const parent = node.parent;
|
||||
|
||||
return parent.loc.start.line === parent.loc.end.line;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the line after the comment and any remaining trailing whitespace is
|
||||
* stripped.
|
||||
* @param {string} line The source line with a trailing comment
|
||||
* @param {ASTNode} comment The comment to remove
|
||||
* @returns {string} Line without comment and trailing whitespace
|
||||
*/
|
||||
function stripTrailingComment(line, comment) {
|
||||
// loc.column is zero-indexed
|
||||
return line.slice(0, comment.loc.start.column).replace(/\s+$/u, "");
|
||||
}
|
||||
|
||||
/**
|
||||
* Ensure that an array exists at [key] on `object`, and add `value` to it.
|
||||
* @param {Object} object the object to mutate
|
||||
* @param {string} key the object's key
|
||||
* @param {any} value the value to add
|
||||
* @returns {void}
|
||||
* @private
|
||||
*/
|
||||
function ensureArrayAndPush(object, key, value) {
|
||||
if (!Array.isArray(object[key])) {
|
||||
object[key] = [];
|
||||
}
|
||||
object[key].push(value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves an array containing all strings (" or ') in the source code.
|
||||
* @returns {ASTNode[]} An array of string nodes.
|
||||
*/
|
||||
function getAllStrings() {
|
||||
return sourceCode.ast.tokens.filter(
|
||||
token =>
|
||||
token.type === "String" ||
|
||||
(token.type === "JSXText" &&
|
||||
sourceCode.getNodeByRangeIndex(token.range[0] - 1)
|
||||
.type === "JSXAttribute"),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves an array containing all template literals in the source code.
|
||||
* @returns {ASTNode[]} An array of template literal nodes.
|
||||
*/
|
||||
function getAllTemplateLiterals() {
|
||||
return sourceCode.ast.tokens.filter(
|
||||
token => token.type === "Template",
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves an array containing all RegExp literals in the source code.
|
||||
* @returns {ASTNode[]} An array of RegExp literal nodes.
|
||||
*/
|
||||
function getAllRegExpLiterals() {
|
||||
return sourceCode.ast.tokens.filter(
|
||||
token => token.type === "RegularExpression",
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* reduce an array of AST nodes by line number, both start and end.
|
||||
* @param {ASTNode[]} arr array of AST nodes
|
||||
* @returns {Object} accululated AST nodes
|
||||
*/
|
||||
function groupArrayByLineNumber(arr) {
|
||||
const obj = {};
|
||||
|
||||
for (let i = 0; i < arr.length; i++) {
|
||||
const node = arr[i];
|
||||
|
||||
for (let j = node.loc.start.line; j <= node.loc.end.line; ++j) {
|
||||
ensureArrayAndPush(obj, j, node);
|
||||
}
|
||||
}
|
||||
return obj;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an array of all comments in the source code.
|
||||
* If the element in the array is a JSXEmptyExpression contained with a single line JSXExpressionContainer,
|
||||
* the element is changed with JSXExpressionContainer node.
|
||||
* @returns {ASTNode[]} An array of comment nodes
|
||||
*/
|
||||
function getAllComments() {
|
||||
const comments = [];
|
||||
|
||||
sourceCode.getAllComments().forEach(commentNode => {
|
||||
const containingNode = sourceCode.getNodeByRangeIndex(
|
||||
commentNode.range[0],
|
||||
);
|
||||
|
||||
if (isJSXEmptyExpressionInSingleLineContainer(containingNode)) {
|
||||
// push a unique node only
|
||||
if (comments.at(-1) !== containingNode.parent) {
|
||||
comments.push(containingNode.parent);
|
||||
}
|
||||
} else {
|
||||
comments.push(commentNode);
|
||||
}
|
||||
});
|
||||
|
||||
return comments;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check the program for max length
|
||||
* @param {ASTNode} node Node to examine
|
||||
* @returns {void}
|
||||
* @private
|
||||
*/
|
||||
function checkProgramForMaxLength(node) {
|
||||
// split (honors line-ending)
|
||||
const lines = sourceCode.lines,
|
||||
// list of comments to ignore
|
||||
comments =
|
||||
ignoreComments || maxCommentLength || ignoreTrailingComments
|
||||
? getAllComments()
|
||||
: [];
|
||||
|
||||
// we iterate over comments in parallel with the lines
|
||||
let commentsIndex = 0;
|
||||
|
||||
const strings = getAllStrings();
|
||||
const stringsByLine = groupArrayByLineNumber(strings);
|
||||
|
||||
const templateLiterals = getAllTemplateLiterals();
|
||||
const templateLiteralsByLine =
|
||||
groupArrayByLineNumber(templateLiterals);
|
||||
|
||||
const regExpLiterals = getAllRegExpLiterals();
|
||||
const regExpLiteralsByLine = groupArrayByLineNumber(regExpLiterals);
|
||||
|
||||
lines.forEach((line, i) => {
|
||||
// i is zero-indexed, line numbers are one-indexed
|
||||
const lineNumber = i + 1;
|
||||
|
||||
/*
|
||||
* if we're checking comment length; we need to know whether this
|
||||
* line is a comment
|
||||
*/
|
||||
let lineIsComment = false;
|
||||
let textToMeasure;
|
||||
|
||||
/*
|
||||
* We can short-circuit the comment checks if we're already out of
|
||||
* comments to check.
|
||||
*/
|
||||
if (commentsIndex < comments.length) {
|
||||
let comment;
|
||||
|
||||
// iterate over comments until we find one past the current line
|
||||
do {
|
||||
comment = comments[++commentsIndex];
|
||||
} while (comment && comment.loc.start.line <= lineNumber);
|
||||
|
||||
// and step back by one
|
||||
comment = comments[--commentsIndex];
|
||||
|
||||
if (isFullLineComment(line, lineNumber, comment)) {
|
||||
lineIsComment = true;
|
||||
textToMeasure = line;
|
||||
} else if (
|
||||
ignoreTrailingComments &&
|
||||
isTrailingComment(line, lineNumber, comment)
|
||||
) {
|
||||
textToMeasure = stripTrailingComment(line, comment);
|
||||
|
||||
// ignore multiple trailing comments in the same line
|
||||
let lastIndex = commentsIndex;
|
||||
|
||||
while (
|
||||
isTrailingComment(
|
||||
textToMeasure,
|
||||
lineNumber,
|
||||
comments[--lastIndex],
|
||||
)
|
||||
) {
|
||||
textToMeasure = stripTrailingComment(
|
||||
textToMeasure,
|
||||
comments[lastIndex],
|
||||
);
|
||||
}
|
||||
} else {
|
||||
textToMeasure = line;
|
||||
}
|
||||
} else {
|
||||
textToMeasure = line;
|
||||
}
|
||||
if (
|
||||
(ignorePattern && ignorePattern.test(textToMeasure)) ||
|
||||
(ignoreUrls && URL_REGEXP.test(textToMeasure)) ||
|
||||
(ignoreStrings && stringsByLine[lineNumber]) ||
|
||||
(ignoreTemplateLiterals &&
|
||||
templateLiteralsByLine[lineNumber]) ||
|
||||
(ignoreRegExpLiterals && regExpLiteralsByLine[lineNumber])
|
||||
) {
|
||||
// ignore this line
|
||||
return;
|
||||
}
|
||||
|
||||
const lineLength = computeLineLength(textToMeasure, tabWidth);
|
||||
const commentLengthApplies = lineIsComment && maxCommentLength;
|
||||
|
||||
if (lineIsComment && ignoreComments) {
|
||||
return;
|
||||
}
|
||||
|
||||
const loc = {
|
||||
start: {
|
||||
line: lineNumber,
|
||||
column: 0,
|
||||
},
|
||||
end: {
|
||||
line: lineNumber,
|
||||
column: textToMeasure.length,
|
||||
},
|
||||
};
|
||||
|
||||
if (commentLengthApplies) {
|
||||
if (lineLength > maxCommentLength) {
|
||||
context.report({
|
||||
node,
|
||||
loc,
|
||||
messageId: "maxComment",
|
||||
data: {
|
||||
lineLength,
|
||||
maxCommentLength,
|
||||
},
|
||||
});
|
||||
}
|
||||
} else if (lineLength > maxLength) {
|
||||
context.report({
|
||||
node,
|
||||
loc,
|
||||
messageId: "max",
|
||||
data: {
|
||||
lineLength,
|
||||
maxLength,
|
||||
},
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Public API
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
return {
|
||||
Program: checkProgramForMaxLength,
|
||||
};
|
||||
},
|
||||
};
|
||||
@@ -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 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","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 qC rC"},D:{"1":"0 9 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","33":"1 2 3 4 5 6 7 8 G N O P QB RB SB TB UB VB WB XB YB ZB aB bB cB dB eB fB gB hB iB jB kB lB mB nB oB pB qB rB sB tB uB vB MC wB NC xB yB zB"},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":"J PB K sC SC tC","33":"D E uC vC"},F:{"1":"0 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 3 4 5 6 7 8 G N O P QB RB SB TB UB VB WB XB YB ZB aB bB cB dB eB fB gB hB iB jB kB lB mB nB oB"},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 lC AD","33":"E BD CD DD"},H:{"2":"WD"},I:{"1":"I","16":"LC J XD YD ZD aD lC","33":"bD cD"},J:{"16":"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 hD TC iD jD kD lD mD IC JC KC nD","16":"J","33":"dD eD fD gD"},Q:{"1":"oD"},R:{"1":"pD"},S:{"1":"rD","33":"qD"}},B:5,C:"CSS :any-link selector",D:true};
|
||||
@@ -0,0 +1,8 @@
|
||||
import { StructuralSharingOption, ValidateSelected } from './structuralSharing.js';
|
||||
import { AnyRouter, RegisteredRouter, ResolveUseLoaderData, StrictOrFrom, UseLoaderDataResult } from '@tanstack/router-core';
|
||||
export interface UseLoaderDataBaseOptions<TRouter extends AnyRouter, TFrom, TStrict extends boolean, TSelected, TStructuralSharing> {
|
||||
select?: (match: ResolveUseLoaderData<TRouter, TFrom, TStrict>) => ValidateSelected<TRouter, TSelected, TStructuralSharing>;
|
||||
}
|
||||
export type UseLoaderDataOptions<TRouter extends AnyRouter, TFrom extends string | undefined, TStrict extends boolean, TSelected, TStructuralSharing> = StrictOrFrom<TRouter, TFrom, TStrict> & UseLoaderDataBaseOptions<TRouter, TFrom, TStrict, TSelected, TStructuralSharing> & StructuralSharingOption<TRouter, TSelected, TStructuralSharing>;
|
||||
export type UseLoaderDataRoute<out TId> = <TRouter extends AnyRouter = RegisteredRouter, TSelected = unknown, TStructuralSharing extends boolean = boolean>(opts?: UseLoaderDataBaseOptions<TRouter, TId, true, TSelected, TStructuralSharing> & StructuralSharingOption<TRouter, TSelected, TStructuralSharing>) => UseLoaderDataResult<TRouter, TId, true, TSelected>;
|
||||
export declare function useLoaderData<TRouter extends AnyRouter = RegisteredRouter, const TFrom extends string | undefined = undefined, TStrict extends boolean = true, TSelected = unknown, TStructuralSharing extends boolean = boolean>(opts: UseLoaderDataOptions<TRouter, TFrom, TStrict, TSelected, TStructuralSharing>): UseLoaderDataResult<TRouter, TFrom, TStrict, TSelected>;
|
||||
@@ -0,0 +1,54 @@
|
||||
import { TransformOptions, ParserOptions } from '@babel/core';
|
||||
import { PluginOption, ResolvedConfig } from 'vite';
|
||||
|
||||
interface Options {
|
||||
include?: string | RegExp | Array<string | RegExp>;
|
||||
exclude?: string | RegExp | Array<string | RegExp>;
|
||||
/**
|
||||
* Control where the JSX factory is imported from.
|
||||
* https://esbuild.github.io/api/#jsx-import-source
|
||||
* @default 'react'
|
||||
*/
|
||||
jsxImportSource?: string;
|
||||
/**
|
||||
* Note: Skipping React import with classic runtime is not supported from v4
|
||||
* @default "automatic"
|
||||
*/
|
||||
jsxRuntime?: 'classic' | 'automatic';
|
||||
/**
|
||||
* Babel configuration applied in both dev and prod.
|
||||
*/
|
||||
babel?: BabelOptions | ((id: string, options: {
|
||||
ssr?: boolean;
|
||||
}) => BabelOptions);
|
||||
}
|
||||
type BabelOptions = Omit<TransformOptions, 'ast' | 'filename' | 'root' | 'sourceFileName' | 'sourceMaps' | 'inputSourceMap'>;
|
||||
/**
|
||||
* The object type used by the `options` passed to plugins with
|
||||
* an `api.reactBabel` method.
|
||||
*/
|
||||
interface ReactBabelOptions extends BabelOptions {
|
||||
plugins: Extract<BabelOptions['plugins'], any[]>;
|
||||
presets: Extract<BabelOptions['presets'], any[]>;
|
||||
overrides: Extract<BabelOptions['overrides'], any[]>;
|
||||
parserOpts: ParserOptions & {
|
||||
plugins: Extract<ParserOptions['plugins'], any[]>;
|
||||
};
|
||||
}
|
||||
type ReactBabelHook = (babelConfig: ReactBabelOptions, context: ReactBabelHookContext, config: ResolvedConfig) => void;
|
||||
type ReactBabelHookContext = {
|
||||
ssr: boolean;
|
||||
id: string;
|
||||
};
|
||||
type ViteReactPluginApi = {
|
||||
/**
|
||||
* Manipulate the Babel options of `@vitejs/plugin-react`
|
||||
*/
|
||||
reactBabel?: ReactBabelHook;
|
||||
};
|
||||
declare function viteReact(opts?: Options): PluginOption[];
|
||||
declare namespace viteReact {
|
||||
var preambleCode: string;
|
||||
}
|
||||
|
||||
export { type BabelOptions, type Options, type ReactBabelOptions, type ViteReactPluginApi, viteReact as default };
|
||||
@@ -0,0 +1 @@
|
||||
module.exports={C:{"34":0.01057,"52":0.00423,"59":0.00211,"78":0.00845,"88":0.00634,"99":0.00211,"113":0.00211,"115":0.05494,"123":0.00211,"127":0.00211,"128":0.01479,"132":0.00423,"133":0.00423,"134":0.00634,"135":0.10565,"136":0.35921,"137":0.00211,_:"2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 53 54 55 56 57 58 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 89 90 91 92 93 94 95 96 97 98 100 101 102 103 104 105 106 107 108 109 110 111 112 114 116 117 118 119 120 121 122 124 125 126 129 130 131 138 139 140 3.5 3.6"},D:{"11":0.00211,"40":0.00211,"47":0.00211,"49":0.00423,"50":0.00423,"52":0.03592,"54":0.00211,"55":0.00211,"56":0.00211,"65":0.00845,"66":0.01268,"67":0.00211,"69":0.00211,"70":0.00634,"71":0.00634,"73":0.00211,"74":0.00211,"75":0.00845,"78":0.00423,"79":0.01479,"80":0.00211,"81":0.00423,"83":0.00211,"86":0.00423,"87":0.01057,"88":0.01902,"89":0.00211,"90":0.00423,"91":0.00423,"92":0.00211,"93":0.00211,"94":0.00634,"95":0.00423,"98":0.07184,"99":0.00211,"100":0.00634,"101":0.00211,"102":0.00423,"103":0.01479,"104":0.00845,"105":0.00211,"106":0.00423,"107":0.00211,"108":0.00845,"109":0.39724,"110":0.00211,"111":0.02324,"113":0.00211,"114":0.03381,"115":0.00634,"116":0.0317,"117":0.00423,"118":0.00845,"119":0.02324,"120":0.01479,"121":0.00845,"122":0.02536,"123":0.02747,"124":0.03381,"125":0.10776,"126":0.0655,"127":0.01902,"128":0.04437,"129":0.02113,"130":0.02536,"131":0.1944,"132":0.23032,"133":3.04695,"134":5.68397,"135":0.01057,"136":0.00211,_:"4 5 6 7 8 9 10 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 41 42 43 44 45 46 48 51 53 57 58 59 60 61 62 63 64 68 72 76 77 84 85 96 97 112 137 138"},F:{"79":0.00211,"85":0.00211,"86":0.00634,"87":0.07396,"88":0.02113,"95":0.01268,"109":0.00211,"113":0.00211,"114":0.00211,"116":0.04649,"117":0.24511,_:"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 80 81 82 83 84 89 90 91 92 93 94 96 97 98 99 100 101 102 103 104 105 106 107 108 110 111 112 115 9.5-9.6 10.0-10.1 10.5 10.6 11.1 11.5 11.6 12.1"},B:{"12":0.00211,"14":0.00211,"17":0.00211,"18":0.00423,"92":0.00845,"100":0.00211,"109":0.01902,"114":0.00423,"116":0.00211,"118":0.02747,"119":0.00211,"120":0.00211,"121":0.00211,"122":0.00423,"124":0.00211,"125":0.00211,"126":0.00634,"127":0.01057,"128":0.00423,"129":0.00423,"130":0.00634,"131":0.0317,"132":0.04437,"133":0.79238,"134":1.77703,_:"13 15 16 79 80 81 83 84 85 86 87 88 89 90 91 93 94 95 96 97 98 99 101 102 103 104 105 106 107 108 110 111 112 113 115 117 123"},E:{"10":0.00211,"14":0.00423,"15":0.00211,_:"0 4 5 6 7 8 9 11 12 13 3.1 3.2 5.1 6.1 7.1 9.1 10.1 15.1","11.1":0.00211,"12.1":0.00211,"13.1":0.01057,"14.1":0.01902,"15.2-15.3":0.00211,"15.4":0.00423,"15.5":0.00845,"15.6":0.05916,"16.0":0.01902,"16.1":0.00845,"16.2":0.00423,"16.3":0.0169,"16.4":0.00634,"16.5":0.00845,"16.6":0.09086,"17.0":0.00211,"17.1":0.0486,"17.2":0.00423,"17.3":0.01268,"17.4":0.01479,"17.5":0.02536,"17.6":0.07396,"18.0":0.02324,"18.1":0.05071,"18.2":0.0169,"18.3":0.43739,"18.4":0.00423},G:{"8":0,"3.2":0,"4.0-4.1":0,"4.2-4.3":0.00192,"5.0-5.1":0,"6.0-6.1":0.00577,"7.0-7.1":0.00385,"8.1-8.4":0,"9.0-9.2":0.00289,"9.3":0.01347,"10.0-10.2":0.00096,"10.3":0.02213,"11.0-11.2":0.10198,"11.3-11.4":0.00673,"12.0-12.1":0.00385,"12.2-12.5":0.09525,"13.0-13.1":0.00192,"13.2":0.00289,"13.3":0.00385,"13.4-13.7":0.01347,"14.0-14.4":0.03367,"14.5-14.8":0.04041,"15.0-15.1":0.02213,"15.2-15.3":0.02213,"15.4":0.02694,"15.5":0.03079,"15.6-15.8":0.37906,"16.0":0.05388,"16.1":0.11064,"16.2":0.05773,"16.3":0.10006,"16.4":0.02213,"16.5":0.04137,"16.6-16.7":0.4493,"17.0":0.02694,"17.1":0.0481,"17.2":0.03656,"17.3":0.05099,"17.4":0.10198,"17.5":0.22705,"17.6-17.7":0.65903,"18.0":0.18472,"18.1":0.60419,"18.2":0.27035,"18.3":5.65037,"18.4":0.0837},P:{"4":0.0711,"20":0.02031,"21":0.04063,"22":0.06094,"23":0.06094,"24":0.17267,"25":0.10157,"26":0.15236,"27":6.69346,_:"5.0-5.4 6.2-6.4 8.2 9.2 10.1 14.0 15.0","7.2-7.4":0.17267,"11.1-11.2":0.02031,"12.0":0.01016,"13.0":0.01016,"16.0":0.01016,"17.0":0.02031,"18.0":0.01016,"19.0":0.05079},I:{"0":0.02361,"3":0,"4":0,"2.1":0,"2.2":0,"2.3":0,"4.1":0,"4.2-4.3":0.00001,"4.4":0,"4.4.3-4.4.4":0.00003},K:{"0":3.43195,_:"10 11 12 11.1 11.5 12.1"},A:{"11":0.00634,_:"6 7 8 9 10 5.5"},S:{_:"2.5 3.0-3.1"},J:{_:"7 10"},N:{_:"10 11"},R:{_:"0"},M:{"0":0.56779},Q:{"14.9":0.00789},O:{"0":0.29967},H:{"0":0.03},L:{"0":62.50724}};
|
||||
@@ -0,0 +1,66 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = gatherSequenceExpressions;
|
||||
var _getBindingIdentifiers = require("../retrievers/getBindingIdentifiers.js");
|
||||
var _index = require("../validators/generated/index.js");
|
||||
var _index2 = require("../builders/generated/index.js");
|
||||
var _productions = require("../builders/productions.js");
|
||||
var _cloneNode = require("../clone/cloneNode.js");
|
||||
;
|
||||
function gatherSequenceExpressions(nodes, declars) {
|
||||
const exprs = [];
|
||||
let ensureLastUndefined = true;
|
||||
for (const node of nodes) {
|
||||
if (!(0, _index.isEmptyStatement)(node)) {
|
||||
ensureLastUndefined = false;
|
||||
}
|
||||
if ((0, _index.isExpression)(node)) {
|
||||
exprs.push(node);
|
||||
} else if ((0, _index.isExpressionStatement)(node)) {
|
||||
exprs.push(node.expression);
|
||||
} else if ((0, _index.isVariableDeclaration)(node)) {
|
||||
if (node.kind !== "var") return;
|
||||
for (const declar of node.declarations) {
|
||||
const bindings = (0, _getBindingIdentifiers.default)(declar);
|
||||
for (const key of Object.keys(bindings)) {
|
||||
declars.push({
|
||||
kind: node.kind,
|
||||
id: (0, _cloneNode.default)(bindings[key])
|
||||
});
|
||||
}
|
||||
if (declar.init) {
|
||||
exprs.push((0, _index2.assignmentExpression)("=", declar.id, declar.init));
|
||||
}
|
||||
}
|
||||
ensureLastUndefined = true;
|
||||
} else if ((0, _index.isIfStatement)(node)) {
|
||||
const consequent = node.consequent ? gatherSequenceExpressions([node.consequent], declars) : (0, _productions.buildUndefinedNode)();
|
||||
const alternate = node.alternate ? gatherSequenceExpressions([node.alternate], declars) : (0, _productions.buildUndefinedNode)();
|
||||
if (!consequent || !alternate) return;
|
||||
exprs.push((0, _index2.conditionalExpression)(node.test, consequent, alternate));
|
||||
} else if ((0, _index.isBlockStatement)(node)) {
|
||||
const body = gatherSequenceExpressions(node.body, declars);
|
||||
if (!body) return;
|
||||
exprs.push(body);
|
||||
} else if ((0, _index.isEmptyStatement)(node)) {
|
||||
if (nodes.indexOf(node) === 0) {
|
||||
ensureLastUndefined = true;
|
||||
}
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (ensureLastUndefined) {
|
||||
exprs.push((0, _productions.buildUndefinedNode)());
|
||||
}
|
||||
if (exprs.length === 1) {
|
||||
return exprs[0];
|
||||
} else {
|
||||
return (0, _index2.sequenceExpression)(exprs);
|
||||
}
|
||||
}
|
||||
|
||||
//# sourceMappingURL=gatherSequenceExpressions.js.map
|
||||
@@ -0,0 +1,70 @@
|
||||
deep-is
|
||||
==========
|
||||
|
||||
Node's `assert.deepEqual() algorithm` as a standalone module. Exactly like
|
||||
[deep-equal](https://github.com/substack/node-deep-equal) except for the fact that `deepEqual(NaN, NaN) === true`.
|
||||
|
||||
This module is around [5 times faster](https://gist.github.com/2790507)
|
||||
than wrapping `assert.deepEqual()` in a `try/catch`.
|
||||
|
||||
[](http://ci.testling.com/thlorenz/deep-is)
|
||||
|
||||
[](http://travis-ci.org/thlorenz/deep-is)
|
||||
|
||||
example
|
||||
=======
|
||||
|
||||
``` js
|
||||
var equal = require('deep-is');
|
||||
console.dir([
|
||||
equal(
|
||||
{ a : [ 2, 3 ], b : [ 4 ] },
|
||||
{ a : [ 2, 3 ], b : [ 4 ] }
|
||||
),
|
||||
equal(
|
||||
{ x : 5, y : [6] },
|
||||
{ x : 5, y : 6 }
|
||||
)
|
||||
]);
|
||||
```
|
||||
|
||||
methods
|
||||
=======
|
||||
|
||||
var deepIs = require('deep-is')
|
||||
|
||||
deepIs(a, b)
|
||||
---------------
|
||||
|
||||
Compare objects `a` and `b`, returning whether they are equal according to a
|
||||
recursive equality algorithm.
|
||||
|
||||
install
|
||||
=======
|
||||
|
||||
With [npm](http://npmjs.org) do:
|
||||
|
||||
```
|
||||
npm install deep-is
|
||||
```
|
||||
|
||||
test
|
||||
====
|
||||
|
||||
With [npm](http://npmjs.org) do:
|
||||
|
||||
```
|
||||
npm test
|
||||
```
|
||||
|
||||
license
|
||||
=======
|
||||
|
||||
Copyright (c) 2012, 2013 Thorsten Lorenz <thlorenz@gmx.de>
|
||||
Copyright (c) 2012 James Halliday <mail@substack.net>
|
||||
|
||||
Derived largely from node's assert module, which has the copyright statement:
|
||||
|
||||
Copyright (c) 2009 Thomas Robinson <280north.com>
|
||||
|
||||
Released under the MIT license, see LICENSE for details.
|
||||
@@ -0,0 +1,65 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = removeTypeDuplicates;
|
||||
var _index = require("../../validators/generated/index.js");
|
||||
function getQualifiedName(node) {
|
||||
return (0, _index.isIdentifier)(node) ? node.name : `${node.id.name}.${getQualifiedName(node.qualification)}`;
|
||||
}
|
||||
function removeTypeDuplicates(nodesIn) {
|
||||
const nodes = Array.from(nodesIn);
|
||||
const generics = new Map();
|
||||
const bases = new Map();
|
||||
const typeGroups = new Set();
|
||||
const types = [];
|
||||
for (let i = 0; i < nodes.length; i++) {
|
||||
const node = nodes[i];
|
||||
if (!node) continue;
|
||||
if (types.includes(node)) {
|
||||
continue;
|
||||
}
|
||||
if ((0, _index.isAnyTypeAnnotation)(node)) {
|
||||
return [node];
|
||||
}
|
||||
if ((0, _index.isFlowBaseAnnotation)(node)) {
|
||||
bases.set(node.type, node);
|
||||
continue;
|
||||
}
|
||||
if ((0, _index.isUnionTypeAnnotation)(node)) {
|
||||
if (!typeGroups.has(node.types)) {
|
||||
nodes.push(...node.types);
|
||||
typeGroups.add(node.types);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
if ((0, _index.isGenericTypeAnnotation)(node)) {
|
||||
const name = getQualifiedName(node.id);
|
||||
if (generics.has(name)) {
|
||||
let existing = generics.get(name);
|
||||
if (existing.typeParameters) {
|
||||
if (node.typeParameters) {
|
||||
existing.typeParameters.params.push(...node.typeParameters.params);
|
||||
existing.typeParameters.params = removeTypeDuplicates(existing.typeParameters.params);
|
||||
}
|
||||
} else {
|
||||
existing = node.typeParameters;
|
||||
}
|
||||
} else {
|
||||
generics.set(name, node);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
types.push(node);
|
||||
}
|
||||
for (const [, baseType] of bases) {
|
||||
types.push(baseType);
|
||||
}
|
||||
for (const [, genericName] of generics) {
|
||||
types.push(genericName);
|
||||
}
|
||||
return types;
|
||||
}
|
||||
|
||||
//# sourceMappingURL=removeTypeDuplicates.js.map
|
||||
@@ -0,0 +1,2 @@
|
||||
export * from "./node-hfs.js";
|
||||
export { Hfs } from "@humanfs/core";
|
||||
@@ -0,0 +1,34 @@
|
||||
let random = async bytes => crypto.getRandomValues(new Uint8Array(bytes))
|
||||
let customAlphabet = (alphabet, defaultSize = 21) => {
|
||||
let mask = (2 << (Math.log(alphabet.length - 1) / Math.LN2)) - 1
|
||||
let step = -~((1.6 * mask * defaultSize) / alphabet.length)
|
||||
return async (size = defaultSize) => {
|
||||
let id = ''
|
||||
while (true) {
|
||||
let bytes = crypto.getRandomValues(new Uint8Array(step))
|
||||
let i = step | 0
|
||||
while (i--) {
|
||||
id += alphabet[bytes[i] & mask] || ''
|
||||
if (id.length === size) return id
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
let nanoid = async (size = 21) => {
|
||||
let id = ''
|
||||
let bytes = crypto.getRandomValues(new Uint8Array((size |= 0)))
|
||||
while (size--) {
|
||||
let byte = bytes[size] & 63
|
||||
if (byte < 36) {
|
||||
id += byte.toString(36)
|
||||
} else if (byte < 62) {
|
||||
id += (byte - 26).toString(36).toUpperCase()
|
||||
} else if (byte < 63) {
|
||||
id += '_'
|
||||
} else {
|
||||
id += '-'
|
||||
}
|
||||
}
|
||||
return id
|
||||
}
|
||||
export { nanoid, customAlphabet, random }
|
||||
@@ -0,0 +1,40 @@
|
||||
# Acorn-JSX
|
||||
|
||||
[](https://travis-ci.org/acornjs/acorn-jsx)
|
||||
[](https://www.npmjs.org/package/acorn-jsx)
|
||||
|
||||
This is plugin for [Acorn](http://marijnhaverbeke.nl/acorn/) - a tiny, fast JavaScript parser, written completely in JavaScript.
|
||||
|
||||
It was created as an experimental alternative, faster [React.js JSX](http://facebook.github.io/react/docs/jsx-in-depth.html) parser. Later, it replaced the [official parser](https://github.com/facebookarchive/esprima) and these days is used by many prominent development tools.
|
||||
|
||||
## Transpiler
|
||||
|
||||
Please note that this tool only parses source code to JSX AST, which is useful for various language tools and services. If you want to transpile your code to regular ES5-compliant JavaScript with source map, check out [Babel](https://babeljs.io/) and [Buble](https://buble.surge.sh/) transpilers which use `acorn-jsx` under the hood.
|
||||
|
||||
## Usage
|
||||
|
||||
Requiring this module provides you with an Acorn plugin that you can use like this:
|
||||
|
||||
```javascript
|
||||
var acorn = require("acorn");
|
||||
var jsx = require("acorn-jsx");
|
||||
acorn.Parser.extend(jsx()).parse("my(<jsx/>, 'code');");
|
||||
```
|
||||
|
||||
Note that official spec doesn't support mix of XML namespaces and object-style access in tag names (#27) like in `<namespace:Object.Property />`, so it was deprecated in `acorn-jsx@3.0`. If you still want to opt-in to support of such constructions, you can pass the following option:
|
||||
|
||||
```javascript
|
||||
acorn.Parser.extend(jsx({ allowNamespacedObjects: true }))
|
||||
```
|
||||
|
||||
Also, since most apps use pure React transformer, a new option was introduced that allows to prohibit namespaces completely:
|
||||
|
||||
```javascript
|
||||
acorn.Parser.extend(jsx({ allowNamespaces: false }))
|
||||
```
|
||||
|
||||
Note that by default `allowNamespaces` is enabled for spec compliancy.
|
||||
|
||||
## License
|
||||
|
||||
This plugin is issued under the [MIT license](./LICENSE).
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user