docs: 仓库链接指向本镜像仓库
Dev Build / cleanup (push) Waiting to run
Dev Build / typecheck (push) Waiting to run

This commit is contained in:
TanTan committed 2026-11-13 09:27:07 +08:00
1 parent fa9c73363d
commit 2a69b23b47
18210 files changed
+5101211 -16

No files matched your search

@@ -0,0 +1,199 @@
import { readFileSync } from "node:fs";
import { dirname, join } from "node:path";
import { fileURLToPath } from "node:url";
import { exactRegex, makeIdFiltersToMatchWithQuery } from "@rolldown/pluginutils";
import { reactRefreshWrapperPlugin } from "vite/internal";
//#region ../common/refresh-utils.ts
const runtimePublicPath = "/@react-refresh";
const preambleCode = `import { injectIntoGlobalHook } from "__BASE__${runtimePublicPath.slice(1)}";
injectIntoGlobalHook(window);
window.$RefreshReg$ = () => {};
window.$RefreshSig$ = () => (type) => type;`;
const getPreambleCode = (base) => preambleCode.replace("__BASE__", base);
function virtualPreamblePlugin({ name, isEnabled }) {
return {
name: "vite:react-virtual-preamble",
resolveId: {
order: "pre",
filter: { id: exactRegex(name) },
handler(source) {
if (source === name) return "\0" + source;
}
},
load: {
filter: { id: exactRegex("\0" + name) },
handler(id) {
if (id === "\0" + name) {
if (isEnabled()) return preambleCode.replace("__BASE__", "/");
return "";
}
}
}
};
}
//#endregion
//#region ../common/warning.ts
const silenceUseClientWarning = (userConfig) => ({ rollupOptions: { onwarn(warning, defaultHandler) {
if (warning.code === "MODULE_LEVEL_DIRECTIVE" && (warning.message.includes("use client") || warning.message.includes("use server"))) return;
if (warning.code === "SOURCEMAP_ERROR" && warning.message.includes("resolve original location") && warning.pos === 0) return;
if (userConfig.build?.rollupOptions?.onwarn) userConfig.build.rollupOptions.onwarn(warning, defaultHandler);
else defaultHandler(warning);
} } });
//#endregion
//#region src/reactCompilerPreset.ts
const reactCompilerPreset = (options = {}) => ({
preset: () => ({ plugins: [["babel-plugin-react-compiler", options]] }),
rolldown: {
filter: { code: options.compilationMode === "annotation" ? /['"]use memo['"]/ : /\b[A-Z]|\buse/ },
applyToEnvironmentHook: (env) => env.config.consumer === "client",
optimizeDeps: { include: options.target === "17" || options.target === "18" ? ["react-compiler-runtime"] : ["react/compiler-runtime"] }
}
});
//#endregion
//#region src/index.ts
const refreshRuntimePath = join(dirname(fileURLToPath(import.meta.url)), "refresh-runtime.js");
const defaultIncludeRE = /\.[tj]sx?$/;
const defaultExcludeRE = /\/node_modules\//;
function viteReact(opts = {}) {
const include = opts.include ?? defaultIncludeRE;
const exclude = opts.exclude ?? defaultExcludeRE;
const jsxImportSource = opts.jsxImportSource ?? "react";
const jsxImportRuntime = `${jsxImportSource}/jsx-runtime`;
const jsxImportDevRuntime = `${jsxImportSource}/jsx-dev-runtime`;
let runningInVite = false;
let isProduction = true;
let skipFastRefresh = true;
let base;
let isBundledDev = false;
const viteBabel = {
name: "vite:react-babel",
enforce: "pre",
config(_userConfig, { command }) {
if (opts.jsxRuntime === "classic") return { oxc: {
jsx: {
runtime: "classic",
refresh: command === "serve"
},
jsxRefreshInclude: makeIdFiltersToMatchWithQuery(include),
jsxRefreshExclude: makeIdFiltersToMatchWithQuery(exclude)
} };
else return {
oxc: {
jsx: {
runtime: "automatic",
importSource: opts.jsxImportSource,
refresh: command === "serve"
},
jsxRefreshInclude: makeIdFiltersToMatchWithQuery(include),
jsxRefreshExclude: makeIdFiltersToMatchWithQuery(exclude)
},
optimizeDeps: { rolldownOptions: { transform: { jsx: { runtime: "automatic" } } } }
};
},
configResolved(config) {
runningInVite = true;
base = config.base;
if (config.experimental.bundledDev) isBundledDev = true;
isProduction = config.isProduction;
skipFastRefresh = isProduction || config.command === "build" || config.server.hmr === false;
},
options(options) {
if (!runningInVite) {
options.transform ??= {};
options.transform.jsx = {
runtime: opts.jsxRuntime,
importSource: opts.jsxImportSource
};
return options;
}
}
};
const viteRefreshWrapper = {
name: "vite:react:refresh-wrapper",
apply: "serve",
async applyToEnvironment(env) {
if (env.config.consumer !== "client" || skipFastRefresh) return false;
return reactRefreshWrapperPlugin({
cwd: process.cwd(),
include: makeIdFiltersToMatchWithQuery(include),
exclude: makeIdFiltersToMatchWithQuery(exclude),
jsxImportSource,
reactRefreshHost: opts.reactRefreshHost ?? ""
});
}
};
const viteConfigPost = {
name: "vite:react:config-post",
enforce: "post",
config(userConfig) {
if (userConfig.server?.hmr === false) return { oxc: { jsx: { refresh: false } } };
}
};
const viteReactRefreshBundledDevMode = {
name: "vite:react-refresh-fbm",
enforce: "pre",
transformIndexHtml: {
handler() {
if (!skipFastRefresh && isBundledDev) return [{
tag: "script",
attrs: { type: "module" },
children: getPreambleCode(base)
}];
},
order: "pre"
}
};
const dependencies = [
"react",
"react-dom",
jsxImportDevRuntime,
jsxImportRuntime
];
return [
viteBabel,
viteRefreshWrapper,
viteConfigPost,
viteReactRefreshBundledDevMode,
{
name: "vite:react-refresh",
enforce: "pre",
config: (userConfig) => ({
build: silenceUseClientWarning(userConfig),
optimizeDeps: { include: dependencies }
}),
resolveId: {
filter: { id: exactRegex(runtimePublicPath) },
handler(id) {
if (id === "/@react-refresh") return id;
}
},
load: {
filter: { id: exactRegex(runtimePublicPath) },
handler(id) {
if (id === "/@react-refresh") return readFileSync(refreshRuntimePath, "utf-8").replace(/__README_URL__/g, "https://github.com/vitejs/vite-plugin-react/tree/main/packages/plugin-react");
}
},
transformIndexHtml() {
if (!skipFastRefresh && !isBundledDev) return [{
tag: "script",
attrs: { type: "module" },
children: getPreambleCode(base)
}];
}
},
virtualPreamblePlugin({
name: "@vitejs/plugin-react/preamble",
isEnabled: () => !skipFastRefresh && !isBundledDev
})
];
}
viteReact.preambleCode = preambleCode;
function viteReactForCjs(options) {
return viteReact.call(this, options);
}
Object.assign(viteReactForCjs, {
default: viteReactForCjs,
reactCompilerPreset
});
//#endregion
export { viteReact as default, viteReactForCjs as "module.exports", reactCompilerPreset };
@@ -0,0 +1,12 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = _classCheckPrivateStaticAccess;
var _assertClassBrand = require("assertClassBrand");
function _classCheckPrivateStaticAccess(receiver, classConstructor, returnValue) {
return _assertClassBrand(classConstructor, receiver, returnValue);
}
//# sourceMappingURL=classCheckPrivateStaticAccess.js.map
@@ -0,0 +1,22 @@
/**
* Ensure the type of a value
*
* 确认类型
*
* @example
* ```js
* import { ensureType } from 'is-what-type';
*
* const value: string | number | boolean | null | undefined | symbol | bigint = null;
const whatType = typeof value;
if (ensureType<object>(value, whatType === 'object')) {
Object.keys(value); // Throws TypeError: Cannot convert undefined or null to object
}
* ```
*
* @param value - The value to check
* @param checked - If the type is already checked
* @returns
*/
export declare function ensureType<T = unknown>(value: unknown, checked: boolean): value is T;
@@ -0,0 +1,16 @@
/**
* @license lucide-react v0.469.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/
import createLucideIcon from '../createLucideIcon.js';
const StepBack = createLucideIcon("StepBack", [
["line", { x1: "18", x2: "18", y1: "20", y2: "4", key: "cun8e5" }],
["polygon", { points: "14,20 4,12 14,4", key: "ypakod" }]
]);
export { StepBack as default };
//# sourceMappingURL=step-back.js.map
@@ -0,0 +1,19 @@
/*! *****************************************************************************
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
this file except in compliance with the License. You may obtain a copy of the
License at http://www.apache.org/licenses/LICENSE-2.0
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
MERCHANTABILITY OR NON-INFRINGEMENT.
See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */
interface ArrayBufferConstructor {
new (): ArrayBuffer;
}
@@ -0,0 +1 @@
{"version":3,"file":"websocket.js","sourceRoot":"","sources":["../../../src/client/websocket.ts"],"names":[],"mappings":"AACA,OAAO,EAAkB,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAEnE,MAAM,WAAW,GAAG,KAAK,CAAC;AAE1B;;GAEG;AACH,MAAM,OAAO,wBAAwB;IAQjC,YAAY,GAAQ;QAChB,IAAI,CAAC,IAAI,GAAG,GAAG,CAAC;IACpB,CAAC;IAED,KAAK;QACD,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC;YACf,MAAM,IAAI,KAAK,CACX,mHAAmH,CACtH,CAAC;QACN,CAAC;QAED,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;YACnC,IAAI,CAAC,OAAO,GAAG,IAAI,SAAS,CAAC,IAAI,CAAC,IAAI,EAAE,WAAW,CAAC,CAAC;YAErD,IAAI,CAAC,OAAO,CAAC,OAAO,GAAG,KAAK,CAAC,EAAE;gBAC3B,MAAM,KAAK,GAAG,OAAO,IAAI,KAAK,CAAC,CAAC,CAAE,KAAK,CAAC,KAAe,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,oBAAoB,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;gBACjH,MAAM,CAAC,KAAK,CAAC,CAAC;gBACd,IAAI,CAAC,OAAO,EAAE,CAAC,KAAK,CAAC,CAAC;YAC1B,CAAC,CAAC;YAEF,IAAI,CAAC,OAAO,CAAC,MAAM,GAAG,GAAG,EAAE;gBACvB,OAAO,EAAE,CAAC;YACd,CAAC,CAAC;YAEF,IAAI,CAAC,OAAO,CAAC,OAAO,GAAG,GAAG,EAAE;gBACxB,IAAI,CAAC,OAAO,EAAE,EAAE,CAAC;YACrB,CAAC,CAAC;YAEF,IAAI,CAAC,OAAO,CAAC,SAAS,GAAG,CAAC,KAAmB,EAAE,EAAE;gBAC7C,IAAI,OAAuB,CAAC;gBAC5B,IAAI,CAAC;oBACD,OAAO,GAAG,oBAAoB,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC;gBACjE,CAAC;gBAAC,OAAO,KAAK,EAAE,CAAC;oBACb,IAAI,CAAC,OAAO,EAAE,CAAC,KAAc,CAAC,CAAC;oBAC/B,OAAO;gBACX,CAAC;gBAED,IAAI,CAAC,SAAS,EAAE,CAAC,OAAO,CAAC,CAAC;YAC9B,CAAC,CAAC;QACN,CAAC,CAAC,CAAC;IACP,CAAC;IAED,KAAK,CAAC,KAAK;QACP,IAAI,CAAC,OAAO,EAAE,KAAK,EAAE,CAAC;IAC1B,CAAC;IAED,IAAI,CAAC,OAAuB;QACxB,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;YACnC,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC;gBAChB,MAAM,CAAC,IAAI,KAAK,CAAC,eAAe,CAAC,CAAC,CAAC;gBACnC,OAAO;YACX,CAAC;YAED,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,CAAC;YAC5C,OAAO,EAAE,CAAC;QACd,CAAC,CAAC,CAAC;IACP,CAAC;CACJ"}
@@ -0,0 +1 @@
{"version":3,"file":"renderRouteNotFound.cjs","names":[],"sources":["../../src/renderRouteNotFound.tsx"],"sourcesContent":["import * as React from 'react'\nimport { DefaultGlobalNotFound } from './not-found'\nimport type { AnyRoute, AnyRouter } from '@tanstack/router-core'\n\n/**\n * Renders a not found component for a route when no matching route is found.\n *\n * @param router - The router instance containing the route configuration\n * @param route - The route that triggered the not found state\n * @param data - Additional data to pass to the not found component\n * @returns The rendered not found component or a default fallback component\n */\nexport function renderRouteNotFound(\n router: AnyRouter,\n route: AnyRoute,\n data: any,\n) {\n if (!route.options.notFoundComponent) {\n if (router.options.defaultNotFoundComponent) {\n return <router.options.defaultNotFoundComponent {...data} />\n }\n\n if (process.env.NODE_ENV !== 'production') {\n if (!route.options.notFoundComponent) {\n console.warn(\n `Warning: A notFoundError was encountered on the route with ID \"${route.id}\", but a notFoundComponent option was not configured, nor was a router level defaultNotFoundComponent configured. Consider configuring at least one of these to avoid TanStack Router's overly generic defaultNotFoundComponent (<p>Not Found</p>)`,\n )\n }\n }\n\n return <DefaultGlobalNotFound />\n }\n\n return <route.options.notFoundComponent {...data} />\n}\n"],"mappings":";;;;;;;;;;;;;;AAYA,SAAgB,oBACd,QACA,OACA,MACA;AACA,KAAI,CAAC,MAAM,QAAQ,mBAAmB;AACpC,MAAI,OAAO,QAAQ,yBACjB,QAAO,iBAAA,GAAA,kBAAA,KAAC,OAAO,QAAQ,0BAAhB,EAAyC,GAAI,MAAQ,CAAA;AAG9D,MAAA,QAAA,IAAA,aAA6B;OACvB,CAAC,MAAM,QAAQ,kBACjB,SAAQ,KACN,kEAAkE,MAAM,GAAG,oPAC5E;;AAIL,SAAO,iBAAA,GAAA,kBAAA,KAAC,kBAAA,uBAAD,EAAyB,CAAA;;AAGlC,QAAO,iBAAA,GAAA,kBAAA,KAAC,MAAM,QAAQ,mBAAf,EAAiC,GAAI,MAAQ,CAAA"}
@@ -0,0 +1 @@
{"version":3,"file":"large-numbers.d.ts","sourceRoot":"","sources":["../../src/large-numbers.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,MAAM,GAAI,KAAK,MAAM,EAAE,KAAK,MAAM,4BAa9C,CAAA;AA6BD,eAAO,MAAM,KAAK,GAAI,KAAK,MAAM,WAiBhC,CAAA"}
@@ -0,0 +1,184 @@
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || (function () {
var ownKeys = function(o) {
ownKeys = Object.getOwnPropertyNames || function (o) {
var ar = [];
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
return ar;
};
return ownKeys(o);
};
return function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
__setModuleDefault(result, mod);
return result;
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
const tsutils = __importStar(require("ts-api-utils"));
const ts = __importStar(require("typescript"));
const util_1 = require("../util");
const getParentFunctionNode_1 = require("../util/getParentFunctionNode");
exports.default = (0, util_1.createRule)({
name: 'no-unsafe-return',
meta: {
type: 'problem',
docs: {
description: 'Disallow returning a value with type `any` from a function',
recommended: 'recommended',
requiresTypeChecking: true,
},
messages: {
unsafeReturn: 'Unsafe return of a value of type {{type}}.',
unsafeReturnAssignment: 'Unsafe return of type `{{sender}}` from function with return type `{{receiver}}`.',
unsafeReturnThis: [
'Unsafe return of a value of type `{{type}}`. `this` is typed as `any`.',
'You can try to fix this by turning on the `noImplicitThis` compiler option, or adding a `this` parameter to the function.',
].join('\n'),
},
schema: [],
},
defaultOptions: [],
create(context) {
const services = (0, util_1.getParserServices)(context);
const checker = services.program.getTypeChecker();
const compilerOptions = services.program.getCompilerOptions();
const isNoImplicitThis = tsutils.isStrictCompilerOptionEnabled(compilerOptions, 'noImplicitThis');
function checkReturn(returnNode, reportingNode = returnNode) {
const tsNode = services.esTreeNodeToTSNodeMap.get(returnNode);
const type = checker.getTypeAtLocation(tsNode);
const anyType = (0, util_1.discriminateAnyType)(type, checker, services.program, tsNode);
const functionNode = (0, getParentFunctionNode_1.getParentFunctionNode)(returnNode);
/* istanbul ignore if */ if (!functionNode) {
return;
}
// function has an explicit return type, so ensure it's a safe return
const returnNodeType = services.getTypeAtLocation(returnNode);
const constrainedReturnNodeType = (0, util_1.getConstrainedTypeAtLocation)(services, returnNode);
const functionTSNode = services.esTreeNodeToTSNodeMap.get(functionNode);
// function expressions will not have their return type modified based on receiver typing
// so we have to use the contextual typing in these cases, i.e.
// const foo1: () => Set<string> = () => new Set<any>();
// the return type of the arrow function is Set<any> even though the variable is typed as Set<string>
let functionType = ts.isFunctionExpression(functionTSNode) ||
ts.isArrowFunction(functionTSNode)
? (0, util_1.getContextualType)(checker, functionTSNode)
: services.getTypeAtLocation(functionNode);
functionType ??= services.getTypeAtLocation(functionNode);
const callSignatures = tsutils.getCallSignaturesOfType(functionType);
// If there is an explicit type annotation *and* that type matches the actual
// function return type, we shouldn't complain (it's intentional, even if unsafe)
if (functionTSNode.type) {
for (const signature of callSignatures) {
const signatureReturnType = signature.getReturnType();
if (returnNodeType === signatureReturnType ||
(0, util_1.isTypeFlagSet)(signatureReturnType, ts.TypeFlags.Any | ts.TypeFlags.Unknown)) {
return;
}
if (functionNode.async) {
const awaitedSignatureReturnType = checker.getAwaitedType(signatureReturnType);
const awaitedReturnNodeType = checker.getAwaitedType(returnNodeType);
if (awaitedReturnNodeType === awaitedSignatureReturnType ||
(awaitedSignatureReturnType &&
(0, util_1.isTypeFlagSet)(awaitedSignatureReturnType, ts.TypeFlags.Any | ts.TypeFlags.Unknown))) {
return;
}
}
}
}
if (anyType !== util_1.AnyType.Safe) {
// Allow cases when the declared return type of the function is either unknown or unknown[]
// and the function is returning any or any[].
for (const signature of callSignatures) {
const functionReturnType = signature.getReturnType();
if (anyType === util_1.AnyType.Any &&
(0, util_1.isTypeUnknownType)(functionReturnType)) {
return;
}
if (anyType === util_1.AnyType.AnyArray &&
(0, util_1.isTypeUnknownArrayType)(functionReturnType, checker)) {
return;
}
const awaitedType = checker.getAwaitedType(functionReturnType);
if (awaitedType &&
anyType === util_1.AnyType.PromiseAny &&
(0, util_1.isTypeUnknownType)(awaitedType)) {
return;
}
}
if (anyType === util_1.AnyType.PromiseAny && !functionNode.async) {
return;
}
let messageId = 'unsafeReturn';
const isErrorType = tsutils.isIntrinsicErrorType(constrainedReturnNodeType);
if (!isNoImplicitThis) {
// `return this`
const thisExpression = (0, util_1.getThisExpression)(returnNode);
if (thisExpression &&
(0, util_1.isTypeAnyType)((0, util_1.getConstrainedTypeAtLocation)(services, thisExpression))) {
messageId = 'unsafeReturnThis';
}
}
// If the function return type was not unknown/unknown[], mark usage as unsafeReturn.
return context.report({
node: reportingNode,
messageId,
data: {
type: isErrorType
? 'error'
: anyType === util_1.AnyType.Any
? '`any`'
: anyType === util_1.AnyType.PromiseAny
? '`Promise<any>`'
: '`any[]`',
},
});
}
const signature = functionType.getCallSignatures().at(0);
if (signature) {
const functionReturnType = signature.getReturnType();
const result = (0, util_1.isUnsafeAssignment)(returnNodeType, functionReturnType, checker, returnNode);
if (!result) {
return;
}
const { receiver, sender } = result;
return context.report({
node: reportingNode,
messageId: 'unsafeReturnAssignment',
data: {
receiver: checker.typeToString(receiver),
sender: checker.typeToString(sender),
},
});
}
}
return {
'ArrowFunctionExpression > :not(BlockStatement).body': checkReturn,
ReturnStatement(node) {
const argument = node.argument;
if (!argument) {
return;
}
checkReturn(argument, node);
},
};
},
});
@@ -0,0 +1 @@
{"version":3,"file":"data-id.mjs","sources":["../../../../src/animation/optimized-appear/data-id.ts"],"sourcesContent":["import { camelToDash } from \"../../render/dom/utils/camel-to-dash\"\n\nexport const optimizedAppearDataId = \"framerAppearId\"\n\nexport const optimizedAppearDataAttribute =\n \"data-\" + camelToDash(optimizedAppearDataId) as \"data-framer-appear-id\"\n"],"names":[],"mappings":";;AAEO,MAAM,qBAAqB,GAAG;AAE9B,MAAM,4BAA4B,GACrC,OAAO,GAAG,WAAW,CAAC,qBAAqB;;;;"}
@@ -0,0 +1 @@
{"version":3,"file":"pause.js","sources":["../../../src/icons/pause.ts"],"sourcesContent":["import createLucideIcon from '../createLucideIcon';\n\n/**\n * @component @name Pause\n * @description Lucide SVG icon component, renders SVG Element with children.\n *\n * @preview ![img](data:image/svg+xml;base64,PHN2ZyAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogIHdpZHRoPSIyNCIKICBoZWlnaHQ9IjI0IgogIHZpZXdCb3g9IjAgMCAyNCAyNCIKICBmaWxsPSJub25lIgogIHN0cm9rZT0iIzAwMCIgc3R5bGU9ImJhY2tncm91bmQtY29sb3I6ICNmZmY7IGJvcmRlci1yYWRpdXM6IDJweCIKICBzdHJva2Utd2lkdGg9IjIiCiAgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIgogIHN0cm9rZS1saW5lam9pbj0icm91bmQiCj4KICA8cmVjdCB4PSIxNCIgeT0iNCIgd2lkdGg9IjQiIGhlaWdodD0iMTYiIHJ4PSIxIiAvPgogIDxyZWN0IHg9IjYiIHk9IjQiIHdpZHRoPSI0IiBoZWlnaHQ9IjE2IiByeD0iMSIgLz4KPC9zdmc+Cg==) - https://lucide.dev/icons/pause\n * @see https://lucide.dev/guide/packages/lucide-react - Documentation\n *\n * @param {Object} props - Lucide icons props and any valid SVG attribute\n * @returns {JSX.Element} JSX Element\n *\n */\nconst Pause = createLucideIcon('Pause', [\n ['rect', { x: '14', y: '4', width: '4', height: '16', rx: '1', key: 'zuxfzm' }],\n ['rect', { x: '6', y: '4', width: '4', height: '16', rx: '1', key: '1okwgv' }],\n]);\n\nexport default Pause;\n"],"names":[],"mappings":";;;;;;;;;AAaM,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,iBAAiB,OAAS,CAAA,CAAA,CAAA;AAAA,CAAA,CACtC,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAE,CAAA,CAAA,CAAG,MAAM,CAAG,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,CAAO,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,QAAQ,CAAM,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAI,CAAK,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA,CAAA;AAAA,CAAA,CAC9E,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAE,CAAA,CAAA,CAAG,KAAK,CAAG,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,CAAO,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,QAAQ,CAAM,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAI,CAAK,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA;AAC/E,CAAC,CAAA,CAAA;;"}
@@ -0,0 +1,23 @@
/**
* @license lucide-react v0.469.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/
import createLucideIcon from '../createLucideIcon.js';
const BookCopy = createLucideIcon("BookCopy", [
["path", { d: "M2 16V4a2 2 0 0 1 2-2h11", key: "spzkk5" }],
[
"path",
{
d: "M22 18H11a2 2 0 1 0 0 4h10.5a.5.5 0 0 0 .5-.5v-15a.5.5 0 0 0-.5-.5H11a2 2 0 0 0-2 2v12",
key: "1wz07i"
}
],
["path", { d: "M5 14H4a2 2 0 1 0 0 4h1", key: "16gqf9" }]
]);
export { BookCopy as default };
//# sourceMappingURL=book-copy.js.map
@@ -0,0 +1 @@
module.exports={A:{A:{"2":"_E"},B:{"1":"_J"},C:{"1":"_mR","2":"_VS"},D:{"1":"_aE","2":"_aL _TF _cG","66":"_jC _kH"},E:{"1":"_QB","2":"_TB"},F:{"1":"_BF","2":"_j _NB _9D _O","66":"_0E"},G:{"1":"_BB","2":"_OB"},H:{"2":"1D"},I:{"1":"I","2":"_G"},J:{"2":"_B"},K:{"1":"H","2":"_D"},L:{"1":"I"},M:{"1":"YC"},N:{"2":"_A"},O:{"1":"bC"},P:{"1":"_U","2":"J"},Q:{"1":"JE"},R:{"1":"KE"},S:{"1":"_C"}},B:6,C:"Proxy object",D:true};
@@ -0,0 +1,30 @@
import { floatRegex } from '../utils/float-regex.mjs';
import { isNullish } from '../utils/is-nullish.mjs';
import { singleColorRegex } from '../utils/single-color-regex.mjs';
/**
* Returns true if the provided string is a color, ie rgba(0,0,0,0) or #000,
* but false if a number or multiple colors
*/
const isColorString = (type, testProp) => (v) => {
return Boolean((typeof v === "string" &&
singleColorRegex.test(v) &&
v.startsWith(type)) ||
(testProp &&
!isNullish(v) &&
Object.prototype.hasOwnProperty.call(v, testProp)));
};
const splitColor = (aName, bName, cName) => (v) => {
if (typeof v !== "string")
return v;
const [a, b, c, alpha] = v.match(floatRegex);
return {
[aName]: parseFloat(a),
[bName]: parseFloat(b),
[cName]: parseFloat(c),
alpha: alpha !== undefined ? parseFloat(alpha) : 1,
};
};
export { isColorString, splitColor };
//# sourceMappingURL=utils.mjs.map
@@ -0,0 +1,76 @@
var inspect = require('../');
var test = require('tape');
var arrow = require('make-arrow-function')();
var functionsHaveConfigurableNames = require('functions-have-names').functionsHaveConfigurableNames();
test('function', function (t) {
t.plan(1);
var obj = [1, 2, function f(n) { return n; }, 4];
t.equal(inspect(obj), '[ 1, 2, [Function: f], 4 ]');
});
test('function name', function (t) {
t.plan(1);
var f = (function () {
return function () {};
}());
f.toString = function toStr() { return 'function xxx () {}'; };
var obj = [1, 2, f, 4];
t.equal(inspect(obj), '[ 1, 2, [Function (anonymous)] { toString: [Function: toStr] }, 4 ]');
});
test('anon function', function (t) {
var f = (function () {
return function () {};
}());
var obj = [1, 2, f, 4];
t.equal(inspect(obj), '[ 1, 2, [Function (anonymous)], 4 ]');
t.end();
});
test('arrow function', { skip: !arrow }, function (t) {
t.equal(inspect(arrow), '[Function (anonymous)]');
t.end();
});
test('truly nameless function', { skip: !arrow || !functionsHaveConfigurableNames }, function (t) {
function f() {}
Object.defineProperty(f, 'name', { value: false });
t.equal(f.name, false);
t.equal(
inspect(f),
'[Function: f]',
'named function with falsy `.name` does not hide its original name'
);
function g() {}
Object.defineProperty(g, 'name', { value: true });
t.equal(g.name, true);
t.equal(
inspect(g),
'[Function: true]',
'named function with truthy `.name` hides its original name'
);
var anon = function () {}; // eslint-disable-line func-style
Object.defineProperty(anon, 'name', { value: null });
t.equal(anon.name, null);
t.equal(
inspect(anon),
'[Function (anonymous)]',
'anon function with falsy `.name` does not hide its anonymity'
);
var anon2 = function () {}; // eslint-disable-line func-style
Object.defineProperty(anon2, 'name', { value: 1 });
t.equal(anon2.name, 1);
t.equal(
inspect(anon2),
'[Function: 1]',
'anon function with truthy `.name` hides its anonymity'
);
t.end();
});
@@ -0,0 +1 @@
{"version":3,"file":"waves-ladder.js","sources":["../../../src/icons/waves-ladder.ts"],"sourcesContent":["import createLucideIcon from '../createLucideIcon';\n\n/**\n * @component @name WavesLadder\n * @description Lucide SVG icon component, renders SVG Element with children.\n *\n * @preview ![img](data:image/svg+xml;base64,PHN2ZyAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogIHdpZHRoPSIyNCIKICBoZWlnaHQ9IjI0IgogIHZpZXdCb3g9IjAgMCAyNCAyNCIKICBmaWxsPSJub25lIgogIHN0cm9rZT0iIzAwMCIgc3R5bGU9ImJhY2tncm91bmQtY29sb3I6ICNmZmY7IGJvcmRlci1yYWRpdXM6IDJweCIKICBzdHJva2Utd2lkdGg9IjIiCiAgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIgogIHN0cm9rZS1saW5lam9pbj0icm91bmQiCj4KICA8cGF0aCBkPSJNMTkgNWEyIDIgMCAwIDAtMiAydjExIiAvPgogIDxwYXRoIGQ9Ik0yIDE4Yy42LjUgMS4yIDEgMi41IDEgMi41IDAgMi41LTIgNS0yIDIuNiAwIDIuNCAyIDUgMiAyLjUgMCAyLjUtMiA1LTIgMS4zIDAgMS45LjUgMi41IDEiIC8+CiAgPHBhdGggZD0iTTcgMTNoMTAiIC8+CiAgPHBhdGggZD0iTTcgOWgxMCIgLz4KICA8cGF0aCBkPSJNOSA1YTIgMiAwIDAgMC0yIDJ2MTEiIC8+Cjwvc3ZnPgo=) - https://lucide.dev/icons/waves-ladder\n * @see https://lucide.dev/guide/packages/lucide-react - Documentation\n *\n * @param {Object} props - Lucide icons props and any valid SVG attribute\n * @returns {JSX.Element} JSX Element\n *\n */\nconst WavesLadder = createLucideIcon('WavesLadder', [\n ['path', { d: 'M19 5a2 2 0 0 0-2 2v11', key: 's41o68' }],\n [\n 'path',\n {\n d: 'M2 18c.6.5 1.2 1 2.5 1 2.5 0 2.5-2 5-2 2.6 0 2.4 2 5 2 2.5 0 2.5-2 5-2 1.3 0 1.9.5 2.5 1',\n key: 'rd2r6e',\n },\n ],\n ['path', { d: 'M7 13h10', key: '1rwob1' }],\n ['path', { d: 'M7 9h10', key: '12czzb' }],\n ['path', { d: 'M9 5a2 2 0 0 0-2 2v11', key: 'x0q4gh' }],\n]);\n\nexport default WavesLadder;\n"],"names":[],"mappings":";;;;;;;;;AAaM,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAc,iBAAiB,aAAe,CAAA,CAAA,CAAA;AAAA,CAAA,CAClD,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,CAA0B,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA,CAAA;AAAA,CACvD,CAAA,CAAA;AAAA,CAAA,CAAA,CAAA,CACE,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;AAAA,CACA,CAAA,CAAA,CAAA,CAAA;AAAA,CACE,CAAA,CAAA,CAAA,CAAA,CAAA,CAAG,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;AAAA,CACH,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;AAAA,CACP,CAAA,CAAA,CAAA,CAAA;AAAA,CACF,CAAA,CAAA,CAAA;AAAA,CAAA,CACA,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,CAAY,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA,CAAA;AAAA,CAAA,CACzC,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,CAAW,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA,CAAA;AAAA,CAAA,CACxC,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,CAAyB,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA;AACxD,CAAC,CAAA,CAAA;;"}
@@ -0,0 +1,13 @@
import * as ts from 'typescript';
import type { ParseSettings } from '../parseSettings';
/**
* Clear all of the parser caches.
* This should only be used in testing to ensure the parser is clean between tests.
*/
export declare function clearWatchCaches(): void;
/**
* Calculate project environments using options provided by consumer and paths from config
* @param parseSettings Internal settings for parsing the file
* @returns The programs corresponding to the supplied tsconfig paths
*/
export declare function getWatchProgramsForProjects(parseSettings: ParseSettings): ts.Program[];
@@ -0,0 +1 @@
{"version":3,"file":"server.js","names":[],"sources":["../../../src/isServer/server.ts"],"sourcesContent":["export const isServer = process.env.NODE_ENV === 'test' ? undefined : true\n"],"mappings":";AAAA,MAAa,WAAA,QAAA,IAAA,aAAoC,SAAS,KAAA,IAAY"}
@@ -0,0 +1 @@
module.exports={C:{"78":0.00302,"88":0.00302,"115":0.04529,"120":0.05736,"121":0.12076,"123":0.00302,"124":0.00302,"125":0.00302,"127":0.00302,"136":0.00302,"140":0.0634,"146":0.00302,"147":0.00302,"148":0.00302,"149":0.00302,"150":0.00604,"151":0.00302,"152":0.02113,"153":0.02717,"154":0.12378,"155":0.34417,"156":0.36832,"157":0.01208,_:"2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 79 80 81 82 83 84 85 86 87 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 116 117 118 119 122 126 128 129 130 131 132 133 134 135 137 138 139 141 142 143 144 145 158 159 160 3.5 3.6"},D:{"49":0.00906,"76":0.00302,"79":0.00302,"87":0.00302,"88":0.00302,"89":0.00302,"90":0.00302,"91":0.00302,"92":0.00302,"93":0.01208,"96":0.00302,"103":0.06038,"104":0.03623,"105":0.03623,"106":0.03925,"107":0.03623,"108":0.03623,"109":0.18416,"110":0.03623,"111":0.03623,"112":0.03623,"116":0.10868,"117":0.03925,"118":0.12076,"119":0.11472,"120":0.16303,"121":0.00302,"122":0.0483,"123":0.00906,"124":0.0483,"125":0.00302,"126":0.04529,"127":0.00302,"128":0.05736,"129":0.00302,"130":0.00302,"131":0.12378,"132":0.00302,"133":0.1117,"134":0.05132,"135":0.0483,"136":0.1117,"137":0.06038,"138":0.10868,"139":0.05736,"140":0.06038,"141":0.08453,"142":0.1751,"143":0.0151,"144":0.03623,"145":0.06038,"146":0.05132,"147":0.06038,"148":0.13284,"149":0.18416,"150":0.60078,"151":1.58196,"152":5.47043,"153":4.82436,"154":1.11703,"155":0.0151,_:"4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 77 78 80 81 83 84 85 86 94 95 97 98 99 100 101 102 113 114 115 156 157"},F:{"46":0.00302,"95":0.00302,"101":0.00604,"106":0.00302,"108":0.00302,"133":0.00302,"134":0.03623,"135":0.24152,_:"9 11 12 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 47 48 49 50 51 52 53 54 55 56 57 58 60 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 96 97 98 99 100 102 103 104 105 107 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 131 132 9.5-9.6 10.0-10.1 10.5 10.6 11.1 11.5 11.6 12.1"},B:{"109":0.00604,"119":0.0634,"120":0.05736,"122":0.00604,"132":0.00302,"134":0.01208,"135":0.00302,"136":0.00302,"137":0.00906,"138":0.00302,"139":0.00302,"140":0.00302,"141":0.00302,"142":0.00906,"143":0.00604,"144":0.00302,"145":0.00302,"146":0.00302,"147":0.00906,"148":0.02113,"149":0.01811,"150":0.07246,"151":0.28077,"152":2.34878,"153":2.72918,"154":0.69135,_:"12 13 14 15 16 17 18 79 80 81 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 110 111 112 113 114 115 116 117 118 121 123 124 125 126 127 128 129 130 131 133"},E:{"14":0.00604,"27":0.08453,_:"4 5 6 7 8 9 10 11 12 13 15 3.1 3.2 5.1 6.1 7.1 9.1 10.1 11.1 12.1 15.1 27.1 27.2 TP","13.1":0.00604,"14.1":0.02113,"15.2-15.3":0.00302,"15.4":0.00302,"15.5":0.00906,"15.6":0.08755,"16.0":0.00604,"16.1":0.00906,"16.2":0.00906,"16.3":0.0151,"16.4":0.00302,"16.5":0.00604,"16.6":0.16605,"17.0":0.02113,"17.1":0.1117,"17.2":0.00604,"17.3":0.00906,"17.4":0.0151,"17.5":0.02113,"17.6":0.10868,"18.0":0.00604,"18.1":0.02113,"18.2":0.00604,"18.3":0.03925,"18.4":0.01208,"18.5-18.7":0.0483,"26.0":0.01208,"26.1":0.02113,"26.2":0.06642,"26.3":0.09661,"26.4":0.07548,"26.5":0.41662,"26.6":1.30723},G:{"8":0,"3.2":0,"4.0-4.1":0,"4.2-4.3":0.00271,"5.0-5.1":0.00271,"6.0-6.1":0,"7.0-7.1":0.00543,"8.1-8.4":0,"9.0-9.2":0,"9.3":0,"10.0-10.2":0,"10.3":0.02713,"11.0-11.2":0.00271,"11.3-11.4":0.00543,"12.0-12.1":0,"12.2-12.5":0.07054,"13.0-13.1":0,"13.2":0.01357,"13.3":0,"13.4-13.7":0.00271,"14.0-14.4":0.01085,"14.5-14.8":0.01628,"15.0-15.1":0.01628,"15.2-15.3":0.01085,"15.4":0.01357,"15.5":0.01628,"15.6-15.8":0.35272,"16.0":0.02713,"16.1":0.04884,"16.2":0.02713,"16.3":0.05969,"16.4":0.01357,"16.5":0.02171,"16.6-16.7":0.49109,"17.0":0.01899,"17.1":0.02713,"17.2":0.02713,"17.3":0.0407,"17.4":0.05698,"17.5":0.11124,"17.6-17.7":0.2876,"18.0":0.05969,"18.1":0.11938,"18.2":0.16279,"18.3":0.28217,"18.4":0.17636,"18.5-18.7":3.64383,"26.0":0.17636,"26.1":0.17907,"26.2":0.46667,"26.3":0.50466,"26.4":0.369,"26.5":2.47173,"26.6":15.25093,"27.0":1.16939,"27.1":0,"27.2":0.02985},P:{"21":0.01838,"22":0.00919,"23":0.00919,"24":0.01838,"25":0.00919,"26":0.03675,"27":0.03675,"28":0.05513,"29":0.14702,"30":3.36305,_:"4 20 5.0-5.4 6.2-6.4 7.2-7.4 8.2 9.2 10.1 11.1-11.2 12.0 13.0 15.0 16.0 17.0 18.0","14.0":0.00919,"19.0":0.00919},I:{"0":0.02791,"3":0,"4":0,"2.1":0,"2.2":0,"2.3":0,"4.1":0,"4.2-4.3":0,"4.4":0,"4.4.3-4.4.4":0.00001},K:{"0":0.16757,_:"10 11 12 11.1 11.5 12.1"},A:{_:"6 7 8 9 10 11 5.5"},S:{"2.5":0.00698,_:"3.0-3.1"},J:{_:"7 10"},N:{_:"10 11"},L:{"0":38.94513},R:{_Line truncated
@@ -0,0 +1,128 @@
import { f as createRule, g as import_ast_utils, m as AST_NODE_TYPES } from "../utils.js";
var space_before_function_paren_default = createRule({
name: "space-before-function-paren",
meta: {
type: "layout",
docs: { description: "Enforce consistent spacing before function parenthesis" },
fixable: "whitespace",
schema: [{ oneOf: [{
type: "string",
enum: ["always", "never"]
}, {
type: "object",
properties: {
anonymous: {
type: "string",
enum: [
"always",
"never",
"ignore"
]
},
named: {
type: "string",
enum: [
"always",
"never",
"ignore"
]
},
asyncArrow: {
type: "string",
enum: [
"always",
"never",
"ignore"
]
},
catch: {
type: "string",
enum: [
"always",
"never",
"ignore"
]
}
},
additionalProperties: false
}] }],
defaultOptions: ["always"],
messages: {
unexpectedSpace: "Unexpected space before function parentheses.",
missingSpace: "Missing space before function parentheses."
}
},
create(context, [options]) {
const sourceCode = context.sourceCode;
const { asyncArrow = "always", anonymous = "always", named = "always", catch: catchOption = "always" } = typeof options === "string" ? {
asyncArrow: options,
anonymous: options,
named: options,
catch: options
} : options;
function isNamedFunction(node) {
if (node.id != null) return true;
const parent = node.parent;
return parent.type === AST_NODE_TYPES.MethodDefinition || parent.type === AST_NODE_TYPES.TSAbstractMethodDefinition || parent.type === AST_NODE_TYPES.Property && (parent.kind === "get" || parent.kind === "set" || parent.method);
}
function getConfigForFunction(node) {
if (node.type === AST_NODE_TYPES.ArrowFunctionExpression) {
if (node.async && (0, import_ast_utils.isOpeningParenToken)(sourceCode.getFirstToken(node, { skip: 1 }))) return asyncArrow;
} else if (isNamedFunction(node)) return named;
else if (!node.generator) return anonymous;
return "ignore";
}
function checkFunction(node) {
const functionConfig = getConfigForFunction(node);
if (functionConfig === "ignore") return;
if (functionConfig === "always" && node.typeParameters && !node.id) return;
let leftToken;
let rightToken;
if (node.typeParameters) {
leftToken = sourceCode.getLastToken(node.typeParameters);
rightToken = sourceCode.getTokenAfter(leftToken);
} else {
rightToken = sourceCode.getFirstToken(node, import_ast_utils.isOpeningParenToken);
leftToken = sourceCode.getTokenBefore(rightToken);
}
checkSpace(node, leftToken, rightToken, functionConfig);
}
function checkSpace(node, leftToken, rightToken, option) {
const hasSpacing = sourceCode.isSpaceBetween(leftToken, rightToken);
if (hasSpacing && option === "never") context.report({
node,
loc: {
start: leftToken.loc.end,
end: rightToken.loc.start
},
messageId: "unexpectedSpace",
fix: (fixer) => {
const comments = sourceCode.getCommentsBefore(rightToken);
if (comments.some((comment) => comment.type === "Line")) return null;
return fixer.replaceTextRange([leftToken.range[1], rightToken.range[0]], comments.reduce((text, comment) => text + sourceCode.getText(comment), ""));
}
});
else if (!hasSpacing && option === "always") context.report({
node,
loc: rightToken.loc,
messageId: "missingSpace",
fix: (fixer) => fixer.insertTextAfter(leftToken, " ")
});
}
return {
ArrowFunctionExpression: checkFunction,
FunctionDeclaration: checkFunction,
FunctionExpression: checkFunction,
TSEmptyBodyFunctionExpression: checkFunction,
TSDeclareFunction: checkFunction,
CatchClause(node) {
if (!node.param) return;
const option = catchOption;
if (catchOption === "ignore") return;
const rightToken = sourceCode.getFirstToken(node, import_ast_utils.isOpeningParenToken);
checkSpace(node, sourceCode.getTokenBefore(rightToken), rightToken, option);
}
};
}
});
export { space_before_function_paren_default as t };
@@ -0,0 +1 @@
module.exports={C:{"52":0.00491,"78":0.00491,"115":0.09818,"120":0.03927,"121":0.07854,"122":0.00491,"123":0.00491,"124":0.00982,"125":0.00491,"127":0.00491,"128":0.00491,"135":0.00491,"136":0.00491,"139":0.00491,"140":0.04418,"141":0.00491,"143":0.00491,"146":0.00491,"147":0.00982,"148":0.00491,"149":0.00982,"150":0.01473,"151":0.01964,"152":0.04418,"153":0.06382,"154":0.32399,"155":0.94744,"156":0.91798,"157":0.02945,_:"2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 116 117 118 119 126 129 130 131 132 133 134 137 138 142 144 145 158 159 160 3.5 3.6"},D:{"49":0.00491,"70":0.00982,"81":0.00491,"87":0.00491,"88":0.00491,"91":0.00491,"100":0.00491,"101":0.00982,"103":0.054,"104":0.03927,"105":0.03436,"106":0.03436,"107":0.03927,"108":0.03927,"109":0.40254,"110":0.03927,"111":0.04418,"112":0.03927,"113":0.00491,"114":0.00491,"116":0.10309,"117":0.03927,"118":0.24054,"119":0.07854,"120":0.22581,"121":0.01473,"122":0.09327,"123":0.02455,"124":0.054,"125":0.00491,"126":0.09818,"127":0.00491,"128":0.02455,"129":0.00491,"130":0.08345,"131":0.09818,"132":0.00982,"133":0.13254,"134":0.07854,"135":0.07854,"136":0.09327,"137":0.08345,"138":0.162,"139":0.07854,"140":0.36818,"141":0.10309,"142":0.26509,"143":0.02945,"144":0.054,"145":0.108,"146":0.08345,"147":0.06873,"148":0.12763,"149":0.15218,"150":0.3289,"151":1.92433,"152":8.98838,"153":12.21359,"154":3.16631,"155":0.07854,_:"4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 71 72 73 74 75 76 77 78 79 80 83 84 85 86 89 90 92 93 94 95 96 97 98 99 102 115 156 157"},F:{"73":0.00491,"89":0.00491,"95":0.00491,"101":0.01473,"102":0.00491,"105":0.00491,"106":0.00982,"107":0.00491,"115":0.00491,"120":0.00491,"127":0.00491,"132":0.00491,"133":0.00982,"134":0.162,"135":1.54634,_:"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 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 90 91 92 93 94 96 97 98 99 100 103 104 108 109 110 111 112 113 114 116 117 118 119 121 122 123 124 125 126 131 9.5-9.6 10.0-10.1 10.5 10.6 11.1 11.5 11.6 12.1"},B:{"92":0.00491,"108":0.00491,"109":0.01964,"119":0.03927,"120":0.03927,"122":0.00982,"123":0.00491,"124":0.00491,"127":0.00491,"131":0.00491,"132":0.00491,"133":0.00491,"134":0.00491,"135":0.00491,"136":0.00491,"138":0.00491,"139":0.00491,"140":0.00491,"141":0.00491,"142":0.00491,"143":0.00491,"144":0.01473,"145":0.01473,"146":0.00982,"147":0.01964,"148":0.01473,"149":0.02945,"150":0.07364,"151":0.33381,"152":2.35632,"153":3.48048,"154":0.99162,_:"12 13 14 15 16 17 18 79 80 81 83 84 85 86 87 88 89 90 91 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 110 111 112 113 114 115 116 117 118 121 125 126 128 129 130 137"},E:{"27":0.20618,_:"4 5 6 7 8 9 10 11 12 13 14 15 3.1 3.2 5.1 6.1 7.1 9.1 10.1 11.1 12.1 15.1 15.2-15.3 15.4 15.5 16.0 16.2 27.1 TP","13.1":0.00982,"14.1":0.00982,"15.6":0.02945,"16.1":0.00491,"16.3":0.00491,"16.4":0.00491,"16.5":0.00491,"16.6":0.06382,"17.0":0.01473,"17.1":0.05891,"17.2":0.00982,"17.3":0.00982,"17.4":0.02455,"17.5":0.01964,"17.6":0.11291,"18.0":0.00982,"18.1":0.01473,"18.2":0.02455,"18.3":0.04909,"18.4":0.02945,"18.5-18.7":0.06382,"26.0":0.11782,"26.1":0.11291,"26.2":0.162,"26.3":0.09818,"26.4":0.03927,"26.5":0.27981,"26.6":1.12416,"27.2":0.00491},G:{"8":0,"3.2":0,"4.0-4.1":0,"4.2-4.3":0.00123,"5.0-5.1":0.00123,"6.0-6.1":0,"7.0-7.1":0.00246,"8.1-8.4":0,"9.0-9.2":0,"9.3":0,"10.0-10.2":0,"10.3":0.0123,"11.0-11.2":0.00123,"11.3-11.4":0.00246,"12.0-12.1":0,"12.2-12.5":0.03198,"13.0-13.1":0,"13.2":0.00615,"13.3":0,"13.4-13.7":0.00123,"14.0-14.4":0.00492,"14.5-14.8":0.00738,"15.0-15.1":0.00738,"15.2-15.3":0.00492,"15.4":0.00615,"15.5":0.00738,"15.6-15.8":0.1599,"16.0":0.0123,"16.1":0.02214,"16.2":0.0123,"16.3":0.02706,"16.4":0.00615,"16.5":0.00984,"16.6-16.7":0.22263,"17.0":0.00861,"17.1":0.0123,"17.2":0.0123,"17.3":0.01845,"17.4":0.02583,"17.5":0.05043,"17.6-17.7":0.13038,"18.0":0.02706,"18.1":0.05412,"18.2":0.0738,"18.3":0.12792,"18.4":0.07995,"18.5-18.7":1.65187,"26.0":0.07995,"26.1":0.08118,"26.2":0.21156,"26.3":0.22878,"26.4":0.16728,"26.5":1.12052,"26.6":6.91375,"27.0":0.53012,"27.1":0,"27.2":0.01353},P:{"21":0.00952,"22":0.01904,"23":0.01904,"25":0.00952,"26":0.01904,"27":0.01904,"28":0.02856,"29":0.06664,"30":1.93255,_:"4 20 24 5.0-5.4 6.2-6.4 7.2-7.4 8.2 9.2 10.1 11.1-11.2 12.0 13.0 14.0 15.0 16.0 17.0 18.0 19.0"},I:{"0":0.03052,"3":0,"4":0,"2.1":0,"2.2":0,"2.3":0,"4.1":0,"4.2-4.3":0,"4.4":0,"4.4.3-4.4.4":0.00001},K:{"0":0.26473,_:"10 11 12 11.1 11.5 12.1"},A:{"11":Line truncated
@@ -0,0 +1 @@
{"version":3,"file":"slice.js","sources":["../../../src/icons/slice.ts"],"sourcesContent":["import createLucideIcon from '../createLucideIcon';\n\n/**\n * @component @name Slice\n * @description Lucide SVG icon component, renders SVG Element with children.\n *\n * @preview ![img](data:image/svg+xml;base64,PHN2ZyAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogIHdpZHRoPSIyNCIKICBoZWlnaHQ9IjI0IgogIHZpZXdCb3g9IjAgMCAyNCAyNCIKICBmaWxsPSJub25lIgogIHN0cm9rZT0iIzAwMCIgc3R5bGU9ImJhY2tncm91bmQtY29sb3I6ICNmZmY7IGJvcmRlci1yYWRpdXM6IDJweCIKICBzdHJva2Utd2lkdGg9IjIiCiAgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIgogIHN0cm9rZS1saW5lam9pbj0icm91bmQiCj4KICA8cGF0aCBkPSJNMTEgMTYuNTg2VjE5YTEgMSAwIDAgMS0xIDFIMkwxOC4zNyAzLjYzYTEgMSAwIDEgMSAzIDNsLTkuNjYzIDkuNjYzYTEgMSAwIDAgMS0xLjQxNCAwTDggMTQiIC8+Cjwvc3ZnPgo=) - https://lucide.dev/icons/slice\n * @see https://lucide.dev/guide/packages/lucide-react - Documentation\n *\n * @param {Object} props - Lucide icons props and any valid SVG attribute\n * @returns {JSX.Element} JSX Element\n *\n */\nconst Slice = createLucideIcon('Slice', [\n [\n 'path',\n {\n d: 'M11 16.586V19a1 1 0 0 1-1 1H2L18.37 3.63a1 1 0 1 1 3 3l-9.663 9.663a1 1 0 0 1-1.414 0L8 14',\n key: '1sllp5',\n },\n ],\n]);\n\nexport default Slice;\n"],"names":[],"mappings":";;;;;;;;;AAaM,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,iBAAiB,OAAS,CAAA,CAAA,CAAA;AAAA,CACtC,CAAA,CAAA;AAAA,CAAA,CAAA,CAAA,CACE,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;AAAA,CACA,CAAA,CAAA,CAAA,CAAA;AAAA,CACE,CAAA,CAAA,CAAA,CAAA,CAAA,CAAG,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;AAAA,CACH,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;AAAA,CACP,CAAA,CAAA,CAAA,CAAA;AAAA,CACF,CAAA,CAAA;AACF,CAAC,CAAA,CAAA;;"}
@@ -0,0 +1,73 @@
var thenify = require('thenify')
module.exports = thenifyAll
thenifyAll.withCallback = withCallback
thenifyAll.thenify = thenify
/**
* Promisifies all the selected functions in an object.
*
* @param {Object} source the source object for the async functions
* @param {Object} [destination] the destination to set all the promisified methods
* @param {Array} [methods] an array of method names of `source`
* @return {Object}
* @api public
*/
function thenifyAll(source, destination, methods) {
return promisifyAll(source, destination, methods, thenify)
}
/**
* Promisifies all the selected functions in an object and backward compatible with callback.
*
* @param {Object} source the source object for the async functions
* @param {Object} [destination] the destination to set all the promisified methods
* @param {Array} [methods] an array of method names of `source`
* @return {Object}
* @api public
*/
function withCallback(source, destination, methods) {
return promisifyAll(source, destination, methods, thenify.withCallback)
}
function promisifyAll(source, destination, methods, promisify) {
if (!destination) {
destination = {};
methods = Object.keys(source)
}
if (Array.isArray(destination)) {
methods = destination
destination = {}
}
if (!methods) {
methods = Object.keys(source)
}
if (typeof source === 'function') destination = promisify(source)
methods.forEach(function (name) {
// promisify only if it's a function
if (typeof source[name] === 'function') destination[name] = promisify(source[name])
})
// proxy the rest
Object.keys(source).forEach(function (name) {
if (deprecated(source, name)) return
if (destination[name]) return
destination[name] = source[name]
})
return destination
}
function deprecated(source, name) {
var desc = Object.getOwnPropertyDescriptor(source, name)
if (!desc || !desc.get) return false
if (desc.get.name === 'deprecated') return true
return false
}
@@ -0,0 +1,42 @@
// @ts-ignore TS6133
import { expect, test } from "vitest";
import * as z from "zod/v3";
function checkErrors(a: z.ZodTypeAny, bad: any) {
let expected: any;
try {
a.parse(bad);
} catch (error) {
expected = (error as z.ZodError).formErrors;
}
try {
a.optional().parse(bad);
} catch (error) {
expect((error as z.ZodError).formErrors).toEqual(expected);
}
}
test("Should have error messages appropriate for the underlying type", () => {
checkErrors(z.string().min(2), 1);
z.string().min(2).optional().parse(undefined);
checkErrors(z.number().gte(2), 1);
z.number().gte(2).optional().parse(undefined);
checkErrors(z.boolean(), "");
z.boolean().optional().parse(undefined);
checkErrors(z.undefined(), null);
z.undefined().optional().parse(undefined);
checkErrors(z.null(), {});
z.null().optional().parse(undefined);
checkErrors(z.object({}), 1);
z.object({}).optional().parse(undefined);
checkErrors(z.tuple([]), 1);
z.tuple([]).optional().parse(undefined);
checkErrors(z.unknown(), 1);
z.unknown().optional().parse(undefined);
});
test("unwrap", () => {
const unwrapped = z.string().optional().unwrap();
expect(unwrapped).toBeInstanceOf(z.ZodString);
});
@@ -0,0 +1,9 @@
/**
* @license lucide-react v0.469.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/
export { default } from './square-chart-gantt.js';
//# sourceMappingURL=gantt-chart-square.js.map
@@ -0,0 +1,154 @@
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const node_crypto_1 = require("node:crypto");
const mcp_js_1 = require("../../server/mcp.js");
const express_js_1 = require("../../server/express.js");
const streamableHttp_js_1 = require("../../server/streamableHttp.js");
const types_js_1 = require("../../types.js");
const inMemoryEventStore_js_1 = require("../shared/inMemoryEventStore.js");
const cors_1 = __importDefault(require("cors"));
// Factory to create a new MCP server per session.
// Each session needs its own server+transport pair to avoid cross-session contamination.
const getServer = () => {
const server = new mcp_js_1.McpServer({
name: 'sse-polling-example',
version: '1.0.0'
}, {
capabilities: { logging: {} }
});
// Register a long-running tool that demonstrates server-initiated disconnect
server.tool('long-task', 'A long-running task that sends progress updates. Server will disconnect mid-task to demonstrate polling.', {}, async (_args, extra) => {
const sleep = (ms) => new Promise(resolve => setTimeout(resolve, ms));
console.log(`[${extra.sessionId}] Starting long-task...`);
// Send first progress notification
await server.sendLoggingMessage({
level: 'info',
data: 'Progress: 25% - Starting work...'
}, extra.sessionId);
await sleep(1000);
// Send second progress notification
await server.sendLoggingMessage({
level: 'info',
data: 'Progress: 50% - Halfway there...'
}, extra.sessionId);
await sleep(1000);
// Server decides to disconnect the client to free resources
// Client will reconnect via GET with Last-Event-ID after the transport's retryInterval
// Use extra.closeSSEStream callback - available when eventStore is configured
if (extra.closeSSEStream) {
console.log(`[${extra.sessionId}] Closing SSE stream to trigger client polling...`);
extra.closeSSEStream();
}
// Continue processing while client is disconnected
// Events are stored in eventStore and will be replayed on reconnect
await sleep(500);
await server.sendLoggingMessage({
level: 'info',
data: 'Progress: 75% - Almost done (sent while client disconnected)...'
}, extra.sessionId);
await sleep(500);
await server.sendLoggingMessage({
level: 'info',
data: 'Progress: 100% - Complete!'
}, extra.sessionId);
console.log(`[${extra.sessionId}] Task complete`);
return {
content: [
{
type: 'text',
text: 'Long task completed successfully!'
}
]
};
});
return server;
};
// Set up Express app
const app = (0, express_js_1.createMcpExpressApp)();
app.use((0, cors_1.default)());
// Create event store for resumability
const eventStore = new inMemoryEventStore_js_1.InMemoryEventStore();
// Close sessions that have been idle for IDLE_MS, and keep at most MAX_SESSIONS open
const IDLE_MS = 30 * 60000;
const MAX_SESSIONS = 1000;
const sessions = new Map();
// Count open responses so a long-running request or a listening SSE stream is not treated as idle
const trackResponse = (session, res) => {
if (!res.socket || res.destroyed)
return;
session.open++;
res.on('close', () => {
session.open--;
session.lastActive = Date.now();
});
};
// Close sessions with nothing open and no activity for IDLE_MS
setInterval(() => {
const cutoff = Date.now() - IDLE_MS;
for (const { transport, open, lastActive } of sessions.values()) {
if (open === 0 && lastActive < cutoff)
transport.close().catch(console.error);
}
}, 60000).unref();
// Handle all MCP requests
app.all('/mcp', async (req, res) => {
const sessionId = req.headers['mcp-session-id'];
// Reuse the existing transport for a known session
const session = sessionId ? sessions.get(sessionId) : undefined;
if (session) {
trackResponse(session, res);
await session.transport.handleRequest(req, res, req.body);
return;
}
if (sessionId) {
// Unknown or expired session ID - the client should start a new session
res.status(404).json({ jsonrpc: '2.0', error: { code: -32001, message: 'Session not found' }, id: null });
return;
}
if (!(0, types_js_1.isInitializeRequest)(req.body)) {
// Invalid request - no session ID and not an initialization request
res.status(400).json({ jsonrpc: '2.0', error: { code: -32000, message: 'Bad Request: No valid session ID provided' }, id: null });
return;
}
if (sessions.size >= MAX_SESSIONS) {
res.status(503).json({ jsonrpc: '2.0', error: { code: -32000, message: 'Too many open sessions' }, id: null });
return;
}
// New initialization request - create a transport for the session
const transport = new streamableHttp_js_1.StreamableHTTPServerTransport({
sessionIdGenerator: () => (0, node_crypto_1.randomUUID)(),
eventStore,
retryInterval: 2000, // Default retry interval for priming events
onsessioninitialized: id => {
console.log(`[${id}] Session initialized`);
sessions.set(id, { transport, open: 0, lastActive: Date.now() });
}
});
// Set up onclose handler to clean up transport when closed
transport.onclose = () => {
const sid = transport.sessionId;
if (sid && sessions.has(sid)) {
console.log(`[${sid}] Transport closed, removing from sessions map`);
sessions.delete(sid);
}
};
// Create a new server per session and connect it to the transport
const server = getServer();
await server.connect(transport);
await transport.handleRequest(req, res, req.body);
});
// Start the server
const PORT = 3001;
app.listen(PORT, () => {
console.log(`SSE Polling Example Server running on http://localhost:${PORT}/mcp`);
console.log('');
console.log('This server demonstrates SEP-1699 SSE polling:');
console.log('- retryInterval: 2000ms (client waits 2s before reconnecting)');
console.log('- eventStore: InMemoryEventStore (events are persisted for replay)');
console.log('');
console.log('Try calling the "long-task" tool to see server-initiated disconnect in action.');
});
//# sourceMappingURL=ssePollingExample.js.map
@@ -0,0 +1 @@
module.exports={A:{A:{"2":"_E"},B:{"1":"_yO","2":"_I","194":"_FB T"},C:{"1":"_tH","2":"_lG 7 _0G","322":"8 9"},D:{"1":"_zO","2":"_7 _rD","194":"_iI _SF T"},E:{"1":"_QE","2":"_cD"},F:{"1":"_bJ","2":"_cF _EI _O","194":"FC GC _8K"},G:{"1":"_AD","2":"_YC"},H:{"2":"1D"},I:{"1":"I","2":"_G"},J:{"2":"_B"},K:{"1":"H","2":"_D"},L:{"1":"I"},M:{"1":"YC"},N:{"2":"_A"},O:{"1":"bC"},P:{"1":"_yD","2":"_WE"},Q:{"2":"JE"},R:{"1":"KE"},S:{"2":"_C"}},B:4,C:"Screen Wake Lock API",D:true};
@@ -0,0 +1,19 @@
"use strict";
function returnValue(value) {
return value;
}
function formatMessage(message, callback = returnValue) {
return message.reduce((prev, curr, index) => {
let msg;
if (curr instanceof Error) {
msg = curr.stack || curr.message;
} else if (typeof curr === "object") {
msg = JSON.stringify(curr);
} else {
msg = String(curr);
}
msg = callback(msg);
return index === 0 ? msg : `${prev} ${msg}`;
}, "");
}
module.exports = formatMessage;
@@ -0,0 +1 @@
{"version":3,"file":"battery.js","sources":["../../../src/icons/battery.ts"],"sourcesContent":["import createLucideIcon from '../createLucideIcon';\n\n/**\n * @component @name Battery\n * @description Lucide SVG icon component, renders SVG Element with children.\n *\n * @preview ![img](data:image/svg+xml;base64,PHN2ZyAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogIHdpZHRoPSIyNCIKICBoZWlnaHQ9IjI0IgogIHZpZXdCb3g9IjAgMCAyNCAyNCIKICBmaWxsPSJub25lIgogIHN0cm9rZT0iIzAwMCIgc3R5bGU9ImJhY2tncm91bmQtY29sb3I6ICNmZmY7IGJvcmRlci1yYWRpdXM6IDJweCIKICBzdHJva2Utd2lkdGg9IjIiCiAgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIgogIHN0cm9rZS1saW5lam9pbj0icm91bmQiCj4KICA8cmVjdCB3aWR0aD0iMTYiIGhlaWdodD0iMTAiIHg9IjIiIHk9IjciIHJ4PSIyIiByeT0iMiIgLz4KICA8bGluZSB4MT0iMjIiIHgyPSIyMiIgeTE9IjExIiB5Mj0iMTMiIC8+Cjwvc3ZnPgo=) - https://lucide.dev/icons/battery\n * @see https://lucide.dev/guide/packages/lucide-react - Documentation\n *\n * @param {Object} props - Lucide icons props and any valid SVG attribute\n * @returns {JSX.Element} JSX Element\n *\n */\nconst Battery = createLucideIcon('Battery', [\n ['rect', { width: '16', height: '10', x: '2', y: '7', rx: '2', ry: '2', key: '1w10f2' }],\n ['line', { x1: '22', x2: '22', y1: '11', y2: '13', key: '4dh1rd' }],\n]);\n\nexport default Battery;\n"],"names":[],"mappings":";;;;;;;;;AAaM,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAU,iBAAiB,SAAW,CAAA,CAAA,CAAA;AAAA,CAAA,CAC1C,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,KAAO,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAM,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAQ,CAAA,CAAA,CAAA,CAAA,CAAM,CAAA,CAAA,CAAA,EAAG,CAAK,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAG,KAAK,CAAI,CAAA,CAAA,CAAA,GAAA,CAAK,CAAA,CAAA,EAAI,CAAA,CAAA,CAAA,CAAK,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,GAAU,CAAA,CAAA;AAAA,CACvF,CAAA,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAE,CAAA,CAAA,CAAA,EAAI,CAAM,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAI,CAAM,CAAA,CAAA,CAAA,CAAA,CAAA,EAAA,CAAI,CAAA,CAAA,CAAA,CAAA,CAAM,CAAA,CAAA,CAAA,CAAA,CAAI,CAAA,CAAA,CAAA,CAAA,CAAM,EAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA;AACpE,CAAC,CAAA,CAAA;;"}
@@ -0,0 +1,52 @@
{
"name": "content-type",
"version": "2.1.0",
"description": "Create and parse HTTP Content-Type header",
"keywords": [
"content-type",
"http",
"req",
"res",
"rfc7231",
"rfc9110"
],
"repository": "jshttp/content-type",
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/express"
},
"license": "MIT",
"author": "Douglas Christopher Wilson <doug@somethingdoug.com>",
"type": "commonjs",
"exports": "./dist/index.js",
"main": "./dist/index.js",
"typings": "./dist/index.d.ts",
"files": [
"dist/"
],
"scripts": {
"bench": "vitest bench",
"build": "ts-scripts build",
"format": "ts-scripts format",
"prepare": "ts-scripts install && npm run build",
"specs": "ts-scripts specs",
"test": "ts-scripts test"
},
"devDependencies": {
"@borderless/ts-scripts": "^0.15.0",
"@vitest/coverage-v8": "^3.0.5",
"typescript": "^5.7.3",
"vitest": "^3.2.4"
},
"engines": {
"node": ">=18"
},
"ts-scripts": {
"dist": [
"dist"
],
"project": [
"tsconfig.build.json"
]
}
}
@@ -0,0 +1 @@
{"version":3,"file":"git-pull-request-create.js","sources":["../../../src/icons/git-pull-request-create.ts"],"sourcesContent":["import createLucideIcon from '../createLucideIcon';\n\n/**\n * @component @name GitPullRequestCreate\n * @description Lucide SVG icon component, renders SVG Element with children.\n *\n * @preview ![img](data:image/svg+xml;base64,PHN2ZyAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogIHdpZHRoPSIyNCIKICBoZWlnaHQ9IjI0IgogIHZpZXdCb3g9IjAgMCAyNCAyNCIKICBmaWxsPSJub25lIgogIHN0cm9rZT0iIzAwMCIgc3R5bGU9ImJhY2tncm91bmQtY29sb3I6ICNmZmY7IGJvcmRlci1yYWRpdXM6IDJweCIKICBzdHJva2Utd2lkdGg9IjIiCiAgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIgogIHN0cm9rZS1saW5lam9pbj0icm91bmQiCj4KICA8Y2lyY2xlIGN4PSI2IiBjeT0iNiIgcj0iMyIgLz4KICA8cGF0aCBkPSJNNiA5djEyIiAvPgogIDxwYXRoIGQ9Ik0xMyA2aDNhMiAyIDAgMCAxIDIgMnYzIiAvPgogIDxwYXRoIGQ9Ik0xOCAxNXY2IiAvPgogIDxwYXRoIGQ9Ik0yMSAxOGgtNiIgLz4KPC9zdmc+Cg==) - https://lucide.dev/icons/git-pull-request-create\n * @see https://lucide.dev/guide/packages/lucide-react - Documentation\n *\n * @param {Object} props - Lucide icons props and any valid SVG attribute\n * @returns {JSX.Element} JSX Element\n *\n */\nconst GitPullRequestCreate = createLucideIcon('GitPullRequestCreate', [\n ['circle', { cx: '6', cy: '6', r: '3', key: '1lh9wr' }],\n ['path', { d: 'M6 9v12', key: '1sc30k' }],\n ['path', { d: 'M13 6h3a2 2 0 0 1 2 2v3', key: '1jb6z3' }],\n ['path', { d: 'M18 15v6', key: '9wciyi' }],\n ['path', { d: 'M21 18h-6', key: '139f0c' }],\n]);\n\nexport default GitPullRequestCreate;\n"],"names":[],"mappings":";;;;;;;;;AAaM,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAuB,iBAAiB,sBAAwB,CAAA,CAAA,CAAA;AAAA,CACpE,CAAA,CAAC,QAAU,CAAA,CAAA,CAAA,CAAE,EAAI,CAAA,CAAA,CAAA,CAAA,CAAA,EAAK,CAAI,CAAA,CAAA,CAAA,GAAA,CAAK,CAAA,CAAG,EAAA,CAAA,CAAA,CAAA,CAAA,CAAK,GAAK,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAU,CAAA,CAAA;AAAA,CAAA,CACtD,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,CAAW,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA,CAAA;AAAA,CAAA,CACxC,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,CAA2B,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA,CAAA;AAAA,CAAA,CACxD,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,CAAY,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA,CAAA;AAAA,CAAA,CACzC,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,CAAa,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA;AAC5C,CAAC,CAAA,CAAA;;"}
@@ -0,0 +1,18 @@
import { ParamIndexMap, Router } from "../../router.js";
import { MatcherMap, match } from "./matcher.js";
//#region src/router/reg-exp-router/prepared-router.d.ts
type RelocateMap = Record<string, ([(number | string)[], ParamIndexMap] | [(number | string)[]])[]>;
export declare class PreparedRegExpRouter<T> implements Router<T> {
name: string;
constructor(matchers: MatcherMap<T>, relocateMap: RelocateMap);
add(method: string, path: string, handler: T): void;
protected buildAllMatchers(): MatcherMap<T>;
match: typeof match<Router<T>, T>;
}
export declare const buildInitParams: (params: {
paths: string[];
}) => ConstructorParameters<typeof PreparedRegExpRouter>;
export declare const serializeInitParams: (params: ConstructorParameters<typeof PreparedRegExpRouter>) => string;
//#endregion
export {};
@@ -0,0 +1,93 @@
/**
* HMAC: RFC2104 message authentication code.
* @module
*/
import { abytes, aexists, ahash, aoutput, clean, } from "./utils.js";
/**
* Internal class for HMAC.
* Accepts any byte key, although RFC 2104 §3 recommends keys at least
* `HashLen` bytes long.
*/
export class _HMAC {
oHash;
iHash;
blockLen;
outputLen;
canXOF = false;
finished = false;
destroyed = false;
constructor(hash, key) {
ahash(hash);
abytes(key, undefined, 'key');
this.iHash = hash.create();
if (typeof this.iHash.update !== 'function')
throw new Error('Expected instance of class which extends utils.Hash');
this.blockLen = this.iHash.blockLen;
this.outputLen = this.iHash.outputLen;
const blockLen = this.blockLen;
const pad = new Uint8Array(blockLen);
// blockLen can be bigger than outputLen
pad.set(key.length > blockLen ? hash.create().update(key).digest() : key);
for (let i = 0; i < pad.length; i++)
pad[i] ^= 0x36;
this.iHash.update(pad);
// By doing update (processing of the first block) of the outer hash here,
// we can re-use it between multiple calls via clone.
this.oHash = hash.create();
// Undo internal XOR && apply outer XOR
for (let i = 0; i < pad.length; i++)
pad[i] ^= 0x36 ^ 0x5c;
this.oHash.update(pad);
clean(pad);
}
update(buf) {
aexists(this);
this.iHash.update(buf);
return this;
}
digestInto(out) {
aexists(this);
aoutput(out, this);
this.finished = true;
const buf = out.subarray(0, this.outputLen);
// Reuse the first outputLen bytes for the inner digest; the outer hash consumes them before
// overwriting that same prefix with the final tag, leaving any oversized tail untouched.
this.iHash.digestInto(buf);
this.oHash.update(buf);
this.oHash.digestInto(buf);
this.destroy();
}
digest() {
const out = new Uint8Array(this.oHash.outputLen);
this.digestInto(out);
return out;
}
_cloneInto(to) {
// Create new instance without calling constructor since the key
// is already in state and we don't know it.
to ||= Object.create(Object.getPrototypeOf(this), {});
const { oHash, iHash, finished, destroyed, blockLen, outputLen } = this;
to = to;
to.finished = finished;
to.destroyed = destroyed;
to.blockLen = blockLen;
to.outputLen = outputLen;
to.oHash = oHash._cloneInto(to.oHash);
to.iHash = iHash._cloneInto(to.iHash);
return to;
}
clone() {
return this._cloneInto();
}
destroy() {
this.destroyed = true;
this.oHash.destroy();
this.iHash.destroy();
}
}
export const hmac = /* @__PURE__ */ (() => {
const hmac_ = ((hash, key, message) => new _HMAC(hash, key).update(message).digest());
hmac_.create = (hash, key) => new _HMAC(hash, key);
return hmac_;
})();
//# sourceMappingURL=hmac.js.map
@@ -0,0 +1,365 @@
import { decodePath } from "../utils.js";
import { invariant } from "../invariant.js";
import { createLRUCache } from "../lru-cache.js";
import { rootRouteId } from "../root.js";
import { createInlineCssPlaceholderAsset, createInlineCssStyleAsset, getStylesheetHref, isInlinableStylesheet } from "../manifest.js";
import { GLOBAL_TSR, TSR_SCRIPT_BARRIER_ID } from "./constants.js";
import { makeSsrSerovalPlugin } from "./serializer/transformer.js";
import { defaultSerovalPlugins } from "./serializer/seroval-plugins.js";
import { dehydrateSsrMatchId } from "./ssr-match-id.js";
import tsrScript_default from "./tsrScript.js";
import { crossSerializeStream, getCrossReferenceHeader } from "seroval";
//#region src/ssr/ssr-server.ts
const SCOPE_ID = "tsr";
const TSR_PREFIX = GLOBAL_TSR + ".router=";
const P_PREFIX = GLOBAL_TSR + ".p(()=>";
const P_SUFFIX = ")";
function dehydrateMatch(match) {
const dehydratedMatch = {
i: dehydrateSsrMatchId(match.id),
u: match.updatedAt,
s: match.status
};
for (const [key, shorthand] of [
["__beforeLoadContext", "b"],
["loaderData", "l"],
["error", "e"],
["ssr", "ssr"]
]) if (match[key] !== void 0) dehydratedMatch[shorthand] = match[key];
if (match.globalNotFound) dehydratedMatch.g = true;
return dehydratedMatch;
}
const INITIAL_SCRIPTS = [getCrossReferenceHeader(SCOPE_ID), tsrScript_default];
var ScriptBuffer = class {
constructor(router) {
this._scriptBarrierLifted = false;
this._cleanedUp = false;
this._pendingMicrotask = false;
this.router = router;
this._queue = INITIAL_SCRIPTS.slice();
}
enqueue(script) {
if (this._cleanedUp) return;
this._queue.push(script);
if (this._scriptBarrierLifted && !this._pendingMicrotask) {
this._pendingMicrotask = true;
queueMicrotask(() => {
this._pendingMicrotask = false;
this.injectBufferedScripts();
});
}
}
liftBarrier() {
if (this._scriptBarrierLifted || this._cleanedUp) return;
this._scriptBarrierLifted = true;
if (this._queue.length > 0 && !this._pendingMicrotask) {
this._pendingMicrotask = true;
queueMicrotask(() => {
this._pendingMicrotask = false;
this.injectBufferedScripts();
});
}
}
/**
* Flushes any pending scripts synchronously.
* Call this before emitting onSerializationFinished to ensure all scripts are injected.
*
* IMPORTANT: Only injects if the barrier has been lifted. Before the barrier is lifted,
* scripts should remain in the queue so takeBufferedScripts() can retrieve them
*/
flush() {
if (!this._scriptBarrierLifted) return;
if (this._cleanedUp) return;
this._pendingMicrotask = false;
const scriptsToInject = this.takeAll();
if (scriptsToInject && this.router?.serverSsr) this.router.serverSsr.injectScript(scriptsToInject);
}
takeAll() {
const bufferedScripts = this._queue;
this._queue = [];
if (bufferedScripts.length === 0) return;
if (bufferedScripts.length === 1) return bufferedScripts[0] + ";document.currentScript.remove()";
return bufferedScripts.join(";") + ";document.currentScript.remove()";
}
injectBufferedScripts() {
if (this._cleanedUp) return;
if (this._queue.length === 0) return;
const scriptsToInject = this.takeAll();
if (scriptsToInject && this.router?.serverSsr) this.router.serverSsr.injectScript(scriptsToInject);
}
cleanup() {
this._cleanedUp = true;
this._queue = [];
this.router = void 0;
}
};
const isProd = process.env.NODE_ENV === "production";
const MANIFEST_CACHE_SIZE = 100;
const manifestCaches = /* @__PURE__ */ new WeakMap();
const inlineCssCaches = /* @__PURE__ */ new WeakMap();
function getManifestCache(manifest) {
const cache = manifestCaches.get(manifest);
if (cache) return cache;
const newCache = createLRUCache(MANIFEST_CACHE_SIZE);
manifestCaches.set(manifest, newCache);
return newCache;
}
function getInlineCssCache(manifest) {
const cache = inlineCssCaches.get(manifest);
if (cache) return cache;
const newCache = createLRUCache(MANIFEST_CACHE_SIZE);
inlineCssCaches.set(manifest, newCache);
return newCache;
}
function getInlineCssHrefsForMatches(manifest, matches) {
const styles = manifest?.inlineCss?.styles;
if (!styles) return [];
const seen = /* @__PURE__ */ new Set();
const hrefs = [];
for (const match of matches) {
const assets = manifest?.routes[match.routeId]?.assets ?? [];
for (const asset of assets) {
const href = getStylesheetHref(asset);
if (!href || seen.has(href) || styles[href] === void 0) continue;
seen.add(href);
hrefs.push(href);
}
}
return hrefs;
}
function getInlineCssForHrefs(manifest, hrefs) {
const styles = manifest.inlineCss?.styles;
if (!styles || hrefs.length === 0) return void 0;
const cacheKey = hrefs.join("\0");
if (isProd) {
const cached = getInlineCssCache(manifest).get(cacheKey);
if (cached !== void 0) return cached;
}
const css = hrefs.map((href) => styles[href]).join("");
if (isProd) getInlineCssCache(manifest).set(cacheKey, css);
return css;
}
function getInlineCssAssetForMatches(manifest, matches) {
if (!manifest?.inlineCss) return void 0;
const css = getInlineCssForHrefs(manifest, getInlineCssHrefsForMatches(manifest, matches));
return css === void 0 ? void 0 : createInlineCssStyleAsset(css);
}
function stripInlinedStylesheetAssets(manifest, routes, matches) {
if (!manifest.inlineCss) return routes;
const nextRoutes = {};
for (const [routeId, route] of Object.entries(routes)) {
const assets = route.assets?.filter((asset) => !isInlinableStylesheet(manifest, asset));
const nextRoute = { ...route };
if (assets) if (assets.length > 0) nextRoute.assets = assets;
else delete nextRoute.assets;
nextRoutes[routeId] = nextRoute;
}
if (getInlineCssAssetForMatches(manifest, matches)) {
const rootRoute = nextRoutes["__root__"] ?? {};
nextRoutes[rootRouteId] = {
...rootRoute,
assets: [createInlineCssPlaceholderAsset(), ...rootRoute.assets ?? []]
};
}
return nextRoutes;
}
function attachRouterServerSsrUtils({ router, manifest, getRequestAssets, includeUnmatchedRouteAssets = true }) {
router.ssr = { get manifest() {
const requestAssets = getRequestAssets?.();
const inlineCssAsset = getInlineCssAssetForMatches(manifest, router.stores.matches.get());
if (!requestAssets?.length && !inlineCssAsset) return manifest;
return {
...manifest,
routes: {
...manifest?.routes,
[rootRouteId]: {
...manifest?.routes?.[rootRouteId],
assets: [
...requestAssets ?? [],
...inlineCssAsset ? [inlineCssAsset] : [],
...manifest?.routes?.["__root__"]?.assets ?? []
]
}
}
};
} };
let _dehydrated = false;
let _serializationFinished = false;
const renderFinishedListeners = [];
const serializationFinishedListeners = [];
const scriptBuffer = new ScriptBuffer(router);
let injectedHtmlBuffer = "";
router.serverSsr = {
injectHtml: (html) => {
if (!html) return;
injectedHtmlBuffer += html;
router.emit({ type: "onInjectedHtml" });
},
injectScript: (script) => {
if (!script) return;
const html = `<script${router.options.ssr?.nonce ? ` nonce='${router.options.ssr.nonce}'` : ""}>${script}<\/script>`;
router.serverSsr.injectHtml(html);
},
dehydrate: async (opts) => {
if (_dehydrated) {
if (process.env.NODE_ENV !== "production") throw new Error("Invariant failed: router is already dehydrated!");
invariant();
}
let matchesToDehydrate = router.stores.matches.get();
if (router.isShell()) matchesToDehydrate = matchesToDehydrate.slice(0, 1);
const matches = matchesToDehydrate.map(dehydrateMatch);
let manifestToDehydrate = void 0;
if (manifest) {
const currentRouteIdsList = matchesToDehydrate.map((m) => m.routeId);
const manifestCacheKey = `${currentRouteIdsList.join("\0")}\0includeUnmatchedRouteAssets=${includeUnmatchedRouteAssets}`;
let filteredRoutes;
if (isProd) filteredRoutes = getManifestCache(manifest).get(manifestCacheKey);
if (!filteredRoutes) {
const currentRouteIds = new Set(currentRouteIdsList);
const nextFilteredRoutes = {};
for (const routeId in manifest.routes) {
const routeManifest = manifest.routes[routeId];
if (currentRouteIds.has(routeId)) nextFilteredRoutes[routeId] = routeManifest;
else if (includeUnmatchedRouteAssets && routeManifest.assets && routeManifest.assets.length > 0) nextFilteredRoutes[routeId] = { assets: routeManifest.assets };
}
filteredRoutes = stripInlinedStylesheetAssets(manifest, nextFilteredRoutes, matchesToDehydrate);
if (isProd) getManifestCache(manifest).set(manifestCacheKey, filteredRoutes);
}
manifestToDehydrate = { routes: { ...filteredRoutes } };
if (opts?.requestAssets?.length) {
const existingRoot = manifestToDehydrate.routes[rootRouteId];
manifestToDehydrate.routes[rootRouteId] = {
...existingRoot,
assets: [...opts.requestAssets, ...existingRoot?.assets ?? []]
};
}
}
const dehydratedRouter = {
manifest: manifestToDehydrate,
matches
};
const lastMatchId = matchesToDehydrate[matchesToDehydrate.length - 1]?.id;
if (lastMatchId) dehydratedRouter.lastMatchId = dehydrateSsrMatchId(lastMatchId);
const dehydratedData = await router.options.dehydrate?.();
if (dehydratedData) dehydratedRouter.dehydratedData = dehydratedData;
_dehydrated = true;
const trackPlugins = { didRun: false };
const serializationAdapters = router.options.serializationAdapters;
const plugins = serializationAdapters ? serializationAdapters.map((t) => /* @__PURE__ */ makeSsrSerovalPlugin(t, trackPlugins)).concat(defaultSerovalPlugins) : defaultSerovalPlugins;
const signalSerializationComplete = () => {
_serializationFinished = true;
try {
serializationFinishedListeners.forEach((l) => l());
router.emit({ type: "onSerializationFinished" });
} catch (err) {
console.error("Serialization listener error:", err);
} finally {
serializationFinishedListeners.length = 0;
renderFinishedListeners.length = 0;
}
};
crossSerializeStream(dehydratedRouter, {
refs: /* @__PURE__ */ new Map(),
plugins,
onSerialize: (data, initial) => {
let serialized = initial ? TSR_PREFIX + data : data;
if (trackPlugins.didRun) serialized = P_PREFIX + serialized + P_SUFFIX;
scriptBuffer.enqueue(serialized);
},
onError: (err) => {
console.error("Serialization error:", err);
if (err && err.stack) console.error(err.stack);
signalSerializationComplete();
},
scopeId: SCOPE_ID,
onDone: () => {
scriptBuffer.enqueue(GLOBAL_TSR + ".e()");
scriptBuffer.flush();
signalSerializationComplete();
}
});
},
isDehydrated() {
return _dehydrated;
},
isSerializationFinished() {
return _serializationFinished;
},
onRenderFinished: (listener) => renderFinishedListeners.push(listener),
onSerializationFinished: (listener) => serializationFinishedListeners.push(listener),
setRenderFinished: () => {
try {
renderFinishedListeners.forEach((l) => l());
} catch (err) {
console.error("Error in render finished listener:", err);
} finally {
renderFinishedListeners.length = 0;
}
scriptBuffer.liftBarrier();
},
takeBufferedScripts() {
const scripts = scriptBuffer.takeAll();
return {
tag: "script",
attrs: {
nonce: router.options.ssr?.nonce,
className: "$tsr",
id: TSR_SCRIPT_BARRIER_ID
},
children: scripts
};
},
liftScriptBarrier() {
scriptBuffer.liftBarrier();
},
takeBufferedHtml() {
if (!injectedHtmlBuffer) return;
const buffered = injectedHtmlBuffer;
injectedHtmlBuffer = "";
return buffered;
},
cleanup() {
if (!router.serverSsr) return;
renderFinishedListeners.length = 0;
serializationFinishedListeners.length = 0;
injectedHtmlBuffer = "";
scriptBuffer.cleanup();
router.serverSsr = void 0;
}
};
}
/**
* Get the origin for the request.
*
* SECURITY: We intentionally do NOT trust the Origin header for determining
* the router's origin. The Origin header can be spoofed by attackers, which
* could lead to SSRF-like vulnerabilities where redirects are constructed
* using a malicious origin (CVE-2024-34351).
*
* Instead, we derive the origin from request.url, which is typically set by
* the server infrastructure (not client-controlled headers).
*
* For applications behind proxies that need to trust forwarded headers,
* use the router's `origin` option to explicitly configure a trusted origin.
*/
function getOrigin(request) {
try {
return new URL(request.url).origin;
} catch {}
return "http://localhost";
}
function getNormalizedURL(url, base) {
if (typeof url === "string") url = url.replace("\\", "%5C");
const rawUrl = new URL(url, base);
const { path: decodedPathname, handledProtocolRelativeURL } = decodePath(rawUrl.pathname);
const searchParams = new URLSearchParams(rawUrl.search);
const normalizedHref = decodedPathname + (searchParams.size > 0 ? "?" : "") + searchParams.toString() + rawUrl.hash;
return {
url: new URL(normalizedHref, rawUrl.origin),
handledProtocolRelativeURL
};
}
//#endregion
export { attachRouterServerSsrUtils, getNormalizedURL, getOrigin };
//# sourceMappingURL=ssr-server.js.map
@@ -0,0 +1,15 @@
"use strict";
// THIS CODE WAS AUTOMATICALLY GENERATED
// DO NOT EDIT THIS CODE BY HAND
// RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE:
// npx nx generate-lib repo
Object.defineProperty(exports, "__esModule", { value: true });
exports.esnext_typedarrays = void 0;
const base_config_1 = require("./base-config");
exports.esnext_typedarrays = {
libs: [],
variables: [
['Uint8Array', base_config_1.TYPE],
['Uint8ArrayConstructor', base_config_1.TYPE],
],
};
@@ -0,0 +1,71 @@
import { int } from '../int.mjs';
import { alpha } from '../numbers/index.mjs';
import { px } from '../numbers/units.mjs';
import { transformValueTypes } from './transform.mjs';
const numberValueTypes = {
// Border props
borderWidth: px,
borderTopWidth: px,
borderRightWidth: px,
borderBottomWidth: px,
borderLeftWidth: px,
borderRadius: px,
borderTopLeftRadius: px,
borderTopRightRadius: px,
borderBottomRightRadius: px,
borderBottomLeftRadius: px,
// Positioning props
width: px,
maxWidth: px,
height: px,
maxHeight: px,
top: px,
right: px,
bottom: px,
left: px,
inset: px,
insetBlock: px,
insetBlockStart: px,
insetBlockEnd: px,
insetInline: px,
insetInlineStart: px,
insetInlineEnd: px,
// Spacing props
padding: px,
paddingTop: px,
paddingRight: px,
paddingBottom: px,
paddingLeft: px,
paddingBlock: px,
paddingBlockStart: px,
paddingBlockEnd: px,
paddingInline: px,
paddingInlineStart: px,
paddingInlineEnd: px,
margin: px,
marginTop: px,
marginRight: px,
marginBottom: px,
marginLeft: px,
marginBlock: px,
marginBlockStart: px,
marginBlockEnd: px,
marginInline: px,
marginInlineStart: px,
marginInlineEnd: px,
// Typography
fontSize: px,
// Misc
backgroundPositionX: px,
backgroundPositionY: px,
...transformValueTypes,
zIndex: int,
// SVG
fillOpacity: alpha,
strokeOpacity: alpha,
numOctaves: int,
};
export { numberValueTypes };
//# sourceMappingURL=number.mjs.map
@@ -0,0 +1,167 @@
"use strict";
var _a;
Object.defineProperty(exports, "__esModule", { value: true });
exports.globalConfig = exports.$ZodEncodeError = exports.$ZodAsyncError = exports.$brand = exports.NEVER = void 0;
exports.$constructor = $constructor;
exports.config = config;
const util_js_1 = require("./util.cjs");
/** A special constant with type `never` */
exports.NEVER = Object.freeze({
status: "aborted",
});
/* Shared descriptor for installing `_zod`; defineProperty reads it
* synchronously, so reusing one object avoids a per-instance allocation. */
const _zodDesc = { value: undefined, enumerable: false };
// null where suppressing the capture would be unrecoverable: `parse()` puts the frames back with `captureStackTrace`, so without it the throw would lose its stack. also latched to null once `stackTraceLimit` proves unassignable, which a realm can do at any point by hardening Error
let _E = "captureStackTrace" in Error ? Error : null;
// v8 captures a stack trace inside the Error constructor, which dominates a failed parse; costs only the frames, and parse() restores those. the constructor must RUN: Object.create is cheaper and passes instanceof, but Error.isError and util.types.isNativeError check an internal slot
function newError(Definition) {
const E = _E;
if (E) {
const saved = E.stackTraceLimit;
if (typeof saved === "number") {
try {
E.stackTraceLimit = 0;
}
catch {
_E = null;
return new Definition();
}
try {
return new Definition();
}
finally {
E.stackTraceLimit = saved;
}
}
}
return new Definition();
}
function $constructor(name, initializer,
/** This trait's members, installed once on every prototype that composes it. They cannot be declared in the initializer above: that runs per instance, and the prototype is shared. */
proto, params) {
// Prototype for this constructor's `_zod` internals. Lazily-derived fields (`values`, `pattern`, `optin`, …) install here once rather than as an accessor on every instance.
const zodProto = {};
// Assigning the fields in the constructor body is what gives instances in-object slots; building the object literally and reparenting it costs a second allocation and a generic property copy.
function Internals(def) {
this.def = def;
this.constr = _;
this.traits = new Set();
}
Internals.prototype = zodProto;
const protoMembers = proto;
// One trait's members land on every prototype whose chain composes it, so the answer is per prototype rather than per trait.
const initialized = protoMembers && new WeakSet();
function init(inst, def) {
if (!inst._zod) {
_zodDesc.value = new Internals(def);
try {
Object.defineProperty(inst, "_zod", _zodDesc);
}
finally {
// Cleared even on throw, so the shared descriptor never leaks one instance's internals into the next.
_zodDesc.value = undefined;
}
}
else if (inst._zod.traits.has(name)) {
return;
}
inst._zod.traits.add(name);
initializer(inst, def);
if (initialized) {
// `super(def)` from a user subclass gives `this` a prototype the subclass owns, and installing there would overwrite whatever the subclass declared. `constr` built the instance, so its prototype is the one below the subclass's that should carry the members. A receiver whose chain never reaches that prototype installs on its own, which for a plain object handed straight to `init` means `Object.prototype` — unchanged from before.
const own = Object.getPrototypeOf(inst);
const ctorProto = inst._zod.constr.prototype;
let up = own;
while (up && up !== ctorProto)
up = Object.getPrototypeOf(up);
const target = up ?? own;
if (!initialized.has(target)) {
initialized.add(target);
(0, util_js_1.members)(target, protoMembers);
}
}
// support prototype modifications; for-in avoids the array allocation of Object.keys on the (usually empty) prototype
const proto = _.prototype;
for (const k in proto) {
if (!Object.prototype.hasOwnProperty.call(proto, k))
continue;
if (!(k in inst)) {
inst[k] = proto[k].bind(inst);
}
}
}
// doesn't work if Parent has a constructor with arguments
const Parent = params?.Parent ?? Object;
class Definition extends Parent {
}
Object.defineProperty(Definition, "name", { value: name });
function _(def) {
const inst = params?.Parent ? newError(Definition) : this;
init(inst, def);
const deferred = inst._zod.deferred;
if (deferred) {
for (const fn of deferred) {
fn();
}
// Released: initializers run once, and the list would otherwise be retained for the schema's lifetime.
inst._zod.deferred = undefined;
}
// Global post-processor hook. Internal: installed by `import "zod/compile"` to enable AOT compilation for every constructed schema. Runs last, once the instance is fully built, because it hands the instance to compile(). The post-processor is expected to be reentrancy-guarded by its own implementation.
const pp = globalThis.__zod_globalConfig?.postProcessor;
if (pp)
pp(inst);
return inst;
}
Object.defineProperty(_, "init", { value: init });
Object.defineProperty(_, Symbol.hasInstance, {
value: (inst) => {
if (params?.Parent && inst instanceof params.Parent)
return true;
return inst?._zod?.traits?.has(name);
},
});
Object.defineProperty(_, "name", { value: name });
return _;
}
////////////////////////////// UTILITIES ///////////////////////////////////////
exports.$brand = Symbol("zod_brand");
class $ZodAsyncError extends Error {
constructor() {
super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`);
}
}
exports.$ZodAsyncError = $ZodAsyncError;
class $ZodEncodeError extends Error {
constructor(name) {
super(`Encountered unidirectional transform during encode: ${name}`);
this.name = "ZodEncodeError";
}
}
exports.$ZodEncodeError = $ZodEncodeError;
(_a = globalThis).__zod_globalConfig ?? (_a.__zod_globalConfig = {});
exports.globalConfig = globalThis.__zod_globalConfig;
function config(newConfig) {
if (newConfig)
Object.assign(exports.globalConfig, newConfig);
return exports.globalConfig;
}
// seal-cjs-exports
(function () {
var keys = Object.getOwnPropertyNames(exports);
for (var i = 0; i < keys.length; i++) {
var desc = Object.getOwnPropertyDescriptor(exports, keys[i]);
if (!desc || !desc.get || !desc.configurable) continue;
var value;
try {
value = desc.get();
} catch (e) {
continue;
}
// a circular require may not have settled this one yet, so leave it live
if (value === undefined) continue;
Object.defineProperty(exports, keys[i], { value: value, writable: false, enumerable: desc.enumerable, configurable: false });
}
Object.freeze(exports);
})();
@@ -0,0 +1,17 @@
/**
* @license lucide-react v0.469.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/
import createLucideIcon from '../createLucideIcon.js';
const PanelTopOpen = createLucideIcon("PanelTopOpen", [
["rect", { width: "18", height: "18", x: "3", y: "3", rx: "2", key: "afitv7" }],
["path", { d: "M3 9h18", key: "1pudct" }],
["path", { d: "m15 14-3 3-3-3", key: "g215vf" }]
]);
export { PanelTopOpen as default };
//# sourceMappingURL=panel-top-open.js.map
@@ -0,0 +1,177 @@
const rxParseJson = /position\s(\d+)(?: \(line \d+ column \d+\))?$/
export function parseJson(s: string, pos: number): unknown {
let endPos: number | undefined
parseJson.message = undefined
let matches: RegExpExecArray | null
if (pos) s = s.slice(pos)
try {
parseJson.position = pos + s.length
return JSON.parse(s)
} catch (e) {
matches = rxParseJson.exec((e as Error).message)
if (!matches) {
parseJson.message = "unexpected end"
return undefined
}
endPos = +matches[1]
const c = s[endPos]
s = s.slice(0, endPos)
parseJson.position = pos + endPos
try {
return JSON.parse(s)
} catch (e1) {
parseJson.message = `unexpected token ${c}`
return undefined
}
}
}
parseJson.message = undefined as string | undefined
parseJson.position = 0 as number
parseJson.code = 'require("ajv/dist/runtime/parseJson").parseJson'
export function parseJsonNumber(s: string, pos: number, maxDigits?: number): number | undefined {
let numStr = ""
let c: string
parseJsonNumber.message = undefined
if (s[pos] === "-") {
numStr += "-"
pos++
}
if (s[pos] === "0") {
numStr += "0"
pos++
} else {
if (!parseDigits(maxDigits)) {
errorMessage()
return undefined
}
}
if (maxDigits) {
parseJsonNumber.position = pos
return +numStr
}
if (s[pos] === ".") {
numStr += "."
pos++
if (!parseDigits()) {
errorMessage()
return undefined
}
}
if (((c = s[pos]), c === "e" || c === "E")) {
numStr += "e"
pos++
if (((c = s[pos]), c === "+" || c === "-")) {
numStr += c
pos++
}
if (!parseDigits()) {
errorMessage()
return undefined
}
}
parseJsonNumber.position = pos
return +numStr
function parseDigits(maxLen?: number): boolean {
let digit = false
while (((c = s[pos]), c >= "0" && c <= "9" && (maxLen === undefined || maxLen-- > 0))) {
digit = true
numStr += c
pos++
}
return digit
}
function errorMessage(): void {
parseJsonNumber.position = pos
parseJsonNumber.message = pos < s.length ? `unexpected token ${s[pos]}` : "unexpected end"
}
}
parseJsonNumber.message = undefined as string | undefined
parseJsonNumber.position = 0 as number
parseJsonNumber.code = 'require("ajv/dist/runtime/parseJson").parseJsonNumber'
const escapedChars: {[X in string]?: string} = {
b: "\b",
f: "\f",
n: "\n",
r: "\r",
t: "\t",
'"': '"',
"/": "/",
"\\": "\\",
}
const CODE_A: number = "a".charCodeAt(0)
const CODE_0: number = "0".charCodeAt(0)
export function parseJsonString(s: string, pos: number): string | undefined {
let str = ""
let c: string | undefined
parseJsonString.message = undefined
// eslint-disable-next-line no-constant-condition, @typescript-eslint/no-unnecessary-condition
while (true) {
c = s[pos++]
if (c === '"') break
if (c === "\\") {
c = s[pos]
if (c in escapedChars) {
str += escapedChars[c]
pos++
} else if (c === "u") {
pos++
let count = 4
let code = 0
while (count--) {
code <<= 4
c = s[pos]
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
if (c === undefined) {
errorMessage("unexpected end")
return undefined
}
c = c.toLowerCase()
if (c >= "a" && c <= "f") {
code += c.charCodeAt(0) - CODE_A + 10
} else if (c >= "0" && c <= "9") {
code += c.charCodeAt(0) - CODE_0
} else {
errorMessage(`unexpected token ${c}`)
return undefined
}
pos++
}
str += String.fromCharCode(code)
} else {
errorMessage(`unexpected token ${c}`)
return undefined
}
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
} else if (c === undefined) {
errorMessage("unexpected end")
return undefined
} else {
if (c.charCodeAt(0) >= 0x20) {
str += c
} else {
errorMessage(`unexpected token ${c}`)
return undefined
}
}
}
parseJsonString.position = pos
return str
function errorMessage(msg: string): void {
parseJsonString.position = pos
parseJsonString.message = msg
}
}
parseJsonString.message = undefined as string | undefined
parseJsonString.position = 0 as number
parseJsonString.code = 'require("ajv/dist/runtime/parseJson").parseJsonString'
@@ -0,0 +1,421 @@
export default `flf2a$ 4 3 14 63 11 0 24511 0
Author :
Date : 2001/8/8 16:32:39
Version: 1.0
-------------------------------------------------
-------------------------------------------------
This font has been created using Jave's FIGlet font export assistant.
Have a look at: http://www.jave.de
Permission is hereby given to modify this font, as long as the
modifier's name is placed on a comment line.
$#
$#
$#
$##
#
#
#
##
#
#
#
##
#
#
#
##
#
#
#
##
#
#
#
##
#
#
#
##
#
#
#
##
#
#
#
##
#
#
#
##
#
#
#
##
#
#
#
##
#
#
#
##
#
#
#
##
#
#
#
##
#
#
#
##
#
#
#
##
#
#
#
##
#
#
#
##
#
#
#
##
#
#
#
##
#
#
#
##
#
#
#
##
#
#
#
##
#
#
#
##
#
#
#
##
#
#
#
##
#
#
#
##
#
#
#
##
#
#
#
##
#
#
#
##
#
#
#
##
#
#
#
##
_______ #
/ O \\ #
/___/%\\___\\#
\`BB' \`BB'##
_________ #
| o )#
|_____O___)#
\`BBBBBBB' ##
__________#
/ /_____/#
\\___\\%%%%%'#
\`BBBBBBBB'##
_________ #
| O \\#
|_________/#
\`BBBBBBB' ##
__________#
/ /_____/#
\\___\\%%%%%'#
\`BBBBBBBB'##
__________#
/ /_____/#
\\___\\%%%%%'#
\`BB' ##
__________#
/ /_____/#
\\___\\%%%%.]#
\`BBBBBBBB'##
____ ____ #
/ /_\\ \\#
\\___\\%/___/#
\`BB' \`BB' ##
_________#
\\__/ \\__/#
_\`%\\_/%'_#
\`BBBBBBB'##
___________#
\\____/ \\__/#
_\`%%%\\_/%' #
\`BBBBB' ##
___ _____#
| |/____/#
|___|\\____\\#
\`BBB' \`BBB'##
____ #
/ /_____ #
\\___\\_____\\#
\`BBBBBBBB'##
___ ___ #
| \\ / |#
|____|____|#
\`BBBBBBB' ##
___ __ #
| \\ | |#
|____\\_|__|#
\`BBBBBBB' ##
_________ #
/ O \\#
\\_________/#
\`BBBBBBB' ##
_________ #
| _o___)#
|___|%%%%%'#
\`B' ##
_________ #
/ O___ \\#
\\_____\\ \\/#
\`BBBBB\\__\\##
_________ #
| _o___)#
|___|\\____\\#
\`BB' \`BBB'##
__________#
/_________/#
\`%%%%%%%%%/#
\`BBBBBBBB' ##
_________ #
/__ __\\#
\`%%|___|%%'#
\`B' ##
_____ _____#
\\ / \\ /#
/___\\_/___\\#
\`BBBBBBBBB'##
___ ___ #
/ \\ / \\#
\\___/_\\___/#
\`BBBBBBB' ##
_________ #
/ \\ / \\#
\\____|____/#
\`BBBBBBB' ##
____ ____#
\\ \\_/ /#
/___/%\\___\\#
\`BB' \`BB'##
____ ____#
\\___\\_/___/#
%%%/_\\%%% #
\`B' ##
___________#
\\_________/#
.%%%%%%%%%%#
\`BBBBBBBB'##
#
#
#
##
#
#
#
##
#
#
#
##
#
#
#
##
#
#
#
##
#
#
#
##
_______ #
/ O \\ #
/___/%\\___\\#
\`BB' \`BB'##
_________ #
| o )#
|_____O___)#
\`BBBBBBB' ##
__________#
/ /_____/#
\\___\\%%%%%'#
\`BBBBBBBB'##
_________ #
| O \\#
|_________/#
\`BBBBBBB' ##
__________#
/ /_____/#
\\___\\%%%%%'#
\`BBBBBBBB'##
__________#
/ /_____/#
\\___\\%%%%%'#
\`BB' ##
__________#
/ /_____/#
\\___\\%%%%.]#
\`BBBBBBBB'##
____ ____ #
/ /_\\ \\#
\\___\\%/___/#
\`BB' \`BB' ##
_________#
\\__/ \\__/#
_\`%\\_/%'_#
\`BBBBBBB'##
___________#
\\____/ \\__/#
_\`%%%\\_/%' #
\`BBBBB' ##
___ _____#
| |/____/#
|___|\\____\\#
\`BBB' \`BBB'##
____ #
/ /_____ #
\\___\\_____\\#
\`BBBBBBBB'##
___ ___ #
| \\ / |#
|____|____|#
\`BBBBBBB' ##
___ __ #
| \\ | |#
|____\\_|__|#
\`BBBBBBB' ##
_________ #
/ O \\#
\\_________/#
\`BBBBBBB' ##
_________ #
| _o___)#
|___|%%%%%'#
\`B' ##
_________ #
/ O___ \\#
\\_____\\ \\/#
\`BBBBB\\__\\##
_________ #
| _o___)#
|___|\\____\\#
\`BB' \`BBB'##
__________#
/_________/#
\`%%%%%%%%%/#
\`BBBBBBBB' ##
_________ #
/__ __\\#
\`%%|___|%%'#
\`B' ##
_____ _____#
\\ / \\ /#
/___\\_/___\\#
\`BBBBBBBBB'##
___ ___ #
/ \\ / \\#
\\___/_\\___/#
\`BBBBBBB' ##
_________ #
/ \\ / \\#
\\____|____/#
\`BBBBBBB' ##
____ ____#
\\ \\_/ /#
/___/%\\___\\#
\`BB' \`BB'##
____ ____#
\\___\\_/___/#
%%%/_\\%%% #
\`B' ##
___________#
\\_________/#
.%%%%%%%%%%#
\`BBBBBBBB'##
#
#
#
##
#
#
#
##
#
#
#
##
#
#
#
##
_______ #
/ O \\ #
/___/%\\___\\#
\`BB' \`BB'##
_________ #
/ O \\#
\\_________/#
\`BBBBBBB' ##
_____ _____#
\\ / \\ /#
/___\\_/___\\#
\`BBBBBBBBB'##
_______ #
/ O \\ #
/___/%\\___\\#
\`BB' \`BB'##
_________ #
/ O \\#
\\_________/#
\`BBBBBBB' ##
_____ _____#
\\ / \\ /#
/___\\_/___\\#
\`BBBBBBBBB'##
#
#
#
##
`
@@ -0,0 +1,12 @@
import type { TSESLint } from '@typescript-eslint/utils';
import type { TypeOrValueSpecifier } from '../util';
type Options = [
{
allow?: TypeOrValueSpecifier[];
}
];
type MessageIds = 'addAwait' | 'noArraySpreadInObject' | 'noClassDeclarationSpreadInObject' | 'noClassInstanceSpreadInObject' | 'noFunctionSpreadInObject' | 'noIterableSpreadInObject' | 'noMapSpreadInObject' | 'noPromiseSpreadInObject' | 'noStringSpread' | 'replaceMapSpreadInObject';
declare const _default: TSESLint.RuleModule<MessageIds, Options, import("../../rules").ESLintPluginDocs, TSESLint.RuleListener> & {
name: string;
};
export default _default;
@@ -0,0 +1 @@
{"version":3,"file":"chevron-first.js","sources":["../../../src/icons/chevron-first.ts"],"sourcesContent":["import createLucideIcon from '../createLucideIcon';\n\n/**\n * @component @name ChevronFirst\n * @description Lucide SVG icon component, renders SVG Element with children.\n *\n * @preview ![img](data:image/svg+xml;base64,PHN2ZyAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogIHdpZHRoPSIyNCIKICBoZWlnaHQ9IjI0IgogIHZpZXdCb3g9IjAgMCAyNCAyNCIKICBmaWxsPSJub25lIgogIHN0cm9rZT0iIzAwMCIgc3R5bGU9ImJhY2tncm91bmQtY29sb3I6ICNmZmY7IGJvcmRlci1yYWRpdXM6IDJweCIKICBzdHJva2Utd2lkdGg9IjIiCiAgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIgogIHN0cm9rZS1saW5lam9pbj0icm91bmQiCj4KICA8cGF0aCBkPSJtMTcgMTgtNi02IDYtNiIgLz4KICA8cGF0aCBkPSJNNyA2djEyIiAvPgo8L3N2Zz4K) - https://lucide.dev/icons/chevron-first\n * @see https://lucide.dev/guide/packages/lucide-react - Documentation\n *\n * @param {Object} props - Lucide icons props and any valid SVG attribute\n * @returns {JSX.Element} JSX Element\n *\n */\nconst ChevronFirst = createLucideIcon('ChevronFirst', [\n ['path', { d: 'm17 18-6-6 6-6', key: '1yerx2' }],\n ['path', { d: 'M7 6v12', key: '1p53r6' }],\n]);\n\nexport default ChevronFirst;\n"],"names":[],"mappings":";;;;;;;;;AAaM,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAe,iBAAiB,cAAgB,CAAA,CAAA,CAAA;AAAA,CAAA,CACpD,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,CAAkB,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA,CAAA;AAAA,CAAA,CAC/C,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,CAAW,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA;AAC1C,CAAC,CAAA,CAAA;;"}
@@ -0,0 +1,21 @@
sudo: false
language: node_js
os:
- linux
- osx
- windows
arch: amd64
node_js:
- 14
- 13
- 12
- 11
- 10
script:
- npm test
- npm run test:coveralls
@@ -0,0 +1,424 @@
/**
* @fileoverview Rule to forbid or enforce dangling commas.
* @author Ian Christian Myers
* @deprecated in ESLint v8.53.0
*/
"use strict";
//------------------------------------------------------------------------------
// Requirements
//------------------------------------------------------------------------------
const astUtils = require("./utils/ast-utils");
//------------------------------------------------------------------------------
// Helpers
//------------------------------------------------------------------------------
const DEFAULT_OPTIONS = Object.freeze({
arrays: "never",
objects: "never",
imports: "never",
exports: "never",
functions: "never",
});
/**
* Checks whether or not a trailing comma is allowed in a given node.
* If the `lastItem` is `RestElement` or `RestProperty`, it disallows trailing commas.
* @param {ASTNode} lastItem The node of the last element in the given node.
* @returns {boolean} `true` if a trailing comma is allowed.
*/
function isTrailingCommaAllowed(lastItem) {
return !(
lastItem.type === "RestElement" ||
lastItem.type === "RestProperty" ||
lastItem.type === "ExperimentalRestProperty"
);
}
/**
* Normalize option value.
* @param {string|Object|undefined} optionValue The 1st option value to normalize.
* @param {number} ecmaVersion The normalized ECMAScript version.
* @returns {Object} The normalized option value.
*/
function normalizeOptions(optionValue, ecmaVersion) {
if (typeof optionValue === "string") {
return {
arrays: optionValue,
objects: optionValue,
imports: optionValue,
exports: optionValue,
functions: ecmaVersion < 2017 ? "ignore" : optionValue,
};
}
if (typeof optionValue === "object" && optionValue !== null) {
return {
arrays: optionValue.arrays || DEFAULT_OPTIONS.arrays,
objects: optionValue.objects || DEFAULT_OPTIONS.objects,
imports: optionValue.imports || DEFAULT_OPTIONS.imports,
exports: optionValue.exports || DEFAULT_OPTIONS.exports,
functions: optionValue.functions || DEFAULT_OPTIONS.functions,
};
}
return DEFAULT_OPTIONS;
}
//------------------------------------------------------------------------------
// Rule Definition
//------------------------------------------------------------------------------
/** @type {import('../types').Rule.RuleModule} */
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: "11.0.0",
replacedBy: [
{
message:
"ESLint Stylistic now maintains deprecated stylistic core rules.",
url: "https://eslint.style/guide/migration",
plugin: {
name: "@stylistic/eslint-plugin",
url: "https://eslint.style",
},
rule: {
name: "comma-dangle",
url: "https://eslint.style/rules/comma-dangle",
},
},
],
},
type: "layout",
docs: {
description: "Require or disallow trailing commas",
recommended: false,
url: "https://eslint.org/docs/latest/rules/comma-dangle",
},
fixable: "code",
schema: {
definitions: {
value: {
enum: [
"always-multiline",
"always",
"never",
"only-multiline",
],
},
valueWithIgnore: {
enum: [
"always-multiline",
"always",
"ignore",
"never",
"only-multiline",
],
},
},
type: "array",
items: [
{
oneOf: [
{
$ref: "#/definitions/value",
},
{
type: "object",
properties: {
arrays: {
$ref: "#/definitions/valueWithIgnore",
},
objects: {
$ref: "#/definitions/valueWithIgnore",
},
imports: {
$ref: "#/definitions/valueWithIgnore",
},
exports: {
$ref: "#/definitions/valueWithIgnore",
},
functions: {
$ref: "#/definitions/valueWithIgnore",
},
},
additionalProperties: false,
},
],
},
],
additionalItems: false,
},
messages: {
unexpected: "Unexpected trailing comma.",
missing: "Missing trailing comma.",
},
},
create(context) {
const options = normalizeOptions(
context.options[0],
context.languageOptions.ecmaVersion,
);
const sourceCode = context.sourceCode;
/**
* Gets the last item of the given node.
* @param {ASTNode} node The node to get.
* @returns {ASTNode|null} The last node or null.
*/
function getLastItem(node) {
/**
* Returns the last element of an array
* @param {any[]} array The input array
* @returns {any} The last element
*/
function last(array) {
return array.at(-1);
}
switch (node.type) {
case "ObjectExpression":
case "ObjectPattern":
return last(node.properties);
case "ArrayExpression":
case "ArrayPattern":
return last(node.elements);
case "ImportDeclaration":
case "ExportNamedDeclaration":
return last(node.specifiers);
case "FunctionDeclaration":
case "FunctionExpression":
case "ArrowFunctionExpression":
return last(node.params);
case "CallExpression":
case "NewExpression":
return last(node.arguments);
default:
return null;
}
}
/**
* Gets the trailing comma token of the given node.
* If the trailing comma does not exist, this returns the token which is
* the insertion point of the trailing comma token.
* @param {ASTNode} node The node to get.
* @param {ASTNode} lastItem The last item of the node.
* @returns {Token} The trailing comma token or the insertion point.
*/
function getTrailingToken(node, lastItem) {
switch (node.type) {
case "ObjectExpression":
case "ArrayExpression":
case "CallExpression":
case "NewExpression":
return sourceCode.getLastToken(node, 1);
default: {
const nextToken = sourceCode.getTokenAfter(lastItem);
if (astUtils.isCommaToken(nextToken)) {
return nextToken;
}
return sourceCode.getLastToken(lastItem);
}
}
}
/**
* Checks whether or not a given node is multiline.
* This rule handles a given node as multiline when the closing parenthesis
* and the last element are not on the same line.
* @param {ASTNode} node A node to check.
* @returns {boolean} `true` if the node is multiline.
*/
function isMultiline(node) {
const lastItem = getLastItem(node);
if (!lastItem) {
return false;
}
const penultimateToken = getTrailingToken(node, lastItem);
const lastToken = sourceCode.getTokenAfter(penultimateToken);
return lastToken.loc.end.line !== penultimateToken.loc.end.line;
}
/**
* Reports a trailing comma if it exists.
* @param {ASTNode} node A node to check. Its type is one of
* ObjectExpression, ObjectPattern, ArrayExpression, ArrayPattern,
* ImportDeclaration, and ExportNamedDeclaration.
* @returns {void}
*/
function forbidTrailingComma(node) {
const lastItem = getLastItem(node);
if (
!lastItem ||
(node.type === "ImportDeclaration" &&
lastItem.type !== "ImportSpecifier")
) {
return;
}
const trailingToken = getTrailingToken(node, lastItem);
if (astUtils.isCommaToken(trailingToken)) {
context.report({
node: lastItem,
loc: trailingToken.loc,
messageId: "unexpected",
*fix(fixer) {
yield fixer.remove(trailingToken);
/*
* Extend the range of the fix to include surrounding tokens to ensure
* that the element after which the comma is removed stays _last_.
* This intentionally makes conflicts in fix ranges with rules that may be
* adding or removing elements in the same autofix pass.
* https://github.com/eslint/eslint/issues/15660
*/
yield fixer.insertTextBefore(
sourceCode.getTokenBefore(trailingToken),
"",
);
yield fixer.insertTextAfter(
sourceCode.getTokenAfter(trailingToken),
"",
);
},
});
}
}
/**
* Reports the last element of a given node if it does not have a trailing
* comma.
*
* If a given node is `ArrayPattern` which has `RestElement`, the trailing
* comma is disallowed, so report if it exists.
* @param {ASTNode} node A node to check. Its type is one of
* ObjectExpression, ObjectPattern, ArrayExpression, ArrayPattern,
* ImportDeclaration, and ExportNamedDeclaration.
* @returns {void}
*/
function forceTrailingComma(node) {
const lastItem = getLastItem(node);
if (
!lastItem ||
(node.type === "ImportDeclaration" &&
lastItem.type !== "ImportSpecifier")
) {
return;
}
if (!isTrailingCommaAllowed(lastItem)) {
forbidTrailingComma(node);
return;
}
const trailingToken = getTrailingToken(node, lastItem);
if (trailingToken.value !== ",") {
context.report({
node: lastItem,
loc: {
start: trailingToken.loc.end,
end: astUtils.getNextLocation(
sourceCode,
trailingToken.loc.end,
),
},
messageId: "missing",
*fix(fixer) {
yield fixer.insertTextAfter(trailingToken, ",");
/*
* Extend the range of the fix to include surrounding tokens to ensure
* that the element after which the comma is inserted stays _last_.
* This intentionally makes conflicts in fix ranges with rules that may be
* adding or removing elements in the same autofix pass.
* https://github.com/eslint/eslint/issues/15660
*/
yield fixer.insertTextBefore(trailingToken, "");
yield fixer.insertTextAfter(
sourceCode.getTokenAfter(trailingToken),
"",
);
},
});
}
}
/**
* If a given node is multiline, reports the last element of a given node
* when it does not have a trailing comma.
* Otherwise, reports a trailing comma if it exists.
* @param {ASTNode} node A node to check. Its type is one of
* ObjectExpression, ObjectPattern, ArrayExpression, ArrayPattern,
* ImportDeclaration, and ExportNamedDeclaration.
* @returns {void}
*/
function forceTrailingCommaIfMultiline(node) {
if (isMultiline(node)) {
forceTrailingComma(node);
} else {
forbidTrailingComma(node);
}
}
/**
* Only if a given node is not multiline, reports the last element of a given node
* when it does not have a trailing comma.
* Otherwise, reports a trailing comma if it exists.
* @param {ASTNode} node A node to check. Its type is one of
* ObjectExpression, ObjectPattern, ArrayExpression, ArrayPattern,
* ImportDeclaration, and ExportNamedDeclaration.
* @returns {void}
*/
function allowTrailingCommaIfMultiline(node) {
if (!isMultiline(node)) {
forbidTrailingComma(node);
}
}
const predicate = {
always: forceTrailingComma,
"always-multiline": forceTrailingCommaIfMultiline,
"only-multiline": allowTrailingCommaIfMultiline,
never: forbidTrailingComma,
ignore() {},
};
return {
ObjectExpression: predicate[options.objects],
ObjectPattern: predicate[options.objects],
ArrayExpression: predicate[options.arrays],
ArrayPattern: predicate[options.arrays],
ImportDeclaration: predicate[options.imports],
ExportNamedDeclaration: predicate[options.exports],
FunctionDeclaration: predicate[options.functions],
FunctionExpression: predicate[options.functions],
ArrowFunctionExpression: predicate[options.functions],
CallExpression: predicate[options.functions],
NewExpression: predicate[options.functions],
};
},
};
@@ -0,0 +1,21 @@
import type { TSESLint } from '@typescript-eslint/utils';
export type Options = [
{
checksConditionals?: boolean;
checksSpreads?: boolean;
checksVoidReturn?: boolean | ChecksVoidReturnOptions;
}
];
export interface ChecksVoidReturnOptions {
arguments?: boolean;
attributes?: boolean;
inheritedMethods?: boolean;
properties?: boolean;
returns?: boolean;
variables?: boolean;
}
export type MessageId = 'conditional' | 'predicate' | 'spread' | 'voidReturnArgument' | 'voidReturnAttribute' | 'voidReturnInheritedMethod' | 'voidReturnProperty' | 'voidReturnReturnValue' | 'voidReturnVariable';
declare const _default: TSESLint.RuleModule<MessageId, Options, import("../../rules").ESLintPluginDocs, TSESLint.RuleListener> & {
name: string;
};
export default _default;
@@ -0,0 +1,33 @@
//#region \0rolldown/runtime.js
var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __exportAll = (all, no_symbols) => {
let target = {};
for (var name in all) __defProp(target, name, {
get: all[name],
enumerable: true
});
if (!no_symbols) __defProp(target, Symbol.toStringTag, { value: "Module" });
return target;
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
key = keys[i];
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
get: ((k) => from[k]).bind(null, key),
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
});
}
return to;
};
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule || !__hasOwnProp.call(mod, "default") ? __defProp(target, "default", {
value: mod,
enumerable: true
}) : target, mod));
//#endregion
exports.__exportAll = __exportAll;
exports.__toESM = __toESM;
@@ -0,0 +1,12 @@
import type {CodeKeywordDefinition} from "../../types"
import {validateTuple} from "./items"
const def: CodeKeywordDefinition = {
keyword: "prefixItems",
type: "array",
schemaType: ["array"],
before: "uniqueItems",
code: (cxt) => validateTuple(cxt, "items"),
}
export default def
@@ -0,0 +1,18 @@
/**
* @license lucide-react v0.469.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/
import createLucideIcon from '../createLucideIcon.js';
const SquareMenu = createLucideIcon("SquareMenu", [
["rect", { width: "18", height: "18", x: "3", y: "3", rx: "2", key: "afitv7" }],
["path", { d: "M7 8h10", key: "1jw688" }],
["path", { d: "M7 12h10", key: "b7w52i" }],
["path", { d: "M7 16h10", key: "wp8him" }]
]);
export { SquareMenu as default };
//# sourceMappingURL=square-menu.js.map
@@ -0,0 +1,16 @@
/**
* @license lucide-react v0.469.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/
import createLucideIcon from '../createLucideIcon.js';
const SquareChevronLeft = createLucideIcon("SquareChevronLeft", [
["rect", { width: "18", height: "18", x: "3", y: "3", rx: "2", key: "afitv7" }],
["path", { d: "m14 16-4-4 4-4", key: "ojs7w8" }]
]);
export { SquareChevronLeft as default };
//# sourceMappingURL=square-chevron-left.js.map
@@ -0,0 +1,102 @@
/**
* @fileoverview Rule to flag use of unary increment and decrement operators.
* @author Ian Christian Myers
* @author Brody McKee (github.com/mrmckeb)
*/
"use strict";
//------------------------------------------------------------------------------
// Helpers
//------------------------------------------------------------------------------
/**
* Determines whether the given node is the update node of a `ForStatement`.
* @param {ASTNode} node The node to check.
* @returns {boolean} `true` if the node is `ForStatement` update.
*/
function isForStatementUpdate(node) {
const parent = node.parent;
return parent.type === "ForStatement" && parent.update === node;
}
/**
* Determines whether the given node is considered to be a for loop "afterthought" by the logic of this rule.
* In particular, it returns `true` if the given node is either:
* - The update node of a `ForStatement`: for (;; i++) {}
* - An operand of a sequence expression that is the update node: for (;; foo(), i++) {}
* - An operand of a sequence expression that is child of another sequence expression, etc.,
* up to the sequence expression that is the update node: for (;; foo(), (bar(), (baz(), i++))) {}
* @param {ASTNode} node The node to check.
* @returns {boolean} `true` if the node is a for loop afterthought.
*/
function isForLoopAfterthought(node) {
const parent = node.parent;
if (parent.type === "SequenceExpression") {
return isForLoopAfterthought(parent);
}
return isForStatementUpdate(node);
}
//------------------------------------------------------------------------------
// Rule Definition
//------------------------------------------------------------------------------
/** @type {import('../types').Rule.RuleModule} */
module.exports = {
meta: {
type: "suggestion",
defaultOptions: [
{
allowForLoopAfterthoughts: false,
},
],
docs: {
description: "Disallow the unary operators `++` and `--`",
recommended: false,
frozen: true,
url: "https://eslint.org/docs/latest/rules/no-plusplus",
},
schema: [
{
type: "object",
properties: {
allowForLoopAfterthoughts: {
type: "boolean",
},
},
additionalProperties: false,
},
],
messages: {
unexpectedUnaryOp: "Unary operator '{{operator}}' used.",
},
},
create(context) {
const [{ allowForLoopAfterthoughts }] = context.options;
return {
UpdateExpression(node) {
if (allowForLoopAfterthoughts && isForLoopAfterthought(node)) {
return;
}
context.report({
node,
messageId: "unexpectedUnaryOp",
data: {
operator: node.operator,
},
});
},
};
},
};
@@ -0,0 +1,60 @@
/*!
* encodeurl
* Copyright(c) 2016 Douglas Christopher Wilson
* MIT Licensed
*/
'use strict'
/**
* Module exports.
* @public
*/
module.exports = encodeUrl
/**
* RegExp to match non-URL code points, *after* encoding (i.e. not including "%")
* and including invalid escape sequences.
* @private
*/
var ENCODE_CHARS_REGEXP = /(?:[^\x21\x23-\x3B\x3D\x3F-\x5F\x61-\x7A\x7C\x7E]|%(?:[^0-9A-Fa-f]|[0-9A-Fa-f][^0-9A-Fa-f]|$))+/g
/**
* RegExp to match unmatched surrogate pair.
* @private
*/
var UNMATCHED_SURROGATE_PAIR_REGEXP = /(^|[^\uD800-\uDBFF])[\uDC00-\uDFFF]|[\uD800-\uDBFF]([^\uDC00-\uDFFF]|$)/g
/**
* String to replace unmatched surrogate pair with.
* @private
*/
var UNMATCHED_SURROGATE_PAIR_REPLACE = '$1\uFFFD$2'
/**
* Encode a URL to a percent-encoded form, excluding already-encoded sequences.
*
* This function will take an already-encoded URL and encode all the non-URL
* code points. This function will not encode the "%" character unless it is
* not part of a valid sequence (`%20` will be left as-is, but `%foo` will
* be encoded as `%25foo`).
*
* This encode is meant to be "safe" and does not throw errors. It will try as
* hard as it can to properly encode the given URL, including replacing any raw,
* unpaired surrogate pairs with the Unicode replacement character prior to
* encoding.
*
* @param {string} url
* @return {string}
* @public
*/
function encodeUrl (url) {
return String(url)
.replace(UNMATCHED_SURROGATE_PAIR_REGEXP, UNMATCHED_SURROGATE_PAIR_REPLACE)
.replace(ENCODE_CHARS_REGEXP, encodeURI)
}
@@ -0,0 +1,26 @@
Minizlib was created by Isaac Z. Schlueter.
It is a derivative work of the Node.js project.
"""
Copyright (c) 2017-2023 Isaac Z. Schlueter and Contributors
Copyright (c) 2017-2023 Node.js contributors. All rights reserved.
Copyright (c) 2017-2023 Joyent, Inc. and other Node contributors. All rights reserved.
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 @@
{"version":3,"file":"arrow-left-to-line.js","sources":["../../../src/icons/arrow-left-to-line.ts"],"sourcesContent":["import createLucideIcon from '../createLucideIcon';\n\n/**\n * @component @name ArrowLeftToLine\n * @description Lucide SVG icon component, renders SVG Element with children.\n *\n * @preview ![img](data:image/svg+xml;base64,PHN2ZyAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogIHdpZHRoPSIyNCIKICBoZWlnaHQ9IjI0IgogIHZpZXdCb3g9IjAgMCAyNCAyNCIKICBmaWxsPSJub25lIgogIHN0cm9rZT0iIzAwMCIgc3R5bGU9ImJhY2tncm91bmQtY29sb3I6ICNmZmY7IGJvcmRlci1yYWRpdXM6IDJweCIKICBzdHJva2Utd2lkdGg9IjIiCiAgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIgogIHN0cm9rZS1saW5lam9pbj0icm91bmQiCj4KICA8cGF0aCBkPSJNMyAxOVY1IiAvPgogIDxwYXRoIGQ9Im0xMyA2LTYgNiA2IDYiIC8+CiAgPHBhdGggZD0iTTcgMTJoMTQiIC8+Cjwvc3ZnPgo=) - https://lucide.dev/icons/arrow-left-to-line\n * @see https://lucide.dev/guide/packages/lucide-react - Documentation\n *\n * @param {Object} props - Lucide icons props and any valid SVG attribute\n * @returns {JSX.Element} JSX Element\n *\n */\nconst ArrowLeftToLine = createLucideIcon('ArrowLeftToLine', [\n ['path', { d: 'M3 19V5', key: 'rwsyhb' }],\n ['path', { d: 'm13 6-6 6 6 6', key: '1yhaz7' }],\n ['path', { d: 'M7 12h14', key: 'uoisry' }],\n]);\n\nexport default ArrowLeftToLine;\n"],"names":[],"mappings":";;;;;;;;;AAaM,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAkB,iBAAiB,iBAAmB,CAAA,CAAA,CAAA;AAAA,CAAA,CAC1D,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,CAAW,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA,CAAA;AAAA,CAAA,CACxC,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,CAAiB,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA,CAAA;AAAA,CAAA,CAC9C,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,CAAY,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA;AAC3C,CAAC,CAAA,CAAA;;"}
@@ -0,0 +1 @@
{"version":3,"file":"querying.js","sourceRoot":"https://raw.githubusercontent.com/fb55/domutils/0ab8bcf1ecfc70dfc93291a4cb2496578ac25e9c/src/","sources":["querying.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,WAAW,EAAgC,MAAM,YAAY,CAAC;AAE9E;;;;;;;;;GASG;AACH,MAAM,UAAU,MAAM,CAClB,IAAgC,EAChC,IAAyB,EACzB,OAAO,GAAG,IAAI,EACd,QAAgB,QAAQ;IAExB,OAAO,IAAI,CAAC,IAAI,EAAE,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC;AAC3E,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,UAAU,IAAI,CAChB,IAAgC,EAChC,KAA6B,EAC7B,OAAgB,EAChB,KAAa;IAEb,MAAM,MAAM,GAAc,EAAE,CAAC;IAC7B,6CAA6C;IAC7C,MAAM,SAAS,GAAgB,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC;IACxE,8CAA8C;IAC9C,MAAM,UAAU,GAAG,CAAC,CAAC,CAAC,CAAC;IAEvB,SAAS,CAAC;QACN,sEAAsE;QACtE,IAAI,UAAU,CAAC,CAAC,CAAC,IAAI,SAAS,CAAC,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;YACvC,qDAAqD;YACrD,IAAI,UAAU,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;gBAC1B,OAAO,MAAM,CAAC;YAClB,CAAC;YAED,sDAAsD;YACtD,SAAS,CAAC,KAAK,EAAE,CAAC;YAClB,UAAU,CAAC,KAAK,EAAE,CAAC;YAEnB,0DAA0D;YAC1D,SAAS;QACb,CAAC;QAED,MAAM,IAAI,GAAG,SAAS,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;QAE3C,IAAI,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;YACb,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YAClB,IAAI,EAAE,KAAK,IAAI,CAAC;gBAAE,OAAO,MAAM,CAAC;QACpC,CAAC;QAED,IAAI,OAAO,IAAI,WAAW,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YAC3D;;;eAGG;YACH,UAAU,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;YACtB,SAAS,CAAC,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QACrC,CAAC;IACL,CAAC;AACL,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,YAAY,CACxB,IAA0B,EAC1B,KAAU;IAEV,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC5B,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,OAAO,CACnB,IAAgC,EAChC,KAA6B,EAC7B,OAAO,GAAG,IAAI;IAEd,MAAM,aAAa,GAAG,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;IAC7D,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,aAAa,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QAC5C,MAAM,IAAI,GAAG,aAAa,CAAC,CAAC,CAAC,CAAC;QAC9B,IAAI,KAAK,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;YAC5B,OAAO,IAAI,CAAC;QAChB,CAAC;QACD,IAAI,OAAO,IAAI,WAAW,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YAC3D,MAAM,KAAK,GAAG,OAAO,CAAC,IAAI,EAAE,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;YACjD,IAAI,KAAK;gBAAE,OAAO,KAAK,CAAC;QAC5B,CAAC;IACL,CAAC;IAED,OAAO,IAAI,CAAC;AAChB,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,SAAS,CACrB,IAAgC,EAChC,KAA6B;IAE7B,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAChD,CAAC,IAAI,EAAE,EAAE,CACL,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,CAAC;QAC3B,CAAC,WAAW,CAAC,IAAI,CAAC,IAAI,SAAS,CAAC,IAAI,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC,CAC5D,CAAC;AACN,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,UAAU,OAAO,CACnB,IAAgC,EAChC,KAA6B;IAE7B,MAAM,MAAM,GAAG,EAAE,CAAC;IAClB,MAAM,SAAS,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC;IAC3D,MAAM,UAAU,GAAG,CAAC,CAAC,CAAC,CAAC;IAEvB,SAAS,CAAC;QACN,IAAI,UAAU,CAAC,CAAC,CAAC,IAAI,SAAS,CAAC,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;YACvC,IAAI,SAAS,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;gBACzB,OAAO,MAAM,CAAC;YAClB,CAAC;YAED,sDAAsD;YACtD,SAAS,CAAC,KAAK,EAAE,CAAC;YAClB,UAAU,CAAC,KAAK,EAAE,CAAC;YAEnB,0DAA0D;YAC1D,SAAS;QACb,CAAC;QAED,MAAM,IAAI,GAAG,SAAS,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;QAE3C,IAAI,KAAK,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC;YAAE,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAEjD,IAAI,WAAW,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YAChD,UAAU,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;YACtB,SAAS,CAAC,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QACrC,CAAC;IACL,CAAC;AACL,CAAC"}
@@ -0,0 +1,419 @@
export default `flf2a$ 4 3 7 0 9
pepper.flf by Dr. Pepper (mcscs1jcwj@dct.ac.uk)
Completed and ported to figlet by Juan Car (jc@juguete.quim.ucm.es)
version 1.0 -- 20/Jan/94
version 1.1 -- 18/Feb/94 -- smushmode 0, thanks to Glenn Chappell (ggc@uiuc.edu)
Uses spanish character set with -D option:
_ _
[ = a' \\ = e' ] = i' { = o' | = u' } = n ~ = N
$@
$@
$@
$@@
@
/@
. @
@@
@
//@
$ @
@@
@
_/_/@
-/-/ @
@@
_,@
/_\`@
._/ @
' @@
@
./@
/.@
@@
_@
(/@
(_X@
@@
@
/@
@
@@
@
/@
| @
@@
@
|@
/ @
@@
@
.|/@
/|\`@
@@
@
_ /_@
/' @
@@
@
@
/@
@@
@
__@
@
@@
@
@
.@
@@
@
/@
/' @
@@
_ @
/ /@
/_/ @
@@
@
-/@
/ @
@@
_@
'/@
/_ @
@@
_ @
_/@
._/ @
@@
@
/_/@
/ @
@@
__@
/_ @
._/ @
@@
_ @
/_\`@
/_/ @
@@
__@
/@
/' @
@@
_ @
/_/@
/_/ @
@@
_ @
/_/@
/ @
@@
@
.@
. @
@@
@
.@
/ @
@@
@
/@
\\@
@@
@
__@
-- @
@@
@
\\@
/@
@@
_ @
'_/@
/ @
@@
_ @
/.)@
/_~ @
@@
_ @
/_/@
/ / @
@@
_ @
/_)@
/_) @
@@
_ @
/ \`@
/_, @
@@
_ @
/ |@
/_.'@
@@
_ @
/_\`@
/_, @
@@
_ @
/_\`@
/ $ @
@@
_ @
/ \`@
/_; @
@@
@
/_/@
/ / @
@@
@
/@
/ @
@@
_ @
/@
(_/ @
@@
@
/_/@
/\`\\ @
@@
@
/ @
/_,@
@@
@
/|,/@
/ / @
@@
@
/|/@
/ | @
@@
_ @
/ /@
/_/ @
@@
_ @
/_/@
/$ @
@@
_ @
/ /@
/_\\ @
@@
_ @
/_/@
/ \\ @
@@
_ @
/_\`@
._/ @
@@
__@
/ @
/ @
@@
@
/ /@
/_/ @
@@
@
| |@
|/ @
@@
@
| | |@
|/|/ @
@@
@
\\ /@
/'\\@
@@
@
/_/@
/ @
@@
_ @
/@
/_.@
@@
__@
/ @
/_ @
@@
@
\\ @
\\@
@@
_ @
/@
__/ @
@@
@
/|@
@
@@
@
@
__@
@@
@
\\@
@
@@
@
_ @
/_|@
@@
@
/_@
/_/@
@@
@
_ @
/_$@
@@
@
_/@
/_/ @
@@
@
_ @
/_'@
@@
@
_/|@
/$ @
@@
@
_ @
/_/@
_/ @@
@
/_@
/ /@
@@
@
.@
/ @
@@
@
.@
/ @
|/ @@
@
/_@
/\\ @
@@
@
/@
/ @
@@
@
_ _ @
/ / /@
@@
@
_ @
/ /@
@@
@
_ @
/_/@
@@
@
_ @
/_/@
/$ @@
@
_ @
/_/@
/ @@
@
_@
/ @
@@
@
_@
_\\ @
@@
@
_/_@
/$ @
@@
@
@
/_/@
@@
@
@
|/@
@@
@
@
|/|/@
@@
@
@
><@
@@
@
@
/_/@
_/ @@
@
_ @
/_@
@@
_ @
_/ \`@
/_ @
@@
@
/@
/ @
@@
_ @
/@
._/\`@
@@
@
/|/@
@
@@
@
_'@
/_|@
@@
@
_'@
/_'@
@@
@
,@
/ @
@@
@
_'@
/_/@
@@
@
,@
/_/@
@@
@
_--@
/ / @
@@
--@
/|/@
/ | @
@@
`
@@ -0,0 +1,29 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.modeFix = void 0;
const modeFix = (mode, isDir, portable) => {
mode &= 0o7777;
// in portable mode, use the minimum reasonable umask
// if this system creates files with 0o664 by default
// (as some linux distros do), then we'll write the
// archive with 0o644 instead. Also, don't ever create
// a file that is not readable/writable by the owner.
if (portable) {
mode = (mode | 0o600) & ~0o22;
}
// if dirs are readable, then they should be listable
if (isDir) {
if (mode & 0o400) {
mode |= 0o100;
}
if (mode & 0o40) {
mode |= 0o10;
}
if (mode & 0o4) {
mode |= 0o1;
}
}
return mode;
};
exports.modeFix = modeFix;
//# sourceMappingURL=mode-fix.js.map
@@ -0,0 +1,3 @@
export declare const WHITESPACE_CHARS: Array<number>;
export declare const skipWhiteSpace: RegExp;
export declare const IS_WHITESPACE: Uint8Array;
@@ -0,0 +1,57 @@
{
"$schema": "https://json-schema.org/draft/2019-09/schema",
"$id": "https://json-schema.org/draft/2019-09/meta/core",
"$vocabulary": {
"https://json-schema.org/draft/2019-09/vocab/core": true
},
"$recursiveAnchor": true,
"title": "Core vocabulary meta-schema",
"type": ["object", "boolean"],
"properties": {
"$id": {
"type": "string",
"format": "uri-reference",
"$comment": "Non-empty fragments not allowed.",
"pattern": "^[^#]*#?$"
},
"$schema": {
"type": "string",
"format": "uri"
},
"$anchor": {
"type": "string",
"pattern": "^[A-Za-z][-A-Za-z0-9.:_]*$"
},
"$ref": {
"type": "string",
"format": "uri-reference"
},
"$recursiveRef": {
"type": "string",
"format": "uri-reference"
},
"$recursiveAnchor": {
"type": "boolean",
"default": false
},
"$vocabulary": {
"type": "object",
"propertyNames": {
"type": "string",
"format": "uri"
},
"additionalProperties": {
"type": "boolean"
}
},
"$comment": {
"type": "string"
},
"$defs": {
"type": "object",
"additionalProperties": {"$recursiveRef": "#"},
"default": {}
}
}
}
@@ -0,0 +1,2 @@
export {};
//# sourceMappingURL=standaloneSseWithGetStreamableHttp.d.ts.map
@@ -0,0 +1,18 @@
"use strict";
module.exports = require('./loader')(window, loadImplementation)
/**
* Browser specific loadImplementation. Always uses `window.Promise`
*
* To register a custom implementation, must register with `Promise` option.
*/
function loadImplementation(){
if(typeof window.Promise === 'undefined'){
throw new Error("any-promise browser requires a polyfill or explicit registration"+
" e.g: require('any-promise/register/bluebird')")
}
return {
Promise: window.Promise,
implementation: 'window.Promise'
}
}
@@ -0,0 +1,67 @@
/**
* @fileoverview A shared list of ES3 keywords.
* @author Josh Perez
*/
"use strict";
module.exports = [
"abstract",
"boolean",
"break",
"byte",
"case",
"catch",
"char",
"class",
"const",
"continue",
"debugger",
"default",
"delete",
"do",
"double",
"else",
"enum",
"export",
"extends",
"false",
"final",
"finally",
"float",
"for",
"function",
"goto",
"if",
"implements",
"import",
"in",
"instanceof",
"int",
"interface",
"long",
"native",
"new",
"null",
"package",
"private",
"protected",
"public",
"return",
"short",
"static",
"super",
"switch",
"synchronized",
"this",
"throw",
"throws",
"transient",
"true",
"try",
"typeof",
"var",
"void",
"volatile",
"while",
"with",
];
@@ -0,0 +1 @@
{"version":3,"file":"mix-values.mjs","sources":["../../../../src/projection/animation/mix-values.ts"],"sourcesContent":["import { mixNumber } from \"../../utils/mix/number\"\nimport { percent, px } from \"../../value/types/numbers/units\"\nimport type { AnyResolvedKeyframe } from \"../../animation/types\"\nimport {\n progress as calcProgress,\n circOut,\n EasingFunction,\n noop,\n} from \"motion-utils\"\nimport type { ResolvedValues } from \"../../node/types\"\n\nconst borderLabels = [\n \"borderTopLeftRadius\",\n \"borderTopRightRadius\",\n \"borderBottomLeftRadius\",\n \"borderBottomRightRadius\",\n]\nconst numBorders = borderLabels.length\n\nconst asNumber = (value: AnyResolvedKeyframe) =>\n typeof value === \"string\" ? parseFloat(value) : value\n\nconst isPx = (value: AnyResolvedKeyframe) =>\n typeof value === \"number\" || px.test(value)\n\nexport function mixValues(\n target: ResolvedValues,\n follow: ResolvedValues,\n lead: ResolvedValues,\n progress: number,\n shouldCrossfadeOpacity: boolean,\n isOnlyMember: boolean\n) {\n if (shouldCrossfadeOpacity) {\n target.opacity = mixNumber(\n 0,\n (lead.opacity as number) ?? 1,\n easeCrossfadeIn(progress)\n )\n target.opacityExit = mixNumber(\n (follow.opacity as number) ?? 1,\n 0,\n easeCrossfadeOut(progress)\n )\n } else if (isOnlyMember) {\n target.opacity = mixNumber(\n (follow.opacity as number) ?? 1,\n (lead.opacity as number) ?? 1,\n progress\n )\n }\n\n /**\n * Mix border radius\n */\n for (let i = 0; i < numBorders; i++) {\n const borderLabel = borderLabels[i]\n let followRadius = getRadius(follow, borderLabel)\n let leadRadius = getRadius(lead, borderLabel)\n\n if (followRadius === undefined && leadRadius === undefined) continue\n\n followRadius ||= 0\n leadRadius ||= 0\n\n const canMix =\n followRadius === 0 ||\n leadRadius === 0 ||\n isPx(followRadius) === isPx(leadRadius)\n\n if (canMix) {\n target[borderLabel] = Math.max(\n mixNumber(\n asNumber(followRadius),\n asNumber(leadRadius),\n progress\n ),\n 0\n )\n\n if (percent.test(leadRadius) || percent.test(followRadius)) {\n target[borderLabel] += \"%\"\n }\n } else {\n target[borderLabel] = leadRadius\n }\n }\n\n /**\n * Mix rotation\n */\n if (follow.rotate || lead.rotate) {\n target.rotate = mixNumber(\n (follow.rotate as number) || 0,\n (lead.rotate as number) || 0,\n progress\n )\n }\n}\n\nfunction getRadius(values: ResolvedValues, radiusName: string) {\n return values[radiusName] !== undefined\n ? values[radiusName]\n : values.borderRadius\n}\n\nconst easeCrossfadeIn = /*@__PURE__*/ compress(0, 0.5, circOut)\nconst easeCrossfadeOut = /*@__PURE__*/ compress(0.5, 0.95, noop)\n\nfunction compress(\n min: number,\n max: number,\n easing: EasingFunction\n): EasingFunction {\n return (p: number) => {\n // Could replace ifs with clamp\n if (p < min) return 0\n if (p > max) return 1\n return easing(calcProgress(min, max, p))\n }\n}\n"],"names":["calcProgress"],"mappings":";;;;AAWA,MAAM,YAAY,GAAG;IACjB,qBAAqB;IACrB,sBAAsB;IACtB,wBAAwB;IACxB,yBAAyB;CAC5B;AACD,MAAM,UAAU,GAAG,YAAY,CAAC,MAAM;AAEtC,MAAM,QAAQ,GAAG,CAAC,KAA0B,KACxC,OAAO,KAAK,KAAK,QAAQ,GAAG,UAAU,CAAC,KAAK,CAAC,GAAG,KAAK;AAEzD,MAAM,IAAI,GAAG,CAAC,KAA0B,KACpC,OAAO,KAAK,KAAK,QAAQ,IAAI,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC;AAEzC,SAAU,SAAS,CACrB,MAAsB,EACtB,MAAsB,EACtB,IAAoB,EACpB,QAAgB,EAChB,sBAA+B,EAC/B,YAAqB,EAAA;IAErB,IAAI,sBAAsB,EAAE;AACxB,QAAA,MAAM,CAAC,OAAO,GAAG,SAAS,CACtB,CAAC,EACA,IAAI,CAAC,OAAkB,IAAI,CAAC,EAC7B,eAAe,CAAC,QAAQ,CAAC,CAC5B;AACD,QAAA,MAAM,CAAC,WAAW,GAAG,SAAS,CACzB,MAAM,CAAC,OAAkB,IAAI,CAAC,EAC/B,CAAC,EACD,gBAAgB,CAAC,QAAQ,CAAC,CAC7B;IACL;SAAO,IAAI,YAAY,EAAE;AACrB,QAAA,MAAM,CAAC,OAAO,GAAG,SAAS,CACrB,MAAM,CAAC,OAAkB,IAAI,CAAC,EAC9B,IAAI,CAAC,OAAkB,IAAI,CAAC,EAC7B,QAAQ,CACX;IACL;AAEA;;AAEG;AACH,IAAA,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,UAAU,EAAE,CAAC,EAAE,EAAE;AACjC,QAAA,MAAM,WAAW,GAAG,YAAY,CAAC,CAAC,CAAC;QACnC,IAAI,YAAY,GAAG,SAAS,CAAC,MAAM,EAAE,WAAW,CAAC;QACjD,IAAI,UAAU,GAAG,SAAS,CAAC,IAAI,EAAE,WAAW,CAAC;AAE7C,QAAA,IAAI,YAAY,KAAK,SAAS,IAAI,UAAU,KAAK,SAAS;YAAE;AAE5D,QAAA,YAAY,KAAZ,YAAY,GAAK,CAAC,CAAA;AAClB,QAAA,UAAU,KAAV,UAAU,GAAK,CAAC,CAAA;AAEhB,QAAA,MAAM,MAAM,GACR,YAAY,KAAK,CAAC;AAClB,YAAA,UAAU,KAAK,CAAC;YAChB,IAAI,CAAC,YAAY,CAAC,KAAK,IAAI,CAAC,UAAU,CAAC;QAE3C,IAAI,MAAM,EAAE;YACR,MAAM,CAAC,WAAW,CAAC,GAAG,IAAI,CAAC,GAAG,CAC1B,SAAS,CACL,QAAQ,CAAC,YAAY,CAAC,EACtB,QAAQ,CAAC,UAAU,CAAC,EACpB,QAAQ,CACX,EACD,CAAC,CACJ;AAED,YAAA,IAALine truncated
@@ -0,0 +1 @@
{"version":3,"file":"dice-1.js","sources":["../../../src/icons/dice-1.ts"],"sourcesContent":["import createLucideIcon from '../createLucideIcon';\n\n/**\n * @component @name Dice1\n * @description Lucide SVG icon component, renders SVG Element with children.\n *\n * @preview ![img](data:image/svg+xml;base64,PHN2ZyAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogIHdpZHRoPSIyNCIKICBoZWlnaHQ9IjI0IgogIHZpZXdCb3g9IjAgMCAyNCAyNCIKICBmaWxsPSJub25lIgogIHN0cm9rZT0iIzAwMCIgc3R5bGU9ImJhY2tncm91bmQtY29sb3I6ICNmZmY7IGJvcmRlci1yYWRpdXM6IDJweCIKICBzdHJva2Utd2lkdGg9IjIiCiAgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIgogIHN0cm9rZS1saW5lam9pbj0icm91bmQiCj4KICA8cmVjdCB3aWR0aD0iMTgiIGhlaWdodD0iMTgiIHg9IjMiIHk9IjMiIHJ4PSIyIiByeT0iMiIgLz4KICA8cGF0aCBkPSJNMTIgMTJoLjAxIiAvPgo8L3N2Zz4K) - https://lucide.dev/icons/dice-1\n * @see https://lucide.dev/guide/packages/lucide-react - Documentation\n *\n * @param {Object} props - Lucide icons props and any valid SVG attribute\n * @returns {JSX.Element} JSX Element\n *\n */\nconst Dice1 = createLucideIcon('Dice1', [\n ['rect', { width: '18', height: '18', x: '3', y: '3', rx: '2', ry: '2', key: '1m3agn' }],\n ['path', { d: 'M12 12h.01', key: '1mp3jc' }],\n]);\n\nexport default Dice1;\n"],"names":[],"mappings":";;;;;;;;;AAaM,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,iBAAiB,OAAS,CAAA,CAAA,CAAA;AAAA,CAAA,CACtC,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,KAAO,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAM,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAQ,CAAA,CAAA,CAAA,CAAA,CAAM,CAAA,CAAA,CAAA,EAAG,CAAK,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAG,KAAK,CAAI,CAAA,CAAA,CAAA,GAAA,CAAK,CAAA,CAAA,EAAI,CAAA,CAAA,CAAA,CAAK,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,GAAU,CAAA,CAAA;AAAA,CAAA,CACvF,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,CAAc,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA;AAC7C,CAAC,CAAA,CAAA;;"}
@@ -0,0 +1,31 @@
'use strict'
const u = require('universalify').fromPromise
const fs = require('../fs')
const path = require('path')
const mkdir = require('../mkdirs')
const pathExists = require('../path-exists').pathExists
async function outputFile (file, data, encoding = 'utf-8') {
const dir = path.dirname(file)
if (!(await pathExists(dir))) {
await mkdir.mkdirs(dir)
}
return fs.writeFile(file, data, encoding)
}
function outputFileSync (file, ...args) {
const dir = path.dirname(file)
if (!fs.existsSync(dir)) {
mkdir.mkdirsSync(dir)
}
fs.writeFileSync(file, ...args)
}
module.exports = {
outputFile: u(outputFile),
outputFileSync
}
@@ -0,0 +1,961 @@
import { Server } from './index.js';
import { normalizeObjectSchema, safeParseAsync, getObjectShape, objectFromShape, getParseErrorMessage, getSchemaDescription, isSchemaOptional, getLiteralValue } from './zod-compat.js';
import { toJsonSchemaCompat } from './zod-json-schema-compat.js';
import { McpError, ErrorCode, ListResourceTemplatesRequestSchema, ReadResourceRequestSchema, ListToolsRequestSchema, CallToolRequestSchema, ListResourcesRequestSchema, ListPromptsRequestSchema, GetPromptRequestSchema, CompleteRequestSchema, assertCompleteRequestPrompt, assertCompleteRequestResourceTemplate } from '../types.js';
import { isCompletable, getCompleter } from './completable.js';
import { UriTemplate } from '../shared/uriTemplate.js';
import { validateAndWarnToolName } from '../shared/toolNameValidation.js';
import { ExperimentalMcpServerTasks } from '../experimental/tasks/mcp-server.js';
import { ZodOptional } from 'zod';
// Counts array elements and object members in `value`, stopping once the running total passes `max`.
function toolInputElementCount(value, max) {
let count = 0;
const stack = [value];
while (stack.length > 0) {
const node = stack.pop();
if (node === null || typeof node !== 'object')
continue;
if (Array.isArray(node)) {
for (const child of node) {
if (++count > max)
return count;
if (child !== null && typeof child === 'object')
stack.push(child);
}
}
else {
for (const key in node) {
if (!Object.prototype.hasOwnProperty.call(node, key))
continue;
if (++count > max)
return count;
const child = node[key];
if (child !== null && typeof child === 'object')
stack.push(child);
}
}
}
return count;
}
// Resolves the configured element ceiling: no limit when unset or Infinity, else a number of at least 1.
function resolveMaxToolInputElements(value) {
if (value === undefined || value === Infinity)
return undefined;
if (typeof value !== 'number' || Number.isNaN(value) || value < 1) {
throw new RangeError(`maxToolInputElements must be a number of at least 1, or Infinity, got ${String(value)}`);
}
return value;
}
/**
* High-level MCP server that provides a simpler API for working with resources, tools, and prompts.
* For advanced usage (like sending notifications or setting custom request handlers), use the underlying
* Server instance available via the `server` property.
*/
export class McpServer {
constructor(serverInfo, options) {
this._registeredResources = {};
this._registeredResourceTemplates = {};
this._registeredTools = {};
this._registeredPrompts = {};
this._toolHandlersInitialized = false;
this._completionHandlerInitialized = false;
this._resourceHandlersInitialized = false;
this._promptHandlersInitialized = false;
this.server = new Server(serverInfo, options);
this._maxToolInputElements = resolveMaxToolInputElements(options?.maxToolInputElements);
}
/**
* Access experimental features.
*
* WARNING: These APIs are experimental and may change without notice.
*
* @experimental
*/
get experimental() {
if (!this._experimental) {
this._experimental = {
tasks: new ExperimentalMcpServerTasks(this)
};
}
return this._experimental;
}
/**
* Attaches to the given transport, starts it, and starts listening for messages.
*
* The `server` object assumes ownership of the Transport, replacing any callbacks that have already been set, and expects that it is the only user of the Transport instance going forward.
*/
async connect(transport) {
return await this.server.connect(transport);
}
/**
* Closes the connection.
*/
async close() {
await this.server.close();
}
setToolRequestHandlers() {
if (this._toolHandlersInitialized) {
return;
}
this.server.assertCanSetRequestHandler(getMethodValue(ListToolsRequestSchema));
this.server.assertCanSetRequestHandler(getMethodValue(CallToolRequestSchema));
this.server.registerCapabilities({
tools: {
listChanged: true
}
});
this.server.setRequestHandler(ListToolsRequestSchema, () => ({
tools: Object.entries(this._registeredTools)
.filter(([, tool]) => tool.enabled)
.map(([name, tool]) => {
const toolDefinition = {
name,
title: tool.title,
description: tool.description,
inputSchema: (() => {
const obj = normalizeObjectSchema(tool.inputSchema);
return obj
? toJsonSchemaCompat(obj, {
strictUnions: true,
pipeStrategy: 'input'
})
: EMPTY_OBJECT_JSON_SCHEMA;
})(),
annotations: tool.annotations,
execution: tool.execution,
_meta: tool._meta
};
if (tool.outputSchema) {
const obj = normalizeObjectSchema(tool.outputSchema);
if (obj) {
toolDefinition.outputSchema = toJsonSchemaCompat(obj, {
strictUnions: true,
pipeStrategy: 'output'
});
}
}
return toolDefinition;
})
}));
this.server.setRequestHandler(CallToolRequestSchema, async (request, extra) => {
try {
const tool = this._registeredTools[request.params.name];
if (!tool) {
throw new McpError(ErrorCode.InvalidParams, `Tool ${request.params.name} not found`);
}
if (!tool.enabled) {
throw new McpError(ErrorCode.InvalidParams, `Tool ${request.params.name} disabled`);
}
const isTaskRequest = !!request.params.task;
const taskSupport = tool.execution?.taskSupport;
const isTaskHandler = 'createTask' in tool.handler;
// Validate task hint configuration
if ((taskSupport === 'required' || taskSupport === 'optional') && !isTaskHandler) {
throw new McpError(ErrorCode.InternalError, `Tool ${request.params.name} has taskSupport '${taskSupport}' but was not registered with registerToolTask`);
}
// Handle taskSupport 'required' without task augmentation
if (taskSupport === 'required' && !isTaskRequest) {
throw new McpError(ErrorCode.MethodNotFound, `Tool ${request.params.name} requires task augmentation (taskSupport: 'required')`);
}
// Handle taskSupport 'optional' without task augmentation - automatic polling
if (taskSupport === 'optional' && !isTaskRequest && isTaskHandler) {
return await this.handleAutomaticTaskPolling(tool, request, extra);
}
// Normal execution path
const args = await this.validateToolInput(tool, request.params.arguments, request.params.name);
const result = await this.executeToolHandler(tool, args, extra);
// Return CreateTaskResult immediately for task requests
if (isTaskRequest) {
return result;
}
// Validate output schema for non-task requests
await this.validateToolOutput(tool, result, request.params.name);
return result;
}
catch (error) {
if (error instanceof McpError) {
if (error.code === ErrorCode.UrlElicitationRequired) {
throw error; // Return the error to the caller without wrapping in CallToolResult
}
}
return this.createToolError(error instanceof Error ? error.message : String(error));
}
});
this._toolHandlersInitialized = true;
}
/**
* Creates a tool error result.
*
* @param errorMessage - The error message.
* @returns The tool error result.
*/
createToolError(errorMessage) {
return {
content: [
{
type: 'text',
text: errorMessage
}
],
isError: true
};
}
/**
* Validates tool input arguments against the tool's input schema.
*/
async validateToolInput(tool, args, toolName) {
if (this._maxToolInputElements !== undefined &&
toolInputElementCount(args, this._maxToolInputElements) > this._maxToolInputElements) {
throw new McpError(ErrorCode.InvalidParams, `Invalid arguments for tool ${toolName}: arguments contain more than the maximum of ${this._maxToolInputElements} elements`);
}
if (!tool.inputSchema) {
return undefined;
}
// Try to normalize to object schema first (for raw shapes and object schemas)
// If that fails, use the schema directly (for union/intersection/etc)
const inputObj = normalizeObjectSchema(tool.inputSchema);
const schemaToParse = inputObj ?? tool.inputSchema;
const parseResult = await safeParseAsync(schemaToParse, args ?? {});
if (!parseResult.success) {
const error = 'error' in parseResult ? parseResult.error : 'Unknown error';
const errorMessage = getParseErrorMessage(error);
throw new McpError(ErrorCode.InvalidParams, `Input validation error: Invalid arguments for tool ${toolName}: ${errorMessage}`);
}
return parseResult.data;
}
/**
* Validates tool output against the tool's output schema.
*/
async validateToolOutput(tool, result, toolName) {
if (!tool.outputSchema) {
return;
}
// Only validate CallToolResult, not CreateTaskResult
if (!('content' in result)) {
return;
}
if (result.isError) {
return;
}
if (!result.structuredContent) {
throw new McpError(ErrorCode.InvalidParams, `Output validation error: Tool ${toolName} has an output schema but no structured content was provided`);
}
// if the tool has an output schema, validate structured content
const outputObj = normalizeObjectSchema(tool.outputSchema);
const parseResult = await safeParseAsync(outputObj, result.structuredContent);
if (!parseResult.success) {
const error = 'error' in parseResult ? parseResult.error : 'Unknown error';
const errorMessage = getParseErrorMessage(error);
throw new McpError(ErrorCode.InvalidParams, `Output validation error: Invalid structured content for tool ${toolName}: ${errorMessage}`);
}
}
/**
* Executes a tool handler (either regular or task-based).
*/
async executeToolHandler(tool, args, extra) {
const handler = tool.handler;
const isTaskHandler = 'createTask' in handler;
if (isTaskHandler) {
if (!extra.taskStore) {
throw new Error('No task store provided.');
}
const taskExtra = { ...extra, taskStore: extra.taskStore };
if (tool.inputSchema) {
const typedHandler = handler;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
return await Promise.resolve(typedHandler.createTask(args, taskExtra));
}
else {
const typedHandler = handler;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
return await Promise.resolve(typedHandler.createTask(taskExtra));
}
}
if (tool.inputSchema) {
const typedHandler = handler;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
return await Promise.resolve(typedHandler(args, extra));
}
else {
const typedHandler = handler;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
return await Promise.resolve(typedHandler(extra));
}
}
/**
* Handles automatic task polling for tools with taskSupport 'optional'.
*/
async handleAutomaticTaskPolling(tool, request, extra) {
if (!extra.taskStore) {
throw new Error('No task store provided for task-capable tool.');
}
// Validate input and create task
const args = await this.validateToolInput(tool, request.params.arguments, request.params.name);
const handler = tool.handler;
const taskExtra = { ...extra, taskStore: extra.taskStore };
const createTaskResult = args // undefined only if tool.inputSchema is undefined
? await Promise.resolve(handler.createTask(args, taskExtra))
: // eslint-disable-next-line @typescript-eslint/no-explicit-any
await Promise.resolve(handler.createTask(taskExtra));
// Poll until completion
const taskId = createTaskResult.task.taskId;
let task = createTaskResult.task;
const pollInterval = task.pollInterval ?? 5000;
while (task.status !== 'completed' && task.status !== 'failed' && task.status !== 'cancelled') {
await new Promise(resolve => setTimeout(resolve, pollInterval));
const updatedTask = await extra.taskStore.getTask(taskId);
if (!updatedTask) {
throw new McpError(ErrorCode.InternalError, `Task ${taskId} not found during polling`);
}
task = updatedTask;
}
// Return the final result
return (await extra.taskStore.getTaskResult(taskId));
}
setCompletionRequestHandler() {
if (this._completionHandlerInitialized) {
return;
}
this.server.assertCanSetRequestHandler(getMethodValue(CompleteRequestSchema));
this.server.registerCapabilities({
completions: {}
});
this.server.setRequestHandler(CompleteRequestSchema, async (request) => {
switch (request.params.ref.type) {
case 'ref/prompt':
assertCompleteRequestPrompt(request);
return this.handlePromptCompletion(request, request.params.ref);
case 'ref/resource':
assertCompleteRequestResourceTemplate(request);
return this.handleResourceCompletion(request, request.params.ref);
default:
throw new McpError(ErrorCode.InvalidParams, `Invalid completion reference: ${request.params.ref}`);
}
});
this._completionHandlerInitialized = true;
}
async handlePromptCompletion(request, ref) {
const prompt = this._registeredPrompts[ref.name];
if (!prompt) {
throw new McpError(ErrorCode.InvalidParams, `Prompt ${ref.name} not found`);
}
if (!prompt.enabled) {
throw new McpError(ErrorCode.InvalidParams, `Prompt ${ref.name} disabled`);
}
if (!prompt.argsSchema) {
return EMPTY_COMPLETION_RESULT;
}
const promptShape = getObjectShape(prompt.argsSchema);
const field = promptShape?.[request.params.argument.name];
if (!isCompletable(field)) {
return EMPTY_COMPLETION_RESULT;
}
const completer = getCompleter(field);
if (!completer) {
return EMPTY_COMPLETION_RESULT;
}
const suggestions = await completer(request.params.argument.value, request.params.context);
return createCompletionResult(suggestions);
}
async handleResourceCompletion(request, ref) {
const template = Object.values(this._registeredResourceTemplates).find(t => t.resourceTemplate.uriTemplate.toString() === ref.uri);
if (!template) {
if (this._registeredResources[ref.uri]) {
// Attempting to autocomplete a fixed resource URI is not an error in the spec (but probably should be).
return EMPTY_COMPLETION_RESULT;
}
throw new McpError(ErrorCode.InvalidParams, `Resource template ${request.params.ref.uri} not found`);
}
const completer = template.resourceTemplate.completeCallback(request.params.argument.name);
if (!completer) {
return EMPTY_COMPLETION_RESULT;
}
const suggestions = await completer(request.params.argument.value, request.params.context);
return createCompletionResult(suggestions);
}
setResourceRequestHandlers() {
if (this._resourceHandlersInitialized) {
return;
}
this.server.assertCanSetRequestHandler(getMethodValue(ListResourcesRequestSchema));
this.server.assertCanSetRequestHandler(getMethodValue(ListResourceTemplatesRequestSchema));
this.server.assertCanSetRequestHandler(getMethodValue(ReadResourceRequestSchema));
this.server.registerCapabilities({
resources: {
listChanged: true
}
});
this.server.setRequestHandler(ListResourcesRequestSchema, async (request, extra) => {
const resources = Object.entries(this._registeredResources)
.filter(([_, resource]) => resource.enabled)
.map(([uri, resource]) => ({
uri,
name: resource.name,
...resource.metadata
}));
const templateResources = [];
for (const template of Object.values(this._registeredResourceTemplates)) {
if (!template.resourceTemplate.listCallback) {
continue;
}
const result = await template.resourceTemplate.listCallback(extra);
for (const resource of result.resources) {
templateResources.push({
...template.metadata,
// the defined resource metadata should override the template metadata if present
...resource
});
}
}
return { resources: [...resources, ...templateResources] };
});
this.server.setRequestHandler(ListResourceTemplatesRequestSchema, async () => {
const resourceTemplates = Object.entries(this._registeredResourceTemplates).map(([name, template]) => ({
name,
uriTemplate: template.resourceTemplate.uriTemplate.toString(),
...template.metadata
}));
return { resourceTemplates };
});
this.server.setRequestHandler(ReadResourceRequestSchema, async (request, extra) => {
const uri = new URL(request.params.uri);
// First check for exact resource match
const resource = this._registeredResources[uri.toString()];
if (resource) {
if (!resource.enabled) {
throw new McpError(ErrorCode.InvalidParams, `Resource ${uri} disabled`);
}
return resource.readCallback(uri, extra);
}
// Then check templates
for (const template of Object.values(this._registeredResourceTemplates)) {
const variables = template.resourceTemplate.uriTemplate.match(uri.toString());
if (variables) {
return template.readCallback(uri, variables, extra);
}
}
throw new McpError(ErrorCode.InvalidParams, `Resource ${uri} not found`);
});
this._resourceHandlersInitialized = true;
}
setPromptRequestHandlers() {
if (this._promptHandlersInitialized) {
return;
}
this.server.assertCanSetRequestHandler(getMethodValue(ListPromptsRequestSchema));
this.server.assertCanSetRequestHandler(getMethodValue(GetPromptRequestSchema));
this.server.registerCapabilities({
prompts: {
listChanged: true
}
});
this.server.setRequestHandler(ListPromptsRequestSchema, () => ({
prompts: Object.entries(this._registeredPrompts)
.filter(([, prompt]) => prompt.enabled)
.map(([name, prompt]) => {
return {
name,
title: prompt.title,
description: prompt.description,
arguments: prompt.argsSchema ? promptArgumentsFromSchema(prompt.argsSchema) : undefined
};
})
}));
this.server.setRequestHandler(GetPromptRequestSchema, async (request, extra) => {
const prompt = this._registeredPrompts[request.params.name];
if (!prompt) {
throw new McpError(ErrorCode.InvalidParams, `Prompt ${request.params.name} not found`);
}
if (!prompt.enabled) {
throw new McpError(ErrorCode.InvalidParams, `Prompt ${request.params.name} disabled`);
}
if (prompt.argsSchema) {
const argsObj = normalizeObjectSchema(prompt.argsSchema);
const parseResult = await safeParseAsync(argsObj, request.params.arguments ?? {});
if (!parseResult.success) {
const error = 'error' in parseResult ? parseResult.error : 'Unknown error';
const errorMessage = getParseErrorMessage(error);
throw new McpError(ErrorCode.InvalidParams, `Invalid arguments for prompt ${request.params.name}: ${errorMessage}`);
}
const args = parseResult.data;
const cb = prompt.callback;
return await Promise.resolve(cb(args, extra));
}
else {
const cb = prompt.callback;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
return await Promise.resolve(cb(extra));
}
});
this._promptHandlersInitialized = true;
}
resource(name, uriOrTemplate, ...rest) {
let metadata;
if (typeof rest[0] === 'object') {
metadata = rest.shift();
}
const readCallback = rest[0];
if (typeof uriOrTemplate === 'string') {
if (this._registeredResources[uriOrTemplate]) {
throw new Error(`Resource ${uriOrTemplate} is already registered`);
}
const registeredResource = this._createRegisteredResource(name, undefined, uriOrTemplate, metadata, readCallback);
this.setResourceRequestHandlers();
this.sendResourceListChanged();
return registeredResource;
}
else {
if (this._registeredResourceTemplates[name]) {
throw new Error(`Resource template ${name} is already registered`);
}
const registeredResourceTemplate = this._createRegisteredResourceTemplate(name, undefined, uriOrTemplate, metadata, readCallback);
this.setResourceRequestHandlers();
this.sendResourceListChanged();
return registeredResourceTemplate;
}
}
registerResource(name, uriOrTemplate, config, readCallback) {
if (typeof uriOrTemplate === 'string') {
if (this._registeredResources[uriOrTemplate]) {
throw new Error(`Resource ${uriOrTemplate} is already registered`);
}
const registeredResource = this._createRegisteredResource(name, config.title, uriOrTemplate, config, readCallback);
this.setResourceRequestHandlers();
this.sendResourceListChanged();
return registeredResource;
}
else {
if (this._registeredResourceTemplates[name]) {
throw new Error(`Resource template ${name} is already registered`);
}
const registeredResourceTemplate = this._createRegisteredResourceTemplate(name, config.title, uriOrTemplate, config, readCallback);
this.setResourceRequestHandlers();
this.sendResourceListChanged();
return registeredResourceTemplate;
}
}
_createRegisteredResource(name, title, uri, metadata, readCallback) {
const registeredResource = {
name,
title,
metadata,
readCallback,
enabled: true,
disable: () => registeredResource.update({ enabled: false }),
enable: () => registeredResource.update({ enabled: true }),
remove: () => registeredResource.update({ uri: null }),
update: updates => {
if (typeof updates.uri !== 'undefined' && updates.uri !== uri) {
delete this._registeredResources[uri];
if (updates.uri)
this._registeredResources[updates.uri] = registeredResource;
}
if (typeof updates.name !== 'undefined')
registeredResource.name = updates.name;
if (typeof updates.title !== 'undefined')
registeredResource.title = updates.title;
if (typeof updates.metadata !== 'undefined')
registeredResource.metadata = updates.metadata;
if (typeof updates.callback !== 'undefined')
registeredResource.readCallback = updates.callback;
if (typeof updates.enabled !== 'undefined')
registeredResource.enabled = updates.enabled;
this.sendResourceListChanged();
}
};
this._registeredResources[uri] = registeredResource;
return registeredResource;
}
_createRegisteredResourceTemplate(name, title, template, metadata, readCallback) {
const registeredResourceTemplate = {
resourceTemplate: template,
title,
metadata,
readCallback,
enabled: true,
disable: () => registeredResourceTemplate.update({ enabled: false }),
enable: () => registeredResourceTemplate.update({ enabled: true }),
remove: () => registeredResourceTemplate.update({ name: null }),
update: updates => {
if (typeof updates.name !== 'undefined' && updates.name !== name) {
delete this._registeredResourceTemplates[name];
if (updates.name)
this._registeredResourceTemplates[updates.name] = registeredResourceTemplate;
}
if (typeof updates.title !== 'undefined')
registeredResourceTemplate.title = updates.title;
if (typeof updates.template !== 'undefined')
registeredResourceTemplate.resourceTemplate = updates.template;
if (typeof updates.metadata !== 'undefined')
registeredResourceTemplate.metadata = updates.metadata;
if (typeof updates.callback !== 'undefined')
registeredResourceTemplate.readCallback = updates.callback;
if (typeof updates.enabled !== 'undefined')
registeredResourceTemplate.enabled = updates.enabled;
this.sendResourceListChanged();
}
};
this._registeredResourceTemplates[name] = registeredResourceTemplate;
// If the resource template has any completion callbacks, enable completions capability
const variableNames = template.uriTemplate.variableNames;
const hasCompleter = Array.isArray(variableNames) && variableNames.some(v => !!template.completeCallback(v));
if (hasCompleter) {
this.setCompletionRequestHandler();
}
return registeredResourceTemplate;
}
_createRegisteredPrompt(name, title, description, argsSchema, callback) {
const registeredPrompt = {
title,
description,
argsSchema: argsSchema === undefined ? undefined : objectFromShape(argsSchema),
callback,
enabled: true,
disable: () => registeredPrompt.update({ enabled: false }),
enable: () => registeredPrompt.update({ enabled: true }),
remove: () => registeredPrompt.update({ name: null }),
update: updates => {
if (typeof updates.name !== 'undefined' && updates.name !== name) {
delete this._registeredPrompts[name];
if (updates.name)
this._registeredPrompts[updates.name] = registeredPrompt;
}
if (typeof updates.title !== 'undefined')
registeredPrompt.title = updates.title;
if (typeof updates.description !== 'undefined')
registeredPrompt.description = updates.description;
if (typeof updates.argsSchema !== 'undefined')
registeredPrompt.argsSchema = objectFromShape(updates.argsSchema);
if (typeof updates.callback !== 'undefined')
registeredPrompt.callback = updates.callback;
if (typeof updates.enabled !== 'undefined')
registeredPrompt.enabled = updates.enabled;
this.sendPromptListChanged();
}
};
this._registeredPrompts[name] = registeredPrompt;
// If any argument uses a Completable schema, enable completions capability
if (argsSchema) {
const hasCompletable = Object.values(argsSchema).some(field => {
const inner = field instanceof ZodOptional ? field._def?.innerType : field;
return isCompletable(inner);
});
if (hasCompletable) {
this.setCompletionRequestHandler();
}
}
return registeredPrompt;
}
_createRegisteredTool(name, title, description, inputSchema, outputSchema, annotations, execution, _meta, handler) {
// Validate tool name according to SEP specification
validateAndWarnToolName(name);
const registeredTool = {
title,
description,
inputSchema: getZodSchemaObject(inputSchema),
outputSchema: getZodSchemaObject(outputSchema),
annotations,
execution,
_meta,
handler: handler,
enabled: true,
disable: () => registeredTool.update({ enabled: false }),
enable: () => registeredTool.update({ enabled: true }),
remove: () => registeredTool.update({ name: null }),
update: updates => {
if (typeof updates.name !== 'undefined' && updates.name !== name) {
if (typeof updates.name === 'string') {
validateAndWarnToolName(updates.name);
}
delete this._registeredTools[name];
if (updates.name)
this._registeredTools[updates.name] = registeredTool;
}
if (typeof updates.title !== 'undefined')
registeredTool.title = updates.title;
if (typeof updates.description !== 'undefined')
registeredTool.description = updates.description;
if (typeof updates.paramsSchema !== 'undefined')
registeredTool.inputSchema = objectFromShape(updates.paramsSchema);
if (typeof updates.outputSchema !== 'undefined')
registeredTool.outputSchema = objectFromShape(updates.outputSchema);
if (typeof updates.callback !== 'undefined')
registeredTool.handler = updates.callback;
if (typeof updates.annotations !== 'undefined')
registeredTool.annotations = updates.annotations;
if (typeof updates._meta !== 'undefined')
registeredTool._meta = updates._meta;
if (typeof updates.enabled !== 'undefined')
registeredTool.enabled = updates.enabled;
this.sendToolListChanged();
}
};
this._registeredTools[name] = registeredTool;
this.setToolRequestHandlers();
this.sendToolListChanged();
return registeredTool;
}
/**
* tool() implementation. Parses arguments passed to overrides defined above.
*/
tool(name, ...rest) {
if (this._registeredTools[name]) {
throw new Error(`Tool ${name} is already registered`);
}
let description;
let inputSchema;
let outputSchema;
let annotations;
// Tool properties are passed as separate arguments, with omissions allowed.
// Support for this style is frozen as of protocol version 2025-03-26. Future additions
// to tool definition should *NOT* be added.
if (typeof rest[0] === 'string') {
description = rest.shift();
}
// Handle the different overload combinations
if (rest.length > 1) {
// We have at least one more arg before the callback
const firstArg = rest[0];
if (isZodRawShapeCompat(firstArg)) {
// We have a params schema as the first arg
inputSchema = rest.shift();
// Check if the next arg is potentially annotations
if (rest.length > 1 && typeof rest[0] === 'object' && rest[0] !== null && !isZodRawShapeCompat(rest[0])) {
// Case: tool(name, paramsSchema, annotations, cb)
// Or: tool(name, description, paramsSchema, annotations, cb)
annotations = rest.shift();
}
}
else if (typeof firstArg === 'object' && firstArg !== null) {
// ToolAnnotations values are primitives. Nested objects indicate a misplaced schema
if (Object.values(firstArg).some(v => typeof v === 'object' && v !== null)) {
throw new Error(`Tool ${name} expected a Zod schema or ToolAnnotations, but received an unrecognized object`);
}
annotations = rest.shift();
}
}
const callback = rest[0];
return this._createRegisteredTool(name, undefined, description, inputSchema, outputSchema, annotations, { taskSupport: 'forbidden' }, undefined, callback);
}
/**
* Registers a tool with a config object and callback.
*/
registerTool(name, config, cb) {
if (this._registeredTools[name]) {
throw new Error(`Tool ${name} is already registered`);
}
const { title, description, inputSchema, outputSchema, annotations, _meta } = config;
return this._createRegisteredTool(name, title, description, inputSchema, outputSchema, annotations, { taskSupport: 'forbidden' }, _meta, cb);
}
prompt(name, ...rest) {
if (this._registeredPrompts[name]) {
throw new Error(`Prompt ${name} is already registered`);
}
let description;
if (typeof rest[0] === 'string') {
description = rest.shift();
}
let argsSchema;
if (rest.length > 1) {
argsSchema = rest.shift();
}
const cb = rest[0];
const registeredPrompt = this._createRegisteredPrompt(name, undefined, description, argsSchema, cb);
this.setPromptRequestHandlers();
this.sendPromptListChanged();
return registeredPrompt;
}
/**
* Registers a prompt with a config object and callback.
*/
registerPrompt(name, config, cb) {
if (this._registeredPrompts[name]) {
throw new Error(`Prompt ${name} is already registered`);
}
const { title, description, argsSchema } = config;
const registeredPrompt = this._createRegisteredPrompt(name, title, description, argsSchema, cb);
this.setPromptRequestHandlers();
this.sendPromptListChanged();
return registeredPrompt;
}
/**
* Checks if the server is connected to a transport.
* @returns True if the server is connected
*/
isConnected() {
return this.server.transport !== undefined;
}
/**
* Sends a logging message to the client, if connected.
* Note: You only need to send the parameters object, not the entire JSON RPC message
* @see LoggingMessageNotification
* @param params
* @param sessionId optional for stateless and backward compatibility
*/
async sendLoggingMessage(params, sessionId) {
return this.server.sendLoggingMessage(params, sessionId);
}
/**
* Sends a resource list changed event to the client, if connected.
*/
sendResourceListChanged() {
if (this.isConnected()) {
this.server.sendResourceListChanged();
}
}
/**
* Sends a tool list changed event to the client, if connected.
*/
sendToolListChanged() {
if (this.isConnected()) {
this.server.sendToolListChanged();
}
}
/**
* Sends a prompt list changed event to the client, if connected.
*/
sendPromptListChanged() {
if (this.isConnected()) {
this.server.sendPromptListChanged();
}
}
}
/**
* A resource template combines a URI pattern with optional functionality to enumerate
* all resources matching that pattern.
*/
export class ResourceTemplate {
constructor(uriTemplate, _callbacks) {
this._callbacks = _callbacks;
this._uriTemplate = typeof uriTemplate === 'string' ? new UriTemplate(uriTemplate) : uriTemplate;
}
/**
* Gets the URI template pattern.
*/
get uriTemplate() {
return this._uriTemplate;
}
/**
* Gets the list callback, if one was provided.
*/
get listCallback() {
return this._callbacks.list;
}
/**
* Gets the callback for completing a specific URI template variable, if one was provided.
*/
completeCallback(variable) {
return this._callbacks.complete?.[variable];
}
}
const EMPTY_OBJECT_JSON_SCHEMA = {
type: 'object',
properties: {}
};
/**
* Checks if a value looks like a Zod schema by checking for parse/safeParse methods.
*/
function isZodTypeLike(value) {
return (value !== null &&
typeof value === 'object' &&
'parse' in value &&
typeof value.parse === 'function' &&
'safeParse' in value &&
typeof value.safeParse === 'function');
}
/**
* Checks if an object is a Zod schema instance (v3 or v4).
*
* Zod schemas have internal markers:
* - v3: `_def` property
* - v4: `_zod` property
*
* This includes transformed schemas like z.preprocess(), z.transform(), z.pipe().
*/
function isZodSchemaInstance(obj) {
return '_def' in obj || '_zod' in obj || isZodTypeLike(obj);
}
/**
* Checks if an object is a "raw shape" - a plain object where values are Zod schemas.
*
* Raw shapes are used as shorthand: `{ name: z.string() }` instead of `z.object({ name: z.string() })`.
*
* IMPORTANT: This must NOT match actual Zod schema instances (like z.preprocess, z.pipe),
* which have internal properties that could be mistaken for schema values.
*/
function isZodRawShapeCompat(obj) {
if (typeof obj !== 'object' || obj === null) {
return false;
}
// If it's already a Zod schema instance, it's NOT a raw shape
if (isZodSchemaInstance(obj)) {
return false;
}
// Empty objects are valid raw shapes (tools with no parameters)
if (Object.keys(obj).length === 0) {
return true;
}
// A raw shape has at least one property that is a Zod schema
return Object.values(obj).some(isZodTypeLike);
}
/**
* Converts a provided Zod schema to a Zod object if it is a ZodRawShapeCompat,
* otherwise returns the schema as is. Throws if the value is not a valid Zod schema.
*/
function getZodSchemaObject(schema) {
if (!schema) {
return undefined;
}
if (isZodRawShapeCompat(schema)) {
return objectFromShape(schema);
}
if (!isZodSchemaInstance(schema)) {
throw new Error('inputSchema must be a Zod schema or raw shape, received an unrecognized object');
}
return schema;
}
function promptArgumentsFromSchema(schema) {
const shape = getObjectShape(schema);
if (!shape)
return [];
return Object.entries(shape).map(([name, field]) => {
// Get description - works for both v3 and v4
const description = getSchemaDescription(field);
// Check if optional - works for both v3 and v4
const isOptional = isSchemaOptional(field);
return {
name,
description,
required: !isOptional
};
});
}
function getMethodValue(schema) {
const shape = getObjectShape(schema);
const methodSchema = shape?.method;
if (!methodSchema) {
throw new Error('Schema is missing a method literal');
}
// Extract literal value - works for both v3 and v4
const value = getLiteralValue(methodSchema);
if (typeof value === 'string') {
return value;
}
throw new Error('Schema method literal must be a string');
}
function createCompletionResult(suggestions) {
return {
completion: {
values: suggestions.slice(0, 100),
total: suggestions.length,
hasMore: suggestions.length > 100
}
};
}
const EMPTY_COMPLETION_RESULT = {
completion: {
values: [],
hasMore: false
}
};
//# sourceMappingURL=mcp.js.map
@@ -0,0 +1 @@
{"version":3,"file":"zxcvbn-ts.js","sources":["../../../../node_modules/@zxcvbn-ts/dictionary-compression/dist/decompress.mjs","../src/translations.ts","../src/index.ts"],"sourcesContent":["function decompress(encodedString) {\n const decompressedArray = encodedString.split(/([A-Z])/g);\n const decompressedData = [];\n let last = \"\";\n let i;\n for (i = 1; i < decompressedArray.length; i += 2) {\n last = last.slice(0, decompressedArray[i].charCodeAt(0) - 65) + decompressedArray[i + 1];\n decompressedData.push(last);\n }\n return decompressedData;\n}\nexport {\n decompress as default\n};\n//# sourceMappingURL=decompress.mjs.map",null,null],"names":["warnings","straightRow","keyPattern","simpleRepeat","extendedRepeat","sequences","recentYears","dates","topTen","topHundred","common","similarToCommon","wordByItself","namesByThemselves","commonNames","userInputs","pwned","suggestions","l33t","reverseWords","allUppercase","capitalization","associatedYears","repeated","longerKeyboardPattern","anotherWord","useWords","noNeed","timeEstimation","ltSecond","second","seconds","minute","minutes","hour","hours","day","days","month","months","year","years","centuries","dictionary","commonWords","firstnames","lastnames","wikipedia","wordSequences"],"mappings":";;;;EAAA,SAAS,UAAU,CAAC,aAAa,EAAE;EACnC,EAAE,MAAM,iBAAiB,GAAG,aAAa,CAAC,KAAK,CAAC,UAAU,CAAC;EAC3D,EAAE,MAAM,gBAAgB,GAAG,EAAE;EAC7B,EAAE,IAAI,IAAI,GAAG,EAAE;EACf,EAAE,IAAI,CAAC;EACP,EAAE,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,iBAAiB,CAAC,MAAM,EAAE,CAAC,IAAI,CAAC,EAAE;EACpD,IAAI,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,iBAAiB,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC,GAAG,iBAAiB,CAAC,CAAC,GAAG,CAAC,CAAC;EAC5F,IAAI,gBAAgB,CAAC,IAAI,CAAC,IAAI,CAAC;EAC/B,EAAE;EACF,EAAE,OAAO,gBAAgB;EACzB;;;;;;;;;;;;ACVA,qBAAe;EACbA,EAAAA,QAAQ,EAAE;EACRC,IAAAA,WAAW,EAAE,2DAA2D;EACxEC,IAAAA,UAAU,EAAE,4CAA4C;EACxDC,IAAAA,YAAY,EAAE,mDAAmD;EACjEC,IAAAA,cAAc,EACZ,iEAAiE;EACnEC,IAAAA,SAAS,EAAE,0DAA0D;EACrEC,IAAAA,WAAW,EAAE,iCAAiC;EAC9CC,IAAAA,KAAK,EAAE,0BAA0B;EACjCC,IAAAA,MAAM,EAAE,kCAAkC;EAC1CC,IAAAA,UAAU,EAAE,qCAAqC;EACjDC,IAAAA,MAAM,EAAE,mCAAmC;EAC3CC,IAAAA,eAAe,EAAE,8CAA8C;EAC/DC,IAAAA,YAAY,EAAE,iCAAiC;EAC/CC,IAAAA,iBAAiB,EAAE,6CAA6C;EAChEC,IAAAA,WAAW,EAAE,8CAA8C;EAC3DC,IAAAA,UAAU,EAAE,wDAAwD;EACpEC,IAAAA,KAAK,EAAE;KACR;EACDC,EAAAA,WAAW,EAAE;EACXC,IAAAA,IAAI,EAAE,0DAA0D;EAChEC,IAAAA,YAAY,EAAE,2CAA2C;EACzDC,IAAAA,YAAY,EAAE,uCAAuC;EACrDC,IAAAA,cAAc,EAAE,wCAAwC;EACxDd,IAAAA,KAAK,EAAE,qDAAqD;EAC5DD,IAAAA,WAAW,EAAE,qBAAqB;EAClCgB,IAAAA,eAAe,EAAE,2CAA2C;EAC5DjB,IAAAA,SAAS,EAAE,mCAAmC;EAC9CkB,IAAAA,QAAQ,EAAE,sCAAsC;EAChDC,IAAAA,qBAAqB,EACnB,0EAA0E;EAC5EC,IAAAA,WAAW,EAAE,sCAAsC;EACnDC,IAAAA,QAAQ,EAAE,+CAA+C;EACzDC,IAAAA,MAAM,EACJ,uFAAuF;EACzFX,IAAAA,KAAK,EAAE;KACR;EACDY,EAAAA,cAAc,EAAE;EACdC,IAAAA,QAAQ,EAAE,oBAAoB;EAC9BC,IAAAA,MAAM,EAAE,eAAe;EACvBC,IAAAA,OAAO,EAAE,gBAAgB;EACzBC,IAAAA,MAAM,EAAE,eAAe;EACvBC,IAAAA,OAAO,EAAE,gBAAgB;EACzBC,IAAAA,IAAI,EAAE,aAAa;EACnBC,IAAAA,KAAK,EAAE,cAAc;EACrBC,IAAAA,GAAG,EAAE,YAAY;EACjBC,IAAAA,IAAI,EAAE,aAAa;EACnBC,IAAAA,KAAK,EAAE,cAAc;EACrBC,IAAAA,MAAM,EAAE,eAAe;EACvBC,IAAAA,IAAI,EAAE,aAAa;EACnBC,IAAAA,KAAK,EAAE,cAAc;EACrBC,IAAAA,SAAS,EAAE;EACZ;GACF;;ECtDD;AAQA,QAAMC,UAAU,GAAG;EACjB,EAAA,gBAAgB,EAAEC,WAAW;EAC7B,EAAA,eAAe,EAAEC,UAAU;EAC3B,EAAA,cAAc,EAAEC,SAAS;EACzB,EAAA,cAAc,EAAEC,SAAS;IACzB,GAAGC;;;;;;;;;;;;","x_google_ignoreList":[0]}
@@ -0,0 +1,74 @@
"use strict";
var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
// If the importer is in node compatibility mode or this is not an ESM
// file that has been converted to a CommonJS file using a Babel-
// compatible transform (i.e. "__esModule" has not been set), then set
// "default" to the CommonJS "module.exports" for node compatibility.
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
mod
));
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
// packages/react/compose-refs/src/index.ts
var index_exports = {};
__export(index_exports, {
composeRefs: () => composeRefs,
useComposedRefs: () => useComposedRefs
});
module.exports = __toCommonJS(index_exports);
// packages/react/compose-refs/src/compose-refs.tsx
var React = __toESM(require("react"));
function setRef(ref, value) {
if (typeof ref === "function") {
return ref(value);
} else if (ref !== null && ref !== void 0) {
ref.current = value;
}
}
function composeRefs(...refs) {
return (node) => {
let hasCleanup = false;
const cleanups = refs.map((ref) => {
const cleanup = setRef(ref, node);
if (!hasCleanup && typeof cleanup == "function") {
hasCleanup = true;
}
return cleanup;
});
if (hasCleanup) {
return () => {
for (let i = 0; i < cleanups.length; i++) {
const cleanup = cleanups[i];
if (typeof cleanup == "function") {
cleanup();
} else {
setRef(refs[i], null);
}
}
};
}
};
}
function useComposedRefs(...refs) {
return React.useCallback(composeRefs(...refs), refs);
}
//# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
{"version":3,"file":"websocket.d.ts","sourceRoot":"","sources":["../../../src/client/websocket.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACnD,OAAO,EAAE,cAAc,EAAwB,MAAM,aAAa,CAAC;AAInE;;GAEG;AACH,qBAAa,wBAAyB,YAAW,SAAS;IACtD,OAAO,CAAC,OAAO,CAAC,CAAY;IAC5B,OAAO,CAAC,IAAI,CAAM;IAElB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;IACjC,SAAS,CAAC,EAAE,CAAC,OAAO,EAAE,cAAc,KAAK,IAAI,CAAC;gBAElC,GAAG,EAAE,GAAG;IAIpB,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAsChB,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAI5B,IAAI,CAAC,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC;CAW/C"}
@@ -0,0 +1,6 @@
const isEasingArray = (ease) => {
return Array.isArray(ease) && typeof ease[0] !== "number";
};
export { isEasingArray };
//# sourceMappingURL=is-easing-array.mjs.map
@@ -0,0 +1,10 @@
"use strict";
function pad(str, width, alignLeft = true) {
const diff = width - str.length;
if (diff <= 0) {
return str;
}
const padding = " ".repeat(diff);
return alignLeft ? str + padding : padding + str;
}
module.exports = pad;
@@ -0,0 +1,658 @@
/**
* @fileoverview A rule to disallow unnecessary assignments`.
* @author Yosuke Ota
*/
"use strict";
const { findVariable } = require("@eslint-community/eslint-utils");
//------------------------------------------------------------------------------
// Types
//------------------------------------------------------------------------------
/** @typedef {import("estree").Node} ASTNode */
/** @typedef {import("estree").Pattern} Pattern */
/** @typedef {import("estree").Identifier} Identifier */
/** @typedef {import("estree").VariableDeclarator} VariableDeclarator */
/** @typedef {import("estree").AssignmentExpression} AssignmentExpression */
/** @typedef {import("estree").UpdateExpression} UpdateExpression */
/** @typedef {import("estree").Expression} Expression */
/** @typedef {import("eslint-scope").Scope} Scope */
/** @typedef {import("eslint-scope").Variable} Variable */
/** @typedef {import("../linter/code-path-analysis/code-path")} CodePath */
/** @typedef {import("../linter/code-path-analysis/code-path-segment")} CodePathSegment */
//------------------------------------------------------------------------------
// Helpers
//------------------------------------------------------------------------------
/**
* Extract identifier from the given pattern node used on the left-hand side of the assignment.
* @param {Pattern} pattern The pattern node to extract identifier
* @returns {Iterable<Identifier>} The extracted identifier
*/
function* extractIdentifiersFromPattern(pattern) {
switch (pattern.type) {
case "Identifier":
yield pattern;
return;
case "ObjectPattern":
for (const property of pattern.properties) {
yield* extractIdentifiersFromPattern(
property.type === "Property" ? property.value : property,
);
}
return;
case "ArrayPattern":
for (const element of pattern.elements) {
if (!element) {
continue;
}
yield* extractIdentifiersFromPattern(element);
}
return;
case "RestElement":
yield* extractIdentifiersFromPattern(pattern.argument);
return;
case "AssignmentPattern":
yield* extractIdentifiersFromPattern(pattern.left);
// no default
}
}
/**
* Checks whether the given identifier node is evaluated after the assignment identifier.
* @param {AssignmentInfo} assignment The assignment info.
* @param {Identifier} identifier The identifier to check.
* @returns {boolean} `true` if the given identifier node is evaluated after the assignment identifier.
*/
function isIdentifierEvaluatedAfterAssignment(assignment, identifier) {
if (identifier.range[0] < assignment.identifier.range[1]) {
return false;
}
if (
assignment.expression &&
assignment.expression.range[0] <= identifier.range[0] &&
identifier.range[1] <= assignment.expression.range[1]
) {
/*
* The identifier node is in an expression that is evaluated before the assignment.
* e.g. x = id;
* ^^ identifier to check
* ^ assignment identifier
*/
return false;
}
/*
* e.g.
* x = 42; id;
* ^^ identifier to check
* ^ assignment identifier
* let { x, y = id } = obj;
* ^^ identifier to check
* ^ assignment identifier
*/
return true;
}
/**
* Checks whether the given identifier node is used between the assigned identifier and the equal sign.
*
* e.g. let { x, y = x } = obj;
* ^ identifier to check
* ^ assigned identifier
* @param {AssignmentInfo} assignment The assignment info.
* @param {Identifier} identifier The identifier to check.
* @returns {boolean} `true` if the given identifier node is used between the assigned identifier and the equal sign.
*/
function isIdentifierUsedBetweenAssignedAndEqualSign(assignment, identifier) {
if (!assignment.expression) {
return false;
}
return (
assignment.identifier.range[1] <= identifier.range[0] &&
identifier.range[1] <= assignment.expression.range[0]
);
}
//------------------------------------------------------------------------------
// Rule Definition
//------------------------------------------------------------------------------
/** @type {import('../types').Rule.RuleModule} */
module.exports = {
meta: {
type: "problem",
docs: {
description:
"Disallow variable assignments when the value is not used",
recommended: true,
url: "https://eslint.org/docs/latest/rules/no-useless-assignment",
},
schema: [],
messages: {
unnecessaryAssignment:
"The value assigned to '{{name}}' is not used in subsequent statements.",
},
},
create(context) {
const sourceCode = context.sourceCode;
/**
* @typedef {Object} ScopeStack
* @property {CodePath} codePath The code path of this scope stack.
* @property {Scope} scope The scope of this scope stack.
* @property {ScopeStack} upper The upper scope stack.
* @property {Record<string, ScopeStackSegmentInfo>} segments The map of ScopeStackSegmentInfo.
* @property {Set<CodePathSegment>} currentSegments The current CodePathSegments.
* @property {Map<Variable, AssignmentInfo[]>} assignments The map of list of AssignmentInfo for each variable.
* @property {Array} tryStatementBlocks The array of TryStatement block nodes in this scope stack.
*/
/**
* @typedef {Object} ScopeStackSegmentInfo
* @property {CodePathSegment} segment The code path segment.
* @property {Identifier|null} first The first identifier that appears within the segment.
* @property {Identifier|null} last The last identifier that appears within the segment.
* `first` and `last` are used to determine whether an identifier exists within the segment position range.
* Since it is used as a range of segments, we should originally hold all nodes, not just identifiers,
* but since the only nodes to be judged are identifiers, it is sufficient to have a range of identifiers.
*/
/**
* @typedef {Object} AssignmentInfo
* @property {Variable} variable The variable that is assigned.
* @property {Identifier} identifier The identifier that is assigned.
* @property {VariableDeclarator|AssignmentExpression|UpdateExpression} node The node where the variable was updated.
* @property {Expression|null} expression The expression that is evaluated before the assignment.
* @property {CodePathSegment[]} segments The code path segments where the assignment was made.
*/
/** @type {ScopeStack} */
let scopeStack = null;
/** @type {Set<Scope>} */
const codePathStartScopes = new Set();
/**
* Gets the scope of code path start from given scope
* @param {Scope} scope The initial scope
* @returns {Scope} The scope of code path start
* @throws {Error} Unexpected error
*/
function getCodePathStartScope(scope) {
let target = scope;
while (target) {
if (codePathStartScopes.has(target)) {
return target;
}
target = target.upper;
}
// Should be unreachable
return null;
}
/**
* Verify the given scope stack.
* @param {ScopeStack} target The scope stack to verify.
* @returns {void}
*/
function verify(target) {
/**
* Checks whether the given identifier is used in the segment.
* @param {CodePathSegment} segment The code path segment.
* @param {Identifier} identifier The identifier to check.
* @returns {boolean} `true` if the identifier is used in the segment.
*/
function isIdentifierUsedInSegment(segment, identifier) {
const segmentInfo = target.segments[segment.id];
return (
segmentInfo.first &&
segmentInfo.last &&
segmentInfo.first.range[0] <= identifier.range[0] &&
identifier.range[1] <= segmentInfo.last.range[1]
);
}
/**
* Verifies whether the given assignment info is an used assignment.
* Report if it is an unused assignment.
* @param {AssignmentInfo} targetAssignment The assignment info to verify.
* @param {AssignmentInfo[]} allAssignments The list of all assignment info for variables.
* @returns {void}
*/
function verifyAssignmentIsUsed(targetAssignment, allAssignments) {
// Skip assignment if it is in a try block.
const isAssignmentInTryBlock = target.tryStatementBlocks.some(
tryBlock =>
tryBlock.range[0] <=
targetAssignment.identifier.range[0] &&
targetAssignment.identifier.range[1] <=
tryBlock.range[1],
);
if (isAssignmentInTryBlock) {
return;
}
/**
* @typedef {Object} SubsequentSegmentData
* @property {CodePathSegment} segment The code path segment
* @property {AssignmentInfo} [assignment] The first occurrence of the assignment within the segment.
* There is no need to check if the variable is used after this assignment,
* as the value it was assigned will be used.
*/
/**
* Information used in `getSubsequentSegments()`.
* To avoid unnecessary iterations, cache information that has already been iterated over,
* and if additional iterations are needed, start iterating from the retained position.
*/
const subsequentSegmentData = {
/**
* Cache of subsequent segment information list that have already been iterated.
* @type {SubsequentSegmentData[]}
*/
results: [],
/**
* Subsequent segments that have already been iterated on. Used to avoid infinite loops.
* @type {Set<CodePathSegment>}
*/
subsequentSegments: new Set(),
/**
* Unexplored code path segment.
* If additional iterations are needed, consume this information and iterate.
* @type {CodePathSegment[]}
*/
queueSegments: targetAssignment.segments.flatMap(
segment => segment.nextSegments,
),
};
/**
* Gets the subsequent segments from the segment of
* the assignment currently being validated (targetAssignment).
* @returns {Iterable<SubsequentSegmentData>} the subsequent segments
*/
function* getSubsequentSegments() {
yield* subsequentSegmentData.results;
while (subsequentSegmentData.queueSegments.length > 0) {
const nextSegment =
subsequentSegmentData.queueSegments.shift();
if (
subsequentSegmentData.subsequentSegments.has(
nextSegment,
)
) {
continue;
}
subsequentSegmentData.subsequentSegments.add(
nextSegment,
);
const assignmentInSegment = allAssignments.find(
otherAssignment =>
otherAssignment.segments.includes(
nextSegment,
) &&
!isIdentifierUsedBetweenAssignedAndEqualSign(
otherAssignment,
targetAssignment.identifier,
),
);
if (!assignmentInSegment) {
/*
* Stores the next segment to explore.
* If `assignmentInSegment` exists,
* we are guarding it because we don't need to explore the next segment.
*/
subsequentSegmentData.queueSegments.push(
...nextSegment.nextSegments,
);
}
/** @type {SubsequentSegmentData} */
const result = {
segment: nextSegment,
assignment: assignmentInSegment,
};
subsequentSegmentData.results.push(result);
yield result;
}
}
if (
targetAssignment.variable.references.some(ref => {
const type = ref.identifier.type;
return (
type !== "Identifier" && type !== "JSXIdentifier"
);
})
) {
/**
* Skip checking for a variable that has at least one non-identifier reference.
* It's generated by plugins and cannot be handled reliably in the core rule.
*/
return;
}
const readReferences =
targetAssignment.variable.references.filter(reference =>
reference.isRead(),
);
if (!readReferences.length) {
/*
* It is not just an unnecessary assignment, but an unnecessary (unused) variable
* and thus should not be reported by this rule because it is reported by `no-unused-vars`.
*/
return;
}
/**
* Other assignment on the current segment and after current assignment.
*/
const otherAssignmentAfterTargetAssignment =
allAssignments.find(assignment => {
if (
assignment === targetAssignment ||
(assignment.segments.length &&
assignment.segments.every(
segment =>
!targetAssignment.segments.includes(
segment,
),
))
) {
return false;
}
if (
isIdentifierEvaluatedAfterAssignment(
targetAssignment,
assignment.identifier,
)
) {
return true;
}
if (
assignment.expression &&
assignment.expression.range[0] <=
targetAssignment.identifier.range[0] &&
targetAssignment.identifier.range[1] <=
assignment.expression.range[1]
) {
/*
* The target assignment is in an expression that is evaluated before the assignment.
* e.g. x=(x=1);
* ^^^ targetAssignment
* ^^^^^^^ assignment
*/
return true;
}
return false;
});
for (const reference of readReferences) {
/*
* If the scope of the reference is outside the current code path scope,
* we cannot track whether this assignment is not used.
* For example, it can also be called asynchronously.
*/
if (
target.scope !== getCodePathStartScope(reference.from)
) {
return;
}
// Checks if it is used in the same segment as the target assignment.
if (
isIdentifierEvaluatedAfterAssignment(
targetAssignment,
reference.identifier,
) &&
(isIdentifierUsedBetweenAssignedAndEqualSign(
targetAssignment,
reference.identifier,
) ||
targetAssignment.segments.some(segment =>
isIdentifierUsedInSegment(
segment,
reference.identifier,
),
))
) {
if (
otherAssignmentAfterTargetAssignment &&
isIdentifierEvaluatedAfterAssignment(
otherAssignmentAfterTargetAssignment,
reference.identifier,
)
) {
// There was another assignment before the reference. Therefore, it has not been used yet.
continue;
}
// Uses in statements after the written identifier.
return;
}
if (otherAssignmentAfterTargetAssignment) {
/*
* The assignment was followed by another assignment in the same segment.
* Therefore, there is no need to check the next segment.
*/
continue;
}
// Check subsequent segments.
for (const subsequentSegment of getSubsequentSegments()) {
if (
isIdentifierUsedInSegment(
subsequentSegment.segment,
reference.identifier,
)
) {
if (
subsequentSegment.assignment &&
isIdentifierEvaluatedAfterAssignment(
subsequentSegment.assignment,
reference.identifier,
)
) {
// There was another assignment before the reference. Therefore, it has not been used yet.
continue;
}
// It is used
return;
}
}
}
context.report({
node: targetAssignment.identifier,
messageId: "unnecessaryAssignment",
data: { name: targetAssignment.identifier.name },
});
}
// Verify that each assignment in the code path is used.
for (const assignments of target.assignments.values()) {
assignments.sort(
(a, b) => a.identifier.range[0] - b.identifier.range[0],
);
for (const assignment of assignments) {
verifyAssignmentIsUsed(assignment, assignments);
}
}
}
return {
onCodePathStart(codePath, node) {
const scope = sourceCode.getScope(node);
scopeStack = {
upper: scopeStack,
codePath,
scope,
segments: Object.create(null),
currentSegments: new Set(),
assignments: new Map(),
tryStatementBlocks: [],
};
codePathStartScopes.add(scopeStack.scope);
},
onCodePathEnd() {
verify(scopeStack);
scopeStack = scopeStack.upper;
},
onCodePathSegmentStart(segment) {
const segmentInfo = { segment, first: null, last: null };
scopeStack.segments[segment.id] = segmentInfo;
scopeStack.currentSegments.add(segment);
},
onCodePathSegmentEnd(segment) {
scopeStack.currentSegments.delete(segment);
},
TryStatement(node) {
scopeStack.tryStatementBlocks.push(node.block);
},
"Identifier, JSXIdentifier"(node) {
for (const segment of scopeStack.currentSegments) {
const segmentInfo = scopeStack.segments[segment.id];
if (!segmentInfo.first) {
segmentInfo.first = node;
}
segmentInfo.last = node;
}
},
"VariableDeclarator[init!=null], AssignmentExpression, UpdateExpression:exit"(
node,
) {
if (scopeStack.currentSegments.size === 0) {
// Ignore unreachable segments
return;
}
const assignments = scopeStack.assignments;
let pattern;
let expression = null;
if (node.type === "VariableDeclarator") {
pattern = node.id;
expression = node.init;
} else if (node.type === "AssignmentExpression") {
pattern = node.left;
expression = node.right;
} else {
// UpdateExpression
pattern = node.argument;
}
for (const identifier of extractIdentifiersFromPattern(
pattern,
)) {
const scope = sourceCode.getScope(identifier);
/** @type {Variable} */
const variable = findVariable(scope, identifier);
if (!variable) {
continue;
}
// We don't know where global variables are used.
if (
variable.scope.type === "global" &&
variable.defs.length === 0
) {
continue;
}
/*
* If the scope of the variable is outside the current code path scope,
* we cannot track whether this assignment is not used.
*/
if (
scopeStack.scope !==
getCodePathStartScope(variable.scope)
) {
continue;
}
// Variables marked by `markVariableAsUsed()` or
// exported by "exported" block comment.
if (variable.eslintUsed) {
continue;
}
// Variables exported by ESM export syntax
if (variable.scope.type === "module") {
if (
variable.defs.some(
def =>
(def.type === "Variable" &&
def.parent.parent.type ===
"ExportNamedDeclaration") ||
(def.type === "FunctionName" &&
(def.node.parent.type ===
"ExportNamedDeclaration" ||
def.node.parent.type ===
"ExportDefaultDeclaration")) ||
(def.type === "ClassName" &&
(def.node.parent.type ===
"ExportNamedDeclaration" ||
def.node.parent.type ===
"ExportDefaultDeclaration")),
)
) {
continue;
}
if (
variable.references.some(
reference =>
reference.identifier.parent.type ===
"ExportSpecifier",
)
) {
// It have `export { ... }` reference.
continue;
}
}
let list = assignments.get(variable);
if (!list) {
list = [];
assignments.set(variable, list);
}
list.push({
variable,
identifier,
node,
expression,
segments: [...scopeStack.currentSegments],
});
}
},
};
},
};
@@ -0,0 +1,717 @@
flf2a$ 7 6 20 15 2
Rounded by Nick Miners N.M.Miners@durham.ac.uk
May 1994
$$#
$$#
$$#
$$#
$$#
$$#
$$##
_ #
| |#
| |#
|_|#
_ #
|_|#
##
_ _ #
( )( )#
|/ \|#
#
#
#
##
_ _ #
_| U |_ #
(_ _)#
_| O |_ #
(_ _)#
|_n_| #
##
_ #
_| |_ #
| ___)#
|___ |#
(_ _|#
|_| #
##
_ _ #
(_) | |#
/ / #
/ / #
/ / _ #
|_| (_)#
##
___ #
/ _ \ #
( (_) ) #
) _ ( #
( (/ \ #
\__/\_)#
##
_ #
( )#
|/ #
#
#
#
##
_ #
/ )#
| | #
| | #
| | #
\_)#
##
_ #
( \ #
| |#
| |#
| |#
(_/ #
##
_ #
_ | | _ #
( \| |/ )#
) ( #
(_/| |\_)#
|_| #
##
#
_ #
_| |_ #
(_ _)#
|_| #
#
##
#
#
#
#
_ #
( )#
|/ ##
#
#
_____ #
(_____)#
#
#
##
#
#
#
#
_ #
(_)#
##
_ #
| |#
/ / #
/ / #
/ / #
|_| #
##
_____ #
(_____) #
_ __ _ #
| |/ /| |#
| /_| |#
\_____/ #
##
___ #
(___) #
_ #
| | #
_| |_ #
(_____)#
##
______ #
(_____ \ #
____) )#
/ ____/ #
| (_____ #
|_______)#
##
______ #
(_____ \ #
_____) )#
(_____ ( #
_____) )#
(______/ #
##
_ _ #
| | (_)#
| |_____ #
|_____ |#
| |#
|_|#
##
_______ #
(_______)#
______ #
(_____ \ #
_____) )#
(______/ #
##
_______ #
(_______)#
______ #
| ___ \ #
| |___) )#
|______/ #
##
_______ #
(_______)#
_ #
/ ) #
/ / #
(_/ #
##
_____ #
(_____) #
_____ #
/ ___ \ #
( (___) )#
\_____/ #
##
_______ #
(_______)#
_______ #
(_____ |#
| |#
|_|#
##
#
#
_ #
(_)#
_ #
(_)#
##
#
#
_ #
(_)#
_ #
( )#
|/ ##
#
_ #
/ )#
( ( #
\_)#
#
##
#
_____ #
(_____)#
_____ #
(_____)#
#
##
#
_ #
( \ #
) )#
(_/ #
#
##
___ #
/ _ \ #
(_( ) )#
(_/ #
_ #
(_) #
##
_____ #
/ __ \ #
| | / )#
| | \__/ #
| |____ #
\_____) #
##
_______ #
(_______)#
_______ #
| ___ |#
| | | |#
|_| |_|#
##
______ #
(____ \ #
____) )#
| __ ( #
| |__) )#
|______/ #
##
_______ #
(_______)#
_ #
| | #
| |_____ #
\______)#
##
______ #
(______) #
_ _ #
| | | |#
| |__/ / #
|_____/ #
##
_______ #
(_______)#
_____ #
| ___) #
| |_____ #
|_______)#
##
_______ #
(_______)#
_____ #
| ___) #
| | #
|_| #
##
_______ #
(_______)#
_ ___ #
| | (_ |#
| |___) |#
\_____/ #
##
_ _ #
(_) (_)#
_______ #
| ___ |#
| | | |#
|_| |_|#
##
_ #
| |#
| |#
| |#
| |#
|_|#
##
_______ #
(_______)#
_ #
_ | | #
| |_| | #
\___/ #
##
_ _ #
(_) | |#
_____| |#
| _ _)#
| | \ \ #
|_| \_)#
##
_ #
(_) #
_ #
| | #
| |_____ #
|_______)#
##
_______ #
(_______)#
_ _ _ #
| ||_|| |#
| | | |#
|_| |_|#
##
_______ #
(_______)#
_ _ #
| | | |#
| | | |#
|_| |_|#
##
_______ #
(_______)#
_ _ #
| | | |#
| |___| |#
\_____/ #
##
______ #
(_____ \ #
_____) )#
| ____/ #
| | #
|_| #
##
_______ #
(_______)#
_ _ #
| | | | #
| |__| | #
\______)#
##
______ #
(_____ \ #
_____) )#
| __ / #
| | \ \ #
|_| |_|#
##
______ #
/ _____)#
( (____ #
\____ \ #
_____) )#
(______/ #
##
_______ #
(_______)#
_ #
| | #
| | #
|_| #
##
_ _ #
(_) (_)#
_ _ #
| | | |#
| |___| |#
\_____/ #
##
_ _ #
(_) (_)#
_ _ #
| | | |#
\ \ / / #
\___/ #
##
_ _ _ #
(_)(_)(_)#
_ _ _ #
| || || |#
| || || |#
\_____/ #
##
_ _ #
(_) (_)#
___ #
| | #
/ / \ \ #
|_| |_|#
##
_ _ #
| | | |#
| |___| |#
|_____ |#
_____| |#
(_______|#
##
_______ #
(_______)#
__ #
/ / #
/ /____ #
(_______)#
##
___ #
| _)#
| | #
| | #
| |_ #
|___)#
##
_ #
| | #
\ \ #
\ \ #
\ \ #
|_|#
##
___ #
(_ |#
| |#
| |#
_| |#
(___|#
##
__ #
/ \ #
(_/\_)#
#
#
#
##
#
#
#
#
_______ #
(_______)#
##
_ #
( )#
\|#
#
#
#
##
#
#
_____ #
(____ |#
/ ___ |#
\_____|#
##
_ #
| | #
| |__ #
| _ \ #
| |_) )#
|____/ #
##
#
#
____ #
/ ___)#
( (___ #
\____)#
##
_ #
| |#
__| |#
/ _ |#
( (_| |#
\____|#
##
#
#
_____ #
| ___ |#
| ____|#
|_____)#
##
___ #
/ __)#
_| |__ #
(_ __)#
| | #
|_| #
##
#
#
____ #
/ _ |#
( (_| |#
\___ |#
(_____|##
_ #
| | #
| |__ #
| _ \ #
| | | |#
|_| |_|#
##
_ #
(_)#
_ #
| |#
| |#
|_|#
##
_ #
(_)#
_ #
| |#
| |#
_| |#
(__/ ##
_ #
| | #
| | _ #
| |_/ )#
| _ ( #
|_| \_)#
##
_ #
| | #
| | #
| | #
| | #
\_)#
##
#
#
____ #
| \ #
| | | |#
|_|_|_|#
##
#
#
____ #
| _ \ #
| | | |#
|_| |_|#
##
#
#
___ #
/ _ \ #
| |_| |#
\___/ #
##
#
#
____ #
| _ \ #
| |_| |#
| __/ #
|_| ##
#
#
____ #
/ _ |#
| |_| |#
\__ |#
|_|##
#
#
____ #
/ ___)#
| | #
|_| #
##
#
#
___ #
/___)#
|___ |#
(___/ #
##
#
_ #
_| |_ #
(_ _)#
| |_ #
\__)#
##
#
#
_ _ #
| | | |#
| |_| |#
|____/ #
##
#
#
_ _ #
| | | |#
\ V / #
\_/ #
##
#
#
_ _ _ #
| | | |#
| | | |#
\___/ #
##
#
#
_ _ #
( \ / )#
) X ( #
(_/ \_)#
##
#
#
_ _ #
| | | |#
| |_| |#
\__ |#
(____/ ##
#
#
_____ #
(___ )#
/ __/ #
(_____)#
##
__ #
/ _)#
| | #
( ( #
| |_ #
\__)#
##
_ #
| |#
|_|#
_ #
| |#
|_|#
##
__ #
(_ \ #
| | #
) )#
_| | #
(__/ #
##
__ _ #
/ \/ )#
(_/\__/ #
#
#
#
##
_______ #
(_)___(_)#
_______ #
| ___ |#
| | | |#
|_| |_|#
##
_______ #
(_)___(_)#
_ _ #
| | | |#
| |___| |#
\_____/ #
##
_ _ #
(_) (_)#
_ _ #
| | | |#
| |___| |#
\_____/ #
##
_ _ #
(_) (_)#
_____ #
(____ |#
/ ___ |#
\_____|#
##
_ _ #
(_) (_)#
___ #
/ _ \ #
| |_| |#
\___/ #
##
_ _ #
(_) (_)#
_ _ #
| | | |#
| |_| |#
|____/ #
##
___ #
/ _ \ #
| ( ) )#
| |( ( #
| | ) )#
|_|(_/ #
##