update
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = _tdzError;
|
||||
function _tdzError(name) {
|
||||
throw new ReferenceError(name + " is not defined - temporal dead zone");
|
||||
}
|
||||
|
||||
//# sourceMappingURL=tdz.js.map
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,321 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
||||
const jsxRuntime = require("react/jsx-runtime");
|
||||
const React = require("react");
|
||||
const reactDom = require("react-dom");
|
||||
const routerCore = require("@tanstack/router-core");
|
||||
const useRouterState = require("./useRouterState.cjs");
|
||||
const useRouter = require("./useRouter.cjs");
|
||||
const utils = require("./utils.cjs");
|
||||
const Matches = require("./Matches.cjs");
|
||||
function _interopNamespaceDefault(e) {
|
||||
const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
|
||||
if (e) {
|
||||
for (const k in e) {
|
||||
if (k !== "default") {
|
||||
const d = Object.getOwnPropertyDescriptor(e, k);
|
||||
Object.defineProperty(n, k, d.get ? d : {
|
||||
enumerable: true,
|
||||
get: () => e[k]
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
n.default = e;
|
||||
return Object.freeze(n);
|
||||
}
|
||||
const React__namespace = /* @__PURE__ */ _interopNamespaceDefault(React);
|
||||
function useLinkProps(options, forwardedRef) {
|
||||
const router = useRouter.useRouter();
|
||||
const [isTransitioning, setIsTransitioning] = React__namespace.useState(false);
|
||||
const hasRenderFetched = React__namespace.useRef(false);
|
||||
const innerRef = utils.useForwardedRef(forwardedRef);
|
||||
const {
|
||||
// custom props
|
||||
activeProps = () => ({ className: "active" }),
|
||||
inactiveProps = () => ({}),
|
||||
activeOptions,
|
||||
to,
|
||||
preload: userPreload,
|
||||
preloadDelay: userPreloadDelay,
|
||||
hashScrollIntoView,
|
||||
replace,
|
||||
startTransition,
|
||||
resetScroll,
|
||||
viewTransition,
|
||||
// element props
|
||||
children,
|
||||
target,
|
||||
disabled,
|
||||
style,
|
||||
className,
|
||||
onClick,
|
||||
onFocus,
|
||||
onMouseEnter,
|
||||
onMouseLeave,
|
||||
onTouchStart,
|
||||
ignoreBlocker,
|
||||
...rest
|
||||
} = options;
|
||||
const {
|
||||
// prevent these from being returned
|
||||
params: _params,
|
||||
search: _search,
|
||||
hash: _hash,
|
||||
state: _state,
|
||||
mask: _mask,
|
||||
reloadDocument: _reloadDocument,
|
||||
...propsSafeToSpread
|
||||
} = rest;
|
||||
const type = React__namespace.useMemo(() => {
|
||||
try {
|
||||
new URL(`${to}`);
|
||||
return "external";
|
||||
} catch {
|
||||
}
|
||||
return "internal";
|
||||
}, [to]);
|
||||
const currentSearch = useRouterState.useRouterState({
|
||||
select: (s) => s.location.search,
|
||||
structuralSharing: true
|
||||
});
|
||||
const from = Matches.useMatches({
|
||||
select: (matches) => {
|
||||
var _a;
|
||||
return options.from ?? ((_a = matches[matches.length - 1]) == null ? void 0 : _a.fullPath);
|
||||
}
|
||||
});
|
||||
const _options = React__namespace.useMemo(() => ({ ...options, from }), [options, from]);
|
||||
const next = React__namespace.useMemo(
|
||||
() => router.buildLocation(_options),
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
[router, _options, currentSearch]
|
||||
);
|
||||
const preload = React__namespace.useMemo(() => {
|
||||
if (_options.reloadDocument) {
|
||||
return false;
|
||||
}
|
||||
return userPreload ?? router.options.defaultPreload;
|
||||
}, [router.options.defaultPreload, userPreload, _options.reloadDocument]);
|
||||
const preloadDelay = userPreloadDelay ?? router.options.defaultPreloadDelay ?? 0;
|
||||
const isActive = useRouterState.useRouterState({
|
||||
select: (s) => {
|
||||
if (activeOptions == null ? void 0 : activeOptions.exact) {
|
||||
const testExact = routerCore.exactPathTest(
|
||||
s.location.pathname,
|
||||
next.pathname,
|
||||
router.basepath
|
||||
);
|
||||
if (!testExact) {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
const currentPathSplit = routerCore.removeTrailingSlash(
|
||||
s.location.pathname,
|
||||
router.basepath
|
||||
).split("/");
|
||||
const nextPathSplit = routerCore.removeTrailingSlash(
|
||||
next.pathname,
|
||||
router.basepath
|
||||
).split("/");
|
||||
const pathIsFuzzyEqual = nextPathSplit.every(
|
||||
(d, i) => d === currentPathSplit[i]
|
||||
);
|
||||
if (!pathIsFuzzyEqual) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if ((activeOptions == null ? void 0 : activeOptions.includeSearch) ?? true) {
|
||||
const searchTest = routerCore.deepEqual(s.location.search, next.search, {
|
||||
partial: !(activeOptions == null ? void 0 : activeOptions.exact),
|
||||
ignoreUndefined: !(activeOptions == null ? void 0 : activeOptions.explicitUndefined)
|
||||
});
|
||||
if (!searchTest) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (activeOptions == null ? void 0 : activeOptions.includeHash) {
|
||||
return s.location.hash === next.hash;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
});
|
||||
const doPreload = React__namespace.useCallback(() => {
|
||||
router.preloadRoute(_options).catch((err) => {
|
||||
console.warn(err);
|
||||
console.warn(routerCore.preloadWarning);
|
||||
});
|
||||
}, [_options, router]);
|
||||
const preloadViewportIoCallback = React__namespace.useCallback(
|
||||
(entry) => {
|
||||
if (entry == null ? void 0 : entry.isIntersecting) {
|
||||
doPreload();
|
||||
}
|
||||
},
|
||||
[doPreload]
|
||||
);
|
||||
utils.useIntersectionObserver(
|
||||
innerRef,
|
||||
preloadViewportIoCallback,
|
||||
{ rootMargin: "100px" },
|
||||
{ disabled: !!disabled || !(preload === "viewport") }
|
||||
);
|
||||
utils.useLayoutEffect(() => {
|
||||
if (hasRenderFetched.current) {
|
||||
return;
|
||||
}
|
||||
if (!disabled && preload === "render") {
|
||||
doPreload();
|
||||
hasRenderFetched.current = true;
|
||||
}
|
||||
}, [disabled, doPreload, preload]);
|
||||
if (type === "external") {
|
||||
return {
|
||||
...propsSafeToSpread,
|
||||
ref: innerRef,
|
||||
type,
|
||||
href: to,
|
||||
...children && { children },
|
||||
...target && { target },
|
||||
...disabled && { disabled },
|
||||
...style && { style },
|
||||
...className && { className },
|
||||
...onClick && { onClick },
|
||||
...onFocus && { onFocus },
|
||||
...onMouseEnter && { onMouseEnter },
|
||||
...onMouseLeave && { onMouseLeave },
|
||||
...onTouchStart && { onTouchStart }
|
||||
};
|
||||
}
|
||||
const handleClick = (e) => {
|
||||
if (!disabled && !isCtrlEvent(e) && !e.defaultPrevented && (!target || target === "_self") && e.button === 0) {
|
||||
e.preventDefault();
|
||||
reactDom.flushSync(() => {
|
||||
setIsTransitioning(true);
|
||||
});
|
||||
const unsub = router.subscribe("onResolved", () => {
|
||||
unsub();
|
||||
setIsTransitioning(false);
|
||||
});
|
||||
return router.navigate({
|
||||
..._options,
|
||||
replace,
|
||||
resetScroll,
|
||||
hashScrollIntoView,
|
||||
startTransition,
|
||||
viewTransition,
|
||||
ignoreBlocker
|
||||
});
|
||||
}
|
||||
};
|
||||
const handleFocus = (_) => {
|
||||
if (disabled) return;
|
||||
if (preload) {
|
||||
doPreload();
|
||||
}
|
||||
};
|
||||
const handleTouchStart = handleFocus;
|
||||
const handleEnter = (e) => {
|
||||
if (disabled) return;
|
||||
const eventTarget = e.target || {};
|
||||
if (preload) {
|
||||
if (eventTarget.preloadTimeout) {
|
||||
return;
|
||||
}
|
||||
eventTarget.preloadTimeout = setTimeout(() => {
|
||||
eventTarget.preloadTimeout = null;
|
||||
doPreload();
|
||||
}, preloadDelay);
|
||||
}
|
||||
};
|
||||
const handleLeave = (e) => {
|
||||
if (disabled) return;
|
||||
const eventTarget = e.target || {};
|
||||
if (eventTarget.preloadTimeout) {
|
||||
clearTimeout(eventTarget.preloadTimeout);
|
||||
eventTarget.preloadTimeout = null;
|
||||
}
|
||||
};
|
||||
const composeHandlers = (handlers) => (e) => {
|
||||
var _a;
|
||||
(_a = e.persist) == null ? void 0 : _a.call(e);
|
||||
handlers.filter(Boolean).forEach((handler) => {
|
||||
if (e.defaultPrevented) return;
|
||||
handler(e);
|
||||
});
|
||||
};
|
||||
const resolvedActiveProps = isActive ? routerCore.functionalUpdate(activeProps, {}) ?? {} : {};
|
||||
const resolvedInactiveProps = isActive ? {} : routerCore.functionalUpdate(inactiveProps, {});
|
||||
const resolvedClassName = [
|
||||
className,
|
||||
resolvedActiveProps.className,
|
||||
resolvedInactiveProps.className
|
||||
].filter(Boolean).join(" ");
|
||||
const resolvedStyle = {
|
||||
...style,
|
||||
...resolvedActiveProps.style,
|
||||
...resolvedInactiveProps.style
|
||||
};
|
||||
return {
|
||||
...propsSafeToSpread,
|
||||
...resolvedActiveProps,
|
||||
...resolvedInactiveProps,
|
||||
href: disabled ? void 0 : next.maskedLocation ? router.history.createHref(next.maskedLocation.href) : router.history.createHref(next.href),
|
||||
ref: innerRef,
|
||||
onClick: composeHandlers([onClick, handleClick]),
|
||||
onFocus: composeHandlers([onFocus, handleFocus]),
|
||||
onMouseEnter: composeHandlers([onMouseEnter, handleEnter]),
|
||||
onMouseLeave: composeHandlers([onMouseLeave, handleLeave]),
|
||||
onTouchStart: composeHandlers([onTouchStart, handleTouchStart]),
|
||||
disabled: !!disabled,
|
||||
target,
|
||||
...Object.keys(resolvedStyle).length && { style: resolvedStyle },
|
||||
...resolvedClassName && { className: resolvedClassName },
|
||||
...disabled && {
|
||||
role: "link",
|
||||
"aria-disabled": true
|
||||
},
|
||||
...isActive && { "data-status": "active", "aria-current": "page" },
|
||||
...isTransitioning && { "data-transitioning": "transitioning" }
|
||||
};
|
||||
}
|
||||
function createLink(Comp) {
|
||||
return React__namespace.forwardRef(function CreatedLink(props, ref) {
|
||||
return /* @__PURE__ */ jsxRuntime.jsx(Link, { ...props, _asChild: Comp, ref });
|
||||
});
|
||||
}
|
||||
const Link = React__namespace.forwardRef(
|
||||
(props, ref) => {
|
||||
const { _asChild, ...rest } = props;
|
||||
const {
|
||||
type: _type,
|
||||
ref: innerRef,
|
||||
...linkProps
|
||||
} = useLinkProps(rest, ref);
|
||||
const children = typeof rest.children === "function" ? rest.children({
|
||||
isActive: linkProps["data-status"] === "active"
|
||||
}) : rest.children;
|
||||
if (typeof _asChild === "undefined") {
|
||||
delete linkProps.disabled;
|
||||
}
|
||||
return React__namespace.createElement(
|
||||
_asChild ? _asChild : "a",
|
||||
{
|
||||
...linkProps,
|
||||
ref: innerRef
|
||||
},
|
||||
children
|
||||
);
|
||||
}
|
||||
);
|
||||
function isCtrlEvent(e) {
|
||||
return !!(e.metaKey || e.altKey || e.ctrlKey || e.shiftKey);
|
||||
}
|
||||
const linkOptions = (options) => {
|
||||
return options;
|
||||
};
|
||||
exports.Link = Link;
|
||||
exports.createLink = createLink;
|
||||
exports.linkOptions = linkOptions;
|
||||
exports.useLinkProps = useLinkProps;
|
||||
//# sourceMappingURL=link.cjs.map
|
||||
@@ -0,0 +1,2 @@
|
||||
import type { PageContextType } from '../types.js';
|
||||
export default function usePageContext(): PageContextType;
|
||||
@@ -0,0 +1,447 @@
|
||||
/**
|
||||
* @fileoverview Source code for spaced-comments rule
|
||||
* @author Gyandeep Singh
|
||||
* @deprecated in ESLint v8.53.0
|
||||
*/
|
||||
"use strict";
|
||||
|
||||
const escapeRegExp = require("escape-string-regexp");
|
||||
const astUtils = require("./utils/ast-utils");
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Helpers
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Escapes the control characters of a given string.
|
||||
* @param {string} s A string to escape.
|
||||
* @returns {string} An escaped string.
|
||||
*/
|
||||
function escape(s) {
|
||||
return `(?:${escapeRegExp(s)})`;
|
||||
}
|
||||
|
||||
/**
|
||||
* Escapes the control characters of a given string.
|
||||
* And adds a repeat flag.
|
||||
* @param {string} s A string to escape.
|
||||
* @returns {string} An escaped string.
|
||||
*/
|
||||
function escapeAndRepeat(s) {
|
||||
return `${escape(s)}+`;
|
||||
}
|
||||
|
||||
/**
|
||||
* Parses `markers` option.
|
||||
* If markers don't include `"*"`, this adds `"*"` to allow JSDoc comments.
|
||||
* @param {string[]} [markers] A marker list.
|
||||
* @returns {string[]} A marker list.
|
||||
*/
|
||||
function parseMarkersOption(markers) {
|
||||
// `*` is a marker for JSDoc comments.
|
||||
if (!markers.includes("*")) {
|
||||
return markers.concat("*");
|
||||
}
|
||||
|
||||
return markers;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates string pattern for exceptions.
|
||||
* Generated pattern:
|
||||
*
|
||||
* 1. A space or an exception pattern sequence.
|
||||
* @param {string[]} exceptions An exception pattern list.
|
||||
* @returns {string} A regular expression string for exceptions.
|
||||
*/
|
||||
function createExceptionsPattern(exceptions) {
|
||||
let pattern = "";
|
||||
|
||||
/*
|
||||
* A space or an exception pattern sequence.
|
||||
* [] ==> "\s"
|
||||
* ["-"] ==> "(?:\s|\-+$)"
|
||||
* ["-", "="] ==> "(?:\s|(?:\-+|=+)$)"
|
||||
* ["-", "=", "--=="] ==> "(?:\s|(?:\-+|=+|(?:\-\-==)+)$)" ==> https://jex.im/regulex/#!embed=false&flags=&re=(%3F%3A%5Cs%7C(%3F%3A%5C-%2B%7C%3D%2B%7C(%3F%3A%5C-%5C-%3D%3D)%2B)%24)
|
||||
*/
|
||||
if (exceptions.length === 0) {
|
||||
// a space.
|
||||
pattern += "\\s";
|
||||
} else {
|
||||
// a space or...
|
||||
pattern += "(?:\\s|";
|
||||
|
||||
if (exceptions.length === 1) {
|
||||
// a sequence of the exception pattern.
|
||||
pattern += escapeAndRepeat(exceptions[0]);
|
||||
} else {
|
||||
// a sequence of one of the exception patterns.
|
||||
pattern += "(?:";
|
||||
pattern += exceptions.map(escapeAndRepeat).join("|");
|
||||
pattern += ")";
|
||||
}
|
||||
pattern += `(?:$|[${Array.from(astUtils.LINEBREAKS).join("")}]))`;
|
||||
}
|
||||
|
||||
return pattern;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates RegExp object for `always` mode.
|
||||
* Generated pattern for beginning of comment:
|
||||
*
|
||||
* 1. First, a marker or nothing.
|
||||
* 2. Next, a space or an exception pattern sequence.
|
||||
* @param {string[]} markers A marker list.
|
||||
* @param {string[]} exceptions An exception pattern list.
|
||||
* @returns {RegExp} A RegExp object for the beginning of a comment in `always` mode.
|
||||
*/
|
||||
function createAlwaysStylePattern(markers, exceptions) {
|
||||
let pattern = "^";
|
||||
|
||||
/*
|
||||
* A marker or nothing.
|
||||
* ["*"] ==> "\*?"
|
||||
* ["*", "!"] ==> "(?:\*|!)?"
|
||||
* ["*", "/", "!<"] ==> "(?:\*|\/|(?:!<))?" ==> https://jex.im/regulex/#!embed=false&flags=&re=(%3F%3A%5C*%7C%5C%2F%7C(%3F%3A!%3C))%3F
|
||||
*/
|
||||
if (markers.length === 1) {
|
||||
// the marker.
|
||||
pattern += escape(markers[0]);
|
||||
} else {
|
||||
// one of markers.
|
||||
pattern += "(?:";
|
||||
pattern += markers.map(escape).join("|");
|
||||
pattern += ")";
|
||||
}
|
||||
|
||||
pattern += "?"; // or nothing.
|
||||
pattern += createExceptionsPattern(exceptions);
|
||||
|
||||
return new RegExp(pattern, "u");
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates RegExp object for `never` mode.
|
||||
* Generated pattern for beginning of comment:
|
||||
*
|
||||
* 1. First, a marker or nothing (captured).
|
||||
* 2. Next, a space or a tab.
|
||||
* @param {string[]} markers A marker list.
|
||||
* @returns {RegExp} A RegExp object for `never` mode.
|
||||
*/
|
||||
function createNeverStylePattern(markers) {
|
||||
const pattern = `^(${markers.map(escape).join("|")})?[ \t]+`;
|
||||
|
||||
return new RegExp(pattern, "u");
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Rule Definition
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
/** @type {import('../shared/types').Rule} */
|
||||
module.exports = {
|
||||
meta: {
|
||||
deprecated: {
|
||||
message: "Formatting rules are being moved out of ESLint core.",
|
||||
url: "https://eslint.org/blog/2023/10/deprecating-formatting-rules/",
|
||||
deprecatedSince: "8.53.0",
|
||||
availableUntil: "10.0.0",
|
||||
replacedBy: [
|
||||
{
|
||||
message:
|
||||
"ESLint Stylistic now maintains deprecated stylistic core rules.",
|
||||
url: "https://eslint.style/guide/migration",
|
||||
plugin: {
|
||||
name: "@stylistic/eslint-plugin-js",
|
||||
url: "https://eslint.style/packages/js",
|
||||
},
|
||||
rule: {
|
||||
name: "spaced-comment",
|
||||
url: "https://eslint.style/rules/js/spaced-comment",
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
type: "suggestion",
|
||||
|
||||
docs: {
|
||||
description:
|
||||
"Enforce consistent spacing after the `//` or `/*` in a comment",
|
||||
recommended: false,
|
||||
url: "https://eslint.org/docs/latest/rules/spaced-comment",
|
||||
},
|
||||
|
||||
fixable: "whitespace",
|
||||
|
||||
schema: [
|
||||
{
|
||||
enum: ["always", "never"],
|
||||
},
|
||||
{
|
||||
type: "object",
|
||||
properties: {
|
||||
exceptions: {
|
||||
type: "array",
|
||||
items: {
|
||||
type: "string",
|
||||
},
|
||||
},
|
||||
markers: {
|
||||
type: "array",
|
||||
items: {
|
||||
type: "string",
|
||||
},
|
||||
},
|
||||
line: {
|
||||
type: "object",
|
||||
properties: {
|
||||
exceptions: {
|
||||
type: "array",
|
||||
items: {
|
||||
type: "string",
|
||||
},
|
||||
},
|
||||
markers: {
|
||||
type: "array",
|
||||
items: {
|
||||
type: "string",
|
||||
},
|
||||
},
|
||||
},
|
||||
additionalProperties: false,
|
||||
},
|
||||
block: {
|
||||
type: "object",
|
||||
properties: {
|
||||
exceptions: {
|
||||
type: "array",
|
||||
items: {
|
||||
type: "string",
|
||||
},
|
||||
},
|
||||
markers: {
|
||||
type: "array",
|
||||
items: {
|
||||
type: "string",
|
||||
},
|
||||
},
|
||||
balanced: {
|
||||
type: "boolean",
|
||||
default: false,
|
||||
},
|
||||
},
|
||||
additionalProperties: false,
|
||||
},
|
||||
},
|
||||
additionalProperties: false,
|
||||
},
|
||||
],
|
||||
|
||||
messages: {
|
||||
unexpectedSpaceAfterMarker:
|
||||
"Unexpected space or tab after marker ({{refChar}}) in comment.",
|
||||
expectedExceptionAfter:
|
||||
"Expected exception block, space or tab after '{{refChar}}' in comment.",
|
||||
unexpectedSpaceBefore:
|
||||
"Unexpected space or tab before '*/' in comment.",
|
||||
unexpectedSpaceAfter:
|
||||
"Unexpected space or tab after '{{refChar}}' in comment.",
|
||||
expectedSpaceBefore:
|
||||
"Expected space or tab before '*/' in comment.",
|
||||
expectedSpaceAfter:
|
||||
"Expected space or tab after '{{refChar}}' in comment.",
|
||||
},
|
||||
},
|
||||
|
||||
create(context) {
|
||||
const sourceCode = context.sourceCode;
|
||||
|
||||
// Unless the first option is never, require a space
|
||||
const requireSpace = context.options[0] !== "never";
|
||||
|
||||
/*
|
||||
* Parse the second options.
|
||||
* If markers don't include `"*"`, it's added automatically for JSDoc
|
||||
* comments.
|
||||
*/
|
||||
const config = context.options[1] || {};
|
||||
const balanced = config.block && config.block.balanced;
|
||||
|
||||
const styleRules = ["block", "line"].reduce((rule, type) => {
|
||||
const markers = parseMarkersOption(
|
||||
(config[type] && config[type].markers) || config.markers || [],
|
||||
);
|
||||
const exceptions =
|
||||
(config[type] && config[type].exceptions) ||
|
||||
config.exceptions ||
|
||||
[];
|
||||
const endNeverPattern = "[ \t]+$";
|
||||
|
||||
// Create RegExp object for valid patterns.
|
||||
rule[type] = {
|
||||
beginRegex: requireSpace
|
||||
? createAlwaysStylePattern(markers, exceptions)
|
||||
: createNeverStylePattern(markers),
|
||||
endRegex:
|
||||
balanced && requireSpace
|
||||
? new RegExp(
|
||||
`${createExceptionsPattern(exceptions)}$`,
|
||||
"u",
|
||||
)
|
||||
: new RegExp(endNeverPattern, "u"),
|
||||
hasExceptions: exceptions.length > 0,
|
||||
captureMarker: new RegExp(
|
||||
`^(${markers.map(escape).join("|")})`,
|
||||
"u",
|
||||
),
|
||||
markers: new Set(markers),
|
||||
};
|
||||
|
||||
return rule;
|
||||
}, {});
|
||||
|
||||
/**
|
||||
* Reports a beginning spacing error with an appropriate message.
|
||||
* @param {ASTNode} node A comment node to check.
|
||||
* @param {string} messageId An error message to report.
|
||||
* @param {Array} match An array of match results for markers.
|
||||
* @param {string} refChar Character used for reference in the error message.
|
||||
* @returns {void}
|
||||
*/
|
||||
function reportBegin(node, messageId, match, refChar) {
|
||||
const type = node.type.toLowerCase(),
|
||||
commentIdentifier = type === "block" ? "/*" : "//";
|
||||
|
||||
context.report({
|
||||
node,
|
||||
fix(fixer) {
|
||||
const start = node.range[0];
|
||||
let end = start + 2;
|
||||
|
||||
if (requireSpace) {
|
||||
if (match) {
|
||||
end += match[0].length;
|
||||
}
|
||||
return fixer.insertTextAfterRange([start, end], " ");
|
||||
}
|
||||
end += match[0].length;
|
||||
return fixer.replaceTextRange(
|
||||
[start, end],
|
||||
commentIdentifier + (match[1] ? match[1] : ""),
|
||||
);
|
||||
},
|
||||
messageId,
|
||||
data: { refChar },
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reports an ending spacing error with an appropriate message.
|
||||
* @param {ASTNode} node A comment node to check.
|
||||
* @param {string} messageId An error message to report.
|
||||
* @param {string} match An array of the matched whitespace characters.
|
||||
* @returns {void}
|
||||
*/
|
||||
function reportEnd(node, messageId, match) {
|
||||
context.report({
|
||||
node,
|
||||
fix(fixer) {
|
||||
if (requireSpace) {
|
||||
return fixer.insertTextAfterRange(
|
||||
[node.range[0], node.range[1] - 2],
|
||||
" ",
|
||||
);
|
||||
}
|
||||
const end = node.range[1] - 2,
|
||||
start = end - match[0].length;
|
||||
|
||||
return fixer.replaceTextRange([start, end], "");
|
||||
},
|
||||
messageId,
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reports a given comment if it's invalid.
|
||||
* @param {ASTNode} node a comment node to check.
|
||||
* @returns {void}
|
||||
*/
|
||||
function checkCommentForSpace(node) {
|
||||
const type = node.type.toLowerCase(),
|
||||
rule = styleRules[type],
|
||||
commentIdentifier = type === "block" ? "/*" : "//";
|
||||
|
||||
// Ignores empty comments and comments that consist only of a marker.
|
||||
if (node.value.length === 0 || rule.markers.has(node.value)) {
|
||||
return;
|
||||
}
|
||||
|
||||
const beginMatch = rule.beginRegex.exec(node.value);
|
||||
const endMatch = rule.endRegex.exec(node.value);
|
||||
|
||||
// Checks.
|
||||
if (requireSpace) {
|
||||
if (!beginMatch) {
|
||||
const hasMarker = rule.captureMarker.exec(node.value);
|
||||
const marker = hasMarker
|
||||
? commentIdentifier + hasMarker[0]
|
||||
: commentIdentifier;
|
||||
|
||||
if (rule.hasExceptions) {
|
||||
reportBegin(
|
||||
node,
|
||||
"expectedExceptionAfter",
|
||||
hasMarker,
|
||||
marker,
|
||||
);
|
||||
} else {
|
||||
reportBegin(
|
||||
node,
|
||||
"expectedSpaceAfter",
|
||||
hasMarker,
|
||||
marker,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
if (balanced && type === "block" && !endMatch) {
|
||||
reportEnd(node, "expectedSpaceBefore");
|
||||
}
|
||||
} else {
|
||||
if (beginMatch) {
|
||||
if (!beginMatch[1]) {
|
||||
reportBegin(
|
||||
node,
|
||||
"unexpectedSpaceAfter",
|
||||
beginMatch,
|
||||
commentIdentifier,
|
||||
);
|
||||
} else {
|
||||
reportBegin(
|
||||
node,
|
||||
"unexpectedSpaceAfterMarker",
|
||||
beginMatch,
|
||||
beginMatch[1],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
if (balanced && type === "block" && endMatch) {
|
||||
reportEnd(node, "unexpectedSpaceBefore", endMatch);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
Program() {
|
||||
const comments = sourceCode.getAllComments();
|
||||
|
||||
comments
|
||||
.filter(token => token.type !== "Shebang")
|
||||
.forEach(checkCommentForSpace);
|
||||
},
|
||||
};
|
||||
},
|
||||
};
|
||||
@@ -0,0 +1,15 @@
|
||||
var isProduction = process.env.NODE_ENV === 'production';
|
||||
var prefix = 'Invariant failed';
|
||||
function invariant(condition, message) {
|
||||
if (condition) {
|
||||
return;
|
||||
}
|
||||
if (isProduction) {
|
||||
throw new Error(prefix);
|
||||
}
|
||||
var provided = typeof message === 'function' ? message() : message;
|
||||
var value = provided ? "".concat(prefix, ": ").concat(provided) : prefix;
|
||||
throw new Error(value);
|
||||
}
|
||||
|
||||
export { invariant as default };
|
||||
@@ -0,0 +1 @@
|
||||
module.exports={A:{A:{"2":"K D E F A B mC"},B:{"1":"0 9 V W X Y Z a b c d e f g h i j k l m n o p q r s t u v w x y z AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB I","2":"C L M G N O P Q H R S T U"},C:{"1":"0 9 3B 4B 5B 6B 7B 8B 9B AC BC CC DC Q H R OC S T U V W X Y Z a b c d e f g h i j k l m n o p q r s t u v w x y z AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB I PC EC QC RC oC pC","2":"1 2 3 4 5 6 7 8 nC LC J PB K D E F A B C L M G N O P QB RB SB TB UB VB WB XB YB ZB aB bB cB dB eB fB gB hB iB jB kB lB mB nB oB pB qB rB sB tB uB vB MC wB NC xB yB zB 0B 1B 2B qC rC"},D:{"1":"0 9 V W X Y Z a b c d e f g h i j k l m n o p q r s t u v w x y z AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB I PC EC QC RC","2":"1 2 3 4 5 6 7 8 J PB K D E F A B C L M G N O P QB RB SB TB UB VB WB XB YB ZB aB bB cB dB eB fB gB hB iB jB kB lB mB nB oB pB qB rB sB tB uB vB MC wB NC xB yB zB 0B 1B 2B 3B 4B 5B 6B 7B 8B 9B AC BC CC DC Q H R S T U"},E:{"1":"3C","2":"J PB K D E F A B sC SC tC uC vC wC TC","132":"C L M G FC GC xC yC zC UC VC HC 0C IC WC XC YC ZC aC 1C JC bC cC dC eC fC 2C KC gC hC iC jC"},F:{"1":"0 7B 8B 9B AC BC CC DC Q H R OC S T U V W X Y Z a b c d e f g h i j k l m n o p q r s t u v w x y z","2":"1 2 3 4 5 6 7 8 F B C G N O P QB RB SB TB UB VB WB XB YB ZB aB bB cB dB eB fB gB hB iB jB kB lB mB nB oB pB qB rB sB tB uB vB wB xB yB zB 0B 1B 2B 3B 4B 5B 6B 4C 5C 6C 7C FC kC 8C GC"},G:{"2":"E SC 9C lC AD BD CD DD ED FD GD HD ID","132":"JD KD LD MD ND OD PD QD RD SD UC VC HC TD IC WC XC YC ZC aC UD JC bC cC dC eC fC VD KC gC hC iC jC"},H:{"2":"WD"},I:{"1":"I","2":"LC J XD YD ZD aD lC bD cD"},J:{"2":"D A"},K:{"1":"H","2":"A B C FC kC GC"},L:{"1":"I"},M:{"1":"EC"},N:{"2":"A B"},O:{"1":"HC"},P:{"1":"1 2 3 4 5 6 7 8 lD mD IC JC KC nD","2":"J dD eD fD gD hD TC iD jD kD"},Q:{"2":"oD"},R:{"1":"pD"},S:{"1":"rD","2":"qD"}},B:5,C:"CSS ::marker pseudo-element",D:true};
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"http.js","sourceRoot":"","sources":["../../../src/schemes/http.ts"],"names":[],"mappings":"AAEA,MAAM,OAAO,GAAoB;IAChC,MAAM,EAAG,MAAM;IAEf,UAAU,EAAG,IAAI;IAEjB,KAAK,EAAG,UAAU,UAAwB,EAAE,OAAkB;QAC7D,qBAAqB;QACrB,IAAI,CAAC,UAAU,CAAC,IAAI,EAAE;YACrB,UAAU,CAAC,KAAK,GAAG,UAAU,CAAC,KAAK,IAAI,6BAA6B,CAAC;SACrE;QAED,OAAO,UAAU,CAAC;IACnB,CAAC;IAED,SAAS,EAAG,UAAU,UAAwB,EAAE,OAAkB;QACjE,MAAM,MAAM,GAAG,MAAM,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,WAAW,EAAE,KAAK,OAAO,CAAC;QAEnE,4BAA4B;QAC5B,IAAI,UAAU,CAAC,IAAI,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,IAAI,UAAU,CAAC,IAAI,KAAK,EAAE,EAAE;YACtE,UAAU,CAAC,IAAI,GAAG,SAAS,CAAC;SAC5B;QAED,0BAA0B;QAC1B,IAAI,CAAC,UAAU,CAAC,IAAI,EAAE;YACrB,UAAU,CAAC,IAAI,GAAG,GAAG,CAAC;SACtB;QAED,mDAAmD;QACnD,oEAAoE;QACpE,wBAAwB;QAExB,OAAO,UAAU,CAAC;IACnB,CAAC;CACD,CAAC;AAEF,eAAe,OAAO,CAAC"}
|
||||
@@ -0,0 +1,24 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = _objectSpread;
|
||||
var _defineProperty = require("./defineProperty.js");
|
||||
function _objectSpread(target) {
|
||||
for (var i = 1; i < arguments.length; i++) {
|
||||
var source = arguments[i] != null ? Object(arguments[i]) : {};
|
||||
var ownKeys = Object.keys(source);
|
||||
if (typeof Object.getOwnPropertySymbols === "function") {
|
||||
ownKeys.push.apply(ownKeys, Object.getOwnPropertySymbols(source).filter(function (sym) {
|
||||
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
||||
}));
|
||||
}
|
||||
ownKeys.forEach(function (key) {
|
||||
(0, _defineProperty.default)(target, key, source[key]);
|
||||
});
|
||||
}
|
||||
return target;
|
||||
}
|
||||
|
||||
//# sourceMappingURL=objectSpread.js.map
|
||||
@@ -0,0 +1,102 @@
|
||||
Digitized data copyright (c) 2010 Google Corporation
|
||||
with Reserved Font Arimo, Tinos and Cousine.
|
||||
Copyright (c) 2012 Red Hat, Inc.
|
||||
with Reserved Font Name Liberation.
|
||||
|
||||
This Font Software is licensed under the SIL Open Font License,
|
||||
Version 1.1.
|
||||
|
||||
This license is copied below, and is also available with a FAQ at:
|
||||
http://scripts.sil.org/OFL
|
||||
|
||||
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
|
||||
|
||||
PREAMBLE The goals of the Open Font License (OFL) are to stimulate
|
||||
worldwide development of collaborative font projects, to support the font
|
||||
creation efforts of academic and linguistic communities, and to provide
|
||||
a free and open framework in which fonts may be shared and improved in
|
||||
partnership with others.
|
||||
|
||||
The OFL allows the licensed fonts to be used, studied, modified and
|
||||
redistributed freely as long as they are not sold by themselves.
|
||||
The fonts, including any derivative works, can be bundled, embedded,
|
||||
redistributed and/or sold with any software provided that any reserved
|
||||
names are not used by derivative works. The fonts and derivatives,
|
||||
however, cannot be released under any other type of license. The
|
||||
requirement for fonts to remain under this license does not apply to
|
||||
any document created using the fonts or their derivatives.
|
||||
|
||||
|
||||
|
||||
DEFINITIONS
|
||||
"Font Software" refers to the set of files released by the Copyright
|
||||
Holder(s) under this license and clearly marked as such.
|
||||
This may include source files, build scripts and documentation.
|
||||
|
||||
"Reserved Font Name" refers to any names specified as such after the
|
||||
copyright statement(s).
|
||||
|
||||
"Original Version" refers to the collection of Font Software components
|
||||
as distributed by the Copyright Holder(s).
|
||||
|
||||
"Modified Version" refers to any derivative made by adding to, deleting,
|
||||
or substituting ? in part or in whole ?
|
||||
any of the components of the Original Version, by changing formats or
|
||||
by porting the Font Software to a new environment.
|
||||
|
||||
"Author" refers to any designer, engineer, programmer, technical writer
|
||||
or other person who contributed to the Font Software.
|
||||
|
||||
|
||||
PERMISSION & CONDITIONS
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a
|
||||
copy of the Font Software, to use, study, copy, merge, embed, modify,
|
||||
redistribute, and sell modified and unmodified copies of the Font
|
||||
Software, subject to the following conditions:
|
||||
|
||||
1) Neither the Font Software nor any of its individual components,in
|
||||
Original or Modified Versions, may be sold by itself.
|
||||
|
||||
2) Original or Modified Versions of the Font Software may be bundled,
|
||||
redistributed and/or sold with any software, provided that each copy
|
||||
contains the above copyright notice and this license. These can be
|
||||
included either as stand-alone text files, human-readable headers or
|
||||
in the appropriate machine-readable metadata fields within text or
|
||||
binary files as long as those fields can be easily viewed by the user.
|
||||
|
||||
3) No Modified Version of the Font Software may use the Reserved Font
|
||||
Name(s) unless explicit written permission is granted by the
|
||||
corresponding Copyright Holder. This restriction only applies to the
|
||||
primary font name as presented to the users.
|
||||
|
||||
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
|
||||
Software shall not be used to promote, endorse or advertise any
|
||||
Modified Version, except to acknowledge the contribution(s) of the
|
||||
Copyright Holder(s) and the Author(s) or with their explicit written
|
||||
permission.
|
||||
|
||||
5) The Font Software, modified or unmodified, in part or in whole, must
|
||||
be distributed entirely under this license, and must not be distributed
|
||||
under any other license. The requirement for fonts to remain under
|
||||
this license does not apply to any document created using the Font
|
||||
Software.
|
||||
|
||||
|
||||
|
||||
TERMINATION
|
||||
This license becomes null and void if any of the above conditions are not met.
|
||||
|
||||
|
||||
|
||||
DISCLAIMER
|
||||
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
|
||||
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
|
||||
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
|
||||
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM OTHER
|
||||
DEALINGS IN THE FONT SOFTWARE.
|
||||
|
||||
@@ -0,0 +1,107 @@
|
||||
import { Derived } from "./derived.js";
|
||||
const __storeToDerived = /* @__PURE__ */ new WeakMap();
|
||||
const __derivedToStore = /* @__PURE__ */ new WeakMap();
|
||||
const __depsThatHaveWrittenThisTick = {
|
||||
current: []
|
||||
};
|
||||
let __isFlushing = false;
|
||||
let __batchDepth = 0;
|
||||
const __pendingUpdates = /* @__PURE__ */ new Set();
|
||||
const __initialBatchValues = /* @__PURE__ */ new Map();
|
||||
function __flush_internals(relatedVals) {
|
||||
const sorted = Array.from(relatedVals).sort((a, b) => {
|
||||
if (a instanceof Derived && a.options.deps.includes(b)) return 1;
|
||||
if (b instanceof Derived && b.options.deps.includes(a)) return -1;
|
||||
return 0;
|
||||
});
|
||||
for (const derived of sorted) {
|
||||
if (__depsThatHaveWrittenThisTick.current.includes(derived)) {
|
||||
continue;
|
||||
}
|
||||
__depsThatHaveWrittenThisTick.current.push(derived);
|
||||
derived.recompute();
|
||||
const stores = __derivedToStore.get(derived);
|
||||
if (stores) {
|
||||
for (const store of stores) {
|
||||
const relatedLinkedDerivedVals = __storeToDerived.get(store);
|
||||
if (!relatedLinkedDerivedVals) continue;
|
||||
__flush_internals(relatedLinkedDerivedVals);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
function __notifyListeners(store) {
|
||||
store.listeners.forEach(
|
||||
(listener) => listener({
|
||||
prevVal: store.prevState,
|
||||
currentVal: store.state
|
||||
})
|
||||
);
|
||||
}
|
||||
function __notifyDerivedListeners(derived) {
|
||||
derived.listeners.forEach(
|
||||
(listener) => listener({
|
||||
prevVal: derived.prevState,
|
||||
currentVal: derived.state
|
||||
})
|
||||
);
|
||||
}
|
||||
function __flush(store) {
|
||||
if (__batchDepth > 0 && !__initialBatchValues.has(store)) {
|
||||
__initialBatchValues.set(store, store.prevState);
|
||||
}
|
||||
__pendingUpdates.add(store);
|
||||
if (__batchDepth > 0) return;
|
||||
if (__isFlushing) return;
|
||||
try {
|
||||
__isFlushing = true;
|
||||
while (__pendingUpdates.size > 0) {
|
||||
const stores = Array.from(__pendingUpdates);
|
||||
__pendingUpdates.clear();
|
||||
for (const store2 of stores) {
|
||||
const prevState = __initialBatchValues.get(store2) ?? store2.prevState;
|
||||
store2.prevState = prevState;
|
||||
__notifyListeners(store2);
|
||||
}
|
||||
for (const store2 of stores) {
|
||||
const derivedVals = __storeToDerived.get(store2);
|
||||
if (!derivedVals) continue;
|
||||
__depsThatHaveWrittenThisTick.current.push(store2);
|
||||
__flush_internals(derivedVals);
|
||||
}
|
||||
for (const store2 of stores) {
|
||||
const derivedVals = __storeToDerived.get(store2);
|
||||
if (!derivedVals) continue;
|
||||
for (const derived of derivedVals) {
|
||||
__notifyDerivedListeners(derived);
|
||||
}
|
||||
}
|
||||
}
|
||||
} finally {
|
||||
__isFlushing = false;
|
||||
__depsThatHaveWrittenThisTick.current = [];
|
||||
__initialBatchValues.clear();
|
||||
}
|
||||
}
|
||||
function batch(fn) {
|
||||
__batchDepth++;
|
||||
try {
|
||||
fn();
|
||||
} finally {
|
||||
__batchDepth--;
|
||||
if (__batchDepth === 0) {
|
||||
const pendingUpdateToFlush = Array.from(__pendingUpdates)[0];
|
||||
if (pendingUpdateToFlush) {
|
||||
__flush(pendingUpdateToFlush);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
export {
|
||||
__depsThatHaveWrittenThisTick,
|
||||
__derivedToStore,
|
||||
__flush,
|
||||
__storeToDerived,
|
||||
batch
|
||||
};
|
||||
//# sourceMappingURL=scheduler.js.map
|
||||
@@ -0,0 +1 @@
|
||||
export declare const Scripts: () => import("react/jsx-runtime").JSX.Element;
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"names":["_index","require","_index2","cleanJSXElementLiteralChild","child","args","lines","value","split","lastNonEmptyLine","i","length","exec","str","line","isFirstLine","isLastLine","isLastNonEmptyLine","trimmedLine","replace","push","inherits","stringLiteral"],"sources":["../../../src/utils/react/cleanJSXElementLiteralChild.ts"],"sourcesContent":["import { stringLiteral } from \"../../builders/generated/index.ts\";\nimport type * as t from \"../../index.ts\";\nimport { inherits } from \"../../index.ts\";\n\nexport default function cleanJSXElementLiteralChild(\n child: t.JSXText,\n args: Array<t.Node>,\n) {\n const lines = child.value.split(/\\r\\n|\\n|\\r/);\n\n let lastNonEmptyLine = 0;\n\n for (let i = 0; i < lines.length; i++) {\n if (/[^ \\t]/.exec(lines[i])) {\n lastNonEmptyLine = i;\n }\n }\n\n let str = \"\";\n\n for (let i = 0; i < lines.length; i++) {\n const line = lines[i];\n\n const isFirstLine = i === 0;\n const isLastLine = i === lines.length - 1;\n const isLastNonEmptyLine = i === lastNonEmptyLine;\n\n // replace rendered whitespace tabs with spaces\n let trimmedLine = line.replace(/\\t/g, \" \");\n\n // trim whitespace touching a newline\n if (!isFirstLine) {\n trimmedLine = trimmedLine.replace(/^ +/, \"\");\n }\n\n // trim whitespace touching an endline\n if (!isLastLine) {\n trimmedLine = trimmedLine.replace(/ +$/, \"\");\n }\n\n if (trimmedLine) {\n if (!isLastNonEmptyLine) {\n trimmedLine += \" \";\n }\n\n str += trimmedLine;\n }\n }\n\n if (str) args.push(inherits(stringLiteral(str), child));\n}\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAEA,IAAAC,OAAA,GAAAD,OAAA;AAEe,SAASE,2BAA2BA,CACjDC,KAAgB,EAChBC,IAAmB,EACnB;EACA,MAAMC,KAAK,GAAGF,KAAK,CAACG,KAAK,CAACC,KAAK,CAAC,YAAY,CAAC;EAE7C,IAAIC,gBAAgB,GAAG,CAAC;EAExB,KAAK,IAAIC,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGJ,KAAK,CAACK,MAAM,EAAED,CAAC,EAAE,EAAE;IACrC,IAAI,QAAQ,CAACE,IAAI,CAACN,KAAK,CAACI,CAAC,CAAC,CAAC,EAAE;MAC3BD,gBAAgB,GAAGC,CAAC;IACtB;EACF;EAEA,IAAIG,GAAG,GAAG,EAAE;EAEZ,KAAK,IAAIH,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGJ,KAAK,CAACK,MAAM,EAAED,CAAC,EAAE,EAAE;IACrC,MAAMI,IAAI,GAAGR,KAAK,CAACI,CAAC,CAAC;IAErB,MAAMK,WAAW,GAAGL,CAAC,KAAK,CAAC;IAC3B,MAAMM,UAAU,GAAGN,CAAC,KAAKJ,KAAK,CAACK,MAAM,GAAG,CAAC;IACzC,MAAMM,kBAAkB,GAAGP,CAAC,KAAKD,gBAAgB;IAGjD,IAAIS,WAAW,GAAGJ,IAAI,CAACK,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC;IAG1C,IAAI,CAACJ,WAAW,EAAE;MAChBG,WAAW,GAAGA,WAAW,CAACC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC;IAC9C;IAGA,IAAI,CAACH,UAAU,EAAE;MACfE,WAAW,GAAGA,WAAW,CAACC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC;IAC9C;IAEA,IAAID,WAAW,EAAE;MACf,IAAI,CAACD,kBAAkB,EAAE;QACvBC,WAAW,IAAI,GAAG;MACpB;MAEAL,GAAG,IAAIK,WAAW;IACpB;EACF;EAEA,IAAIL,GAAG,EAAER,IAAI,CAACe,IAAI,CAAC,IAAAC,gBAAQ,EAAC,IAAAC,oBAAa,EAACT,GAAG,CAAC,EAAET,KAAK,CAAC,CAAC;AACzD","ignoreList":[]}
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,114 @@
|
||||
/**
|
||||
* Parse options.
|
||||
*/
|
||||
export interface ParseOptions {
|
||||
/**
|
||||
* Specifies a function that will be used to decode a [cookie-value](https://datatracker.ietf.org/doc/html/rfc6265#section-4.1.1).
|
||||
* Since the value of a cookie has a limited character set (and must be a simple string), this function can be used to decode
|
||||
* a previously-encoded cookie value into a JavaScript string.
|
||||
*
|
||||
* The default function is the global `decodeURIComponent`, wrapped in a `try..catch`. If an error
|
||||
* is thrown it will return the cookie's original value. If you provide your own encode/decode
|
||||
* scheme you must ensure errors are appropriately handled.
|
||||
*
|
||||
* @default decode
|
||||
*/
|
||||
decode?: (str: string) => string | undefined;
|
||||
}
|
||||
/**
|
||||
* Parse a cookie header.
|
||||
*
|
||||
* Parse the given cookie header string into an object
|
||||
* The object has the various cookies as keys(names) => values
|
||||
*/
|
||||
export declare function parse(str: string, options?: ParseOptions): Record<string, string | undefined>;
|
||||
/**
|
||||
* Serialize options.
|
||||
*/
|
||||
export interface SerializeOptions {
|
||||
/**
|
||||
* Specifies a function that will be used to encode a [cookie-value](https://datatracker.ietf.org/doc/html/rfc6265#section-4.1.1).
|
||||
* Since value of a cookie has a limited character set (and must be a simple string), this function can be used to encode
|
||||
* a value into a string suited for a cookie's value, and should mirror `decode` when parsing.
|
||||
*
|
||||
* @default encodeURIComponent
|
||||
*/
|
||||
encode?: (str: string) => string;
|
||||
/**
|
||||
* Specifies the `number` (in seconds) to be the value for the [`Max-Age` `Set-Cookie` attribute](https://tools.ietf.org/html/rfc6265#section-5.2.2).
|
||||
*
|
||||
* The [cookie storage model specification](https://tools.ietf.org/html/rfc6265#section-5.3) states that if both `expires` and
|
||||
* `maxAge` are set, then `maxAge` takes precedence, but it is possible not all clients by obey this,
|
||||
* so if both are set, they should point to the same date and time.
|
||||
*/
|
||||
maxAge?: number;
|
||||
/**
|
||||
* Specifies the `Date` object to be the value for the [`Expires` `Set-Cookie` attribute](https://tools.ietf.org/html/rfc6265#section-5.2.1).
|
||||
* When no expiration is set clients consider this a "non-persistent cookie" and delete it the current session is over.
|
||||
*
|
||||
* The [cookie storage model specification](https://tools.ietf.org/html/rfc6265#section-5.3) states that if both `expires` and
|
||||
* `maxAge` are set, then `maxAge` takes precedence, but it is possible not all clients by obey this,
|
||||
* so if both are set, they should point to the same date and time.
|
||||
*/
|
||||
expires?: Date;
|
||||
/**
|
||||
* Specifies the value for the [`Domain` `Set-Cookie` attribute](https://tools.ietf.org/html/rfc6265#section-5.2.3).
|
||||
* When no domain is set clients consider the cookie to apply to the current domain only.
|
||||
*/
|
||||
domain?: string;
|
||||
/**
|
||||
* Specifies the value for the [`Path` `Set-Cookie` attribute](https://tools.ietf.org/html/rfc6265#section-5.2.4).
|
||||
* When no path is set, the path is considered the ["default path"](https://tools.ietf.org/html/rfc6265#section-5.1.4).
|
||||
*/
|
||||
path?: string;
|
||||
/**
|
||||
* Enables the [`HttpOnly` `Set-Cookie` attribute](https://tools.ietf.org/html/rfc6265#section-5.2.6).
|
||||
* When enabled, clients will not allow client-side JavaScript to see the cookie in `document.cookie`.
|
||||
*/
|
||||
httpOnly?: boolean;
|
||||
/**
|
||||
* Enables the [`Secure` `Set-Cookie` attribute](https://tools.ietf.org/html/rfc6265#section-5.2.5).
|
||||
* When enabled, clients will only send the cookie back if the browser has a HTTPS connection.
|
||||
*/
|
||||
secure?: boolean;
|
||||
/**
|
||||
* Enables the [`Partitioned` `Set-Cookie` attribute](https://tools.ietf.org/html/draft-cutler-httpbis-partitioned-cookies/).
|
||||
* When enabled, clients will only send the cookie back when the current domain _and_ top-level domain matches.
|
||||
*
|
||||
* This is an attribute that has not yet been fully standardized, and may change in the future.
|
||||
* This also means clients may ignore this attribute until they understand it. More information
|
||||
* about can be found in [the proposal](https://github.com/privacycg/CHIPS).
|
||||
*/
|
||||
partitioned?: boolean;
|
||||
/**
|
||||
* Specifies the value for the [`Priority` `Set-Cookie` attribute](https://tools.ietf.org/html/draft-west-cookie-priority-00#section-4.1).
|
||||
*
|
||||
* - `'low'` will set the `Priority` attribute to `Low`.
|
||||
* - `'medium'` will set the `Priority` attribute to `Medium`, the default priority when not set.
|
||||
* - `'high'` will set the `Priority` attribute to `High`.
|
||||
*
|
||||
* More information about priority levels can be found in [the specification](https://tools.ietf.org/html/draft-west-cookie-priority-00#section-4.1).
|
||||
*/
|
||||
priority?: "low" | "medium" | "high";
|
||||
/**
|
||||
* Specifies the value for the [`SameSite` `Set-Cookie` attribute](https://tools.ietf.org/html/draft-ietf-httpbis-rfc6265bis-09#section-5.4.7).
|
||||
*
|
||||
* - `true` will set the `SameSite` attribute to `Strict` for strict same site enforcement.
|
||||
* - `'lax'` will set the `SameSite` attribute to `Lax` for lax same site enforcement.
|
||||
* - `'none'` will set the `SameSite` attribute to `None` for an explicit cross-site cookie.
|
||||
* - `'strict'` will set the `SameSite` attribute to `Strict` for strict same site enforcement.
|
||||
*
|
||||
* More information about enforcement levels can be found in [the specification](https://tools.ietf.org/html/draft-ietf-httpbis-rfc6265bis-09#section-5.4.7).
|
||||
*/
|
||||
sameSite?: boolean | "lax" | "strict" | "none";
|
||||
}
|
||||
/**
|
||||
* Serialize data into a cookie header.
|
||||
*
|
||||
* Serialize a name value pair into a cookie string suitable for
|
||||
* http headers. An optional options object specifies cookie parameters.
|
||||
*
|
||||
* serialize('foo', 'bar', { httpOnly: true })
|
||||
* => "foo=bar; httpOnly"
|
||||
*/
|
||||
export declare function serialize(name: string, val: string, options?: SerializeOptions): string;
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,69 @@
|
||||
let random = async bytes => crypto.getRandomValues(new Uint8Array(bytes))
|
||||
|
||||
let customAlphabet = (alphabet, defaultSize = 21) => {
|
||||
// First, a bitmask is necessary to generate the ID. The bitmask makes bytes
|
||||
// values closer to the alphabet size. The bitmask calculates the closest
|
||||
// `2^31 - 1` number, which exceeds the alphabet size.
|
||||
// For example, the bitmask for the alphabet size 30 is 31 (00011111).
|
||||
// `Math.clz32` is not used, because it is not available in browsers.
|
||||
let mask = (2 << (Math.log(alphabet.length - 1) / Math.LN2)) - 1
|
||||
// Though, the bitmask solution is not perfect since the bytes exceeding
|
||||
// the alphabet size are refused. Therefore, to reliably generate the ID,
|
||||
// the random bytes redundancy has to be satisfied.
|
||||
|
||||
// Note: every hardware random generator call is performance expensive,
|
||||
// because the system call for entropy collection takes a lot of time.
|
||||
// So, to avoid additional system calls, extra bytes are requested in advance.
|
||||
|
||||
// Next, a step determines how many random bytes to generate.
|
||||
// The number of random bytes gets decided upon the ID size, mask,
|
||||
// alphabet size, and magic number 1.6 (using 1.6 peaks at performance
|
||||
// according to benchmarks).
|
||||
|
||||
// `-~f => Math.ceil(f)` if f is a float
|
||||
// `-~i => i + 1` if i is an integer
|
||||
let step = -~((1.6 * mask * defaultSize) / alphabet.length)
|
||||
|
||||
return async (size = defaultSize) => {
|
||||
let id = ''
|
||||
while (true) {
|
||||
let bytes = crypto.getRandomValues(new Uint8Array(step))
|
||||
// A compact alternative for `for (var i = 0; i < step; i++)`.
|
||||
let i = step | 0
|
||||
while (i--) {
|
||||
// Adding `|| ''` refuses a random byte that exceeds the alphabet size.
|
||||
id += alphabet[bytes[i] & mask] || ''
|
||||
if (id.length === size) return id
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
let nanoid = async (size = 21) => {
|
||||
let id = ''
|
||||
let bytes = crypto.getRandomValues(new Uint8Array((size |= 0)))
|
||||
|
||||
// A compact alternative for `for (var i = 0; i < step; i++)`.
|
||||
while (size--) {
|
||||
// It is incorrect to use bytes exceeding the alphabet size.
|
||||
// The following mask reduces the random byte in the 0-255 value
|
||||
// range to the 0-63 value range. Therefore, adding hacks, such
|
||||
// as empty string fallback or magic numbers, is unneccessary because
|
||||
// the bitmask trims bytes down to the alphabet size.
|
||||
let byte = bytes[size] & 63
|
||||
if (byte < 36) {
|
||||
// `0-9a-z`
|
||||
id += byte.toString(36)
|
||||
} else if (byte < 62) {
|
||||
// `A-Z`
|
||||
id += (byte - 26).toString(36).toUpperCase()
|
||||
} else if (byte < 63) {
|
||||
id += '_'
|
||||
} else {
|
||||
id += '-'
|
||||
}
|
||||
}
|
||||
return id
|
||||
}
|
||||
|
||||
module.exports = { nanoid, customAlphabet, random }
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"names":["_checkPrivateRedeclaration","require","_classPrivateFieldInitSpec","obj","privateMap","value","checkPrivateRedeclaration","set"],"sources":["../../src/helpers/classPrivateFieldInitSpec.ts"],"sourcesContent":["/* @minVersion 7.14.1 */\n\nimport checkPrivateRedeclaration from \"./checkPrivateRedeclaration.ts\";\n\nexport default function _classPrivateFieldInitSpec(\n obj: object,\n privateMap: WeakMap<object, unknown>,\n value: unknown,\n) {\n checkPrivateRedeclaration(obj, privateMap);\n privateMap.set(obj, value);\n}\n"],"mappings":";;;;;;AAEA,IAAAA,0BAAA,GAAAC,OAAA;AAEe,SAASC,0BAA0BA,CAChDC,GAAW,EACXC,UAAoC,EACpCC,KAAc,EACd;EACA,IAAAC,kCAAyB,EAACH,GAAG,EAAEC,UAAU,CAAC;EAC1CA,UAAU,CAACG,GAAG,CAACJ,GAAG,EAAEE,KAAK,CAAC;AAC5B","ignoreList":[]}
|
||||
@@ -0,0 +1,19 @@
|
||||
Copyright 2019 Justin Ridgewell <jridgewell@google.com>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
@@ -0,0 +1 @@
|
||||
module.exports={A:{A:{"2":"K D E F mC","8":"A B"},B:{"1":"0 9 Q H R S T U V W X Y Z a b c d e f g h i j k l m n o p q r s t u v w x y z AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB I","8":"C L M G N O P"},C:{"1":"0 9 yB zB 0B 1B 2B 3B 4B 5B 6B 7B 8B 9B AC BC CC DC Q H R OC S T U V W X Y Z a b c d e f g h i j k l m n o p q r s t u v w x y z AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB I PC EC QC RC oC pC","2":"1 2 3 4 5 6 7 8 nC LC J PB K D E F A B C L M G N O P QB RB SB qC rC","8":"TB UB VB WB XB YB ZB aB bB cB dB eB fB gB hB iB jB kB lB mB","456":"nB oB pB qB rB sB tB uB vB","712":"MC wB NC xB"},D:{"1":"0 9 2B 3B 4B 5B 6B 7B 8B 9B AC BC CC DC Q H R S T U V W X Y Z a b c d e f g h i j k l m n o p q r s t u v w x y z AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB I PC EC QC RC","2":"1 2 3 4 5 6 7 8 J PB K D E F A B C L M G N O P QB RB SB TB UB VB WB XB YB ZB aB bB cB dB eB fB gB hB iB jB kB lB mB nB oB","8":"pB qB","132":"rB sB tB uB vB MC wB NC xB yB zB 0B 1B"},E:{"2":"J PB K D sC SC tC uC vC","8":"E F A wC","132":"B C L M G TC FC GC xC yC zC UC VC HC 0C IC WC XC YC ZC aC 1C JC bC cC dC eC fC 2C KC gC hC iC jC 3C"},F:{"1":"0 zB 0B 1B 2B 3B 4B 5B 6B 7B 8B 9B AC BC CC DC Q H R OC S T U V W X Y Z a b c d e f g h i j k l m n o p q r s t u v w x y z","2":"1 2 3 4 5 6 7 8 F B C G N O P QB RB SB TB UB VB WB XB YB ZB aB bB cB dB 4C 5C 6C 7C FC kC 8C GC","132":"eB fB gB hB iB jB kB lB mB nB oB pB qB rB sB tB uB vB wB xB yB"},G:{"2":"E SC 9C lC AD BD CD DD ED FD GD","132":"HD ID JD KD LD MD ND OD PD QD RD SD UC VC HC TD IC WC XC YC ZC aC UD JC bC cC dC eC fC VD KC gC hC iC jC"},H:{"2":"WD"},I:{"1":"I","2":"LC J XD YD ZD aD lC bD cD"},J:{"2":"D A"},K:{"1":"H","2":"A B C FC kC GC"},L:{"1":"I"},M:{"1":"EC"},N:{"2":"A B"},O:{"1":"HC"},P:{"1":"1 2 3 4 5 6 7 8 eD fD gD hD TC iD jD kD lD mD IC JC KC nD","2":"J","132":"dD"},Q:{"1":"oD"},R:{"1":"pD"},S:{"1":"rD","8":"qD"}},B:1,C:"Custom Elements (V1)",D:true};
|
||||
Reference in New Issue
Block a user