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,77 @@
var Promise = require('any-promise')
var assert = require('assert')
module.exports = thenify
/**
* Turn async functions into promises
*
* @param {Function} fn
* @return {Function}
* @api public
*/
function thenify(fn, options) {
assert(typeof fn === 'function')
return createWrapper(fn, options)
}
/**
* Turn async functions into promises and backward compatible with callback
*
* @param {Function} fn
* @return {Function}
* @api public
*/
thenify.withCallback = function (fn, options) {
assert(typeof fn === 'function')
options = options || {}
options.withCallback = true
return createWrapper(fn, options)
}
function createCallback(resolve, reject, multiArgs) {
// default to true
if (multiArgs === undefined) multiArgs = true
return function(err, value) {
if (err) return reject(err)
var length = arguments.length
if (length <= 2 || !multiArgs) return resolve(value)
if (Array.isArray(multiArgs)) {
var values = {}
for (var i = 1; i < length; i++) values[multiArgs[i - 1]] = arguments[i]
return resolve(values)
}
var values = new Array(length - 1)
for (var i = 1; i < length; ++i) values[i - 1] = arguments[i]
resolve(values)
}
}
function createWrapper(fn, options) {
options = options || {}
var name = fn.name;
name = (name || '').replace(/\s|bound(?!$)/g, '')
var newFn = function () {
var self = this
var len = arguments.length
if (options.withCallback) {
var lastType = typeof arguments[len - 1]
if (lastType === 'function') return fn.apply(self, arguments)
}
var args = new Array(len + 1)
for (var i = 0; i < len; ++i) args[i] = arguments[i]
var lastIndex = i
return new Promise(function (resolve, reject) {
args[lastIndex] = createCallback(resolve, reject, options.multiArgs)
fn.apply(self, args)
})
}
Object.defineProperty(newFn, 'name', { value: name })
return newFn
}
@@ -0,0 +1 @@
module.exports={C:{"52":0.01557,"78":0.01038,"115":0.1401,"120":0.00519,"121":0.01038,"124":0.00519,"125":0.01038,"128":0.00519,"132":0.00519,"134":0.00519,"136":0.00519,"140":0.0467,"142":0.00519,"143":0.00519,"146":0.00519,"147":0.00519,"148":0.00519,"149":0.00519,"150":0.01038,"151":0.01038,"152":0.03113,"153":0.03632,"154":0.35285,"155":1.06375,"156":1.00667,"157":0.02076,_:"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 122 123 126 127 129 130 131 133 135 137 138 139 141 144 145 158 159 160 3.5 3.6"},D:{"39":0.0467,"40":0.0467,"41":0.0467,"42":0.0467,"43":0.0467,"44":0.0467,"45":0.0467,"46":0.0467,"47":0.0467,"48":0.0467,"49":0.06227,"50":0.0467,"51":0.0467,"52":0.0467,"53":0.0467,"54":0.0467,"55":0.0467,"56":0.0467,"57":0.0467,"58":0.0467,"59":0.0467,"60":0.0467,"61":0.00519,"70":0.02076,"79":0.00519,"81":0.01038,"83":0.00519,"85":0.00519,"86":0.01038,"89":0.00519,"90":0.00519,"91":0.00519,"93":0.00519,"95":0.02076,"98":0.00519,"100":0.00519,"101":0.01038,"103":0.02595,"104":0.00519,"105":0.00519,"106":0.01557,"107":0.01038,"108":0.01038,"109":0.4722,"110":0.00519,"111":0.00519,"112":0.00519,"113":0.00519,"114":0.01038,"115":0.00519,"116":0.05708,"117":0.00519,"118":0.01557,"119":0.06746,"120":0.02595,"121":0.02595,"122":0.02076,"123":0.01038,"124":0.0467,"125":0.0467,"126":0.02595,"127":0.02595,"128":0.04151,"129":0.01038,"130":0.01557,"131":0.0467,"132":0.02076,"133":0.05189,"134":0.05189,"135":0.0467,"136":0.0467,"137":0.07784,"138":0.17643,"139":0.0467,"140":0.08302,"141":0.06746,"142":0.21794,"143":0.02595,"144":0.07784,"145":0.03113,"146":0.05189,"147":0.09859,"148":1.20385,"149":0.1868,"150":0.43588,"151":1.58783,"152":8.92508,"153":6.57446,"154":1.36471,"155":0.05708,"156":0.01038,_:"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 62 63 64 65 66 67 68 69 71 72 73 74 75 76 77 78 80 84 87 88 92 94 96 97 99 102 157"},F:{"63":0.01038,"90":0.00519,"95":0.00519,"101":0.04151,"102":0.00519,"106":0.00519,"125":0.01038,"133":0.00519,"134":0.02076,"135":0.23351,_:"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 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 91 92 93 94 96 97 98 99 100 103 104 105 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 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:{"17":0.00519,"92":0.01038,"109":0.1868,"113":0.00519,"115":0.00519,"118":0.00519,"119":0.00519,"120":0.00519,"121":0.00519,"122":0.01038,"123":0.00519,"124":0.00519,"126":0.00519,"127":0.00519,"128":0.00519,"129":0.00519,"130":0.00519,"131":0.01038,"132":0.00519,"133":0.01038,"134":0.01038,"135":0.01038,"136":0.00519,"137":0.01038,"138":0.01557,"139":0.01038,"140":0.02076,"141":0.01557,"142":0.01557,"143":0.02076,"144":0.02076,"145":0.02595,"146":0.04151,"147":0.03632,"148":0.0467,"149":0.06227,"150":0.17643,"151":0.50852,"152":5.6612,"153":5.91027,"154":1.58783,_:"12 13 14 15 16 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 108 110 111 112 114 116 117 125"},E:{"13":0.00519,"14":0.02076,"27":0.10897,_:"4 5 6 7 8 9 10 11 12 15 3.1 3.2 5.1 6.1 7.1 9.1 10.1 15.1 16.0 27.1 27.2 TP","11.1":0.00519,"12.1":0.00519,"13.1":0.02595,"14.1":0.02595,"15.2-15.3":0.00519,"15.4":0.00519,"15.5":0.01038,"15.6":0.09859,"16.1":0.01038,"16.2":0.01038,"16.3":0.00519,"16.4":0.01038,"16.5":0.01038,"16.6":0.10378,"17.0":0.00519,"17.1":0.10897,"17.2":0.00519,"17.3":0.00519,"17.4":0.01557,"17.5":0.01557,"17.6":0.11935,"18.0":0.01038,"18.1":0.02595,"18.2":0.00519,"18.3":0.03113,"18.4":0.01038,"18.5-18.7":0.03113,"26.0":0.03113,"26.1":0.02076,"26.2":0.04151,"26.3":0.05708,"26.4":0.04151,"26.5":0.24388,"26.6":1.17271},G:{"8":0,"3.2":0,"4.0-4.1":0,"4.2-4.3":0.00225,"5.0-5.1":0.00225,"6.0-6.1":0,"7.0-7.1":0.0045,"8.1-8.4":0,"9.0-9.2":0,"9.3":0,"10.0-10.2":0,"10.3":0.0225,"11.0-11.2":0.00225,"11.3-11.4":0.0045,"12.0-12.1":0,"12.2-12.5":0.05849,"13.0-13.1":0,"13.2":0.01125,"13.3":0,"13.4-13.7":0.00225,"14.0-14.4":0.009,"14.5-14.8":0.0135,"15.0-15.1":0.0135,"15.2-15.3":0.009,"15.4":0.01125,"15.5":0.0135,"15.6-15.8":0.29245,"16.0":0.0225,"16.1":0.04049,"16.2":0.0225,"16.3":0.04949,"16.4":0.01125,"16.5":0.018,"16.6-16.7":0.40718,"17.0":0.01575,"17.1":0.0225,"17.2":0.0225,"17.3":0.03374,"17.4":0.04724,"17.5":0.09223,"17.6-17.7":0.23846,"18.0":0.04949,"18.1":0.09898,"18.2":0.13498,"18.3":0.23396,"18.4":0.14622,"18.5-18.7":3.02123,"26.0":0.14622,"26.1":0.14847,"26.2":0.38693,"26.3":0.41843,"26.4":0.30595,"26.5":2.04939,"26.6":12.64506,"27.0":0.96958,"27.1":0,"27.2":0.02475},P:{"27":0.00Line truncated
@@ -0,0 +1,20 @@
/**
* @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 GitPullRequestClosed = createLucideIcon("GitPullRequestClosed", [
["circle", { cx: "6", cy: "6", r: "3", key: "1lh9wr" }],
["path", { d: "M6 9v12", key: "1sc30k" }],
["path", { d: "m21 3-6 6", key: "16nqsk" }],
["path", { d: "m21 9-6-6", key: "9j17rh" }],
["path", { d: "M18 11.5V15", key: "65xf6f" }],
["circle", { cx: "18", cy: "18", r: "3", key: "1xkwt0" }]
]);
export { GitPullRequestClosed as default };
//# sourceMappingURL=git-pull-request-closed.js.map
@@ -0,0 +1 @@
module.exports={C:{"4":0.00283,"89":0.00283,"115":0.0311,"120":0.47211,"121":0.92726,"122":0.00283,"123":0.01696,"124":0.01696,"125":0.00565,"127":0.00283,"129":0.00283,"130":0.00283,"131":0.00283,"132":0.00283,"133":0.00848,"134":0.00283,"135":0.00283,"136":0.00565,"137":0.00283,"138":0.00283,"139":0.00283,"140":0.01414,"141":0.00283,"142":0.00283,"143":0.00283,"144":0.00283,"146":0.00283,"147":0.00283,"148":0.00283,"149":0.00283,"150":0.05371,"151":0.00565,"152":0.01131,"153":0.02544,"154":0.15549,"155":0.30814,"156":0.31662,"157":0.01414,_:"2 3 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 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 128 145 158 159 160 3.5 3.6"},D:{"38":0.00283,"63":0.00283,"65":0.00283,"66":0.00283,"68":0.00283,"70":0.00283,"73":0.00283,"75":0.00283,"79":0.00848,"81":0.00565,"87":0.00848,"97":0.00565,"101":0.00283,"103":0.16114,"104":0.14983,"105":0.14983,"106":0.14983,"107":0.14983,"108":0.15266,"109":0.29966,"110":0.14983,"111":0.15266,"112":0.14418,"113":0.00283,"114":0.00283,"116":0.30814,"117":0.147,"118":0.88768,"119":0.91878,"120":1.08557,"121":0.00848,"122":0.03392,"123":0.01979,"124":0.15831,"125":0.00565,"126":0.00848,"127":0.00565,"128":0.04241,"129":0.00565,"130":0.01696,"131":0.31097,"132":0.00565,"133":0.3873,"134":0.11308,"135":0.11025,"136":0.11591,"137":0.11591,"138":0.13287,"139":0.11873,"140":0.12722,"141":0.13004,"142":0.39013,"143":0.00848,"144":0.18658,"145":0.1781,"146":0.2827,"147":0.01979,"148":0.26574,"149":0.21485,"150":0.20072,"151":3.52527,"152":4.05109,"153":3.17472,"154":0.80852,"155":0.00848,_:"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 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 64 67 69 71 72 74 76 77 78 80 83 84 85 86 88 89 90 91 92 93 94 95 96 98 99 100 102 115 156 157"},F:{"54":0.00283,"55":0.00283,"56":0.00283,"89":0.00283,"90":0.00283,"95":0.00565,"101":0.00283,"105":0.00848,"106":0.01414,"107":0.00565,"113":0.00283,"114":0.00283,"115":0.00283,"116":0.00565,"119":0.00283,"120":0.00283,"121":0.00565,"122":0.00848,"133":0.00283,"134":0.06219,"135":0.2827,_:"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 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 91 92 93 94 96 97 98 99 100 102 103 104 108 109 110 111 112 117 118 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:{"92":0.00283,"109":0.01414,"119":0.4608,"120":0.4608,"122":0.01414,"123":0.00565,"124":0.00283,"131":0.00283,"132":0.00565,"133":0.00283,"134":0.00283,"135":0.00283,"136":0.00283,"137":0.00283,"138":0.00283,"139":0.00283,"140":0.00848,"141":0.00283,"142":0.00283,"143":0.00283,"144":0.00283,"145":0.01131,"146":0.00565,"147":0.01131,"148":0.01414,"149":0.01131,"150":0.02827,"151":0.09895,"152":0.82831,"153":0.93574,"154":0.22616,_:"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 108 110 111 112 113 114 115 116 117 118 121 125 126 127 128 129 130"},E:{"27":0.04523,_:"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 13.1 15.1 15.2-15.3 15.4 15.5 16.0 16.2 16.3 16.4 17.0 18.0 18.2 27.1 27.2 TP","14.1":0.00283,"15.6":0.01131,"16.1":0.00283,"16.5":0.00283,"16.6":0.01131,"17.1":0.01979,"17.2":0.00283,"17.3":0.00283,"17.4":0.00565,"17.5":0.00565,"17.6":0.01414,"18.1":0.00283,"18.3":0.02262,"18.4":0.00848,"18.5-18.7":0.00283,"26.0":0.00283,"26.1":0.00565,"26.2":0.01696,"26.3":0.01131,"26.4":0.01696,"26.5":0.05937,"26.6":0.24595},G:{"8":0,"3.2":0,"4.0-4.1":0,"4.2-4.3":0.00069,"5.0-5.1":0.00069,"6.0-6.1":0,"7.0-7.1":0.00138,"8.1-8.4":0,"9.0-9.2":0,"9.3":0,"10.0-10.2":0,"10.3":0.00689,"11.0-11.2":0.00069,"11.3-11.4":0.00138,"12.0-12.1":0,"12.2-12.5":0.01792,"13.0-13.1":0,"13.2":0.00345,"13.3":0,"13.4-13.7":0.00069,"14.0-14.4":0.00276,"14.5-14.8":0.00414,"15.0-15.1":0.00414,"15.2-15.3":0.00276,"15.4":0.00345,"15.5":0.00414,"15.6-15.8":0.08961,"16.0":0.00689,"16.1":0.01241,"16.2":0.00689,"16.3":0.01517,"16.4":0.00345,"16.5":0.00551,"16.6-16.7":0.12477,"17.0":0.00483,"17.1":0.00689,"17.2":0.00689,"17.3":0.01034,"17.4":0.01448,"17.5":0.02826,"17.6-17.7":0.07307,"18.0":0.01517,"18.1":0.03033,"18.2":0.04136,"18.3":0.07169,"18.4":0.04481,"18.5-18.7":0.92576,"26.0":0.04481,"26.1":0.0455,"26.2":0.11856,"26.3":0.12821,"26.4":0.09375,"26.5":0.62798,"26.6":3.8747,"27.0":0.2971,"27.1":0,"27.2":0.00758},P:{"21":0.01003,"22":0.01003,"23":0.01003,"24":0.01003,"25":0.01003,"26":0.08026,"27":0.01003,"28":0.04013,"29":0.08026,"30":1.29427,_:"4 20 5.0-5.4 6.2-6.4 8.2 9.2 10.1 11.1-11.2 12.0 13.0 14.0 15.0 16.0 17.0 18.0 19.0","7.2-7.4":0.0301},I:{"0"Line truncated
@@ -0,0 +1,480 @@
"use client";
import { useForwardedRef, useIntersectionObserver } from "./utils.js";
import { useHydrated } from "./ClientOnly.js";
import { useRouter } from "./useRouter.js";
import { deepEqual, exactPathTest, functionalUpdate, hasKeys, isDangerousProtocol, preloadWarning, removeTrailingSlash } from "@tanstack/router-core";
import * as React$1 from "react";
import { jsx } from "react/jsx-runtime";
import { useStore } from "@tanstack/react-store";
import { isServer } from "@tanstack/router-core/isServer";
import { flushSync } from "react-dom";
//#region src/link.tsx
/**
* Build anchor-like props for declarative navigation and preloading.
*
* Returns stable `href`, event handlers and accessibility props derived from
* router options and active state. Used internally by `Link` and custom links.
*
* Options cover `to`, `params`, `search`, `hash`, `state`, `preload`,
* `activeProps`, `inactiveProps`, and more.
*
* @returns React anchor props suitable for `<a>` or custom components.
* @link https://tanstack.com/router/latest/docs/framework/react/api/router/useLinkPropsHook
*/
function useLinkProps(options, forwardedRef) {
const router = useRouter();
const innerRef = useForwardedRef(forwardedRef);
const _isServer = isServer ?? router.isServer;
const { activeProps, inactiveProps, activeOptions, to, preload: userPreload, preloadDelay: userPreloadDelay, preloadIntentProximity: _preloadIntentProximity, hashScrollIntoView, replace, startTransition, resetScroll, viewTransition, children, target, disabled, style, className, onClick, onBlur, onFocus, onMouseEnter, onMouseLeave, onTouchStart, ignoreBlocker, params: _params, search: _search, hash: _hash, state: _state, mask: _mask, reloadDocument: _reloadDocument, unsafeRelative: _unsafeRelative, from: _from, _fromLocation, ...propsSafeToSpread } = options;
if (_isServer) {
const safeInternal = isSafeInternal(to);
if (typeof to === "string" && !safeInternal && to.indexOf(":") > -1) try {
new URL(to);
if (isDangerousProtocol(to, router.protocolAllowlist)) {
if (process.env.NODE_ENV !== "production") console.warn(`Blocked Link with dangerous protocol: ${to}`);
return {
...propsSafeToSpread,
ref: innerRef,
href: void 0,
...children && { children },
...target && { target },
...disabled && { disabled },
...style && { style },
...className && { className }
};
}
return {
...propsSafeToSpread,
ref: innerRef,
href: to,
...children && { children },
...target && { target },
...disabled && { disabled },
...style && { style },
...className && { className }
};
} catch {}
const next = router.buildLocation({
...options,
from: options.from
});
const hrefOption = getHrefOption(next.maskedLocation ? next.maskedLocation.publicHref : next.publicHref, next.maskedLocation ? next.maskedLocation.external : next.external, router.history, disabled);
const externalLink = (() => {
if (hrefOption?.external) {
if (isDangerousProtocol(hrefOption.href, router.protocolAllowlist)) {
if (process.env.NODE_ENV !== "production") console.warn(`Blocked Link with dangerous protocol: ${hrefOption.href}`);
return;
}
return hrefOption.href;
}
if (safeInternal) return void 0;
if (typeof to === "string" && to.indexOf(":") > -1) try {
new URL(to);
if (isDangerousProtocol(to, router.protocolAllowlist)) {
if (process.env.NODE_ENV !== "production") console.warn(`Blocked Link with dangerous protocol: ${to}`);
return;
}
return to;
} catch {}
})();
const isActive = (() => {
if (externalLink) return false;
const currentLocation = router.stores.location.get();
const exact = activeOptions?.exact ?? false;
if (exact) {
if (!exactPathTest(currentLocation.pathname, next.pathname, router.basepath)) return false;
} else {
const currentPathSplit = removeTrailingSlash(currentLocation.pathname, router.basepath);
const nextPathSplit = removeTrailingSlash(next.pathname, router.basepath);
if (!(currentPathSplit.startsWith(nextPathSplit) && (currentPathSplit.length === nextPathSplit.length || currentPathSplit[nextPathSplit.length] === "/"))) return false;
}
if (activeOptions?.includeSearch ?? true) {
if (currentLocation.search !== next.search) {
const currentSearchEmpty = !currentLocation.search || typeof currentLocation.search === "object" && !hasKeys(currentLocation.search);
const nextSearchEmpty = !next.search || typeof next.search === "object" && !hasKeys(next.search);
if (!(currentSearchEmpty && nextSearchEmpty)) {
if (!deepEqual(currentLocation.search, next.search, {
partial: !exact,
ignoreUndefined: !activeOptions?.explicitUndefined
})) return false;
}
}
}
if (activeOptions?.includeHash) return false;
return true;
})();
if (externalLink) return {
...propsSafeToSpread,
ref: innerRef,
href: externalLink,
...children && { children },
...target && { target },
...disabled && { disabled },
...style && { style },
...className && { className }
};
const resolvedActiveProps = isActive ? functionalUpdate(activeProps, {}) ?? STATIC_ACTIVE_OBJECT : STATIC_EMPTY_OBJECT;
const resolvedInactiveProps = isActive ? STATIC_EMPTY_OBJECT : functionalUpdate(inactiveProps, {}) ?? STATIC_EMPTY_OBJECT;
const resolvedStyle = (() => {
const baseStyle = style;
const activeStyle = resolvedActiveProps.style;
const inactiveStyle = resolvedInactiveProps.style;
if (!baseStyle && !activeStyle && !inactiveStyle) return;
if (baseStyle && !activeStyle && !inactiveStyle) return baseStyle;
if (!baseStyle && activeStyle && !inactiveStyle) return activeStyle;
if (!baseStyle && !activeStyle && inactiveStyle) return inactiveStyle;
return {
...baseStyle,
...activeStyle,
...inactiveStyle
};
})();
const resolvedClassName = (() => {
const baseClassName = className;
const activeClassName = resolvedActiveProps.className;
const inactiveClassName = resolvedInactiveProps.className;
if (!baseClassName && !activeClassName && !inactiveClassName) return "";
let out = "";
if (baseClassName) out = baseClassName;
if (activeClassName) out = out ? `${out} ${activeClassName}` : activeClassName;
if (inactiveClassName) out = out ? `${out} ${inactiveClassName}` : inactiveClassName;
return out;
})();
return {
...propsSafeToSpread,
...resolvedActiveProps,
...resolvedInactiveProps,
href: hrefOption?.href,
ref: innerRef,
disabled: !!disabled,
target,
...resolvedStyle && { style: resolvedStyle },
...resolvedClassName && { className: resolvedClassName },
...disabled && STATIC_DISABLED_PROPS,
...isActive && STATIC_ACTIVE_PROPS
};
}
const isHydrated = useHydrated();
const _options = React$1.useMemo(() => options, [
router,
options.from,
options._fromLocation,
options.hash,
options.to,
options.search,
options.params,
options.state,
options.mask,
options.unsafeRelative
]);
const currentLocation = useStore(router.stores.location, (l) => l, (prev, next) => prev.href === next.href);
const next = React$1.useMemo(() => {
const opts = {
_fromLocation: currentLocation,
..._options
};
return router.buildLocation(opts);
}, [
router,
currentLocation,
_options
]);
const hrefOptionPublicHref = next.maskedLocation ? next.maskedLocation.publicHref : next.publicHref;
const hrefOptionExternal = next.maskedLocation ? next.maskedLocation.external : next.external;
const hrefOption = React$1.useMemo(() => getHrefOption(hrefOptionPublicHref, hrefOptionExternal, router.history, disabled), [
disabled,
hrefOptionExternal,
hrefOptionPublicHref,
router.history
]);
const externalLink = React$1.useMemo(() => {
if (hrefOption?.external) {
if (isDangerousProtocol(hrefOption.href, router.protocolAllowlist)) {
if (process.env.NODE_ENV !== "production") console.warn(`Blocked Link with dangerous protocol: ${hrefOption.href}`);
return;
}
return hrefOption.href;
}
if (isSafeInternal(to)) return void 0;
if (typeof to !== "string" || to.indexOf(":") === -1) return void 0;
try {
new URL(to);
if (isDangerousProtocol(to, router.protocolAllowlist)) {
if (process.env.NODE_ENV !== "production") console.warn(`Blocked Link with dangerous protocol: ${to}`);
return;
}
return to;
} catch {}
}, [
to,
hrefOption,
router.protocolAllowlist
]);
const isActive = React$1.useMemo(() => {
if (externalLink) return false;
if (activeOptions?.exact) {
if (!exactPathTest(currentLocation.pathname, next.pathname, router.basepath)) return false;
} else {
const currentPathSplit = removeTrailingSlash(currentLocation.pathname, router.basepath);
const nextPathSplit = removeTrailingSlash(next.pathname, router.basepath);
if (!(currentPathSplit.startsWith(nextPathSplit) && (currentPathSplit.length === nextPathSplit.length || currentPathSplit[nextPathSplit.length] === "/"))) return false;
}
if (activeOptions?.includeSearch ?? true) {
if (!deepEqual(currentLocation.search, next.search, {
partial: !activeOptions?.exact,
ignoreUndefined: !activeOptions?.explicitUndefined
})) return false;
}
if (activeOptions?.includeHash) return isHydrated && currentLocation.hash === next.hash;
return true;
}, [
activeOptions?.exact,
activeOptions?.explicitUndefined,
activeOptions?.includeHash,
activeOptions?.includeSearch,
currentLocation,
externalLink,
isHydrated,
next.hash,
next.pathname,
next.search,
router.basepath
]);
const resolvedActiveProps = isActive ? functionalUpdate(activeProps, {}) ?? STATIC_ACTIVE_OBJECT : STATIC_EMPTY_OBJECT;
const resolvedInactiveProps = isActive ? STATIC_EMPTY_OBJECT : functionalUpdate(inactiveProps, {}) ?? STATIC_EMPTY_OBJECT;
const resolvedClassName = [
className,
resolvedActiveProps.className,
resolvedInactiveProps.className
].filter(Boolean).join(" ");
const resolvedStyle = (style || resolvedActiveProps.style || resolvedInactiveProps.style) && {
...style,
...resolvedActiveProps.style,
...resolvedInactiveProps.style
};
const [isTransitioning, setIsTransitioning] = React$1.useState(false);
const hasRenderFetched = React$1.useRef(false);
const preload = options.reloadDocument || externalLink ? false : userPreload ?? router.options.defaultPreload;
const preloadDelay = userPreloadDelay ?? router.options.defaultPreloadDelay ?? 0;
const doPreload = React$1.useCallback(() => {
router.preloadRoute({
..._options,
_builtLocation: next
}).catch((err) => {
console.warn(err);
console.warn(preloadWarning);
});
}, [
router,
_options,
next
]);
useIntersectionObserver(innerRef, React$1.useCallback((entry) => {
if (entry?.isIntersecting) doPreload();
}, [doPreload]), intersectionObserverOptions, { disabled: !!disabled || !(preload === "viewport") });
React$1.useEffect(() => {
if (hasRenderFetched.current) return;
if (!disabled && preload === "render") {
doPreload();
hasRenderFetched.current = true;
}
}, [
disabled,
doPreload,
preload
]);
const handleClick = (e) => {
const elementTarget = e.currentTarget.getAttribute("target");
const effectiveTarget = target !== void 0 ? target : elementTarget;
if (!disabled && !isCtrlEvent(e) && !e.defaultPrevented && (!effectiveTarget || effectiveTarget === "_self") && e.button === 0) {
e.preventDefault();
flushSync(() => {
setIsTransitioning(true);
});
const unsub = router.subscribe("onResolved", () => {
unsub();
setIsTransitioning(false);
});
router.navigate({
..._options,
replace,
resetScroll,
hashScrollIntoView,
startTransition,
viewTransition,
ignoreBlocker
});
}
};
if (externalLink) return {
...propsSafeToSpread,
ref: innerRef,
href: externalLink,
...children && { children },
...target && { target },
...disabled && { disabled },
...style && { style },
...className && { className },
...onClick && { onClick },
...onBlur && { onBlur },
...onFocus && { onFocus },
...onMouseEnter && { onMouseEnter },
...onMouseLeave && { onMouseLeave },
...onTouchStart && { onTouchStart }
};
const enqueueIntentPreload = (e) => {
if (disabled || preload !== "intent") return;
if (!preloadDelay) {
doPreload();
return;
}
const eventTarget = e.currentTarget;
if (timeoutMap.has(eventTarget)) return;
const id = setTimeout(() => {
timeoutMap.delete(eventTarget);
doPreload();
}, preloadDelay);
timeoutMap.set(eventTarget, id);
};
const handleTouchStart = (_) => {
if (disabled || preload !== "intent") return;
doPreload();
};
const handleLeave = (e) => {
if (disabled || !preload || !preloadDelay) return;
const eventTarget = e.currentTarget;
const id = timeoutMap.get(eventTarget);
if (id) {
clearTimeout(id);
timeoutMap.delete(eventTarget);
}
};
return {
...propsSafeToSpread,
...resolvedActiveProps,
...resolvedInactiveProps,
href: hrefOption?.href,
ref: innerRef,
onClick: composeHandlers([onClick, handleClick]),
onBlur: composeHandlers([onBlur, handleLeave]),
onFocus: composeHandlers([onFocus, enqueueIntentPreload]),
onMouseEnter: composeHandlers([onMouseEnter, enqueueIntentPreload]),
onMouseLeave: composeHandlers([onMouseLeave, handleLeave]),
onTouchStart: composeHandlers([onTouchStart, handleTouchStart]),
disabled: !!disabled,
target,
...resolvedStyle && { style: resolvedStyle },
...resolvedClassName && { className: resolvedClassName },
...disabled && STATIC_DISABLED_PROPS,
...isActive && STATIC_ACTIVE_PROPS,
...isHydrated && isTransitioning && STATIC_TRANSITIONING_PROPS
};
}
var STATIC_EMPTY_OBJECT = {};
var STATIC_ACTIVE_OBJECT = { className: "active" };
var STATIC_DISABLED_PROPS = {
role: "link",
"aria-disabled": true
};
var STATIC_ACTIVE_PROPS = {
"data-status": "active",
"aria-current": "page"
};
var STATIC_TRANSITIONING_PROPS = { "data-transitioning": "transitioning" };
var timeoutMap = /* @__PURE__ */ new WeakMap();
var intersectionObserverOptions = { rootMargin: "100px" };
var composeHandlers = (handlers) => (e) => {
for (const handler of handlers) {
if (!handler) continue;
if (e.defaultPrevented) return;
handler(e);
}
};
function getHrefOption(publicHref, external, history, disabled) {
if (disabled) return void 0;
if (external) return {
href: publicHref,
external: true
};
return {
href: history.createHref(publicHref) || "/",
external: false
};
}
function isSafeInternal(to) {
if (typeof to !== "string") return false;
const zero = to.charCodeAt(0);
if (zero === 47) return to.charCodeAt(1) !== 47;
return zero === 46;
}
/**
* Creates a typed Link-like component that preserves TanStack Router's
* navigation semantics and type-safety while delegating rendering to the
* provided host component.
*
* Useful for integrating design system anchors/buttons while keeping
* router-aware props (eg. `to`, `params`, `search`, `preload`).
*
* @param Comp The host component to render (eg. a design-system Link/Button)
* @returns A router-aware component with the same API as `Link`.
* @link https://tanstack.com/router/latest/docs/framework/react/guide/custom-link
*/
function createLink(Comp) {
return React$1.forwardRef(function CreatedLink(props, ref) {
return /* @__PURE__ */ jsx(Link, {
...props,
_asChild: Comp,
ref
});
});
}
/**
* A strongly-typed anchor component for declarative navigation.
* Handles path, search, hash and state updates with optional route preloading
* and active-state styling.
*
* Props:
* - `preload`: Controls route preloading (eg. 'intent', 'render', 'viewport', true/false)
* - `preloadDelay`: Delay in ms before preloading on hover
* - `activeProps`/`inactiveProps`: Additional props merged when link is active/inactive
* - `resetScroll`/`hashScrollIntoView`: Control scroll behavior on navigation
* - `viewTransition`/`startTransition`: Use View Transitions/React transitions for navigation
* - `ignoreBlocker`: Bypass registered blockers
*
* @returns An anchor-like element that navigates without full page reloads.
* @link https://tanstack.com/router/latest/docs/framework/react/api/router/linkComponent
*/
var Link = React$1.forwardRef((props, ref) => {
const { _asChild, ...rest } = props;
const { type: _type, ...linkProps } = useLinkProps(rest, ref);
const children = typeof rest.children === "function" ? rest.children({ isActive: linkProps["data-status"] === "active" }) : rest.children;
if (!_asChild) {
const { disabled: _, ...rest } = linkProps;
return React$1.createElement("a", rest, children);
}
return React$1.createElement(_asChild, linkProps, children);
});
function isCtrlEvent(e) {
return !!(e.metaKey || e.altKey || e.ctrlKey || e.shiftKey);
}
/**
* Validate and reuse navigation options for `Link`, `navigate` or `redirect`.
* Accepts a literal options object and returns it typed for later spreading.
* @example
* const opts = linkOptions({ to: '/dashboard', search: { tab: 'home' } })
* @link https://tanstack.com/router/latest/docs/framework/react/api/router/linkOptions
*/
var linkOptions = (options) => {
return options;
};
/**
* Type-check a literal object for use with `Link`, `navigate` or `redirect`.
* Use to validate and reuse navigation options across your app.
* @example
* const opts = linkOptions({ to: '/dashboard', search: { tab: 'home' } })
* @link https://tanstack.com/router/latest/docs/framework/react/api/router/linkOptions
*/
//#endregion
export { Link, createLink, linkOptions, useLinkProps };
//# sourceMappingURL=link.js.map
@@ -0,0 +1,527 @@
export default `flf2a$ 5 4 99 0 16
_____ _____ ____ ___ _____ _____
/ ___>/ __ \\/ _/ /___\\/ __\\/ __\\
|___ || __|| |---| || __|| __|
<_____/\\__/ \\_____/\\___/\\__/ \\__/
#-> spliff : by nathan bloomfield (xzovik@gmail.com)
#-> based on the letters a,i,j,m,n,r,u, seen on the web, by E.DUB
#->
#-> History:
#-> 5-3-2008 : version 1.1
#-> Added umlauts (to make the file valid) and small letters ~Markus Gebhard
#-> 5-10-2007 : version 1.0
#->
#-> You are free to make changes- just note them in the history.
#->
#-> (end comments)
$$@
$$@
$$@
$$@
$$@@
___ @
/ \\@
\\___/@
<___>@
@@
_ _ @
| | | @
\\_|_/ @
@
@@
_ _ @
_| |_|_ @
|_|_|___|@
|___| |_|@
|_|_| @@
_/_/@
/ __>@
\\__ \\@
<___/@
/_/ @@
_ __ @
<_>/ / @
/ /_ @
/_/<_>@
@@
___ @
< _ > @
/ _ \\/@
\\__\\ \\@
/@@
_ @
< >@
|/ @
@
@@
___@
/ /@
| | @
\\__\\@
@@
___ @
\\ \\@
| |@
/__/@
@@
__A__@
\\ /@
/_ _\\@
V @
@@
_ @
_| |_ @
|_ _|@
|_| @
@@
@
@
_ @
< >@
|/ @@
@
___ @
<___>@
@
@@
@
@
_ @
<_>@
@@
___@
/ /@
/ / @
/__/ @
@@
_____ @
/ _ \\@
| | |@
\\_____/@
@@
___ @
/ | @
| | @
<____>@
@@
_____ @
<___ \\@
/ __/@
<_____|@
@@
_____ @
/ _ \\@
>-<_ <@
\\_____/@
@@
__ __ @
/ | \\@
\\_ |@
\\___/@
@@
_____ @
| ___|@
|___ \\@
<_____/@
@@
____ @
/ __| @
| _ \\@
\\_____/@
@@
_____ @
<__ \\@
/ /@
<___/ @
@@
_____ @
/ _ \\@
> _ <@
\\_____/@
@@
_____ @
/ _ \\@
\\___ |@
|_____/@
@@
_ @
<_>@
_ @
<_>@
@@
_ @
<_>@
_ @
< >@
|/ @@
___@
/ /@
< < @
\\__\\@
@@
@
___ @
<___> @
<___> @
@@
___ @
\\ \\ @
> >@
/__/ @
@@
_____ @
<___ \\@
|__ /@
<___> @
@@
_____ @
/ __ \\@
| |___|@
\\_____/@
@@
_____ @
/ _ \\@
| _ |@
\\__|__/@
@@
_____ @
/ _ \\@
| _ <@
\\_____/@
@@
_____ @
/ \\@
| |--|@
\\_____/@
@@
_____ @
| _ \\@
| | |@
|_____/@
@@
_____ @
/ __\\@
| __|@
\\_____/@
@@
_____ @
/ __\\@
| __|@
\\__/ @
@@
_____ @
/ __\\@
| |_ |@
\\_____/@
@@
__ __ @
/ | \\@
| _ |@
\\__|__/@
@@
___ @
/___\\@
| |@
\\___/@
@@
____ @
\\_ \\@
---| |@
\\_____/@
@@
__ ___@
| | /@
| _ < @
|__|__\\@
@@
____ @
/ _/ @
| |---@
\\_____/@
@@
__ __ @
/ \\/ \\@
| \\/ |@
\\__ \\__/@
@@
_____ @
/ _ \\@
| | |@
\\__|__/@
@@
_____ @
/ _ \\@
| | |@
\\_____/@
@@
_____ @
/ _ \\@
| __/@
\\__/ @
@@
_____ @
/ _ \\@
| | |@
\\___\\ \\@
/@@
_____ @
/ _ \\@
| _ <@
\\__|\\_/@
@@
_____ @
/ ___>@
|___ |@
<_____/@
@@
____ @
/ \\@
\\- -/@
|__| @
@@
__ __ @
/ | \\@
| | |@
\\_____/@
@@
__ __ @
/ | \\@
\\ | /@
\\___/ @
@@
__ __ @
/ / \\@
| /\\ |@
\\__/\\__/@
@@
__ __ @
/ \\/ \\@
>- -<@
\\__/\\__/@
@@
___ ___@
\\ | /@
| | @
\\___/ @
@@
_____ @
|__ /@
/ _/ @
/_____|@
@@
___ @
| _|@
| |_ @
|___|@
@@
___ @
\\ \\ @
\\ \\ @
\\__\\@
@@
___ @
|_ |@
_| |@
|___|@
@@
__ @
/ \\ @
/_/\\_\\@
@
@@
@
@
@
____ @
<____>@@
_ @
< >@
\\|@
@
@@
_____ @
/ _ \\@
| _ |@
\\__|__/@
@@
_____ @
/ _ \\@
| _ <@
\\_____/@
@@
_____ @
/ \\@
| |--|@
\\_____/@
@@
_____ @
| _ \\@
| | |@
|_____/@
@@
_____ @
/ __\\@
| __|@
\\_____/@
@@
_____ @
/ __\\@
| __|@
\\__/ @
@@
_____ @
/ __\\@
| |_ |@
\\_____/@
@@
__ __ @
/ | \\@
| _ |@
\\__|__/@
@@
___ @
/___\\@
| |@
\\___/@
@@
____ @
\\_ \\@
---| |@
\\_____/@
@@
__ ___@
| | /@
| _ < @
|__|__\\@
@@
____ @
/ _/ @
| |---@
\\_____/@
@@
__ __ @
/ \\/ \\@
| \\/ |@
\\__ \\__/@
@@
_____ @
/ _ \\@
| | |@
\\__|__/@
@@
_____ @
/ _ \\@
| | |@
\\_____/@
@@
_____ @
/ _ \\@
| __/@
\\__/ @
@@
_____ @
/ _ \\@
| | |@
\\___\\ \\@
/@@
_____ @
/ _ \\@
| _ <@
\\__|\\_/@
@@
_____ @
/ ___>@
|___ |@
<_____/@
@@
____ @
/ \\@
\\- -/@
|__| @
@@
__ __ @
/ | \\@
| | |@
\\_____/@
@@
__ __ @
/ | \\@
\\ | /@
\\___/ @
@@
__ __ @
/ / \\@
| /\\ |@
\\__/\\__/@
@@
__ __ @
/ \\/ \\@
>- -<@
\\__/\\__/@
@@
___ ___@
\\ | /@
| | @
\\___/ @
@@
_____ @
|__ /@
/ _/ @
/_____|@
@@
___@
| /@
< | @
|__\\@
@@
_ @
| |@
| |@
|_|@
@@
___ @
\\ | @
| >@
/__| @
@@
_ _ @
/ \\/ >@
<_/\\_/ @
@
@@
/_\\_/_\\@
/ _ \\@
| _ |@
\\__|__/@
@@
/_\\_/_\\@
/ _ \\@
| | |@
\\_____/@
@@
/_\\ /_\\@
/ | \\@
| | |@
\\_____/@
@@
/_\\_/_\\@
/ _ \\@
| _ |@
\\__|__/@
@@
/_\\_/_\\@
/ _ \\@
| | |@
\\_____/@
@@
/_\\ /_\\@
/ | \\@
| | |@
\\_____/@
@@
�@
@
@
@
@@ `
@@ -0,0 +1 @@
{"version":3,"names":["_path","require","_helperValidatorIdentifier","hasExports","metadata","isSideEffectImport","source","imports","size","importsNamespace","reexports","reexportNamespace","reexportAll","validateImportInteropOption","importInterop","Error","resolveImportInterop","filename","normalizeModuleAndLoadMetadata","programPath","exportName","initializeReexports","getWrapperPayload","esNamespaceOnly","scope","generateUidIdentifier","name","stringSpecifiers","Set","nameAnonymousExports","local","sources","getModuleMetadata","removeImportExportDeclarations","nameOfnamespace","resolvedInterop","interop","exportNameListName","getExportSpecifierName","path","isIdentifier","node","isStringLiteral","stringValue","value","isIdentifierName","add","type","assertExportSpecifier","isExportSpecifier","isExportNamespaceSpecifier","buildCodeFrameError","localData","getLocalExportMetadata","importNodes","Map","sourceData","getData","sourceNode","data","get","basename","extname","loc","wrap","lazy","referenced","set","push","forEach","child","isImportDeclaration","spec","isImportDefaultSpecifier","localName","reexport","delete","names","isImportNamespaceSpecifier","isImportSpecifier","importName","isExportAllDeclaration","isExportNamedDeclaration","isExportDefaultDeclaration","values","needsDefault","needsNamed","bindingKindLookup","programScope","programChildren","kind","declaration","isFunctionDeclaration","isClassDeclaration","isVariableDeclaration","Object","keys","getOuterBindingIdentifiers","localMetadata","getLocalMetadata","idPath","_bindingKindLookup$ge","_programScope$getBind","getBinding","undefined","ids","getOuterBindingIdentifierPaths","exported","_child$splitExportDec","splitExportDeclaration","NodePath","prototype","remove","_blockHoist","replaceWith"],"sources":["../src/normalize-and-load-metadata.ts"],"sourcesContent":["import { basename, extname } from \"node:path\";\nimport type { types as t, NodePath } from \"@babel/core\";\n\nimport { isIdentifierName } from \"@babel/helper-validator-identifier\";\n\nexport interface ModuleMetadata {\n exportName: string;\n // The name of the variable that will reference an object containing export names.\n exportNameListName: null | string;\n hasExports: boolean;\n // Lookup from local binding to export information.\n local: Map<string, LocalExportMetadata>;\n // Lookup of source file to source file metadata.\n source: Map<string, SourceModuleMetadata>;\n // List of names that should only be printed as string literals.\n // i.e. `import { \"any unicode\" as foo } from \"some-module\"`\n // `stringSpecifiers` is Set(1) [\"any unicode\"]\n // In most cases `stringSpecifiers` is an empty Set\n stringSpecifiers: Set<string>;\n}\n\nexport type InteropType =\n | \"default\" // Babel interop for default-only imports\n | \"namespace\" // Babel interop for namespace or default+named imports\n | \"node-default\" // Node.js interop for default-only imports\n | \"node-namespace\" // Node.js interop for namespace or default+named imports\n | \"none\"; // No interop, or named-only imports\n\nexport type ImportInterop =\n | \"none\"\n | \"babel\"\n | \"node\"\n | ((source: string, filename?: string) => \"none\" | \"babel\" | \"node\");\n\nexport interface SourceModuleMetadata {\n // A unique variable name to use for this namespace object. Centralized for simplicity.\n name: string;\n loc: t.SourceLocation | undefined | null;\n interop: InteropType;\n // Local binding to reference from this source namespace. Key: Local name, value: Import name\n imports: Map<string, string>;\n // Local names that reference namespace object.\n importsNamespace: Set<string>;\n // Reexports to create for namespace. Key: Export name, value: Import name\n reexports: Map<string, string>;\n // List of names to re-export namespace as.\n reexportNamespace: Set<string>;\n // Tracks if the source should be re-exported.\n reexportAll: null | {\n loc: t.SourceLocation | undefined | null;\n };\n wrap?: unknown;\n referenced: boolean;\n}\n\nexport interface LocalExportMetadata {\n names: string[]; // names of exports,\n kind: \"import\" | \"hoisted\" | \"block\" | \"var\";\n}\n\n/**\n * Check if the module has any exports that need handling.\n */\nexport function hasExports(metadata: ModuleMetadata) {\n return metadata.hasExports;\n}\n\n/**\n * Check if a given source is an anonymous import, e.g. \"import 'foo';\"\n */\nexport function isSideEffectImport(source: SourceModuleMetadata) {\n return (\n source.imports.size === 0 &&\n source.importsNamespace.size === 0 &&\n source.reexports.size === 0 &&\n source.reexportNamespace.size === 0 &&\n !source.reexportAll\n );\n}\n\nexport function validateImportInteropOption(\n importInterop: any,\n): importInterop is ImportInterop {\n if (\n typeof importInterop !== \"function\" &&\n importInterop !== \"none\" &&\n importInterop !== \"babel\" &&\n importInterop !== \"node\"\n ) {\n throLine truncated
@@ -0,0 +1,26 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.Var = exports.User = exports.Statement = exports.SpreadProperty = exports.Scope = exports.RestProperty = exports.ReferencedMemberExpression = exports.ReferencedIdentifier = exports.Referenced = exports.Pure = exports.NumericLiteralTypeAnnotation = exports.Generated = exports.ForAwaitStatement = exports.Flow = exports.Expression = exports.ExistentialTypeParam = exports.BlockScoped = exports.BindingIdentifier = void 0;
const ReferencedIdentifier = exports.ReferencedIdentifier = ["Identifier", "JSXIdentifier"];
const ReferencedMemberExpression = exports.ReferencedMemberExpression = ["MemberExpression"];
const BindingIdentifier = exports.BindingIdentifier = ["Identifier"];
const Statement = exports.Statement = ["Statement"];
const Expression = exports.Expression = ["Expression"];
const Scope = exports.Scope = ["Scopable", "Pattern"];
const Referenced = exports.Referenced = null;
const BlockScoped = exports.BlockScoped = ["FunctionDeclaration", "ClassDeclaration", "VariableDeclaration"];
const Var = exports.Var = ["VariableDeclaration"];
const User = exports.User = null;
const Generated = exports.Generated = null;
const Pure = exports.Pure = null;
const Flow = exports.Flow = ["Flow", "ImportDeclaration", "ExportDeclaration", "ImportSpecifier"];
const RestProperty = exports.RestProperty = ["RestElement"];
const SpreadProperty = exports.SpreadProperty = ["RestElement"];
const ExistentialTypeParam = exports.ExistentialTypeParam = ["ExistsTypeAnnotation"];
const NumericLiteralTypeAnnotation = exports.NumericLiteralTypeAnnotation = ["NumberLiteralTypeAnnotation"];
const ForAwaitStatement = exports.ForAwaitStatement = ["ForOfStatement"];
//# sourceMappingURL=virtual-types.js.map
@@ -0,0 +1,395 @@
Attribution 4.0 International
=======================================================================
Creative Commons Corporation ("Creative Commons") is not a law firm and
does not provide legal services or legal advice. Distribution of
Creative Commons public licenses does not create a lawyer-client or
other relationship. Creative Commons makes its licenses and related
information available on an "as-is" basis. Creative Commons gives no
warranties regarding its licenses, any material licensed under their
terms and conditions, or any related information. Creative Commons
disclaims all liability for damages resulting from their use to the
fullest extent possible.
Using Creative Commons Public Licenses
Creative Commons public licenses provide a standard set of terms and
conditions that creators and other rights holders may use to share
original works of authorship and other material subject to copyright
and certain other rights specified in the public license below. The
following considerations are for informational purposes only, are not
exhaustive, and do not form part of our licenses.
Considerations for licensors: Our public licenses are
intended for use by those authorized to give the public
permission to use material in ways otherwise restricted by
copyright and certain other rights. Our licenses are
irrevocable. Licensors should read and understand the terms
and conditions of the license they choose before applying it.
Licensors should also secure all rights necessary before
applying our licenses so that the public can reuse the
material as expected. Licensors should clearly mark any
material not subject to the license. This includes other CC-
licensed material, or material used under an exception or
limitation to copyright. More considerations for licensors:
wiki.creativecommons.org/Considerations_for_licensors
Considerations for the public: By using one of our public
licenses, a licensor grants the public permission to use the
licensed material under specified terms and conditions. If
the licensor's permission is not necessary for any reason--for
example, because of any applicable exception or limitation to
copyright--then that use is not regulated by the license. Our
licenses grant only permissions under copyright and certain
other rights that a licensor has authority to grant. Use of
the licensed material may still be restricted for other
reasons, including because others have copyright or other
rights in the material. A licensor may make special requests,
such as asking that all changes be marked or described.
Although not required by our licenses, you are encouraged to
respect those requests where reasonable. More_considerations
for the public:
wiki.creativecommons.org/Considerations_for_licensees
=======================================================================
Creative Commons Attribution 4.0 International Public License
By exercising the Licensed Rights (defined below), You accept and agree
to be bound by the terms and conditions of this Creative Commons
Attribution 4.0 International Public License ("Public License"). To the
extent this Public License may be interpreted as a contract, You are
granted the Licensed Rights in consideration of Your acceptance of
these terms and conditions, and the Licensor grants You such rights in
consideration of benefits the Licensor receives from making the
Licensed Material available under these terms and conditions.
Section 1 -- Definitions.
a. Adapted Material means material subject to Copyright and Similar
Rights that is derived from or based upon the Licensed Material
and in which the Licensed Material is translated, altered,
arranged, transformed, or otherwise modified in a manner requiring
permission under the Copyright and Similar Rights held by the
Licensor. For purposes of this Public License, where the Licensed
Material is a musical work, performance, or sound recording,
Adapted Material is always produced where the Licensed Material is
synched in timed relation with a moving image.
b. Adapter's License means the license You apply to Your Copyright
and Similar Rights in Your contributions to Adapted Material in
accordance with the terms and conditions of this Public License.
c. Copyright and Similar Rights means copyright and/or similar rights
closely related to copyright including, without limitation,
performance, broadcast, sound recording, and Sui Generis Database
Rights, without regard to how the rights are labeled or
categorized. For purposes of this Public License, the rights
specified in Section 2(b)(1)-(2) are not Copyright and Similar
Rights.
d. Effective Technological Measures means those measures that, in the
absence of proper authority, may not be circumvented under laws
fulfilling obligations under Article 11 of the WIPO Copyright
Treaty adopted on December 20, 1996, and/or similar international
agreements.
e. Exceptions and Limitations means fair use, fair dealing, and/or
any other exception or limitation to Copyright and Similar Rights
that applies to Your use of the Licensed Material.
f. Licensed Material means the artistic or literary work, database,
or other material to which the Licensor applied this Public
License.
g. Licensed Rights means the rights granted to You subject to the
terms and conditions of this Public License, which are limited to
all Copyright and Similar Rights that apply to Your use of the
Licensed Material and that the Licensor has authority to license.
h. Licensor means the individual(s) or entity(ies) granting rights
under this Public License.
i. Share means to provide material to the public by any means or
process that requires permission under the Licensed Rights, such
as reproduction, public display, public performance, distribution,
dissemination, communication, or importation, and to make material
available to the public including in ways that members of the
public may access the material from a place and at a time
individually chosen by them.
j. Sui Generis Database Rights means rights other than copyright
resulting from Directive 96/9/EC of the European Parliament and of
the Council of 11 March 1996 on the legal protection of databases,
as amended and/or succeeded, as well as other essentially
equivalent rights anywhere in the world.
k. You means the individual or entity exercising the Licensed Rights
under this Public License. Your has a corresponding meaning.
Section 2 -- Scope.
a. License grant.
1. Subject to the terms and conditions of this Public License,
the Licensor hereby grants You a worldwide, royalty-free,
non-sublicensable, non-exclusive, irrevocable license to
exercise the Licensed Rights in the Licensed Material to:
a. reproduce and Share the Licensed Material, in whole or
in part; and
b. produce, reproduce, and Share Adapted Material.
2. Exceptions and Limitations. For the avoidance of doubt, where
Exceptions and Limitations apply to Your use, this Public
License does not apply, and You do not need to comply with
its terms and conditions.
3. Term. The term of this Public License is specified in Section
6(a).
4. Media and formats; technical modifications allowed. The
Licensor authorizes You to exercise the Licensed Rights in
all media and formats whether now known or hereafter created,
and to make technical modifications necessary to do so. The
Licensor waives and/or agrees not to assert any right or
authority to forbid You from making technical modifications
necessary to exercise the Licensed Rights, including
technical modifications necessary to circumvent Effective
Technological Measures. For purposes of this Public License,
simply making modifications authorized by this Section 2(a)
(4) never produces Adapted Material.
5. Downstream recipients.
a. Offer from the Licensor -- Licensed Material. Every
recipient of the Licensed Material automatically
receives an offer from the Licensor to exercise the
Licensed Rights under the terms and conditions of this
Public License.
b. No downstream restrictions. You may not offer or impose
any additional or different terms or conditions on, or
apply any Effective Technological Measures to, the
Licensed Material if doing so restricts exercise of the
Licensed Rights by any recipient of the Licensed
Material.
6. No endorsement. Nothing in this Public License constitutes or
may be construed as permission to assert or imply that You
are, or that Your use of the Licensed Material is, connected
with, or sponsored, endorsed, or granted official status by,
the Licensor or others designated to receive attribution as
provided in Section 3(a)(1)(A)(i).
b. Other rights.
1. Moral rights, such as the right of integrity, are not
licensed under this Public License, nor are publicity,
privacy, and/or other similar personality rights; however, to
the extent possible, the Licensor waives and/or agrees not to
assert any such rights held by the Licensor to the limited
extent necessary to allow You to exercise the Licensed
Rights, but not otherwise.
2. Patent and trademark rights are not licensed under this
Public License.
3. To the extent possible, the Licensor waives any right to
collect royalties from You for the exercise of the Licensed
Rights, whether directly or through a collecting society
under any voluntary or waivable statutory or compulsory
licensing scheme. In all other cases the Licensor expressly
reserves any right to collect such royalties.
Section 3 -- License Conditions.
Your exercise of the Licensed Rights is expressly made subject to the
following conditions.
a. Attribution.
1. If You Share the Licensed Material (including in modified
form), You must:
a. retain the following if it is supplied by the Licensor
with the Licensed Material:
i. identification of the creator(s) of the Licensed
Material and any others designated to receive
attribution, in any reasonable manner requested by
the Licensor (including by pseudonym if
designated);
ii. a copyright notice;
iii. a notice that refers to this Public License;
iv. a notice that refers to the disclaimer of
warranties;
v. a URI or hyperlink to the Licensed Material to the
extent reasonably practicable;
b. indicate if You modified the Licensed Material and
retain an indication of any previous modifications; and
c. indicate the Licensed Material is licensed under this
Public License, and include the text of, or the URI or
hyperlink to, this Public License.
2. You may satisfy the conditions in Section 3(a)(1) in any
reasonable manner based on the medium, means, and context in
which You Share the Licensed Material. For example, it may be
reasonable to satisfy the conditions by providing a URI or
hyperlink to a resource that includes the required
information.
3. If requested by the Licensor, You must remove any of the
information required by Section 3(a)(1)(A) to the extent
reasonably practicable.
4. If You Share Adapted Material You produce, the Adapter's
License You apply must not prevent recipients of the Adapted
Material from complying with this Public License.
Section 4 -- Sui Generis Database Rights.
Where the Licensed Rights include Sui Generis Database Rights that
apply to Your use of the Licensed Material:
a. for the avoidance of doubt, Section 2(a)(1) grants You the right
to extract, reuse, reproduce, and Share all or a substantial
portion of the contents of the database;
b. if You include all or a substantial portion of the database
contents in a database in which You have Sui Generis Database
Rights, then the database in which You have Sui Generis Database
Rights (but not its individual contents) is Adapted Material; and
c. You must comply with the conditions in Section 3(a) if You Share
all or a substantial portion of the contents of the database.
For the avoidance of doubt, this Section 4 supplements and does not
replace Your obligations under this Public License where the Licensed
Rights include other Copyright and Similar Rights.
Section 5 -- Disclaimer of Warranties and Limitation of Liability.
a. UNLESS OTHERWISE SEPARATELY UNDERTAKEN BY THE LICENSOR, TO THE
EXTENT POSSIBLE, THE LICENSOR OFFERS THE LICENSED MATERIAL AS-IS
AND AS-AVAILABLE, AND MAKES NO REPRESENTATIONS OR WARRANTIES OF
ANY KIND CONCERNING THE LICENSED MATERIAL, WHETHER EXPRESS,
IMPLIED, STATUTORY, OR OTHER. THIS INCLUDES, WITHOUT LIMITATION,
WARRANTIES OF TITLE, MERCHANTABILITY, FITNESS FOR A PARTICULAR
PURPOSE, NON-INFRINGEMENT, ABSENCE OF LATENT OR OTHER DEFECTS,
ACCURACY, OR THE PRESENCE OR ABSENCE OF ERRORS, WHETHER OR NOT
KNOWN OR DISCOVERABLE. WHERE DISCLAIMERS OF WARRANTIES ARE NOT
ALLOWED IN FULL OR IN PART, THIS DISCLAIMER MAY NOT APPLY TO YOU.
b. TO THE EXTENT POSSIBLE, IN NO EVENT WILL THE LICENSOR BE LIABLE
TO YOU ON ANY LEGAL THEORY (INCLUDING, WITHOUT LIMITATION,
NEGLIGENCE) OR OTHERWISE FOR ANY DIRECT, SPECIAL, INDIRECT,
INCIDENTAL, CONSEQUENTIAL, PUNITIVE, EXEMPLARY, OR OTHER LOSSES,
COSTS, EXPENSES, OR DAMAGES ARISING OUT OF THIS PUBLIC LICENSE OR
USE OF THE LICENSED MATERIAL, EVEN IF THE LICENSOR HAS BEEN
ADVISED OF THE POSSIBILITY OF SUCH LOSSES, COSTS, EXPENSES, OR
DAMAGES. WHERE A LIMITATION OF LIABILITY IS NOT ALLOWED IN FULL OR
IN PART, THIS LIMITATION MAY NOT APPLY TO YOU.
c. The disclaimer of warranties and limitation of liability provided
above shall be interpreted in a manner that, to the extent
possible, most closely approximates an absolute disclaimer and
waiver of all liability.
Section 6 -- Term and Termination.
a. This Public License applies for the term of the Copyright and
Similar Rights licensed here. However, if You fail to comply with
this Public License, then Your rights under this Public License
terminate automatically.
b. Where Your right to use the Licensed Material has terminated under
Section 6(a), it reinstates:
1. automatically as of the date the violation is cured, provided
it is cured within 30 days of Your discovery of the
violation; or
2. upon express reinstatement by the Licensor.
For the avoidance of doubt, this Section 6(b) does not affect any
right the Licensor may have to seek remedies for Your violations
of this Public License.
c. For the avoidance of doubt, the Licensor may also offer the
Licensed Material under separate terms or conditions or stop
distributing the Licensed Material at any time; however, doing so
will not terminate this Public License.
d. Sections 1, 5, 6, 7, and 8 survive termination of this Public
License.
Section 7 -- Other Terms and Conditions.
a. The Licensor shall not be bound by any additional or different
terms or conditions communicated by You unless expressly agreed.
b. Any arrangements, understandings, or agreements regarding the
Licensed Material not stated herein are separate from and
independent of the terms and conditions of this Public License.
Section 8 -- Interpretation.
a. For the avoidance of doubt, this Public License does not, and
shall not be interpreted to, reduce, limit, restrict, or impose
conditions on any use of the Licensed Material that could lawfully
be made without permission under this Public License.
b. To the extent possible, if any provision of this Public License is
deemed unenforceable, it shall be automatically reformed to the
minimum extent necessary to make it enforceable. If the provision
cannot be reformed, it shall be severed from this Public License
without affecting the enforceability of the remaining terms and
conditions.
c. No term or condition of this Public License will be waived and no
failure to comply consented to unless expressly agreed to by the
Licensor.
d. Nothing in this Public License constitutes or may be interpreted
as a limitation upon, or waiver of, any privileges and immunities
that apply to the Licensor or You, including from the legal
processes of any jurisdiction or authority.
=======================================================================
Creative Commons is not a party to its public
licenses. Notwithstanding, Creative Commons may elect to apply one of
its public licenses to material it publishes and in those instances
will be considered the “Licensor.” The text of the Creative Commons
public licenses is dedicated to the public domain under the CC0 Public
Domain Dedication. Except for the limited purpose of indicating that
material is shared under a Creative Commons public license or as
otherwise permitted by the Creative Commons policies published at
creativecommons.org/policies, Creative Commons does not authorize the
use of the trademark "Creative Commons" or any other trademark or logo
of Creative Commons without its prior written consent including,
without limitation, in connection with any unauthorized modifications
to any of its public licenses or any other arrangements,
understandings, or agreements concerning use of licensed material. For
the avoidance of doubt, this paragraph does not form part of the
public licenses.
Creative Commons may be contacted at creativecommons.org.
@@ -0,0 +1,558 @@
# zod-validation-error
Wrap zod validation errors in user-friendly readable messages.
[![Build Status](https://github.com/causaly/zod-validation-error/actions/workflows/ci.yml/badge.svg)](https://github.com/causaly/zod-validation-error/actions/workflows/ci.yml) [![npm version](https://img.shields.io/npm/v/zod-validation-error.svg?color=0c0)](https://www.npmjs.com/package/zod-validation-error)
#### Features
- User-friendly readable messages, configurable via options;
- Maintain original issues under `error.details`;
- Supports both `zod` v3 and v4.
**_Note:_** This is the v3 version of `zod-validation-error`. If you are looking for zod v4 support, please click [here](/README.md).
## Installation
```bash
npm install zod-validation-error
```
#### Requirements
- Node.js v.18+
- TypeScript v.4.5+
## Quick start
```typescript
import { z as zod } from 'zod/v3';
import { fromError } from 'zod-validation-error/v3';
// create zod schema
const zodSchema = zod.object({
id: zod.number().int().positive(),
email: zod.string().email(),
});
// parse some invalid value
try {
zodSchema.parse({
id: 1,
email: 'foobar', // note: invalid email
});
} catch (err) {
const validationError = fromError(err);
// the error is now readable by the user
// you may print it to console
console.log(validationError.toString());
// or return it as an actual error
return validationError;
}
```
## Motivation
Zod errors are difficult to consume for the end-user. This library wraps Zod validation errors in user-friendly readable messages that can be exposed to the outer world, while maintaining the original errors in an array for _dev_ use.
### Example
#### Input (from Zod)
```json
[
{
"code": "too_small",
"inclusive": false,
"message": "Number must be greater than 0",
"minimum": 0,
"path": ["id"],
"type": "number"
},
{
"code": "invalid_string",
"message": "Invalid email",
"path": ["email"],
"validation": "email"
}
]
```
#### Output
```
Validation error: Number must be greater than 0 at "id"; Invalid email at "email"
```
## API
- [ValidationError(message[, options])](#validationerror)
- [createMessageBuilder(props)](#createMessageBuilder)
- [errorMap](#errormap)
- [isValidationError(error)](#isvalidationerror)
- [isValidationErrorLike(error)](#isvalidationerrorlike)
- [isZodErrorLike(error)](#iszoderrorlike)
- [fromError(error[, options])](#fromerror)
- [fromZodIssue(zodIssue[, options])](#fromzodissue)
- [fromZodError(zodError[, options])](#fromzoderror)
- [toValidationError([options]) => (error) => ValidationError](#tovalidationerror)
### ValidationError
Main `ValidationError` class, extending native JavaScript `Error`.
#### Arguments
- `message` - _string_; error message (required)
- `options` - _ErrorOptions_; error options as per [JavaScript definition](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error/Error#options) (optional)
- `options.cause` - _any_; can be used to hold the original zod error (optional)
#### Example 1: construct new ValidationError with `message`
```typescript
const { ValidationError } = require('zod-validation-error');
const error = new ValidationError('foobar');
console.log(error instanceof Error); // prints true
```
#### Example 2: construct new ValidationError with `message` and `options.cause`
```typescript
import { z as zod } from 'zod/v3';
const { ValidationError } = require('zod-validation-error');
const error = new ValidationError('foobar', {
cause: new zod.ZodError([
{
code: 'invalid_string',
message: 'Invalid email',
path: ['email'],
validation: 'email',
},
]),
});
console.log(error.details); // prints issues from zod error
```
### createMessageBuilder
Creates zod-validation-error's default `MessageBuilder`, which is used to produce user-friendly error messages.
Meant to be passed as an option to [fromError](#fromerror), [fromZodIssue](#fromzodissue), [fromZodError](#fromzoderror) or [toValidationError](#tovalidationerror).
You may read more on the concept of the `MessageBuilder` further [below](#MessageBuilder).
#### Arguments
- `props` - _Object_; formatting options (optional)
- `maxIssuesInMessage` - _number_; max issues to include in user-friendly message (optional, defaults to 99)
- `issueSeparator` - _string_; used to concatenate issues in user-friendly message (optional, defaults to ";")
- `unionSeparator` - _string_; used to concatenate union-issues in user-friendly message (optional, defaults to ", or")
- `prefix` - _string_ or _null_; prefix to use in user-friendly message (optional, defaults to "Validation error"). Pass `null` to disable prefix completely.
- `prefixSeparator` - _string_; used to concatenate prefix with rest of the user-friendly message (optional, defaults to ": "). Not used when `prefix` is `null`.
- `includePath` - _boolean_; used to provide control on whether to include the erroneous property name suffix or not (optional, defaults to `true`).
#### Example
```typescript
import { createMessageBuilder } from 'zod-validation-error/v3';
const messageBuilder = createMessageBuilder({
includePath: false,
maxIssuesInMessage: 3,
});
```
### errorMap
A custom error map to use with zod's `setErrorMap` method and get user-friendly messages automatically.
#### Example
```typescript
import { z as zod } from 'zod/v3';
import { errorMap } from 'zod-validation-error/v3';
zod.setErrorMap(errorMap);
```
### isValidationError
A [type guard](https://www.typescriptlang.org/docs/handbook/2/narrowing.html#using-type-predicates) utility function, based on `instanceof` comparison.
#### Arguments
- `error` - error instance (required)
#### Example
```typescript
import { z as zod } from 'zod/v3';
import { ValidationError, isValidationError } from 'zod-validation-error/v3';
const err = new ValidationError('foobar');
isValidationError(err); // returns true
const invalidErr = new Error('foobar');
isValidationError(err); // returns false
```
### isValidationErrorLike
A [type guard](https://www.typescriptlang.org/docs/handbook/2/narrowing.html#using-type-predicates) utility function, based on _heuristics_ comparison.
_Why do we need heuristics since we can use a simple `instanceof` comparison?_ Because of multi-version inconsistencies. For instance, it's possible that a dependency is using an older `zod-validation-error` version internally. In such case, the `instanceof` comparison will yield invalid results because module deduplication does not apply at npm/yarn level and the prototype is different.
tl;dr if you are uncertain then it is preferable to use `isValidationErrorLike` instead of `isValidationError`.
#### Arguments
- `error` - error instance (required)
#### Example
```typescript
import {
ValidationError,
isValidationErrorLike,
} from 'zod-validation-error/v3';
const err = new ValidationError('foobar');
isValidationErrorLike(err); // returns true
const invalidErr = new Error('foobar');
isValidationErrorLike(err); // returns false
```
### isZodErrorLike
A [type guard](https://www.typescriptlang.org/docs/handbook/2/narrowing.html#using-type-predicates) utility function, based on _heuristics_ comparison.
_Why do we need heuristics since we can use a simple `instanceof` comparison?_ Because of multi-version inconsistencies. For instance, it's possible that a dependency is using an older `zod` version internally. In such case, the `instanceof` comparison will yield invalid results because module deduplication does not apply at npm/yarn level and the prototype is different.
#### Arguments
- `error` - error instance (required)
#### Example
```typescript
import { z as zod } from 'zod/v3';
import { ValidationError, isZodErrorLike } from 'zod-validation-error/v3';
const zodValidationErr = new ValidationError('foobar');
isZodErrorLike(zodValidationErr); // returns false
const genericErr = new Error('foobar');
isZodErrorLike(genericErr); // returns false
const zodErr = new zod.ZodError([
{
code: zod.ZodIssueCode.custom,
path: [],
message: 'foobar',
fatal: true,
},
]);
isZodErrorLike(zodErr); // returns true
```
### fromError
Converts an error to `ValidationError`.
_What is the difference between `fromError` and `fromZodError`?_ The `fromError` function is a less strict version of `fromZodError`. It can accept an unknown error and attempt to convert it to a `ValidationError`.
#### Arguments
- `error` - _unknown_; an error (required)
- `options` - _Object_; formatting options (optional)
- `messageBuilder` - _MessageBuilder_; a function that accepts an array of `zod.ZodIssue` objects and returns a user-friendly error message in the form of a `string` (optional).
#### Notes
Alternatively, you may pass the following `options` instead of a `messageBuilder`.
- `options` - _Object_; formatting options (optional)
- `maxIssuesInMessage` - _number_; max issues to include in user-friendly message (optional, defaults to 99)
- `issueSeparator` - _string_; used to concatenate issues in user-friendly message (optional, defaults to ";")
- `unionSeparator` - _string_; used to concatenate union-issues in user-friendly message (optional, defaults to ", or")
- `prefix` - _string_ or _null_; prefix to use in user-friendly message (optional, defaults to "Validation error"). Pass `null` to disable prefix completely.
- `prefixSeparator` - _string_; used to concatenate prefix with rest of the user-friendly message (optional, defaults to ": "). Not used when `prefix` is `null`.
- `includePath` - _boolean_; used to provide control on whether to include the erroneous property name suffix or not (optional, defaults to `true`).
They will be passed as arguments to the [createMessageBuilder](#createMessageBuilder) function. The only reason they exist is to provide backwards-compatibility with older versions of `zod-validation-error`. They should however be considered deprecated and may be removed in the future.
### fromZodIssue
Converts a single zod issue to `ValidationError`.
#### Arguments
- `zodIssue` - _zod.ZodIssue_; a ZodIssue instance (required)
- `options` - _Object_; formatting options (optional)
- `messageBuilder` - _MessageBuilder_; a function that accepts an array of `zod.ZodIssue` objects and returns a user-friendly error message in the form of a `string` (optional).
#### Notes
Alternatively, you may pass the following `options` instead of a `messageBuilder`.
- `options` - _Object_; formatting options (optional)
- `issueSeparator` - _string_; used to concatenate issues in user-friendly message (optional, defaults to ";")
- `unionSeparator` - _string_; used to concatenate union-issues in user-friendly message (optional, defaults to ", or")
- `prefix` - _string_ or _null_; prefix to use in user-friendly message (optional, defaults to "Validation error"). Pass `null` to disable prefix completely.
- `prefixSeparator` - _string_; used to concatenate prefix with rest of the user-friendly message (optional, defaults to ": "). Not used when `prefix` is `null`.
- `includePath` - _boolean_; used to provide control on whether to include the erroneous property name suffix or not (optional, defaults to `true`).
They will be passed as arguments to the [createMessageBuilder](#createMessageBuilder) function. The only reason they exist is to provide backwards-compatibility with older versions of `zod-validation-error`. They should however be considered deprecated and may be removed in the future.
### fromZodError
Converts zod error to `ValidationError`.
_Why is the difference between `ZodError` and `ZodIssue`?_ A `ZodError` is a collection of 1 or more `ZodIssue` instances. It's what you get when you call `zodSchema.parse()`.
#### Arguments
- `zodError` - _zod.ZodError_; a ZodError instance (required)
- `options` - _Object_; formatting options (optional)
- `messageBuilder` - _MessageBuilder_; a function that accepts an array of `zod.ZodIssue` objects and returns a user-friendly error message in the form of a `string` (optional).
#### Notes
Alternatively, you may pass the following `options` instead of a `messageBuilder`.
- `options` - _Object_; formatting options (optional)
- `maxIssuesInMessage` - _number_; max issues to include in user-friendly message (optional, defaults to 99)
- `issueSeparator` - _string_; used to concatenate issues in user-friendly message (optional, defaults to ";")
- `unionSeparator` - _string_; used to concatenate union-issues in user-friendly message (optional, defaults to ", or")
- `prefix` - _string_ or _null_; prefix to use in user-friendly message (optional, defaults to "Validation error"). Pass `null` to disable prefix completely.
- `prefixSeparator` - _string_; used to concatenate prefix with rest of the user-friendly message (optional, defaults to ": "). Not used when `prefix` is `null`.
- `includePath` - _boolean_; used to provide control on whether to include the erroneous property name suffix or not (optional, defaults to `true`).
They will be passed as arguments to the [createMessageBuilder](#createMessageBuilder) function. The only reason they exist is to provide backwards-compatibility with older versions of `zod-validation-error`. They should however be considered deprecated and may be removed in the future.
### toValidationError
A curried version of `fromZodError` meant to be used for FP (Functional Programming). Note it first takes the options object if needed and returns a function that converts the `zodError` to a `ValidationError` object
```js
toValidationError(options) => (zodError) => ValidationError
```
#### Example using fp-ts
```typescript
import * as Either from 'fp-ts/Either';
import { z as zod } from 'zod/v3';
import { toValidationError, ValidationError } from 'zod-validation-error/v3';
// create zod schema
const zodSchema = zod
.object({
id: zod.number().int().positive(),
email: zod.string().email(),
})
.brand<'User'>();
export type User = zod.infer<typeof zodSchema>;
export function parse(
value: zod.input<typeof zodSchema>
): Either.Either<ValidationError, User> {
return Either.tryCatch(() => schema.parse(value), toValidationError());
}
```
## MessageBuilder
`zod-validation-error` can be configured with a custom `MessageBuilder` function in order to produce case-specific error messages.
#### Example
For instance, one may want to print `invalid_string` errors to the console in red color.
```typescript
import { z as zod } from 'zod/v3';
import { type MessageBuilder, fromError } from 'zod-validation-error/v3';
import chalk from 'chalk';
// create custom MessageBuilder
const myMessageBuilder: MessageBuilder = (issues) => {
return (
issues
// format error message
.map((issue) => {
if (issue.code === zod.ZodIssueCode.invalid_string) {
return chalk.red(issue.message);
}
return issue.message;
})
// join as string with new-line character
.join('\n')
);
};
// create zod schema
const zodSchema = zod.object({
id: zod.number().int().positive(),
email: zod.string().email(),
});
// parse some invalid value
try {
zodSchema.parse({
id: 1,
email: 'foobar', // note: invalid email value
});
} catch (err) {
const validationError = fromError(err, {
messageBuilder: myMessageBuilder,
});
// the error is now displayed with red letters
console.log(validationError.toString());
}
```
## FAQ
### How to distinguish between errors
Use the `isValidationErrorLike` type guard.
#### Example
Scenario: Distinguish between `ValidationError` VS generic `Error` in order to respond with 400 VS 500 HTTP status code respectively.
```typescript
import * as Either from 'fp-ts/Either';
import { z as zod } from 'zod/v3';
import { isValidationErrorLike } from 'zod-validation-error/v3';
try {
func(); // throws Error - or - ValidationError
} catch (err) {
if (isValidationErrorLike(err)) {
return 400; // Bad Data (this is a client error)
}
return 500; // Server Error
}
```
### How to use `ValidationError` outside `zod`
It's possible to implement custom validation logic outside `zod` and throw a `ValidationError`.
#### Example 1: passing custom message
```typescript
import { ValidationError } from 'zod-validation-error/v3';
import { Buffer } from 'node:buffer';
function parseBuffer(buf: unknown): Buffer {
if (!Buffer.isBuffer(buf)) {
throw new ValidationError('Invalid argument; expected buffer');
}
return buf;
}
```
#### Example 2: passing custom message and original error as cause
```typescript
import { ValidationError } from 'zod-validation-error/v3';
try {
// do something that throws an error
} catch (err) {
throw new ValidationError('Something went deeply wrong', { cause: err });
}
```
### How to use `ValidationError` with custom "error map"
Zod supports customizing error messages by providing a custom "error map". You may combine this with `zod-validation-error` to produce user-friendly messages.
#### Example 1: produce user-friendly error messages using the `errorMap` property
If all you need is to produce user-friendly error messages you may use the `errorMap` property.
```typescript
import { z as zod } from 'zod/v3';
import { errorMap } from 'zod-validation-error/v3';
zod.setErrorMap(errorMap);
```
#### Example 2: extra customization using `fromZodIssue`
If you need to customize some error code, you may use the `fromZodIssue` function.
```typescript
import { z as zod } from 'zod/v3';
import { fromZodIssue } from 'zod-validation-error/v3';
const customErrorMap: zod.ZodErrorMap = (issue, ctx) => {
switch (issue.code) {
case ZodIssueCode.invalid_type: {
return {
message:
'Custom error message of your preference for invalid_type errors',
};
}
default: {
const validationError = fromZodIssue({
...issue,
// fallback to the default error message
// when issue does not have a message
message: issue.message ?? ctx.defaultError,
});
return {
message: validationError.message,
};
}
}
};
zod.setErrorMap(customErrorMap);
```
### How to use `zod-validation-error` with `react-hook-form`?
```typescript
import { useForm } from 'react-hook-form';
import { zodResolver } from '@hookform/resolvers/zod';
import { errorMap } from 'zod-validation-error/v3';
useForm({
resolver: zodResolver(schema, { errorMap }),
});
```
### Does `zod-validation-error` support CommonJS
Yes, `zod-validation-error` supports CommonJS out-of-the-box. All you need to do is import it using `require`.
#### Example
```typescript
const { ValidationError } = require('zod-validation-error');
```
## Contribute
Source code contributions are most welcome. Please open a PR, ensure the linter is satisfied and all tests pass.
#### We are hiring
Causaly is building the world's largest biomedical knowledge platform, using technologies such as TypeScript, React and Node.js. Find out more about our openings at https://jobs.ashbyhq.com/causaly.
## License
MIT
@@ -0,0 +1,44 @@
/**
* gridstack.component.ts 12.6.0
* Copyright (c) 2022-2024 Alain Dumesny - see GridStack root license
*/
import { NgModule } from "@angular/core";
import { GridstackItemComponent } from "./gridstack-item.component";
import { GridstackComponent } from "./gridstack.component";
/**
* @deprecated Use GridstackComponent and GridstackItemComponent as standalone components instead.
*
* This NgModule is provided for backward compatibility but is no longer the recommended approach.
* Import components directly in your standalone components or use the new Angular module structure.
*
* @example
* ```typescript
* // Preferred approach - standalone components
* @Component({
* selector: 'my-app',
* imports: [GridstackComponent, GridstackItemComponent],
* template: '<gridstack></gridstack>'
* })
* export class AppComponent {}
*
* // Legacy approach (deprecated)
* @NgModule({
* imports: [GridstackModule]
* })
* export class AppModule {}
* ```
*/
@NgModule({
imports: [
GridstackItemComponent,
GridstackComponent,
],
exports: [
GridstackItemComponent,
GridstackComponent,
],
})
export class GridstackModule {}
@@ -0,0 +1 @@
module.exports={C:{"48":0.00319,"52":0.00319,"55":0.00319,"57":0.00319,"59":0.00319,"60":0.00319,"63":0.00319,"66":0.00319,"68":0.00319,"76":0.00319,"112":0.00319,"115":0.04151,"120":0.98983,"121":2.03713,"123":0.01277,"124":0.00958,"127":0.00958,"129":0.00319,"131":0.00319,"133":0.00319,"135":0.00319,"136":0.03193,"140":0.01277,"142":0.00319,"147":0.00319,"149":0.00639,"150":0.01277,"151":0.00319,"152":0.00319,"153":0.01597,"154":0.17242,"155":0.34165,"156":0.19797,"157":0.00958,_:"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 49 50 51 53 54 56 58 61 62 64 65 67 69 70 71 72 73 74 75 77 78 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 113 114 116 117 118 119 122 125 126 128 130 132 134 137 138 139 141 143 144 145 146 148 158 159 160 3.5","3.6":0.00319},D:{"50":0.00319,"56":0.01277,"60":0.00319,"61":0.00319,"62":0.00639,"63":0.00319,"64":0.00639,"65":0.00319,"66":0.00639,"67":0.00639,"68":0.00958,"69":0.01916,"70":0.00639,"71":0.00319,"72":0.00319,"73":0.00639,"75":0.00319,"77":0.00319,"79":0.00319,"81":0.02554,"83":0.00639,"86":0.02874,"87":0.00958,"88":0.00319,"90":0.00319,"93":0.00319,"95":0.00958,"98":0.03193,"101":0.07025,"103":0.30014,"104":0.28737,"105":0.28737,"106":0.28098,"107":0.29376,"108":0.30014,"109":0.43106,"110":0.29695,"111":0.30334,"112":0.30014,"114":0.02235,"116":0.60348,"117":0.2746,"118":1.53264,"119":2.04352,"120":2.22233,"121":0.00639,"122":0.02874,"123":0.01597,"124":0.30014,"126":0.00958,"127":0.00319,"128":0.01277,"129":0.00639,"130":0.00639,"131":0.61306,"132":0.00319,"133":0.67692,"134":0.11495,"135":0.12133,"136":0.1373,"137":0.14049,"138":0.16604,"139":0.12133,"140":0.15007,"141":0.14369,"142":0.39593,"143":0.03512,"144":0.02235,"145":0.0447,"146":0.20116,"147":0.01597,"148":0.06705,"149":0.59709,"150":0.23628,"151":0.66734,"152":2.34047,"153":1.6412,"154":0.46618,"155":0.00319,_:"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 51 52 53 54 55 57 58 59 74 76 78 80 84 85 89 91 92 94 96 97 99 100 102 113 115 125 156 157"},F:{"46":0.00319,"50":0.00319,"51":0.00639,"52":0.00319,"53":0.00639,"54":0.00639,"55":0.00639,"56":0.01277,"57":0.00319,"58":0.00319,"62":0.00319,"72":0.00319,"100":0.00319,"101":0.01597,"102":0.00319,"105":0.00319,"106":0.00958,"109":0.00319,"111":0.00319,"114":0.00319,"119":0.00319,"120":0.00319,"121":0.00319,"131":0.00639,"134":0.01597,"135":0.26821,_:"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 60 63 64 65 66 67 68 69 70 71 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 103 104 107 108 110 112 113 115 116 117 118 122 123 124 125 126 127 132 133 9.5-9.6 10.0-10.1 10.5 10.6 11.1 11.6 12.1","11.5":0.00319},B:{"17":0.00639,"18":0.00958,"89":0.00639,"90":0.00319,"92":0.03512,"100":0.00319,"105":0.00319,"109":0.00319,"114":0.00319,"119":1.00899,"120":0.9579,"122":0.00639,"123":0.01597,"124":0.00319,"125":0.00319,"131":0.00319,"132":0.00319,"133":0.00319,"135":0.00319,"139":0.00319,"140":0.00639,"142":0.00319,"143":0.00319,"144":0.00319,"145":0.0447,"146":0.00639,"147":0.01597,"148":0.01597,"149":0.00958,"150":0.02235,"151":0.09898,"152":0.66734,"153":0.5492,"154":0.1373,_:"12 13 14 15 16 79 80 81 83 84 85 86 87 88 91 93 94 95 96 97 98 99 101 102 103 104 106 107 108 110 111 112 113 115 116 117 118 121 126 127 128 129 130 134 136 137 138 141"},E:{"27":0.02554,_:"4 5 6 7 8 9 10 11 12 13 14 15 3.1 3.2 5.1 6.1 7.1 9.1 12.1 13.1 15.1 15.4 15.5 16.0 16.1 16.2 16.4 16.5 17.0 17.2 17.3 17.4 17.5 18.1 18.2 18.4 18.5-18.7 26.1 26.2 27.1 27.2 TP","10.1":0.00639,"11.1":0.00319,"14.1":0.00319,"15.2-15.3":0.06067,"15.6":0.02554,"16.3":0.00319,"16.6":0.00958,"17.1":0.00639,"17.6":0.01277,"18.0":0.00319,"18.3":0.00319,"26.0":0.00319,"26.3":0.01916,"26.4":0.00319,"26.5":0.02874,"26.6":0.06705},G:{"8":0,"3.2":0,"4.0-4.1":0,"4.2-4.3":0.00067,"5.0-5.1":0.00067,"6.0-6.1":0,"7.0-7.1":0.00134,"8.1-8.4":0,"9.0-9.2":0,"9.3":0,"10.0-10.2":0,"10.3":0.0067,"11.0-11.2":0.00067,"11.3-11.4":0.00134,"12.0-12.1":0,"12.2-12.5":0.01743,"13.0-13.1":0,"13.2":0.00335,"13.3":0,"13.4-13.7":0.00067,"14.0-14.4":0.00268,"14.5-14.8":0.00402,"15.0-15.1":0.00402,"15.2-15.3":0.00268,"15.4":0.00335,"15.5":0.00402,"15.6-15.8":0.08715,"16.0":0.0067,"16.1":0.01207,"16.2":0.0067,"16.3":0.01475,"16.4":0.00335,"16.5":0.00536,"16.6-16.7":0.12134,"17.0":0.00469,"17.1":0.0067,"17.2":0.0067,"17.3":0.01006,"17.4":0.01408,"17.5":0.02749,"17.6-17.7":0.07106,"18.0":0.01475,"18.1":0.0295,"18.2":0.04022,"18.3":0.06972,"18.4":0.04358,"18.5-18.7":0.90034,"26.0":0.04358,"26.1":0.04425,"26.2":0.11531,"26.3":0.12469,"26.4":0.09117,"26.5":0.61073,"26.6":3.76827,"27.0":0.28894,"27.1":0,"27.2":0.00737},P:{"4":0.02829,"21":0.00943,"22":0.01886,"23":0.03772,"24":0.02829,"25":0.01886,"26":0.03772,"27":0.066,"28Line truncated
@@ -0,0 +1,68 @@
import type { Program } from 'typescript';
import type { Lib } from './lib';
export type DebugLevel = boolean | ('eslint' | 'typescript' | 'typescript-eslint')[];
export type CacheDurationSeconds = number | 'Infinity';
export type EcmaVersion = 3 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 2015 | 2016 | 2017 | 2018 | 2019 | 2020 | 2021 | 2022 | 2023 | 2024 | 2025 | 2026 | 'latest' | undefined;
export type SourceTypeClassic = 'module' | 'script';
export type SourceType = 'commonjs' | SourceTypeClassic;
export type JSDocParsingMode = 'all' | 'none' | 'type-info';
/**
* Granular options to configure the project service.
*/
export interface ProjectServiceOptions {
/**
* Globs of files to allow running with the default project compiler options
* despite not being matched by the project service.
*/
allowDefaultProject?: string[];
/**
* Path to a TSConfig to use instead of TypeScript's default project configuration.
* @default 'tsconfig.json'
*/
defaultProject?: string;
/**
* Whether to allow TypeScript plugins as configured in the TSConfig.
*/
loadTypeScriptPlugins?: boolean;
/**
* The maximum number of files {@link allowDefaultProject} may match.
* Each file match slows down linting, so if you do need to use this, please
* file an informative issue on typescript-eslint explaining why - so we can
* help you avoid using it!
* @default 8
*/
maximumDefaultProjectFileMatchCount_THIS_WILL_SLOW_DOWN_LINTING?: number;
}
export interface ParserOptions {
[additionalProperties: string]: unknown;
cacheLifetime?: {
glob?: CacheDurationSeconds;
};
debugLevel?: DebugLevel;
ecmaFeatures?: {
[key: string]: unknown;
globalReturn?: boolean | undefined;
jsx?: boolean | undefined;
} | undefined;
ecmaVersion?: EcmaVersion;
emitDecoratorMetadata?: boolean;
errorOnTypeScriptSyntacticAndSemanticIssues?: boolean;
errorOnUnknownASTType?: boolean;
experimentalDecorators?: boolean;
extraFileExtensions?: string[];
filePath?: string;
isolatedDeclarations?: boolean;
jsDocParsingMode?: JSDocParsingMode;
jsxFragmentName?: string | null;
jsxPragma?: string | null;
lib?: Lib[];
programs?: Program[] | null;
project?: boolean | string | string[] | null;
projectFolderIgnoreList?: string[];
projectService?: boolean | ProjectServiceOptions;
range?: boolean;
sourceType?: SourceType | undefined;
tokens?: boolean;
tsconfigRootDir?: string;
warnOnUnsupportedTypeScriptVersion?: boolean;
}
@@ -0,0 +1,60 @@
"use client";
const require_runtime = require("./_virtual/_rolldown/runtime.cjs");
const require_utils = require("./utils.cjs");
const require_useRouter = require("./useRouter.cjs");
let react = require("react");
react = require_runtime.__toESM(react);
//#region src/useNavigate.tsx
/**
* Imperative navigation hook.
*
* Returns a stable `navigate(options)` function to change the current location
* programmatically. Prefer the `Link` component for user-initiated navigation,
* and use this hook from effects, callbacks, or handlers where imperative
* navigation is required.
*
* Options:
* - `from`: Optional route base used to resolve relative `to` paths.
*
* @returns A function that accepts `NavigateOptions`.
* @link https://tanstack.com/router/latest/docs/framework/react/api/router/useNavigateHook
*/
function useNavigate(_defaultOpts) {
const router = require_useRouter.useRouter();
return react.useCallback((options) => {
return router.navigate({
...options,
from: options.from ?? _defaultOpts?.from
});
}, [_defaultOpts?.from, router]);
}
/**
* Component that triggers a navigation when rendered. Navigation executes
* in an effect after mount/update.
*
* Props are the same as `NavigateOptions` used by `navigate()`.
*
* @returns null
* @link https://tanstack.com/router/latest/docs/framework/react/api/router/navigateComponent
*/
function Navigate(props) {
const router = require_useRouter.useRouter();
const navigate = useNavigate();
const previousPropsRef = react.useRef(null);
require_utils.useLayoutEffect(() => {
if (previousPropsRef.current !== props) {
navigate(props);
previousPropsRef.current = props;
}
}, [
router,
props,
navigate
]);
return null;
}
//#endregion
exports.Navigate = Navigate;
exports.useNavigate = useNavigate;
//# sourceMappingURL=useNavigate.cjs.map
@@ -0,0 +1,4 @@
import { parseDef } from "../parseDef.js";
export const parseReadonlyDef = (def, refs) => {
return parseDef(def.innerType._def, refs);
};
@@ -0,0 +1,612 @@
/**
* @fileoverview Rule to require or disallow newlines between statements
* @author Toru Nagashima
* @deprecated in ESLint v8.53.0
*/
"use strict";
//------------------------------------------------------------------------------
// Requirements
//------------------------------------------------------------------------------
const astUtils = require("./utils/ast-utils");
//------------------------------------------------------------------------------
// Helpers
//------------------------------------------------------------------------------
const LT = `[${Array.from(astUtils.LINEBREAKS).join("")}]`;
const PADDING_LINE_SEQUENCE = new RegExp(
String.raw`^(\s*?${LT})\s*${LT}(\s*;?)$`,
"u",
);
const CJS_EXPORT = /^(?:module\s*\.\s*)?exports(?:\s*\.|\s*\[|$)/u;
const CJS_IMPORT = /^require\(/u;
/**
* Creates tester which check if a node starts with specific keyword.
* @param {string} keyword The keyword to test.
* @returns {Object} the created tester.
* @private
*/
function newKeywordTester(keyword) {
return {
test: (node, sourceCode) =>
sourceCode.getFirstToken(node).value === keyword,
};
}
/**
* Creates tester which check if a node starts with specific keyword and spans a single line.
* @param {string} keyword The keyword to test.
* @returns {Object} the created tester.
* @private
*/
function newSinglelineKeywordTester(keyword) {
return {
test: (node, sourceCode) =>
node.loc.start.line === node.loc.end.line &&
sourceCode.getFirstToken(node).value === keyword,
};
}
/**
* Creates tester which check if a node starts with specific keyword and spans multiple lines.
* @param {string} keyword The keyword to test.
* @returns {Object} the created tester.
* @private
*/
function newMultilineKeywordTester(keyword) {
return {
test: (node, sourceCode) =>
node.loc.start.line !== node.loc.end.line &&
sourceCode.getFirstToken(node).value === keyword,
};
}
/**
* Creates tester which check if a node is specific type.
* @param {string} type The node type to test.
* @returns {Object} the created tester.
* @private
*/
function newNodeTypeTester(type) {
return {
test: node => node.type === type,
};
}
/**
* Checks the given node is an expression statement of IIFE.
* @param {ASTNode} node The node to check.
* @returns {boolean} `true` if the node is an expression statement of IIFE.
* @private
*/
function isIIFEStatement(node) {
if (node.type === "ExpressionStatement") {
let call = astUtils.skipChainExpression(node.expression);
if (call.type === "UnaryExpression") {
call = astUtils.skipChainExpression(call.argument);
}
return (
call.type === "CallExpression" && astUtils.isFunction(call.callee)
);
}
return false;
}
/**
* Checks whether the given node is a block-like statement.
* This checks the last token of the node is the closing brace of a block.
* @param {SourceCode} sourceCode The source code to get tokens.
* @param {ASTNode} node The node to check.
* @returns {boolean} `true` if the node is a block-like statement.
* @private
*/
function isBlockLikeStatement(sourceCode, node) {
// do-while with a block is a block-like statement.
if (
node.type === "DoWhileStatement" &&
node.body.type === "BlockStatement"
) {
return true;
}
/*
* IIFE is a block-like statement specially from
* JSCS#disallowPaddingNewLinesAfterBlocks.
*/
if (isIIFEStatement(node)) {
return true;
}
// Checks the last token is a closing brace of blocks.
const lastToken = sourceCode.getLastToken(
node,
astUtils.isNotSemicolonToken,
);
const belongingNode =
lastToken && astUtils.isClosingBraceToken(lastToken)
? sourceCode.getNodeByRangeIndex(lastToken.range[0])
: null;
return (
Boolean(belongingNode) &&
(belongingNode.type === "BlockStatement" ||
belongingNode.type === "SwitchStatement")
);
}
/**
* Gets the actual last token.
*
* If a semicolon is semicolon-less style's semicolon, this ignores it.
* For example:
*
* foo()
* ;[1, 2, 3].forEach(bar)
* @param {SourceCode} sourceCode The source code to get tokens.
* @param {ASTNode} node The node to get.
* @returns {Token} The actual last token.
* @private
*/
function getActualLastToken(sourceCode, node) {
const semiToken = sourceCode.getLastToken(node);
const prevToken = sourceCode.getTokenBefore(semiToken);
const nextToken = sourceCode.getTokenAfter(semiToken);
const isSemicolonLessStyle = Boolean(
prevToken &&
nextToken &&
prevToken.range[0] >= node.range[0] &&
astUtils.isSemicolonToken(semiToken) &&
semiToken.loc.start.line !== prevToken.loc.end.line &&
semiToken.loc.end.line === nextToken.loc.start.line,
);
return isSemicolonLessStyle ? prevToken : semiToken;
}
/**
* This returns the concatenation of the first 2 captured strings.
* @param {string} _ Unused. Whole matched string.
* @param {string} trailingSpaces The trailing spaces of the first line.
* @param {string} indentSpaces The indentation spaces of the last line.
* @returns {string} The concatenation of trailingSpaces and indentSpaces.
* @private
*/
function replacerToRemovePaddingLines(_, trailingSpaces, indentSpaces) {
return trailingSpaces + indentSpaces;
}
/**
* Check and report statements for `any` configuration.
* It does nothing.
* @returns {void}
* @private
*/
function verifyForAny() {}
/**
* Check and report statements for `never` configuration.
* This autofix removes blank lines between the given 2 statements.
* However, if comments exist between 2 blank lines, it does not remove those
* blank lines automatically.
* @param {RuleContext} context The rule context to report.
* @param {ASTNode} _ Unused. The previous node to check.
* @param {ASTNode} nextNode The next node to check.
* @param {Array<Token[]>} paddingLines The array of token pairs that blank
* lines exist between the pair.
* @returns {void}
* @private
*/
function verifyForNever(context, _, nextNode, paddingLines) {
if (paddingLines.length === 0) {
return;
}
context.report({
node: nextNode,
messageId: "unexpectedBlankLine",
fix(fixer) {
if (paddingLines.length >= 2) {
return null;
}
const prevToken = paddingLines[0][0];
const nextToken = paddingLines[0][1];
const start = prevToken.range[1];
const end = nextToken.range[0];
const text = context.sourceCode.text
.slice(start, end)
.replace(PADDING_LINE_SEQUENCE, replacerToRemovePaddingLines);
return fixer.replaceTextRange([start, end], text);
},
});
}
/**
* Check and report statements for `always` configuration.
* This autofix inserts a blank line between the given 2 statements.
* If the `prevNode` has trailing comments, it inserts a blank line after the
* trailing comments.
* @param {RuleContext} context The rule context to report.
* @param {ASTNode} prevNode The previous node to check.
* @param {ASTNode} nextNode The next node to check.
* @param {Array<Token[]>} paddingLines The array of token pairs that blank
* lines exist between the pair.
* @returns {void}
* @private
*/
function verifyForAlways(context, prevNode, nextNode, paddingLines) {
if (paddingLines.length > 0) {
return;
}
context.report({
node: nextNode,
messageId: "expectedBlankLine",
fix(fixer) {
const sourceCode = context.sourceCode;
let prevToken = getActualLastToken(sourceCode, prevNode);
const nextToken =
sourceCode.getFirstTokenBetween(prevToken, nextNode, {
includeComments: true,
/**
* Skip the trailing comments of the previous node.
* This inserts a blank line after the last trailing comment.
*
* For example:
*
* foo(); // trailing comment.
* // comment.
* bar();
*
* Get fixed to:
*
* foo(); // trailing comment.
*
* // comment.
* bar();
* @param {Token} token The token to check.
* @returns {boolean} `true` if the token is not a trailing comment.
* @private
*/
filter(token) {
if (astUtils.isTokenOnSameLine(prevToken, token)) {
prevToken = token;
return false;
}
return true;
},
}) || nextNode;
const insertText = astUtils.isTokenOnSameLine(prevToken, nextToken)
? "\n\n"
: "\n";
return fixer.insertTextAfter(prevToken, insertText);
},
});
}
/**
* Types of blank lines.
* `any`, `never`, and `always` are defined.
* Those have `verify` method to check and report statements.
* @private
*/
const PaddingTypes = {
any: { verify: verifyForAny },
never: { verify: verifyForNever },
always: { verify: verifyForAlways },
};
/**
* Types of statements.
* Those have `test` method to check it matches to the given statement.
* @private
*/
const StatementTypes = {
"*": { test: () => true },
"block-like": {
test: (node, sourceCode) => isBlockLikeStatement(sourceCode, node),
},
"cjs-export": {
test: (node, sourceCode) =>
node.type === "ExpressionStatement" &&
node.expression.type === "AssignmentExpression" &&
CJS_EXPORT.test(sourceCode.getText(node.expression.left)),
},
"cjs-import": {
test: (node, sourceCode) =>
node.type === "VariableDeclaration" &&
node.declarations.length > 0 &&
Boolean(node.declarations[0].init) &&
CJS_IMPORT.test(sourceCode.getText(node.declarations[0].init)),
},
directive: {
test: astUtils.isDirective,
},
expression: {
test: node =>
node.type === "ExpressionStatement" && !astUtils.isDirective(node),
},
iife: {
test: isIIFEStatement,
},
"multiline-block-like": {
test: (node, sourceCode) =>
node.loc.start.line !== node.loc.end.line &&
isBlockLikeStatement(sourceCode, node),
},
"multiline-expression": {
test: node =>
node.loc.start.line !== node.loc.end.line &&
node.type === "ExpressionStatement" &&
!astUtils.isDirective(node),
},
"multiline-const": newMultilineKeywordTester("const"),
"multiline-let": newMultilineKeywordTester("let"),
"multiline-var": newMultilineKeywordTester("var"),
"singleline-const": newSinglelineKeywordTester("const"),
"singleline-let": newSinglelineKeywordTester("let"),
"singleline-var": newSinglelineKeywordTester("var"),
block: newNodeTypeTester("BlockStatement"),
empty: newNodeTypeTester("EmptyStatement"),
function: newNodeTypeTester("FunctionDeclaration"),
break: newKeywordTester("break"),
case: newKeywordTester("case"),
class: newKeywordTester("class"),
const: newKeywordTester("const"),
continue: newKeywordTester("continue"),
debugger: newKeywordTester("debugger"),
default: newKeywordTester("default"),
do: newKeywordTester("do"),
export: newKeywordTester("export"),
for: newKeywordTester("for"),
if: newKeywordTester("if"),
import: newKeywordTester("import"),
let: newKeywordTester("let"),
return: newKeywordTester("return"),
switch: newKeywordTester("switch"),
throw: newKeywordTester("throw"),
try: newKeywordTester("try"),
var: newKeywordTester("var"),
while: newKeywordTester("while"),
with: newKeywordTester("with"),
};
//------------------------------------------------------------------------------
// 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: "padding-line-between-statements",
url: "https://eslint.style/rules/padding-line-between-statements",
},
},
],
},
type: "layout",
docs: {
description: "Require or disallow padding lines between statements",
recommended: false,
url: "https://eslint.org/docs/latest/rules/padding-line-between-statements",
},
fixable: "whitespace",
schema: {
definitions: {
paddingType: {
enum: Object.keys(PaddingTypes),
},
statementType: {
anyOf: [
{ enum: Object.keys(StatementTypes) },
{
type: "array",
items: { enum: Object.keys(StatementTypes) },
minItems: 1,
uniqueItems: true,
},
],
},
},
type: "array",
items: {
type: "object",
properties: {
blankLine: { $ref: "#/definitions/paddingType" },
prev: { $ref: "#/definitions/statementType" },
next: { $ref: "#/definitions/statementType" },
},
additionalProperties: false,
required: ["blankLine", "prev", "next"],
},
},
messages: {
unexpectedBlankLine: "Unexpected blank line before this statement.",
expectedBlankLine: "Expected blank line before this statement.",
},
},
create(context) {
const sourceCode = context.sourceCode;
const configureList = context.options || [];
let scopeInfo = null;
/**
* Processes to enter to new scope.
* This manages the current previous statement.
* @returns {void}
* @private
*/
function enterScope() {
scopeInfo = {
upper: scopeInfo,
prevNode: null,
};
}
/**
* Processes to exit from the current scope.
* @returns {void}
* @private
*/
function exitScope() {
scopeInfo = scopeInfo.upper;
}
/**
* Checks whether the given node matches the given type.
* @param {ASTNode} node The statement node to check.
* @param {string|string[]} type The statement type to check.
* @returns {boolean} `true` if the statement node matched the type.
* @private
*/
function match(node, type) {
let innerStatementNode = node;
while (innerStatementNode.type === "LabeledStatement") {
innerStatementNode = innerStatementNode.body;
}
if (Array.isArray(type)) {
return type.some(match.bind(null, innerStatementNode));
}
return StatementTypes[type].test(innerStatementNode, sourceCode);
}
/**
* Finds the last matched configure from configureList.
* @param {ASTNode} prevNode The previous statement to match.
* @param {ASTNode} nextNode The current statement to match.
* @returns {Object} The tester of the last matched configure.
* @private
*/
function getPaddingType(prevNode, nextNode) {
for (let i = configureList.length - 1; i >= 0; --i) {
const configure = configureList[i];
const matched =
match(prevNode, configure.prev) &&
match(nextNode, configure.next);
if (matched) {
return PaddingTypes[configure.blankLine];
}
}
return PaddingTypes.any;
}
/**
* Gets padding line sequences between the given 2 statements.
* Comments are separators of the padding line sequences.
* @param {ASTNode} prevNode The previous statement to count.
* @param {ASTNode} nextNode The current statement to count.
* @returns {Array<Token[]>} The array of token pairs.
* @private
*/
function getPaddingLineSequences(prevNode, nextNode) {
const pairs = [];
let prevToken = getActualLastToken(sourceCode, prevNode);
if (nextNode.loc.start.line - prevToken.loc.end.line >= 2) {
do {
const token = sourceCode.getTokenAfter(prevToken, {
includeComments: true,
});
if (token.loc.start.line - prevToken.loc.end.line >= 2) {
pairs.push([prevToken, token]);
}
prevToken = token;
} while (prevToken.range[0] < nextNode.range[0]);
}
return pairs;
}
/**
* Verify padding lines between the given node and the previous node.
* @param {ASTNode} node The node to verify.
* @returns {void}
* @private
*/
function verify(node) {
const parentType = node.parent.type;
const validParent =
astUtils.STATEMENT_LIST_PARENTS.has(parentType) ||
parentType === "SwitchStatement";
if (!validParent) {
return;
}
// Save this node as the current previous statement.
const prevNode = scopeInfo.prevNode;
// Verify.
if (prevNode) {
const type = getPaddingType(prevNode, node);
const paddingLines = getPaddingLineSequences(prevNode, node);
type.verify(context, prevNode, node, paddingLines);
}
scopeInfo.prevNode = node;
}
/**
* Verify padding lines between the given node and the previous node.
* Then process to enter to new scope.
* @param {ASTNode} node The node to verify.
* @returns {void}
* @private
*/
function verifyThenEnterScope(node) {
verify(node);
enterScope();
}
return {
Program: enterScope,
BlockStatement: enterScope,
SwitchStatement: enterScope,
StaticBlock: enterScope,
"Program:exit": exitScope,
"BlockStatement:exit": exitScope,
"SwitchStatement:exit": exitScope,
"StaticBlock:exit": exitScope,
":statement": verify,
SwitchCase: verifyThenEnterScope,
"SwitchCase:exit": exitScope,
};
},
};
@@ -0,0 +1 @@
{"version":3,"file":"sigma-square.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;"}
@@ -0,0 +1 @@
{"version":3,"file":"joystick.js","sources":["../../../src/icons/joystick.ts"],"sourcesContent":["import createLucideIcon from '../createLucideIcon';\n\n/**\n * @component @name Joystick\n * @description Lucide SVG icon component, renders SVG Element with children.\n *\n * @preview ![img](data:image/svg+xml;base64,PHN2ZyAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogIHdpZHRoPSIyNCIKICBoZWlnaHQ9IjI0IgogIHZpZXdCb3g9IjAgMCAyNCAyNCIKICBmaWxsPSJub25lIgogIHN0cm9rZT0iIzAwMCIgc3R5bGU9ImJhY2tncm91bmQtY29sb3I6ICNmZmY7IGJvcmRlci1yYWRpdXM6IDJweCIKICBzdHJva2Utd2lkdGg9IjIiCiAgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIgogIHN0cm9rZS1saW5lam9pbj0icm91bmQiCj4KICA8cGF0aCBkPSJNMjEgMTdhMiAyIDAgMCAwLTItMkg1YTIgMiAwIDAgMC0yIDJ2MmEyIDIgMCAwIDAgMiAyaDE0YTIgMiAwIDAgMCAyLTJ2LTJaIiAvPgogIDxwYXRoIGQ9Ik02IDE1di0yIiAvPgogIDxwYXRoIGQ9Ik0xMiAxNVY5IiAvPgogIDxjaXJjbGUgY3g9IjEyIiBjeT0iNiIgcj0iMyIgLz4KPC9zdmc+Cg==) - https://lucide.dev/icons/joystick\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 Joystick = createLucideIcon('Joystick', [\n [\n 'path',\n {\n d: 'M21 17a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v2a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-2Z',\n key: 'jg2n2t',\n },\n ],\n ['path', { d: 'M6 15v-2', key: 'gd6mvg' }],\n ['path', { d: 'M12 15V9', key: '8c7uyn' }],\n ['circle', { cx: '12', cy: '6', r: '3', key: '1gm2ql' }],\n]);\n\nexport default Joystick;\n"],"names":[],"mappings":";;;;;;;;;AAaM,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAW,iBAAiB,UAAY,CAAA,CAAA,CAAA;AAAA,CAC5C,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;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,CAAY,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA,CAAA;AAAA,CACzC,CAAA,CAAC,QAAU,CAAA,CAAA,CAAA,CAAE,EAAI,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAM,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;AACzD,CAAC,CAAA,CAAA;;"}
@@ -0,0 +1 @@
{"version":3,"file":"percent-square.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;"}
@@ -0,0 +1,596 @@
import {createParser, type EventSourceMessage, type EventSourceParser} from 'eventsource-parser'
import {ErrorEvent, flattenError, syntaxError} from './errors.js'
import type {
AddEventListenerOptions,
EventListenerOptions,
EventListenerOrEventListenerObject,
EventSourceEventMap,
EventSourceFetchInit,
EventSourceInit,
FetchLike,
FetchLikeResponse,
} from './types.js'
/**
* An `EventSource` instance opens a persistent connection to an HTTP server, which sends events
* in `text/event-stream` format. The connection remains open until closed by calling `.close()`.
*
* @public
* @example
* ```js
* const eventSource = new EventSource('https://example.com/stream')
* eventSource.addEventListener('error', (error) => {
* console.error(error)
* })
* eventSource.addEventListener('message', (event) => {
* console.log('Received message:', event.data)
* })
* ```
*/
export class EventSource extends EventTarget {
/**
* ReadyState representing an EventSource currently trying to connect
*
* @public
*/
static CONNECTING = 0 as const
/**
* ReadyState representing an EventSource connection that is open (eg connected)
*
* @public
*/
static OPEN = 1 as const
/**
* ReadyState representing an EventSource connection that is closed (eg disconnected)
*
* @public
*/
static CLOSED = 2 as const
/**
* ReadyState representing an EventSource currently trying to connect
*
* @public
*/
readonly CONNECTING = 0 as const
/**
* ReadyState representing an EventSource connection that is open (eg connected)
*
* @public
*/
readonly OPEN = 1 as const
/**
* ReadyState representing an EventSource connection that is closed (eg disconnected)
*
* @public
*/
readonly CLOSED = 2 as const
/**
* Returns the state of this EventSource object's connection. It can have the values described below.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/readyState)
*
* Note: typed as `number` instead of `0 | 1 | 2` for compatibility with the `EventSource` interface,
* defined in the TypeScript `dom` library.
*
* @public
*/
public get readyState(): number {
return this.#readyState
}
/**
* Returns the URL providing the event stream.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/url)
*
* @public
*/
public get url(): string {
return this.#url.href
}
/**
* Returns true if the credentials mode for connection requests to the URL providing the event stream is set to "include", and false otherwise.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/withCredentials)
*/
public get withCredentials(): boolean {
return this.#withCredentials
}
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/error_event) */
public get onerror(): ((ev: ErrorEvent) => unknown) | null {
return this.#onError
}
public set onerror(value: ((ev: ErrorEvent) => unknown) | null) {
this.#onError = value
}
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/message_event) */
public get onmessage(): ((ev: MessageEvent) => unknown) | null {
return this.#onMessage
}
public set onmessage(value: ((ev: MessageEvent) => unknown) | null) {
this.#onMessage = value
}
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/open_event) */
public get onopen(): ((ev: Event) => unknown) | null {
return this.#onOpen
}
public set onopen(value: ((ev: Event) => unknown) | null) {
this.#onOpen = value
}
override addEventListener<K extends keyof EventSourceEventMap>(
type: K,
listener: (this: EventSource, ev: EventSourceEventMap[K]) => unknown,
options?: boolean | AddEventListenerOptions,
): void
override addEventListener(
type: string,
listener: (this: EventSource, event: MessageEvent) => unknown,
options?: boolean | AddEventListenerOptions,
): void
override addEventListener(
type: string,
listener: EventListenerOrEventListenerObject,
options?: boolean | AddEventListenerOptions,
): void
override addEventListener(
type: string,
listener:
| ((this: EventSource, event: MessageEvent) => unknown)
| EventListenerOrEventListenerObject,
options?: boolean | AddEventListenerOptions,
): void {
const listen = listener as (this: EventSource, event: Event) => unknown
super.addEventListener(type, listen, options)
}
override removeEventListener<K extends keyof EventSourceEventMap>(
type: K,
listener: (this: EventSource, ev: EventSourceEventMap[K]) => unknown,
options?: boolean | EventListenerOptions,
): void
override removeEventListener(
type: string,
listener: (this: EventSource, event: MessageEvent) => unknown,
options?: boolean | EventListenerOptions,
): void
override removeEventListener(
type: string,
listener: EventListenerOrEventListenerObject,
options?: boolean | EventListenerOptions,
): void
override removeEventListener(
type: string,
listener:
| ((this: EventSource, event: MessageEvent) => unknown)
| EventListenerOrEventListenerObject,
options?: boolean | EventListenerOptions,
): void {
const listen = listener as (this: EventSource, event: Event) => unknown
super.removeEventListener(type, listen, options)
}
constructor(url: string | URL, eventSourceInitDict?: EventSourceInit) {
super()
try {
if (url instanceof URL) {
this.#url = url
} else if (typeof url === 'string') {
this.#url = new URL(url, getBaseURL())
} else {
throw new Error('Invalid URL')
}
} catch (err) {
throw syntaxError('An invalid or illegal string was specified')
}
this.#parser = createParser({
onEvent: this.#onEvent,
onRetry: this.#onRetryChange,
})
this.#readyState = this.CONNECTING
this.#reconnectInterval = 3000
this.#fetch = eventSourceInitDict?.fetch ?? globalThis.fetch
this.#withCredentials = eventSourceInitDict?.withCredentials ?? false
this.#connect()
}
/**
* Aborts any instances of the fetch algorithm started for this EventSource object, and sets the readyState attribute to CLOSED.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/close)
*
* @public
*/
close(): void {
if (this.#reconnectTimer) clearTimeout(this.#reconnectTimer)
if (this.#readyState === this.CLOSED) return
if (this.#controller) this.#controller.abort()
this.#readyState = this.CLOSED
this.#controller = undefined
}
// PRIVATES FOLLOW
/**
* Current connection state
*
* @internal
*/
#readyState: number
/**
* Original URL used to connect.
*
* Note that this will stay the same even after a redirect.
*
* @internal
*/
#url: URL
/**
* The destination URL after a redirect. Is reset on reconnection.
*
* @internal
*/
#redirectUrl: URL | undefined
/**
* Whether to include credentials in the request
*
* @internal
*/
#withCredentials: boolean
/**
* The fetch implementation to use
*
* @internal
*/
#fetch: FetchLike
/**
* The reconnection time in milliseconds
*
* @internal
*/
#reconnectInterval: number
/**
* Reference to an ongoing reconnect attempt, if any
*
* @internal
*/
#reconnectTimer: ReturnType<typeof setTimeout> | undefined
/**
* The last event ID seen by the EventSource, which will be sent as `Last-Event-ID` in the
* request headers on a reconnection attempt.
*
* @internal
*/
#lastEventId: string | null = null
/**
* The AbortController instance used to abort the fetch request
*
* @internal
*/
#controller: AbortController | undefined
/**
* Instance of an EventSource parser (`eventsource-parser` npm module)
*
* @internal
*/
#parser: EventSourceParser
/**
* Holds the current error handler, attached through `onerror` property directly.
* Note that `addEventListener('error', …)` will not be stored here.
*
* @internal
*/
#onError: ((ev: ErrorEvent) => unknown) | null = null
/**
* Holds the current message handler, attached through `onmessage` property directly.
* Note that `addEventListener('message', …)` will not be stored here.
*
* @internal
*/
#onMessage: ((ev: MessageEvent) => unknown) | null = null
/**
* Holds the current open handler, attached through `onopen` property directly.
* Note that `addEventListener('open', …)` will not be stored here.
*
* @internal
*/
#onOpen: ((ev: Event) => unknown) | null = null
/**
* Connect to the given URL and start receiving events
*
* @internal
*/
#connect() {
this.#readyState = this.CONNECTING
this.#controller = new AbortController()
// Browser tests are failing if we directly call `this.#fetch()`, thus the indirection.
const fetch = this.#fetch
fetch(this.#url, this.#getRequestOptions())
.then(this.#onFetchResponse)
.catch(this.#onFetchError)
}
/**
* Handles the fetch response
*
* @param response - The Fetch(ish) response
* @internal
*/
#onFetchResponse = async (response: FetchLikeResponse) => {
this.#parser.reset()
const {body, redirected, status, headers} = response
// [spec] a client can be told to stop reconnecting using the HTTP 204 No Content response code.
if (status === 204) {
// We still need to emit an error event - this mirrors the browser behavior,
// and without it there is no way to tell the user that the connection was closed.
this.#failConnection('Server sent HTTP 204, not reconnecting', 204)
this.close()
return
}
// [spec] …Event stream requests can be redirected using HTTP 301 and 307 redirects as with
// [spec] normal HTTP requests.
// Spec does not say anything about other redirect codes (302, 308), but this seems an
// unintended omission, rather than a feature. Browsers will happily redirect on other 3xxs's.
if (redirected) {
this.#redirectUrl = new URL(response.url)
} else {
this.#redirectUrl = undefined
}
// [spec] if res's status is not 200, …, then fail the connection.
if (status !== 200) {
this.#failConnection(`Non-200 status code (${status})`, status)
return
}
// [spec] …or if res's `Content-Type` is not `text/event-stream`, then fail the connection.
const contentType = headers.get('content-type') || ''
if (!contentType.startsWith('text/event-stream')) {
this.#failConnection('Invalid content type, expected "text/event-stream"', status)
return
}
// [spec] …if the readyState attribute is set to a value other than CLOSED…
if (this.#readyState === this.CLOSED) {
return
}
// [spec] …sets the readyState attribute to OPEN and fires an event
// [spec] …named open at the EventSource object.
this.#readyState = this.OPEN
const openEvent = new Event('open')
this.#onOpen?.(openEvent)
this.dispatchEvent(openEvent)
// Ensure that the response stream is a web stream
if (typeof body !== 'object' || !body || !('getReader' in body)) {
this.#failConnection('Invalid response body, expected a web ReadableStream', status)
this.close() // This should only happen if `fetch` provided is "faulty" - don't reconnect
return
}
const decoder = new TextDecoder()
const reader = body.getReader()
let open = true
do {
const {done, value} = await reader.read()
if (value) {
this.#parser.feed(decoder.decode(value, {stream: !done}))
}
if (!done) {
continue
}
open = false
this.#parser.reset()
this.#scheduleReconnect()
} while (open)
}
/**
* Handles rejected requests for the EventSource endpoint
*
* @param err - The error from `fetch()`
* @internal
*/
#onFetchError = (err: Error & {type?: string}) => {
this.#controller = undefined
// We expect abort errors when the user manually calls `close()` - ignore those
if (err.name === 'AbortError' || err.type === 'aborted') {
return
}
this.#scheduleReconnect(flattenError(err))
}
/**
* Get request options for the `fetch()` request
*
* @returns The request options
* @internal
*/
#getRequestOptions(): EventSourceFetchInit {
const lastEvent = this.#lastEventId ? {'Last-Event-ID': this.#lastEventId} : undefined
const init: EventSourceFetchInit = {
// [spec] Let `corsAttributeState` be `Anonymous`…
// [spec] …will have their mode set to "cors"…
mode: 'cors',
redirect: 'follow',
headers: {Accept: 'text/event-stream', ...lastEvent},
cache: 'no-store',
signal: this.#controller?.signal,
}
// Some environments crash if attempting to set `credentials` where it is not supported,
// eg on Cloudflare Workers. To avoid this, we only set it in browser-like environments.
if ('window' in globalThis) {
// [spec] …and their credentials mode set to "same-origin"
// [spec] …if the `withCredentials` attribute is `true`, set the credentials mode to "include"…
init.credentials = this.withCredentials ? 'include' : 'same-origin'
}
return init
}
/**
* Called by EventSourceParser instance when an event has successfully been parsed
* and is ready to be processed.
*
* @param event - The parsed event
* @internal
*/
#onEvent = (event: EventSourceMessage) => {
if (typeof event.id === 'string') {
this.#lastEventId = event.id
}
const messageEvent = new MessageEvent(event.event || 'message', {
data: event.data,
origin: this.#redirectUrl ? this.#redirectUrl.origin : this.#url.origin,
lastEventId: event.id || '',
})
// The `onmessage` property of the EventSource instance only triggers on messages without an
// `event` field, or ones that explicitly set `message`.
if (this.#onMessage && (!event.event || event.event === 'message')) {
this.#onMessage(messageEvent)
}
this.dispatchEvent(messageEvent)
}
/**
* Called by EventSourceParser instance when a new reconnection interval is received
* from the EventSource endpoint.
*
* @param value - The new reconnection interval in milliseconds
* @internal
*/
#onRetryChange = (value: number) => {
this.#reconnectInterval = value
}
/**
* Handles the process referred to in the EventSource specification as "failing a connection".
*
* @param error - The error causing the connection to fail
* @param code - The HTTP status code, if available
* @internal
*/
#failConnection(message?: string, code?: number) {
// [spec] …if the readyState attribute is set to a value other than CLOSED,
// [spec] sets the readyState attribute to CLOSED…
if (this.#readyState !== this.CLOSED) {
this.#readyState = this.CLOSED
}
// [spec] …and fires an event named `error` at the `EventSource` object.
// [spec] Once the user agent has failed the connection, it does not attempt to reconnect.
// [spec] > Implementations are especially encouraged to report detailed information
// [spec] > to their development consoles whenever an error event is fired, since little
// [spec] > to no information can be made available in the events themselves.
// Printing to console is not very programatically helpful, though, so we emit a custom event.
const errorEvent = new ErrorEvent('error', {code, message})
this.#onError?.(errorEvent)
this.dispatchEvent(errorEvent)
}
/**
* Schedules a reconnection attempt against the EventSource endpoint.
*
* @param message - The error causing the connection to fail
* @param code - The HTTP status code, if available
* @internal
*/
#scheduleReconnect(message?: string, code?: number) {
// [spec] If the readyState attribute is set to CLOSED, abort the task.
if (this.#readyState === this.CLOSED) {
return
}
// [spec] Set the readyState attribute to CONNECTING.
this.#readyState = this.CONNECTING
// [spec] Fire an event named `error` at the EventSource object.
const errorEvent = new ErrorEvent('error', {code, message})
this.#onError?.(errorEvent)
this.dispatchEvent(errorEvent)
// [spec] Wait a delay equal to the reconnection time of the event source.
this.#reconnectTimer = setTimeout(this.#reconnect, this.#reconnectInterval)
}
/**
* Reconnects to the EventSource endpoint after a disconnect/failure
*
* @internal
*/
#reconnect = () => {
this.#reconnectTimer = undefined
// [spec] If the EventSource's readyState attribute is not set to CONNECTING, then return.
if (this.#readyState !== this.CONNECTING) {
return
}
this.#connect()
}
}
/**
* According to spec, when constructing a URL:
* > 1. Let baseURL be environment's base URL, if environment is a Document object
* > 2. Return the result of applying the URL parser to url, with baseURL.
*
* Thus we should use `document.baseURI` if available, since it can be set through a base tag.
*
* @returns The base URL, if available - otherwise `undefined`
* @internal
*/
function getBaseURL(): string | undefined {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const doc = 'document' in globalThis ? (globalThis as any).document : undefined
return doc && typeof doc === 'object' && 'baseURI' in doc && typeof doc.baseURI === 'string'
? doc.baseURI
: undefined
}
@@ -0,0 +1,77 @@
{
"name": "uri-js",
"version": "4.4.1",
"description": "An RFC 3986/3987 compliant, scheme extendable URI/IRI parsing/validating/resolving library for JavaScript.",
"main": "dist/es5/uri.all.js",
"types": "dist/es5/uri.all.d.ts",
"directories": {
"test": "tests"
},
"files": [
"dist",
"package.json",
"yarn.lock",
"README.md",
"CHANGELOG",
"LICENSE"
],
"scripts": {
"build:esnext": "tsc",
"build:es5": "rollup -c && cp dist/esnext/uri.d.ts dist/es5/uri.all.d.ts && npm run build:es5:fix-sourcemap",
"build:es5:fix-sourcemap": "sorcery -i dist/es5/uri.all.js",
"build:es5:min": "uglifyjs dist/es5/uri.all.js --support-ie8 --output dist/es5/uri.all.min.js --in-source-map dist/es5/uri.all.js.map --source-map uri.all.min.js.map --comments --compress --mangle --pure-funcs merge subexp && mv uri.all.min.js.map dist/es5/ && cp dist/es5/uri.all.d.ts dist/es5/uri.all.min.d.ts",
"build": "npm run build:esnext && npm run build:es5 && npm run build:es5:min",
"clean": "rm -rf dist",
"test": "mocha -u mocha-qunit-ui dist/es5/uri.all.js tests/tests.js"
},
"repository": {
"type": "git",
"url": "http://github.com/garycourt/uri-js"
},
"keywords": [
"URI",
"IRI",
"IDN",
"URN",
"UUID",
"HTTP",
"HTTPS",
"WS",
"WSS",
"MAILTO",
"RFC3986",
"RFC3987",
"RFC5891",
"RFC2616",
"RFC2818",
"RFC2141",
"RFC4122",
"RFC4291",
"RFC5952",
"RFC6068",
"RFC6455",
"RFC6874"
],
"author": "Gary Court <gary.court@gmail.com>",
"license": "BSD-2-Clause",
"bugs": {
"url": "https://github.com/garycourt/uri-js/issues"
},
"homepage": "https://github.com/garycourt/uri-js",
"devDependencies": {
"babel-cli": "^6.26.0",
"babel-plugin-external-helpers": "^6.22.0",
"babel-preset-latest": "^6.24.1",
"mocha": "^8.2.1",
"mocha-qunit-ui": "^0.1.3",
"rollup": "^0.41.6",
"rollup-plugin-babel": "^2.7.1",
"rollup-plugin-node-resolve": "^2.0.0",
"sorcery": "^0.10.0",
"typescript": "^2.8.1",
"uglify-js": "^2.8.14"
},
"dependencies": {
"punycode": "^2.1.0"
}
}
@@ -0,0 +1 @@
module.exports={C:{"47":0.00512,"48":0.00512,"50":0.00512,"52":0.01025,"56":0.00512,"57":0.00512,"58":0.00512,"59":0.00512,"60":0.00512,"61":0.00512,"62":0.00512,"63":0.00512,"65":0.00512,"66":0.00512,"67":0.00512,"72":0.01025,"97":0.00512,"102":0.00512,"104":0.00512,"105":0.00512,"112":0.0205,"115":0.55339,"118":0.00512,"120":2.13671,"121":4.31441,"122":0.00512,"123":0.01025,"124":0.01537,"125":0.00512,"127":0.02562,"130":0.01025,"131":0.01537,"133":0.00512,"134":0.00512,"136":0.00512,"138":0.00512,"140":0.02562,"141":0.00512,"142":0.00512,"143":0.01025,"144":0.00512,"146":0.00512,"147":0.01537,"149":0.00512,"150":0.02562,"151":0.00512,"152":0.03074,"153":0.03587,"154":0.19471,"155":0.45604,"156":0.47141,"157":0.01537,_:"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 49 51 53 54 55 64 68 69 70 71 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 98 99 100 101 103 106 107 108 109 110 111 113 114 116 117 119 126 128 129 132 135 137 139 145 148 158 159 160 3.5 3.6"},D:{"49":0.00512,"50":0.00512,"53":0.00512,"56":0.00512,"58":0.01025,"60":0.00512,"61":0.00512,"62":0.00512,"63":0.00512,"64":0.01025,"65":0.00512,"66":0.01537,"67":0.01025,"68":0.01025,"69":0.00512,"70":0.01025,"71":0.01025,"72":0.00512,"73":0.02562,"74":0.00512,"75":0.01025,"76":0.00512,"77":0.01025,"79":0.02562,"80":0.11273,"81":0.01537,"83":0.01025,"85":0.00512,"86":0.01537,"87":0.01025,"88":0.00512,"90":0.00512,"91":0.00512,"93":0.01025,"95":0.00512,"98":0.0205,"100":0.00512,"101":0.06149,"102":0.00512,"103":0.25108,"104":0.23058,"105":0.23058,"106":0.2357,"107":0.22033,"108":0.23058,"109":0.70711,"110":0.22546,"111":0.2357,"112":0.22546,"113":0.00512,"114":0.03074,"115":0.00512,"116":0.45604,"117":0.23058,"118":2.76696,"119":4.29904,"120":4.48862,"121":0.00512,"122":0.0205,"123":0.0205,"124":0.23058,"125":0.00512,"126":0.0205,"127":0.01025,"128":0.01025,"130":0.01537,"131":0.46628,"132":0.03074,"133":0.55852,"134":0.15372,"135":0.13835,"136":0.14347,"137":0.15372,"138":0.22033,"139":0.16397,"140":0.16397,"141":0.16397,"142":0.46116,"143":0.0205,"144":0.04612,"145":0.07686,"146":0.93769,"147":0.03587,"148":0.1486,"149":0.45091,"150":0.59438,"151":1.30662,"152":4.67309,"153":3.37672,"154":0.77885,"155":0.02562,_:"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 51 52 54 55 57 59 78 84 89 92 94 96 97 99 129 156 157"},F:{"36":0.00512,"46":0.00512,"50":0.00512,"51":0.00512,"52":0.00512,"53":0.00512,"54":0.00512,"55":0.01025,"56":0.01537,"57":0.00512,"58":0.00512,"79":0.00512,"80":0.00512,"89":0.00512,"95":0.07174,"99":0.00512,"100":0.01537,"101":0.01537,"105":0.01025,"106":0.0205,"107":0.00512,"110":0.00512,"114":0.00512,"116":0.00512,"119":0.00512,"120":0.00512,"121":0.00512,"122":0.01025,"131":0.00512,"132":0.00512,"133":0.01025,"134":0.05124,"135":0.67124,_:"9 11 12 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 37 38 39 40 41 42 43 44 45 47 48 49 60 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 81 82 83 84 85 86 87 88 90 91 92 93 94 96 97 98 102 103 104 108 109 111 112 113 115 117 118 123 124 125 126 127 9.5-9.6 10.0-10.1 10.5 10.6 11.1 11.5 11.6 12.1"},B:{"14":0.00512,"16":0.00512,"18":0.0205,"89":0.00512,"90":0.00512,"92":0.03587,"100":0.00512,"106":0.01025,"109":0.01025,"112":0.00512,"114":0.00512,"119":2.06497,"120":2.16745,"122":0.02562,"123":0.00512,"124":0.00512,"126":0.00512,"131":0.00512,"132":0.01025,"133":0.00512,"134":0.00512,"136":0.00512,"137":0.00512,"138":0.01025,"139":0.00512,"140":0.01537,"141":0.01025,"142":0.00512,"143":0.01025,"144":0.00512,"145":0.01025,"146":0.00512,"147":0.01537,"148":0.01537,"149":0.02562,"150":0.06661,"151":0.13322,"152":1.00943,"153":1.15802,"154":0.33818,_:"12 13 15 17 79 80 81 83 84 85 86 87 88 91 93 94 95 96 97 98 99 101 102 103 104 105 107 108 110 111 113 115 116 117 118 121 125 127 128 129 130 135"},E:{"27":0.01025,_:"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 14.1 15.1 15.2-15.3 15.4 15.5 16.0 16.1 16.2 16.3 16.4 16.5 17.0 17.2 17.4 17.5 18.0 18.1 18.2 18.3 18.4 18.5-18.7 26.1 27.1 27.2 TP","13.1":0.00512,"15.6":0.01537,"16.6":0.02562,"17.1":0.01025,"17.3":0.00512,"17.6":0.01025,"26.0":0.00512,"26.2":0.01025,"26.3":0.01537,"26.4":0.00512,"26.5":0.0205,"26.6":0.04099},G:{"8":0,"3.2":0,"4.0-4.1":0,"4.2-4.3":0.00016,"5.0-5.1":0.00016,"6.0-6.1":0,"7.0-7.1":0.00033,"8.1-8.4":0,"9.0-9.2":0,"9.3":0,"10.0-10.2":0,"10.3":0.00163,"11.0-11.2":0.00016,"11.3-11.4":0.00033,"12.0-12.1":0,"12.2-12.5":0.00425,"13.0-13.1":0,"13.2":0.00082,"13.3":0,"13.4-13.7":0.00016,"14.0-14.4":0.00065,"14.5-14.8":0.00098,"15.0-15.1":0.00098,"15.2-15.3":0.00065,"15.4":0.00082,"15.5":0.00098,"15.6-15.8":0.02123,"16.0":0.00163,"16.1":0.00294,"16.2":0.00163,"16.3":0.00359,"16.4":0.00082,"16.5":0.00131,"16.6-16.7":0.02957,"17.0":0.00114,"17.1":0.00163,"17.2":0.00163,"17.3":0.00245,"17.4":0.00343,"17.5":0.0Line truncated
@@ -0,0 +1,367 @@
flf2a 1 1 10 -1 8
rot13.flf (C) 1994 by Victor Parada (vparada@inf.utfsm.cl) 94/12/28.
Based on Terminal by Glenn Chappell 4/93
Includes characters 128-255
figlet release 2.1 -- 12 Aug 1994
@
!@
"@
#@
$@
%@
&@
'@
(@
)@
*@
+@
,@
-@
.@
/@
0@
1@
2@
3@
4@
5@
6@
7@
8@
9@
:@
;@
<@
=@
>@
?@
@#
N@
O@
P@
Q@
R@
S@
T@
U@
V@
W@
X@
Y@
Z@
A@
B@
C@
D@
E@
F@
G@
H@
I@
J@
K@
L@
M@
[@
\@
]@
^@
_@
`@
n@
o@
p@
q@
r@
s@
t@
u@
v@
w@
x@
y@
z@
a@
b@
c@
d@
e@
f@
g@
h@
i@
j@
k@
l@
m@
{@
|@
}@
~@
願
淐
軹
裰
蠩
廹
稛
128
�@
129
�
130
�
131
�
132
�
133
�
134
�
135
䏰
136
㇀
137
𪎩
138
𧶄
139
𣏴
140
倻
141
𠮟
142
𣻗
143
蕋
144
趩
145
𥜆
146
𡏆
147
媁
148
銉
149
𦅜
150
桇
151
愌
152
𦴦
153
䄉
154
鋣
155
𡨭
156
嵛
157
𨆉
158
𠺢
159
籖
160
𨩚
161
 
162
\
163
w
164
一
165
世
166
共
167
作
168
杓
169
咖
170
昇
171
陂
172
拯
173
耐
174
哦
175
浬
176
虔
177
娼
178
毫
179
莆
180
婷
181
溉
182
詔
183
媳
184
睹
185
辟
186
愿
187
罰
188
劇
189
瑾
190
輥
191
濃
192
錐
193
瞧
194
駿
195
鞭
196
願
197
護
198
讖
199
す
200
Л
201
乂
202
汌
203
杙
204
坨
205
泒
206
哃
207
柜
208
穾
209
唊
210
毨
211
笄
212
酎
213
崰
214
淐
215
耞
216
釫
217
惲
218
湨
219
罦
220
軹
221
媷
222
毹
223
稛
224
觡
225
凘
226
榠
227
禗
228
裰
229
噚
230
澍
231
膞
232
踔
233
噳
234
澢
235
蕀
236
錋
237
檕
238
蕷
239
鞞
240
璸
241
蹛
242
徿
243
譑
244
嚵
245
鏼
246
蠩
247
糴
248
讌
249
纘
250
𠕇
251
𨦼
252
廹
253
𣑯
254
鑂
255
�@
@@ -0,0 +1 @@
{"version":3,"names":["virtualTypes","require","_debug","_index","_index2","_t","t","cache","_generator","NodePath_ancestry","NodePath_inference","NodePath_replacement","NodePath_evaluation","NodePath_conversion","NodePath_introspection","_context","NodePath_context","NodePath_removal","NodePath_modification","NodePath_family","NodePath_comments","NodePath_virtual_types_validator","validate","debug","buildDebug","REMOVED","exports","SHOULD_STOP","SHOULD_SKIP","NodePath_Final","default","NodePath","constructor","hub","parent","contexts","state","_traverseFlags","skipKeys","parentPath","container","listKey","key","node","type","_store","data","context","scope","removed","v","shouldStop","shouldSkip","get","Error","targetNode","paths","getOrCreateCachedPaths","path","set","setup","call","getScope","isScope","Scope","setData","val","Object","create","getData","def","undefined","hasNode","buildCodeFrameError","msg","SyntaxError","buildError","traverse","visitor","getPathLocation","parts","inList","unshift","join","message","enabled","toString","generator","code","parentKey","methods","findParent","find","getFunctionParent","getStatementParent","getEarliestCommonAncestorFrom","getDeepestCommonAncestorFrom","getAncestry","isAncestor","isDescendant","inType","getTypeAnnotation","isBaseType","couldBeBaseType","baseTypeStrictlyMatches","isGenericType","replaceWithMultiple","replaceWithSourceString","replaceWith","replaceExpressionWithStatements","replaceInline","evaluateTruthy","evaluate","toComputedKey","ensureBlock","unwrapFunctionEnvironment","arrowFunctionToExpression","splitExportDeclaration","ensureFunctionName","matchesPattern","isStatic","isNodeType","canHaveVariableDeclarationOrExpression","canSwapBetweenExpressionAndStatement","isCompletionRecord","isStatementOrBlock","referencesImport","getSource","willIMaybeExecuteBefore","_guessExecutionStatusRelativeTo","resolve","isConstantExpression","isInStrictMode","isDenylisted","visit","skip","skipKey","stop","setContext","requeue","requeueComputedKeyAndDecorators","remove","insertBefore","insertAfter","unshiftContainer","pushContainer","getOpposite","getCompletionRecords","getSibling","getPrevSibling","getNextSibling","getAllNextSiblings","getAllPrevSiblings","getAssignmentIdentifiers","getBindingIdentifiers","getOuterBindingIdentifiers","getBindingIdentifierPaths","getOuterBindingIdentifierPaths","shareCommentsWithSiblings","addComment","addComments","assign","prototype","arrowFunctionToShadowed","String","has","is","isnt","equals","hoist","updateSiblingKeys","isBlacklisted","setScope","resync","popContext","pushContext","setKey","_guessExecutionStatusRelativeToDifferentFunctions","_getTypeAnnotation","_replaceWith","_resolve","_call","_resyncParent","_resyncKey","_resyncList","_resyncRemoved","_getQueueContexts","_removeFromScope","_callRemovalHooks","_remove","_markRemoved","_assertUnremoved","_containerInsert","_containerInsertBefore","_containerInsertAfter","_verifyNodeList","_getKey","_getPattern","TYPES","typeKey","fn","opts","TypeError","keys","startsWith","includes","push"],"sources":["../../src/path/index.ts"],"sourcesContent":["import type { HubInterface } from \"../hub.ts\";\nimport type TraversalContext from \"../context.ts\";\nimport type { ExplodedTraverseOptions } from \"../index.ts\";\nimport * as virtualTypes from \"./lib/virtual-types.ts\";\nimport buildDebug from \"debug\";\nimport traverse from \"../index.ts\";\nimport type { Visitor } from \"../types.ts\";\nimport Scope from \"../scope/index.ts\";\nimport { validate } from \"@babel/types\";\nimport * as t from \"@babel/types\";\nimport * as cache from \"../cache.ts\";\nimport generator from \"@babel/generator\";\n\n// NodePath is split across many files.\nimport * as NodePath_ancestry from \"./ancestry.ts\";\nimport * as NodePath_inference from \"./inference/index.ts\";\nimport * as NodePath_replacement from \"./replacement.ts\";\nimport * as NodePath_evaluation from \"./evaluation.ts\";\nimport * as NodePath_conversion from \"./conversion.ts\";\nimport * as NodePath_introspection from \"./introspection.ts\";\nimport * as NodePath_context from \"./context.ts\";\nimport * as NodePath_removal from \"./removal.ts\";\nimport * as NodePath_modification from \"./modification.ts\";\nimport * as NodePath_family from \"./family.ts\";\nimport * as NodePath_comments from \"./comments.ts\";\nimport * as NodePath_virtual_types_validator from \"./lib/virtual-types-validator.ts\";\nimport type { NodePathAssertions } from \"./generated/asserts.ts\";\nimport type { NodePathValidators } from \"./generated/validators.ts\";\nimport { setup } from \"./context.ts\";\n\nconst debug = buildDebug(\"babel\");\n\nexport const REMOVED = 1 << 0;\nexport const SHOULD_STOP = 1 << 1;\nexport const SHOULD_SKIP = 1 << 2;\n\ndeclare const bit: import(\"../../../../scripts/babel-plugin-bit-decorator/types.d.ts\").BitDecorator<\n NodePath_Final<t.Node>\n>;\n\nexport type NodePaths<T extends t.Node | t.Node[]> = T extends t.NoLine truncated
@@ -0,0 +1,24 @@
import { DEFAULT_PROTOCOL_ALLOWLIST, buildDevStylesUrl, createControlledPromise, deepEqual, escapeHtml, functionalUpdate, hasKeys, isDangerousProtocol, isModuleNotFoundError, isPlainArray, isPlainObject, replaceEqualDeep } from "./utils.js";
import { invariant } from "./invariant.js";
import { cleanPath, exactPathTest, interpolatePath, joinPaths, removeTrailingSlash, resolvePath, trimPath, trimPathLeft, trimPathRight } from "./path.js";
import { isNotFound, notFound } from "./not-found.js";
import { defaultGetScrollRestorationKey, getElementScrollRestorationEntry, scrollRestorationCache, setupScrollRestoration, storageKey } from "./scroll-restoration.js";
import { decode, encode } from "./qss.js";
import { defaultParseSearch, defaultStringifySearch, parseSearchWith, stringifySearchWith } from "./searchParams.js";
import { rootRouteId } from "./root.js";
import { isRedirect, isResolvedRedirect, parseRedirect, redirect } from "./redirect.js";
import { composeRewrites, executeRewriteInput } from "./rewrite.js";
import { createNonReactiveMutableStore, createNonReactiveReadonlyStore } from "./stores.js";
import { PathParamError, RouterCore, SearchParamError, defaultSerializeError, getInitialRouterState, getLocationChangeInfo, getMatchedRoutes, lazyFn, trailingSlashOptions } from "./router.js";
import { TSR_DEFERRED_PROMISE, defer } from "./defer.js";
import { preloadWarning } from "./link.js";
import { createInlineCssStyleAsset, getAssetCrossOrigin, getStylesheetHref, isInlinableStylesheet, resolveManifestAssetLink } from "./manifest.js";
import { isMatch } from "./Matches.js";
import { BaseRootRoute, BaseRoute, BaseRouteApi } from "./route.js";
import { createRouterConfig } from "./config.js";
import { retainSearchParams, stripSearchParams } from "./searchMiddleware.js";
import { handleHashScroll } from "./hash-scroll.js";
import { createSerializationAdapter, makeSerovalPlugin, makeSsrSerovalPlugin } from "./ssr/serializer/transformer.js";
import { RawStream, createRawStreamDeserializePlugin, createRawStreamRPCPlugin } from "./ssr/serializer/RawStream.js";
import { defaultSerovalPlugins } from "./ssr/serializer/seroval-plugins.js";
export { BaseRootRoute, BaseRoute, BaseRouteApi, DEFAULT_PROTOCOL_ALLOWLIST, PathParamError, RawStream, RouterCore, SearchParamError, TSR_DEFERRED_PROMISE, buildDevStylesUrl, cleanPath, composeRewrites, createControlledPromise, createInlineCssStyleAsset, createNonReactiveMutableStore, createNonReactiveReadonlyStore, createRawStreamDeserializePlugin, createRawStreamRPCPlugin, createRouterConfig, createSerializationAdapter, decode, deepEqual, defaultGetScrollRestorationKey, defaultParseSearch, defaultSerializeError, defaultSerovalPlugins, defaultStringifySearch, defer, encode, escapeHtml, exactPathTest, executeRewriteInput, functionalUpdate, getAssetCrossOrigin, getElementScrollRestorationEntry, getInitialRouterState, getLocationChangeInfo, getMatchedRoutes, getStylesheetHref, handleHashScroll, hasKeys, interpolatePath, invariant, isDangerousProtocol, isInlinableStylesheet, isMatch, isModuleNotFoundError, isNotFound, isPlainArray, isPlainObject, isRedirect, isResolvedRedirect, joinPaths, lazyFn, makeSerovalPlugin, makeSsrSerovalPlugin, notFound, parseRedirect, parseSearchWith, preloadWarning, redirect, removeTrailingSlash, replaceEqualDeep, resolveManifestAssetLink, resolvePath, retainSearchParams, rootRouteId, scrollRestorationCache, setupScrollRestoration, storageKey, stringifySearchWith, stripSearchParams, trailingSlashOptions, trimPath, trimPathLeft, trimPathRight };
@@ -0,0 +1 @@
{"version":3,"file":"features-animation.mjs","sources":["../../../../src/render/dom/features-animation.ts"],"sourcesContent":["\"use client\"\n\nimport { animations } from \"../../motion/features/animations\"\nimport { gestureAnimations } from \"../../motion/features/gestures\"\nimport { FeatureBundle } from \"../../motion/features/types\"\nimport { createDomVisualElement } from \"./create-visual-element\"\n\n/**\n * @public\n */\nexport const domAnimation: FeatureBundle = {\n renderer: createDomVisualElement,\n ...animations,\n ...gestureAnimations,\n}\n"],"names":[],"mappings":";;;;;AAOA;;AAEG;AACI;AACH;AACA;AACA;;;"}
@@ -0,0 +1,105 @@
/**
* @fileoverview Rule to check that spaced function application
* @author Matt DuVall <http://www.mattduvall.com>
* @deprecated in ESLint v3.3.0
*/
"use strict";
//------------------------------------------------------------------------------
// Rule Definition
//------------------------------------------------------------------------------
/** @type {import('../types').Rule.RuleModule} */
module.exports = {
meta: {
type: "layout",
docs: {
description:
"Disallow spacing between function identifiers and their applications (deprecated)",
recommended: false,
url: "https://eslint.org/docs/latest/rules/no-spaced-func",
},
deprecated: {
message: "Formatting rules are being moved out of ESLint core.",
url: "https://eslint.org/blog/2016/08/eslint-v3.3.0-released/#deprecated-rules",
deprecatedSince: "3.3.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: "function-call-spacing",
url: "https://eslint.style/rules/function-call-spacing",
},
},
],
},
fixable: "whitespace",
schema: [],
messages: {
noSpacedFunction:
"Unexpected space between function name and paren.",
},
},
create(context) {
const sourceCode = context.sourceCode;
/**
* Check if open space is present in a function name
* @param {ASTNode} node node to evaluate
* @returns {void}
* @private
*/
function detectOpenSpaces(node) {
const lastCalleeToken = sourceCode.getLastToken(node.callee);
let prevToken = lastCalleeToken,
parenToken = sourceCode.getTokenAfter(lastCalleeToken);
// advances to an open parenthesis.
while (
parenToken &&
parenToken.range[1] < node.range[1] &&
parenToken.value !== "("
) {
prevToken = parenToken;
parenToken = sourceCode.getTokenAfter(parenToken);
}
// look for a space between the callee and the open paren
if (
parenToken &&
parenToken.range[1] < node.range[1] &&
sourceCode.isSpaceBetween(prevToken, parenToken)
) {
context.report({
node,
loc: lastCalleeToken.loc.start,
messageId: "noSpacedFunction",
fix(fixer) {
return fixer.removeRange([
prevToken.range[1],
parenToken.range[0],
]);
},
});
}
}
return {
CallExpression: detectOpenSpaces,
NewExpression: detectOpenSpaces,
};
},
};
@@ -0,0 +1 @@
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,qBAAa,OAAO,CAAC,CAAC,GAAG,OAAO;IAC9B,IAAI,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC,CAAA;IACd,IAAI,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC,CAAA;IACd,MAAM,EAAE,MAAM,CAAI;IAElB,MAAM,CAAC,MAAM,CAAC,CAAC,GAAG,OAAO,EAAE,IAAI,GAAE,QAAQ,CAAC,CAAC,CAAM;gBAIrC,IAAI,GAAE,QAAQ,CAAC,CAAC,CAAM;IAMjC,CAAC,MAAM,CAAC,QAAQ,CAAC;IAMlB,UAAU,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC;IAiCxB,WAAW,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC;IAuBzB,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC;IAuBtB,IAAI,CAAC,GAAG,IAAI,EAAE,CAAC,EAAE;IAOjB,OAAO,CAAC,GAAG,IAAI,EAAE,CAAC,EAAE;IAOpB,GAAG;IAkBH,KAAK;IAkBL,OAAO,CACL,EAAE,EAAE,CAAC,KAAK,EAAE,CAAC,EAAE,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC,CAAC,KAAK,GAAG,EAClD,KAAK,CAAC,EAAE,GAAG;IASb,cAAc,CACZ,EAAE,EAAE,CAAC,KAAK,EAAE,CAAC,EAAE,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC,CAAC,KAAK,GAAG,EAClD,KAAK,CAAC,EAAE,GAAG;IASb,GAAG,CAAC,CAAC,EAAE,MAAM;IAWb,UAAU,CAAC,CAAC,EAAE,MAAM;IAYpB,GAAG,CAAC,CAAC,GAAG,GAAG,EACT,EAAE,EAAE,CAAC,KAAK,EAAE,CAAC,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,EACrC,KAAK,CAAC,EAAE,GAAG,GACV,OAAO,CAAC,CAAC,CAAC;IAUb,UAAU,CAAC,CAAC,GAAG,GAAG,EAChB,EAAE,EAAE,CAAC,KAAK,EAAE,CAAC,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,EACrC,KAAK,CAAC,EAAE,GAAG,GACV,OAAO,CAAC,CAAC,CAAC;IAUb,MAAM,CAAC,EAAE,EAAE,CAAC,IAAI,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC,GAAG,CAAC;IAClD,MAAM,CAAC,CAAC,GAAG,GAAG,EACZ,EAAE,EAAE,CAAC,GAAG,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC,EACrC,OAAO,EAAE,CAAC,GACT,CAAC;IA0BJ,aAAa,CAAC,EAAE,EAAE,CAAC,IAAI,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC,GAAG,CAAC;IACzD,aAAa,CAAC,CAAC,GAAG,GAAG,EACnB,EAAE,EAAE,CAAC,GAAG,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC,EACrC,OAAO,EAAE,CAAC,GACT,CAAC;IA0BJ,OAAO;IASP,cAAc;IASd,KAAK,CAAC,IAAI,GAAE,MAAU,EAAE,EAAE,GAAE,MAAoB;IA4BhD,YAAY,CAAC,IAAI,GAAE,MAAU,EAAE,EAAE,GAAE,MAAoB;IA4BvD,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,WAAW,GAAE,MAAU,EAAE,GAAG,KAAK,EAAE,CAAC,EAAE;IAgC5D,OAAO;CAYR;AAwCD,qBAAa,IAAI,CAAC,CAAC,GAAG,OAAO;IAC3B,IAAI,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC,CAAA;IACjB,IAAI,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC,CAAA;IACd,IAAI,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC,CAAA;IACd,KAAK,EAAE,CAAC,CAAA;gBAGN,KAAK,EAAE,CAAC,EACR,IAAI,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC,GAAG,SAAS,EAC1B,IAAI,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC,GAAG,SAAS,EAC1B,IAAI,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC,GAAG,SAAS;CAmBhC"}
@@ -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 SquareArrowLeft = createLucideIcon("SquareArrowLeft", [
["rect", { width: "18", height: "18", x: "3", y: "3", rx: "2", key: "afitv7" }],
["path", { d: "m12 8-4 4 4 4", key: "15vm53" }],
["path", { d: "M16 12H8", key: "1fr5h0" }]
]);
export { SquareArrowLeft as default };
//# sourceMappingURL=square-arrow-left.js.map
@@ -0,0 +1 @@
module.exports={A:{A:{"2":"_E"},B:{"1":"_K","2":"_I"},C:{"1":"_H _HQ _WC","2":"_o _xJ _L"},D:{"1":"_ZJ _mD","2":"_LE","194":"_zD"},E:{"1":"_1C","2":"_pD"},F:{"1":"_NN _NG","2":"_QM","194":"QB _ZQ"},G:{"1":"_kB","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":"_U","2":"J"},Q:{"1":"JE"},R:{"1":"KE"},S:{"1":"ME","2":"LE"}},B:5,C:"CSS Motion Path",D:true};
@@ -0,0 +1,517 @@
flf2a$ 5 4 20 15 6
Square by Chris Gill, 30-JUN-94 -- based on .sig of Jeb Hagan.
---
Font modified June 17, 2007 by patorjk
This was to widen the space character.
$ $@
$ $@
$ $@
$ $@
$ $@@
__ @
| |@
|__|@
|__|@
@@
____ @
| | |@
|_|_|@
@
@@
_____ @
_| | |_ @
|_ _|@
|_ _|@
|__|__| @@
__,-,__ @
| ' '__|@
|__ |@
|_______|@
|_| @@
__ ___ @
|__| |@
| __|@
|___|__|@
@@
__,-,__ @
| ' '__|@
| __|@
|_______|@
|_| @@
__ @
| |@
|_|@
@
@@
___ @
,' _|@
| | @
| |_ @
`.___|@@
___ @
|_ `.@
| |@
_| |@
|___,'@@
__ _ __ @
| | | |@
> < @
|__|_|__|@
@@
__ @
_| |_ @
|_ _|@
|__| @
@@
@
@
__ @
| |@
|_|@@
@
______ @
|______|@
@
@@
@
@
__ @
|__|@
@@
___@
/ /@
,' ,' @
/__/ @
@@
______ @
| |@
| -- |@
|______|@
@@
____ @
|_ | @
_| |_ @
|______|@
@@
______ @
|__ |@
| __|@
|______|@
@@
______ @
|__ |@
|__ |@
|______|@
@@
_____ @
| | | @
|__ |@
|__| @
@@
______ @
| __|@
|__ |@
|______|@
@@
______ @
| __|@
| __ |@
|______|@
@@
______ @
| |@
|_ |@
|____|@
@@
______ @
| __ |@
| __ |@
|______|@
@@
______ @
| __ |@
|__ |@
|______|@
@@
__ @
|__|@
__ @
|__|@
@@
__ @
|__|@
__ @
| |@
|_|@@
__ @
,' _|@
/ / @
\ \_ @
`.__|@@
@
______ @
|______|@
|______|@
@@
__ @
|_ `. @
\ \@
_/ /@
|__,' @@
_____ @
|__ |@
', ,-'@
|--| @
'--' @@
_________ @
| ___ |@
| | _ |@
| |______|@
|_________|@@
_______ @
| _ |@
| |@
|___|___|@
@@
______ @
| __ \@
| __ <@
|______/@
@@
______ @
| |@
| ---|@
|______|@
@@
_____ @
| \ @
| -- |@
|_____/ @
@@
_______ @
| ___|@
| ___|@
|_______|@
@@
_______ @
| ___|@
| ___|@
|___| @
@@
_______ @
| __|@
| | |@
|_______|@
@@
_______ @
| | |@
| |@
|___|___|@
@@
_______ @
|_ _|@
_| |_ @
|_______|@
@@
_____ @
_| |@
| |@
|_______|@
@@
__ __ @
| |/ |@
| < @
|__|\__|@
@@
_____ @
| |_ @
| |@
|_______|@
@@
_______ @
| | |@
| |@
|__|_|__|@
@@
_______ @
| | |@
| |@
|__|____|@
@@
_______ @
| |@
| - |@
|_______|@
@@
______ @
| __ \@
| __/@
|___| @
@@
_______ @
| |@
| - _|@
|_______|@
@@
______ @
| __ \@
| <@
|___|__|@
@@
_______ @
| __|@
|__ |@
|_______|@
@@
_______ @
|_ _|@
| | @
|___| @
@@
_______ @
| | |@
| | |@
|_______|@
@@
___ ___ @
| | |@
| | |@
\_____/ @
@@
________ @
| | | |@
| | | |@
|________|@
@@
___ ___ @
| | |@
|- -|@
|___|___|@
@@
___ ___ @
| | |@
\ / @
|___| @
@@
_______ @
|__ |@
| __|@
|_______|@
@@
____ @
| _|@
| | @
| |_ @
|____|@@
___ @
\ \ @
`. `. @
\__\@
@@
____ @
|_ |@
| |@
_| |@
|____|@@
____ @
| |@
|_/\_|@
@
@@
@
@
@
______ @
|______|@@
__ @
| |@
|_| @
@
@@
@
.---.-.@
| _ |@
|___._|@
@@
__ @
| |--.@
| _ |@
|_____|@
@@
@
.----.@
| __|@
|____|@
@@
__ @
.--| |@
| _ |@
|_____|@
@@
@
.-----.@
| -__|@
|_____|@
@@
___ @
.' _|@
| _|@
|__| @
@@
@
.-----.@
| _ |@
|___ |@
|_____|@@
__ @
| |--.@
| |@
|__|__|@
@@
__ @
|__|@
| |@
|__|@
@@
__ @
|__|@
| |@
| |@
|___|@@
__ @
| |--.@
| < @
|__|__|@
@@
__ @
| |@
| |@
|__|@
@@
@
.--------.@
| |@
|__|__|__|@
@@
@
.-----.@
| |@
|__|__|@
@@
@
.-----.@
| _ |@
|_____|@
@@
@
.-----.@
| _ |@
| __|@
|__| @@
@
.-----.@
| _ |@
|__ |@
|__|@@
@
.----.@
| _|@
|__| @
@@
@
.-----.@
|__ --|@
|_____|@
@@
__ @
| |_ @
| _|@
|____|@
@@
@
.--.--.@
| | |@
|_____|@
@@
@
.--.--.@
| | |@
\___/ @
@@
@
.--.--.--.@
| | | |@
|________|@
@@
@
.--.--.@
|_ _|@
|__.__|@
@@
@
.--.--.@
| | |@
|___ |@
|_____|@@
@
.-----.@
|-- __|@
|_____|@
@@
___ @
| _|@
/ / @
\ \_ @
|___|@@
__ @
| |@
| |@
| |@
|__|@@
___ @
|_ | @
\ \@
_/ /@
|___| @@
___ @
| ' |@
|_,_| @
@
@@
.--.--.@
|-----|@
| - |@
|__|__|@
@@
.--.--.@
|-----|@
| _ |@
|_____|@
@@
.--.--.@
|--|--|@
| | |@
|_____|@
@@
.--.--.@
|---.-|@
| _ |@
|___._|@
@@
.--.--.@
|-----|@
| _ |@
|_____|@
@@
.--.--.@
|--|--|@
| | |@
|_____|@
@@
_______ @
| __ \@
| __ <@
| |____/@
|__| @@
@@ -0,0 +1,532 @@
flf2a$ 5 4 12 -1 21 0 -2 12 34 63 HIKE
double.flf (FIGlet font)
figlet conversion by Kent Nassen, kentn@cyberspace.org, 11/24/94
From: stuce@csv.warwick.ac.uk (Peter Weighill)
Newsgroups: alt.ascii-art
Subject: FONT: double (not .flf)
Date: 15 Mar 1994 16:20:01 -0000
Organization: Commodore 64 Services, University of Warwick, UK
Lines: 30
Message-ID: <2m4n7h$2ti@basil.csv.warwick.ac.uk>
NNTP-Posting-Host: basil.csv.warwick.ac.uk
Mime-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
Keywords: font
Status: RO
Below is the capital letters for a font & also a few punctuation characters
(no lower case).
$ $@
$ $@
$ $@
$ $@
$ $@@
__@
||@
||@
..@
@@
_@
//@
@
@
@@
__ __ @
|| || @
=||=||=@
|| || @
@@
@
@
@
@
@@
_@
O //@
// @
// O@
@@
@
@
@
@
@@
//@
@
@
@
@@
_@
//@
(( @
\\@
@@
_ @
\\ @
))@
// @
@@
@
@
@
@
@@
@
@
@
@
@@
@
@
@
//@
@@
@
@
@
@
@@
@
@
@
||@
@@
@
@
@
@
@@
@
@
@
@
@@
@
@
@
@
@@
@
@
@
@
@@
@
@
@
@
@@
@
@
@
@
@@
@
@
@
@
@@
@
@
@
@
@@
@
@
@
@
@@
@
@
@
@
@@
@
@
@
@
@@
@
@
@
@
@@
@
@
@
@
@@
@
@
@
@
@@
@
@
@
@
@@
@
@
@
@
@@
____ @
| \\@
_//@
|| @
@@
@
@
@
@
@@
___ @
// \\@
||=||@
|| ||@
@@
____ @
|| ))@
||=) @
||_))@
@@
___@
// @
(( @
\\__@
@@
____ @
|| \\ @
|| ))@
||_// @
@@
____@
|| @
||== @
||___@
@@
____@
|| @
||== @
|| @
@@
___ @
// \\@
(( ___@
\\_||@
@@
__ __@
|| ||@
||==||@
|| ||@
@@
__@
||@
||@
||@
@@
__@
||@
||@
|__||@
@@
__ __@
|| //@
||<< @
|| \\@
@@
__ @
|| @
|| @
||__|@
@@
___ ___@
||\\//||@
|| \/ ||@
|| ||@
@@
__ __@
||\ ||@
||\\||@
|| \||@
@@
___ @
// \\ @
(( ))@
\\_// @
@@
____ @
|| \\@
||_//@
|| @
@@
___ @
// \\ @
(( ))@
\\_/X|@
@@
____ @
|| \\@
||_//@
|| \\@
@@
__ @
(( \@
\\ @
\_))@
@@
______@
| || |@
|| @
|| @
@@
__ __@
|| ||@
|| ||@
\\_//@
@@
__ __@
|| ||@
\\ //@
\V/ @
@@
__ __@
|| ||@
\\ /\ //@
\V/\V/ @
@@
_ _@
\\ //@
)X( @
// \\@
@@
_ _@
\\//@
)/ @
// @
@@
____@
//@
// @
//__@
@@
@
@
@
@
@@
@
@
@
@
@@
@
@
@
@
@@
@
@
@
@
@@
@
@
@
@
@@
@
@
@
@
@@
___ @
// \\@
||=||@
|| ||@
@@
____ @
|| ))@
||=) @
||_))@
@@
___@
// @
(( @
\\__@
@@
____ @
|| \\ @
|| ))@
||_// @
@@
____@
|| @
||== @
||___@
@@
____@
|| @
||== @
|| @
@@
___ @
// \\@
(( ___@
\\_||@
@@
__ __@
|| ||@
||==||@
|| ||@
@@
__@
||@
||@
||@
@@
__@
||@
||@
|__||@
@@
__ __@
|| //@
||<< @
|| \\@
@@
__ @
|| @
|| @
||__|@
@@
___ ___@
||\\//||@
|| \/ ||@
|| ||@
@@
__ __@
||\ ||@
||\\||@
|| \||@
@@
___ @
// \\ @
(( ))@
\\_// @
@@
____ @
|| \\@
||_//@
|| @
@@
___ @
// \\ @
(( ))@
\\_/X|@
@@
____ @
|| \\@
||_//@
|| \\@
@@
__ @
(( \@
\\ @
\_))@
@@
______@
| || |@
|| @
|| @
@@
__ __@
|| ||@
|| ||@
\\_//@
@@
__ __@
|| ||@
\\ //@
\V/ @
@@
__ __@
|| ||@
\\ /\ //@
\V/\V/ @
@@
_ _@
\\ //@
)X( @
// \\@
@@
_ _@
\\//@
)/ @
// @
@@
____@
//@
// @
//__@
@@
@
@
@
@
@@
@
@
@
@
@@
@
@
@
@
@@
@
@
@
@
@@
@
@
@
@
@@
@
@
@
@
@@
@
@
@
@
@@
@
@
@
@
@@
@
@
@
@
@@
@
@
@
@
@@
@
@
@
@
@@
@@ -0,0 +1,22 @@
/**
* @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 Camera = createLucideIcon("Camera", [
[
"path",
{
d: "M14.5 4h-5L7 7H4a2 2 0 0 0-2 2v9a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2h-3l-2.5-3z",
key: "1tc9qg"
}
],
["circle", { cx: "12", cy: "13", r: "3", key: "1vg3eu" }]
]);
export { Camera as default };
//# sourceMappingURL=camera.js.map
@@ -0,0 +1,190 @@
# enhanced-resolve
[![npm][npm]][npm-url]
[![Build Status][build-status]][build-status-url]
[![codecov][codecov-badge]][codecov-url]
[![Install Size][size]][size-url]
[![GitHub Discussions][discussion]][discussion-url]
Offers an async require.resolve function. It's highly configurable.
## Features
- plugin system
- provide a custom filesystem
- sync and async node.js filesystems included
## Getting Started
### Install
```sh
# npm
npm install enhanced-resolve
# or Yarn
yarn add enhanced-resolve
```
### Resolve
There is a Node.js API which allows to resolve requests according to the Node.js resolving rules.
Sync and async APIs are offered. A `create` method allows to create a custom resolve function.
```js
const resolve = require("enhanced-resolve");
resolve("/some/path/to/folder", "module/dir", (err, result) => {
result; // === "/some/path/node_modules/module/dir/index.js"
});
resolve.sync("/some/path/to/folder", "../../dir");
// === "/some/path/dir/index.js"
const myResolve = resolve.create({
// or resolve.create.sync
extensions: [".ts", ".js"],
// see more options below
});
myResolve("/some/path/to/folder", "ts-module", (err, result) => {
result; // === "/some/node_modules/ts-module/index.ts"
});
```
### Creating a Resolver
The easiest way to create a resolver is to use the `createResolver` function on `ResolveFactory`, along with one of the supplied File System implementations.
```js
const fs = require("fs");
const { CachedInputFileSystem, ResolverFactory } = require("enhanced-resolve");
// create a resolver
const myResolver = ResolverFactory.createResolver({
// Typical usage will consume the `fs` + `CachedInputFileSystem`, which wraps Node.js `fs` to add caching.
fileSystem: new CachedInputFileSystem(fs, 4000),
extensions: [".js", ".json"],
/* any other resolver options here. Options/defaults can be seen below */
});
// resolve a file with the new resolver
const context = {};
const lookupStartPath = "/Users/webpack/some/root/dir";
const request = "./path/to-look-up.js";
const resolveContext = {};
myResolver.resolve(
context,
lookupStartPath,
request,
resolveContext,
(err /* Error */, filepath /* string */) => {
// Do something with the path
},
);
```
#### Resolver Options
| Field | Default | Description |
| ------------------- | --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| alias | [] | A list of module alias configurations or an object which maps key to value |
| aliasFields | [] | A list of alias fields in description files |
| extensionAlias | {} | An object which maps extension to extension aliases |
| cachePredicate | function() { return true }; | A function which decides whether a request should be cached or not. An object is passed to the function with `path` and `request` properties. |
| cacheWithContext | true | If unsafe cache is enabled, includes `request.context` in the cache key |
| conditionNames | [] | A list of exports field condition names |
| descriptionFiles | ["package.json"] | A list of description files to read from |
| enforceExtension | false | Enforce that a extension from extensions must be used |
| exportsFields | ["exports"] | A list of exports fields in description files |
| extensions | [".js", ".json", ".node"] | A list of extensions which should be tried for files |
| fallback | [] | Same as `alias`, but only used if default resolving fails |
| fileSystem | | The file system which should be used |
| fullySpecified | false | Request passed to resolve is already fully specified and extensions or main files are not resolved for it (they are still resolved for internal requests) |
| mainFields | ["main"] | A list of main fields in description files |
| mainFiles | ["index"] | A list of main files in directories |
| modules | ["node_modules"] | A list of directories to resolve modules from, can be absolute path or folder name |
| plugins | [] | A list of additional resolve plugins which should be applied |
| resolver | undefined | A prepared Resolver to which the plugins are attached |
| resolveToContext | false | Resolve to a context instead of a file |
| preferRelative | false | Prefer to resolve module requests as relative request and fallback to resolving as module |
| preferAbsolute | false | Prefer to resolve server-relative urls as absolute paths before falling back to resolve in roots |
| restrictions | [] | A list of resolve restrictions |
| roots | [] | A list of root paths |
| symlinks | true | Whether to resolve symlinks to their symlinked location |
| tsconfig | false | TypeScript config for paths mapping. Can be `false` (disabled), `true` (use default `tsconfig.json`), a string path to `tsconfig.json`, or an object with `configFile`, `references`, and `baseUrl` options. Supports JSONC format (comments and trailing commas) like TypeScript compiler. |
| tsconfig.configFile | tsconfig.json | Path to the tsconfig.json file |
| tsconfig.references | [] | Project references. `'auto'` to load from tsconfig, or an array of paths to referenced projects |
| tsconfig.baseUrl | undefined | Override baseUrl from tsconfig.json. If provided, this value will be used instead of the baseUrl in the tsconfig file |
| unsafeCache | false | Use this cache object to unsafely cache the successful requests |
## Plugins
Similar to `webpack`, the core of `enhanced-resolve` functionality is implemented as individual plugins that are executed using [`tapable`](https://github.com/webpack/tapable).
These plugins can extend the functionality of the library, adding other ways for files/contexts to be resolved.
A plugin should be a `class` (or its ES5 equivalent) with an `apply` method. The `apply` method will receive a `resolver` instance, that can be used to hook in to the event system.
### Plugin Boilerplate
```js
class MyResolverPlugin {
constructor(source, target) {
this.source = source;
this.target = target;
}
apply(resolver) {
const target = resolver.ensureHook(this.target);
resolver
.getHook(this.source)
.tapAsync("MyResolverPlugin", (request, resolveContext, callback) => {
// Any logic you need to create a new `request` can go here
resolver.doResolve(target, request, null, resolveContext, callback);
});
}
}
```
Plugins are executed in a pipeline, and register which event they should be executed before/after. In the example above, `source` is the name of the event that starts the pipeline, and `target` is what event this plugin should fire, which is what continues the execution of the pipeline. For an example of how these different plugin events create a chain, see `lib/ResolverFactory.js`, in the `//// pipeline ////` section.
## Escaping
It's allowed to escape `#` as `\0#` to avoid parsing it as fragment.
enhanced-resolve will try to resolve requests containing `#` as path and as fragment, so it will automatically figure out if `./some#thing` means `.../some.js#thing` or `.../some#thing.js`. When a `#` is resolved as path it will be escaped in the result. Here: `.../some\0#thing.js`.
## Tests
```sh
npm run test
```
## Passing options from webpack
If you are using `webpack`, and you want to pass custom options to `enhanced-resolve`, the options are passed from the `resolve` key of your webpack configuration e.g.:
```
resolve: {
extensions: ['.js', '.jsx'],
modules: [path.resolve(__dirname, 'src'), 'node_modules'],
plugins: [new DirectoryNamedWebpackPlugin()]
...
},
```
## License
Copyright (c) 2012-2019 JS Foundation and other contributors
MIT (http://www.opensource.org/licenses/mit-license.php)
[npm]: https://img.shields.io/npm/v/enhanced-resolve.svg
[npm-url]: https://www.npmjs.com/package/enhanced-resolve
[build-status]: https://github.com/webpack/enhanced-resolve/actions/workflows/test.yml/badge.svg
[build-status-url]: https://github.com/webpack/enhanced-resolve/actions
[codecov-badge]: https://codecov.io/gh/webpack/enhanced-resolve/branch/main/graph/badge.svg?token=6B6NxtsZc3
[codecov-url]: https://codecov.io/gh/webpack/enhanced-resolve
[size]: https://packagephobia.com/badge?p=enhanced-resolve
[size-url]: https://packagephobia.com/result?p=enhanced-resolve
[discussion]: https://img.shields.io/github/discussions/webpack/webpack
[discussion-url]: https://github.com/webpack/webpack/discussions
@@ -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 TicketPlus = createLucideIcon("TicketPlus", [
[
"path",
{
d: "M2 9a3 3 0 0 1 0 6v2a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-2a3 3 0 0 1 0-6V7a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2Z",
key: "qn84l0"
}
],
["path", { d: "M9 12h6", key: "1c52cq" }],
["path", { d: "M12 9v6", key: "199k2o" }]
]);
export { TicketPlus as default };
//# sourceMappingURL=ticket-plus.js.map
@@ -0,0 +1,62 @@
// @ts-check
const { createRequire } = require('node:module')
const { pathToFileURL } = require('node:url')
const TS_EXT_RE = /\.[mc]?ts$/
let tsx
let jiti
let importError = []
/**
* @param {string} name
* @param {string} rootFile
* @returns {Promise<any>}
*/
async function req(name, rootFile = __filename) {
let url = createRequire(rootFile).resolve(name)
try {
return (await import(`${pathToFileURL(url)}?t=${Date.now()}`)).default
} catch (err) {
if (!TS_EXT_RE.test(url)) {
/* c8 ignore start */
throw err
}
}
if (tsx === undefined) {
try {
tsx = await import('tsx/cjs/api')
} catch (error) {
importError.push(error)
}
}
if (tsx) {
let loaded = tsx.require(name, rootFile)
return loaded && '__esModule' in loaded ? loaded.default : loaded
}
if (jiti === undefined) {
try {
jiti = (await import('jiti')).default
} catch (error) {
importError.push(error)
}
}
if (jiti) {
return jiti(rootFile, { interopDefault: true })(name)
}
throw new Error(
`'tsx' or 'jiti' is required for the TypeScript configuration files. Make sure it is installed\nError: ${importError
.map(error => error.message)
.join('\n')}`
)
}
module.exports = req
@@ -0,0 +1,230 @@
import type * as errors from "./errors.js";
import type * as schemas from "./schemas.js";
import type { Class, ProtoOf } from "./util.js";
import { members as installMembers } from "./util.js";
////////////////////////////// CONSTRUCTORS ///////////////////////////////////////
type ZodTrait = { _zod: { def: any; [k: string]: any } };
export interface $constructor<T extends ZodTrait, D = T["_zod"]["def"]> {
new (def: D): T;
init(inst: T, def: D): asserts inst is T;
}
export interface $constructorParams {
Parent?: typeof Class;
}
/** A special constant with type `never` */
export const NEVER: never = /*@__PURE__*/ Object.freeze({
status: "aborted",
}) as never;
/* Shared descriptor for installing `_zod`; defineProperty reads it
* synchronously, so reusing one object avoids a per-instance allocation. */
const _zodDesc: PropertyDescriptor = { 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: (ErrorConstructor & { stackTraceLimit?: number }) | null = "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: new () => any): any {
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();
}
export /*@__NO_SIDE_EFFECTS__*/ function $constructor<T extends ZodTrait, D = T["_zod"]["def"]>(
name: string,
initializer: (inst: T, def: D) => void,
/** 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?: ProtoOf<T>,
params?: $constructorParams
): $constructor<T, D> {
// 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: any = {};
// 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(this: any, def: D) {
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<object>();
function init(inst: T, def: D) {
if (!inst._zod) {
_zodDesc.value = new (Internals as any)(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: object | null = own;
while (up && up !== ctorProto) up = Object.getPrototypeOf(up);
const target = up ?? own;
if (!initialized.has(target)) {
initialized.add(target);
installMembers(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 as any)[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 _(this: any, def: D) {
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 as GlobalThisWithConfig).__zod_globalConfig?.postProcessor;
if (pp) pp(inst);
return inst;
}
Object.defineProperty(_, "init", { value: init });
Object.defineProperty(_, Symbol.hasInstance, {
value: (inst: any) => {
if (params?.Parent && inst instanceof params.Parent) return true;
return inst?._zod?.traits?.has(name);
},
});
Object.defineProperty(_, "name", { value: name });
return _ as any;
}
////////////////////////////// UTILITIES ///////////////////////////////////////
export const $brand: unique symbol = /*@__PURE__*/ Symbol("zod_brand");
export type $brand<T extends string | number | symbol = string | number | symbol> = {
[$brand]: { [k in T]: true };
};
export type $ZodBranded<
T extends schemas.SomeType,
Brand extends string | number | symbol,
Dir extends "in" | "out" | "inout" = "out",
> = T &
(Dir extends "inout"
? { _zod: { input: input<T> & $brand<Brand>; output: output<T> & $brand<Brand> } }
: Dir extends "in"
? { _zod: { input: input<T> & $brand<Brand> } }
: { _zod: { output: output<T> & $brand<Brand> } });
export type $ZodNarrow<T extends schemas.SomeType, Out> = T & { _zod: { output: Out } };
export class $ZodAsyncError extends Error {
constructor() {
super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`);
}
}
export class $ZodEncodeError extends Error {
constructor(name: string) {
super(`Encountered unidirectional transform during encode: ${name}`);
this.name = "ZodEncodeError";
}
}
//////////////////////////// TYPE HELPERS ///////////////////////////////////
// export type input<T extends schemas.$ZodType> = T["_zod"]["input"];
// export type output<T extends schemas.$ZodType> = T["_zod"]["output"];
// export type input<T extends schemas.$ZodType> = T["_zod"]["input"];
// export type output<T extends schemas.$ZodType> = T["_zod"]["output"];
export type input<T> = T extends { _zod: { input: any } } ? T["_zod"]["input"] : unknown;
export type output<T> = T extends { _zod: { output: any } } ? T["_zod"]["output"] : unknown;
export type { output as infer };
////////////////////////////// CONFIG ///////////////////////////////////////
export interface $ZodConfig {
/** Custom error map. Overrides `config().localeError`. */
customError?: errors.$ZodErrorMap | undefined;
/** Localized error map. Lowest priority. */
localeError?: errors.$ZodErrorMap | undefined;
/** Disable JIT schema compilation. Useful in environments that disallow `eval`. */
jitless?: boolean | undefined;
/** Enables parsing input that contains reference cycles. Read when a schema is constructed. */
memoizer?: schemas.$ZodMemoizer | undefined;
/**
* Internal: post-processor invoked on every freshly-constructed schema
* instance, after init and deferred fns run. Set by `import "zod/compile"`
* to install AOT compilation. Not part of the public API.
* @internal
*/
postProcessor?: ((inst: any) => void) | undefined;
}
interface GlobalThisWithConfig {
/**
* The globalConfig instance shared across both CommonJS and ESM builds.
* Attached to `globalThis` (mirroring `__zod_globalRegistry`) so that a
* single config object is used regardless of how Zod is loaded — CJS,
* ESM, multiple bundles in a monorepo, etc. This means `z.config(...)`
* applied against any one instance is observed by all of them, and
* pre-populating it before Zod loads (e.g. `globalThis.__zod_globalConfig
* = { jitless: true }` in an inline script) takes effect immediately on
* import.
*/
__zod_globalConfig?: $ZodConfig;
}
(globalThis as GlobalThisWithConfig).__zod_globalConfig ??= {};
export const globalConfig: $ZodConfig = (globalThis as GlobalThisWithConfig).__zod_globalConfig!;
export function config(newConfig?: Partial<$ZodConfig>): $ZodConfig {
if (newConfig) Object.assign(globalConfig, newConfig);
return globalConfig;
}
@@ -0,0 +1,22 @@
The MIT License (MIT)
Copyright (c) 2015-2021 Evgeny Poberezkin
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,79 @@
export { AnimatePresence } from './components/AnimatePresence/index.mjs';
export { PopChild } from './components/AnimatePresence/PopChild.mjs';
export { PresenceChild } from './components/AnimatePresence/PresenceChild.mjs';
export { LayoutGroup } from './components/LayoutGroup/index.mjs';
export { LazyMotion } from './components/LazyMotion/index.mjs';
export { MotionConfig } from './components/MotionConfig/index.mjs';
export { m } from './render/components/m/proxy.mjs';
export { motion } from './render/components/motion/proxy.mjs';
export { addPointerEvent } from './events/add-pointer-event.mjs';
export { addPointerInfo } from './events/event-info.mjs';
export { animations } from './motion/features/animations.mjs';
export { makeUseVisualState } from './motion/utils/use-visual-state.mjs';
export * from 'motion-dom';
export { VisualElement, addScaleCorrector, animateVisualElement, buildTransform, calcLength, createBox, delay, optimizedAppearDataAttribute, resolveMotionValue, visualElementStore } from 'motion-dom';
export { filterProps } from './render/dom/utils/filter-props.mjs';
export { isBrowser } from './utils/is-browser.mjs';
export { useComposedRefs } from './utils/use-composed-ref.mjs';
export { useForceUpdate } from './utils/use-force-update.mjs';
export { useIsomorphicLayoutEffect } from './utils/use-isomorphic-effect.mjs';
export { useUnmountEffect } from './utils/use-unmount-effect.mjs';
export { domAnimation } from './render/dom/features-animation.mjs';
export { domMax } from './render/dom/features-max.mjs';
export { domMin } from './render/dom/features-min.mjs';
export { useMotionValueEvent } from './utils/use-motion-value-event.mjs';
export { useElementScroll } from './value/scroll/use-element-scroll.mjs';
export { useViewportScroll } from './value/scroll/use-viewport-scroll.mjs';
export { useMotionTemplate } from './value/use-motion-template.mjs';
export { useMotionValue } from './value/use-motion-value.mjs';
export { useScroll } from './value/use-scroll.mjs';
export { useFollowValue } from './value/use-follow-value.mjs';
export { useSpring } from './value/use-spring.mjs';
export { useTime } from './value/use-time.mjs';
export { useTransform } from './value/use-transform.mjs';
export { useVelocity } from './value/use-velocity.mjs';
export { useWillChange } from './value/use-will-change/index.mjs';
export { WillChangeMotionValue } from './value/use-will-change/WillChangeMotionValue.mjs';
export { useReducedMotion } from './utils/reduced-motion/use-reduced-motion.mjs';
export { useReducedMotionConfig } from './utils/reduced-motion/use-reduced-motion-config.mjs';
export * from 'motion-utils';
export { MotionGlobalConfig } from 'motion-utils';
export { animationControls } from './animation/hooks/animation-controls.mjs';
export { useAnimate } from './animation/hooks/use-animate.mjs';
export { useAnimateMini } from './animation/hooks/use-animate-style.mjs';
export { useAnimation, useAnimationControls } from './animation/hooks/use-animation.mjs';
export { useIsPresent, usePresence } from './components/AnimatePresence/use-presence.mjs';
export { usePresenceData } from './components/AnimatePresence/use-presence-data.mjs';
export { useDomEvent } from './events/use-dom-event.mjs';
export { DragControls, useDragControls } from './gestures/drag/use-drag-controls.mjs';
export { isMotionComponent } from './motion/utils/is-motion-component.mjs';
export { unwrapMotionComponent } from './motion/utils/unwrap-motion-component.mjs';
export { isValidMotionProp } from './motion/utils/valid-prop.mjs';
export { useInstantLayoutTransition } from './projection/use-instant-layout-transition.mjs';
export { useResetProjection } from './projection/use-reset-projection.mjs';
export { useAnimationFrame } from './utils/use-animation-frame.mjs';
export { useCycle } from './utils/use-cycle.mjs';
export { useInView } from './utils/use-in-view.mjs';
export { disableInstantTransitions, useInstantTransition } from './utils/use-instant-transition.mjs';
export { usePageInView } from './utils/use-page-in-view.mjs';
export { transformViewBoxPoint } from './utils/transform-viewbox-point.mjs';
export { correctParentTransform } from './utils/transform-rotated-parent.mjs';
export { startOptimizedAppearAnimation } from './animation/optimized-appear/start.mjs';
export { LayoutGroupContext } from './context/LayoutGroupContext.mjs';
export { MotionConfigContext } from './context/MotionConfigContext.mjs';
export { MotionContext } from './context/MotionContext/index.mjs';
export { PresenceContext } from './context/PresenceContext.mjs';
export { SwitchLayoutGroupContext } from './context/SwitchLayoutGroupContext.mjs';
export { useAnimatedState as useDeprecatedAnimatedState } from './animation/hooks/use-animated-state.mjs';
export { AnimateSharedLayout } from './components/AnimateSharedLayout.mjs';
export { DeprecatedLayoutGroupContext } from './context/DeprecatedLayoutGroupContext.mjs';
export { useInvertedScale as useDeprecatedInvertedScale } from './value/use-inverted-scale.mjs';
import * as namespace from './components/Reorder/namespace.mjs';
export { namespace as Reorder };
export { animate, createScopedAnimate } from './animation/animate/index.mjs';
export { animateMini } from './animation/animators/waapi/animate-style.mjs';
export { distance, distance2D } from './utils/distance.mjs';
export { inView } from './render/dom/viewport/index.mjs';
export { scroll } from './render/dom/scroll/index.mjs';
export { scrollInfo } from './render/dom/scroll/track.mjs';
//# sourceMappingURL=index.mjs.map
@@ -0,0 +1,12 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const items_1 = require("./items");
const def = {
keyword: "prefixItems",
type: "array",
schemaType: ["array"],
before: "uniqueItems",
code: (cxt) => (0, items_1.validateTuple)(cxt, "items"),
};
exports.default = def;
//# sourceMappingURL=prefixItems.js.map
@@ -0,0 +1,4 @@
import type { CodeKeywordDefinition, ErrorNoParams, AnySchema } from "../../types";
export type AnyOfError = ErrorNoParams<"anyOf", AnySchema[]>;
declare const def: CodeKeywordDefinition;
export default def;
@@ -0,0 +1,4 @@
export interface IDelay {
apply: () => Promise<unknown>;
setAttemptNumber: (attempt: number) => void;
}
@@ -0,0 +1,46 @@
"use strict";
// NOTE: this file is isolated to be shared across legacy and flat configs.
/**
* This is a compatibility ruleset that:
* - disables rules from eslint:recommended which are already handled by TypeScript.
* - enables rules that make sense due to TS's typechecking / transpilation.
*/
const config = (style) => ({
files: style === 'glob'
? // classic configs use glob syntax
['*.ts', '*.tsx', '*.mts', '*.cts']
: // flat configs use minimatch syntax
['**/*.ts', '**/*.tsx', '**/*.mts', '**/*.cts'],
rules: {
'constructor-super': 'off', // ts(2335) & ts(2377)
'getter-return': 'off', // ts(2378)
'no-class-assign': 'off', // ts(2629)
'no-const-assign': 'off', // ts(2588)
'no-dupe-args': 'off', // ts(2300)
'no-dupe-class-members': 'off', // ts(2393) & ts(2300)
'no-dupe-keys': 'off', // ts(1117)
'no-func-assign': 'off', // ts(2630)
'no-import-assign': 'off', // ts(2632) & ts(2540)
'no-new-native-nonconstructor': 'off', // ts(7009)
// "no-new-symbol" was deprecated in ESLint 9.0.0 and will be removed in
// ESLint v11.0.0. See:
// https://eslint.org/docs/latest/rules/no-new-symbol
// We need to keep the rule disabled until TSESLint drops support for
// ESlint 8. See:
// https://github.com/typescript-eslint/typescript-eslint/pull/8895
'no-new-symbol': 'off', // ts(7009)
'no-obj-calls': 'off', // ts(2349)
'no-redeclare': 'off', // ts(2451)
'no-setter-return': 'off', // ts(2408)
'no-this-before-super': 'off', // ts(2376) & ts(17009)
'no-undef': 'off', // ts(2304) & ts(2552)
'no-unreachable': 'off', // ts(7027)
'no-unsafe-negation': 'off', // ts(2365) & ts(2322) & ts(2358)
'no-var': 'error', // ts transpiles let/const to var, so no need for vars any more
'no-with': 'off', // ts(1101) & ts(2410)
'prefer-const': 'error', // ts provides better types with const
'prefer-rest-params': 'error', // ts provides better types with rest args over arguments
'prefer-spread': 'error', // ts transpiles spread to apply, so no need for manual apply
},
});
module.exports = config;
@@ -0,0 +1 @@
{"version":3,"file":"discriminator.js","sourceRoot":"","sources":["../../../lib/vocabularies/jtd/discriminator.ts"],"names":[],"mappings":";;AAEA,mDAA+D;AAC/D,yCAAwC;AACxC,yCAA8C;AAC9C,mCAAwE;AACxE,kDAAgE;AAOhE,MAAM,KAAK,GAA2B;IACpC,OAAO,EAAE,CAAC,GAAG,EAAE,EAAE;QACf,MAAM,EAAC,MAAM,EAAE,MAAM,EAAC,GAAG,GAAG,CAAA;QAC5B,OAAO,MAAM,CAAC,UAAU;YACtB,CAAC,CAAC,MAAM,CAAC,UAAU,KAAK,kBAAU,CAAC,GAAG;gBACpC,CAAC,CAAC,QAAQ,MAAM,kBAAkB;gBAClC,CAAC,CAAC,iBAAiB,MAAM,sBAAsB;YACjD,CAAC,CAAC,IAAA,wBAAgB,EAAC,GAAG,EAAE,QAAQ,CAAC,CAAA;IACrC,CAAC;IACD,MAAM,EAAE,CAAC,GAAG,EAAE,EAAE;QACd,MAAM,EAAC,MAAM,EAAE,MAAM,EAAC,GAAG,GAAG,CAAA;QAC5B,OAAO,MAAM,CAAC,UAAU;YACtB,CAAC,CAAC,IAAA,WAAC,EAAA,WAAW,MAAM,CAAC,UAAU,UAAU,MAAM,eAAe,MAAM,CAAC,GAAG,GAAG;YAC3E,CAAC,CAAC,IAAA,uBAAe,EAAC,GAAG,EAAE,QAAQ,CAAC,CAAA;IACpC,CAAC;CACF,CAAA;AAED,MAAM,GAAG,GAA0B;IACjC,OAAO,EAAE,eAAe;IACxB,UAAU,EAAE,QAAQ;IACpB,UAAU,EAAE,CAAC,SAAS,CAAC;IACvB,KAAK;IACL,IAAI,CAAC,GAAe;QAClB,IAAA,wBAAa,EAAC,GAAG,CAAC,CAAA;QAClB,MAAM,EAAC,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,YAAY,EAAC,GAAG,GAAG,CAAA;QAC7C,MAAM,CAAC,KAAK,EAAE,IAAI,CAAC,GAAG,IAAA,8BAAmB,EAAC,GAAG,EAAE,IAAI,CAAC,CAAA;QAEpD,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,CAAA;QACZ,qBAAqB,EAAE,CAAA;QACvB,GAAG,CAAC,MAAM,CAAC,IAAA,aAAG,EAAC,KAAK,CAAC,CAAC,CAAA;QACtB,GAAG,CAAC,KAAK,EAAE,CAAA;QACX,GAAG,CAAC,KAAK,EAAE,CAAA;QACX,GAAG,CAAC,EAAE,CAAC,KAAK,CAAC,CAAA;QAEb,SAAS,qBAAqB;YAC5B,MAAM,GAAG,GAAG,GAAG,CAAC,KAAK,CAAC,KAAK,EAAE,IAAA,WAAC,EAAA,GAAG,IAAI,GAAG,IAAA,qBAAW,EAAC,MAAM,CAAC,EAAE,CAAC,CAAA;YAC9D,GAAG,CAAC,EAAE,CAAC,IAAA,WAAC,EAAA,GAAG,GAAG,gBAAgB,CAAC,CAAA;YAC/B,GAAG,CAAC,KAAK,CAAC,KAAK,EAAE,EAAC,UAAU,EAAE,kBAAU,CAAC,GAAG,EAAE,GAAG,EAAC,CAAC,CAAA;YACnD,GAAG,CAAC,MAAM,CAAC,IAAA,WAAC,EAAA,UAAU,GAAG,cAAc,CAAC,CAAA;YACxC,eAAe,CAAC,GAAG,CAAC,CAAA;YACpB,GAAG,CAAC,IAAI,EAAE,CAAA;YACV,GAAG,CAAC,KAAK,CAAC,KAAK,EAAE,EAAC,UAAU,EAAE,kBAAU,CAAC,GAAG,EAAE,GAAG,EAAC,EAAE,EAAC,YAAY,EAAE,MAAM,EAAC,CAAC,CAAA;YAC3E,GAAG,CAAC,KAAK,EAAE,CAAA;QACb,CAAC;QAED,SAAS,eAAe,CAAC,GAAS;YAChC,GAAG,CAAC,EAAE,CAAC,KAAK,CAAC,CAAA;YACb,KAAK,MAAM,QAAQ,IAAI,YAAY,CAAC,OAAO,EAAE,CAAC;gBAC5C,GAAG,CAAC,MAAM,CAAC,IAAA,WAAC,EAAA,GAAG,GAAG,QAAQ,QAAQ,EAAE,CAAC,CAAA;gBACrC,GAAG,CAAC,MAAM,CAAC,KAAK,EAAE,cAAc,CAAC,QAAQ,CAAC,CAAC,CAAA;YAC7C,CAAC;YACD,GAAG,CAAC,IAAI,EAAE,CAAA;YACV,GAAG,CAAC,KAAK,CACP,KAAK,EACL,EAAC,UAAU,EAAE,kBAAU,CAAC,OAAO,EAAE,GAAG,EAAC,EACrC,EAAC,YAAY,EAAE,MAAM,EAAE,UAAU,EAAE,SAAS,EAAE,YAAY,EAAE,IAAI,EAAC,CAClE,CAAA;YACD,GAAG,CAAC,KAAK,EAAE,CAAA;QACb,CAAC;QAED,SAAS,cAAc,CAAC,UAAkB;YACxC,MAAM,MAAM,GAAG,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;YAChC,GAAG,CAAC,SAAS,CACX;gBACE,OAAO,EAAE,SAAS;gBAClB,UAAU;gBACV,gBAAgB,EAAE,MAAM;aACzB,EACD,MAAM,CACP,CAAA;YACD,OAAO,MAAM,CAAA;QACf,CAAC;IACH,CAAC;CACF,CAAA;AAED,kBAAe,GAAG,CAAA"}
@@ -0,0 +1,77 @@
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.encodeNonAsciiHTML = exports.encodeHTML = void 0;
var encode_html_js_1 = __importDefault(require("./generated/encode-html.js"));
var escape_js_1 = require("./escape.js");
var htmlReplacer = /[\t\n!-,./:-@[-`\f{-}$\x80-\uFFFF]/g;
/**
* Encodes all characters in the input using HTML entities. This includes
* characters that are valid ASCII characters in HTML documents, such as `#`.
*
* To get a more compact output, consider using the `encodeNonAsciiHTML`
* function, which will only encode characters that are not valid in HTML
* documents, as well as non-ASCII characters.
*
* If a character has no equivalent entity, a numeric hexadecimal reference
* (eg. `&#xfc;`) will be used.
*/
function encodeHTML(data) {
return encodeHTMLTrieRe(htmlReplacer, data);
}
exports.encodeHTML = encodeHTML;
/**
* Encodes all non-ASCII characters, as well as characters not valid in HTML
* documents using HTML entities. This function will not encode characters that
* are valid in HTML documents, such as `#`.
*
* If a character has no equivalent entity, a numeric hexadecimal reference
* (eg. `&#xfc;`) will be used.
*/
function encodeNonAsciiHTML(data) {
return encodeHTMLTrieRe(escape_js_1.xmlReplacer, data);
}
exports.encodeNonAsciiHTML = encodeNonAsciiHTML;
function encodeHTMLTrieRe(regExp, str) {
var ret = "";
var lastIdx = 0;
var match;
while ((match = regExp.exec(str)) !== null) {
var i = match.index;
ret += str.substring(lastIdx, i);
var char = str.charCodeAt(i);
var next = encode_html_js_1.default.get(char);
if (typeof next === "object") {
// We are in a branch. Try to match the next char.
if (i + 1 < str.length) {
var nextChar = str.charCodeAt(i + 1);
var value = typeof next.n === "number"
? next.n === nextChar
? next.o
: undefined
: next.n.get(nextChar);
if (value !== undefined) {
ret += value;
lastIdx = regExp.lastIndex += 1;
continue;
}
}
next = next.v;
}
// We might have a tree node without a value; skip and use a numeric entity.
if (next !== undefined) {
ret += next;
lastIdx = i + 1;
}
else {
var cp = (0, escape_js_1.getCodePoint)(str, i);
ret += "&#x".concat(cp.toString(16), ";");
// Increase by 1 if we have a surrogate pair
lastIdx = regExp.lastIndex += Number(cp !== char);
}
}
return ret + str.substr(lastIdx);
}
//# sourceMappingURL=encode.js.map
@@ -0,0 +1 @@
{"version":3,"file":"minus-circle.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;"}
@@ -0,0 +1,9 @@
import SemVer = require("../classes/semver");
import semver = require("../index");
/**
* Return the major version number.
*/
declare function major(version: string | SemVer, optionsOrLoose?: boolean | semver.Options): number;
export = major;
@@ -0,0 +1 @@
{"version":3,"file":"pie-chart.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;"}
@@ -0,0 +1,2 @@
// Deno users should use mod.ts instead
export * from './deno/index.ts'
@@ -0,0 +1,83 @@
# @rolldown/pluginutils
A utility library for building flexible, composable filter expressions that can be used in plugin hook filters of Rolldown/Vite/Rollup/Unplugin plugins.
## Installation
```sh
pnpm add @rolldown/pluginutils
```
## Usage
### Simple Filters
```ts
import { exactRegex, makeIdFiltersToMatchWithQuery, prefixRegex } from '@rolldown/pluginutils';
// Match exactly 'foo.js'
const filter = exactRegex('foo.js');
// Match any id starting with 'lib/'
const prefix = prefixRegex('lib/');
// Match ids with query params (e.g. 'foo.js?bar')
const idFilters = makeIdFiltersToMatchWithQuery(['**/*.js', /\.ts$/]);
// Usage in a plugin to define a hook filter
const myPlugin = {
resolveId: {
filter: {
id: [exactRegex('MY_ID_TO_CHECK'), /some-other-regex/],
},
handler(id) {
// Your code here
},
},
};
```
### Composable Filters
> [!WARNING]
> Composable filters are not yet supported in legacy Vite or unplugin. They can be used in Rolldown/Rolldown-Vite/Vite Beta plugins only.
```ts
import { and, id, include, moduleType, query } from '@rolldown/pluginutils';
// Build a filter expression
const filterExpr = and(id(/\.ts$/), moduleType('ts'), query('foo', true));
// Usage in a plugin to define a hook filter
const myPlugin = {
transform: {
filter: [include(filterExpr)],
handler(code, id, options) {
// Your code here
},
},
};
```
## API Reference
### Simple Filters
- `exactRegex(str: string, flags?: string): RegExp` — Matches the exact string.
- `prefixRegex(str: string, flags?: string): RegExp` — Matches values with the given prefix.
- `makeIdFiltersToMatchWithQuery(input: string | RegExp | (string | RegExp)[]): string | RegExp | (string | RegExp)[]` — Adapts filters to match ids with query params.
### Composable Filters
- `and(...exprs)` / `or(...exprs)` / `not(expr)` — Logical composition of filter expressions.
- `id(pattern, params?)` — Filter by id. A `string` pattern is matched by exact equality (not glob); a `RegExp` is tested against the id.
- `importerId(pattern, params?)` — Filter by importer id. A `string` pattern is matched by exact equality; a `RegExp` is tested against the importer id. Only usable with the `resolveId` hook.
- `moduleType(type)` — Filter by module type (e.g. 'js', 'tsx', or 'json').
- `code(pattern)` — Filter by code content.
- `query(key, pattern)` — Filter by query parameter.
- `include(expr)` / `exclude(expr)` — Top-level include/exclude wrappers.
- `queries(obj)` — Compose multiple query filters.
### Utilities
- `filterVitePlugins(plugins)` — Filters out Vite plugins with `apply: 'serve'`.
@@ -0,0 +1,140 @@
/**
* @license React
* scheduler-unstable_post_task.production.js
*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
"use strict";
var perf = window.performance,
setTimeout = window.setTimeout,
scheduler = global.scheduler,
getCurrentTime = perf.now.bind(perf),
deadline = 0,
currentPriorityLevel_DEPRECATED = 3;
function runTask(priorityLevel, postTaskPriority, node, callback) {
deadline = getCurrentTime() + 5;
try {
currentPriorityLevel_DEPRECATED = priorityLevel;
var result = callback(!1);
if ("function" === typeof result) {
var continuationOptions = { signal: node._controller.signal },
nextTask = runTask.bind(
null,
priorityLevel,
postTaskPriority,
node,
result
);
void 0 !== scheduler.yield
? scheduler
.yield(continuationOptions)
.then(nextTask)
.catch(handleAbortError)
: scheduler
.postTask(nextTask, continuationOptions)
.catch(handleAbortError);
}
} catch (error) {
setTimeout(function () {
throw error;
});
} finally {
currentPriorityLevel_DEPRECATED = 3;
}
}
function handleAbortError() {}
exports.unstable_IdlePriority = 5;
exports.unstable_ImmediatePriority = 1;
exports.unstable_LowPriority = 4;
exports.unstable_NormalPriority = 3;
exports.unstable_Profiling = null;
exports.unstable_UserBlockingPriority = 2;
exports.unstable_cancelCallback = function (node) {
node._controller.abort();
};
exports.unstable_forceFrameRate = function () {};
exports.unstable_getCurrentPriorityLevel = function () {
return currentPriorityLevel_DEPRECATED;
};
exports.unstable_next = function (callback) {
switch (currentPriorityLevel_DEPRECATED) {
case 1:
case 2:
case 3:
var priorityLevel = 3;
break;
default:
priorityLevel = currentPriorityLevel_DEPRECATED;
}
var previousPriorityLevel = currentPriorityLevel_DEPRECATED;
currentPriorityLevel_DEPRECATED = priorityLevel;
try {
return callback();
} finally {
currentPriorityLevel_DEPRECATED = previousPriorityLevel;
}
};
exports.unstable_now = getCurrentTime;
exports.unstable_requestPaint = function () {};
exports.unstable_runWithPriority = function (priorityLevel, callback) {
var previousPriorityLevel = currentPriorityLevel_DEPRECATED;
currentPriorityLevel_DEPRECATED = priorityLevel;
try {
return callback();
} finally {
currentPriorityLevel_DEPRECATED = previousPriorityLevel;
}
};
exports.unstable_scheduleCallback = function (
priorityLevel,
callback,
options
) {
switch (priorityLevel) {
case 1:
case 2:
var postTaskPriority = "user-blocking";
break;
case 4:
case 3:
postTaskPriority = "user-visible";
break;
case 5:
postTaskPriority = "background";
break;
default:
postTaskPriority = "user-visible";
}
var controller = new TaskController({ priority: postTaskPriority });
options = {
delay: "object" === typeof options && null !== options ? options.delay : 0,
signal: controller.signal
};
controller = { _controller: controller };
scheduler
.postTask(
runTask.bind(null, priorityLevel, postTaskPriority, controller, callback),
options
)
.catch(handleAbortError);
return controller;
};
exports.unstable_shouldYield = function () {
return getCurrentTime() >= deadline;
};
exports.unstable_wrapCallback = function (callback) {
var parentPriorityLevel = currentPriorityLevel_DEPRECATED;
return function () {
var previousPriorityLevel = currentPriorityLevel_DEPRECATED;
currentPriorityLevel_DEPRECATED = parentPriorityLevel;
try {
return callback();
} finally {
currentPriorityLevel_DEPRECATED = previousPriorityLevel;
}
};
};
@@ -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 ClockAlert = createLucideIcon("ClockAlert", [
["path", { d: "M12 6v6l4 2", key: "mmk7yg" }],
["path", { d: "M16 21.16a10 10 0 1 1 5-13.516", key: "cxo92l" }],
["path", { d: "M20 11.5v6", key: "2ei3xq" }],
["path", { d: "M20 21.5h.01", key: "1r2dzp" }]
]);
export { ClockAlert as default };
//# sourceMappingURL=clock-alert.js.map
@@ -0,0 +1 @@
{"version":3,"file":"navigation-2.js","sources":["../../../src/icons/navigation-2.ts"],"sourcesContent":["import createLucideIcon from '../createLucideIcon';\n\n/**\n * @component @name Navigation2\n * @description Lucide SVG icon component, renders SVG Element with children.\n *\n * @preview ![img](data:image/svg+xml;base64,PHN2ZyAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogIHdpZHRoPSIyNCIKICBoZWlnaHQ9IjI0IgogIHZpZXdCb3g9IjAgMCAyNCAyNCIKICBmaWxsPSJub25lIgogIHN0cm9rZT0iIzAwMCIgc3R5bGU9ImJhY2tncm91bmQtY29sb3I6ICNmZmY7IGJvcmRlci1yYWRpdXM6IDJweCIKICBzdHJva2Utd2lkdGg9IjIiCiAgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIgogIHN0cm9rZS1saW5lam9pbj0icm91bmQiCj4KICA8cG9seWdvbiBwb2ludHM9IjEyIDIgMTkgMjEgMTIgMTcgNSAyMSAxMiAyIiAvPgo8L3N2Zz4K) - https://lucide.dev/icons/navigation-2\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 Navigation2 = createLucideIcon('Navigation2', [\n ['polygon', { points: '12 2 19 21 12 17 5 21 12 2', key: 'x8c0qg' }],\n]);\n\nexport default Navigation2;\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,CAAA,CAAA,CAAA,CAAW,CAAA,CAAA,CAAA,CAAE,QAAQ,CAA8B,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,CAAK,UAAU,CAAA;AACrE,CAAC,CAAA,CAAA;;"}
@@ -0,0 +1,91 @@
import type {CodeKeywordDefinition} from "../../types"
import type {KeywordCxt} from "../../compile/validate"
import {allSchemaProperties, usePattern} from "../code"
import {_, not, Name} from "../../compile/codegen"
import {alwaysValidSchema, checkStrictMode} from "../../compile/util"
import {evaluatedPropsToName, Type} from "../../compile/util"
import {AnySchema} from "../../types"
const def: CodeKeywordDefinition = {
keyword: "patternProperties",
type: "object",
schemaType: "object",
code(cxt: KeywordCxt) {
const {gen, schema, data, parentSchema, it} = cxt
const {opts} = it
const patterns = allSchemaProperties(schema)
const alwaysValidPatterns = patterns.filter((p) =>
alwaysValidSchema(it, schema[p] as AnySchema)
)
if (
patterns.length === 0 ||
(alwaysValidPatterns.length === patterns.length &&
(!it.opts.unevaluated || it.props === true))
) {
return
}
const checkProperties =
opts.strictSchema && !opts.allowMatchingProperties && parentSchema.properties
const valid = gen.name("valid")
if (it.props !== true && !(it.props instanceof Name)) {
it.props = evaluatedPropsToName(gen, it.props)
}
const {props} = it
validatePatternProperties()
function validatePatternProperties(): void {
for (const pat of patterns) {
if (checkProperties) checkMatchingProperties(pat)
if (it.allErrors) {
validateProperties(pat)
} else {
gen.var(valid, true) // TODO var
validateProperties(pat)
gen.if(valid)
}
}
}
function checkMatchingProperties(pat: string): void {
for (const prop in checkProperties) {
if (new RegExp(pat).test(prop)) {
checkStrictMode(
it,
`property ${prop} matches pattern ${pat} (use allowMatchingProperties)`
)
}
}
}
function validateProperties(pat: string): void {
gen.forIn("key", data, (key) => {
gen.if(_`${usePattern(cxt, pat)}.test(${key})`, () => {
const alwaysValid = alwaysValidPatterns.includes(pat)
if (!alwaysValid) {
cxt.subschema(
{
keyword: "patternProperties",
schemaProp: pat,
dataProp: key,
dataPropType: Type.Str,
},
valid
)
}
if (it.opts.unevaluated && props !== true) {
gen.assign(_`${props}[${key}]`, true)
} else if (!alwaysValid && !it.allErrors) {
// can short-circuit if `unevaluatedProperties` is not supported (opts.next === false)
// or if all properties were evaluated (props === true)
gen.if(not(valid), () => gen.break())
}
})
})
}
},
}
export default def
@@ -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 Vote = createLucideIcon("Vote", [
["path", { d: "m9 12 2 2 4-4", key: "dzmm74" }],
["path", { d: "M5 7c0-1.1.9-2 2-2h10a2 2 0 0 1 2 2v12H5V7Z", key: "1ezoue" }],
["path", { d: "M22 19H2", key: "nuriw5" }]
]);
export { Vote as default };
//# sourceMappingURL=vote.js.map
@@ -0,0 +1,166 @@
import { Client } from '../../client/index.js';
import { StreamableHTTPClientTransport } from '../../client/streamableHttp.js';
import { SSEClientTransport } from '../../client/sse.js';
import { ListToolsResultSchema, CallToolResultSchema, LoggingMessageNotificationSchema } from '../../types.js';
/**
* Simplified Backwards Compatible MCP Client
*
* This client demonstrates backward compatibility with both:
* 1. Modern servers using Streamable HTTP transport (protocol version 2025-03-26)
* 2. Older servers using HTTP+SSE transport (protocol version 2024-11-05)
*
* Following the MCP specification for backwards compatibility:
* - Attempts to POST an initialize request to the server URL first (modern transport)
* - If that fails with 4xx status, falls back to GET request for SSE stream (older transport)
*/
// Command line args processing
const args = process.argv.slice(2);
const serverUrl = args[0] || 'http://localhost:3000/mcp';
async function main() {
console.log('MCP Backwards Compatible Client');
console.log('===============================');
console.log(`Connecting to server at: ${serverUrl}`);
let client;
let transport;
try {
// Try connecting with automatic transport detection
const connection = await connectWithBackwardsCompatibility(serverUrl);
client = connection.client;
transport = connection.transport;
// Set up notification handler
client.setNotificationHandler(LoggingMessageNotificationSchema, notification => {
console.log(`Notification: ${notification.params.level} - ${notification.params.data}`);
});
// DEMO WORKFLOW:
// 1. List available tools
console.log('\n=== Listing Available Tools ===');
await listTools(client);
// 2. Call the notification tool
console.log('\n=== Starting Notification Stream ===');
await startNotificationTool(client);
// 3. Wait for all notifications (5 seconds)
console.log('\n=== Waiting for all notifications ===');
await new Promise(resolve => setTimeout(resolve, 5000));
// 4. Disconnect
console.log('\n=== Disconnecting ===');
await transport.close();
console.log('Disconnected from MCP server');
}
catch (error) {
console.error('Error running client:', error);
process.exit(1);
}
}
/**
* Connect to an MCP server with backwards compatibility
* Following the spec for client backward compatibility
*/
async function connectWithBackwardsCompatibility(url) {
console.log('1. Trying Streamable HTTP transport first...');
// Step 1: Try Streamable HTTP transport first
const client = new Client({
name: 'backwards-compatible-client',
version: '1.0.0'
});
client.onerror = error => {
console.error('Client error:', error);
};
const baseUrl = new URL(url);
try {
// Create modern transport
const streamableTransport = new StreamableHTTPClientTransport(baseUrl);
await client.connect(streamableTransport);
console.log('Successfully connected using modern Streamable HTTP transport.');
return {
client,
transport: streamableTransport,
transportType: 'streamable-http'
};
}
catch (error) {
// Step 2: If transport fails, try the older SSE transport
console.log(`StreamableHttp transport connection failed: ${error}`);
console.log('2. Falling back to deprecated HTTP+SSE transport...');
try {
// Create SSE transport pointing to /sse endpoint
const sseTransport = new SSEClientTransport(baseUrl);
const sseClient = new Client({
name: 'backwards-compatible-client',
version: '1.0.0'
});
await sseClient.connect(sseTransport);
console.log('Successfully connected using deprecated HTTP+SSE transport.');
return {
client: sseClient,
transport: sseTransport,
transportType: 'sse'
};
}
catch (sseError) {
console.error(`Failed to connect with either transport method:\n1. Streamable HTTP error: ${error}\n2. SSE error: ${sseError}`);
throw new Error('Could not connect to server with any available transport');
}
}
}
/**
* List available tools on the server
*/
async function listTools(client) {
try {
const toolsRequest = {
method: 'tools/list',
params: {}
};
const toolsResult = await client.request(toolsRequest, ListToolsResultSchema);
console.log('Available tools:');
if (toolsResult.tools.length === 0) {
console.log(' No tools available');
}
else {
for (const tool of toolsResult.tools) {
console.log(` - ${tool.name}: ${tool.description}`);
}
}
}
catch (error) {
console.log(`Tools not supported by this server: ${error}`);
}
}
/**
* Start a notification stream by calling the notification tool
*/
async function startNotificationTool(client) {
try {
// Call the notification tool using reasonable defaults
const request = {
method: 'tools/call',
params: {
name: 'start-notification-stream',
arguments: {
interval: 1000, // 1 second between notifications
count: 5 // Send 5 notifications
}
}
};
console.log('Calling notification tool...');
const result = await client.request(request, CallToolResultSchema);
console.log('Tool result:');
result.content.forEach(item => {
if (item.type === 'text') {
console.log(` ${item.text}`);
}
else {
console.log(` ${item.type} content:`, item);
}
});
}
catch (error) {
console.log(`Error calling notification tool: ${error}`);
}
}
// Start the client
main().catch((error) => {
console.error('Error running MCP client:', error);
process.exit(1);
});
//# sourceMappingURL=streamableHttpWithSseFallbackClient.js.map
@@ -0,0 +1,20 @@
import { IntrinsicElements } from "../../intrinsic-elements.js";
import { RefObject } from "../../hooks/index.js";
import { PropsWithChildren } from "../../types.js";
import { FC } from "../../base.js";
//#region src/jsx/dom/intrinsic-element/components.d.ts
export declare const clearCache: () => void;
export declare const composeRef: <T>(ref: RefObject<T | null> | Function | undefined, cb: (e: T) => void | (() => void)) => ((e: T) => () => void);
export declare const title: FC<PropsWithChildren>;
export declare const script: FC<PropsWithChildren<IntrinsicElements['script']>>;
export declare const style: FC<PropsWithChildren<IntrinsicElements['style']>>;
export declare const link: FC<PropsWithChildren<IntrinsicElements['link']>>;
export declare const meta: FC<PropsWithChildren>;
export declare const form: FC<PropsWithChildren<{
action?: Function | string;
method?: 'get' | 'post';
ref?: RefObject<HTMLFormElement | null> | ((e: HTMLFormElement | null) => void | (() => void));
}>>;
export declare const input: FC<PropsWithChildren<IntrinsicElements['input']>>;
export declare const button: FC<PropsWithChildren<IntrinsicElements['button']>>;
//#endregion
@@ -0,0 +1 @@
function e(){for(var e,o=0,r="",t=arguments.length;o<t;o++)(e=arguments[o])&&"string"==typeof e&&(r+=(r&&" ")+e);return r}module.exports=e,module.exports.clsx=e;
@@ -0,0 +1,133 @@
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }var _CJSImportProcessor = require('./CJSImportProcessor'); var _CJSImportProcessor2 = _interopRequireDefault(_CJSImportProcessor);
var _computeSourceMap = require('./computeSourceMap'); var _computeSourceMap2 = _interopRequireDefault(_computeSourceMap);
var _HelperManager = require('./HelperManager');
var _identifyShadowedGlobals = require('./identifyShadowedGlobals'); var _identifyShadowedGlobals2 = _interopRequireDefault(_identifyShadowedGlobals);
var _NameManager = require('./NameManager'); var _NameManager2 = _interopRequireDefault(_NameManager);
var _Options = require('./Options');
var _parser = require('./parser');
var _TokenProcessor = require('./TokenProcessor'); var _TokenProcessor2 = _interopRequireDefault(_TokenProcessor);
var _RootTransformer = require('./transformers/RootTransformer'); var _RootTransformer2 = _interopRequireDefault(_RootTransformer);
var _formatTokens = require('./util/formatTokens'); var _formatTokens2 = _interopRequireDefault(_formatTokens);
var _getTSImportedNames = require('./util/getTSImportedNames'); var _getTSImportedNames2 = _interopRequireDefault(_getTSImportedNames);
;
function getVersion() {
/* istanbul ignore next */
return "3.35.1";
} exports.getVersion = getVersion;
function transform(code, options) {
_Options.validateOptions.call(void 0, options);
try {
const sucraseContext = getSucraseContext(code, options);
const transformer = new (0, _RootTransformer2.default)(
sucraseContext,
options.transforms,
Boolean(options.enableLegacyBabel5ModuleInterop),
options,
);
const transformerResult = transformer.transform();
let result = {code: transformerResult.code};
if (options.sourceMapOptions) {
if (!options.filePath) {
throw new Error("filePath must be specified when generating a source map.");
}
result = {
...result,
sourceMap: _computeSourceMap2.default.call(void 0,
transformerResult,
options.filePath,
options.sourceMapOptions,
code,
sucraseContext.tokenProcessor.tokens,
),
};
}
return result;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
} catch (e) {
if (options.filePath) {
e.message = `Error transforming ${options.filePath}: ${e.message}`;
}
throw e;
}
} exports.transform = transform;
/**
* Return a string representation of the sucrase tokens, mostly useful for
* diagnostic purposes.
*/
function getFormattedTokens(code, options) {
const tokens = getSucraseContext(code, options).tokenProcessor.tokens;
return _formatTokens2.default.call(void 0, code, tokens);
} exports.getFormattedTokens = getFormattedTokens;
/**
* Call into the parser/tokenizer and do some further preprocessing:
* - Come up with a set of used names so that we can assign new names.
* - Preprocess all import/export statements so we know which globals we are interested in.
* - Compute situations where any of those globals are shadowed.
*
* In the future, some of these preprocessing steps can be skipped based on what actual work is
* being done.
*/
function getSucraseContext(code, options) {
const isJSXEnabled = options.transforms.includes("jsx");
const isTypeScriptEnabled = options.transforms.includes("typescript");
const isFlowEnabled = options.transforms.includes("flow");
const disableESTransforms = options.disableESTransforms === true;
const file = _parser.parse.call(void 0, code, isJSXEnabled, isTypeScriptEnabled, isFlowEnabled);
const tokens = file.tokens;
const scopes = file.scopes;
const nameManager = new (0, _NameManager2.default)(code, tokens);
const helperManager = new (0, _HelperManager.HelperManager)(nameManager);
const tokenProcessor = new (0, _TokenProcessor2.default)(
code,
tokens,
isFlowEnabled,
disableESTransforms,
helperManager,
);
const enableLegacyTypeScriptModuleInterop = Boolean(options.enableLegacyTypeScriptModuleInterop);
let importProcessor = null;
if (options.transforms.includes("imports")) {
importProcessor = new (0, _CJSImportProcessor2.default)(
nameManager,
tokenProcessor,
enableLegacyTypeScriptModuleInterop,
options,
options.transforms.includes("typescript"),
Boolean(options.keepUnusedImports),
helperManager,
);
importProcessor.preprocessTokens();
// We need to mark shadowed globals after processing imports so we know that the globals are,
// but before type-only import pruning, since that relies on shadowing information.
_identifyShadowedGlobals2.default.call(void 0, tokenProcessor, scopes, importProcessor.getGlobalNames());
if (options.transforms.includes("typescript") && !options.keepUnusedImports) {
importProcessor.pruneTypeOnlyImports();
}
} else if (options.transforms.includes("typescript") && !options.keepUnusedImports) {
// Shadowed global detection is needed for TS implicit elision of imported names.
_identifyShadowedGlobals2.default.call(void 0, tokenProcessor, scopes, _getTSImportedNames2.default.call(void 0, tokenProcessor));
}
return {tokenProcessor, scopes, nameManager, importProcessor, helperManager};
}
@@ -0,0 +1,62 @@
'use strict';
var Matching = require('./Matching.cjs');
var TimeEstimates = require('./TimeEstimates.cjs');
var Feedback = require('./Feedback.cjs');
var Options = require('./Options.cjs');
var debounce = require('./utils/debounce.cjs');
var index = require('./scoring/index.cjs');
var types = require('./types.cjs');
const time = () => new Date().getTime();
class ZxcvbnFactory {
constructor(options = {}, customMatchers = {}) {
this.options = new Options(options, customMatchers);
this.scoring = new index(this.options);
this.matching = new Matching(this.options);
this.feedback = new Feedback(this.options);
this.timeEstimates = new TimeEstimates.TimeEstimates(this.options);
}
estimateAttackTimes(guesses) {
return this.timeEstimates.estimateAttackTimes(guesses);
}
getFeedback(score, sequence) {
return this.feedback.getFeedback(score, sequence);
}
createReturnValue(resolvedMatches, password, start) {
const matchSequence = this.scoring.mostGuessableMatchSequence(password, resolvedMatches);
const calcTime = time() - start;
const attackTimes = this.estimateAttackTimes(matchSequence.guesses);
return {
calcTime,
...matchSequence,
...attackTimes,
feedback: this.getFeedback(attackTimes.score, matchSequence.sequence)
};
}
main(password, userInputs) {
const userInputsOptions = this.options.getUserInputsOptions(userInputs);
return this.matching.match(password, userInputsOptions);
}
check(password, userInputs) {
const reducedPassword = password.substring(0, this.options.maxLength);
const start = time();
const matches = this.main(reducedPassword, userInputs);
if (matches instanceof Promise) {
throw new Error('You are using a Promised matcher, please use `zxcvbnAsync` for it.');
}
return this.createReturnValue(matches, reducedPassword, start);
}
async checkAsync(password, userInputs) {
const reducedPassword = password.substring(0, this.options.maxLength);
const start = time();
const matches = await this.main(reducedPassword, userInputs);
return this.createReturnValue(matches, reducedPassword, start);
}
}
exports.Options = Options;
exports.debounce = debounce;
exports.MatcherBaseClass = types.MatcherBaseClass;
exports.ZxcvbnFactory = ZxcvbnFactory;
//# sourceMappingURL=index.cjs.map
@@ -0,0 +1,253 @@
import { f as createRule, g as import_ast_utils, m as AST_NODE_TYPES } from "../utils.js";
var object_curly_spacing_default = createRule({
name: "object-curly-spacing",
meta: {
type: "layout",
docs: { description: "Enforce consistent spacing inside braces" },
fixable: "whitespace",
schema: [{
type: "string",
enum: ["always", "never"]
}, {
type: "object",
properties: {
arraysInObjects: { type: "boolean" },
objectsInObjects: { type: "boolean" },
overrides: {
type: "object",
properties: Object.fromEntries([
"ObjectPattern",
"ObjectExpression",
"ImportDeclaration",
"ImportAttributes",
"ExportNamedDeclaration",
"ExportAllDeclaration",
"TSMappedType",
"TSTypeLiteral",
"TSInterfaceBody",
"TSEnumBody"
].map((node) => [node, {
type: "string",
enum: ["always", "never"]
}])),
additionalProperties: false
},
emptyObjects: {
type: "string",
enum: [
"ignore",
"always",
"never"
]
}
},
additionalProperties: false
}],
defaultOptions: ["never"],
messages: {
requireSpaceBefore: "A space is required before '{{token}}'.",
requireSpaceAfter: "A space is required after '{{token}}'.",
unexpectedSpaceBefore: "There should be no space before '{{token}}'.",
unexpectedSpaceAfter: "There should be no space after '{{token}}'.",
requiredSpaceInEmptyObject: "A space is required in empty '{{node}}'.",
unexpectedSpaceInEmptyObject: "There should be no space in empty '{{node}}'."
}
},
create(context, [firstOption, secondOption]) {
const spaced = firstOption === "always";
const sourceCode = context.sourceCode;
function isOptionSet(option) {
return secondOption ? secondOption[option] === !spaced : false;
}
const options = {
spaced,
arraysInObjectsException: isOptionSet("arraysInObjects"),
objectsInObjectsException: isOptionSet("objectsInObjects"),
overrides: secondOption?.overrides ?? {},
emptyObjects: secondOption?.emptyObjects ?? "ignore"
};
function reportNoBeginningSpace(node, token) {
const nextToken = sourceCode.getTokenAfter(token, { includeComments: true });
context.report({
node,
loc: {
start: token.loc.end,
end: nextToken.loc.start
},
messageId: "unexpectedSpaceAfter",
data: { token: token.value },
fix(fixer) {
return fixer.removeRange([token.range[1], nextToken.range[0]]);
}
});
}
function reportNoEndingSpace(node, token) {
const previousToken = sourceCode.getTokenBefore(token, { includeComments: true });
context.report({
node,
loc: {
start: previousToken.loc.end,
end: token.loc.start
},
messageId: "unexpectedSpaceBefore",
data: { token: token.value },
fix(fixer) {
return fixer.removeRange([previousToken.range[1], token.range[0]]);
}
});
}
function reportRequiredBeginningSpace(node, token) {
context.report({
node,
loc: token.loc,
messageId: "requireSpaceAfter",
data: { token: token.value },
fix(fixer) {
return fixer.insertTextAfter(token, " ");
}
});
}
function reportRequiredEndingSpace(node, token) {
context.report({
node,
loc: token.loc,
messageId: "requireSpaceBefore",
data: { token: token.value },
fix(fixer) {
return fixer.insertTextBefore(token, " ");
}
});
}
function validateBraceSpacing(node, openingToken, closingToken, nodeType = node.type) {
const tokenAfterOpening = sourceCode.getTokenAfter(openingToken, { includeComments: true });
const spaced = options.overrides[nodeType] ? options.overrides[nodeType] === "always" : options.spaced;
if ((0, import_ast_utils.isTokenOnSameLine)(openingToken, tokenAfterOpening)) {
const firstSpaced = sourceCode.isSpaceBetween(openingToken, tokenAfterOpening);
const secondType = sourceCode.getNodeByRangeIndex(tokenAfterOpening.range[0]).type;
const openingCurlyBraceMustBeSpaced = options.arraysInObjectsException && [AST_NODE_TYPES.TSMappedType, AST_NODE_TYPES.TSIndexSignature].includes(secondType) ? !spaced : spaced;
if (openingCurlyBraceMustBeSpaced && !firstSpaced) reportRequiredBeginningSpace(node, openingToken);
if (!openingCurlyBraceMustBeSpaced && firstSpaced && !((0, import_ast_utils.isCommentToken)(tokenAfterOpening) && !(0, import_ast_utils.isTokenOnSameLine)(openingToken, closingToken))) reportNoBeginningSpace(node, openingToken);
}
const tokenBeforeClosing = sourceCode.getTokenBefore(closingToken, { includeComments: true });
if ((0, import_ast_utils.isTokenOnSameLine)(tokenBeforeClosing, closingToken)) {
const penultimateType = options.arraysInObjectsException && (0, import_ast_utils.isClosingBracketToken)(tokenBeforeClosing) || options.objectsInObjectsException && (0, import_ast_utils.isClosingBraceToken)(tokenBeforeClosing) ? sourceCode.getNodeByRangeIndex(tokenBeforeClosing.range[0]).type : void 0;
const closingCurlyBraceMustBeSpaced = options.arraysInObjectsException && [AST_NODE_TYPES.ArrayExpression, AST_NODE_TYPES.TSTupleType].includes(penultimateType) || options.objectsInObjectsException && penultimateType !== void 0 && [
AST_NODE_TYPES.ObjectExpression,
AST_NODE_TYPES.ObjectPattern,
AST_NODE_TYPES.TSMappedType,
AST_NODE_TYPES.TSTypeLiteral
].includes(penultimateType) ? !spaced : spaced;
const lastSpaced = sourceCode.isSpaceBetween(tokenBeforeClosing, closingToken);
if (closingCurlyBraceMustBeSpaced && !lastSpaced) reportRequiredEndingSpace(node, closingToken);
if (!closingCurlyBraceMustBeSpaced && lastSpaced) reportNoEndingSpace(node, closingToken);
}
}
function checkSpaceInEmptyObjectLike(node, openingToken, closingToken, nodeType = node.type) {
if (options.emptyObjects === "ignore" || !(0, import_ast_utils.isTokenOnSameLine)(openingToken, closingToken) || sourceCode.commentsExistBetween(openingToken, closingToken)) return;
const sourceBetween = sourceCode.getText().slice(openingToken.range[0] + 1, closingToken.range[1] - 1);
if (sourceBetween.trim() !== "") return;
if (options.emptyObjects === "always") {
if (sourceBetween === " ") return;
context.report({
node,
loc: {
start: openingToken.loc.end,
end: closingToken.loc.start
},
messageId: "requiredSpaceInEmptyObject",
data: { node: nodeType },
fix(fixer) {
return fixer.replaceTextRange([openingToken.range[1], closingToken.range[0]], " ");
}
});
} else if (options.emptyObjects === "never") {
if (sourceBetween === "") return;
context.report({
node,
loc: {
start: openingToken.loc.end,
end: closingToken.loc.start
},
messageId: "unexpectedSpaceInEmptyObject",
data: { node: nodeType },
fix(fixer) {
return fixer.removeRange([openingToken.range[1], closingToken.range[0]]);
}
});
}
}
function getBraceToken(node, nodeType = node.type) {
switch (nodeType) {
case "ImportDeclaration":
case "ExportNamedDeclaration":
case "ExportAllDeclaration": {
const attrTokens = sourceCode.getTokens(node);
return [attrTokens.find((token) => (0, import_ast_utils.isOpeningBraceToken)(token)), attrTokens.find((token) => (0, import_ast_utils.isClosingBraceToken)(token))];
}
case "ImportAttributes": {
const attrTokens = sourceCode.getTokens(node);
const openingAttrToken = attrTokens.findLast((token) => (0, import_ast_utils.isOpeningBraceToken)(token));
const closingAttrToken = attrTokens.findLast((token) => (0, import_ast_utils.isClosingBraceToken)(token));
if (!openingAttrToken || !closingAttrToken || !node.source || openingAttrToken.range[0] < node.source.range[0]) return [null, null];
return [openingAttrToken, closingAttrToken];
}
case "ObjectPattern":
case "ObjectExpression":
case "TSMappedType":
case "TSTypeLiteral":
case "TSInterfaceBody":
case "TSEnumBody": {
const allTokens = sourceCode.getTokens(node);
return [allTokens.find((token) => (0, import_ast_utils.isOpeningBraceToken)(token)), node.type === "ObjectPattern" && node.typeAnnotation ? sourceCode.getTokenBefore(node.typeAnnotation) : allTokens.findLast((token) => (0, import_ast_utils.isClosingBraceToken)(token))];
}
default: throw new Error(`Unsupported node type: ${nodeType}`);
}
}
function checkForObjectLike(node, properties, nodeType = node.type) {
const [openingToken, closingToken] = getBraceToken(node, nodeType);
if (!openingToken || !closingToken) return;
if (properties.length === 0) {
checkSpaceInEmptyObjectLike(node, openingToken, closingToken, nodeType);
return;
}
validateBraceSpacing(node, openingToken, closingToken, nodeType);
}
return {
ObjectPattern(node) {
checkForObjectLike(node, node.properties);
},
ObjectExpression(node) {
checkForObjectLike(node, node.properties);
},
ImportDeclaration(node) {
if (node.attributes) checkForObjectLike(node, node.attributes, "ImportAttributes");
const firstSpecifierIndex = node.specifiers.findIndex((specifier) => specifier.type === "ImportSpecifier");
if (firstSpecifierIndex === -1) {
checkForObjectLike(node, []);
return;
}
checkForObjectLike(node, node.specifiers.slice(firstSpecifierIndex));
},
ExportNamedDeclaration(node) {
checkForObjectLike(node, node.specifiers);
if (node.attributes) checkForObjectLike(node, node.attributes, "ImportAttributes");
},
ExportAllDeclaration(node) {
if (node.attributes) checkForObjectLike(node, node.attributes, "ImportAttributes");
},
TSMappedType(node) {
validateBraceSpacing(node, sourceCode.getFirstToken(node), sourceCode.getLastToken(node));
},
TSTypeLiteral(node) {
checkForObjectLike(node, node.members);
},
TSInterfaceBody(node) {
checkForObjectLike(node, node.body);
},
TSEnumBody(node) {
checkForObjectLike(node, node.members);
}
};
}
});
export { object_curly_spacing_default as t };
@@ -0,0 +1 @@
{"version":3,"names":["_writeOnlyError","name","TypeError"],"sources":["../../src/helpers/writeOnlyError.ts"],"sourcesContent":["/* @minVersion 7.12.13 */\n\nexport default function _writeOnlyError(name: string) {\n throw new TypeError('\"' + name + '\" is write-only');\n}\n"],"mappings":";;;;;;AAEe,SAASA,eAAeA,CAACC,IAAY,EAAE;EACpD,MAAM,IAAIC,SAAS,CAAC,GAAG,GAAGD,IAAI,GAAG,iBAAiB,CAAC;AACrD","ignoreList":[]}
@@ -0,0 +1,4 @@
module.exports.agents = require('./agents').agents
module.exports.feature = require('./feature')
module.exports.features = require('./features').features
module.exports.region = require('./region')
@@ -0,0 +1 @@
{"version":3,"file":"monitor-pause.js","sources":["../../../src/icons/monitor-pause.ts"],"sourcesContent":["import createLucideIcon from '../createLucideIcon';\n\n/**\n * @component @name MonitorPause\n * @description Lucide SVG icon component, renders SVG Element with children.\n *\n * @preview ![img](data:image/svg+xml;base64,PHN2ZyAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogIHdpZHRoPSIyNCIKICBoZWlnaHQ9IjI0IgogIHZpZXdCb3g9IjAgMCAyNCAyNCIKICBmaWxsPSJub25lIgogIHN0cm9rZT0iIzAwMCIgc3R5bGU9ImJhY2tncm91bmQtY29sb3I6ICNmZmY7IGJvcmRlci1yYWRpdXM6IDJweCIKICBzdHJva2Utd2lkdGg9IjIiCiAgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIgogIHN0cm9rZS1saW5lam9pbj0icm91bmQiCj4KICA8cGF0aCBkPSJNMTAgMTNWNyIgLz4KICA8cGF0aCBkPSJNMTQgMTNWNyIgLz4KICA8cmVjdCB3aWR0aD0iMjAiIGhlaWdodD0iMTQiIHg9IjIiIHk9IjMiIHJ4PSIyIiAvPgogIDxwYXRoIGQ9Ik0xMiAxN3Y0IiAvPgogIDxwYXRoIGQ9Ik04IDIxaDgiIC8+Cjwvc3ZnPgo=) - https://lucide.dev/icons/monitor-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 MonitorPause = createLucideIcon('MonitorPause', [\n ['path', { d: 'M10 13V7', key: '1u13u9' }],\n ['path', { d: 'M14 13V7', key: '1vj9om' }],\n ['rect', { width: '20', height: '14', x: '2', y: '3', rx: '2', key: '48i651' }],\n ['path', { d: 'M12 17v4', key: '1riwvh' }],\n ['path', { d: 'M8 21h8', key: '1ev6f3' }],\n]);\n\nexport default MonitorPause;\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,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,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,CAAA,CAAQ,CAAA,CAAA,CAAE,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAO,MAAM,CAAQ,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAM,CAAG,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,GAAG,CAAK,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,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;AAC1C,CAAC,CAAA,CAAA;;"}
@@ -0,0 +1,36 @@
import { motionValue, spring } from 'motion-dom';
import { createAnimationsFromSequence } from '../sequence/create.mjs';
import { animateSubject } from './subject.mjs';
function animateSequence(sequence, options, scope) {
const animations = [];
/**
* Pre-process: replace function segments with MotionValue segments,
* subscribe callbacks immediately
*/
const processedSequence = sequence.map((segment) => {
if (Array.isArray(segment) && typeof segment[0] === "function") {
const callback = segment[0];
const mv = motionValue(0);
mv.on("change", callback);
if (segment.length === 1) {
return [mv, [0, 1]];
}
else if (segment.length === 2) {
return [mv, [0, 1], segment[1]];
}
else {
return [mv, segment[1], segment[2]];
}
}
return segment;
});
const animationDefinitions = createAnimationsFromSequence(processedSequence, options, scope, { spring });
animationDefinitions.forEach(({ keyframes, transition }, subject) => {
animations.push(...animateSubject(subject, keyframes, transition));
});
return animations;
}
export { animateSequence };
//# sourceMappingURL=sequence.mjs.map
@@ -0,0 +1,102 @@
var pSlice = Array.prototype.slice;
var Object_keys = typeof Object.keys === 'function'
? Object.keys
: function (obj) {
var keys = [];
for (var key in obj) keys.push(key);
return keys;
}
;
var deepEqual = module.exports = function (actual, expected) {
// enforce Object.is +0 !== -0
if (actual === 0 && expected === 0) {
return areZerosEqual(actual, expected);
// 7.1. All identical values are equivalent, as determined by ===.
} else if (actual === expected) {
return true;
} else if (actual instanceof Date && expected instanceof Date) {
return actual.getTime() === expected.getTime();
} else if (isNumberNaN(actual)) {
return isNumberNaN(expected);
// 7.3. Other pairs that do not both pass typeof value == 'object',
// equivalence is determined by ==.
} else if (typeof actual != 'object' && typeof expected != 'object') {
return actual == expected;
// 7.4. For all other Object pairs, including Array objects, equivalence is
// determined by having the same number of owned properties (as verified
// with Object.prototype.hasOwnProperty.call), the same set of keys
// (although not necessarily the same order), equivalent values for every
// corresponding key, and an identical 'prototype' property. Note: this
// accounts for both named and indexed properties on Arrays.
} else {
return objEquiv(actual, expected);
}
};
function isUndefinedOrNull(value) {
return value === null || value === undefined;
}
function isArguments(object) {
return Object.prototype.toString.call(object) == '[object Arguments]';
}
function isNumberNaN(value) {
// NaN === NaN -> false
return typeof value == 'number' && value !== value;
}
function areZerosEqual(zeroA, zeroB) {
// (1 / +0|0) -> Infinity, but (1 / -0) -> -Infinity and (Infinity !== -Infinity)
return (1 / zeroA) === (1 / zeroB);
}
function objEquiv(a, b) {
if (isUndefinedOrNull(a) || isUndefinedOrNull(b))
return false;
// an identical 'prototype' property.
if (a.prototype !== b.prototype) return false;
//~~~I've managed to break Object.keys through screwy arguments passing.
// Converting to array solves the problem.
if (isArguments(a)) {
if (!isArguments(b)) {
return false;
}
a = pSlice.call(a);
b = pSlice.call(b);
return deepEqual(a, b);
}
try {
var ka = Object_keys(a),
kb = Object_keys(b),
key, i;
} catch (e) {//happens when one is a string literal and the other isn't
return false;
}
// having the same number of owned properties (keys incorporates
// hasOwnProperty)
if (ka.length != kb.length)
return false;
//the same set of keys (although not necessarily the same order),
ka.sort();
kb.sort();
//~~~cheap key test
for (i = ka.length - 1; i >= 0; i--) {
if (ka[i] != kb[i])
return false;
}
//equivalent values for every corresponding key, and
//~~~possibly expensive deep test
for (i = ka.length - 1; i >= 0; i--) {
key = ka[i];
if (!deepEqual(a[key], b[key])) return false;
}
return true;
}
@@ -0,0 +1,2 @@
export {};
//# sourceMappingURL=multipleClientsParallel.d.ts.map